Skip to content

Commit

Permalink
NXP: MLK-11476 iio: adc: Enable i.MX6SX adc driver.
Browse files Browse the repository at this point in the history
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 9a1c0b13424b1c8f2cddbe863cdcdc04ecd6a822)

Using this patch to provide a number of channel limitation if the
supported channel number is smaller than the maximum channel number.

Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>
Signed-off-by: Christoph Fritz <chf@fritzc.com>
Signed-off-by: Christian Hemp <c.hemp@phytec.de>
Signed-off-by: Jan Remmet <j.remmet@phytec.de>
Signed-off-by: Yunus Bas <y.bas@phytec.de>
Signed-off-by: Andrej Picej <andrej.picej@norik.com>
Reviewed-by: Yunus Bas <y.bas@phytec.de>
  • Loading branch information
Luwei Zhou authored and FauliSchlumpf committed Apr 27, 2022
1 parent 6d63ed5 commit c7caebc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/iio/adc/vf610_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@ static int vf610_adc_probe(struct platform_device *pdev)
struct iio_dev *indio_dev;
int irq;
int ret;
u32 channels;

indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(struct vf610_adc));
if (!indio_dev) {
Expand Down Expand Up @@ -858,11 +859,16 @@ 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->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) {
Expand Down

0 comments on commit c7caebc

Please sign in to comment.