diff options
-rw-r--r-- | Documentation/devicetree/bindings/arm/atmel-adc.txt | 1 | ||||
-rw-r--r-- | drivers/iio/adc/at91_adc.c | 12 |
2 files changed, 5 insertions, 8 deletions
diff --git a/Documentation/devicetree/bindings/arm/atmel-adc.txt b/Documentation/devicetree/bindings/arm/atmel-adc.txt index 723c205cb10d..0e65e0137487 100644 --- a/Documentation/devicetree/bindings/arm/atmel-adc.txt +++ b/Documentation/devicetree/bindings/arm/atmel-adc.txt | |||
@@ -7,7 +7,6 @@ Required properties: | |||
7 | - interrupts: Should contain the IRQ line for the ADC | 7 | - interrupts: Should contain the IRQ line for the ADC |
8 | - atmel,adc-channels-used: Bitmask of the channels muxed and enable for this | 8 | - atmel,adc-channels-used: Bitmask of the channels muxed and enable for this |
9 | device | 9 | device |
10 | - atmel,adc-num-channels: Number of channels available in the ADC | ||
11 | - atmel,adc-startup-time: Startup Time of the ADC in microseconds as | 10 | - atmel,adc-startup-time: Startup Time of the ADC in microseconds as |
12 | defined in the datasheet | 11 | defined in the datasheet |
13 | - atmel,adc-vref: Reference voltage in millivolts for the conversions | 12 | - atmel,adc-vref: Reference voltage in millivolts for the conversions |
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index abce01b9ff91..690a560e0dab 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c | |||
@@ -43,6 +43,7 @@ struct at91_adc_caps { | |||
43 | /* startup time calculate function */ | 43 | /* startup time calculate function */ |
44 | u32 (*calc_startup_ticks)(u8 startup_time, u32 adc_clk_khz); | 44 | u32 (*calc_startup_ticks)(u8 startup_time, u32 adc_clk_khz); |
45 | 45 | ||
46 | u8 num_channels; | ||
46 | struct at91_adc_reg_desc registers; | 47 | struct at91_adc_reg_desc registers; |
47 | }; | 48 | }; |
48 | 49 | ||
@@ -496,13 +497,6 @@ static int at91_adc_probe_dt(struct at91_adc_state *st, | |||
496 | } | 497 | } |
497 | st->channels_mask = prop; | 498 | st->channels_mask = prop; |
498 | 499 | ||
499 | if (of_property_read_u32(node, "atmel,adc-num-channels", &prop)) { | ||
500 | dev_err(&idev->dev, "Missing adc-num-channels property in the DT.\n"); | ||
501 | ret = -EINVAL; | ||
502 | goto error_ret; | ||
503 | } | ||
504 | st->num_channels = prop; | ||
505 | |||
506 | st->sleep_mode = of_property_read_bool(node, "atmel,adc-sleep-mode"); | 500 | st->sleep_mode = of_property_read_bool(node, "atmel,adc-sleep-mode"); |
507 | 501 | ||
508 | if (of_property_read_u32(node, "atmel,adc-startup-time", &prop)) { | 502 | if (of_property_read_u32(node, "atmel,adc-startup-time", &prop)) { |
@@ -528,6 +522,7 @@ static int at91_adc_probe_dt(struct at91_adc_state *st, | |||
528 | goto error_ret; | 522 | goto error_ret; |
529 | 523 | ||
530 | st->registers = &st->caps->registers; | 524 | st->registers = &st->caps->registers; |
525 | st->num_channels = st->caps->num_channels; | ||
531 | st->trigger_number = of_get_child_count(node); | 526 | st->trigger_number = of_get_child_count(node); |
532 | st->trigger_list = devm_kzalloc(&idev->dev, st->trigger_number * | 527 | st->trigger_list = devm_kzalloc(&idev->dev, st->trigger_number * |
533 | sizeof(struct at91_adc_trigger), | 528 | sizeof(struct at91_adc_trigger), |
@@ -773,6 +768,7 @@ static int at91_adc_remove(struct platform_device *pdev) | |||
773 | #ifdef CONFIG_OF | 768 | #ifdef CONFIG_OF |
774 | static struct at91_adc_caps at91sam9260_caps = { | 769 | static struct at91_adc_caps at91sam9260_caps = { |
775 | .calc_startup_ticks = calc_startup_ticks_9260, | 770 | .calc_startup_ticks = calc_startup_ticks_9260, |
771 | .num_channels = 4, | ||
776 | .registers = { | 772 | .registers = { |
777 | .channel_base = AT91_ADC_CHR(0), | 773 | .channel_base = AT91_ADC_CHR(0), |
778 | .drdy_mask = AT91_ADC_DRDY, | 774 | .drdy_mask = AT91_ADC_DRDY, |
@@ -785,6 +781,7 @@ static struct at91_adc_caps at91sam9260_caps = { | |||
785 | 781 | ||
786 | static struct at91_adc_caps at91sam9g45_caps = { | 782 | static struct at91_adc_caps at91sam9g45_caps = { |
787 | .calc_startup_ticks = calc_startup_ticks_9260, /* same as 9260 */ | 783 | .calc_startup_ticks = calc_startup_ticks_9260, /* same as 9260 */ |
784 | .num_channels = 8, | ||
788 | .registers = { | 785 | .registers = { |
789 | .channel_base = AT91_ADC_CHR(0), | 786 | .channel_base = AT91_ADC_CHR(0), |
790 | .drdy_mask = AT91_ADC_DRDY, | 787 | .drdy_mask = AT91_ADC_DRDY, |
@@ -797,6 +794,7 @@ static struct at91_adc_caps at91sam9g45_caps = { | |||
797 | 794 | ||
798 | static struct at91_adc_caps at91sam9x5_caps = { | 795 | static struct at91_adc_caps at91sam9x5_caps = { |
799 | .calc_startup_ticks = calc_startup_ticks_9x5, | 796 | .calc_startup_ticks = calc_startup_ticks_9x5, |
797 | .num_channels = 12, | ||
800 | .registers = { | 798 | .registers = { |
801 | .channel_base = AT91_ADC_CDR0_9X5, | 799 | .channel_base = AT91_ADC_CDR0_9X5, |
802 | .drdy_mask = AT91_ADC_SR_DRDY_9X5, | 800 | .drdy_mask = AT91_ADC_SR_DRDY_9X5, |