diff options
author | Luwei Zhou <b45643@freescale.com> | 2014-03-06 15:47:47 +0800 |
---|---|---|
committer | Nitin Garg <nitin.garg@nxp.com> | 2016-01-14 11:00:11 -0600 |
commit | 9a1c0b13424b1c8f2cddbe863cdcdc04ecd6a822 (patch) | |
tree | d771ece0b6e6d9578ccefd936f985886fa1c4e0e /drivers/iio | |
parent | 81ed952312e92ebe6f217af3b13d6b5b55e74722 (diff) |
MLK-11476 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 <b45643@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit 14a6a98f64e26702b1c0ecfc7d58a45ee5752d54)
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/adc/vf610_adc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c index 56292ae4538d..b672d82b8830 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-2015 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 @@ -605,6 +605,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) { @@ -655,13 +656,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) { |