Skip to content

Commit 3a456e4

Browse files
Luwei ZhouFauliSchlumpf
Luwei Zhou
authored andcommitted
NXP: 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 <[email protected]> Signed-off-by: Fugang Duan <[email protected]> (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 <[email protected]> Signed-off-by: Christoph Fritz <[email protected]> Signed-off-by: Christian Hemp <[email protected]> Signed-off-by: Jan Remmet <[email protected]> Signed-off-by: Yunus Bas <[email protected]> Signed-off-by: Andrej Picej <[email protected]> Reviewed-by: Yunus Bas <[email protected]>
1 parent 8b5e5ff commit 3a456e4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/iio/adc/vf610_adc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,7 @@ static int vf610_adc_probe(struct platform_device *pdev)
803803
struct iio_dev *indio_dev;
804804
int irq;
805805
int ret;
806+
u32 channels;
806807

807808
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(struct vf610_adc));
808809
if (!indio_dev) {
@@ -858,11 +859,16 @@ static int vf610_adc_probe(struct platform_device *pdev)
858859

859860
init_completion(&info->completion);
860861

862+
ret = of_property_read_u32(pdev->dev.of_node,
863+
"num-channels", &channels);
864+
if (ret)
865+
channels = ARRAY_SIZE(vf610_adc_iio_channels);
866+
861867
indio_dev->name = dev_name(&pdev->dev);
862868
indio_dev->info = &vf610_adc_iio_info;
863869
indio_dev->modes = INDIO_DIRECT_MODE;
864870
indio_dev->channels = vf610_adc_iio_channels;
865-
indio_dev->num_channels = ARRAY_SIZE(vf610_adc_iio_channels);
871+
indio_dev->num_channels = (int)channels;
866872

867873
ret = clk_prepare_enable(info->clk);
868874
if (ret) {

0 commit comments

Comments
 (0)