diff options
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r-- | drivers/iio/adc/Kconfig | 4 | ||||
-rw-r--r-- | drivers/iio/adc/at91_adc.c | 33 | ||||
-rw-r--r-- | drivers/iio/adc/exynos_adc.c | 6 |
3 files changed, 32 insertions, 11 deletions
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index d86196cfe4b4..24c28e3f93a3 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig | |||
@@ -106,7 +106,7 @@ config AT91_ADC | |||
106 | Say yes here to build support for Atmel AT91 ADC. | 106 | Say yes here to build support for Atmel AT91 ADC. |
107 | 107 | ||
108 | config EXYNOS_ADC | 108 | config EXYNOS_ADC |
109 | bool "Exynos ADC driver support" | 109 | tristate "Exynos ADC driver support" |
110 | depends on OF | 110 | depends on OF |
111 | help | 111 | help |
112 | Core support for the ADC block found in the Samsung EXYNOS series | 112 | Core support for the ADC block found in the Samsung EXYNOS series |
@@ -114,7 +114,7 @@ config EXYNOS_ADC | |||
114 | this resource. | 114 | this resource. |
115 | 115 | ||
116 | config LP8788_ADC | 116 | config LP8788_ADC |
117 | bool "LP8788 ADC driver" | 117 | tristate "LP8788 ADC driver" |
118 | depends on MFD_LP8788 | 118 | depends on MFD_LP8788 |
119 | help | 119 | help |
120 | Say yes here to build support for TI LP8788 ADC. | 120 | Say yes here to build support for TI LP8788 ADC. |
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 5b1aa027c034..89777ed9abd8 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c | |||
@@ -765,14 +765,17 @@ static int at91_adc_probe_pdata(struct at91_adc_state *st, | |||
765 | if (!pdata) | 765 | if (!pdata) |
766 | return -EINVAL; | 766 | return -EINVAL; |
767 | 767 | ||
768 | st->caps = (struct at91_adc_caps *) | ||
769 | platform_get_device_id(pdev)->driver_data; | ||
770 | |||
768 | st->use_external = pdata->use_external_triggers; | 771 | st->use_external = pdata->use_external_triggers; |
769 | st->vref_mv = pdata->vref; | 772 | st->vref_mv = pdata->vref; |
770 | st->channels_mask = pdata->channels_used; | 773 | st->channels_mask = pdata->channels_used; |
771 | st->num_channels = pdata->num_channels; | 774 | st->num_channels = st->caps->num_channels; |
772 | st->startup_time = pdata->startup_time; | 775 | st->startup_time = pdata->startup_time; |
773 | st->trigger_number = pdata->trigger_number; | 776 | st->trigger_number = pdata->trigger_number; |
774 | st->trigger_list = pdata->trigger_list; | 777 | st->trigger_list = pdata->trigger_list; |
775 | st->registers = pdata->registers; | 778 | st->registers = &st->caps->registers; |
776 | 779 | ||
777 | return 0; | 780 | return 0; |
778 | } | 781 | } |
@@ -1004,8 +1007,11 @@ static int at91_adc_probe(struct platform_device *pdev) | |||
1004 | * the best converted final value between two channels selection | 1007 | * the best converted final value between two channels selection |
1005 | * The formula thus is : Sample and Hold Time = (shtim + 1) / ADCClock | 1008 | * The formula thus is : Sample and Hold Time = (shtim + 1) / ADCClock |
1006 | */ | 1009 | */ |
1007 | shtim = round_up((st->sample_hold_time * adc_clk_khz / | 1010 | if (st->sample_hold_time > 0) |
1008 | 1000) - 1, 1); | 1011 | shtim = round_up((st->sample_hold_time * adc_clk_khz / 1000) |
1012 | - 1, 1); | ||
1013 | else | ||
1014 | shtim = 0; | ||
1009 | 1015 | ||
1010 | reg = AT91_ADC_PRESCAL_(prsc) & st->registers->mr_prescal_mask; | 1016 | reg = AT91_ADC_PRESCAL_(prsc) & st->registers->mr_prescal_mask; |
1011 | reg |= AT91_ADC_STARTUP_(ticks) & st->registers->mr_startup_mask; | 1017 | reg |= AT91_ADC_STARTUP_(ticks) & st->registers->mr_startup_mask; |
@@ -1101,7 +1107,6 @@ static int at91_adc_remove(struct platform_device *pdev) | |||
1101 | return 0; | 1107 | return 0; |
1102 | } | 1108 | } |
1103 | 1109 | ||
1104 | #ifdef CONFIG_OF | ||
1105 | static struct at91_adc_caps at91sam9260_caps = { | 1110 | static struct at91_adc_caps at91sam9260_caps = { |
1106 | .calc_startup_ticks = calc_startup_ticks_9260, | 1111 | .calc_startup_ticks = calc_startup_ticks_9260, |
1107 | .num_channels = 4, | 1112 | .num_channels = 4, |
@@ -1154,11 +1159,27 @@ static const struct of_device_id at91_adc_dt_ids[] = { | |||
1154 | {}, | 1159 | {}, |
1155 | }; | 1160 | }; |
1156 | MODULE_DEVICE_TABLE(of, at91_adc_dt_ids); | 1161 | MODULE_DEVICE_TABLE(of, at91_adc_dt_ids); |
1157 | #endif | 1162 | |
1163 | static const struct platform_device_id at91_adc_ids[] = { | ||
1164 | { | ||
1165 | .name = "at91sam9260-adc", | ||
1166 | .driver_data = (unsigned long)&at91sam9260_caps, | ||
1167 | }, { | ||
1168 | .name = "at91sam9g45-adc", | ||
1169 | .driver_data = (unsigned long)&at91sam9g45_caps, | ||
1170 | }, { | ||
1171 | .name = "at91sam9x5-adc", | ||
1172 | .driver_data = (unsigned long)&at91sam9x5_caps, | ||
1173 | }, { | ||
1174 | /* terminator */ | ||
1175 | } | ||
1176 | }; | ||
1177 | MODULE_DEVICE_TABLE(platform, at91_adc_ids); | ||
1158 | 1178 | ||
1159 | static struct platform_driver at91_adc_driver = { | 1179 | static struct platform_driver at91_adc_driver = { |
1160 | .probe = at91_adc_probe, | 1180 | .probe = at91_adc_probe, |
1161 | .remove = at91_adc_remove, | 1181 | .remove = at91_adc_remove, |
1182 | .id_table = at91_adc_ids, | ||
1162 | .driver = { | 1183 | .driver = { |
1163 | .name = DRIVER_NAME, | 1184 | .name = DRIVER_NAME, |
1164 | .of_match_table = of_match_ptr(at91_adc_dt_ids), | 1185 | .of_match_table = of_match_ptr(at91_adc_dt_ids), |
diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c index d25b262193a7..affa93f51789 100644 --- a/drivers/iio/adc/exynos_adc.c +++ b/drivers/iio/adc/exynos_adc.c | |||
@@ -344,7 +344,7 @@ static int exynos_adc_probe(struct platform_device *pdev) | |||
344 | 344 | ||
345 | exynos_adc_hw_init(info); | 345 | exynos_adc_hw_init(info); |
346 | 346 | ||
347 | ret = of_platform_populate(np, exynos_adc_match, NULL, &pdev->dev); | 347 | ret = of_platform_populate(np, exynos_adc_match, NULL, &indio_dev->dev); |
348 | if (ret < 0) { | 348 | if (ret < 0) { |
349 | dev_err(&pdev->dev, "failed adding child nodes\n"); | 349 | dev_err(&pdev->dev, "failed adding child nodes\n"); |
350 | goto err_of_populate; | 350 | goto err_of_populate; |
@@ -353,7 +353,7 @@ static int exynos_adc_probe(struct platform_device *pdev) | |||
353 | return 0; | 353 | return 0; |
354 | 354 | ||
355 | err_of_populate: | 355 | err_of_populate: |
356 | device_for_each_child(&pdev->dev, NULL, | 356 | device_for_each_child(&indio_dev->dev, NULL, |
357 | exynos_adc_remove_devices); | 357 | exynos_adc_remove_devices); |
358 | regulator_disable(info->vdd); | 358 | regulator_disable(info->vdd); |
359 | clk_disable_unprepare(info->clk); | 359 | clk_disable_unprepare(info->clk); |
@@ -369,7 +369,7 @@ static int exynos_adc_remove(struct platform_device *pdev) | |||
369 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); | 369 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); |
370 | struct exynos_adc *info = iio_priv(indio_dev); | 370 | struct exynos_adc *info = iio_priv(indio_dev); |
371 | 371 | ||
372 | device_for_each_child(&pdev->dev, NULL, | 372 | device_for_each_child(&indio_dev->dev, NULL, |
373 | exynos_adc_remove_devices); | 373 | exynos_adc_remove_devices); |
374 | regulator_disable(info->vdd); | 374 | regulator_disable(info->vdd); |
375 | clk_disable_unprepare(info->clk); | 375 | clk_disable_unprepare(info->clk); |