From 3024cb5ff62f6838c3bad2d845e2fe74c8ced9de Mon Sep 17 00:00:00 2001 From: Luwei Zhou Date: Thu, 6 Mar 2014 15:47:47 +0800 Subject: ENGR00301869-1 iio: adc: Enable i.MX6SX adc driver. Enable i.MX6SX adc driver. ADC driver will try getting ADC controller channel number via device tree, because i.MX chip enable 4 channels on each controller. Signed-off-by: Luwei Zhou --- drivers/iio/adc/vf610_adc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'drivers/iio') diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c index 37f542e8233c..96d844df0b71 100644 --- a/drivers/iio/adc/vf610_adc.c +++ b/drivers/iio/adc/vf610_adc.c @@ -1,7 +1,7 @@ /* * Freescale Vybrid vf610 ADC driver * - * Copyright 2013 Freescale Semiconductor, Inc. + * Copyright 2013-2014 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -553,6 +553,7 @@ static int vf610_adc_probe(struct platform_device *pdev) struct resource *mem; int irq; int ret; + u32 channels; indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(struct vf610_adc)); if (!indio_dev) { @@ -604,13 +605,18 @@ static int vf610_adc_probe(struct platform_device *pdev) init_completion(&info->completion); + ret = of_property_read_u32(pdev->dev.of_node, + "num-channels", &channels); + if (ret) + channels = ARRAY_SIZE(vf610_adc_iio_channels); + indio_dev->name = dev_name(&pdev->dev); indio_dev->dev.parent = &pdev->dev; indio_dev->dev.of_node = pdev->dev.of_node; indio_dev->info = &vf610_adc_iio_info; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->channels = vf610_adc_iio_channels; - indio_dev->num_channels = ARRAY_SIZE(vf610_adc_iio_channels); + indio_dev->num_channels = (int)channels; ret = clk_prepare_enable(info->clk); if (ret) { -- cgit v1.2.2