Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: adc: aspeed: Add AST2700 ADC support

This patch adds support for the ADCs found on the Aspeed AST2700 SoC,
which includes two instances: "ast2700-adc0" and "ast2700-adc1". While
they are functionally similar to those on AST2600, the OTP trimming data
is located at the same offset (0x820), but uses different bitfields.

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Billy Tsai and committed by
Jonathan Cameron
9d8b88ff 436cd771

+34
+34
drivers/iio/adc/aspeed_adc.c
··· 645 645 .field = GENMASK(7, 4), 646 646 }; 647 647 648 + static const struct aspeed_adc_trim_locate ast2700_adc0_trim = { 649 + .offset = 0x820, 650 + .field = GENMASK(3, 0), 651 + }; 652 + 653 + static const struct aspeed_adc_trim_locate ast2700_adc1_trim = { 654 + .offset = 0x820, 655 + .field = GENMASK(7, 4), 656 + }; 657 + 648 658 static const struct aspeed_adc_model_data ast2400_model_data = { 649 659 .model_name = "ast2400-adc", 650 660 .vref_fixed_mv = 2500, ··· 699 689 .trim_locate = &ast2600_adc1_trim, 700 690 }; 701 691 692 + static const struct aspeed_adc_model_data ast2700_adc0_model_data = { 693 + .model_name = "ast2700-adc0", 694 + .min_sampling_rate = 10000, 695 + .max_sampling_rate = 500000, 696 + .wait_init_sequence = true, 697 + .bat_sense_sup = true, 698 + .scaler_bit_width = 16, 699 + .num_channels = 8, 700 + .trim_locate = &ast2700_adc0_trim, 701 + }; 702 + 703 + static const struct aspeed_adc_model_data ast2700_adc1_model_data = { 704 + .model_name = "ast2700-adc1", 705 + .min_sampling_rate = 10000, 706 + .max_sampling_rate = 500000, 707 + .wait_init_sequence = true, 708 + .bat_sense_sup = true, 709 + .scaler_bit_width = 16, 710 + .num_channels = 8, 711 + .trim_locate = &ast2700_adc1_trim, 712 + }; 713 + 702 714 static const struct of_device_id aspeed_adc_matches[] = { 703 715 { .compatible = "aspeed,ast2400-adc", .data = &ast2400_model_data }, 704 716 { .compatible = "aspeed,ast2500-adc", .data = &ast2500_model_data }, 705 717 { .compatible = "aspeed,ast2600-adc0", .data = &ast2600_adc0_model_data }, 706 718 { .compatible = "aspeed,ast2600-adc1", .data = &ast2600_adc1_model_data }, 719 + { .compatible = "aspeed,ast2700-adc0", .data = &ast2700_adc0_model_data }, 720 + { .compatible = "aspeed,ast2700-adc1", .data = &ast2700_adc1_model_data }, 707 721 { } 708 722 }; 709 723 MODULE_DEVICE_TABLE(of, aspeed_adc_matches);