diff options
author | Luwei Zhou <b45643@freescale.com> | 2014-03-06 02:47:47 -0500 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:57:50 -0400 |
commit | 3024cb5ff62f6838c3bad2d845e2fe74c8ced9de (patch) | |
tree | 798c9eec8c93ca43a1404e5190ad1799cc3058cf /drivers/iio | |
parent | 656983a99a3045aa553537ee5f62da217f65bec4 (diff) |
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 <b45643@freescale.com>
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 37f542e8233c..96d844df0b71 100644 --- a/drivers/iio/adc/vf610_adc.c +++ b/drivers/iio/adc/vf610_adc.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Freescale Vybrid vf610 ADC driver | 2 | * Freescale Vybrid vf610 ADC driver |
3 | * | 3 | * |
4 | * Copyright 2013 Freescale Semiconductor, Inc. | 4 | * Copyright 2013-2014 Freescale Semiconductor, Inc. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * 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) | |||
553 | struct resource *mem; | 553 | struct resource *mem; |
554 | int irq; | 554 | int irq; |
555 | int ret; | 555 | int ret; |
556 | u32 channels; | ||
556 | 557 | ||
557 | indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(struct vf610_adc)); | 558 | indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(struct vf610_adc)); |
558 | if (!indio_dev) { | 559 | if (!indio_dev) { |
@@ -604,13 +605,18 @@ static int vf610_adc_probe(struct platform_device *pdev) | |||
604 | 605 | ||
605 | init_completion(&info->completion); | 606 | init_completion(&info->completion); |
606 | 607 | ||
608 | ret = of_property_read_u32(pdev->dev.of_node, | ||
609 | "num-channels", &channels); | ||
610 | if (ret) | ||
611 | channels = ARRAY_SIZE(vf610_adc_iio_channels); | ||
612 | |||
607 | indio_dev->name = dev_name(&pdev->dev); | 613 | indio_dev->name = dev_name(&pdev->dev); |
608 | indio_dev->dev.parent = &pdev->dev; | 614 | indio_dev->dev.parent = &pdev->dev; |
609 | indio_dev->dev.of_node = pdev->dev.of_node; | 615 | indio_dev->dev.of_node = pdev->dev.of_node; |
610 | indio_dev->info = &vf610_adc_iio_info; | 616 | indio_dev->info = &vf610_adc_iio_info; |
611 | indio_dev->modes = INDIO_DIRECT_MODE; | 617 | indio_dev->modes = INDIO_DIRECT_MODE; |
612 | indio_dev->channels = vf610_adc_iio_channels; | 618 | indio_dev->channels = vf610_adc_iio_channels; |
613 | indio_dev->num_channels = ARRAY_SIZE(vf610_adc_iio_channels); | 619 | indio_dev->num_channels = (int)channels; |
614 | 620 | ||
615 | ret = clk_prepare_enable(info->clk); | 621 | ret = clk_prepare_enable(info->clk); |
616 | if (ret) { | 622 | if (ret) { |