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

Configure Feed

Select the types of activity you want to include in your feed.

mfd: axp20x: Add ADC, BAT, and USB cells for AXP717

Add support for the AXP717 PMIC to utilize the ADC (for reading
voltage, current, and temperature information from the PMIC) as well
as the USB charger and battery.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Link: https://lore.kernel.org/r/20240821215456.962564-12-macroalpha82@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Chris Morgan and committed by
Lee Jones
2e1a57d5 8400291e

+50 -1
+24 -1
drivers/mfd/axp20x.c
··· 209 209 }; 210 210 211 211 static const struct regmap_range axp717_writeable_ranges[] = { 212 + regmap_reg_range(AXP717_PMU_FAULT, AXP717_MODULE_EN_CONTROL_1), 213 + regmap_reg_range(AXP717_MIN_SYS_V_CONTROL, AXP717_BOOST_CONTROL), 214 + regmap_reg_range(AXP717_VSYS_V_POWEROFF, AXP717_VSYS_V_POWEROFF), 212 215 regmap_reg_range(AXP717_IRQ0_EN, AXP717_IRQ4_EN), 213 216 regmap_reg_range(AXP717_IRQ0_STATE, AXP717_IRQ4_STATE), 217 + regmap_reg_range(AXP717_ICC_CHG_SET, AXP717_CV_CHG_SET), 214 218 regmap_reg_range(AXP717_DCDC_OUTPUT_CONTROL, AXP717_CPUSLDO_CONTROL), 219 + regmap_reg_range(AXP717_ADC_CH_EN_CONTROL, AXP717_ADC_CH_EN_CONTROL), 220 + regmap_reg_range(AXP717_ADC_DATA_SEL, AXP717_ADC_DATA_SEL), 215 221 }; 216 222 217 223 static const struct regmap_range axp717_volatile_ranges[] = { 224 + regmap_reg_range(AXP717_ON_INDICATE, AXP717_PMU_FAULT), 218 225 regmap_reg_range(AXP717_IRQ0_STATE, AXP717_IRQ4_STATE), 226 + regmap_reg_range(AXP717_BATT_PERCENT_DATA, AXP717_BATT_PERCENT_DATA), 227 + regmap_reg_range(AXP717_BATT_V_H, AXP717_BATT_CHRG_I_L), 228 + regmap_reg_range(AXP717_ADC_DATA_H, AXP717_ADC_DATA_L), 219 229 }; 220 230 221 231 static const struct regmap_access_table axp717_writeable_table = { ··· 316 306 static const struct resource axp22x_usb_power_supply_resources[] = { 317 307 DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"), 318 308 DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_VBUS_REMOVAL, "VBUS_REMOVAL"), 309 + }; 310 + 311 + static const struct resource axp717_usb_power_supply_resources[] = { 312 + DEFINE_RES_IRQ_NAMED(AXP717_IRQ_VBUS_OVER_V, "VBUS_OVER_V"), 313 + DEFINE_RES_IRQ_NAMED(AXP717_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"), 314 + DEFINE_RES_IRQ_NAMED(AXP717_IRQ_VBUS_REMOVAL, "VBUS_REMOVAL"), 319 315 }; 320 316 321 317 /* AXP803 and AXP813/AXP818 share the same interrupts */ ··· 438 422 .val_bits = 8, 439 423 .wr_table = &axp717_writeable_table, 440 424 .volatile_table = &axp717_volatile_table, 441 - .max_register = AXP717_CPUSLDO_CONTROL, 425 + .max_register = AXP717_ADC_DATA_L, 442 426 .cache_type = REGCACHE_MAPLE, 443 427 }; 444 428 ··· 1040 1024 static struct mfd_cell axp717_cells[] = { 1041 1025 MFD_CELL_NAME("axp20x-regulator"), 1042 1026 MFD_CELL_RES("axp20x-pek", axp717_pek_resources), 1027 + MFD_CELL_OF("axp717-adc", 1028 + NULL, NULL, 0, 0, "x-powers,axp717-adc"), 1029 + MFD_CELL_OF("axp20x-usb-power-supply", 1030 + axp717_usb_power_supply_resources, NULL, 0, 0, 1031 + "x-powers,axp717-usb-power-supply"), 1032 + MFD_CELL_OF("axp20x-battery-power-supply", 1033 + NULL, NULL, 0, 0, "x-powers,axp717-battery-power-supply"), 1043 1034 }; 1044 1035 1045 1036 static const struct resource axp288_adc_resources[] = {
+26
include/linux/mfd/axp20x.h
··· 115 115 #define AXP313A_IRQ_STATE 0x21 116 116 117 117 #define AXP717_ON_INDICATE 0x00 118 + #define AXP717_PMU_STATUS_2 0x01 119 + #define AXP717_BC_DETECT 0x05 120 + #define AXP717_PMU_FAULT 0x08 121 + #define AXP717_MODULE_EN_CONTROL_1 0x0b 122 + #define AXP717_MIN_SYS_V_CONTROL 0x15 123 + #define AXP717_INPUT_VOL_LIMIT_CTRL 0x16 124 + #define AXP717_INPUT_CUR_LIMIT_CTRL 0x17 125 + #define AXP717_MODULE_EN_CONTROL_2 0x19 126 + #define AXP717_BOOST_CONTROL 0x1e 127 + #define AXP717_VSYS_V_POWEROFF 0x24 118 128 #define AXP717_IRQ0_EN 0x40 119 129 #define AXP717_IRQ1_EN 0x41 120 130 #define AXP717_IRQ2_EN 0x42 ··· 135 125 #define AXP717_IRQ2_STATE 0x4a 136 126 #define AXP717_IRQ3_STATE 0x4b 137 127 #define AXP717_IRQ4_STATE 0x4c 128 + #define AXP717_ICC_CHG_SET 0x62 129 + #define AXP717_ITERM_CHG_SET 0x63 130 + #define AXP717_CV_CHG_SET 0x64 138 131 #define AXP717_DCDC_OUTPUT_CONTROL 0x80 139 132 #define AXP717_DCDC1_CONTROL 0x83 140 133 #define AXP717_DCDC2_CONTROL 0x84 ··· 158 145 #define AXP717_CLDO3_CONTROL 0x9d 159 146 #define AXP717_CLDO4_CONTROL 0x9e 160 147 #define AXP717_CPUSLDO_CONTROL 0x9f 148 + #define AXP717_BATT_PERCENT_DATA 0xa4 149 + #define AXP717_ADC_CH_EN_CONTROL 0xc0 150 + #define AXP717_BATT_V_H 0xc4 151 + #define AXP717_BATT_V_L 0xc5 152 + #define AXP717_VBUS_V_H 0xc6 153 + #define AXP717_VBUS_V_L 0xc7 154 + #define AXP717_VSYS_V_H 0xc8 155 + #define AXP717_VSYS_V_L 0xc9 156 + #define AXP717_BATT_CHRG_I_H 0xca 157 + #define AXP717_BATT_CHRG_I_L 0xcb 158 + #define AXP717_ADC_DATA_SEL 0xcd 159 + #define AXP717_ADC_DATA_H 0xce 160 + #define AXP717_ADC_DATA_L 0xcf 161 161 162 162 #define AXP806_STARTUP_SRC 0x00 163 163 #define AXP806_CHIP_ID 0x03