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

Merge tag 'ib-mfd-clk-gpio-power-regulator-rtc-v6.20' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd into gpio/for-next

Immutable branch between MFD, Clk, GPIO, Power, Regulator and RTC due for the v6.20 merge window

+3128 -133
+4 -3
Documentation/devicetree/bindings/leds/rohm,bd71828-leds.yaml
··· 10 10 - Matti Vaittinen <mazziesaccount@gmail.com> 11 11 12 12 description: | 13 - This module is part of the ROHM BD71828 MFD device. For more details 14 - see Documentation/devicetree/bindings/mfd/rohm,bd71828-pmic.yaml. 13 + This module is part of the ROHM BD71828 and BD72720 MFD device. For more 14 + details see Documentation/devicetree/bindings/mfd/rohm,bd71828-pmic.yaml 15 + and Documentation/devicetree/bindings/mfd/rohm,bd72720-pmic.yaml 15 16 16 17 The LED controller is represented as a sub-node of the PMIC node on the device 17 - tree. 18 + tree. This should be located under "leds" - node in PMIC node. 18 19 19 20 The device has two LED outputs referred as GRNLED and AMBLED in data-sheet. 20 21
+339
Documentation/devicetree/bindings/mfd/rohm,bd72720-pmic.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/mfd/rohm,bd72720-pmic.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: ROHM BD72720 Power Management Integrated Circuit 8 + 9 + maintainers: 10 + - Matti Vaittinen <mazziesaccount@gmail.com> 11 + 12 + description: 13 + BD72720 is a single-chip power management IC for battery-powered portable 14 + devices. The BD72720 integrates 10 bucks and 11 LDOs, and a 3000 mA 15 + switching charger. The IC also includes a Coulomb counter, a real-time 16 + clock (RTC), GPIOs and a 32.768 kHz clock gate. 17 + 18 + # In addition to the properties found from the charger node, the ROHM BD72720 19 + # uses properties from a static battery node. Please see the: 20 + # Documentation/devicetree/bindings/power/supply/battery.yaml 21 + # 22 + # Following properties are used 23 + # when present: 24 + # 25 + # charge-full-design-microamp-hours: Battry capacity in mAh 26 + # voltage-max-design-microvolt: Maximum voltage 27 + # voltage-min-design-microvolt: Minimum voltage system is still operating. 28 + # degrade-cycle-microamp-hours: Capacity lost due to aging at each full 29 + # charge cycle. 30 + # ocv-capacity-celsius: Array of OCV table temperatures. 1/table. 31 + # ocv-capacity-table-<N>: Table of OCV voltage/SOC pairs. Corresponds 32 + # N.th temperature in ocv-capacity-celsius 33 + # 34 + # volt-drop-thresh-microvolt: Threshold for starting the VDR correction 35 + # volt-drop-soc: Table of capacity values matching the 36 + # values in VDR tables. 37 + # 38 + # volt-drop-temperatures-millicelsius: Temperatures corresponding to the volage 39 + # drop values given in volt-drop-[0-9]-microvolt 40 + # 41 + # volt-drop-[0-9]-microvolt: VDR table for a temperature specified in 42 + # volt-drop-temperatures-millicelsius 43 + # 44 + # VDR tables are (usually) determined for a specific battery by ROHM. 45 + # The battery node would then be referred from the charger node: 46 + # 47 + # monitored-battery = <&battery>; 48 + 49 + properties: 50 + compatible: 51 + const: rohm,bd72720 52 + 53 + reg: 54 + description: 55 + I2C slave address. 56 + maxItems: 1 57 + 58 + interrupts: 59 + maxItems: 1 60 + 61 + gpio-controller: true 62 + 63 + "#gpio-cells": 64 + const: 2 65 + description: 66 + The first cell is the pin number and the second cell is used to specify 67 + flags. See the gpio binding document for more information. 68 + 69 + clocks: 70 + maxItems: 1 71 + 72 + "#clock-cells": 73 + const: 0 74 + 75 + clock-output-names: 76 + const: bd71828-32k-out 77 + 78 + rohm,clkout-open-drain: 79 + description: clk32kout mode. Set to 1 for "open-drain" or 0 for "cmos". 80 + $ref: /schemas/types.yaml#/definitions/uint32 81 + maximum: 1 82 + 83 + rohm,charger-sense-resistor-micro-ohms: 84 + minimum: 10000 85 + maximum: 50000 86 + description: 87 + BD72720 has a SAR ADC for measuring charging currents. External sense 88 + resistor (RSENSE in data sheet) should be used. If some other but 89 + 30 mOhm resistor is used the resistance value should be given here in 90 + micro Ohms. 91 + 92 + regulators: 93 + $ref: /schemas/regulator/rohm,bd72720-regulator.yaml 94 + description: 95 + List of child nodes that specify the regulators. 96 + 97 + leds: 98 + $ref: /schemas/leds/rohm,bd71828-leds.yaml 99 + 100 + rohm,pin-fault_b: 101 + $ref: /schemas/types.yaml#/definitions/string 102 + description: 103 + BD72720 has an OTP option to use fault_b-pin for different 104 + purposes. Set this property accordingly. OTP options are 105 + OTP0 - bi-directional FAULT_B or READY indicator depending on a 106 + 'sub option' 107 + OTP1 - GPO 108 + OTP2 - Power sequencer output. 109 + enum: 110 + - faultb 111 + - readyind 112 + - gpo 113 + - pwrseq 114 + 115 + patternProperties: 116 + "^rohm,pin-dvs[0-1]$": 117 + $ref: /schemas/types.yaml#/definitions/string 118 + description: 119 + BD72720 has 4 different OTP options to determine the use of dvs<X>-pins. 120 + OTP0 - regulator RUN state control. 121 + OTP1 - GPI. 122 + OTP2 - GPO. 123 + OTP3 - Power sequencer output. 124 + This property specifies the use of the pin. 125 + enum: 126 + - dvs-input 127 + - gpi 128 + - gpo 129 + - pwrseq 130 + 131 + "^rohm,pin-exten[0-1]$": 132 + $ref: /schemas/types.yaml#/definitions/string 133 + description: BD72720 has an OTP option to use exten0-pin for different 134 + purposes. Set this property accordingly. 135 + OTP0 - GPO 136 + OTP1 - Power sequencer output. 137 + enum: 138 + - gpo 139 + - pwrseq 140 + 141 + required: 142 + - compatible 143 + - reg 144 + - interrupts 145 + - clocks 146 + - "#clock-cells" 147 + - regulators 148 + - gpio-controller 149 + - "#gpio-cells" 150 + 151 + additionalProperties: false 152 + 153 + examples: 154 + - | 155 + #include <dt-bindings/interrupt-controller/irq.h> 156 + #include <dt-bindings/leds/common.h> 157 + i2c { 158 + #address-cells = <1>; 159 + #size-cells = <0>; 160 + pmic: pmic@4b { 161 + compatible = "rohm,bd72720"; 162 + reg = <0x4b>; 163 + 164 + interrupt-parent = <&gpio1>; 165 + interrupts = <29 IRQ_TYPE_LEVEL_LOW>; 166 + 167 + clocks = <&osc 0>; 168 + #clock-cells = <0>; 169 + clock-output-names = "bd71828-32k-out"; 170 + 171 + gpio-controller; 172 + #gpio-cells = <2>; 173 + 174 + rohm,pin-dvs0 = "gpi"; 175 + rohm,pin-dvs1 = "gpi"; 176 + rohm,pin-exten0 = "gpo"; 177 + rohm,pin-exten1 = "gpo"; 178 + rohm,pin-fault_b = "faultb"; 179 + 180 + rohm,charger-sense-resistor-micro-ohms = <10000>; 181 + 182 + regulators { 183 + buck1 { 184 + regulator-name = "buck1"; 185 + regulator-min-microvolt = <500000>; 186 + regulator-max-microvolt = <2000000>; 187 + regulator-ramp-delay = <2500>; 188 + }; 189 + buck2 { 190 + regulator-name = "buck2"; 191 + regulator-min-microvolt = <500000>; 192 + regulator-max-microvolt = <2000000>; 193 + regulator-ramp-delay = <2500>; 194 + }; 195 + buck3 { 196 + regulator-name = "buck3"; 197 + regulator-min-microvolt = <1200000>; 198 + regulator-max-microvolt = <2000000>; 199 + }; 200 + buck4 { 201 + regulator-name = "buck4"; 202 + regulator-min-microvolt = <1000000>; 203 + regulator-max-microvolt = <1800000>; 204 + }; 205 + buck5 { 206 + regulator-name = "buck5"; 207 + regulator-min-microvolt = <2500000>; 208 + regulator-max-microvolt = <3300000>; 209 + }; 210 + buck6 { 211 + regulator-name = "buck6"; 212 + regulator-min-microvolt = <500000>; 213 + regulator-max-microvolt = <2000000>; 214 + regulator-ramp-delay = <2500>; 215 + }; 216 + buck7 { 217 + regulator-name = "buck7"; 218 + regulator-min-microvolt = <500000>; 219 + regulator-max-microvolt = <2000000>; 220 + regulator-ramp-delay = <2500>; 221 + }; 222 + buck8 { 223 + regulator-name = "buck8"; 224 + regulator-min-microvolt = <500000>; 225 + regulator-max-microvolt = <1700000>; 226 + regulator-ramp-delay = <2500>; 227 + rohm,dvs-run-voltage = <1700000>; 228 + rohm,dvs-idle-voltage = <1>; 229 + rohm,dvs-suspend-voltage = <1>; 230 + rohm,dvs-lpsr-voltage = <0>; 231 + regulator-boot-on; 232 + }; 233 + buck9 { 234 + regulator-name = "buck9"; 235 + regulator-min-microvolt = <500000>; 236 + regulator-max-microvolt = <1700000>; 237 + regulator-ramp-delay = <2500>; 238 + rohm,dvs-run-voltage = <1700000>; 239 + rohm,dvs-idle-voltage = <1>; 240 + rohm,dvs-suspend-voltage = <1>; 241 + rohm,dvs-lpsr-voltage = <0>; 242 + regulator-boot-on; 243 + }; 244 + buck10 { 245 + regulator-name = "buck10"; 246 + regulator-min-microvolt = <500000>; 247 + regulator-max-microvolt = <1700000>; 248 + regulator-ramp-delay = <2500>; 249 + rohm,dvs-run-voltage = <1700000>; 250 + rohm,dvs-idle-voltage = <1>; 251 + rohm,dvs-suspend-voltage = <1>; 252 + rohm,dvs-lpsr-voltage = <0>; 253 + regulator-boot-on; 254 + }; 255 + ldo1 { 256 + regulator-name = "ldo1"; 257 + regulator-min-microvolt = <800000>; 258 + regulator-max-microvolt = <3300000>; 259 + }; 260 + ldo2 { 261 + regulator-name = "ldo2"; 262 + regulator-min-microvolt = <800000>; 263 + regulator-max-microvolt = <3300000>; 264 + }; 265 + ldo3 { 266 + regulator-name = "ldo3"; 267 + regulator-min-microvolt = <800000>; 268 + regulator-max-microvolt = <3300000>; 269 + }; 270 + ldo4 { 271 + regulator-name = "ldo4"; 272 + regulator-min-microvolt = <800000>; 273 + regulator-max-microvolt = <3300000>; 274 + }; 275 + ldo5 { 276 + regulator-name = "ldo5"; 277 + regulator-min-microvolt = <800000>; 278 + regulator-max-microvolt = <3300000>; 279 + }; 280 + ldo6 { 281 + regulator-name = "ldo6"; 282 + regulator-min-microvolt = <1800000>; 283 + regulator-max-microvolt = <1800000>; 284 + }; 285 + ldo7 { 286 + regulator-name = "ldo7"; 287 + regulator-min-microvolt = <800000>; 288 + regulator-max-microvolt = <3300000>; 289 + }; 290 + ldo8 { 291 + regulator-name = "ldo8"; 292 + regulator-min-microvolt = <750000>; 293 + regulator-max-microvolt = <3300000>; 294 + rohm,dvs-suspend-voltage = <0>; 295 + rohm,dvs-lpsr-voltage = <1>; 296 + rohm,dvs-run-voltage = <750000>; 297 + }; 298 + ldo9 { 299 + regulator-name = "ldo9"; 300 + regulator-min-microvolt = <750000>; 301 + regulator-max-microvolt = <3300000>; 302 + rohm,dvs-suspend-voltage = <0>; 303 + rohm,dvs-lpsr-voltage = <1>; 304 + rohm,dvs-run-voltage = <750000>; 305 + }; 306 + ldo10 { 307 + regulator-name = "ldo10"; 308 + regulator-min-microvolt = <750000>; 309 + regulator-max-microvolt = <3300000>; 310 + rohm,dvs-suspend-voltage = <0>; 311 + rohm,dvs-lpsr-voltage = <1>; 312 + rohm,dvs-run-voltage = <750000>; 313 + }; 314 + ldo11 { 315 + regulator-name = "ldo11"; 316 + regulator-min-microvolt = <750000>; 317 + regulator-max-microvolt = <3300000>; 318 + rohm,dvs-suspend-voltage = <0>; 319 + rohm,dvs-lpsr-voltage = <1>; 320 + rohm,dvs-run-voltage = <750000>; 321 + }; 322 + }; 323 + 324 + leds { 325 + compatible = "rohm,bd71828-leds"; 326 + 327 + led-1 { 328 + rohm,led-compatible = "bd71828-grnled"; 329 + function = LED_FUNCTION_INDICATOR; 330 + color = <LED_COLOR_ID_GREEN>; 331 + }; 332 + led-2 { 333 + rohm,led-compatible = "bd71828-ambled"; 334 + function = LED_FUNCTION_CHARGING; 335 + color = <LED_COLOR_ID_AMBER>; 336 + }; 337 + }; 338 + }; 339 + };
+32 -1
Documentation/devicetree/bindings/power/supply/battery.yaml
··· 64 64 description: battery design capacity 65 65 66 66 trickle-charge-current-microamp: 67 - description: current for trickle-charge phase 67 + description: current for trickle-charge phase. 68 + Please note that the trickle-charging here, refers "wake-up" or 69 + "pre-pre" -charging, for very empty batteries. Similar term is also 70 + used for "maintenance" or "top-off" -charging of batteries (like 71 + NiMh bq24400) - that is different and not controlled by this 72 + property. 73 + 74 + tricklecharge-upper-limit-microvolt: 75 + description: limit when to change to precharge from trickle charge 76 + Trickle-charging here refers "wake-up" or "pre-pre" -charging. 68 77 69 78 precharge-current-microamp: 70 79 description: current for pre-charge phase ··· 128 119 - description: alert when battery temperature is lower than this value 129 120 - description: alert when battery temperature is higher than this value 130 121 122 + # The volt-drop* -properties describe voltage-drop for a battery, described 123 + # as VDROP in: 124 + # https://patentimages.storage.googleapis.com/6c/f5/17/c1d901c220f6a9/US20150032394A1.pdf 125 + volt-drop-thresh-microvolt: 126 + description: Threshold for starting the VDR correction 127 + maximum: 48000000 128 + 129 + volt-drop-soc-bp: 130 + description: Table of capacity values matching the values in VDR tables. 131 + The value should be given as basis points, 1/100 of a percent. 132 + 133 + volt-drop-temperatures-millicelsius: 134 + description: An array containing the temperature in milli celsius, for each 135 + of the VDR lookup table. 136 + 131 137 required: 132 138 - compatible 133 139 ··· 160 136 - description: open circuit voltage (OCV) in microvolts 161 137 - description: battery capacity percent 162 138 maximum: 100 139 + 140 + '^volt-drop-[0-9]-microvolt': 141 + description: Table of the voltage drop rate (VDR) values. Each entry in the 142 + table should match a capacity value in the volt-drop-soc table. 143 + Furthermore, the values should be obtained for the temperature given in 144 + volt-drop-temperatures-millicelsius table at index matching the 145 + number in this table's name. 163 146 164 147 additionalProperties: false 165 148
+148
Documentation/devicetree/bindings/regulator/rohm,bd72720-regulator.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/regulator/rohm,bd72720-regulator.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: ROHM BD72720 Power Management Integrated Circuit regulators 8 + 9 + maintainers: 10 + - Matti Vaittinen <mazziesaccount@gmail.com> 11 + 12 + description: | 13 + This module is part of the ROHM BD72720 MFD device. For more details 14 + see Documentation/devicetree/bindings/mfd/rohm,bd72720-pmic.yaml. 15 + 16 + The regulator controller is represented as a sub-node of the PMIC node 17 + on the device tree. 18 + 19 + Regulator nodes should be named to BUCK_<number> and LDO_<number>. 20 + The valid names for BD72720 regulator nodes are 21 + buck1, buck2, buck3, buck4, buck5, buck6, buck7, buck8, buck9, buck10 22 + ldo1, ldo2, ldo3, ldo4, ldo5, ldo6, ldo7, ldo8, ldo9, ldo10, ldo11 23 + 24 + patternProperties: 25 + "^ldo([1-9]|1[0-1])$": 26 + type: object 27 + description: 28 + Properties for single LDO regulator. 29 + $ref: regulator.yaml# 30 + 31 + properties: 32 + regulator-name: 33 + pattern: "^ldo([1-9]|1[0-1])$" 34 + 35 + rohm,dvs-run-voltage: 36 + description: 37 + PMIC default "RUN" state voltage in uV. See below table for 38 + LDOs which support this. 0 means disabled. 39 + $ref: /schemas/types.yaml#/definitions/uint32 40 + minimum: 0 41 + maximum: 3300000 42 + 43 + rohm,dvs-idle-voltage: 44 + description: 45 + PMIC default "IDLE" state voltage in uV. See below table for 46 + LDOs which support this. 0 means disabled. 47 + $ref: /schemas/types.yaml#/definitions/uint32 48 + minimum: 0 49 + maximum: 3300000 50 + 51 + rohm,dvs-suspend-voltage: 52 + description: 53 + PMIC default "SUSPEND" state voltage in uV. See below table for 54 + LDOs which support this. 0 means disabled. 55 + $ref: /schemas/types.yaml#/definitions/uint32 56 + minimum: 0 57 + maximum: 3300000 58 + 59 + rohm,dvs-lpsr-voltage: 60 + description: 61 + PMIC default "deep-idle" state voltage in uV. See below table for 62 + LDOs which support this. 0 means disabled. 63 + $ref: /schemas/types.yaml#/definitions/uint32 64 + minimum: 0 65 + maximum: 3300000 66 + 67 + # Supported default DVS states: 68 + # ldo | run | idle | suspend | lpsr 69 + # -------------------------------------------------------------- 70 + # 1, 2, 3, and 4 | supported | supported | supported | supported 71 + # -------------------------------------------------------------- 72 + # 5 - 11 | supported (*) 73 + # -------------------------------------------------------------- 74 + # 75 + # (*) All states use same voltage but have own enable / disable 76 + # settings. Voltage 0 can be specified for a state to make 77 + # regulator disabled on that state. 78 + 79 + unevaluatedProperties: false 80 + 81 + "^buck([1-9]|10)$": 82 + type: object 83 + description: 84 + Properties for single BUCK regulator. 85 + $ref: regulator.yaml# 86 + 87 + properties: 88 + regulator-name: 89 + pattern: "^buck([1-9]|10)$" 90 + 91 + rohm,ldon-head-microvolt: 92 + description: 93 + Set this on boards where BUCK10 is used to supply LDOs 1-4. The bucki 94 + voltage will be changed by the PMIC to follow the LDO output voltages 95 + with the offset voltage given here. This will improve the LDO efficiency. 96 + minimum: 50000 97 + maximum: 300000 98 + 99 + rohm,dvs-run-voltage: 100 + description: 101 + PMIC default "RUN" state voltage in uV. See below table for 102 + bucks which support this. 0 means disabled. 103 + $ref: /schemas/types.yaml#/definitions/uint32 104 + minimum: 0 105 + maximum: 3300000 106 + 107 + rohm,dvs-idle-voltage: 108 + description: 109 + PMIC default "IDLE" state voltage in uV. See below table for 110 + bucks which support this. 0 means disabled. 111 + $ref: /schemas/types.yaml#/definitions/uint32 112 + minimum: 0 113 + maximum: 3300000 114 + 115 + rohm,dvs-suspend-voltage: 116 + description: 117 + PMIC default "SUSPEND" state voltage in uV. See below table for 118 + bucks which support this. 0 means disabled. 119 + $ref: /schemas/types.yaml#/definitions/uint32 120 + minimum: 0 121 + maximum: 3300000 122 + 123 + rohm,dvs-lpsr-voltage: 124 + description: 125 + PMIC default "deep-idle" state voltage in uV. See below table for 126 + bucks which support this. 0 means disabled. 127 + $ref: /schemas/types.yaml#/definitions/uint32 128 + minimum: 0 129 + maximum: 3300000 130 + 131 + # Supported default DVS states: 132 + # buck | run | idle | suspend | lpsr 133 + # -------------------------------------------------------------- 134 + # 1, 2, 3, and 4 | supported | supported | supported | supported 135 + # -------------------------------------------------------------- 136 + # 5 - 10 | supported (*) 137 + # -------------------------------------------------------------- 138 + # 139 + # (*) All states use same voltage but have own enable / disable 140 + # settings. Voltage 0 can be specified for a state to make 141 + # regulator disabled on that state. 142 + 143 + required: 144 + - regulator-name 145 + 146 + unevaluatedProperties: false 147 + 148 + additionalProperties: false
+2
MAINTAINERS
··· 22759 22759 F: drivers/clk/clk-bd718x7.c 22760 22760 F: drivers/gpio/gpio-bd71815.c 22761 22761 F: drivers/gpio/gpio-bd71828.c 22762 + F: drivers/gpio/gpio-bd72720.c 22762 22763 F: drivers/mfd/rohm-bd71828.c 22763 22764 F: drivers/mfd/rohm-bd718x7.c 22764 22765 F: drivers/mfd/rohm-bd9576.c ··· 22776 22775 F: include/linux/mfd/rohm-bd71815.h 22777 22776 F: include/linux/mfd/rohm-bd71828.h 22778 22777 F: include/linux/mfd/rohm-bd718x7.h 22778 + F: include/linux/mfd/rohm-bd72720.h 22779 22779 F: include/linux/mfd/rohm-bd957x.h 22780 22780 F: include/linux/mfd/rohm-bd96801.h 22781 22781 F: include/linux/mfd/rohm-bd96802.h
+2 -2
drivers/clk/Kconfig
··· 475 475 tristate "Clock driver for 32K clk gates on ROHM PMICs" 476 476 depends on MFD_ROHM_BD718XX || MFD_ROHM_BD71828 477 477 help 478 - This driver supports ROHM BD71837, BD71847, BD71850, BD71815 479 - and BD71828 PMICs clock gates. 478 + This driver supports ROHM BD71837, BD71847, BD71850, BD71815, 479 + BD71828, and BD72720 PMICs clock gates. 480 480 481 481 config COMMON_CLK_FIXED_MMIO 482 482 bool "Clock driver for Memory Mapped Fixed values"
+8 -2
drivers/clk/clk-bd718x7.c
··· 19 19 #define BD71828_REG_OUT32K 0x4B 20 20 /* BD71837 and BD71847 */ 21 21 #define BD718XX_REG_OUT32K 0x2E 22 - 22 + /* BD72720 */ 23 + #define BD72720_REG_OUT32K 0x9a 23 24 /* 24 25 * BD71837, BD71847, and BD71828 all use bit [0] to clk output control 25 26 */ ··· 119 118 c->reg = BD71815_REG_OUT32K; 120 119 c->mask = CLK_OUT_EN_MASK; 121 120 break; 121 + case ROHM_CHIP_TYPE_BD72720: 122 + c->reg = BD72720_REG_OUT32K; 123 + c->mask = CLK_OUT_EN_MASK; 124 + break; 122 125 default: 123 126 dev_err(&pdev->dev, "Unknown clk chip\n"); 124 127 return -EINVAL; ··· 151 146 { "bd71847-clk", ROHM_CHIP_TYPE_BD71847 }, 152 147 { "bd71828-clk", ROHM_CHIP_TYPE_BD71828 }, 153 148 { "bd71815-clk", ROHM_CHIP_TYPE_BD71815 }, 149 + { "bd72720-clk", ROHM_CHIP_TYPE_BD72720 }, 154 150 { }, 155 151 }; 156 152 MODULE_DEVICE_TABLE(platform, bd718x7_clk_id); ··· 167 161 module_platform_driver(bd71837_clk); 168 162 169 163 MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>"); 170 - MODULE_DESCRIPTION("BD718(15/18/28/37/47/50) and chip clk driver"); 164 + MODULE_DESCRIPTION("BD718(15/18/28/37/47/50) and BD72720 chip clk driver"); 171 165 MODULE_LICENSE("GPL"); 172 166 MODULE_ALIAS("platform:bd718xx-clk");
+9
drivers/gpio/Kconfig
··· 1317 1317 This driver can also be built as a module. If so, the module 1318 1318 will be called gpio-bd71828. 1319 1319 1320 + config GPIO_BD72720 1321 + tristate "ROHM BD72720 and BD73900 PMIC GPIO support" 1322 + depends on MFD_ROHM_BD71828 1323 + help 1324 + Support for GPIO on ROHM BD72720 and BD73900 PMICs. There are two 1325 + pins which can be configured to GPI or GPO, and three pins which can 1326 + be configured to GPO on the ROHM PMIC. The pin configuration is done 1327 + on OTP at manufacturing. 1328 + 1320 1329 config GPIO_BD9571MWV 1321 1330 tristate "ROHM BD9571 GPIO support" 1322 1331 depends on MFD_BD9571MWV
+1
drivers/gpio/Makefile
··· 46 46 obj-$(CONFIG_GPIO_BCM_XGS_IPROC) += gpio-xgs-iproc.o 47 47 obj-$(CONFIG_GPIO_BD71815) += gpio-bd71815.o 48 48 obj-$(CONFIG_GPIO_BD71828) += gpio-bd71828.o 49 + obj-$(CONFIG_GPIO_BD72720) += gpio-bd72720.o 49 50 obj-$(CONFIG_GPIO_BD9571MWV) += gpio-bd9571mwv.o 50 51 obj-$(CONFIG_GPIO_BLZP1600) += gpio-blzp1600.o 51 52 obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o
+281
drivers/gpio/gpio-bd72720.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Support to GPIOs on ROHM BD72720 and BD79300 4 + * Copyright 2025 ROHM Semiconductors. 5 + * Author: Matti Vaittinen <mazziesaccount@gmail.com> 6 + */ 7 + 8 + #include <linux/gpio/driver.h> 9 + #include <linux/init.h> 10 + #include <linux/irq.h> 11 + #include <linux/module.h> 12 + #include <linux/of.h> 13 + #include <linux/platform_device.h> 14 + #include <linux/mfd/rohm-bd72720.h> 15 + 16 + #define BD72720_GPIO_OPEN_DRAIN 0 17 + #define BD72720_GPIO_CMOS BIT(1) 18 + #define BD72720_INT_GPIO1_IN_SRC 4 19 + /* 20 + * The BD72720 has several "one time programmable" (OTP) configurations which 21 + * can be set at manufacturing phase. A set of these options allow using pins 22 + * as GPIO. The OTP configuration can't be read at run-time, so drivers rely on 23 + * device-tree to advertise the correct options. 24 + * 25 + * Both DVS[0,1] pins can be configured to be used for: 26 + * - OTP0: regulator RUN state control 27 + * - OTP1: GPI 28 + * - OTP2: GPO 29 + * - OTP3: Power sequencer output 30 + * Data-sheet also states that these PINs can always be used for IRQ but the 31 + * driver limits this by allowing them to be used for IRQs with OTP1 only. 32 + * 33 + * Pins GPIO_EXTEN0 (GPIO3), GPIO_EXTEN1 (GPIO4), GPIO_FAULT_B (GPIO5) have OTP 34 + * options for a specific (non GPIO) purposes, but also an option to configure 35 + * them to be used as a GPO. 36 + * 37 + * OTP settings can be separately configured for each pin. 38 + * 39 + * DT properties: 40 + * "rohm,pin-dvs0" and "rohm,pin-dvs1" can be set to one of the values: 41 + * "dvs-input", "gpi", "gpo". 42 + * 43 + * "rohm,pin-exten0", "rohm,pin-exten1" and "rohm,pin-fault_b" can be set to: 44 + * "gpo" 45 + */ 46 + 47 + enum bd72720_gpio_state { 48 + BD72720_PIN_UNKNOWN, 49 + BD72720_PIN_GPI, 50 + BD72720_PIN_GPO, 51 + }; 52 + 53 + enum { 54 + BD72720_GPIO1, 55 + BD72720_GPIO2, 56 + BD72720_GPIO3, 57 + BD72720_GPIO4, 58 + BD72720_GPIO5, 59 + BD72720_GPIO_EPDEN, 60 + BD72720_NUM_GPIOS 61 + }; 62 + 63 + struct bd72720_gpio { 64 + /* chip.parent points the MFD which provides DT node and regmap */ 65 + struct gpio_chip chip; 66 + /* dev points to the platform device for devm and prints */ 67 + struct device *dev; 68 + struct regmap *regmap; 69 + int gpio_is_input; 70 + }; 71 + 72 + static int bd72720gpi_get(struct bd72720_gpio *bdgpio, unsigned int reg_offset) 73 + { 74 + int ret, val, shift; 75 + 76 + ret = regmap_read(bdgpio->regmap, BD72720_REG_INT_ETC1_SRC, &val); 77 + if (ret) 78 + return ret; 79 + 80 + shift = BD72720_INT_GPIO1_IN_SRC + reg_offset; 81 + 82 + return (val >> shift) & 1; 83 + } 84 + 85 + static int bd72720gpo_get(struct bd72720_gpio *bdgpio, 86 + unsigned int offset) 87 + { 88 + const int regs[] = { BD72720_REG_GPIO1_CTRL, BD72720_REG_GPIO2_CTRL, 89 + BD72720_REG_GPIO3_CTRL, BD72720_REG_GPIO4_CTRL, 90 + BD72720_REG_GPIO5_CTRL, BD72720_REG_EPDEN_CTRL }; 91 + int ret, val; 92 + 93 + ret = regmap_read(bdgpio->regmap, regs[offset], &val); 94 + if (ret) 95 + return ret; 96 + 97 + return val & BD72720_GPIO_HIGH; 98 + } 99 + 100 + static int bd72720gpio_get(struct gpio_chip *chip, unsigned int offset) 101 + { 102 + struct bd72720_gpio *bdgpio = gpiochip_get_data(chip); 103 + 104 + if (BIT(offset) & bdgpio->gpio_is_input) 105 + return bd72720gpi_get(bdgpio, offset); 106 + 107 + return bd72720gpo_get(bdgpio, offset); 108 + } 109 + 110 + static int bd72720gpo_set(struct gpio_chip *chip, unsigned int offset, 111 + int value) 112 + { 113 + struct bd72720_gpio *bdgpio = gpiochip_get_data(chip); 114 + const int regs[] = { BD72720_REG_GPIO1_CTRL, BD72720_REG_GPIO2_CTRL, 115 + BD72720_REG_GPIO3_CTRL, BD72720_REG_GPIO4_CTRL, 116 + BD72720_REG_GPIO5_CTRL, BD72720_REG_EPDEN_CTRL }; 117 + 118 + if (BIT(offset) & bdgpio->gpio_is_input) { 119 + dev_dbg(bdgpio->dev, "pin %d not output.\n", offset); 120 + return -EINVAL; 121 + } 122 + 123 + if (value) 124 + return regmap_set_bits(bdgpio->regmap, regs[offset], 125 + BD72720_GPIO_HIGH); 126 + 127 + return regmap_clear_bits(bdgpio->regmap, regs[offset], 128 + BD72720_GPIO_HIGH); 129 + } 130 + 131 + static int bd72720_gpio_set_config(struct gpio_chip *chip, unsigned int offset, 132 + unsigned long config) 133 + { 134 + struct bd72720_gpio *bdgpio = gpiochip_get_data(chip); 135 + const int regs[] = { BD72720_REG_GPIO1_CTRL, BD72720_REG_GPIO2_CTRL, 136 + BD72720_REG_GPIO3_CTRL, BD72720_REG_GPIO4_CTRL, 137 + BD72720_REG_GPIO5_CTRL, BD72720_REG_EPDEN_CTRL }; 138 + 139 + /* 140 + * We can only set the output mode, which makes sense only when output 141 + * OTP configuration is used. 142 + */ 143 + if (BIT(offset) & bdgpio->gpio_is_input) 144 + return -ENOTSUPP; 145 + 146 + switch (pinconf_to_config_param(config)) { 147 + case PIN_CONFIG_DRIVE_OPEN_DRAIN: 148 + return regmap_update_bits(bdgpio->regmap, 149 + regs[offset], 150 + BD72720_GPIO_DRIVE_MASK, 151 + BD72720_GPIO_OPEN_DRAIN); 152 + case PIN_CONFIG_DRIVE_PUSH_PULL: 153 + return regmap_update_bits(bdgpio->regmap, 154 + regs[offset], 155 + BD72720_GPIO_DRIVE_MASK, 156 + BD72720_GPIO_CMOS); 157 + default: 158 + break; 159 + } 160 + 161 + return -ENOTSUPP; 162 + } 163 + 164 + static int bd72720gpo_direction_get(struct gpio_chip *chip, 165 + unsigned int offset) 166 + { 167 + struct bd72720_gpio *bdgpio = gpiochip_get_data(chip); 168 + 169 + if (BIT(offset) & bdgpio->gpio_is_input) 170 + return GPIO_LINE_DIRECTION_IN; 171 + 172 + return GPIO_LINE_DIRECTION_OUT; 173 + } 174 + 175 + static int bd72720_valid_mask(struct gpio_chip *gc, 176 + unsigned long *valid_mask, 177 + unsigned int ngpios) 178 + { 179 + static const char * const properties[] = { 180 + "rohm,pin-dvs0", "rohm,pin-dvs1", "rohm,pin-exten0", 181 + "rohm,pin-exten1", "rohm,pin-fault_b" 182 + }; 183 + struct bd72720_gpio *g = gpiochip_get_data(gc); 184 + const char *val; 185 + int i, ret; 186 + 187 + *valid_mask = BIT(BD72720_GPIO_EPDEN); 188 + 189 + if (!gc->parent) 190 + return 0; 191 + 192 + for (i = 0; i < ARRAY_SIZE(properties); i++) { 193 + ret = fwnode_property_read_string(dev_fwnode(gc->parent), 194 + properties[i], &val); 195 + 196 + if (ret) { 197 + if (ret == -EINVAL) 198 + continue; 199 + 200 + dev_err(g->dev, "pin %d (%s), bad configuration\n", i, 201 + properties[i]); 202 + 203 + return ret; 204 + } 205 + 206 + if (strcmp(val, "gpi") == 0) { 207 + if (i != BD72720_GPIO1 && i != BD72720_GPIO2) { 208 + dev_warn(g->dev, 209 + "pin %d (%s) does not support INPUT mode", 210 + i, properties[i]); 211 + continue; 212 + } 213 + 214 + *valid_mask |= BIT(i); 215 + g->gpio_is_input |= BIT(i); 216 + } else if (strcmp(val, "gpo") == 0) { 217 + *valid_mask |= BIT(i); 218 + } 219 + } 220 + 221 + return 0; 222 + } 223 + 224 + /* Template for GPIO chip */ 225 + static const struct gpio_chip bd72720gpo_chip = { 226 + .label = "bd72720", 227 + .owner = THIS_MODULE, 228 + .get = bd72720gpio_get, 229 + .get_direction = bd72720gpo_direction_get, 230 + .set = bd72720gpo_set, 231 + .set_config = bd72720_gpio_set_config, 232 + .init_valid_mask = bd72720_valid_mask, 233 + .can_sleep = true, 234 + .ngpio = BD72720_NUM_GPIOS, 235 + .base = -1, 236 + }; 237 + 238 + static int gpo_bd72720_probe(struct platform_device *pdev) 239 + { 240 + struct bd72720_gpio *g; 241 + struct device *parent, *dev; 242 + 243 + /* 244 + * Bind devm lifetime to this platform device => use dev for devm. 245 + * also the prints should originate from this device. 246 + */ 247 + dev = &pdev->dev; 248 + /* The device-tree and regmap come from MFD => use parent for that */ 249 + parent = dev->parent; 250 + 251 + g = devm_kzalloc(dev, sizeof(*g), GFP_KERNEL); 252 + if (!g) 253 + return -ENOMEM; 254 + 255 + g->chip = bd72720gpo_chip; 256 + g->dev = dev; 257 + g->chip.parent = parent; 258 + g->regmap = dev_get_regmap(parent, NULL); 259 + 260 + return devm_gpiochip_add_data(dev, &g->chip, g); 261 + } 262 + 263 + static const struct platform_device_id bd72720_gpio_id[] = { 264 + { "bd72720-gpio" }, 265 + { }, 266 + }; 267 + MODULE_DEVICE_TABLE(platform, bd72720_gpio_id); 268 + 269 + static struct platform_driver gpo_bd72720_driver = { 270 + .driver = { 271 + .name = "bd72720-gpio", 272 + .probe_type = PROBE_PREFER_ASYNCHRONOUS, 273 + }, 274 + .probe = gpo_bd72720_probe, 275 + .id_table = bd72720_gpio_id, 276 + }; 277 + module_platform_driver(gpo_bd72720_driver); 278 + 279 + MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>"); 280 + MODULE_DESCRIPTION("GPIO interface for BD72720 and BD73900"); 281 + MODULE_LICENSE("GPL");
+10 -8
drivers/mfd/Kconfig
··· 2217 2217 and emergency shut down as well as 32,768KHz clock output. 2218 2218 2219 2219 config MFD_ROHM_BD71828 2220 - tristate "ROHM BD71828 and BD71815 Power Management IC" 2220 + tristate "ROHM BD718[15/28/79], BD72720 and BD73900 PMICs" 2221 2221 depends on I2C=y 2222 2222 depends on OF 2223 2223 select REGMAP_I2C 2224 2224 select REGMAP_IRQ 2225 2225 select MFD_CORE 2226 2226 help 2227 - Select this option to get support for the ROHM BD71828 and BD71815 2228 - Power Management ICs. BD71828GW and BD71815AGW are single-chip power 2229 - management ICs mainly for battery-powered portable devices. 2230 - The BD71828 integrates 7 buck converters and 7 LDOs. The BD71815 2231 - has 5 bucks, 7 LDOs, and a boost for driving LEDs. Both ICs provide 2232 - also a single-cell linear charger, a Coulomb counter, a real-time 2233 - clock (RTC), GPIOs and a 32.768 kHz clock gate. 2227 + Select this option to get support for the ROHM BD71815, BD71828, 2228 + BD71879, BD72720 and BD73900 Power Management ICs (PMICs). These are 2229 + single-chip Power Management ICs (PMIC), mainly for battery-powered 2230 + portable devices. 2231 + The BD71815 has 5 bucks, 7 LDOs, and a boost for driving LEDs. 2232 + The BD718[28/79] have 7 buck converters and 7 LDOs. 2233 + The BD72720 and the BD73900 have 10 bucks and 11 LDOs. 2234 + All ICs provide a single-cell linear charger, a Coulomb counter, 2235 + a Real-Time Clock (RTC), GPIOs and a 32.768 kHz clock gate. 2234 2236 2235 2237 config MFD_ROHM_BD957XMUF 2236 2238 tristate "ROHM BD9576MUF and BD9573MUF Power Management ICs"
+503 -52
drivers/mfd/rohm-bd71828.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 - // 3 - // Copyright (C) 2019 ROHM Semiconductors 4 - // 5 - // ROHM BD71828/BD71815 PMIC driver 2 + /* 3 + * Copyright (C) 2019 ROHM Semiconductors 4 + * 5 + * ROHM BD718[15/28/79] and BD72720 PMIC driver 6 + */ 6 7 7 8 #include <linux/gpio_keys.h> 8 9 #include <linux/i2c.h> ··· 14 13 #include <linux/mfd/core.h> 15 14 #include <linux/mfd/rohm-bd71815.h> 16 15 #include <linux/mfd/rohm-bd71828.h> 16 + #include <linux/mfd/rohm-bd72720.h> 17 17 #include <linux/mfd/rohm-generic.h> 18 18 #include <linux/module.h> 19 19 #include <linux/of.h> 20 20 #include <linux/regmap.h> 21 21 #include <linux/types.h> 22 + 23 + #define BD72720_TYPED_IRQ_REG(_irq, _stat_offset, _mask, _type_offset) \ 24 + [_irq] = { \ 25 + .reg_offset = (_stat_offset), \ 26 + .mask = (_mask), \ 27 + { \ 28 + .type_reg_offset = (_type_offset), \ 29 + .type_reg_mask = BD72720_GPIO_IRQ_TYPE_MASK, \ 30 + .type_rising_val = BD72720_GPIO_IRQ_TYPE_RISING, \ 31 + .type_falling_val = BD72720_GPIO_IRQ_TYPE_FALLING, \ 32 + .type_level_low_val = BD72720_GPIO_IRQ_TYPE_LOW, \ 33 + .type_level_high_val = BD72720_GPIO_IRQ_TYPE_HIGH, \ 34 + .types_supported = IRQ_TYPE_EDGE_BOTH | \ 35 + IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW, \ 36 + }, \ 37 + } 22 38 23 39 static struct gpio_keys_button button = { 24 40 .code = KEY_POWER, ··· 59 41 DEFINE_RES_IRQ_NAMED(BD71828_INT_RTC0, "bd70528-rtc-alm-0"), 60 42 DEFINE_RES_IRQ_NAMED(BD71828_INT_RTC1, "bd70528-rtc-alm-1"), 61 43 DEFINE_RES_IRQ_NAMED(BD71828_INT_RTC2, "bd70528-rtc-alm-2"), 44 + }; 45 + 46 + static const struct resource bd72720_rtc_irqs[] = { 47 + DEFINE_RES_IRQ_NAMED(BD72720_INT_RTC0, "bd70528-rtc-alm-0"), 48 + DEFINE_RES_IRQ_NAMED(BD72720_INT_RTC1, "bd70528-rtc-alm-1"), 49 + DEFINE_RES_IRQ_NAMED(BD72720_INT_RTC2, "bd70528-rtc-alm-2"), 62 50 }; 63 51 64 52 static const struct resource bd71815_power_irqs[] = { ··· 180 156 }, 181 157 }; 182 158 183 - static const struct regmap_range bd71815_volatile_ranges[] = { 159 + static const struct resource bd72720_power_irqs[] = { 160 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VBUS_RMV, "bd72720_int_vbus_rmv"), 161 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VBUS_DET, "bd72720_int_vbus_det"), 162 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VBUS_MON_RES, "bd72720_int_vbus_mon_res"), 163 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VBUS_MON_DET, "bd72720_int_vbus_mon_det"), 164 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VSYS_MON_RES, "bd72720_int_vsys_mon_res"), 165 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VSYS_MON_DET, "bd72720_int_vsys_mon_det"), 166 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VSYS_UV_RES, "bd72720_int_vsys_uv_res"), 167 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VSYS_UV_DET, "bd72720_int_vsys_uv_det"), 168 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VSYS_LO_RES, "bd72720_int_vsys_lo_res"), 169 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VSYS_LO_DET, "bd72720_int_vsys_lo_det"), 170 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VSYS_OV_RES, "bd72720_int_vsys_ov_res"), 171 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VSYS_OV_DET, "bd72720_int_vsys_ov_det"), 172 + DEFINE_RES_IRQ_NAMED(BD72720_INT_BAT_ILIM, "bd72720_int_bat_ilim"), 173 + DEFINE_RES_IRQ_NAMED(BD72720_INT_CHG_DONE, "bd72720_int_chg_done"), 174 + DEFINE_RES_IRQ_NAMED(BD72720_INT_EXTEMP_TOUT, "bd72720_int_extemp_tout"), 175 + DEFINE_RES_IRQ_NAMED(BD72720_INT_CHG_WDT_EXP, "bd72720_int_chg_wdt_exp"), 176 + DEFINE_RES_IRQ_NAMED(BD72720_INT_BAT_MNT_OUT, "bd72720_int_bat_mnt_out"), 177 + DEFINE_RES_IRQ_NAMED(BD72720_INT_BAT_MNT_IN, "bd72720_int_bat_mnt_in"), 178 + DEFINE_RES_IRQ_NAMED(BD72720_INT_CHG_TRNS, "bd72720_int_chg_trns"), 179 + 180 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VBAT_MON_RES, "bd72720_int_vbat_mon_res"), 181 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VBAT_MON_DET, "bd72720_int_vbat_mon_det"), 182 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VBAT_SHT_RES, "bd72720_int_vbat_sht_res"), 183 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VBAT_SHT_DET, "bd72720_int_vbat_sht_det"), 184 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VBAT_LO_RES, "bd72720_int_vbat_lo_res"), 185 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VBAT_LO_DET, "bd72720_int_vbat_lo_det"), 186 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VBAT_OV_RES, "bd72720_int_vbat_ov_res"), 187 + DEFINE_RES_IRQ_NAMED(BD72720_INT_VBAT_OV_DET, "bd72720_int_vbat_ov_det"), 188 + DEFINE_RES_IRQ_NAMED(BD72720_INT_BAT_RMV, "bd72720_int_bat_rmv"), 189 + DEFINE_RES_IRQ_NAMED(BD72720_INT_BAT_DET, "bd72720_int_bat_det"), 190 + DEFINE_RES_IRQ_NAMED(BD72720_INT_DBAT_DET, "bd72720_int_dbat_det"), 191 + DEFINE_RES_IRQ_NAMED(BD72720_INT_BAT_TEMP_TRNS, "bd72720_int_bat_temp_trns"), 192 + DEFINE_RES_IRQ_NAMED(BD72720_INT_LOBTMP_RES, "bd72720_int_lobtmp_res"), 193 + DEFINE_RES_IRQ_NAMED(BD72720_INT_LOBTMP_DET, "bd72720_int_lobtmp_det"), 194 + DEFINE_RES_IRQ_NAMED(BD72720_INT_OVBTMP_RES, "bd72720_int_ovbtmp_res"), 195 + DEFINE_RES_IRQ_NAMED(BD72720_INT_OVBTMP_DET, "bd72720_int_ovbtmp_det"), 196 + DEFINE_RES_IRQ_NAMED(BD72720_INT_OCUR1_RES, "bd72720_int_ocur1_res"), 197 + DEFINE_RES_IRQ_NAMED(BD72720_INT_OCUR1_DET, "bd72720_int_ocur1_det"), 198 + DEFINE_RES_IRQ_NAMED(BD72720_INT_OCUR2_RES, "bd72720_int_ocur2_res"), 199 + DEFINE_RES_IRQ_NAMED(BD72720_INT_OCUR2_DET, "bd72720_int_ocur2_det"), 200 + DEFINE_RES_IRQ_NAMED(BD72720_INT_OCUR3_RES, "bd72720_int_ocur3_res"), 201 + DEFINE_RES_IRQ_NAMED(BD72720_INT_OCUR3_DET, "bd72720_int_ocur3_det"), 202 + DEFINE_RES_IRQ_NAMED(BD72720_INT_CC_MON1_DET, "bd72720_int_cc_mon1_det"), 203 + DEFINE_RES_IRQ_NAMED(BD72720_INT_CC_MON2_DET, "bd72720_int_cc_mon2_det"), 204 + DEFINE_RES_IRQ_NAMED(BD72720_INT_CC_MON3_DET, "bd72720_int_cc_mon3_det"), 205 + }; 206 + 207 + static const struct mfd_cell bd72720_mfd_cells[] = { 208 + { .name = "bd72720-pmic", }, 209 + { .name = "bd72720-gpio", }, 210 + { .name = "bd72720-led", }, 211 + { .name = "bd72720-clk", }, 184 212 { 185 - .range_min = BD71815_REG_SEC, 186 - .range_max = BD71815_REG_YEAR, 213 + .name = "bd72720-power", 214 + .resources = bd72720_power_irqs, 215 + .num_resources = ARRAY_SIZE(bd72720_power_irqs), 187 216 }, { 188 - .range_min = BD71815_REG_CONF, 189 - .range_max = BD71815_REG_BAT_TEMP, 217 + .name = "bd72720-rtc", 218 + .resources = bd72720_rtc_irqs, 219 + .num_resources = ARRAY_SIZE(bd72720_rtc_irqs), 190 220 }, { 191 - .range_min = BD71815_REG_VM_IBAT_U, 192 - .range_max = BD71815_REG_CC_CTRL, 193 - }, { 194 - .range_min = BD71815_REG_CC_STAT, 195 - .range_max = BD71815_REG_CC_CURCD_L, 196 - }, { 197 - .range_min = BD71815_REG_VM_BTMP_MON, 198 - .range_max = BD71815_REG_VM_BTMP_MON, 199 - }, { 200 - .range_min = BD71815_REG_INT_STAT, 201 - .range_max = BD71815_REG_INT_UPDATE, 202 - }, { 203 - .range_min = BD71815_REG_VM_VSYS_U, 204 - .range_max = BD71815_REG_REX_CTRL_1, 205 - }, { 206 - .range_min = BD71815_REG_FULL_CCNTD_3, 207 - .range_max = BD71815_REG_CCNTD_CHG_2, 221 + .name = "gpio-keys", 222 + .platform_data = &bd71828_powerkey_data, 223 + .pdata_size = sizeof(bd71828_powerkey_data), 208 224 }, 209 225 }; 210 226 227 + static const struct regmap_range bd71815_volatile_ranges[] = { 228 + regmap_reg_range(BD71815_REG_SEC, BD71815_REG_YEAR), 229 + regmap_reg_range(BD71815_REG_CONF, BD71815_REG_BAT_TEMP), 230 + regmap_reg_range(BD71815_REG_VM_IBAT_U, BD71815_REG_CC_CTRL), 231 + regmap_reg_range(BD71815_REG_CC_STAT, BD71815_REG_CC_CURCD_L), 232 + regmap_reg_range(BD71815_REG_VM_BTMP_MON, BD71815_REG_VM_BTMP_MON), 233 + regmap_reg_range(BD71815_REG_INT_STAT, BD71815_REG_INT_UPDATE), 234 + regmap_reg_range(BD71815_REG_VM_VSYS_U, BD71815_REG_REX_CTRL_1), 235 + regmap_reg_range(BD71815_REG_FULL_CCNTD_3, BD71815_REG_CCNTD_CHG_2), 236 + }; 237 + 211 238 static const struct regmap_range bd71828_volatile_ranges[] = { 212 - { 213 - .range_min = BD71828_REG_PS_CTRL_1, 214 - .range_max = BD71828_REG_PS_CTRL_1, 215 - }, { 216 - .range_min = BD71828_REG_PS_CTRL_3, 217 - .range_max = BD71828_REG_PS_CTRL_3, 218 - }, { 219 - .range_min = BD71828_REG_RTC_SEC, 220 - .range_max = BD71828_REG_RTC_YEAR, 221 - }, { 222 - /* 223 - * For now make all charger registers volatile because many 224 - * needs to be and because the charger block is not that 225 - * performance critical. 226 - */ 227 - .range_min = BD71828_REG_CHG_STATE, 228 - .range_max = BD71828_REG_CHG_FULL, 229 - }, { 230 - .range_min = BD71828_REG_INT_MAIN, 231 - .range_max = BD71828_REG_IO_STAT, 232 - }, 239 + regmap_reg_range(BD71828_REG_PS_CTRL_1, BD71828_REG_PS_CTRL_1), 240 + regmap_reg_range(BD71828_REG_PS_CTRL_3, BD71828_REG_PS_CTRL_3), 241 + regmap_reg_range(BD71828_REG_RTC_SEC, BD71828_REG_RTC_YEAR), 242 + /* 243 + * For now make all charger registers volatile because many 244 + * needs to be and because the charger block is not that 245 + * performance critical. 246 + */ 247 + regmap_reg_range(BD71828_REG_CHG_STATE, BD71828_REG_CHG_FULL), 248 + regmap_reg_range(BD71828_REG_INT_MAIN, BD71828_REG_IO_STAT), 249 + }; 250 + 251 + static const struct regmap_range bd72720_volatile_ranges_4b[] = { 252 + regmap_reg_range(BD72720_REG_RESETSRC_1, BD72720_REG_RESETSRC_2), 253 + regmap_reg_range(BD72720_REG_POWER_STATE, BD72720_REG_POWER_STATE), 254 + /* The state indicator bit changes when new state is reached */ 255 + regmap_reg_range(BD72720_REG_PS_CTRL_1, BD72720_REG_PS_CTRL_1), 256 + regmap_reg_range(BD72720_REG_RCVNUM, BD72720_REG_RCVNUM), 257 + regmap_reg_range(BD72720_REG_CONF, BD72720_REG_HALL_STAT), 258 + regmap_reg_range(BD72720_REG_RTC_SEC, BD72720_REG_RTC_YEAR), 259 + regmap_reg_range(BD72720_REG_INT_LVL1_STAT, BD72720_REG_INT_ETC2_SRC), 260 + }; 261 + 262 + static const struct regmap_range bd72720_precious_ranges_4b[] = { 263 + regmap_reg_range(BD72720_REG_INT_LVL1_STAT, BD72720_REG_INT_ETC2_STAT), 264 + }; 265 + 266 + /* 267 + * The BD72720 is an odd beast in that it contains two separate sets of 268 + * registers, both starting from address 0x0. The twist is that these "pages" 269 + * are behind different I2C slave addresses. Most of the registers are behind 270 + * a slave address 0x4b, which will be used as the "main" address for this 271 + * device. 272 + * 273 + * Most of the charger related registers are located behind slave address 0x4c. 274 + * It is tempting to push the dealing with the charger registers and the extra 275 + * 0x4c device in power-supply driver - but perhaps it's better for the sake of 276 + * the cleaner re-use to deal with setting up all of the regmaps here. 277 + * Furthermore, the LED stuff may need access to both of these devices. 278 + * 279 + * Instead of providing one of the regmaps to sub-devices in MFD platform data, 280 + * we create one more 'wrapper regmap' with custom read/write operations. These 281 + * custom accessors will select which of the 'real' regmaps to use, based on 282 + * the register address. 283 + * 284 + * The register addresses are 8-bit, so we add offset 0x100 to the addresses 285 + * behind the secondary slave 0x4c. The 'wrapper' regmap can then detect the 286 + * correct slave address based on the register address and call regmap_write() 287 + * and regmap_read() using correct 'real' regmap. This way the registers of 288 + * both of the slaves can be accessed using one 'wrapper' regmap. 289 + * 290 + * NOTE: The added offsets mean that the defined addresses for slave 0x4c must 291 + * be used through the 'wrapper' regmap because the offset must be stripped 292 + * from the register addresses. The 0x4b can be accessed both indirectly using 293 + * the 'wrapper' regmap, and directly using the 'real' regmap. 294 + */ 295 + #define BD72720_SECONDARY_I2C_SLAVE 0x4c 296 + #define BD72720_SECONDARY_I2C_REG_OFFSET 0x100 297 + 298 + struct bd72720_regmaps { 299 + struct regmap *map1_4b; 300 + struct regmap *map2_4c; 301 + }; 302 + 303 + /* Translate the slave 0x4c wrapper register address to a real one */ 304 + #define BD72720_REG_UNWRAP(reg) ((reg) - BD72720_SECONDARY_I2C_REG_OFFSET) 305 + 306 + /* Ranges given to 'real' 0x4c regmap must use unwrapped addresses. */ 307 + #define BD72720_UNWRAP_REG_RANGE(startreg, endreg) \ 308 + regmap_reg_range(BD72720_REG_UNWRAP(startreg), BD72720_REG_UNWRAP(endreg)) 309 + 310 + static const struct regmap_range bd72720_volatile_ranges_4c[] = { 311 + /* Status information */ 312 + BD72720_UNWRAP_REG_RANGE(BD72720_REG_CHG_STATE, BD72720_REG_CHG_EN), 313 + /* 314 + * Under certain circumstances, write to some bits may be 315 + * ignored 316 + */ 317 + BD72720_UNWRAP_REG_RANGE(BD72720_REG_CHG_CTRL, BD72720_REG_CHG_CTRL), 318 + /* 319 + * TODO: Ensure this is used to advertise state, not (only?) to 320 + * control it. 321 + */ 322 + BD72720_UNWRAP_REG_RANGE(BD72720_REG_VSYS_STATE_STAT, BD72720_REG_VSYS_STATE_STAT), 323 + /* Measured data */ 324 + BD72720_UNWRAP_REG_RANGE(BD72720_REG_VM_VBAT_U, BD72720_REG_VM_VF_L), 325 + /* Self clearing bits */ 326 + BD72720_UNWRAP_REG_RANGE(BD72720_REG_VM_VSYS_SA_MINMAX_CTRL, 327 + BD72720_REG_VM_VSYS_SA_MINMAX_CTRL), 328 + /* Counters, self clearing bits */ 329 + BD72720_UNWRAP_REG_RANGE(BD72720_REG_CC_CURCD_U, BD72720_REG_CC_CTRL), 330 + /* Self clearing bits */ 331 + BD72720_UNWRAP_REG_RANGE(BD72720_REG_CC_CCNTD_CTRL, BD72720_REG_CC_CCNTD_CTRL), 332 + /* Self clearing bits */ 333 + BD72720_UNWRAP_REG_RANGE(BD72720_REG_IMPCHK_CTRL, BD72720_REG_IMPCHK_CTRL), 233 334 }; 234 335 235 336 static const struct regmap_access_table bd71815_volatile_regs = { ··· 365 216 static const struct regmap_access_table bd71828_volatile_regs = { 366 217 .yes_ranges = &bd71828_volatile_ranges[0], 367 218 .n_yes_ranges = ARRAY_SIZE(bd71828_volatile_ranges), 219 + }; 220 + 221 + static const struct regmap_access_table bd72720_volatile_regs_4b = { 222 + .yes_ranges = &bd72720_volatile_ranges_4b[0], 223 + .n_yes_ranges = ARRAY_SIZE(bd72720_volatile_ranges_4b), 224 + }; 225 + 226 + static const struct regmap_access_table bd72720_precious_regs_4b = { 227 + .yes_ranges = &bd72720_precious_ranges_4b[0], 228 + .n_yes_ranges = ARRAY_SIZE(bd72720_precious_ranges_4b), 229 + }; 230 + 231 + static const struct regmap_access_table bd72720_volatile_regs_4c = { 232 + .yes_ranges = &bd72720_volatile_ranges_4c[0], 233 + .n_yes_ranges = ARRAY_SIZE(bd72720_volatile_ranges_4c), 368 234 }; 369 235 370 236 static const struct regmap_config bd71815_regmap = { ··· 398 234 .cache_type = REGCACHE_MAPLE, 399 235 }; 400 236 237 + static int regmap_write_wrapper(void *context, unsigned int reg, unsigned int val) 238 + { 239 + struct bd72720_regmaps *maps = context; 240 + 241 + if (reg < BD72720_SECONDARY_I2C_REG_OFFSET) 242 + return regmap_write(maps->map1_4b, reg, val); 243 + 244 + reg = BD72720_REG_UNWRAP(reg); 245 + 246 + return regmap_write(maps->map2_4c, reg, val); 247 + } 248 + 249 + static int regmap_read_wrapper(void *context, unsigned int reg, unsigned int *val) 250 + { 251 + struct bd72720_regmaps *maps = context; 252 + 253 + if (reg < BD72720_SECONDARY_I2C_REG_OFFSET) 254 + return regmap_read(maps->map1_4b, reg, val); 255 + 256 + reg = BD72720_REG_UNWRAP(reg); 257 + 258 + return regmap_read(maps->map2_4c, reg, val); 259 + } 260 + 261 + static const struct regmap_config bd72720_wrapper_map_config = { 262 + .name = "wrap-map", 263 + .reg_bits = 9, 264 + .val_bits = 8, 265 + .max_register = BD72720_REG_IMPCHK_CTRL, 266 + /* 267 + * We don't want to duplicate caches. It would be a bit faster to 268 + * have the cache in this 'wrapper regmap', and not in the 'real 269 + * regmaps' bd72720_regmap_4b and bd72720_regmap_4c below. This would 270 + * require all the subdevices to use the wrapper-map in order to be 271 + * able to benefit from the cache. 272 + * Currently most of the sub-devices use only the same slave-address 273 + * as this MFD driver. Now, because we don't add the offset to the 274 + * registers belonging to this slave, those devices can use either the 275 + * wrapper map, or the bd72720_regmap_4b directly. This means majority 276 + * of our sub devices don't need to care which regmap they get using 277 + * the dev_get_regmap(). This unifies the code between the BD72720 and 278 + * those variants which don't have this 'multiple slave addresses' 279 + * -hassle. 280 + * So, for a small performance penalty, we simplify the code for the 281 + * sub-devices by having the caches in the wrapped regmaps and not here. 282 + */ 283 + .cache_type = REGCACHE_NONE, 284 + .reg_write = regmap_write_wrapper, 285 + .reg_read = regmap_read_wrapper, 286 + }; 287 + 288 + static const struct regmap_config bd72720_regmap_4b = { 289 + .reg_bits = 8, 290 + .val_bits = 8, 291 + .volatile_table = &bd72720_volatile_regs_4b, 292 + .precious_table = &bd72720_precious_regs_4b, 293 + .max_register = BD72720_REG_INT_ETC2_SRC, 294 + .cache_type = REGCACHE_MAPLE, 295 + }; 296 + 297 + static const struct regmap_config bd72720_regmap_4c = { 298 + .reg_bits = 8, 299 + .val_bits = 8, 300 + .volatile_table = &bd72720_volatile_regs_4c, 301 + .max_register = BD72720_REG_UNWRAP(BD72720_REG_IMPCHK_CTRL), 302 + .cache_type = REGCACHE_MAPLE, 303 + }; 304 + 401 305 /* 402 306 * Mapping of main IRQ register bits to sub-IRQ register offsets so that we can 403 307 * access corect sub-IRQ registers based on bits that are set in main IRQ 404 - * register. BD71815 and BD71828 have same sub-register-block offests. 308 + * register. BD71815 and BD71828 have same sub-register-block offests, the 309 + * BD72720 has a different one. 405 310 */ 406 311 407 312 static unsigned int bit0_offsets[] = {11}; /* RTC IRQ */ ··· 482 249 static unsigned int bit6_offsets[] = {1, 2}; /* DCIN IRQ */ 483 250 static unsigned int bit7_offsets[] = {0}; /* BUCK IRQ */ 484 251 252 + static unsigned int bd72720_bit0_offsets[] = {0, 1}; /* PS1 and PS2 */ 253 + static unsigned int bd72720_bit1_offsets[] = {2, 3}; /* DVS1 and DVS2 */ 254 + static unsigned int bd72720_bit2_offsets[] = {4}; /* VBUS */ 255 + static unsigned int bd72720_bit3_offsets[] = {5}; /* VSYS */ 256 + static unsigned int bd72720_bit4_offsets[] = {6}; /* CHG */ 257 + static unsigned int bd72720_bit5_offsets[] = {7, 8}; /* BAT1 and BAT2 */ 258 + static unsigned int bd72720_bit6_offsets[] = {9}; /* IBAT */ 259 + static unsigned int bd72720_bit7_offsets[] = {10, 11}; /* ETC1 and ETC2 */ 260 + 485 261 static const struct regmap_irq_sub_irq_map bd718xx_sub_irq_offsets[] = { 486 262 REGMAP_IRQ_MAIN_REG_OFFSET(bit0_offsets), 487 263 REGMAP_IRQ_MAIN_REG_OFFSET(bit1_offsets), ··· 500 258 REGMAP_IRQ_MAIN_REG_OFFSET(bit5_offsets), 501 259 REGMAP_IRQ_MAIN_REG_OFFSET(bit6_offsets), 502 260 REGMAP_IRQ_MAIN_REG_OFFSET(bit7_offsets), 261 + }; 262 + 263 + static const struct regmap_irq_sub_irq_map bd72720_sub_irq_offsets[] = { 264 + REGMAP_IRQ_MAIN_REG_OFFSET(bd72720_bit0_offsets), 265 + REGMAP_IRQ_MAIN_REG_OFFSET(bd72720_bit1_offsets), 266 + REGMAP_IRQ_MAIN_REG_OFFSET(bd72720_bit2_offsets), 267 + REGMAP_IRQ_MAIN_REG_OFFSET(bd72720_bit3_offsets), 268 + REGMAP_IRQ_MAIN_REG_OFFSET(bd72720_bit4_offsets), 269 + REGMAP_IRQ_MAIN_REG_OFFSET(bd72720_bit5_offsets), 270 + REGMAP_IRQ_MAIN_REG_OFFSET(bd72720_bit6_offsets), 271 + REGMAP_IRQ_MAIN_REG_OFFSET(bd72720_bit7_offsets), 503 272 }; 504 273 505 274 static const struct regmap_irq bd71815_irqs[] = { ··· 686 433 REGMAP_IRQ_REG(BD71828_INT_RTC2, 11, BD71828_INT_RTC2_MASK), 687 434 }; 688 435 436 + static const struct regmap_irq bd72720_irqs[] = { 437 + REGMAP_IRQ_REG(BD72720_INT_LONGPUSH, 0, BD72720_INT_LONGPUSH_MASK), 438 + REGMAP_IRQ_REG(BD72720_INT_MIDPUSH, 0, BD72720_INT_MIDPUSH_MASK), 439 + REGMAP_IRQ_REG(BD72720_INT_SHORTPUSH, 0, BD72720_INT_SHORTPUSH_MASK), 440 + REGMAP_IRQ_REG(BD72720_INT_PUSH, 0, BD72720_INT_PUSH_MASK), 441 + REGMAP_IRQ_REG(BD72720_INT_HALL_DET, 0, BD72720_INT_HALL_DET_MASK), 442 + REGMAP_IRQ_REG(BD72720_INT_HALL_TGL, 0, BD72720_INT_HALL_TGL_MASK), 443 + REGMAP_IRQ_REG(BD72720_INT_WDOG, 0, BD72720_INT_WDOG_MASK), 444 + REGMAP_IRQ_REG(BD72720_INT_SWRESET, 0, BD72720_INT_SWRESET_MASK), 445 + REGMAP_IRQ_REG(BD72720_INT_SEQ_DONE, 1, BD72720_INT_SEQ_DONE_MASK), 446 + REGMAP_IRQ_REG(BD72720_INT_PGFAULT, 1, BD72720_INT_PGFAULT_MASK), 447 + REGMAP_IRQ_REG(BD72720_INT_BUCK1_DVS, 2, BD72720_INT_BUCK1_DVS_MASK), 448 + REGMAP_IRQ_REG(BD72720_INT_BUCK2_DVS, 2, BD72720_INT_BUCK2_DVS_MASK), 449 + REGMAP_IRQ_REG(BD72720_INT_BUCK3_DVS, 2, BD72720_INT_BUCK3_DVS_MASK), 450 + REGMAP_IRQ_REG(BD72720_INT_BUCK4_DVS, 2, BD72720_INT_BUCK4_DVS_MASK), 451 + REGMAP_IRQ_REG(BD72720_INT_BUCK5_DVS, 2, BD72720_INT_BUCK5_DVS_MASK), 452 + REGMAP_IRQ_REG(BD72720_INT_BUCK6_DVS, 2, BD72720_INT_BUCK6_DVS_MASK), 453 + REGMAP_IRQ_REG(BD72720_INT_BUCK7_DVS, 2, BD72720_INT_BUCK7_DVS_MASK), 454 + REGMAP_IRQ_REG(BD72720_INT_BUCK8_DVS, 2, BD72720_INT_BUCK8_DVS_MASK), 455 + REGMAP_IRQ_REG(BD72720_INT_BUCK9_DVS, 3, BD72720_INT_BUCK9_DVS_MASK), 456 + REGMAP_IRQ_REG(BD72720_INT_BUCK10_DVS, 3, BD72720_INT_BUCK10_DVS_MASK), 457 + REGMAP_IRQ_REG(BD72720_INT_LDO1_DVS, 3, BD72720_INT_LDO1_DVS_MASK), 458 + REGMAP_IRQ_REG(BD72720_INT_LDO2_DVS, 3, BD72720_INT_LDO2_DVS_MASK), 459 + REGMAP_IRQ_REG(BD72720_INT_LDO3_DVS, 3, BD72720_INT_LDO3_DVS_MASK), 460 + REGMAP_IRQ_REG(BD72720_INT_LDO4_DVS, 3, BD72720_INT_LDO4_DVS_MASK), 461 + 462 + REGMAP_IRQ_REG(BD72720_INT_VBUS_RMV, 4, BD72720_INT_VBUS_RMV_MASK), 463 + REGMAP_IRQ_REG(BD72720_INT_VBUS_DET, 4, BD72720_INT_VBUS_DET_MASK), 464 + REGMAP_IRQ_REG(BD72720_INT_VBUS_MON_RES, 4, BD72720_INT_VBUS_MON_RES_MASK), 465 + REGMAP_IRQ_REG(BD72720_INT_VBUS_MON_DET, 4, BD72720_INT_VBUS_MON_DET_MASK), 466 + REGMAP_IRQ_REG(BD72720_INT_VSYS_MON_RES, 5, BD72720_INT_VSYS_MON_RES_MASK), 467 + REGMAP_IRQ_REG(BD72720_INT_VSYS_MON_DET, 5, BD72720_INT_VSYS_MON_DET_MASK), 468 + REGMAP_IRQ_REG(BD72720_INT_VSYS_UV_RES, 5, BD72720_INT_VSYS_UV_RES_MASK), 469 + REGMAP_IRQ_REG(BD72720_INT_VSYS_UV_DET, 5, BD72720_INT_VSYS_UV_DET_MASK), 470 + REGMAP_IRQ_REG(BD72720_INT_VSYS_LO_RES, 5, BD72720_INT_VSYS_LO_RES_MASK), 471 + REGMAP_IRQ_REG(BD72720_INT_VSYS_LO_DET, 5, BD72720_INT_VSYS_LO_DET_MASK), 472 + REGMAP_IRQ_REG(BD72720_INT_VSYS_OV_RES, 5, BD72720_INT_VSYS_OV_RES_MASK), 473 + REGMAP_IRQ_REG(BD72720_INT_VSYS_OV_DET, 5, BD72720_INT_VSYS_OV_DET_MASK), 474 + REGMAP_IRQ_REG(BD72720_INT_BAT_ILIM, 6, BD72720_INT_BAT_ILIM_MASK), 475 + REGMAP_IRQ_REG(BD72720_INT_CHG_DONE, 6, BD72720_INT_CHG_DONE_MASK), 476 + REGMAP_IRQ_REG(BD72720_INT_EXTEMP_TOUT, 6, BD72720_INT_EXTEMP_TOUT_MASK), 477 + REGMAP_IRQ_REG(BD72720_INT_CHG_WDT_EXP, 6, BD72720_INT_CHG_WDT_EXP_MASK), 478 + REGMAP_IRQ_REG(BD72720_INT_BAT_MNT_OUT, 6, BD72720_INT_BAT_MNT_OUT_MASK), 479 + REGMAP_IRQ_REG(BD72720_INT_BAT_MNT_IN, 6, BD72720_INT_BAT_MNT_IN_MASK), 480 + REGMAP_IRQ_REG(BD72720_INT_CHG_TRNS, 6, BD72720_INT_CHG_TRNS_MASK), 481 + 482 + REGMAP_IRQ_REG(BD72720_INT_VBAT_MON_RES, 7, BD72720_INT_VBAT_MON_RES_MASK), 483 + REGMAP_IRQ_REG(BD72720_INT_VBAT_MON_DET, 7, BD72720_INT_VBAT_MON_DET_MASK), 484 + REGMAP_IRQ_REG(BD72720_INT_VBAT_SHT_RES, 7, BD72720_INT_VBAT_SHT_RES_MASK), 485 + REGMAP_IRQ_REG(BD72720_INT_VBAT_SHT_DET, 7, BD72720_INT_VBAT_SHT_DET_MASK), 486 + REGMAP_IRQ_REG(BD72720_INT_VBAT_LO_RES, 7, BD72720_INT_VBAT_LO_RES_MASK), 487 + REGMAP_IRQ_REG(BD72720_INT_VBAT_LO_DET, 7, BD72720_INT_VBAT_LO_DET_MASK), 488 + REGMAP_IRQ_REG(BD72720_INT_VBAT_OV_RES, 7, BD72720_INT_VBAT_OV_RES_MASK), 489 + REGMAP_IRQ_REG(BD72720_INT_VBAT_OV_DET, 7, BD72720_INT_VBAT_OV_DET_MASK), 490 + REGMAP_IRQ_REG(BD72720_INT_BAT_RMV, 8, BD72720_INT_BAT_RMV_MASK), 491 + REGMAP_IRQ_REG(BD72720_INT_BAT_DET, 8, BD72720_INT_BAT_DET_MASK), 492 + REGMAP_IRQ_REG(BD72720_INT_DBAT_DET, 8, BD72720_INT_DBAT_DET_MASK), 493 + REGMAP_IRQ_REG(BD72720_INT_BAT_TEMP_TRNS, 8, BD72720_INT_BAT_TEMP_TRNS_MASK), 494 + REGMAP_IRQ_REG(BD72720_INT_LOBTMP_RES, 8, BD72720_INT_LOBTMP_RES_MASK), 495 + REGMAP_IRQ_REG(BD72720_INT_LOBTMP_DET, 8, BD72720_INT_LOBTMP_DET_MASK), 496 + REGMAP_IRQ_REG(BD72720_INT_OVBTMP_RES, 8, BD72720_INT_OVBTMP_RES_MASK), 497 + REGMAP_IRQ_REG(BD72720_INT_OVBTMP_DET, 8, BD72720_INT_OVBTMP_DET_MASK), 498 + REGMAP_IRQ_REG(BD72720_INT_OCUR1_RES, 9, BD72720_INT_OCUR1_RES_MASK), 499 + REGMAP_IRQ_REG(BD72720_INT_OCUR1_DET, 9, BD72720_INT_OCUR1_DET_MASK), 500 + REGMAP_IRQ_REG(BD72720_INT_OCUR2_RES, 9, BD72720_INT_OCUR2_RES_MASK), 501 + REGMAP_IRQ_REG(BD72720_INT_OCUR2_DET, 9, BD72720_INT_OCUR2_DET_MASK), 502 + REGMAP_IRQ_REG(BD72720_INT_OCUR3_RES, 9, BD72720_INT_OCUR3_RES_MASK), 503 + REGMAP_IRQ_REG(BD72720_INT_OCUR3_DET, 9, BD72720_INT_OCUR3_DET_MASK), 504 + REGMAP_IRQ_REG(BD72720_INT_CC_MON1_DET, 10, BD72720_INT_CC_MON1_DET_MASK), 505 + REGMAP_IRQ_REG(BD72720_INT_CC_MON2_DET, 10, BD72720_INT_CC_MON2_DET_MASK), 506 + REGMAP_IRQ_REG(BD72720_INT_CC_MON3_DET, 10, BD72720_INT_CC_MON3_DET_MASK), 507 + /* 508 + * The GPIO1_IN and GPIO2_IN IRQs are generated from the PMIC's GPIO1 and GPIO2 509 + * pins. Eg, they may be wired to other devices which can then use the PMIC as 510 + * an interrupt controller. The GPIO1 and GPIO2 can have the IRQ type 511 + * specified. All of the types (falling, rising, and both edges as well as low 512 + * and high levels) are supported. 513 + */ 514 + BD72720_TYPED_IRQ_REG(BD72720_INT_GPIO1_IN, 10, BD72720_INT_GPIO1_IN_MASK, 0), 515 + BD72720_TYPED_IRQ_REG(BD72720_INT_GPIO2_IN, 10, BD72720_INT_GPIO2_IN_MASK, 1), 516 + REGMAP_IRQ_REG(BD72720_INT_VF125_RES, 11, BD72720_INT_VF125_RES_MASK), 517 + REGMAP_IRQ_REG(BD72720_INT_VF125_DET, 11, BD72720_INT_VF125_DET_MASK), 518 + REGMAP_IRQ_REG(BD72720_INT_VF_RES, 11, BD72720_INT_VF_RES_MASK), 519 + REGMAP_IRQ_REG(BD72720_INT_VF_DET, 11, BD72720_INT_VF_DET_MASK), 520 + REGMAP_IRQ_REG(BD72720_INT_RTC0, 11, BD72720_INT_RTC0_MASK), 521 + REGMAP_IRQ_REG(BD72720_INT_RTC1, 11, BD72720_INT_RTC1_MASK), 522 + REGMAP_IRQ_REG(BD72720_INT_RTC2, 11, BD72720_INT_RTC2_MASK), 523 + }; 524 + 525 + static int bd72720_set_type_config(unsigned int **buf, unsigned int type, 526 + const struct regmap_irq *irq_data, 527 + int idx, void *irq_drv_data) 528 + { 529 + const struct regmap_irq_type *t = &irq_data->type; 530 + 531 + /* 532 + * The regmap IRQ ecpects IRQ_TYPE_EDGE_BOTH to be written to register 533 + * as logical OR of the type_falling_val and type_rising_val. This is 534 + * not how the BD72720 implements this configuration, hence we need 535 + * to handle this specific case separately. 536 + */ 537 + if (type == IRQ_TYPE_EDGE_BOTH) { 538 + buf[0][idx] &= ~t->type_reg_mask; 539 + buf[0][idx] |= BD72720_GPIO_IRQ_TYPE_BOTH; 540 + 541 + return 0; 542 + } 543 + 544 + return regmap_irq_set_type_config_simple(buf, type, irq_data, idx, irq_drv_data); 545 + } 546 + 689 547 static const struct regmap_irq_chip bd71828_irq_chip = { 690 548 .name = "bd71828_irq", 691 549 .main_status = BD71828_REG_INT_MAIN, ··· 825 461 .num_regs = 12, 826 462 .num_main_regs = 1, 827 463 .sub_reg_offsets = &bd718xx_sub_irq_offsets[0], 464 + .num_main_status_bits = 8, 465 + .irq_reg_stride = 1, 466 + }; 467 + 468 + static const unsigned int bd72720_irq_type_base[] = { BD72720_REG_GPIO1_CTRL }; 469 + 470 + static const struct regmap_irq_chip bd72720_irq_chip = { 471 + .name = "bd72720_irq", 472 + .main_status = BD72720_REG_INT_LVL1_STAT, 473 + .irqs = &bd72720_irqs[0], 474 + .num_irqs = ARRAY_SIZE(bd72720_irqs), 475 + .status_base = BD72720_REG_INT_PS1_STAT, 476 + .unmask_base = BD72720_REG_INT_PS1_EN, 477 + .config_base = &bd72720_irq_type_base[0], 478 + .num_config_bases = 1, 479 + .num_config_regs = 2, 480 + .set_type_config = bd72720_set_type_config, 481 + .ack_base = BD72720_REG_INT_PS1_STAT, 482 + .init_ack_masked = true, 483 + .num_regs = 12, 484 + .num_main_regs = 1, 485 + .sub_reg_offsets = &bd72720_sub_irq_offsets[0], 828 486 .num_main_status_bits = 8, 829 487 .irq_reg_stride = 1, 830 488 }; ··· 897 511 pm_power_off = NULL; 898 512 } 899 513 514 + static struct regmap *bd72720_do_regmaps(struct i2c_client *i2c) 515 + { 516 + struct bd72720_regmaps *maps; 517 + struct i2c_client *secondary_i2c; 518 + 519 + secondary_i2c = devm_i2c_new_dummy_device(&i2c->dev, i2c->adapter, 520 + BD72720_SECONDARY_I2C_SLAVE); 521 + if (IS_ERR(secondary_i2c)) { 522 + dev_err_probe(&i2c->dev, PTR_ERR(secondary_i2c), "Failed to get secondary I2C\n"); 523 + 524 + return ERR_CAST(secondary_i2c); 525 + } 526 + 527 + maps = devm_kzalloc(&i2c->dev, sizeof(*maps), GFP_KERNEL); 528 + if (!maps) 529 + return ERR_PTR(-ENOMEM); 530 + 531 + maps->map1_4b = devm_regmap_init_i2c(i2c, &bd72720_regmap_4b); 532 + if (IS_ERR(maps->map1_4b)) 533 + return maps->map1_4b; 534 + 535 + maps->map2_4c = devm_regmap_init_i2c(secondary_i2c, &bd72720_regmap_4c); 536 + if (IS_ERR(maps->map2_4c)) 537 + return maps->map2_4c; 538 + 539 + return devm_regmap_init(&i2c->dev, NULL, maps, &bd72720_wrapper_map_config); 540 + } 541 + 900 542 static int bd71828_i2c_probe(struct i2c_client *i2c) 901 543 { 902 544 struct regmap_irq_chip_data *irq_data; 903 545 int ret; 904 - struct regmap *regmap; 546 + struct regmap *regmap = NULL; 905 547 const struct regmap_config *regmap_config; 906 548 const struct regmap_irq_chip *irqchip; 907 549 unsigned int chip_type; ··· 937 523 int cells; 938 524 int button_irq; 939 525 int clkmode_reg; 526 + int main_lvl_mask_reg = 0, main_lvl_val = 0; 940 527 941 528 if (!i2c->irq) { 942 529 dev_err(&i2c->dev, "No IRQ configured\n"); ··· 969 554 */ 970 555 button_irq = 0; 971 556 break; 557 + case ROHM_CHIP_TYPE_BD72720: 558 + { 559 + mfd = bd72720_mfd_cells; 560 + cells = ARRAY_SIZE(bd72720_mfd_cells); 561 + 562 + regmap = bd72720_do_regmaps(i2c); 563 + if (IS_ERR(regmap)) 564 + return dev_err_probe(&i2c->dev, PTR_ERR(regmap), 565 + "Failed to initialize Regmap\n"); 566 + 567 + irqchip = &bd72720_irq_chip; 568 + clkmode_reg = BD72720_REG_OUT32K; 569 + button_irq = BD72720_INT_SHORTPUSH; 570 + main_lvl_mask_reg = BD72720_REG_INT_LVL1_EN; 571 + main_lvl_val = BD72720_MASK_LVL1_EN_ALL; 572 + break; 573 + } 972 574 default: 973 575 dev_err(&i2c->dev, "Unknown device type"); 974 576 return -EINVAL; 975 577 } 976 578 977 - regmap = devm_regmap_init_i2c(i2c, regmap_config); 978 - if (IS_ERR(regmap)) 979 - return dev_err_probe(&i2c->dev, PTR_ERR(regmap), 579 + if (!regmap) { 580 + regmap = devm_regmap_init_i2c(i2c, regmap_config); 581 + if (IS_ERR(regmap)) 582 + return dev_err_probe(&i2c->dev, PTR_ERR(regmap), 980 583 "Failed to initialize Regmap\n"); 584 + } 981 585 982 586 ret = devm_regmap_add_irq_chip(&i2c->dev, regmap, i2c->irq, 983 587 IRQF_ONESHOT, 0, irqchip, &irq_data); ··· 1007 573 dev_dbg(&i2c->dev, "Registered %d IRQs for chip\n", 1008 574 irqchip->num_irqs); 1009 575 576 + /* 577 + * On some ICs the main IRQ register has corresponding mask register. 578 + * This is not handled by the regmap IRQ. Let's enable all the main 579 + * level IRQs here. Further writes to the main level MASK is not 580 + * needed because masking is handled by the per IRQ 2.nd level MASK 581 + * registers. 2.nd level masks are handled by the regmap IRQ. 582 + */ 583 + if (main_lvl_mask_reg) { 584 + ret = regmap_write(regmap, main_lvl_mask_reg, main_lvl_val); 585 + if (ret) { 586 + return dev_err_probe(&i2c->dev, ret, 587 + "Failed to enable main level IRQs\n"); 588 + } 589 + } 1010 590 if (button_irq) { 1011 591 ret = regmap_irq_get_virq(irq_data, button_irq); 1012 592 if (ret < 0) ··· 1062 614 }, { 1063 615 .compatible = "rohm,bd71815", 1064 616 .data = (void *)ROHM_CHIP_TYPE_BD71815, 617 + }, { 618 + .compatible = "rohm,bd72720", 619 + .data = (void *)ROHM_CHIP_TYPE_BD72720, 1065 620 }, 1066 621 { }, 1067 622 };
+129 -31
drivers/power/supply/bd71828-power.c
··· 5 5 #include <linux/kernel.h> 6 6 #include <linux/mfd/rohm-bd71815.h> 7 7 #include <linux/mfd/rohm-bd71828.h> 8 + #include <linux/mfd/rohm-bd72720.h> 8 9 #include <linux/module.h> 9 10 #include <linux/mod_devicetable.h> 10 11 #include <linux/platform_device.h> ··· 45 44 #define VBAT_LOW_TH 0x00D4 46 45 47 46 struct pwr_regs { 48 - u8 vbat_avg; 49 - u8 ibat; 50 - u8 ibat_avg; 51 - u8 btemp_vth; 52 - u8 chg_state; 53 - u8 bat_temp; 54 - u8 dcin_stat; 55 - u8 dcin_collapse_limit; 56 - u8 chg_set1; 57 - u8 chg_en; 58 - u8 vbat_alm_limit_u; 59 - u8 conf; 60 - u8 vdcin; 47 + unsigned int vbat_avg; 48 + unsigned int ibat; 49 + unsigned int ibat_avg; 50 + unsigned int btemp_vth; 51 + unsigned int chg_state; 52 + unsigned int bat_temp; 53 + unsigned int dcin_stat; 54 + unsigned int dcin_online_mask; 55 + unsigned int dcin_collapse_limit; 56 + unsigned int chg_set1; 57 + unsigned int chg_en; 58 + unsigned int vbat_alm_limit_u; 59 + unsigned int conf; 60 + unsigned int vdcin; 61 + unsigned int vdcin_himask; 61 62 }; 62 63 63 64 static const struct pwr_regs pwr_regs_bd71828 = { ··· 70 67 .chg_state = BD71828_REG_CHG_STATE, 71 68 .bat_temp = BD71828_REG_BAT_TEMP, 72 69 .dcin_stat = BD71828_REG_DCIN_STAT, 70 + .dcin_online_mask = BD7182x_MASK_DCIN_DET, 73 71 .dcin_collapse_limit = BD71828_REG_DCIN_CLPS, 74 72 .chg_set1 = BD71828_REG_CHG_SET1, 75 73 .chg_en = BD71828_REG_CHG_EN, 76 74 .vbat_alm_limit_u = BD71828_REG_ALM_VBAT_LIMIT_U, 77 75 .conf = BD71828_REG_CONF, 78 76 .vdcin = BD71828_REG_VDCIN_U, 77 + .vdcin_himask = BD7182x_MASK_VDCIN_U, 79 78 }; 80 79 81 80 static const struct pwr_regs pwr_regs_bd71815 = { ··· 90 85 .chg_state = BD71815_REG_CHG_STATE, 91 86 .bat_temp = BD71815_REG_BAT_TEMP, 92 87 .dcin_stat = BD71815_REG_DCIN_STAT, 88 + .dcin_online_mask = BD7182x_MASK_DCIN_DET, 93 89 .dcin_collapse_limit = BD71815_REG_DCIN_CLPS, 94 90 .chg_set1 = BD71815_REG_CHG_SET1, 95 91 .chg_en = BD71815_REG_CHG_SET1, ··· 98 92 .conf = BD71815_REG_CONF, 99 93 100 94 .vdcin = BD71815_REG_VM_DCIN_U, 95 + .vdcin_himask = BD7182x_MASK_VDCIN_U, 96 + }; 97 + 98 + static struct pwr_regs pwr_regs_bd72720 = { 99 + .vbat_avg = BD72720_REG_VM_SA_VBAT_U, 100 + .ibat = BD72720_REG_CC_CURCD_U, 101 + .ibat_avg = BD72720_REG_CC_SA_CURCD_U, 102 + .btemp_vth = BD72720_REG_VM_BTMP_U, 103 + /* 104 + * Note, state 0x40 IMP_CHK. not documented 105 + * on other variants but was still handled in 106 + * existing code. No memory traces as to why. 107 + */ 108 + .chg_state = BD72720_REG_CHG_STATE, 109 + .bat_temp = BD72720_REG_CHG_BAT_TEMP_STAT, 110 + .dcin_stat = BD72720_REG_INT_VBUS_SRC, 111 + .dcin_online_mask = BD72720_MASK_DCIN_DET, 112 + .dcin_collapse_limit = -1, /* Automatic. Setting not supported */ 113 + .chg_set1 = BD72720_REG_CHG_SET_1, 114 + .chg_en = BD72720_REG_CHG_EN, 115 + /* 15mV note in data-sheet */ 116 + .vbat_alm_limit_u = BD72720_REG_ALM_VBAT_TH_U, 117 + .conf = BD72720_REG_CONF, /* o XSTB, only PON. Seprate slave addr */ 118 + .vdcin = BD72720_REG_VM_VBUS_U, /* 10 bits not 11 as with other ICs */ 119 + .vdcin_himask = BD72720_MASK_VDCIN_U, 101 120 }; 102 121 103 122 struct bd71828_power { ··· 329 298 dev_err(pwr->dev, "Failed to read DCIN status\n"); 330 299 return ret; 331 300 } 332 - *chg_online = ((r & BD7182x_MASK_DCIN_DET) != 0); 301 + *chg_online = ((r & pwr->regs->dcin_online_mask) != 0); 333 302 334 303 return 0; 335 304 } ··· 360 329 ret = val & BD7182x_MASK_CONF_PON; 361 330 362 331 if (ret) 363 - regmap_update_bits(pwr->regmap, pwr->regs->conf, 364 - BD7182x_MASK_CONF_PON, 0); 332 + if (regmap_update_bits(pwr->regmap, pwr->regs->conf, BD7182x_MASK_CONF_PON, 0)) 333 + dev_err(pwr->dev, "Failed to write CONF register\n"); 365 334 366 335 return ret; 367 336 } ··· 389 358 int ret; 390 359 391 360 /* TODO: Collapse limit should come from device-tree ? */ 392 - ret = regmap_write(pwr->regmap, pwr->regs->dcin_collapse_limit, 393 - BD7182x_DCIN_COLLAPSE_DEFAULT); 394 - if (ret) { 395 - dev_err(pwr->dev, "Failed to write DCIN collapse limit\n"); 396 - return ret; 361 + if (pwr->regs->dcin_collapse_limit != (unsigned int)-1) { 362 + ret = regmap_write(pwr->regmap, pwr->regs->dcin_collapse_limit, 363 + BD7182x_DCIN_COLLAPSE_DEFAULT); 364 + if (ret) { 365 + dev_err(pwr->dev, "Failed to write DCIN collapse limit\n"); 366 + return ret; 367 + } 397 368 } 398 369 399 370 ret = pwr->bat_inserted(pwr); ··· 452 419 break; 453 420 case POWER_SUPPLY_PROP_VOLTAGE_NOW: 454 421 ret = bd7182x_read16_himask(pwr, pwr->regs->vdcin, 455 - BD7182x_MASK_VDCIN_U, &tmp); 422 + pwr->regs->vdcin_himask, &tmp); 456 423 if (ret) 457 424 return ret; 458 425 ··· 663 630 BD_ISR_DUMMY(dcin_mon_det, "DCIN voltage below threshold") 664 631 BD_ISR_DUMMY(dcin_mon_res, "DCIN voltage above threshold") 665 632 633 + BD_ISR_DUMMY(vbus_curr_limit, "VBUS current limited") 634 + BD_ISR_DUMMY(vsys_ov_res, "VSYS over-voltage cleared") 635 + BD_ISR_DUMMY(vsys_ov_det, "VSYS over-voltage") 666 636 BD_ISR_DUMMY(vsys_uv_res, "VSYS under-voltage cleared") 667 637 BD_ISR_DUMMY(vsys_uv_det, "VSYS under-voltage") 668 638 BD_ISR_DUMMY(vsys_low_res, "'VSYS low' cleared") ··· 914 878 BDIRQ("bd71828-temp-125-over", bd71828_temp_vf125_det), 915 879 BDIRQ("bd71828-temp-125-under", bd71828_temp_vf125_res), 916 880 }; 881 + static const struct bd7182x_irq_res bd72720_irqs[] = { 882 + BDIRQ("bd72720_int_vbus_rmv", BD_ISR_NAME(dcin_removed)), 883 + BDIRQ("bd72720_int_vbus_det", bd7182x_dcin_detected), 884 + BDIRQ("bd72720_int_vbus_mon_res", BD_ISR_NAME(dcin_mon_res)), 885 + BDIRQ("bd72720_int_vbus_mon_det", BD_ISR_NAME(dcin_mon_det)), 886 + BDIRQ("bd72720_int_vsys_mon_res", BD_ISR_NAME(vsys_mon_res)), 887 + BDIRQ("bd72720_int_vsys_mon_det", BD_ISR_NAME(vsys_mon_det)), 888 + BDIRQ("bd72720_int_vsys_uv_res", BD_ISR_NAME(vsys_uv_res)), 889 + BDIRQ("bd72720_int_vsys_uv_det", BD_ISR_NAME(vsys_uv_det)), 890 + BDIRQ("bd72720_int_vsys_lo_res", BD_ISR_NAME(vsys_low_res)), 891 + BDIRQ("bd72720_int_vsys_lo_det", BD_ISR_NAME(vsys_low_det)), 892 + BDIRQ("bd72720_int_vsys_ov_res", BD_ISR_NAME(vsys_ov_res)), 893 + BDIRQ("bd72720_int_vsys_ov_det", BD_ISR_NAME(vsys_ov_det)), 894 + BDIRQ("bd72720_int_bat_ilim", BD_ISR_NAME(vbus_curr_limit)), 895 + BDIRQ("bd72720_int_chg_done", bd718x7_chg_done), 896 + BDIRQ("bd72720_int_extemp_tout", BD_ISR_NAME(chg_wdg_temp)), 897 + BDIRQ("bd72720_int_chg_wdt_exp", BD_ISR_NAME(chg_wdg)), 898 + BDIRQ("bd72720_int_bat_mnt_out", BD_ISR_NAME(rechg_res)), 899 + BDIRQ("bd72720_int_bat_mnt_in", BD_ISR_NAME(rechg_det)), 900 + BDIRQ("bd72720_int_chg_trns", BD_ISR_NAME(chg_state_changed)), 901 + 902 + BDIRQ("bd72720_int_vbat_mon_res", BD_ISR_NAME(bat_mon_res)), 903 + BDIRQ("bd72720_int_vbat_mon_det", BD_ISR_NAME(bat_mon)), 904 + BDIRQ("bd72720_int_vbat_sht_res", BD_ISR_NAME(bat_short_res)), 905 + BDIRQ("bd72720_int_vbat_sht_det", BD_ISR_NAME(bat_short)), 906 + BDIRQ("bd72720_int_vbat_lo_res", BD_ISR_NAME(bat_low_res)), 907 + BDIRQ("bd72720_int_vbat_lo_det", BD_ISR_NAME(bat_low)), 908 + BDIRQ("bd72720_int_vbat_ov_res", BD_ISR_NAME(bat_ov_res)), 909 + BDIRQ("bd72720_int_vbat_ov_det", BD_ISR_NAME(bat_ov)), 910 + BDIRQ("bd72720_int_bat_rmv", BD_ISR_NAME(bat_removed)), 911 + BDIRQ("bd72720_int_bat_det", BD_ISR_NAME(bat_det)), 912 + BDIRQ("bd72720_int_dbat_det", BD_ISR_NAME(bat_dead)), 913 + BDIRQ("bd72720_int_bat_temp_trns", BD_ISR_NAME(temp_transit)), 914 + BDIRQ("bd72720_int_lobtmp_res", BD_ISR_NAME(temp_bat_low_res)), 915 + BDIRQ("bd72720_int_lobtmp_det", BD_ISR_NAME(temp_bat_low)), 916 + BDIRQ("bd72720_int_ovbtmp_res", BD_ISR_NAME(temp_bat_hi_res)), 917 + BDIRQ("bd72720_int_ovbtmp_det", BD_ISR_NAME(temp_bat_hi)), 918 + BDIRQ("bd72720_int_ocur1_res", BD_ISR_NAME(bat_oc1_res)), 919 + BDIRQ("bd72720_int_ocur1_det", BD_ISR_NAME(bat_oc1)), 920 + BDIRQ("bd72720_int_ocur2_res", BD_ISR_NAME(bat_oc2_res)), 921 + BDIRQ("bd72720_int_ocur2_det", BD_ISR_NAME(bat_oc2)), 922 + BDIRQ("bd72720_int_ocur3_res", BD_ISR_NAME(bat_oc3_res)), 923 + BDIRQ("bd72720_int_ocur3_det", BD_ISR_NAME(bat_oc3)), 924 + BDIRQ("bd72720_int_cc_mon2_det", BD_ISR_NAME(bat_cc_mon)), 925 + }; 917 926 int num_irqs; 918 927 const struct bd7182x_irq_res *irqs; 919 928 ··· 970 889 case ROHM_CHIP_TYPE_BD71815: 971 890 irqs = &bd71815_irqs[0]; 972 891 num_irqs = ARRAY_SIZE(bd71815_irqs); 892 + break; 893 + case ROHM_CHIP_TYPE_BD72720: 894 + irqs = &bd72720_irqs[0]; 895 + num_irqs = ARRAY_SIZE(bd72720_irqs); 973 896 break; 974 897 default: 975 898 return -EINVAL; ··· 1043 958 struct power_supply_config ac_cfg = {}; 1044 959 struct power_supply_config bat_cfg = {}; 1045 960 int ret; 1046 - struct regmap *regmap; 1047 - 1048 - regmap = dev_get_regmap(pdev->dev.parent, NULL); 1049 - if (!regmap) { 1050 - dev_err(&pdev->dev, "No parent regmap\n"); 1051 - return -EINVAL; 1052 - } 1053 961 1054 962 pwr = devm_kzalloc(&pdev->dev, sizeof(*pwr), GFP_KERNEL); 1055 963 if (!pwr) 1056 964 return -ENOMEM; 1057 965 1058 - pwr->regmap = regmap; 1059 - pwr->dev = &pdev->dev; 966 + /* 967 + * The BD72720 MFD device registers two regmaps. Power-supply driver 968 + * uses the "wrap-map", which provides access to both of the I2C slave 969 + * addresses used by the BD72720 970 + */ 1060 971 pwr->chip_type = platform_get_device_id(pdev)->driver_data; 972 + if (pwr->chip_type != ROHM_CHIP_TYPE_BD72720) 973 + pwr->regmap = dev_get_regmap(pdev->dev.parent, NULL); 974 + else 975 + pwr->regmap = dev_get_regmap(pdev->dev.parent, "wrap-map"); 976 + if (!pwr->regmap) { 977 + dev_err(&pdev->dev, "No parent regmap\n"); 978 + return -EINVAL; 979 + } 980 + 981 + pwr->dev = &pdev->dev; 1061 982 1062 983 switch (pwr->chip_type) { 1063 984 case ROHM_CHIP_TYPE_BD71828: ··· 1075 984 pwr->bat_inserted = bd71815_bat_inserted; 1076 985 pwr->get_temp = bd71815_get_temp; 1077 986 pwr->regs = &pwr_regs_bd71815; 987 + break; 988 + case ROHM_CHIP_TYPE_BD72720: 989 + pwr->bat_inserted = bd71828_bat_inserted; 990 + pwr->regs = &pwr_regs_bd72720; 991 + pwr->get_temp = bd71828_get_temp; 992 + dev_dbg(pwr->dev, "Found ROHM BD72720\n"); 1078 993 break; 1079 994 default: 1080 995 dev_err(pwr->dev, "Unknown PMIC\n"); ··· 1127 1030 static const struct platform_device_id bd71828_charger_id[] = { 1128 1031 { "bd71815-power", ROHM_CHIP_TYPE_BD71815 }, 1129 1032 { "bd71828-power", ROHM_CHIP_TYPE_BD71828 }, 1033 + { "bd72720-power", ROHM_CHIP_TYPE_BD72720 }, 1130 1034 { }, 1131 1035 }; 1132 1036 MODULE_DEVICE_TABLE(platform, bd71828_charger_id);
+4 -4
drivers/regulator/Kconfig
··· 241 241 will be called bd71815-regulator. 242 242 243 243 config REGULATOR_BD71828 244 - tristate "ROHM BD71828 Power Regulator" 244 + tristate "ROHM BD71828, BD72720 and BD73900 Power Regulators" 245 245 depends on MFD_ROHM_BD71828 246 246 select REGULATOR_ROHM 247 247 help 248 - This driver supports voltage regulators on ROHM BD71828 PMIC. 249 - This will enable support for the software controllable buck 250 - and LDO regulators. 248 + This driver supports voltage regulators on ROHM BD71828, 249 + BD71879, BD72720 and BD73900 PMICs. This will enable 250 + support for the software controllable buck and LDO regulators. 251 251 252 252 This driver can also be built as a module. If so, the module 253 253 will be called bd71828-regulator.
+1005 -22
drivers/regulator/bd71828-regulator.c
··· 3 3 // bd71828-regulator.c ROHM BD71828GW-DS1 regulator driver 4 4 // 5 5 6 + #include <linux/cleanup.h> 6 7 #include <linux/delay.h> 7 8 #include <linux/err.h> 8 9 #include <linux/interrupt.h> 9 10 #include <linux/kernel.h> 10 11 #include <linux/mfd/rohm-bd71828.h> 12 + #include <linux/mfd/rohm-bd72720.h> 11 13 #include <linux/module.h> 14 + #include <linux/mod_devicetable.h> 12 15 #include <linux/of.h> 13 16 #include <linux/platform_device.h> 14 17 #include <linux/regmap.h> ··· 19 16 #include <linux/regulator/machine.h> 20 17 #include <linux/regulator/of_regulator.h> 21 18 19 + #define BD72720_MASK_LDON_HEAD GENMASK(2, 0) 22 20 struct reg_init { 23 21 unsigned int reg; 24 22 unsigned int mask; ··· 32 28 int reg_init_amnt; 33 29 }; 34 30 35 - static const struct reg_init buck1_inits[] = { 31 + static const struct reg_init bd71828_buck1_inits[] = { 36 32 /* 37 33 * DVS Buck voltages can be changed by register values or via GPIO. 38 34 * Use register accesses by default. ··· 44 40 }, 45 41 }; 46 42 47 - static const struct reg_init buck2_inits[] = { 43 + static const struct reg_init bd71828_buck2_inits[] = { 48 44 { 49 45 .reg = BD71828_REG_PS_CTRL_1, 50 46 .mask = BD71828_MASK_DVS_BUCK2_CTRL, ··· 52 48 }, 53 49 }; 54 50 55 - static const struct reg_init buck6_inits[] = { 51 + static const struct reg_init bd71828_buck6_inits[] = { 56 52 { 57 53 .reg = BD71828_REG_PS_CTRL_1, 58 54 .mask = BD71828_MASK_DVS_BUCK6_CTRL, ··· 60 56 }, 61 57 }; 62 58 63 - static const struct reg_init buck7_inits[] = { 59 + static const struct reg_init bd71828_buck7_inits[] = { 64 60 { 65 61 .reg = BD71828_REG_PS_CTRL_1, 66 62 .mask = BD71828_MASK_DVS_BUCK7_CTRL, ··· 68 64 }, 69 65 }; 70 66 67 + #define BD72720_MASK_DVS_BUCK1_CTRL BIT(4) 68 + #define BD72720_MASK_DVS_LDO1_CTRL BIT(5) 69 + 70 + static const struct reg_init bd72720_buck1_inits[] = { 71 + { 72 + .reg = BD72720_REG_PS_CTRL_2, 73 + .mask = BD72720_MASK_DVS_BUCK1_CTRL, 74 + .val = 0, /* Disable "run-level" control */ 75 + }, 76 + }; 77 + 78 + static const struct reg_init bd72720_ldo1_inits[] = { 79 + { 80 + .reg = BD72720_REG_PS_CTRL_2, 81 + .mask = BD72720_MASK_DVS_LDO1_CTRL, 82 + .val = 0, /* Disable "run-level" control */ 83 + }, 84 + }; 85 + 86 + /* BD71828 Buck voltages */ 71 87 static const struct linear_range bd71828_buck1267_volts[] = { 72 88 REGULATOR_LINEAR_RANGE(500000, 0x00, 0xef, 6250), 73 89 REGULATOR_LINEAR_RANGE(2000000, 0xf0, 0xff, 0), ··· 108 84 REGULATOR_LINEAR_RANGE(3300000, 0x10, 0x1f, 0), 109 85 }; 110 86 87 + /* BD71828 LDO voltages */ 111 88 static const struct linear_range bd71828_ldo_volts[] = { 112 89 REGULATOR_LINEAR_RANGE(800000, 0x00, 0x31, 50000), 113 90 REGULATOR_LINEAR_RANGE(3300000, 0x32, 0x3f, 0), 114 91 }; 115 92 93 + /* BD72720 Buck voltages */ 94 + static const struct linear_range bd72720_buck1234_volts[] = { 95 + REGULATOR_LINEAR_RANGE(500000, 0x00, 0xc0, 6250), 96 + REGULATOR_LINEAR_RANGE(1700000, 0xc1, 0xff, 0), 97 + }; 98 + 99 + static const struct linear_range bd72720_buck589_volts[] = { 100 + REGULATOR_LINEAR_RANGE(500000, 0x00, 0x78, 10000), 101 + REGULATOR_LINEAR_RANGE(1700000, 0x79, 0xff, 0), 102 + }; 103 + 104 + static const struct linear_range bd72720_buck67_volts[] = { 105 + REGULATOR_LINEAR_RANGE(1500000, 0x00, 0xb4, 10000), 106 + REGULATOR_LINEAR_RANGE(3300000, 0xb5, 0xff, 0), 107 + }; 108 + 109 + /* 110 + * The BUCK10 on BD72720 has two modes of operation, depending on a LDON_HEAD 111 + * setting. When LDON_HEAD is 0x0, the behaviour is as with other bucks, eg. 112 + * voltage can be set to a values indicated below using the VSEL register. 113 + * 114 + * However, when LDON_HEAD is set to 0x1 ... 0x7, BUCK 10 voltage is, according 115 + * to the data-sheet, "automatically adjusted following LDON_HEAD setting and 116 + * clamped to BUCK10_VID setting". 117 + * 118 + * Again, reading the data-sheet shows a "typical connection" where the BUCK10 119 + * is used to supply the LDOs 1-4. My assumption is that in practice, this 120 + * means that the BUCK10 voltage will be adjusted based on the maximum output 121 + * of the LDO 1-4 (to minimize power loss). This makes sense. 122 + * 123 + * Auto-adjusting regulators aren't something I really like to model in the 124 + * driver though - and, if the auto-adjustment works as intended, then there 125 + * should really be no need to software to care about the buck10 voltages. 126 + * If enable/disable control is still needed, we can implement buck10 as a 127 + * regulator with only the enable/disable ops - and device-tree can be used 128 + * to model the supply-relations. I believe this could allow the regulator 129 + * framework to automagically disable the BUCK10 if all LDOs that are being 130 + * supplied by it are disabled. 131 + */ 132 + static const struct linear_range bd72720_buck10_volts[] = { 133 + REGULATOR_LINEAR_RANGE(500000, 0x00, 0xc0, 6250), 134 + REGULATOR_LINEAR_RANGE(1700000, 0xc1, 0xff, 0), 135 + }; 136 + 137 + /* BD72720 LDO voltages */ 138 + static const struct linear_range bd72720_ldo1234_volts[] = { 139 + REGULATOR_LINEAR_RANGE(500000, 0x00, 0x50, 6250), 140 + REGULATOR_LINEAR_RANGE(1000000, 0x51, 0x7f, 0), 141 + }; 142 + 143 + static const struct linear_range bd72720_ldo57891011_volts[] = { 144 + REGULATOR_LINEAR_RANGE(750000, 0x00, 0xff, 10000), 145 + }; 146 + 147 + static const struct linear_range bd72720_ldo6_volts[] = { 148 + REGULATOR_LINEAR_RANGE(600000, 0x00, 0x78, 10000), 149 + REGULATOR_LINEAR_RANGE(1800000, 0x79, 0x7f, 0), 150 + }; 151 + 116 152 static const unsigned int bd71828_ramp_delay[] = { 2500, 5000, 10000, 20000 }; 153 + 154 + /* 155 + * BD72720 supports setting both the ramp-up and ramp-down values 156 + * separately. Do we need to support ramp-down setting? 157 + */ 158 + static const unsigned int bd72720_ramp_delay[] = { 5000, 7500, 10000, 12500 }; 117 159 118 160 static int buck_set_hw_dvs_levels(struct device_node *np, 119 161 const struct regulator_desc *desc, ··· 192 102 return rohm_regulator_set_dvs_levels(&data->dvs, np, desc, cfg->regmap); 193 103 } 194 104 195 - static int ldo6_parse_dt(struct device_node *np, 196 - const struct regulator_desc *desc, 197 - struct regulator_config *cfg) 105 + static int bd71828_ldo6_parse_dt(struct device_node *np, 106 + const struct regulator_desc *desc, 107 + struct regulator_config *cfg) 198 108 { 199 109 int ret, i; 200 110 uint32_t uv = 0; ··· 261 171 .is_enabled = regulator_is_enabled_regmap, 262 172 }; 263 173 174 + static const struct regulator_ops bd72720_regulator_ops = { 175 + .enable = regulator_enable_regmap, 176 + .disable = regulator_disable_regmap, 177 + .is_enabled = regulator_is_enabled_regmap, 178 + .list_voltage = regulator_list_voltage_linear_range, 179 + .set_voltage_sel = regulator_set_voltage_sel_regmap, 180 + .get_voltage_sel = regulator_get_voltage_sel_regmap, 181 + .set_voltage_time_sel = regulator_set_voltage_time_sel, 182 + .set_ramp_delay = regulator_set_ramp_delay_regmap, 183 + }; 184 + 185 + static const struct regulator_ops bd72720_buck10_ldon_head_op = { 186 + .enable = regulator_enable_regmap, 187 + .disable = regulator_disable_regmap, 188 + .is_enabled = regulator_is_enabled_regmap, 189 + .set_ramp_delay = regulator_set_ramp_delay_regmap, 190 + }; 191 + 264 192 static const struct bd71828_regulator_data bd71828_rdata[] = { 265 193 { 266 194 .desc = { ··· 320 212 */ 321 213 .lpsr_on_mask = BD71828_MASK_LPSR_EN, 322 214 }, 323 - .reg_inits = buck1_inits, 324 - .reg_init_amnt = ARRAY_SIZE(buck1_inits), 215 + .reg_inits = bd71828_buck1_inits, 216 + .reg_init_amnt = ARRAY_SIZE(bd71828_buck1_inits), 325 217 }, 326 218 { 327 219 .desc = { ··· 361 253 .lpsr_reg = BD71828_REG_BUCK2_SUSP_VOLT, 362 254 .lpsr_mask = BD71828_MASK_BUCK1267_VOLT, 363 255 }, 364 - .reg_inits = buck2_inits, 365 - .reg_init_amnt = ARRAY_SIZE(buck2_inits), 256 + .reg_inits = bd71828_buck2_inits, 257 + .reg_init_amnt = ARRAY_SIZE(bd71828_buck2_inits), 366 258 }, 367 259 { 368 260 .desc = { ··· 507 399 .lpsr_reg = BD71828_REG_BUCK6_SUSP_VOLT, 508 400 .lpsr_mask = BD71828_MASK_BUCK1267_VOLT, 509 401 }, 510 - .reg_inits = buck6_inits, 511 - .reg_init_amnt = ARRAY_SIZE(buck6_inits), 402 + .reg_inits = bd71828_buck6_inits, 403 + .reg_init_amnt = ARRAY_SIZE(bd71828_buck6_inits), 512 404 }, 513 405 { 514 406 .desc = { ··· 548 440 .lpsr_reg = BD71828_REG_BUCK7_SUSP_VOLT, 549 441 .lpsr_mask = BD71828_MASK_BUCK1267_VOLT, 550 442 }, 551 - .reg_inits = buck7_inits, 552 - .reg_init_amnt = ARRAY_SIZE(buck7_inits), 443 + .reg_inits = bd71828_buck7_inits, 444 + .reg_init_amnt = ARRAY_SIZE(bd71828_buck7_inits), 553 445 }, 554 446 { 555 447 .desc = { ··· 741 633 * LDO6 only supports enable/disable for all states. 742 634 * Voltage for LDO6 is fixed. 743 635 */ 744 - .of_parse_cb = ldo6_parse_dt, 636 + .of_parse_cb = bd71828_ldo6_parse_dt, 745 637 }, 746 638 }, { 747 639 .desc = { ··· 785 677 }, 786 678 }; 787 679 680 + #define BD72720_BUCK10_DESC_INDEX 10 681 + #define BD72720_NUM_BUCK_VOLTS 0x100 682 + #define BD72720_NUM_LDO_VOLTS 0x100 683 + #define BD72720_NUM_LDO12346_VOLTS 0x80 684 + 685 + static const struct bd71828_regulator_data bd72720_rdata[] = { 686 + { 687 + .desc = { 688 + .name = "buck1", 689 + .of_match = of_match_ptr("buck1"), 690 + .regulators_node = of_match_ptr("regulators"), 691 + .id = BD72720_BUCK1, 692 + .type = REGULATOR_VOLTAGE, 693 + 694 + /* 695 + * The BD72720 BUCK1 and LDO1 support GPIO toggled 696 + * sub-RUN states called RUN0, RUN1, RUN2 and RUN3. 697 + * The "operating mode" (sub-RUN states or normal) 698 + * can be changed by a register. 699 + * 700 + * When the sub-RUN states are used, the voltage and 701 + * enable state depend on a state specific 702 + * configuration. The voltage and enable configuration 703 + * for BUCK1 and LDO1 can be defined for each sub-RUN 704 + * state using BD72720_REG_[BUCK,LDO]1_VSEL_R[0,1,2,3] 705 + * voltage selection registers and the bits 706 + * BD72720_MASK_RUN_[0,1,2,3]_EN in the enable registers. 707 + * The PMIC will change both the BUCK1 and LDO1 voltages 708 + * to the states defined in these registers when 709 + * "DVS GPIOs" are toggled. 710 + * 711 + * If RUN 0 .. RUN 4 states are to be used, the normal 712 + * voltage configuration mechanisms do not apply 713 + * and we should overwrite the ops and ignore the 714 + * voltage setting/getting registers which are setup 715 + * here. This is not supported for now. If you need 716 + * this functionality, you may try merging functionality 717 + * from a downstream driver: 718 + * https://rohmsemiconductor.github.io/Linux-Kernel-PMIC-Drivers/BD72720/ 719 + */ 720 + .ops = &bd72720_regulator_ops, 721 + .linear_ranges = bd72720_buck1234_volts, 722 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck1234_volts), 723 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 724 + .enable_reg = BD72720_REG_BUCK1_ON, 725 + .enable_mask = BD72720_MASK_RUN_B_EN, 726 + .vsel_reg = BD72720_REG_BUCK1_VSEL_RB, 727 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 728 + 729 + .ramp_delay_table = bd72720_ramp_delay, 730 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 731 + .ramp_reg = BD72720_REG_BUCK1_MODE, 732 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 733 + .owner = THIS_MODULE, 734 + .of_parse_cb = buck_set_hw_dvs_levels, 735 + }, 736 + .dvs = { 737 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 738 + ROHM_DVS_LEVEL_SUSPEND | 739 + ROHM_DVS_LEVEL_LPSR, /* Deep idle in data-sheet */ 740 + .run_reg = BD72720_REG_BUCK1_VSEL_RB, 741 + .run_mask = BD72720_MASK_BUCK_VSEL, 742 + .idle_reg = BD72720_REG_BUCK1_VSEL_I, 743 + .idle_mask = BD72720_MASK_BUCK_VSEL, 744 + .idle_on_mask = BD72720_MASK_IDLE_EN, 745 + .suspend_reg = BD72720_REG_BUCK1_VSEL_S, 746 + .suspend_mask = BD72720_MASK_BUCK_VSEL, 747 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 748 + .lpsr_reg = BD72720_REG_BUCK1_VSEL_DI, 749 + .lpsr_mask = BD72720_MASK_BUCK_VSEL, 750 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 751 + }, 752 + .reg_inits = bd72720_buck1_inits, 753 + .reg_init_amnt = ARRAY_SIZE(bd72720_buck1_inits), 754 + }, { 755 + .desc = { 756 + .name = "buck2", 757 + .of_match = of_match_ptr("buck2"), 758 + .regulators_node = of_match_ptr("regulators"), 759 + .id = BD72720_BUCK2, 760 + .type = REGULATOR_VOLTAGE, 761 + .ops = &bd72720_regulator_ops, 762 + .linear_ranges = bd72720_buck1234_volts, 763 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck1234_volts), 764 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 765 + .enable_reg = BD72720_REG_BUCK2_ON, 766 + .enable_mask = BD72720_MASK_RUN_B_EN, 767 + .vsel_reg = BD72720_REG_BUCK2_VSEL_R, 768 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 769 + 770 + .ramp_delay_table = bd72720_ramp_delay, 771 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 772 + .ramp_reg = BD72720_REG_BUCK2_MODE, 773 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 774 + .owner = THIS_MODULE, 775 + .of_parse_cb = buck_set_hw_dvs_levels, 776 + }, 777 + .dvs = { 778 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 779 + ROHM_DVS_LEVEL_SUSPEND | 780 + ROHM_DVS_LEVEL_LPSR, 781 + .run_reg = BD72720_REG_BUCK2_VSEL_R, 782 + .run_mask = BD72720_MASK_BUCK_VSEL, 783 + .idle_reg = BD72720_REG_BUCK2_VSEL_I, 784 + .idle_mask = BD72720_MASK_BUCK_VSEL, 785 + .idle_on_mask = BD72720_MASK_IDLE_EN, 786 + .suspend_reg = BD72720_REG_BUCK2_VSEL_S, 787 + .suspend_mask = BD72720_MASK_BUCK_VSEL, 788 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 789 + .lpsr_reg = BD72720_REG_BUCK2_VSEL_DI, 790 + .lpsr_mask = BD72720_MASK_BUCK_VSEL, 791 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 792 + }, 793 + }, { 794 + .desc = { 795 + .name = "buck3", 796 + .of_match = of_match_ptr("buck3"), 797 + .regulators_node = of_match_ptr("regulators"), 798 + .id = BD72720_BUCK3, 799 + .type = REGULATOR_VOLTAGE, 800 + .ops = &bd72720_regulator_ops, 801 + .linear_ranges = bd72720_buck1234_volts, 802 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck1234_volts), 803 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 804 + .enable_reg = BD72720_REG_BUCK3_ON, 805 + .enable_mask = BD72720_MASK_RUN_B_EN, 806 + .vsel_reg = BD72720_REG_BUCK3_VSEL_R, 807 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 808 + 809 + .ramp_delay_table = bd72720_ramp_delay, 810 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 811 + .ramp_reg = BD72720_REG_BUCK3_MODE, 812 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 813 + .owner = THIS_MODULE, 814 + .of_parse_cb = buck_set_hw_dvs_levels, 815 + }, 816 + .dvs = { 817 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 818 + ROHM_DVS_LEVEL_SUSPEND | 819 + ROHM_DVS_LEVEL_LPSR, 820 + .run_reg = BD72720_REG_BUCK3_VSEL_R, 821 + .run_mask = BD72720_MASK_BUCK_VSEL, 822 + .idle_reg = BD72720_REG_BUCK3_VSEL_I, 823 + .idle_mask = BD72720_MASK_BUCK_VSEL, 824 + .idle_on_mask = BD72720_MASK_IDLE_EN, 825 + .suspend_reg = BD72720_REG_BUCK3_VSEL_S, 826 + .suspend_mask = BD72720_MASK_BUCK_VSEL, 827 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 828 + .lpsr_reg = BD72720_REG_BUCK3_VSEL_DI, 829 + .lpsr_mask = BD72720_MASK_BUCK_VSEL, 830 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 831 + }, 832 + }, { 833 + .desc = { 834 + .name = "buck4", 835 + .of_match = of_match_ptr("buck4"), 836 + .regulators_node = of_match_ptr("regulators"), 837 + .id = BD72720_BUCK4, 838 + .type = REGULATOR_VOLTAGE, 839 + .ops = &bd72720_regulator_ops, 840 + .linear_ranges = bd72720_buck1234_volts, 841 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck1234_volts), 842 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 843 + .enable_reg = BD72720_REG_BUCK4_ON, 844 + .enable_mask = BD72720_MASK_RUN_B_EN, 845 + .vsel_reg = BD72720_REG_BUCK4_VSEL_R, 846 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 847 + 848 + .ramp_delay_table = bd72720_ramp_delay, 849 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 850 + .ramp_reg = BD72720_REG_BUCK4_MODE, 851 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 852 + .owner = THIS_MODULE, 853 + .of_parse_cb = buck_set_hw_dvs_levels, 854 + }, 855 + .dvs = { 856 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 857 + ROHM_DVS_LEVEL_SUSPEND | 858 + ROHM_DVS_LEVEL_LPSR, 859 + .run_reg = BD72720_REG_BUCK4_VSEL_R, 860 + .run_mask = BD72720_MASK_BUCK_VSEL, 861 + .idle_reg = BD72720_REG_BUCK4_VSEL_I, 862 + .idle_mask = BD72720_MASK_BUCK_VSEL, 863 + .idle_on_mask = BD72720_MASK_IDLE_EN, 864 + .suspend_reg = BD72720_REG_BUCK4_VSEL_S, 865 + .suspend_mask = BD72720_MASK_BUCK_VSEL, 866 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 867 + .lpsr_reg = BD72720_REG_BUCK4_VSEL_DI, 868 + .lpsr_mask = BD72720_MASK_BUCK_VSEL, 869 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 870 + }, 871 + }, { 872 + .desc = { 873 + .name = "buck5", 874 + .of_match = of_match_ptr("buck5"), 875 + .regulators_node = of_match_ptr("regulators"), 876 + .id = BD72720_BUCK5, 877 + .type = REGULATOR_VOLTAGE, 878 + .ops = &bd72720_regulator_ops, 879 + .linear_ranges = bd72720_buck589_volts, 880 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck589_volts), 881 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 882 + .enable_reg = BD72720_REG_BUCK5_ON, 883 + .enable_mask = BD72720_MASK_RUN_B_EN, 884 + .vsel_reg = BD72720_REG_BUCK5_VSEL, 885 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 886 + 887 + .ramp_delay_table = bd72720_ramp_delay, 888 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 889 + .ramp_reg = BD72720_REG_BUCK5_MODE, 890 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 891 + .owner = THIS_MODULE, 892 + .of_parse_cb = buck_set_hw_dvs_levels, 893 + }, 894 + .dvs = { 895 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 896 + ROHM_DVS_LEVEL_SUSPEND | 897 + ROHM_DVS_LEVEL_LPSR, 898 + .run_reg = BD72720_REG_BUCK5_VSEL, 899 + .run_mask = BD72720_MASK_BUCK_VSEL, 900 + .idle_on_mask = BD72720_MASK_IDLE_EN, 901 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 902 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 903 + }, 904 + }, { 905 + .desc = { 906 + .name = "buck6", 907 + .of_match = of_match_ptr("buck6"), 908 + .regulators_node = of_match_ptr("regulators"), 909 + .id = BD72720_BUCK6, 910 + .type = REGULATOR_VOLTAGE, 911 + .ops = &bd72720_regulator_ops, 912 + .linear_ranges = bd72720_buck67_volts, 913 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck67_volts), 914 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 915 + .enable_reg = BD72720_REG_BUCK6_ON, 916 + .enable_mask = BD72720_MASK_RUN_B_EN, 917 + .vsel_reg = BD72720_REG_BUCK6_VSEL, 918 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 919 + 920 + .ramp_delay_table = bd72720_ramp_delay, 921 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 922 + .ramp_reg = BD72720_REG_BUCK6_MODE, 923 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 924 + .owner = THIS_MODULE, 925 + .of_parse_cb = buck_set_hw_dvs_levels, 926 + }, 927 + .dvs = { 928 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 929 + ROHM_DVS_LEVEL_SUSPEND | 930 + ROHM_DVS_LEVEL_LPSR, 931 + .run_reg = BD72720_REG_BUCK6_VSEL, 932 + .run_mask = BD72720_MASK_BUCK_VSEL, 933 + .idle_on_mask = BD72720_MASK_IDLE_EN, 934 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 935 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 936 + }, 937 + }, { 938 + .desc = { 939 + .name = "buck7", 940 + .of_match = of_match_ptr("buck7"), 941 + .regulators_node = of_match_ptr("regulators"), 942 + .id = BD72720_BUCK7, 943 + .type = REGULATOR_VOLTAGE, 944 + .ops = &bd72720_regulator_ops, 945 + .linear_ranges = bd72720_buck67_volts, 946 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck67_volts), 947 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 948 + .enable_reg = BD72720_REG_BUCK7_ON, 949 + .enable_mask = BD72720_MASK_RUN_B_EN, 950 + .vsel_reg = BD72720_REG_BUCK7_VSEL, 951 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 952 + 953 + .ramp_delay_table = bd72720_ramp_delay, 954 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 955 + .ramp_reg = BD72720_REG_BUCK7_MODE, 956 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 957 + .owner = THIS_MODULE, 958 + .of_parse_cb = buck_set_hw_dvs_levels, 959 + }, 960 + .dvs = { 961 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 962 + ROHM_DVS_LEVEL_SUSPEND | 963 + ROHM_DVS_LEVEL_LPSR, 964 + .run_reg = BD72720_REG_BUCK7_VSEL, 965 + .run_mask = BD72720_MASK_BUCK_VSEL, 966 + .idle_on_mask = BD72720_MASK_IDLE_EN, 967 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 968 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 969 + }, 970 + }, { 971 + .desc = { 972 + .name = "buck8", 973 + .of_match = of_match_ptr("buck8"), 974 + .regulators_node = of_match_ptr("regulators"), 975 + .id = BD72720_BUCK8, 976 + .type = REGULATOR_VOLTAGE, 977 + .ops = &bd72720_regulator_ops, 978 + .linear_ranges = bd72720_buck589_volts, 979 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck589_volts), 980 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 981 + .enable_reg = BD72720_REG_BUCK8_ON, 982 + .enable_mask = BD72720_MASK_RUN_B_EN, 983 + .vsel_reg = BD72720_REG_BUCK8_VSEL, 984 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 985 + 986 + .ramp_delay_table = bd72720_ramp_delay, 987 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 988 + .ramp_reg = BD72720_REG_BUCK8_MODE, 989 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 990 + .owner = THIS_MODULE, 991 + .of_parse_cb = buck_set_hw_dvs_levels, 992 + }, 993 + .dvs = { 994 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 995 + ROHM_DVS_LEVEL_SUSPEND | 996 + ROHM_DVS_LEVEL_LPSR, 997 + .run_reg = BD72720_REG_BUCK8_VSEL, 998 + .run_mask = BD72720_MASK_BUCK_VSEL, 999 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1000 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1001 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1002 + }, 1003 + }, { 1004 + .desc = { 1005 + .name = "buck9", 1006 + .of_match = of_match_ptr("buck9"), 1007 + .regulators_node = of_match_ptr("regulators"), 1008 + .id = BD72720_BUCK9, 1009 + .type = REGULATOR_VOLTAGE, 1010 + .ops = &bd72720_regulator_ops, 1011 + .linear_ranges = bd72720_buck589_volts, 1012 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck589_volts), 1013 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 1014 + .enable_reg = BD72720_REG_BUCK9_ON, 1015 + .enable_mask = BD72720_MASK_RUN_B_EN, 1016 + .vsel_reg = BD72720_REG_BUCK9_VSEL, 1017 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 1018 + 1019 + .ramp_delay_table = bd72720_ramp_delay, 1020 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1021 + .ramp_reg = BD72720_REG_BUCK9_MODE, 1022 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1023 + .owner = THIS_MODULE, 1024 + .of_parse_cb = buck_set_hw_dvs_levels, 1025 + }, 1026 + .dvs = { 1027 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1028 + ROHM_DVS_LEVEL_SUSPEND | 1029 + ROHM_DVS_LEVEL_LPSR, 1030 + .run_reg = BD72720_REG_BUCK9_VSEL, 1031 + .run_mask = BD72720_MASK_BUCK_VSEL, 1032 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1033 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1034 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1035 + }, 1036 + }, { 1037 + .desc = { 1038 + .name = "buck10", 1039 + .of_match = of_match_ptr("buck10"), 1040 + .regulators_node = of_match_ptr("regulators"), 1041 + .id = BD72720_BUCK10, 1042 + .type = REGULATOR_VOLTAGE, 1043 + .ops = &bd72720_regulator_ops, 1044 + .linear_ranges = bd72720_buck10_volts, 1045 + .n_linear_ranges = ARRAY_SIZE(bd72720_buck10_volts), 1046 + .n_voltages = BD72720_NUM_BUCK_VOLTS, 1047 + .enable_reg = BD72720_REG_BUCK10_ON, 1048 + .enable_mask = BD72720_MASK_RUN_B_EN, 1049 + .vsel_reg = BD72720_REG_BUCK10_VSEL, 1050 + .vsel_mask = BD72720_MASK_BUCK_VSEL, 1051 + 1052 + .ramp_delay_table = bd72720_ramp_delay, 1053 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1054 + .ramp_reg = BD72720_REG_BUCK10_MODE, 1055 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1056 + .owner = THIS_MODULE, 1057 + .of_parse_cb = buck_set_hw_dvs_levels, 1058 + }, 1059 + .dvs = { 1060 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1061 + ROHM_DVS_LEVEL_SUSPEND | 1062 + ROHM_DVS_LEVEL_LPSR, 1063 + .run_reg = BD72720_REG_BUCK10_VSEL, 1064 + .run_mask = BD72720_MASK_BUCK_VSEL, 1065 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1066 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1067 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1068 + }, 1069 + }, { 1070 + .desc = { 1071 + .name = "ldo1", 1072 + .of_match = of_match_ptr("ldo1"), 1073 + .regulators_node = of_match_ptr("regulators"), 1074 + .id = BD72720_LDO1, 1075 + .type = REGULATOR_VOLTAGE, 1076 + .ops = &bd72720_regulator_ops, 1077 + .linear_ranges = bd72720_ldo1234_volts, 1078 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo1234_volts), 1079 + .n_voltages = BD72720_NUM_LDO12346_VOLTS, 1080 + .enable_reg = BD72720_REG_LDO1_ON, 1081 + .enable_mask = BD72720_MASK_RUN_B_EN, 1082 + .vsel_reg = BD72720_REG_LDO1_VSEL_RB, 1083 + .vsel_mask = BD72720_MASK_LDO12346_VSEL, 1084 + 1085 + .ramp_delay_table = bd72720_ramp_delay, 1086 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1087 + .ramp_reg = BD72720_REG_LDO1_MODE1, 1088 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1089 + .owner = THIS_MODULE, 1090 + .of_parse_cb = buck_set_hw_dvs_levels, 1091 + }, 1092 + .dvs = { 1093 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1094 + ROHM_DVS_LEVEL_SUSPEND | 1095 + ROHM_DVS_LEVEL_LPSR, 1096 + .run_reg = BD72720_REG_LDO1_VSEL_RB, 1097 + .run_mask = BD72720_MASK_LDO12346_VSEL, 1098 + .idle_reg = BD72720_REG_LDO1_VSEL_I, 1099 + .idle_mask = BD72720_MASK_LDO12346_VSEL, 1100 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1101 + .suspend_reg = BD72720_REG_LDO1_VSEL_S, 1102 + .suspend_mask = BD72720_MASK_LDO12346_VSEL, 1103 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1104 + .lpsr_reg = BD72720_REG_LDO1_VSEL_DI, 1105 + .lpsr_mask = BD72720_MASK_LDO12346_VSEL, 1106 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1107 + }, 1108 + .reg_inits = bd72720_ldo1_inits, 1109 + .reg_init_amnt = ARRAY_SIZE(bd72720_ldo1_inits), 1110 + }, { 1111 + .desc = { 1112 + .name = "ldo2", 1113 + .of_match = of_match_ptr("ldo2"), 1114 + .regulators_node = of_match_ptr("regulators"), 1115 + .id = BD72720_LDO2, 1116 + .type = REGULATOR_VOLTAGE, 1117 + .ops = &bd72720_regulator_ops, 1118 + .linear_ranges = bd72720_ldo1234_volts, 1119 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo1234_volts), 1120 + .n_voltages = BD72720_NUM_LDO12346_VOLTS, 1121 + .enable_reg = BD72720_REG_LDO2_ON, 1122 + .enable_mask = BD72720_MASK_RUN_B_EN, 1123 + .vsel_reg = BD72720_REG_LDO2_VSEL_R, 1124 + .vsel_mask = BD72720_MASK_LDO12346_VSEL, 1125 + 1126 + .ramp_delay_table = bd72720_ramp_delay, 1127 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1128 + .ramp_reg = BD72720_REG_LDO2_MODE, 1129 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1130 + .owner = THIS_MODULE, 1131 + .of_parse_cb = buck_set_hw_dvs_levels, 1132 + }, 1133 + .dvs = { 1134 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1135 + ROHM_DVS_LEVEL_SUSPEND | 1136 + ROHM_DVS_LEVEL_LPSR, 1137 + .run_reg = BD72720_REG_LDO2_VSEL_R, 1138 + .run_mask = BD72720_MASK_LDO12346_VSEL, 1139 + .idle_reg = BD72720_REG_LDO2_VSEL_I, 1140 + .idle_mask = BD72720_MASK_LDO12346_VSEL, 1141 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1142 + .suspend_reg = BD72720_REG_LDO2_VSEL_S, 1143 + .suspend_mask = BD72720_MASK_LDO12346_VSEL, 1144 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1145 + .lpsr_reg = BD72720_REG_LDO2_VSEL_DI, 1146 + .lpsr_mask = BD72720_MASK_LDO12346_VSEL, 1147 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1148 + }, 1149 + }, { 1150 + .desc = { 1151 + .name = "ldo3", 1152 + .of_match = of_match_ptr("ldo3"), 1153 + .regulators_node = of_match_ptr("regulators"), 1154 + .id = BD72720_LDO3, 1155 + .type = REGULATOR_VOLTAGE, 1156 + .ops = &bd72720_regulator_ops, 1157 + .linear_ranges = bd72720_ldo1234_volts, 1158 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo1234_volts), 1159 + .n_voltages = BD72720_NUM_LDO12346_VOLTS, 1160 + .enable_reg = BD72720_REG_LDO3_ON, 1161 + .enable_mask = BD72720_MASK_RUN_B_EN, 1162 + .vsel_reg = BD72720_REG_LDO3_VSEL_R, 1163 + .vsel_mask = BD72720_MASK_LDO12346_VSEL, 1164 + 1165 + .ramp_delay_table = bd72720_ramp_delay, 1166 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1167 + .ramp_reg = BD72720_REG_LDO3_MODE, 1168 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1169 + .owner = THIS_MODULE, 1170 + .of_parse_cb = buck_set_hw_dvs_levels, 1171 + }, 1172 + .dvs = { 1173 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1174 + ROHM_DVS_LEVEL_SUSPEND | 1175 + ROHM_DVS_LEVEL_LPSR, 1176 + .run_reg = BD72720_REG_LDO3_VSEL_R, 1177 + .run_mask = BD72720_MASK_LDO12346_VSEL, 1178 + .idle_reg = BD72720_REG_LDO3_VSEL_I, 1179 + .idle_mask = BD72720_MASK_LDO12346_VSEL, 1180 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1181 + .suspend_reg = BD72720_REG_LDO3_VSEL_S, 1182 + .suspend_mask = BD72720_MASK_LDO12346_VSEL, 1183 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1184 + .lpsr_reg = BD72720_REG_LDO3_VSEL_DI, 1185 + .lpsr_mask = BD72720_MASK_LDO12346_VSEL, 1186 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1187 + }, 1188 + }, { 1189 + .desc = { 1190 + .name = "ldo4", 1191 + .of_match = of_match_ptr("ldo4"), 1192 + .regulators_node = of_match_ptr("regulators"), 1193 + .id = BD72720_LDO4, 1194 + .type = REGULATOR_VOLTAGE, 1195 + .ops = &bd72720_regulator_ops, 1196 + .linear_ranges = bd72720_ldo1234_volts, 1197 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo1234_volts), 1198 + .n_voltages = BD72720_NUM_LDO12346_VOLTS, 1199 + .enable_reg = BD72720_REG_LDO4_ON, 1200 + .enable_mask = BD72720_MASK_RUN_B_EN, 1201 + .vsel_reg = BD72720_REG_LDO4_VSEL_R, 1202 + .vsel_mask = BD72720_MASK_LDO12346_VSEL, 1203 + 1204 + .ramp_delay_table = bd72720_ramp_delay, 1205 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1206 + .ramp_reg = BD72720_REG_LDO4_MODE, 1207 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1208 + .owner = THIS_MODULE, 1209 + .of_parse_cb = buck_set_hw_dvs_levels, 1210 + }, 1211 + .dvs = { 1212 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1213 + ROHM_DVS_LEVEL_SUSPEND | 1214 + ROHM_DVS_LEVEL_LPSR, 1215 + .run_reg = BD72720_REG_LDO4_VSEL_R, 1216 + .run_mask = BD72720_MASK_LDO12346_VSEL, 1217 + .idle_reg = BD72720_REG_LDO4_VSEL_I, 1218 + .idle_mask = BD72720_MASK_LDO12346_VSEL, 1219 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1220 + .suspend_reg = BD72720_REG_LDO4_VSEL_S, 1221 + .suspend_mask = BD72720_MASK_LDO12346_VSEL, 1222 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1223 + .lpsr_reg = BD72720_REG_LDO4_VSEL_DI, 1224 + .lpsr_mask = BD72720_MASK_LDO12346_VSEL, 1225 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1226 + }, 1227 + }, { 1228 + .desc = { 1229 + .name = "ldo5", 1230 + .of_match = of_match_ptr("ldo5"), 1231 + .regulators_node = of_match_ptr("regulators"), 1232 + .id = BD72720_LDO5, 1233 + .type = REGULATOR_VOLTAGE, 1234 + .ops = &bd72720_regulator_ops, 1235 + .linear_ranges = bd72720_ldo57891011_volts, 1236 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo57891011_volts), 1237 + .n_voltages = BD72720_NUM_LDO_VOLTS, 1238 + .enable_reg = BD72720_REG_LDO5_ON, 1239 + .enable_mask = BD72720_MASK_RUN_B_EN, 1240 + .vsel_reg = BD72720_REG_LDO5_VSEL, 1241 + .vsel_mask = BD72720_MASK_LDO_VSEL, 1242 + 1243 + .ramp_delay_table = bd72720_ramp_delay, 1244 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1245 + .ramp_reg = BD72720_REG_LDO5_MODE, 1246 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1247 + .owner = THIS_MODULE, 1248 + .of_parse_cb = buck_set_hw_dvs_levels, 1249 + }, 1250 + .dvs = { 1251 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1252 + ROHM_DVS_LEVEL_SUSPEND | 1253 + ROHM_DVS_LEVEL_LPSR, 1254 + .run_reg = BD72720_REG_LDO5_VSEL, 1255 + .run_mask = BD72720_MASK_LDO_VSEL, 1256 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1257 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1258 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1259 + }, 1260 + }, { 1261 + .desc = { 1262 + .name = "ldo6", 1263 + .of_match = of_match_ptr("ldo6"), 1264 + .regulators_node = of_match_ptr("regulators"), 1265 + .id = BD72720_LDO6, 1266 + .type = REGULATOR_VOLTAGE, 1267 + .ops = &bd72720_regulator_ops, 1268 + .linear_ranges = bd72720_ldo6_volts, 1269 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo6_volts), 1270 + .n_voltages = BD72720_NUM_LDO12346_VOLTS, 1271 + .enable_reg = BD72720_REG_LDO6_ON, 1272 + .enable_mask = BD72720_MASK_RUN_B_EN, 1273 + .vsel_reg = BD72720_REG_LDO6_VSEL, 1274 + .vsel_mask = BD72720_MASK_LDO12346_VSEL, 1275 + 1276 + .ramp_delay_table = bd72720_ramp_delay, 1277 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1278 + .ramp_reg = BD72720_REG_LDO6_MODE, 1279 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1280 + .owner = THIS_MODULE, 1281 + .of_parse_cb = buck_set_hw_dvs_levels, 1282 + }, 1283 + .dvs = { 1284 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1285 + ROHM_DVS_LEVEL_SUSPEND | 1286 + ROHM_DVS_LEVEL_LPSR, 1287 + .run_reg = BD72720_REG_LDO6_VSEL, 1288 + .run_mask = BD72720_MASK_LDO12346_VSEL, 1289 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1290 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1291 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1292 + }, 1293 + }, { 1294 + .desc = { 1295 + .name = "ldo7", 1296 + .of_match = of_match_ptr("ldo7"), 1297 + .regulators_node = of_match_ptr("regulators"), 1298 + .id = BD72720_LDO7, 1299 + .type = REGULATOR_VOLTAGE, 1300 + .ops = &bd72720_regulator_ops, 1301 + .linear_ranges = bd72720_ldo57891011_volts, 1302 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo57891011_volts), 1303 + .n_voltages = BD72720_NUM_LDO_VOLTS, 1304 + .enable_reg = BD72720_REG_LDO7_ON, 1305 + .enable_mask = BD72720_MASK_RUN_B_EN, 1306 + .vsel_reg = BD72720_REG_LDO7_VSEL, 1307 + .vsel_mask = BD72720_MASK_LDO_VSEL, 1308 + 1309 + .ramp_delay_table = bd72720_ramp_delay, 1310 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1311 + .ramp_reg = BD72720_REG_LDO7_MODE, 1312 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1313 + .owner = THIS_MODULE, 1314 + .of_parse_cb = buck_set_hw_dvs_levels, 1315 + }, 1316 + .dvs = { 1317 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1318 + ROHM_DVS_LEVEL_SUSPEND | 1319 + ROHM_DVS_LEVEL_LPSR, 1320 + .run_reg = BD72720_REG_LDO7_VSEL, 1321 + .run_mask = BD72720_MASK_LDO_VSEL, 1322 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1323 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1324 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1325 + }, 1326 + }, { 1327 + .desc = { 1328 + .name = "ldo8", 1329 + .of_match = of_match_ptr("ldo8"), 1330 + .regulators_node = of_match_ptr("regulators"), 1331 + .id = BD72720_LDO8, 1332 + .type = REGULATOR_VOLTAGE, 1333 + .ops = &bd72720_regulator_ops, 1334 + .linear_ranges = bd72720_ldo57891011_volts, 1335 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo57891011_volts), 1336 + .n_voltages = BD72720_NUM_LDO_VOLTS, 1337 + .enable_reg = BD72720_REG_LDO8_ON, 1338 + .enable_mask = BD72720_MASK_RUN_B_EN, 1339 + .vsel_reg = BD72720_REG_LDO8_VSEL, 1340 + .vsel_mask = BD72720_MASK_LDO_VSEL, 1341 + 1342 + .ramp_delay_table = bd72720_ramp_delay, 1343 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1344 + .ramp_reg = BD72720_REG_LDO8_MODE, 1345 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1346 + .owner = THIS_MODULE, 1347 + .of_parse_cb = buck_set_hw_dvs_levels, 1348 + }, 1349 + .dvs = { 1350 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1351 + ROHM_DVS_LEVEL_SUSPEND | 1352 + ROHM_DVS_LEVEL_LPSR, 1353 + .run_reg = BD72720_REG_LDO8_VSEL, 1354 + .run_mask = BD72720_MASK_LDO_VSEL, 1355 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1356 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1357 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1358 + }, 1359 + }, { 1360 + .desc = { 1361 + .name = "ldo9", 1362 + .of_match = of_match_ptr("ldo9"), 1363 + .regulators_node = of_match_ptr("regulators"), 1364 + .id = BD72720_LDO9, 1365 + .type = REGULATOR_VOLTAGE, 1366 + .ops = &bd72720_regulator_ops, 1367 + .linear_ranges = bd72720_ldo57891011_volts, 1368 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo57891011_volts), 1369 + .n_voltages = BD72720_NUM_LDO_VOLTS, 1370 + .enable_reg = BD72720_REG_LDO9_ON, 1371 + .enable_mask = BD72720_MASK_RUN_B_EN, 1372 + .vsel_reg = BD72720_REG_LDO9_VSEL, 1373 + .vsel_mask = BD72720_MASK_LDO_VSEL, 1374 + 1375 + .ramp_delay_table = bd72720_ramp_delay, 1376 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1377 + .ramp_reg = BD72720_REG_LDO9_MODE, 1378 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1379 + .owner = THIS_MODULE, 1380 + .of_parse_cb = buck_set_hw_dvs_levels, 1381 + }, 1382 + .dvs = { 1383 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1384 + ROHM_DVS_LEVEL_SUSPEND | 1385 + ROHM_DVS_LEVEL_LPSR, 1386 + .run_reg = BD72720_REG_LDO9_VSEL, 1387 + .run_mask = BD72720_MASK_LDO_VSEL, 1388 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1389 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1390 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1391 + }, 1392 + }, { 1393 + .desc = { 1394 + .name = "ldo10", 1395 + .of_match = of_match_ptr("ldo10"), 1396 + .regulators_node = of_match_ptr("regulators"), 1397 + .id = BD72720_LDO10, 1398 + .type = REGULATOR_VOLTAGE, 1399 + .ops = &bd72720_regulator_ops, 1400 + .linear_ranges = bd72720_ldo57891011_volts, 1401 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo57891011_volts), 1402 + .n_voltages = BD72720_NUM_LDO_VOLTS, 1403 + .enable_reg = BD72720_REG_LDO10_ON, 1404 + .enable_mask = BD72720_MASK_RUN_B_EN, 1405 + .vsel_reg = BD72720_REG_LDO10_VSEL, 1406 + .vsel_mask = BD72720_MASK_LDO_VSEL, 1407 + 1408 + .ramp_delay_table = bd72720_ramp_delay, 1409 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1410 + .ramp_reg = BD72720_REG_LDO10_MODE, 1411 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1412 + .owner = THIS_MODULE, 1413 + .of_parse_cb = buck_set_hw_dvs_levels, 1414 + }, 1415 + .dvs = { 1416 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1417 + ROHM_DVS_LEVEL_SUSPEND | 1418 + ROHM_DVS_LEVEL_LPSR, 1419 + .run_reg = BD72720_REG_LDO10_VSEL, 1420 + .run_mask = BD72720_MASK_LDO_VSEL, 1421 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1422 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1423 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1424 + }, 1425 + }, { 1426 + .desc = { 1427 + .name = "ldo11", 1428 + .of_match = of_match_ptr("ldo11"), 1429 + .regulators_node = of_match_ptr("regulators"), 1430 + .id = BD72720_LDO11, 1431 + .type = REGULATOR_VOLTAGE, 1432 + .ops = &bd72720_regulator_ops, 1433 + .linear_ranges = bd72720_ldo57891011_volts, 1434 + .n_linear_ranges = ARRAY_SIZE(bd72720_ldo57891011_volts), 1435 + .n_voltages = BD72720_NUM_LDO_VOLTS, 1436 + .enable_reg = BD72720_REG_LDO11_ON, 1437 + .enable_mask = BD72720_MASK_RUN_B_EN, 1438 + .vsel_reg = BD72720_REG_LDO11_VSEL, 1439 + .vsel_mask = BD72720_MASK_LDO_VSEL, 1440 + 1441 + .ramp_delay_table = bd72720_ramp_delay, 1442 + .n_ramp_values = ARRAY_SIZE(bd72720_ramp_delay), 1443 + .ramp_reg = BD72720_REG_LDO11_MODE, 1444 + .ramp_mask = BD72720_MASK_RAMP_UP_DELAY, 1445 + .owner = THIS_MODULE, 1446 + .of_parse_cb = buck_set_hw_dvs_levels, 1447 + }, 1448 + .dvs = { 1449 + .level_map = ROHM_DVS_LEVEL_RUN | ROHM_DVS_LEVEL_IDLE | 1450 + ROHM_DVS_LEVEL_SUSPEND | 1451 + ROHM_DVS_LEVEL_LPSR, 1452 + .run_reg = BD72720_REG_LDO11_VSEL, 1453 + .run_mask = BD72720_MASK_LDO_VSEL, 1454 + .idle_on_mask = BD72720_MASK_IDLE_EN, 1455 + .suspend_on_mask = BD72720_MASK_SUSPEND_EN, 1456 + .lpsr_on_mask = BD72720_MASK_DEEP_IDLE_EN, 1457 + }, 1458 + }, 1459 + }; 1460 + 1461 + static int bd72720_buck10_ldon_head_mode(struct device *dev, 1462 + struct device_node *npreg, 1463 + struct regmap *regmap, 1464 + struct regulator_desc *buck10_desc) 1465 + { 1466 + struct device_node *np __free(device_node) = 1467 + of_get_child_by_name(npreg, "buck10"); 1468 + uint32_t ldon_head; 1469 + int ldon_val; 1470 + int ret; 1471 + 1472 + if (!np) { 1473 + dev_err(dev, "failed to find buck10 regulator node\n"); 1474 + return -ENODEV; 1475 + } 1476 + 1477 + ret = of_property_read_u32(np, "rohm,ldon-head-microvolt", &ldon_head); 1478 + if (ret == -EINVAL) 1479 + return 0; 1480 + if (ret) 1481 + return ret; 1482 + 1483 + /* 1484 + * LDON_HEAD mode means the BUCK10 is used to supply LDOs 1-4 and 1485 + * the BUCK 10 voltage is automatically set to follow LDO 1-4 1486 + * settings. Thus the BUCK10 should not allow voltage [g/s]etting. 1487 + */ 1488 + buck10_desc->ops = &bd72720_buck10_ldon_head_op; 1489 + 1490 + ldon_val = ldon_head / 50000 + 1; 1491 + if (ldon_head > 300000) { 1492 + dev_warn(dev, "Unsupported LDON_HEAD, clamping to 300 mV\n"); 1493 + ldon_val = 7; 1494 + } 1495 + 1496 + return regmap_update_bits(regmap, BD72720_REG_LDO1_MODE2, 1497 + BD72720_MASK_LDON_HEAD, ldon_val); 1498 + } 1499 + 1500 + static int bd72720_dt_parse(struct device *dev, 1501 + struct regulator_desc *buck10_desc, 1502 + struct regmap *regmap) 1503 + { 1504 + struct device_node *nproot __free(device_node) = 1505 + of_get_child_by_name(dev->parent->of_node, "regulators"); 1506 + 1507 + if (!nproot) { 1508 + dev_err(dev, "failed to find regulators node\n"); 1509 + return -ENODEV; 1510 + } 1511 + 1512 + return bd72720_buck10_ldon_head_mode(dev, nproot, regmap, buck10_desc); 1513 + } 1514 + 788 1515 static int bd71828_probe(struct platform_device *pdev) 789 1516 { 790 - int i, j, ret; 1517 + int i, j, ret, num_regulators; 791 1518 struct regulator_config config = { 792 1519 .dev = pdev->dev.parent, 793 1520 }; 1521 + enum rohm_chip_type chip = platform_get_device_id(pdev)->driver_data; 1522 + struct bd71828_regulator_data *rdata; 794 1523 795 1524 config.regmap = dev_get_regmap(pdev->dev.parent, NULL); 796 1525 if (!config.regmap) 797 1526 return -ENODEV; 798 1527 799 - for (i = 0; i < ARRAY_SIZE(bd71828_rdata); i++) { 800 - struct regulator_dev *rdev; 801 - const struct bd71828_regulator_data *rd; 1528 + switch (chip) { 1529 + case ROHM_CHIP_TYPE_BD72720: 1530 + rdata = devm_kmemdup(&pdev->dev, bd72720_rdata, 1531 + sizeof(bd72720_rdata), GFP_KERNEL); 1532 + if (!rdata) 1533 + return -ENOMEM; 802 1534 803 - rd = &bd71828_rdata[i]; 1535 + ret = bd72720_dt_parse(&pdev->dev, &rdata[BD72720_BUCK10_DESC_INDEX].desc, 1536 + config.regmap); 1537 + if (ret) 1538 + return ret; 1539 + 1540 + num_regulators = ARRAY_SIZE(bd72720_rdata); 1541 + break; 1542 + 1543 + case ROHM_CHIP_TYPE_BD71828: 1544 + rdata = devm_kmemdup(&pdev->dev, bd71828_rdata, 1545 + sizeof(bd71828_rdata), GFP_KERNEL); 1546 + if (!rdata) 1547 + return -ENOMEM; 1548 + 1549 + num_regulators = ARRAY_SIZE(bd71828_rdata); 1550 + 1551 + break; 1552 + default: 1553 + return dev_err_probe(&pdev->dev, -EINVAL, 1554 + "Unsupported device\n"); 1555 + } 1556 + 1557 + for (i = 0; i < num_regulators; i++) { 1558 + struct regulator_dev *rdev; 1559 + struct bd71828_regulator_data *rd; 1560 + 1561 + rd = &rdata[i]; 1562 + 1563 + config.driver_data = rd; 804 1564 rdev = devm_regulator_register(&pdev->dev, 805 1565 &rd->desc, &config); 806 1566 if (IS_ERR(rdev)) ··· 1690 714 return 0; 1691 715 } 1692 716 717 + static const struct platform_device_id bd71828_pmic_id[] = { 718 + { "bd71828-pmic", ROHM_CHIP_TYPE_BD71828 }, 719 + { "bd72720-pmic", ROHM_CHIP_TYPE_BD72720 }, 720 + { }, 721 + }; 722 + MODULE_DEVICE_TABLE(platform, bd71828_pmic_id); 723 + 1693 724 static struct platform_driver bd71828_regulator = { 1694 725 .driver = { 1695 726 .name = "bd71828-pmic", 1696 727 .probe_type = PROBE_PREFER_ASYNCHRONOUS, 1697 728 }, 1698 729 .probe = bd71828_probe, 730 + .id_table = bd71828_pmic_id, 1699 731 }; 1700 732 1701 733 module_platform_driver(bd71828_regulator); ··· 1711 727 MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>"); 1712 728 MODULE_DESCRIPTION("BD71828 voltage regulator driver"); 1713 729 MODULE_LICENSE("GPL"); 1714 - MODULE_ALIAS("platform:bd71828-pmic");
+2 -1
drivers/rtc/Kconfig
··· 570 570 depends on MFD_ROHM_BD71828 571 571 help 572 572 If you say Y here you will get support for the RTC 573 - block on ROHM BD71815 and BD71828 Power Management IC. 573 + block on ROHM BD71815, BD71828 and BD72720 Power 574 + Management ICs. 574 575 575 576 This driver can also be built as a module. If so, the module 576 577 will be called rtc-bd70528.
+14 -7
drivers/rtc/rtc-bd70528.c
··· 7 7 #include <linux/bcd.h> 8 8 #include <linux/mfd/rohm-bd71815.h> 9 9 #include <linux/mfd/rohm-bd71828.h> 10 + #include <linux/mfd/rohm-bd72720.h> 10 11 #include <linux/module.h> 11 12 #include <linux/of.h> 12 13 #include <linux/platform_device.h> ··· 263 262 264 263 /* 265 264 * See also BD718XX_ALM_EN_OFFSET: 266 - * This works for BD71828 and BD71815 as they have same offset 267 - * between ALM0 start and ALM0_MASK. If new ICs are to be 268 - * added this requires proper check as ALM0_MASK is not located 269 - * at the end of ALM0 block - but after all ALM blocks so if 270 - * amount of ALMs differ the offset to enable/disable is likely 271 - * to be incorrect and enable/disable must be given as own 272 - * reg address here. 265 + * This works for BD71828, BD71815, and BD72720 as they all 266 + * have same offset between the ALM0 start and the ALM0_MASK. 267 + * If new ICs are to be added this requires proper check as 268 + * the ALM0_MASK is not located at the end of ALM0 block - 269 + * but after all ALM blocks. If amount of ALMs differ, the 270 + * offset to enable/disable is likely to be incorrect and 271 + * enable/disable must be given as own reg address here. 273 272 */ 274 273 bd_rtc->bd718xx_alm_block_start = BD71815_REG_RTC_ALM_START; 275 274 hour_reg = BD71815_REG_HOUR; ··· 278 277 bd_rtc->reg_time_start = BD71828_REG_RTC_START; 279 278 bd_rtc->bd718xx_alm_block_start = BD71828_REG_RTC_ALM_START; 280 279 hour_reg = BD71828_REG_RTC_HOUR; 280 + break; 281 + case ROHM_CHIP_TYPE_BD72720: 282 + bd_rtc->reg_time_start = BD72720_REG_RTC_START; 283 + bd_rtc->bd718xx_alm_block_start = BD72720_REG_RTC_ALM_START; 284 + hour_reg = BD72720_REG_RTC_HOUR; 281 285 break; 282 286 default: 283 287 dev_err(&pdev->dev, "Unknown chip\n"); ··· 343 337 static const struct platform_device_id bd718x7_rtc_id[] = { 344 338 { "bd71828-rtc", ROHM_CHIP_TYPE_BD71828 }, 345 339 { "bd71815-rtc", ROHM_CHIP_TYPE_BD71815 }, 340 + { "bd72720-rtc", ROHM_CHIP_TYPE_BD72720 }, 346 341 { }, 347 342 }; 348 343 MODULE_DEVICE_TABLE(platform, bd718x7_rtc_id);
+634
include/linux/mfd/rohm-bd72720.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 + /* 3 + * Copyright 2025 ROHM Semiconductors. 4 + * 5 + * Author: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> 6 + */ 7 + 8 + #ifndef _MFD_BD72720_H 9 + #define _MFD_BD72720_H 10 + 11 + #include <linux/regmap.h> 12 + 13 + enum { 14 + BD72720_BUCK1, 15 + BD72720_BUCK2, 16 + BD72720_BUCK3, 17 + BD72720_BUCK4, 18 + BD72720_BUCK5, 19 + BD72720_BUCK6, 20 + BD72720_BUCK7, 21 + BD72720_BUCK8, 22 + BD72720_BUCK9, 23 + BD72720_BUCK10, 24 + BD72720_BUCK11, 25 + BD72720_LDO1, 26 + BD72720_LDO2, 27 + BD72720_LDO3, 28 + BD72720_LDO4, 29 + BD72720_LDO5, 30 + BD72720_LDO6, 31 + BD72720_LDO7, 32 + BD72720_LDO8, 33 + BD72720_LDO9, 34 + BD72720_LDO10, 35 + BD72720_LDO11, 36 + BD72720_REGULATOR_AMOUNT, 37 + }; 38 + 39 + /* BD72720 interrupts */ 40 + #define BD72720_INT_LONGPUSH_MASK BIT(0) 41 + #define BD72720_INT_MIDPUSH_MASK BIT(1) 42 + #define BD72720_INT_SHORTPUSH_MASK BIT(2) 43 + #define BD72720_INT_PUSH_MASK BIT(3) 44 + #define BD72720_INT_HALL_DET_MASK BIT(4) 45 + #define BD72720_INT_HALL_TGL_MASK BIT(5) 46 + #define BD72720_INT_WDOG_MASK BIT(6) 47 + #define BD72720_INT_SWRESET_MASK BIT(7) 48 + #define BD72720_INT_SEQ_DONE_MASK BIT(0) 49 + #define BD72720_INT_PGFAULT_MASK BIT(4) 50 + #define BD72720_INT_BUCK1_DVS_MASK BIT(0) 51 + #define BD72720_INT_BUCK2_DVS_MASK BIT(1) 52 + #define BD72720_INT_BUCK3_DVS_MASK BIT(2) 53 + #define BD72720_INT_BUCK4_DVS_MASK BIT(3) 54 + #define BD72720_INT_BUCK5_DVS_MASK BIT(4) 55 + #define BD72720_INT_BUCK6_DVS_MASK BIT(5) 56 + #define BD72720_INT_BUCK7_DVS_MASK BIT(6) 57 + #define BD72720_INT_BUCK8_DVS_MASK BIT(7) 58 + #define BD72720_INT_BUCK9_DVS_MASK BIT(0) 59 + #define BD72720_INT_BUCK10_DVS_MASK BIT(1) 60 + #define BD72720_INT_LDO1_DVS_MASK BIT(4) 61 + #define BD72720_INT_LDO2_DVS_MASK BIT(5) 62 + #define BD72720_INT_LDO3_DVS_MASK BIT(6) 63 + #define BD72720_INT_LDO4_DVS_MASK BIT(7) 64 + #define BD72720_INT_VBUS_RMV_MASK BIT(0) 65 + #define BD72720_INT_VBUS_DET_MASK BIT(1) 66 + #define BD72720_INT_VBUS_MON_RES_MASK BIT(2) 67 + #define BD72720_INT_VBUS_MON_DET_MASK BIT(3) 68 + #define BD72720_INT_VSYS_MON_RES_MASK BIT(0) 69 + #define BD72720_INT_VSYS_MON_DET_MASK BIT(1) 70 + #define BD72720_INT_VSYS_UV_RES_MASK BIT(2) 71 + #define BD72720_INT_VSYS_UV_DET_MASK BIT(3) 72 + #define BD72720_INT_VSYS_LO_RES_MASK BIT(4) 73 + #define BD72720_INT_VSYS_LO_DET_MASK BIT(5) 74 + #define BD72720_INT_VSYS_OV_RES_MASK BIT(6) 75 + #define BD72720_INT_VSYS_OV_DET_MASK BIT(7) 76 + #define BD72720_INT_BAT_ILIM_MASK BIT(0) 77 + #define BD72720_INT_CHG_DONE_MASK BIT(1) 78 + #define BD72720_INT_EXTEMP_TOUT_MASK BIT(2) 79 + #define BD72720_INT_CHG_WDT_EXP_MASK BIT(3) 80 + #define BD72720_INT_BAT_MNT_OUT_MASK BIT(4) 81 + #define BD72720_INT_BAT_MNT_IN_MASK BIT(5) 82 + #define BD72720_INT_CHG_TRNS_MASK BIT(7) 83 + #define BD72720_INT_VBAT_MON_RES_MASK BIT(0) 84 + #define BD72720_INT_VBAT_MON_DET_MASK BIT(1) 85 + #define BD72720_INT_VBAT_SHT_RES_MASK BIT(2) 86 + #define BD72720_INT_VBAT_SHT_DET_MASK BIT(3) 87 + #define BD72720_INT_VBAT_LO_RES_MASK BIT(4) 88 + #define BD72720_INT_VBAT_LO_DET_MASK BIT(5) 89 + #define BD72720_INT_VBAT_OV_RES_MASK BIT(6) 90 + #define BD72720_INT_VBAT_OV_DET_MASK BIT(7) 91 + #define BD72720_INT_BAT_RMV_MASK BIT(0) 92 + #define BD72720_INT_BAT_DET_MASK BIT(1) 93 + #define BD72720_INT_DBAT_DET_MASK BIT(2) 94 + #define BD72720_INT_BAT_TEMP_TRNS_MASK BIT(3) 95 + #define BD72720_INT_LOBTMP_RES_MASK BIT(4) 96 + #define BD72720_INT_LOBTMP_DET_MASK BIT(5) 97 + #define BD72720_INT_OVBTMP_RES_MASK BIT(6) 98 + #define BD72720_INT_OVBTMP_DET_MASK BIT(7) 99 + #define BD72720_INT_OCUR1_RES_MASK BIT(0) 100 + #define BD72720_INT_OCUR1_DET_MASK BIT(1) 101 + #define BD72720_INT_OCUR2_RES_MASK BIT(2) 102 + #define BD72720_INT_OCUR2_DET_MASK BIT(3) 103 + #define BD72720_INT_OCUR3_RES_MASK BIT(4) 104 + #define BD72720_INT_OCUR3_DET_MASK BIT(5) 105 + #define BD72720_INT_CC_MON1_DET_MASK BIT(0) 106 + #define BD72720_INT_CC_MON2_DET_MASK BIT(1) 107 + #define BD72720_INT_CC_MON3_DET_MASK BIT(2) 108 + #define BD72720_INT_GPIO1_IN_MASK BIT(4) 109 + #define BD72720_INT_GPIO2_IN_MASK BIT(5) 110 + #define BD72720_INT_VF125_RES_MASK BIT(0) 111 + #define BD72720_INT_VF125_DET_MASK BIT(1) 112 + #define BD72720_INT_VF_RES_MASK BIT(2) 113 + #define BD72720_INT_VF_DET_MASK BIT(3) 114 + #define BD72720_INT_RTC0_MASK BIT(4) 115 + #define BD72720_INT_RTC1_MASK BIT(5) 116 + #define BD72720_INT_RTC2_MASK BIT(6) 117 + 118 + enum { 119 + /* 120 + * The IRQs excluding GPIO1 and GPIO2 are ordered in a same way as the 121 + * respective IRQ bits in status and mask registers are ordered. 122 + * 123 + * The BD72720_INT_GPIO1_IN and BD72720_INT_GPIO2_IN are IRQs which can 124 + * be used by other devices. Let's have GPIO1 and GPIO2 as first IRQs 125 + * here so we can use the regmap-IRQ with standard device tree xlate 126 + * while devices connected to the BD72720 IRQ input pins can refer to 127 + * the first two interrupt numbers in their device tree. If we placed 128 + * BD72720_INT_GPIO1_IN and BD72720_INT_GPIO2_IN after the CC_MON_DET 129 + * interrupts (like they are in the registers), the devices using 130 + * BD72720 as an IRQ parent should refer the interrupts starting with 131 + * an offset which might not be trivial to understand. 132 + */ 133 + BD72720_INT_GPIO1_IN, 134 + BD72720_INT_GPIO2_IN, 135 + BD72720_INT_LONGPUSH, 136 + BD72720_INT_MIDPUSH, 137 + BD72720_INT_SHORTPUSH, 138 + BD72720_INT_PUSH, 139 + BD72720_INT_HALL_DET, 140 + BD72720_INT_HALL_TGL, 141 + BD72720_INT_WDOG, 142 + BD72720_INT_SWRESET, 143 + BD72720_INT_SEQ_DONE, 144 + BD72720_INT_PGFAULT, 145 + BD72720_INT_BUCK1_DVS, 146 + BD72720_INT_BUCK2_DVS, 147 + BD72720_INT_BUCK3_DVS, 148 + BD72720_INT_BUCK4_DVS, 149 + BD72720_INT_BUCK5_DVS, 150 + BD72720_INT_BUCK6_DVS, 151 + BD72720_INT_BUCK7_DVS, 152 + BD72720_INT_BUCK8_DVS, 153 + BD72720_INT_BUCK9_DVS, 154 + BD72720_INT_BUCK10_DVS, 155 + BD72720_INT_LDO1_DVS, 156 + BD72720_INT_LDO2_DVS, 157 + BD72720_INT_LDO3_DVS, 158 + BD72720_INT_LDO4_DVS, 159 + BD72720_INT_VBUS_RMV, 160 + BD72720_INT_VBUS_DET, 161 + BD72720_INT_VBUS_MON_RES, 162 + BD72720_INT_VBUS_MON_DET, 163 + BD72720_INT_VSYS_MON_RES, 164 + BD72720_INT_VSYS_MON_DET, 165 + BD72720_INT_VSYS_UV_RES, 166 + BD72720_INT_VSYS_UV_DET, 167 + BD72720_INT_VSYS_LO_RES, 168 + BD72720_INT_VSYS_LO_DET, 169 + BD72720_INT_VSYS_OV_RES, 170 + BD72720_INT_VSYS_OV_DET, 171 + BD72720_INT_BAT_ILIM, 172 + BD72720_INT_CHG_DONE, 173 + BD72720_INT_EXTEMP_TOUT, 174 + BD72720_INT_CHG_WDT_EXP, 175 + BD72720_INT_BAT_MNT_OUT, 176 + BD72720_INT_BAT_MNT_IN, 177 + BD72720_INT_CHG_TRNS, 178 + BD72720_INT_VBAT_MON_RES, 179 + BD72720_INT_VBAT_MON_DET, 180 + BD72720_INT_VBAT_SHT_RES, 181 + BD72720_INT_VBAT_SHT_DET, 182 + BD72720_INT_VBAT_LO_RES, 183 + BD72720_INT_VBAT_LO_DET, 184 + BD72720_INT_VBAT_OV_RES, 185 + BD72720_INT_VBAT_OV_DET, 186 + BD72720_INT_BAT_RMV, 187 + BD72720_INT_BAT_DET, 188 + BD72720_INT_DBAT_DET, 189 + BD72720_INT_BAT_TEMP_TRNS, 190 + BD72720_INT_LOBTMP_RES, 191 + BD72720_INT_LOBTMP_DET, 192 + BD72720_INT_OVBTMP_RES, 193 + BD72720_INT_OVBTMP_DET, 194 + BD72720_INT_OCUR1_RES, 195 + BD72720_INT_OCUR1_DET, 196 + BD72720_INT_OCUR2_RES, 197 + BD72720_INT_OCUR2_DET, 198 + BD72720_INT_OCUR3_RES, 199 + BD72720_INT_OCUR3_DET, 200 + BD72720_INT_CC_MON1_DET, 201 + BD72720_INT_CC_MON2_DET, 202 + BD72720_INT_CC_MON3_DET, 203 + BD72720_INT_VF125_RES, 204 + BD72720_INT_VF125_DET, 205 + BD72720_INT_VF_RES, 206 + BD72720_INT_VF_DET, 207 + BD72720_INT_RTC0, 208 + BD72720_INT_RTC1, 209 + BD72720_INT_RTC2, 210 + }; 211 + 212 + /* 213 + * BD72720 Registers: 214 + * The BD72720 has two sets of registers behind two different I2C slave 215 + * addresses. "Common" registers being behind 0x4b, the charger registers 216 + * being behind 0x4c. 217 + */ 218 + /* Registers behind I2C slave 0x4b */ 219 + enum { 220 + BD72720_REG_PRODUCT_ID, 221 + BD72720_REG_MANUFACTURER_ID, 222 + BD72720_REG_PMIC_REV_NUM, 223 + BD72720_REG_NVM_REV_NUM, 224 + BD72720_REG_BOOTSRC = 0x10, 225 + BD72720_REG_RESETSRC_1, 226 + BD72720_REG_RESETSRC_2, 227 + BD72720_REG_RESETSRC_3, 228 + BD72720_REG_RESETSRC_4, 229 + BD72720_REG_RESETSRC_5, 230 + BD72720_REG_RESETSRC_6, 231 + BD72720_REG_RESETSRC_7, 232 + BD72720_REG_POWER_STATE, 233 + BD72720_REG_PS_CFG, 234 + BD72720_REG_PS_CTRL_1, 235 + BD72720_REG_PS_CTRL_2, 236 + BD72720_REG_RCVCFG, 237 + BD72720_REG_RCVNUM, 238 + BD72720_REG_CRDCFG, 239 + BD72720_REG_REX_CTRL, 240 + 241 + BD72720_REG_BUCK1_ON, 242 + BD72720_REG_BUCK1_MODE, 243 + /* Deep idle vsel */ 244 + BD72720_REG_BUCK1_VSEL_DI, 245 + /* Idle vsel */ 246 + BD72720_REG_BUCK1_VSEL_I, 247 + /* Suspend vsel */ 248 + BD72720_REG_BUCK1_VSEL_S, 249 + /* Run boot vsel */ 250 + BD72720_REG_BUCK1_VSEL_RB, 251 + /* Run0 ... run3 vsel */ 252 + BD72720_REG_BUCK1_VSEL_RB0, 253 + BD72720_REG_BUCK1_VSEL_RB1, 254 + BD72720_REG_BUCK1_VSEL_RB2, 255 + BD72720_REG_BUCK1_VSEL_RB3, 256 + 257 + BD72720_REG_BUCK2_ON, 258 + BD72720_REG_BUCK2_MODE, 259 + BD72720_REG_BUCK2_VSEL_DI, 260 + BD72720_REG_BUCK2_VSEL_I, 261 + BD72720_REG_BUCK2_VSEL_S, 262 + /* Run vsel */ 263 + BD72720_REG_BUCK2_VSEL_R, 264 + 265 + BD72720_REG_BUCK3_ON, 266 + BD72720_REG_BUCK3_MODE, 267 + BD72720_REG_BUCK3_VSEL_DI, 268 + BD72720_REG_BUCK3_VSEL_I, 269 + BD72720_REG_BUCK3_VSEL_S, 270 + BD72720_REG_BUCK3_VSEL_R, 271 + 272 + BD72720_REG_BUCK4_ON, 273 + BD72720_REG_BUCK4_MODE, 274 + BD72720_REG_BUCK4_VSEL_DI, 275 + BD72720_REG_BUCK4_VSEL_I, 276 + BD72720_REG_BUCK4_VSEL_S, 277 + BD72720_REG_BUCK4_VSEL_R, 278 + 279 + BD72720_REG_BUCK5_ON, 280 + BD72720_REG_BUCK5_MODE, 281 + BD72720_REG_BUCK5_VSEL, 282 + 283 + BD72720_REG_BUCK6_ON, 284 + BD72720_REG_BUCK6_MODE, 285 + BD72720_REG_BUCK6_VSEL, 286 + 287 + BD72720_REG_BUCK7_ON, 288 + BD72720_REG_BUCK7_MODE, 289 + BD72720_REG_BUCK7_VSEL, 290 + 291 + BD72720_REG_BUCK8_ON, 292 + BD72720_REG_BUCK8_MODE, 293 + BD72720_REG_BUCK8_VSEL, 294 + 295 + BD72720_REG_BUCK9_ON, 296 + BD72720_REG_BUCK9_MODE, 297 + BD72720_REG_BUCK9_VSEL, 298 + 299 + BD72720_REG_BUCK10_ON, 300 + BD72720_REG_BUCK10_MODE, 301 + BD72720_REG_BUCK10_VSEL, 302 + 303 + BD72720_REG_LDO1_ON, 304 + BD72720_REG_LDO1_MODE1, 305 + BD72720_REG_LDO1_MODE2, 306 + BD72720_REG_LDO1_VSEL_DI, 307 + BD72720_REG_LDO1_VSEL_I, 308 + BD72720_REG_LDO1_VSEL_S, 309 + BD72720_REG_LDO1_VSEL_RB, 310 + BD72720_REG_LDO1_VSEL_R0, 311 + BD72720_REG_LDO1_VSEL_R1, 312 + BD72720_REG_LDO1_VSEL_R2, 313 + BD72720_REG_LDO1_VSEL_R3, 314 + 315 + BD72720_REG_LDO2_ON, 316 + BD72720_REG_LDO2_MODE, 317 + BD72720_REG_LDO2_VSEL_DI, 318 + BD72720_REG_LDO2_VSEL_I, 319 + BD72720_REG_LDO2_VSEL_S, 320 + BD72720_REG_LDO2_VSEL_R, 321 + 322 + BD72720_REG_LDO3_ON, 323 + BD72720_REG_LDO3_MODE, 324 + BD72720_REG_LDO3_VSEL_DI, 325 + BD72720_REG_LDO3_VSEL_I, 326 + BD72720_REG_LDO3_VSEL_S, 327 + BD72720_REG_LDO3_VSEL_R, 328 + 329 + BD72720_REG_LDO4_ON, 330 + BD72720_REG_LDO4_MODE, 331 + BD72720_REG_LDO4_VSEL_DI, 332 + BD72720_REG_LDO4_VSEL_I, 333 + BD72720_REG_LDO4_VSEL_S, 334 + BD72720_REG_LDO4_VSEL_R, 335 + 336 + BD72720_REG_LDO5_ON, 337 + BD72720_REG_LDO5_MODE, 338 + BD72720_REG_LDO5_VSEL, 339 + 340 + BD72720_REG_LDO6_ON, 341 + BD72720_REG_LDO6_MODE, 342 + BD72720_REG_LDO6_VSEL, 343 + 344 + BD72720_REG_LDO7_ON, 345 + BD72720_REG_LDO7_MODE, 346 + BD72720_REG_LDO7_VSEL, 347 + 348 + BD72720_REG_LDO8_ON, 349 + BD72720_REG_LDO8_MODE, 350 + BD72720_REG_LDO8_VSEL, 351 + 352 + BD72720_REG_LDO9_ON, 353 + BD72720_REG_LDO9_MODE, 354 + BD72720_REG_LDO9_VSEL, 355 + 356 + BD72720_REG_LDO10_ON, 357 + BD72720_REG_LDO10_MODE, 358 + BD72720_REG_LDO10_VSEL, 359 + 360 + BD72720_REG_LDO11_ON, 361 + BD72720_REG_LDO11_MODE, 362 + BD72720_REG_LDO11_VSEL, 363 + 364 + BD72720_REG_GPIO1_ON = 0x8b, 365 + BD72720_REG_GPIO2_ON, 366 + BD72720_REG_GPIO3_ON, 367 + BD72720_REG_GPIO4_ON, 368 + BD72720_REG_GPIO5_ON, 369 + 370 + BD72720_REG_GPIO1_CTRL, 371 + BD72720_REG_GPIO2_CTRL, 372 + #define BD72720_GPIO_IRQ_TYPE_MASK GENMASK(6, 4) 373 + #define BD72720_GPIO_IRQ_TYPE_FALLING 0x0 374 + #define BD72720_GPIO_IRQ_TYPE_RISING 0x1 375 + #define BD72720_GPIO_IRQ_TYPE_BOTH 0x2 376 + #define BD72720_GPIO_IRQ_TYPE_HIGH 0x3 377 + #define BD72720_GPIO_IRQ_TYPE_LOW 0x4 378 + BD72720_REG_GPIO3_CTRL, 379 + BD72720_REG_GPIO4_CTRL, 380 + BD72720_REG_GPIO5_CTRL, 381 + #define BD72720_GPIO_DRIVE_MASK BIT(1) 382 + #define BD72720_GPIO_HIGH BIT(0) 383 + 384 + BD72720_REG_EPDEN_CTRL, 385 + BD72720_REG_GATECNT_CTRL, 386 + BD72720_REG_LED_CTRL, 387 + 388 + BD72720_REG_PWRON_CFG1, 389 + BD72720_REG_PWRON_CFG2, 390 + 391 + BD72720_REG_OUT32K, 392 + BD72720_REG_CONF, 393 + BD72720_REG_HALL_STAT, 394 + 395 + BD72720_REG_RTC_SEC = 0xa0, 396 + #define BD72720_REG_RTC_START BD72720_REG_RTC_SEC 397 + BD72720_REG_RTC_MIN, 398 + BD72720_REG_RTC_HOUR, 399 + BD72720_REG_RTC_WEEK, 400 + BD72720_REG_RTC_DAY, 401 + BD72720_REG_RTC_MON, 402 + BD72720_REG_RTC_YEAR, 403 + 404 + BD72720_REG_RTC_ALM0_SEC, 405 + #define BD72720_REG_RTC_ALM_START BD72720_REG_RTC_ALM0_SEC 406 + BD72720_REG_RTC_ALM0_MIN, 407 + BD72720_REG_RTC_ALM0_HOUR, 408 + BD72720_REG_RTC_ALM0_WEEK, 409 + BD72720_REG_RTC_ALM0_MON, 410 + BD72720_REG_RTC_ALM0_YEAR, 411 + 412 + BD72720_REG_RTC_ALM1_SEC, 413 + BD72720_REG_RTC_ALM1_MIN, 414 + BD72720_REG_RTC_ALM1_HOUR, 415 + BD72720_REG_RTC_ALM1_WEEK, 416 + BD72720_REG_RTC_ALM1_MON, 417 + BD72720_REG_RTC_ALM1_YEAR, 418 + 419 + BD72720_REG_RTC_ALM0_EN, 420 + BD72720_REG_RTC_ALM1_EN, 421 + BD72720_REG_RTC_ALM2, 422 + 423 + BD72720_REG_INT_LVL1_EN = 0xc0, 424 + #define BD72720_MASK_LVL1_EN_ALL GENMASK(7, 0) 425 + BD72720_REG_INT_PS1_EN, 426 + BD72720_REG_INT_PS2_EN, 427 + BD72720_REG_INT_DVS1_EN, 428 + BD72720_REG_INT_DVS2_EN, 429 + BD72720_REG_INT_VBUS_EN, 430 + BD72720_REG_INT_VSYS_EN, 431 + BD72720_REG_INT_CHG_EN, 432 + BD72720_REG_INT_BAT1_EN, 433 + BD72720_REG_INT_BAT2_EN, 434 + BD72720_REG_INT_IBAT_EN, 435 + BD72720_REG_INT_ETC1_EN, 436 + BD72720_REG_INT_ETC2_EN, 437 + 438 + /* 439 + * The _STAT registers inform IRQ line state, and are used to ack IRQ. 440 + * The _SRC registers below indicate current state of the function 441 + * connected to the line. 442 + */ 443 + BD72720_REG_INT_LVL1_STAT, 444 + BD72720_REG_INT_PS1_STAT, 445 + BD72720_REG_INT_PS2_STAT, 446 + BD72720_REG_INT_DVS1_STAT, 447 + BD72720_REG_INT_DVS2_STAT, 448 + BD72720_REG_INT_VBUS_STAT, 449 + BD72720_REG_INT_VSYS_STAT, 450 + BD72720_REG_INT_CHG_STAT, 451 + BD72720_REG_INT_BAT1_STAT, 452 + BD72720_REG_INT_BAT2_STAT, 453 + BD72720_REG_INT_IBAT_STAT, 454 + BD72720_REG_INT_ETC1_STAT, 455 + BD72720_REG_INT_ETC2_STAT, 456 + 457 + BD72720_REG_INT_LVL1_SRC, 458 + BD72720_REG_INT_PS1_SRC, 459 + BD72720_REG_INT_PS2_SRC, 460 + BD72720_REG_INT_DVS1_SRC, 461 + BD72720_REG_INT_DVS2_SRC, 462 + BD72720_REG_INT_VBUS_SRC, 463 + #define BD72720_MASK_DCIN_DET BIT(1) 464 + BD72720_REG_INT_VSYS_SRC, 465 + BD72720_REG_INT_CHG_SRC, 466 + BD72720_REG_INT_BAT1_SRC, 467 + BD72720_REG_INT_BAT2_SRC, 468 + BD72720_REG_INT_IBAT_SRC, 469 + BD72720_REG_INT_ETC1_SRC, 470 + BD72720_REG_INT_ETC2_SRC, 471 + }; 472 + 473 + /* Register masks */ 474 + #define BD72720_MASK_DEEP_IDLE_EN BIT(0) 475 + #define BD72720_MASK_IDLE_EN BIT(1) 476 + #define BD72720_MASK_SUSPEND_EN BIT(2) 477 + #define BD72720_MASK_RUN_B_EN BIT(3) 478 + #define BD72720_MASK_RUN_0_EN BIT(4) 479 + #define BD72720_MASK_RUN_1_EN BIT(5) 480 + #define BD72720_MASK_RUN_2_EN BIT(6) 481 + #define BD72720_MASK_RUN_3_EN BIT(7) 482 + 483 + #define BD72720_MASK_RAMP_UP_DELAY GENMASK(7, 6) 484 + #define BD72720_MASK_BUCK_VSEL GENMASK(7, 0) 485 + #define BD72720_MASK_LDO12346_VSEL GENMASK(6, 0) 486 + #define BD72720_MASK_LDO_VSEL GENMASK(7, 0) 487 + 488 + #define BD72720_I2C4C_ADDR_OFFSET 0x100 489 + 490 + /* Registers behind I2C slave 0x4c */ 491 + enum { 492 + BD72720_REG_CHG_STATE = BD72720_I2C4C_ADDR_OFFSET, 493 + BD72720_REG_CHG_LAST_STATE, 494 + BD72720_REG_CHG_VBUS_STAT, 495 + BD72720_REG_CHG_VSYS_STAT, 496 + BD72720_REG_CHG_BAT_TEMP_STAT, 497 + BD72720_REG_CHG_WDT_STAT, 498 + BD72720_REG_CHG_ILIM_STAT, 499 + BD72720_REG_CHG_CHG_STAT, 500 + BD72720_REG_CHG_EN, 501 + BD72720_REG_CHG_INIT, 502 + BD72720_REG_CHG_CTRL, 503 + BD72720_REG_CHG_SET_1, 504 + BD72720_REG_CHG_SET_2, 505 + BD72720_REG_CHG_SET_3, 506 + BD72720_REG_CHG_VPRE, 507 + BD72720_REG_CHG_VBAT_1, 508 + BD72720_REG_CHG_VBAT_2, 509 + BD72720_REG_CHG_VBAT_3, 510 + BD72720_REG_CHG_VBAT_4, 511 + BD72720_REG_CHG_BAT_SET_1, 512 + BD72720_REG_CHG_BAT_SET_2, 513 + BD72720_REG_CHG_BAT_SET_3, 514 + BD72720_REG_CHG_IPRE, 515 + BD72720_REG_CHG_IFST_TERM, 516 + BD72720_REG_CHG_VSYS_REG, 517 + BD72720_REG_CHG_VBUS_SET, 518 + BD72720_REG_CHG_WDT_PRE, 519 + BD72720_REG_CHG_WDT_FST, 520 + BD72720_REG_CHG_LED_CTRL, 521 + BD72720_REG_CHG_CFG_1, 522 + BD72720_REG_CHG_IFST_1, 523 + BD72720_REG_CHG_IFST_2, 524 + BD72720_REG_CHG_IFST_3, 525 + BD72720_REG_CHG_IFST_4, 526 + BD72720_REG_CHG_S_CFG_1, 527 + BD72720_REG_CHG_S_CFG_2, 528 + BD72720_REG_RS_VBUS, 529 + BD72720_REG_RS_IBUS, 530 + BD72720_REG_RS_VSYS, 531 + BD72720_REG_VSYS_STATE_STAT, /* 0x27 + offset*/ 532 + 533 + BD72720_REG_VM_VBAT_U = BD72720_I2C4C_ADDR_OFFSET + 0x30, 534 + BD72720_REG_VM_VBAT_L, 535 + BD72720_REG_VM_OCV_PRE_U, 536 + BD72720_REG_VM_OCV_PRE_L, 537 + BD72720_REG_VM_OCV_PST_U, 538 + BD72720_REG_VM_OCV_PST_L, 539 + BD72720_REG_VM_OCV_PWRON_U, 540 + BD72720_REG_VM_OCV_PWRON_L, 541 + BD72720_REG_VM_DVBAT_IMP_U, 542 + BD72720_REG_VM_DVBAT_IMP_L, 543 + BD72720_REG_VM_SA_VBAT_U, 544 + BD72720_REG_VM_SA_VBAT_L, 545 + BD72720_REG_VM_SA_VBAT_MIN_U, 546 + BD72720_REG_VM_SA_VBAT_MIN_L, 547 + BD72720_REG_VM_SA_VBAT_MAX_U, 548 + BD72720_REG_VM_SA_VBAT_MAX_L, 549 + BD72720_REG_REX_SA_VBAT_U, 550 + BD72720_REG_REX_SA_VBAT_L, 551 + BD72720_REG_VM_VSYS_U, 552 + BD72720_REG_VM_VSYS_L, 553 + BD72720_REG_VM_SA_VSYS_U, 554 + BD72720_REG_VM_SA_VSYS_L, 555 + BD72720_REG_VM_SA_VSYS_MIN_U, 556 + BD72720_REG_VM_SA_VSYS_MIN_L, 557 + BD72720_REG_VM_SA_VSYS_MAX_U, 558 + BD72720_REG_VM_SA_VSYS_MAX_L, 559 + BD72720_REG_VM_SA2_VSYS_U, 560 + BD72720_REG_VM_SA2_VSYS_L, 561 + BD72720_REG_VM_VBUS_U, 562 + #define BD72720_MASK_VDCIN_U GENMASK(3, 0) 563 + BD72720_REG_VM_VBUS_L, 564 + BD72720_REG_VM_BATID_U, 565 + BD72720_REG_VM_BATID_L, 566 + BD72720_REG_VM_BATID_NOLOAD_U, 567 + BD72720_REG_VM_BATID_NOLOAD_L, 568 + BD72720_REG_VM_BATID_OFS_U, 569 + BD72720_REG_VM_BATID_OFS_L, 570 + BD72720_REG_VM_VTH_U, 571 + BD72720_REG_VM_VTH_L, 572 + BD72720_REG_VM_VTH_CORR_U, 573 + BD72720_REG_VM_VTH_CORR_L, 574 + BD72720_REG_VM_BTMP_U, 575 + BD72720_REG_VM_BTMP_L, 576 + BD72720_REG_VM_BTMP_IMP_U, 577 + BD72720_REG_VM_BTMP_IMP_L, 578 + BD72720_REG_VM_VF_U, 579 + BD72720_REG_VM_VF_L, 580 + BD72720_REG_VM_BATID_TH_U, 581 + BD72720_REG_VM_BATID_TH_L, 582 + BD72720_REG_VM_BTMP_OV_THR, 583 + BD72720_REG_VM_BTMP_OV_DUR, 584 + BD72720_REG_VM_BTMP_LO_THR, 585 + BD72720_REG_VM_BTMP_LO_DUR, 586 + BD72720_REG_ALM_VBAT_TH_U, 587 + BD72720_REG_ALM_VBAT_TH_L, 588 + BD72720_REG_ALM_VSYS_TH, 589 + BD72720_REG_ALM_VBUS_TH, 590 + BD72720_REG_ALM_VF_TH, 591 + BD72720_REG_VSYS_MAX, 592 + BD72720_REG_VSYS_MIN, 593 + BD72720_REG_VM_VSYS_SA_MINMAX_CTRL, 594 + BD72720_REG_VM_SA_CFG, /* 0x6c + offset*/ 595 + 596 + BD72720_REG_CC_CURCD_U = BD72720_I2C4C_ADDR_OFFSET + 0x70, 597 + BD72720_REG_CC_CURCD_L, 598 + BD72720_REG_CC_CURCD_IMP_U, 599 + BD72720_REG_CC_CURCD_IMP_L, 600 + BD72720_REG_CC_SA_CURCD_U, 601 + BD72720_REG_CC_SA_CURCD_L, 602 + BD72720_REG_CC_OCUR_MON, 603 + BD72720_REG_CC_CCNTD_3, 604 + BD72720_REG_CC_CCNTD_2, 605 + BD72720_REG_CC_CCNTD_1, 606 + BD72720_REG_CC_CCNTD_0, 607 + BD72720_REG_REX_CCNTD_3, 608 + BD72720_REG_REX_CCNTD_2, 609 + BD72720_REG_REX_CCNTD_1, 610 + BD72720_REG_REX_CCNTD_0, 611 + BD72720_REG_FULL_CCNTD_3, 612 + BD72720_REG_FULL_CCNTD_2, 613 + BD72720_REG_FULL_CCNTD_1, 614 + BD72720_REG_FULL_CCNTD_0, 615 + BD72720_REG_CCNTD_CHG_3, 616 + BD72720_REG_CCNTD_CHG_2, 617 + BD72720_REG_CC_STAT, 618 + BD72720_REG_CC_CTRL, 619 + BD72720_REG_CC_OCUR_THR_1, 620 + BD72720_REG_CC_OCUR_THR_2, 621 + BD72720_REG_CC_OCUR_THR_3, 622 + BD72720_REG_REX_CURCD_TH, 623 + BD72720_REG_CC_BATCAP1_TH_U, 624 + BD72720_REG_CC_BATCAP1_TH_L, 625 + BD72720_REG_CC_BATCAP2_TH_U, 626 + BD72720_REG_CC_BATCAP2_TH_L, 627 + BD72720_REG_CC_BATCAP3_TH_U, 628 + BD72720_REG_CC_BATCAP3_TH_L, 629 + BD72720_REG_CC_CCNTD_CTRL, 630 + BD72720_REG_CC_SA_CFG, /* 0x92 + offset*/ 631 + BD72720_REG_IMPCHK_CTRL = BD72720_I2C4C_ADDR_OFFSET + 0xa0, 632 + }; 633 + 634 + #endif /* __LINUX_MFD_BD72720_H */
+1
include/linux/mfd/rohm-generic.h
··· 16 16 ROHM_CHIP_TYPE_BD71828, 17 17 ROHM_CHIP_TYPE_BD71837, 18 18 ROHM_CHIP_TYPE_BD71847, 19 + ROHM_CHIP_TYPE_BD72720, 19 20 ROHM_CHIP_TYPE_BD96801, 20 21 ROHM_CHIP_TYPE_BD96802, 21 22 ROHM_CHIP_TYPE_BD96805,