iio: adc: Add support to read parallel charger current channel

Add support to read ADC channel 0xA5 for parallel charger
current.

Some PMICs (PMI632) the max supported current is 5A, hence
define a new config data and compatible string for it.

Change-Id: I973dfdf81ee955d322da7e2c328d8b1472d33013
Signed-off-by: Jishnu Prakash <jprakash@codeaurora.org>
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
This commit is contained in:
Jishnu Prakash 2020-01-10 16:42:59 +05:30 committed by David Collins
parent f90d42fefa
commit 7aac9f426d

View File

@ -602,6 +602,8 @@ static const struct adc5_channels adc5_chans_pmic[ADC5_MAX_CHANNEL] = {
SCALE_HW_CALIB_THERM_100K_PULLUP)
[ADC5_AMUX_THM2] = ADC5_CHAN_TEMP("amux_thm2", 0,
SCALE_HW_CALIB_PM5_SMB_TEMP)
[ADC5_PARALLEL_ISENSE] = ADC5_CHAN_VOLT("parallel_isense", 1,
SCALE_HW_CALIB_CUR)
[ADC5_GPIO1_100K_PU] = ADC5_CHAN_TEMP("gpio1_100k_pu", 0,
SCALE_HW_CALIB_THERM_100K_PULLUP)
[ADC5_GPIO2_100K_PU] = ADC5_CHAN_TEMP("gpio2_100k_pu", 0,
@ -842,6 +844,16 @@ static const struct adc5_data adc7_data_pmic = {
64000, 128000},
};
static const struct adc5_data adc5_data_pmic5_lite = {
.full_scale_code_volt = 0x70e4,
/* On PMI632, IBAT LSB = 5A/32767 */
.full_scale_code_cur = 5000,
.adc_chans = adc5_chans_pmic,
.decimation = (unsigned int []) {250, 420, 840},
.hw_settle_2 = (unsigned int []) {15, 100, 200, 300, 400, 500, 600, 700,
800, 900, 1, 2, 4, 6, 8, 10},
};
static const struct adc5_data adc5_data_pmic_rev2 = {
.full_scale_code_volt = 0x4000,
.full_scale_code_cur = 0x1800,
@ -870,6 +882,10 @@ static const struct of_device_id adc5_match_table[] = {
.compatible = "qcom,spmi-adc-rev2",
.data = &adc5_data_pmic_rev2,
},
{
.compatible = "qcom,spmi-adc5-lite",
.data = &adc5_data_pmic5_lite,
},
{ }
};
MODULE_DEVICE_TABLE(of, adc5_match_table);