[PATCH v2 2/2] iio: Aspeed AST2400/AST2500 ADC

kbuild test robot lkp at intel.com
Thu Mar 23 13:42:19 AEDT 2017


Hi Rick,

[auto build test ERROR on iio/togreg]
[also build test ERROR on v4.11-rc3 next-20170322]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Rick-Altherr/Documentation-dt-bindings-Document-bindings-for-Aspeed-AST2400-AST2500-ADC/20170323-093517
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=ia64 

All error/warnings (new ones prefixed by >>):

   drivers/iio/adc/aspeed_adc.c: In function 'aspeed_adc_read_raw':
>> drivers/iio/adc/aspeed_adc.c:100:39: error: dereferencing pointer to incomplete type 'struct clk_hw'
      *val = clk_get_rate(data->clk_scaler->clk) /
                                          ^~
   drivers/iio/adc/aspeed_adc.c: In function 'aspeed_adc_probe':
>> drivers/iio/adc/aspeed_adc.c:177:20: error: implicit declaration of function 'of_clk_get_parent_name' [-Werror=implicit-function-declaration]
     clk_parent_name = of_clk_get_parent_name(pdev->dev.of_node, 0);
                       ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/iio/adc/aspeed_adc.c:177:18: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     clk_parent_name = of_clk_get_parent_name(pdev->dev.of_node, 0);
                     ^
>> drivers/iio/adc/aspeed_adc.c:179:24: error: implicit declaration of function 'clk_hw_register_divider' [-Werror=implicit-function-declaration]
     data->clk_prescaler = clk_hw_register_divider(
                           ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/aspeed_adc.c:179:22: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     data->clk_prescaler = clk_hw_register_divider(
                         ^
>> drivers/iio/adc/aspeed_adc.c:195:5: error: 'CLK_SET_RATE_PARENT' undeclared (first use in this function)
        CLK_SET_RATE_PARENT,
        ^~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/aspeed_adc.c:195:5: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/iio/adc/aspeed_adc.c:229:2: error: implicit declaration of function 'clk_hw_unregister_divider' [-Werror=implicit-function-declaration]
     clk_hw_unregister_divider(data->clk_scaler);
     ^~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +100 drivers/iio/adc/aspeed_adc.c

    94		case IIO_CHAN_INFO_SCALE:
    95			*val = 2500; // mV
    96			*val2 = 10;
    97			return IIO_VAL_FRACTIONAL_LOG2;
    98	
    99		case IIO_CHAN_INFO_SAMP_FREQ:
 > 100			*val = clk_get_rate(data->clk_scaler->clk) /
   101					ASPEED_ADC_CLOCKS_PER_SAMPLE;
   102			return IIO_VAL_INT;
   103	
   104		default:
   105			return -EINVAL;
   106		}
   107	}
   108	
   109	static int aspeed_adc_write_raw(struct iio_dev *indio_dev,
   110					struct iio_chan_spec const *chan,
   111					int val, int val2, long mask)
   112	{
   113		struct aspeed_adc_data *data = iio_priv(indio_dev);
   114	
   115		switch (mask) {
   116		case IIO_CHAN_INFO_SAMP_FREQ:
   117			if (val < ASPEED_ADC_MIN_SAMP_RATE ||
   118			    val > ASPEED_ADC_MAX_SAMP_RATE)
   119				return -EINVAL;
   120	
   121			clk_set_rate(data->clk_scaler->clk,
   122					val * ASPEED_ADC_CLOCKS_PER_SAMPLE);
   123			return 0;
   124	
   125		default:
   126			return -EINVAL;
   127		}
   128	}
   129	
   130	static int aspeed_adc_reg_access(struct iio_dev *indio_dev,
   131					 unsigned int reg, unsigned int writeval,
   132					 unsigned int *readval)
   133	{
   134		struct aspeed_adc_data *data = iio_priv(indio_dev);
   135	
   136		if (!readval || reg % 4 || reg > ASPEED_ADC_REG_MAX)
   137			return -EINVAL;
   138	
   139		*readval = readl(data->base + reg);
   140		return 0;
   141	}
   142	
   143	static const struct iio_info aspeed_adc_iio_info = {
   144		.driver_module = THIS_MODULE,
   145		.read_raw = &aspeed_adc_read_raw,
   146		.write_raw = &aspeed_adc_write_raw,
   147		.debugfs_reg_access = &aspeed_adc_reg_access,
   148	};
   149	
   150	static int aspeed_adc_probe(struct platform_device *pdev)
   151	{
   152		struct iio_dev *indio_dev;
   153		struct aspeed_adc_data *data;
   154		struct resource *res;
   155		const char *clk_parent_name;
   156		int ret;
   157		u32 adc_engine_control_reg_val;
   158	
   159		indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*data));
   160		if (!indio_dev) {
   161			dev_err(&pdev->dev, "Failed allocating iio device\n");
   162			return -ENOMEM;
   163		}
   164	
   165		data = iio_priv(indio_dev);
   166	
   167		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   168		data->base = devm_ioremap_resource(&pdev->dev, res);
   169		if (IS_ERR(data->base)) {
   170			dev_err(&pdev->dev, "Failed allocating device resources\n");
   171			ret = PTR_ERR(data->base);
   172			goto resource_error;
   173		}
   174	
   175		/* Register ADC clock prescaler with source specified by device tree. */
   176		spin_lock_init(&data->clk_lock);
 > 177		clk_parent_name = of_clk_get_parent_name(pdev->dev.of_node, 0);
   178	
 > 179		data->clk_prescaler = clk_hw_register_divider(
   180					&pdev->dev, "prescaler", clk_parent_name, 0,
   181					data->base + ASPEED_ADC_REG_CLOCK_CONTROL,
   182					17, 15, 0, &data->clk_lock);
   183		if (IS_ERR(data->clk_prescaler)) {
   184			dev_err(&pdev->dev, "Failed allocating prescaler clock\n");
   185			ret = PTR_ERR(data->clk_prescaler);
   186			goto prescaler_error;
   187		}
   188	
   189		/*
   190		 * Register ADC clock scaler downstream from the prescaler. Allow rate
   191		 * setting to adjust the prescaler as well.
   192		 */
   193		data->clk_scaler = clk_hw_register_divider(
   194					&pdev->dev, "scaler", "prescaler",
 > 195					CLK_SET_RATE_PARENT,
   196					data->base + ASPEED_ADC_REG_CLOCK_CONTROL,
   197					0, 10, 0, &data->clk_lock);
   198		if (IS_ERR(data->clk_scaler)) {
   199			dev_err(&pdev->dev, "Failed allocating scaler clock\n");
   200			ret = PTR_ERR(data->clk_scaler);
   201			goto scaler_error;
   202		}
   203	
   204		/* Start all channels in normal mode. */
   205		clk_prepare_enable(data->clk_scaler->clk);
   206		adc_engine_control_reg_val = GENMASK(31, 16) |
   207			ASPEED_ADC_OPERATION_MODE_NORMAL | ASPEED_ADC_ENGINE_ENABLE;
   208		writel(adc_engine_control_reg_val,
   209			data->base + ASPEED_ADC_REG_ENGINE_CONTROL);
   210	
   211		indio_dev->name = dev_name(&pdev->dev);
   212		indio_dev->dev.parent = &pdev->dev;
   213		indio_dev->info = &aspeed_adc_iio_info;
   214		indio_dev->modes = INDIO_DIRECT_MODE;
   215		indio_dev->channels = aspeed_adc_iio_channels;
   216		indio_dev->num_channels = ARRAY_SIZE(aspeed_adc_iio_channels);
   217	
   218		ret = iio_device_register(indio_dev);
   219		if (ret) {
   220			dev_err(&pdev->dev, "Could't register the device.\n");
   221			goto iio_register_error;
   222		}
   223	
   224		return 0;
   225	
   226	iio_register_error:
   227		writel(0x0, data->base + ASPEED_ADC_REG_ENGINE_CONTROL);
   228		clk_disable_unprepare(data->clk_scaler->clk);
 > 229		clk_hw_unregister_divider(data->clk_scaler);
   230	
   231	scaler_error:
   232		clk_hw_unregister_divider(data->clk_prescaler);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 45930 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20170323/a27438e3/attachment-0001.gz>


More information about the openbmc mailing list