diff options
author | Josh Wu <josh.wu@atmel.com> | 2013-10-07 23:48:00 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-10-09 16:15:39 -0400 |
commit | 2b6d598bc9043f51d2092d10392a6e3c161cdff7 (patch) | |
tree | 241b7fba37b8960315fa8b7c5b2f8e34f46a8839 /drivers/iio/adc | |
parent | c46016665fff1dcf08d6046cee45c98781996567 (diff) |
iio: at91: move the num_channels from DT to driver itself
CC: devicetree@vger.kernel.org
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r-- | drivers/iio/adc/at91_adc.c | 12 |
1 files changed, 5 insertions, 7 deletions
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, |