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

Configure Feed

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

Merge tag 'mfd-next-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
"New Drivers:
- Add support for TI TPS6594/TPS6593/LP8764 PMICs
- Add support for Samsung RT5033 Battery Charger
- Add support for Analog Devices MAX77540 and MAX77541 PMICs

New Device Support:
- Add support for SPI to Rockchip RK808 (and friends)
- Add support for AXP192 PMIC to X-Powers AXP20X
- Add support for AXP313a PMIC to X-Powers AXP20X
- Add support for RK806 to Rockchip RK8XX

Removed Device Support:
- Removed MFD support for Richtek RT5033 Battery

Fix-ups:
- Remove superfluous code
- Switch I2C drivers from .probe_new() to .probe()
- Convert over to managed resources (devm_*(), etc)
- Use dev_err_probe() for returning errors from .probe()
- Add lots of Device Tree bindings / support
- Improve cache efficiency by switching to Maple
- Use own exported namespaces (NS)
- Include missing and remove superfluous headers
- Start using / convert to the new shutdown sys-off API
- Trivial: variable / define renaming
- Make use of of_property_read_reg() when requesting DT 'reg's

Bug Fixes:
- Fix chip revision readout due to incorrect data masking
- Amend incorrect register and mask values used for charger state
- Hide unused functionality at compile time
- Fix resource leaks following error handling routines
- Return correct error values and fix error handling in general
- Repair incorrect device names - used for device matching
- Remedy broken module auto-loading"

* tag 'mfd-next-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (51 commits)
dt-bindings: mfd: max77541: Add ADI MAX77541/MAX77540
iio: adc: max77541: Add ADI MAX77541 ADC Support
regulator: max77541: Add ADI MAX77541/MAX77540 Regulator Support
dt-bindings: regulator: max77541: Add ADI MAX77541/MAX77540 Regulator
mfd: Switch two more drivers back to use struct i2c_driver::probe
dt-bindings: mfd: samsung,s5m8767: Simplify excluding properties
mfd: stmpe: Only disable the regulators if they are enabled
mfd: max77541: Add ADI MAX77541/MAX77540 PMIC Support
dt-bindings: mfd: gateworks-gsc: Remove unnecessary fan-controller nodes
mfd: core: Use of_property_read_reg() to parse "reg"
mfd: stmfx: Nullify stmfx->vdd in case of error
mfd: stmfx: Fix error path in stmfx_chip_init
mfd: intel-lpss: Add missing check for platform_get_resource
mfd: stpmic1: Add PMIC poweroff via sys-off handler
mfd: stpmic1: Fixup main control register and bits naming
dt-bindings: mfd: qcom,tcsr: Add the compatible for IPQ8074
mfd: tps65219: Add support for soft shutdown via sys-off API
mfd: pm8008: Drop bogus i2c module alias
mfd: pm8008: Fix module autoloading
mfd: tps65219: Add GPIO cell instance
...

+2374 -300
+4
.mailmap
··· 275 275 Krzysztof Kozlowski <krzk@kernel.org> <krzysztof.kozlowski@canonical.com> 276 276 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 277 277 Kuogee Hsieh <quic_khsieh@quicinc.com> <khsieh@codeaurora.org> 278 + Lee Jones <lee@kernel.org> <joneslee@google.com> 279 + Lee Jones <lee@kernel.org> <lee.jones@canonical.com> 280 + Lee Jones <lee@kernel.org> <lee.jones@linaro.org> 281 + Lee Jones <lee@kernel.org> <lee@ubuntu.com> 278 282 Leonard Crestez <leonard.crestez@nxp.com> Leonard Crestez <cdleonard@gmail.com> 279 283 Leonardo Bras <leobras.c@gmail.com> <leonardo@linux.ibm.com> 280 284 Leonard Göhrs <l.goehrs@pengutronix.de>
+68
Documentation/devicetree/bindings/mfd/adi,max77541.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/adi,max77541.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: MAX77540/MAX77541 PMIC from ADI 8 + 9 + maintainers: 10 + - Okan Sahin <okan.sahin@analog.com> 11 + 12 + description: | 13 + MAX77540 is a Power Management IC with 2 buck regulators. 14 + 15 + MAX77541 is a Power Management IC with 2 buck regulators and 1 ADC. 16 + 17 + properties: 18 + compatible: 19 + enum: 20 + - adi,max77540 21 + - adi,max77541 22 + 23 + reg: 24 + maxItems: 1 25 + 26 + interrupts: 27 + maxItems: 1 28 + 29 + regulators: 30 + $ref: /schemas/regulator/adi,max77541-regulator.yaml# 31 + 32 + required: 33 + - compatible 34 + - reg 35 + - interrupts 36 + 37 + additionalProperties: false 38 + 39 + examples: 40 + - | 41 + #include <dt-bindings/interrupt-controller/irq.h> 42 + 43 + i2c { 44 + #address-cells = <1>; 45 + #size-cells = <0>; 46 + 47 + pmic@69 { 48 + compatible = "adi,max77541"; 49 + reg = <0x69>; 50 + interrupt-parent = <&gpio>; 51 + interrupts = <16 IRQ_TYPE_EDGE_FALLING>; 52 + 53 + regulators { 54 + buck1 { 55 + regulator-min-microvolt = <500000>; 56 + regulator-max-microvolt = <5200000>; 57 + regulator-boot-on; 58 + regulator-always-on; 59 + }; 60 + buck2 { 61 + regulator-min-microvolt = <500000>; 62 + regulator-max-microvolt = <5200000>; 63 + regulator-boot-on; 64 + regulator-always-on; 65 + }; 66 + }; 67 + }; 68 + };
-10
Documentation/devicetree/bindings/mfd/gateworks-gsc.yaml
··· 122 122 compatible: 123 123 const: gw,gsc-fan 124 124 125 - "#address-cells": 126 - const: 1 127 - 128 - "#size-cells": 129 - const: 0 130 - 131 125 reg: 132 126 description: The fan controller base address 133 127 maxItems: 1 ··· 129 135 required: 130 136 - compatible 131 137 - reg 132 - - "#address-cells" 133 - - "#size-cells" 134 138 135 139 required: 136 140 - compatible ··· 186 194 }; 187 195 188 196 fan-controller@2c { 189 - #address-cells = <1>; 190 - #size-cells = <0>; 191 197 compatible = "gw,gsc-fan"; 192 198 reg = <0x2c>; 193 199 };
+4
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
··· 146 146 type: object 147 147 $ref: /schemas/nvmem/qcom,spmi-sdam.yaml# 148 148 149 + "phy@[0-9a-f]+$": 150 + type: object 151 + $ref: /schemas/phy/qcom,snps-eusb2-repeater.yaml# 152 + 149 153 "pon@[0-9a-f]+$": 150 154 type: object 151 155 $ref: /schemas/power/reset/qcom,pon.yaml#
+1
Documentation/devicetree/bindings/mfd/qcom,tcsr.yaml
··· 34 34 - qcom,tcsr-ipq5332 35 35 - qcom,tcsr-ipq6018 36 36 - qcom,tcsr-ipq8064 37 + - qcom,tcsr-ipq8074 37 38 - qcom,tcsr-ipq9574 38 39 - qcom,tcsr-mdm9615 39 40 - qcom,tcsr-msm8226
+138
Documentation/devicetree/bindings/mfd/richtek,rt5033.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/mfd/richtek,rt5033.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Richtek RT5033 Power Management Integrated Circuit 8 + 9 + maintainers: 10 + - Jakob Hauser <jahau@rocketmail.com> 11 + 12 + description: 13 + RT5033 is a multifunction device which includes battery charger, fuel gauge, 14 + flash LED current source, LDO and synchronous Buck converter for portable 15 + applications. It is interfaced to host controller using I2C interface. The 16 + battery fuel gauge uses a separate I2C bus. 17 + 18 + properties: 19 + compatible: 20 + const: richtek,rt5033 21 + 22 + reg: 23 + maxItems: 1 24 + 25 + interrupts: 26 + maxItems: 1 27 + 28 + regulators: 29 + description: 30 + The regulators of RT5033 have to be instantiated under a sub-node named 31 + "regulators". For SAFE_LDO voltage there is only one value of 4.9 V. LDO 32 + voltage ranges from 1.2 V to 3.0 V in 0.1 V steps. BUCK voltage ranges 33 + from 1.0 V to 3.0 V in 0.1 V steps. 34 + type: object 35 + patternProperties: 36 + "^(SAFE_LDO|LDO|BUCK)$": 37 + type: object 38 + $ref: /schemas/regulator/regulator.yaml# 39 + unevaluatedProperties: false 40 + additionalProperties: false 41 + 42 + charger: 43 + type: object 44 + $ref: /schemas/power/supply/richtek,rt5033-charger.yaml# 45 + 46 + required: 47 + - compatible 48 + - reg 49 + - interrupts 50 + 51 + additionalProperties: false 52 + 53 + examples: 54 + - | 55 + #include <dt-bindings/interrupt-controller/irq.h> 56 + 57 + battery: battery { 58 + compatible = "simple-battery"; 59 + precharge-current-microamp = <450000>; 60 + constant-charge-current-max-microamp = <1000000>; 61 + charge-term-current-microamp = <150000>; 62 + precharge-upper-limit-microvolt = <3500000>; 63 + constant-charge-voltage-max-microvolt = <4350000>; 64 + }; 65 + 66 + extcon { 67 + usb_con: connector { 68 + compatible = "usb-b-connector"; 69 + label = "micro-USB"; 70 + type = "micro"; 71 + }; 72 + }; 73 + 74 + i2c { 75 + #address-cells = <1>; 76 + #size-cells = <0>; 77 + 78 + i2c@0 { 79 + #address-cells = <1>; 80 + #size-cells = <0>; 81 + reg = <0>; 82 + 83 + fuel-gauge@35 { 84 + compatible = "richtek,rt5033-battery"; 85 + reg = <0x35>; 86 + 87 + interrupt-parent = <&msmgpio>; 88 + interrupts = <121 IRQ_TYPE_EDGE_FALLING>; 89 + 90 + pinctrl-names = "default"; 91 + pinctrl-0 = <&fg_alert_default>; 92 + 93 + power-supplies = <&rt5033_charger>; 94 + }; 95 + }; 96 + 97 + i2c@1 { 98 + #address-cells = <1>; 99 + #size-cells = <0>; 100 + reg = <1>; 101 + 102 + pmic@34 { 103 + compatible = "richtek,rt5033"; 104 + reg = <0x34>; 105 + 106 + interrupt-parent = <&msmgpio>; 107 + interrupts = <62 IRQ_TYPE_EDGE_FALLING>; 108 + 109 + pinctrl-names = "default"; 110 + pinctrl-0 = <&pmic_int_default>; 111 + 112 + regulators { 113 + safe_ldo_reg: SAFE_LDO { 114 + regulator-name = "SAFE_LDO"; 115 + regulator-min-microvolt = <4900000>; 116 + regulator-max-microvolt = <4900000>; 117 + regulator-always-on; 118 + }; 119 + ldo_reg: LDO { 120 + regulator-name = "LDO"; 121 + regulator-min-microvolt = <2800000>; 122 + regulator-max-microvolt = <2800000>; 123 + }; 124 + buck_reg: BUCK { 125 + regulator-name = "BUCK"; 126 + regulator-min-microvolt = <1200000>; 127 + regulator-max-microvolt = <1200000>; 128 + }; 129 + }; 130 + 131 + rt5033_charger: charger { 132 + compatible = "richtek,rt5033-charger"; 133 + monitored-battery = <&battery>; 134 + richtek,usb-connector = <&usb_con>; 135 + }; 136 + }; 137 + }; 138 + };
+7 -18
Documentation/devicetree/bindings/mfd/samsung,s5m8767.yaml
··· 153 153 additionalProperties: false 154 154 155 155 allOf: 156 - - if: 156 + - not: 157 157 required: 158 158 - s5m8767,pmic-buck2-uses-gpio-dvs 159 - then: 160 - properties: 161 - s5m8767,pmic-buck3-uses-gpio-dvs: false 162 - s5m8767,pmic-buck4-uses-gpio-dvs: false 163 - 164 - - if: 159 + - s5m8767,pmic-buck3-uses-gpio-dvs 160 + - not: 161 + required: 162 + - s5m8767,pmic-buck2-uses-gpio-dvs 163 + - s5m8767,pmic-buck4-uses-gpio-dvs 164 + - not: 165 165 required: 166 166 - s5m8767,pmic-buck3-uses-gpio-dvs 167 - then: 168 - properties: 169 - s5m8767,pmic-buck2-uses-gpio-dvs: false 170 - s5m8767,pmic-buck4-uses-gpio-dvs: false 171 - 172 - - if: 173 - required: 174 167 - s5m8767,pmic-buck4-uses-gpio-dvs 175 - then: 176 - properties: 177 - s5m8767,pmic-buck2-uses-gpio-dvs: false 178 - s5m8767,pmic-buck3-uses-gpio-dvs: false 179 168 180 169 examples: 181 170 - |
+1 -1
Documentation/devicetree/bindings/mfd/st,stpmic1.yaml
··· 184 184 additionalProperties: false 185 185 186 186 patternProperties: 187 - "^(buck[1-4]|ldo[1-6]|boost|pwr_sw[1-2])-supply$": 187 + "^(buck[1-4]|ldo[1-6]|vref_ddr|boost|pwr_sw[1-2])-supply$": 188 188 description: STPMIC1 voltage regulators supplies 189 189 190 190 "^(buck[1-4]|ldo[1-6]|boost|vref_ddr|pwr_sw[1-2])$":
+193
Documentation/devicetree/bindings/mfd/ti,tps6594.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/ti,tps6594.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: TI TPS6594 Power Management Integrated Circuit 8 + 9 + maintainers: 10 + - Julien Panis <jpanis@baylibre.com> 11 + 12 + description: 13 + TPS6594 is a Power Management IC which provides regulators and others 14 + features like GPIOs, RTC, watchdog, ESMs (Error Signal Monitor), and 15 + PFSM (Pre-configurable Finite State Machine) managing the state of the device. 16 + TPS6594 is the super-set device while TPS6593 and LP8764 are derivatives. 17 + 18 + properties: 19 + compatible: 20 + enum: 21 + - ti,lp8764-q1 22 + - ti,tps6593-q1 23 + - ti,tps6594-q1 24 + 25 + reg: 26 + description: I2C slave address or SPI chip select number. 27 + maxItems: 1 28 + 29 + ti,primary-pmic: 30 + type: boolean 31 + description: | 32 + Identify the primary PMIC on SPMI bus. 33 + A multi-PMIC synchronization scheme is implemented in the PMIC device 34 + to synchronize the power state changes with other PMIC devices. This is 35 + accomplished through a SPMI bus: the primary PMIC is the controller 36 + device on the SPMI bus, and the secondary PMICs are the target devices 37 + on the SPMI bus. 38 + 39 + system-power-controller: true 40 + 41 + gpio-controller: true 42 + 43 + '#gpio-cells': 44 + const: 2 45 + description: | 46 + The first cell is the pin number, the second cell is used to specify flags. 47 + See ../gpio/gpio.txt for more information. 48 + 49 + interrupts: 50 + maxItems: 1 51 + 52 + regulators: 53 + type: object 54 + description: List of regulators provided by this controller. 55 + 56 + patternProperties: 57 + "^buck([1-5]|12|34|123|1234)$": 58 + type: object 59 + $ref: /schemas/regulator/regulator.yaml# 60 + 61 + unevaluatedProperties: false 62 + 63 + "^ldo[1-4]$": 64 + type: object 65 + $ref: /schemas/regulator/regulator.yaml# 66 + 67 + unevaluatedProperties: false 68 + 69 + allOf: 70 + - if: 71 + required: 72 + - buck12 73 + then: 74 + properties: 75 + buck123: false 76 + buck1234: false 77 + - if: 78 + required: 79 + - buck123 80 + then: 81 + properties: 82 + buck34: false 83 + - if: 84 + required: 85 + - buck1234 86 + then: 87 + properties: 88 + buck34: false 89 + 90 + additionalProperties: false 91 + 92 + patternProperties: 93 + "^buck([1-5]|12|34|123|1234)-supply$": 94 + description: Input supply phandle for each buck. 95 + 96 + "^ldo[1-4]-supply$": 97 + description: Input supply phandle for each ldo. 98 + 99 + required: 100 + - compatible 101 + - reg 102 + - interrupts 103 + 104 + additionalProperties: false 105 + 106 + examples: 107 + - | 108 + #include <dt-bindings/interrupt-controller/arm-gic.h> 109 + i2c { 110 + #address-cells = <1>; 111 + #size-cells = <0>; 112 + 113 + tps6593: pmic@48 { 114 + compatible = "ti,tps6593-q1"; 115 + reg = <0x48>; 116 + ti,primary-pmic; 117 + system-power-controller; 118 + 119 + gpio-controller; 120 + #gpio-cells = <2>; 121 + 122 + pinctrl-names = "default"; 123 + pinctrl-0 = <&pmic_irq_pins_default>; 124 + interrupt-parent = <&mcu_gpio0>; 125 + interrupts = <0 IRQ_TYPE_EDGE_FALLING>; 126 + 127 + buck123-supply = <&vcc_3v3_sys>; 128 + buck4-supply = <&vcc_3v3_sys>; 129 + buck5-supply = <&vcc_3v3_sys>; 130 + ldo1-supply = <&vcc_3v3_sys>; 131 + ldo2-supply = <&vcc_3v3_sys>; 132 + ldo3-supply = <&buck5>; 133 + ldo4-supply = <&vcc_3v3_sys>; 134 + 135 + regulators { 136 + buck123: buck123 { 137 + regulator-name = "vcc_core"; 138 + regulator-min-microvolt = <750000>; 139 + regulator-max-microvolt = <850000>; 140 + regulator-boot-on; 141 + regulator-always-on; 142 + }; 143 + 144 + buck4: buck4 { 145 + regulator-name = "vcc_1v1"; 146 + regulator-min-microvolt = <1100000>; 147 + regulator-max-microvolt = <1100000>; 148 + regulator-boot-on; 149 + regulator-always-on; 150 + }; 151 + 152 + buck5: buck5 { 153 + regulator-name = "vcc_1v8_sys"; 154 + regulator-min-microvolt = <1800000>; 155 + regulator-max-microvolt = <1800000>; 156 + regulator-boot-on; 157 + regulator-always-on; 158 + }; 159 + 160 + ldo1: ldo1 { 161 + regulator-name = "vddshv5_sdio"; 162 + regulator-min-microvolt = <3300000>; 163 + regulator-max-microvolt = <3300000>; 164 + regulator-boot-on; 165 + regulator-always-on; 166 + }; 167 + 168 + ldo2: ldo2 { 169 + regulator-name = "vpp_1v8"; 170 + regulator-min-microvolt = <1800000>; 171 + regulator-max-microvolt = <1800000>; 172 + regulator-boot-on; 173 + regulator-always-on; 174 + }; 175 + 176 + ldo3: ldo3 { 177 + regulator-name = "vcc_0v85"; 178 + regulator-min-microvolt = <850000>; 179 + regulator-max-microvolt = <850000>; 180 + regulator-boot-on; 181 + regulator-always-on; 182 + }; 183 + 184 + ldo4: ldo4 { 185 + regulator-name = "vdda_1v8"; 186 + regulator-min-microvolt = <1800000>; 187 + regulator-max-microvolt = <1800000>; 188 + regulator-boot-on; 189 + regulator-always-on; 190 + }; 191 + }; 192 + }; 193 + };
+1
Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
··· 90 90 oneOf: 91 91 - enum: 92 92 - x-powers,axp152 93 + - x-powers,axp192 93 94 - x-powers,axp202 94 95 - x-powers,axp209 95 96 - x-powers,axp221
+1 -1
Documentation/devicetree/bindings/power/supply/richtek,rt5033-battery.yaml
··· 26 26 - compatible 27 27 - reg 28 28 29 - additionalProperties: false 29 + unevaluatedProperties: false 30 30 31 31 examples: 32 32 - |
+65
Documentation/devicetree/bindings/power/supply/richtek,rt5033-charger.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/power/supply/richtek,rt5033-charger.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Richtek RT5033 PMIC Battery Charger 8 + 9 + maintainers: 10 + - Jakob Hauser <jahau@rocketmail.com> 11 + 12 + description: 13 + The battery charger of the multifunction device RT5033 has to be instantiated 14 + under sub-node named "charger" using the following format. 15 + 16 + properties: 17 + compatible: 18 + const: richtek,rt5033-charger 19 + 20 + monitored-battery: 21 + $ref: /schemas/types.yaml#/definitions/phandle 22 + description: | 23 + Phandle to the monitored battery according to battery.yaml. The battery 24 + node needs to contain five parameters. 25 + 26 + precharge-current-microamp: 27 + Current of pre-charge mode. The pre-charge current levels are 350 mA 28 + to 650 mA programmed by I2C per 100 mA. 29 + 30 + constant-charge-current-max-microamp: 31 + Current of fast-charge mode. The fast-charge current levels are 700 mA 32 + to 2000 mA programmed by I2C per 100 mA. 33 + 34 + charge-term-current-microamp: 35 + This property is end of charge current. Its level ranges from 150 mA 36 + to 600 mA. Between 150 mA and 300 mA in 50 mA steps, between 300 mA and 37 + 600 mA in 100 mA steps. 38 + 39 + precharge-upper-limit-microvolt: 40 + Voltage of pre-charge mode. If the battery voltage is below the pre-charge 41 + threshold voltage, the charger is in pre-charge mode with pre-charge 42 + current. Its levels are 2.3 V to 3.8 V programmed by I2C per 0.1 V. 43 + 44 + constant-charge-voltage-max-microvolt: 45 + Battery regulation voltage of constant voltage mode. This voltage levels 46 + from 3.65 V to 4.4 V by I2C per 0.025 V. 47 + 48 + richtek,usb-connector: 49 + $ref: /schemas/types.yaml#/definitions/phandle 50 + description: 51 + Phandle to a USB connector according to usb-connector.yaml. The connector 52 + should be a child of the extcon device. 53 + 54 + required: 55 + - monitored-battery 56 + 57 + additionalProperties: false 58 + 59 + examples: 60 + - | 61 + charger { 62 + compatible = "richtek,rt5033-charger"; 63 + monitored-battery = <&battery>; 64 + richtek,usb-connector = <&usb_con>; 65 + };
+38
Documentation/devicetree/bindings/regulator/adi,max77541-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/adi,max77541-regulator.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Buck Converter for MAX77540/MAX77541 8 + 9 + maintainers: 10 + - Okan Sahin <okan.sahin@analog.com> 11 + 12 + description: | 13 + This is a part of device tree bindings for ADI MAX77540/MAX77541 14 + 15 + The buck converter is represented as a sub-node of the PMIC node on the device tree. 16 + 17 + The device has two buck regulators. 18 + See also Documentation/devicetree/bindings/mfd/adi,max77541.yaml for 19 + additional information and example. 20 + 21 + patternProperties: 22 + "^buck[12]$": 23 + type: object 24 + $ref: regulator.yaml# 25 + additionalProperties: false 26 + description: | 27 + Buck regulator. 28 + 29 + properties: 30 + regulator-name: true 31 + regulator-always-on: true 32 + regulator-boot-on: true 33 + regulator-min-microvolt: 34 + minimum: 300000 35 + regulator-max-microvolt: 36 + maximum: 5200000 37 + 38 + additionalProperties: false
+28 -19
drivers/fpga/intel-m10-bmc-sec-update.c
··· 376 376 u32 doorbell_reg, progress, status; 377 377 int ret, err; 378 378 379 - ret = regmap_update_bits(sec->m10bmc->regmap, 380 - csr_map->base + csr_map->doorbell, 381 - DRBL_RSU_REQUEST | DRBL_HOST_STATUS, 382 - DRBL_RSU_REQUEST | 383 - FIELD_PREP(DRBL_HOST_STATUS, 384 - HOST_STATUS_IDLE)); 379 + ret = m10bmc_sys_update_bits(sec->m10bmc, csr_map->doorbell, 380 + DRBL_RSU_REQUEST | DRBL_HOST_STATUS, 381 + DRBL_RSU_REQUEST | 382 + FIELD_PREP(DRBL_HOST_STATUS, 383 + HOST_STATUS_IDLE)); 385 384 if (ret) 386 385 return FW_UPLOAD_ERR_RW_ERROR; 387 386 ··· 449 450 u32 doorbell_reg, status; 450 451 int ret; 451 452 452 - ret = regmap_update_bits(sec->m10bmc->regmap, 453 - csr_map->base + csr_map->doorbell, 454 - DRBL_HOST_STATUS, 455 - FIELD_PREP(DRBL_HOST_STATUS, 456 - HOST_STATUS_WRITE_DONE)); 453 + ret = m10bmc_sys_update_bits(sec->m10bmc, csr_map->doorbell, 454 + DRBL_HOST_STATUS, 455 + FIELD_PREP(DRBL_HOST_STATUS, 456 + HOST_STATUS_WRITE_DONE)); 457 457 if (ret) 458 458 return FW_UPLOAD_ERR_RW_ERROR; 459 459 ··· 515 517 if (rsu_prog(doorbell) != RSU_PROG_READY) 516 518 return FW_UPLOAD_ERR_BUSY; 517 519 518 - ret = regmap_update_bits(sec->m10bmc->regmap, 519 - csr_map->base + csr_map->doorbell, 520 - DRBL_HOST_STATUS, 521 - FIELD_PREP(DRBL_HOST_STATUS, 522 - HOST_STATUS_ABORT_RSU)); 520 + ret = m10bmc_sys_update_bits(sec->m10bmc, csr_map->doorbell, 521 + DRBL_HOST_STATUS, 522 + FIELD_PREP(DRBL_HOST_STATUS, 523 + HOST_STATUS_ABORT_RSU)); 523 524 if (ret) 524 525 return FW_UPLOAD_ERR_RW_ERROR; 525 526 ··· 544 547 if (ret != FW_UPLOAD_ERR_NONE) 545 548 goto unlock_flash; 546 549 550 + m10bmc_fw_state_set(sec->m10bmc, M10BMC_FW_STATE_SEC_UPDATE_PREPARE); 551 + 547 552 ret = rsu_update_init(sec); 548 553 if (ret != FW_UPLOAD_ERR_NONE) 549 - goto unlock_flash; 554 + goto fw_state_exit; 550 555 551 556 ret = rsu_prog_ready(sec); 552 557 if (ret != FW_UPLOAD_ERR_NONE) 553 - goto unlock_flash; 558 + goto fw_state_exit; 554 559 555 560 if (sec->cancel_request) { 556 561 ret = rsu_cancel(sec); 557 - goto unlock_flash; 562 + goto fw_state_exit; 558 563 } 559 564 565 + m10bmc_fw_state_set(sec->m10bmc, M10BMC_FW_STATE_SEC_UPDATE_WRITE); 566 + 560 567 return FW_UPLOAD_ERR_NONE; 568 + 569 + fw_state_exit: 570 + m10bmc_fw_state_set(sec->m10bmc, M10BMC_FW_STATE_NORMAL); 561 571 562 572 unlock_flash: 563 573 if (sec->m10bmc->flash_bulk_ops) ··· 614 610 if (sec->cancel_request) 615 611 return rsu_cancel(sec); 616 612 613 + m10bmc_fw_state_set(sec->m10bmc, M10BMC_FW_STATE_SEC_UPDATE_PROGRAM); 614 + 617 615 result = rsu_send_data(sec); 618 616 if (result != FW_UPLOAD_ERR_NONE) 619 617 return result; ··· 658 652 struct m10bmc_sec *sec = fwl->dd_handle; 659 653 660 654 (void)rsu_cancel(sec); 655 + 656 + m10bmc_fw_state_set(sec->m10bmc, M10BMC_FW_STATE_NORMAL); 661 657 662 658 if (sec->m10bmc->flash_bulk_ops) 663 659 sec->m10bmc->flash_bulk_ops->unlock_write(sec->m10bmc); ··· 772 764 MODULE_AUTHOR("Intel Corporation"); 773 765 MODULE_DESCRIPTION("Intel MAX10 BMC Secure Update"); 774 766 MODULE_LICENSE("GPL"); 767 + MODULE_IMPORT_NS(INTEL_M10_BMC_CORE);
+1
drivers/hwmon/intel-m10-bmc-hwmon.c
··· 794 794 MODULE_AUTHOR("Intel Corporation"); 795 795 MODULE_DESCRIPTION("Intel MAX 10 BMC hardware monitor"); 796 796 MODULE_LICENSE("GPL"); 797 + MODULE_IMPORT_NS(INTEL_M10_BMC_CORE);
+11
drivers/iio/adc/Kconfig
··· 735 735 To compile this driver as a module, choose M here: the module will be 736 736 called max1363. 737 737 738 + config MAX77541_ADC 739 + tristate "Analog Devices MAX77541 ADC driver" 740 + depends on MFD_MAX77541 741 + help 742 + This driver controls a Analog Devices MAX77541 ADC 743 + via I2C bus. This device has one adc. Say yes here to build 744 + support for Analog Devices MAX77541 ADC interface. 745 + 746 + To compile this driver as a module, choose M here: 747 + the module will be called max77541-adc. 748 + 738 749 config MAX9611 739 750 tristate "Maxim max9611/max9612 ADC driver" 740 751 depends on I2C
+1
drivers/iio/adc/Makefile
··· 67 67 obj-$(CONFIG_MAX11410) += max11410.o 68 68 obj-$(CONFIG_MAX1241) += max1241.o 69 69 obj-$(CONFIG_MAX1363) += max1363.o 70 + obj-$(CONFIG_MAX77541_ADC) += max77541-adc.o 70 71 obj-$(CONFIG_MAX9611) += max9611.o 71 72 obj-$(CONFIG_MCP320X) += mcp320x.o 72 73 obj-$(CONFIG_MCP3422) += mcp3422.o
+194
drivers/iio/adc/max77541-adc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + /* 3 + * Copyright (c) 2022 Analog Devices, Inc. 4 + * ADI MAX77541 ADC Driver with IIO interface 5 + */ 6 + 7 + #include <linux/bitfield.h> 8 + #include <linux/iio/iio.h> 9 + #include <linux/mod_devicetable.h> 10 + #include <linux/platform_device.h> 11 + #include <linux/regmap.h> 12 + #include <linux/units.h> 13 + 14 + #include <linux/mfd/max77541.h> 15 + 16 + enum max77541_adc_range { 17 + LOW_RANGE, 18 + MID_RANGE, 19 + HIGH_RANGE, 20 + }; 21 + 22 + enum max77541_adc_channel { 23 + MAX77541_ADC_VSYS_V, 24 + MAX77541_ADC_VOUT1_V, 25 + MAX77541_ADC_VOUT2_V, 26 + MAX77541_ADC_TEMP, 27 + }; 28 + 29 + static int max77541_adc_offset(struct iio_dev *indio_dev, 30 + struct iio_chan_spec const *chan, 31 + int *val, int *val2) 32 + { 33 + switch (chan->channel) { 34 + case MAX77541_ADC_TEMP: 35 + *val = DIV_ROUND_CLOSEST(ABSOLUTE_ZERO_MILLICELSIUS, 1725); 36 + return IIO_VAL_INT; 37 + default: 38 + return -EINVAL; 39 + } 40 + } 41 + 42 + static int max77541_adc_scale(struct iio_dev *indio_dev, 43 + struct iio_chan_spec const *chan, 44 + int *val, int *val2) 45 + { 46 + struct regmap **regmap = iio_priv(indio_dev); 47 + unsigned int reg_val; 48 + int ret; 49 + 50 + switch (chan->channel) { 51 + case MAX77541_ADC_VSYS_V: 52 + *val = 25; 53 + return IIO_VAL_INT; 54 + case MAX77541_ADC_VOUT1_V: 55 + case MAX77541_ADC_VOUT2_V: 56 + ret = regmap_read(*regmap, MAX77541_REG_M2_CFG1, &reg_val); 57 + if (ret) 58 + return ret; 59 + 60 + reg_val = FIELD_GET(MAX77541_BITS_MX_CFG1_RNG, reg_val); 61 + switch (reg_val) { 62 + case LOW_RANGE: 63 + *val = 6; 64 + *val2 = 250000; 65 + break; 66 + case MID_RANGE: 67 + *val = 12; 68 + *val2 = 500000; 69 + break; 70 + case HIGH_RANGE: 71 + *val = 25; 72 + return IIO_VAL_INT; 73 + default: 74 + return -EINVAL; 75 + } 76 + 77 + return IIO_VAL_INT_PLUS_MICRO; 78 + case MAX77541_ADC_TEMP: 79 + *val = 1725; 80 + return IIO_VAL_INT; 81 + default: 82 + return -EINVAL; 83 + } 84 + } 85 + 86 + static int max77541_adc_raw(struct iio_dev *indio_dev, 87 + struct iio_chan_spec const *chan, 88 + int *val) 89 + { 90 + struct regmap **regmap = iio_priv(indio_dev); 91 + int ret; 92 + 93 + ret = regmap_read(*regmap, chan->address, val); 94 + if (ret) 95 + return ret; 96 + 97 + return IIO_VAL_INT; 98 + } 99 + 100 + #define MAX77541_ADC_CHANNEL_V(_channel, _name, _type, _reg) \ 101 + { \ 102 + .type = _type, \ 103 + .indexed = 1, \ 104 + .channel = _channel, \ 105 + .address = _reg, \ 106 + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 107 + BIT(IIO_CHAN_INFO_SCALE), \ 108 + .datasheet_name = _name, \ 109 + } 110 + 111 + #define MAX77541_ADC_CHANNEL_TEMP(_channel, _name, _type, _reg) \ 112 + { \ 113 + .type = _type, \ 114 + .indexed = 1, \ 115 + .channel = _channel, \ 116 + .address = _reg, \ 117 + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 118 + BIT(IIO_CHAN_INFO_SCALE) |\ 119 + BIT(IIO_CHAN_INFO_OFFSET),\ 120 + .datasheet_name = _name, \ 121 + } 122 + 123 + static const struct iio_chan_spec max77541_adc_channels[] = { 124 + MAX77541_ADC_CHANNEL_V(MAX77541_ADC_VSYS_V, "vsys_v", IIO_VOLTAGE, 125 + MAX77541_REG_ADC_DATA_CH1), 126 + MAX77541_ADC_CHANNEL_V(MAX77541_ADC_VOUT1_V, "vout1_v", IIO_VOLTAGE, 127 + MAX77541_REG_ADC_DATA_CH2), 128 + MAX77541_ADC_CHANNEL_V(MAX77541_ADC_VOUT2_V, "vout2_v", IIO_VOLTAGE, 129 + MAX77541_REG_ADC_DATA_CH3), 130 + MAX77541_ADC_CHANNEL_TEMP(MAX77541_ADC_TEMP, "temp", IIO_TEMP, 131 + MAX77541_REG_ADC_DATA_CH6), 132 + }; 133 + 134 + static int max77541_adc_read_raw(struct iio_dev *indio_dev, 135 + struct iio_chan_spec const *chan, 136 + int *val, int *val2, long mask) 137 + { 138 + switch (mask) { 139 + case IIO_CHAN_INFO_OFFSET: 140 + return max77541_adc_offset(indio_dev, chan, val, val2); 141 + case IIO_CHAN_INFO_SCALE: 142 + return max77541_adc_scale(indio_dev, chan, val, val2); 143 + case IIO_CHAN_INFO_RAW: 144 + return max77541_adc_raw(indio_dev, chan, val); 145 + default: 146 + return -EINVAL; 147 + } 148 + } 149 + 150 + static const struct iio_info max77541_adc_info = { 151 + .read_raw = max77541_adc_read_raw, 152 + }; 153 + 154 + static int max77541_adc_probe(struct platform_device *pdev) 155 + { 156 + struct device *dev = &pdev->dev; 157 + struct iio_dev *indio_dev; 158 + struct regmap **regmap; 159 + 160 + indio_dev = devm_iio_device_alloc(dev, sizeof(*regmap)); 161 + if (!indio_dev) 162 + return -ENOMEM; 163 + 164 + regmap = iio_priv(indio_dev); 165 + 166 + *regmap = dev_get_regmap(dev->parent, NULL); 167 + indio_dev->modes = INDIO_DIRECT_MODE; 168 + 169 + indio_dev->name = "max77541"; 170 + indio_dev->info = &max77541_adc_info; 171 + indio_dev->channels = max77541_adc_channels; 172 + indio_dev->num_channels = ARRAY_SIZE(max77541_adc_channels); 173 + 174 + return devm_iio_device_register(dev, indio_dev); 175 + } 176 + 177 + static const struct platform_device_id max77541_adc_platform_id[] = { 178 + { "max77541-adc" }, 179 + { /* sentinel */ } 180 + }; 181 + MODULE_DEVICE_TABLE(platform, max77541_adc_platform_id); 182 + 183 + static struct platform_driver max77541_adc_driver = { 184 + .driver = { 185 + .name = "max77541-adc", 186 + }, 187 + .probe = max77541_adc_probe, 188 + .id_table = max77541_adc_platform_id, 189 + }; 190 + module_platform_driver(max77541_adc_driver); 191 + 192 + MODULE_AUTHOR("Okan Sahin <Okan.Sahin@analog.com>"); 193 + MODULE_DESCRIPTION("MAX77541 ADC driver"); 194 + MODULE_LICENSE("GPL");
+1 -1
drivers/mfd/88pm800.c
··· 597 597 .name = "88PM800", 598 598 .pm = pm_sleep_ptr(&pm80x_pm_ops), 599 599 }, 600 - .probe_new = pm800_probe, 600 + .probe = pm800_probe, 601 601 .remove = pm800_remove, 602 602 .id_table = pm80x_id_table, 603 603 };
+1 -1
drivers/mfd/88pm805.c
··· 253 253 .name = "88PM805", 254 254 .pm = pm_sleep_ptr(&pm80x_pm_ops), 255 255 }, 256 - .probe_new = pm805_probe, 256 + .probe = pm805_probe, 257 257 .remove = pm805_remove, 258 258 .id_table = pm80x_id_table, 259 259 };
-1
drivers/mfd/88pm80x.c
··· 74 74 chip->irq = client->irq; 75 75 76 76 chip->dev = &client->dev; 77 - dev_set_drvdata(chip->dev, chip); 78 77 i2c_set_clientdata(chip->client, chip); 79 78 80 79 ret = regmap_read(chip->regmap, PM80X_CHIP_ID, &val);
+1 -2
drivers/mfd/88pm860x-core.c
··· 1166 1166 chip->client = client; 1167 1167 i2c_set_clientdata(client, chip); 1168 1168 chip->dev = &client->dev; 1169 - dev_set_drvdata(chip->dev, chip); 1170 1169 1171 1170 /* 1172 1171 * Both client and companion client shares same platform driver. ··· 1250 1251 .pm = pm_sleep_ptr(&pm860x_pm_ops), 1251 1252 .of_match_table = pm860x_dt_ids, 1252 1253 }, 1253 - .probe_new = pm860x_probe, 1254 + .probe = pm860x_probe, 1254 1255 .remove = pm860x_remove, 1255 1256 .id_table = pm860x_id_table, 1256 1257 };
+15 -2
drivers/mfd/Kconfig
··· 266 266 Support for the Cirrus Logic Madera platform audio SoC 267 267 core functionality controlled via SPI. 268 268 269 - config MFD_MAX597X 270 - tristate "Maxim 597x power switch and monitor" 269 + config MFD_MAX5970 270 + tristate "Maxim 5970/5978 power switch and monitor" 271 271 depends on (I2C && OF) 272 272 select MFD_SIMPLE_MFD_I2C 273 273 help ··· 783 783 This driver provides common support for accessing the device; 784 784 additional drivers must be enabled in order to use the functionality 785 785 of the device. 786 + 787 + config MFD_MAX77541 788 + tristate "Analog Devices MAX77541/77540 PMIC Support" 789 + depends on I2C=y 790 + select MFD_CORE 791 + select REGMAP_I2C 792 + select REGMAP_IRQ 793 + help 794 + Say yes here to add support for Analog Devices MAX77541 and 795 + MAX77540 Power Management ICs. This driver provides 796 + common support for accessing the device; additional drivers 797 + must be enabled in order to use the functionality of the device. 798 + There are regulators and adc. 786 799 787 800 config MFD_MAX77620 788 801 bool "Maxim Semiconductor MAX77620 and MAX20024 PMIC Support"
+1
drivers/mfd/Makefile
··· 154 154 obj-$(CONFIG_MFD_DA9150) += da9150-core.o 155 155 156 156 obj-$(CONFIG_MFD_MAX14577) += max14577.o 157 + obj-$(CONFIG_MFD_MAX77541) += max77541.o 157 158 obj-$(CONFIG_MFD_MAX77620) += max77620.o 158 159 obj-$(CONFIG_MFD_MAX77650) += max77650.o 159 160 obj-$(CONFIG_MFD_MAX77686) += max77686.o
+1 -3
drivers/mfd/aat2870-core.c
··· 345 345 return -ENOMEM; 346 346 347 347 aat2870->dev = &client->dev; 348 - dev_set_drvdata(aat2870->dev, aat2870); 349 - 350 348 aat2870->client = client; 351 349 i2c_set_clientdata(client, aat2870); 352 350 ··· 449 451 .pm = pm_sleep_ptr(&aat2870_pm_ops), 450 452 .suppress_bind_attrs = true, 451 453 }, 452 - .probe_new = aat2870_i2c_probe, 454 + .probe = aat2870_i2c_probe, 453 455 .id_table = aat2870_i2c_id_table, 454 456 }; 455 457
+1 -1
drivers/mfd/acer-ec-a500.c
··· 190 190 .name = "acer-a500-embedded-controller", 191 191 .of_match_table = a500_ec_match, 192 192 }, 193 - .probe_new = a500_ec_probe, 193 + .probe = a500_ec_probe, 194 194 .remove = a500_ec_remove, 195 195 }; 196 196 module_i2c_driver(a500_ec_driver);
+1 -1
drivers/mfd/act8945a.c
··· 70 70 .name = "act8945a", 71 71 .of_match_table = of_match_ptr(act8945a_of_match), 72 72 }, 73 - .probe_new = act8945a_i2c_probe, 73 + .probe = act8945a_i2c_probe, 74 74 .id_table = act8945a_i2c_id, 75 75 }; 76 76
+1 -1
drivers/mfd/adp5520.c
··· 340 340 .pm = pm_sleep_ptr(&adp5520_pm), 341 341 .suppress_bind_attrs = true, 342 342 }, 343 - .probe_new = adp5520_probe, 343 + .probe = adp5520_probe, 344 344 .id_table = adp5520_id, 345 345 }; 346 346 builtin_i2c_driver(adp5520_driver);
+1 -1
drivers/mfd/arizona-i2c.c
··· 121 121 .pm = pm_ptr(&arizona_pm_ops), 122 122 .of_match_table = of_match_ptr(arizona_i2c_of_match), 123 123 }, 124 - .probe_new = arizona_i2c_probe, 124 + .probe = arizona_i2c_probe, 125 125 .remove = arizona_i2c_remove, 126 126 .id_table = arizona_i2c_id, 127 127 };
+1 -1
drivers/mfd/as3711.c
··· 201 201 .name = "as3711", 202 202 .of_match_table = of_match_ptr(as3711_of_match), 203 203 }, 204 - .probe_new = as3711_i2c_probe, 204 + .probe = as3711_i2c_probe, 205 205 .id_table = as3711_i2c_id, 206 206 }; 207 207
+1 -1
drivers/mfd/as3722.c
··· 445 445 .of_match_table = as3722_of_match, 446 446 .pm = &as3722_pm_ops, 447 447 }, 448 - .probe_new = as3722_i2c_probe, 448 + .probe = as3722_i2c_probe, 449 449 .id_table = as3722_i2c_id, 450 450 }; 451 451
+1 -1
drivers/mfd/atc260x-i2c.c
··· 53 53 .name = "atc260x", 54 54 .of_match_table = atc260x_i2c_of_match, 55 55 }, 56 - .probe_new = atc260x_i2c_probe, 56 + .probe = atc260x_i2c_probe, 57 57 }; 58 58 module_i2c_driver(atc260x_i2c_driver); 59 59
+3 -1
drivers/mfd/axp20x-i2c.c
··· 59 59 #ifdef CONFIG_OF 60 60 static const struct of_device_id axp20x_i2c_of_match[] = { 61 61 { .compatible = "x-powers,axp152", .data = (void *)AXP152_ID }, 62 + { .compatible = "x-powers,axp192", .data = (void *)AXP192_ID }, 62 63 { .compatible = "x-powers,axp202", .data = (void *)AXP202_ID }, 63 64 { .compatible = "x-powers,axp209", .data = (void *)AXP209_ID }, 64 65 { .compatible = "x-powers,axp221", .data = (void *)AXP221_ID }, ··· 75 74 76 75 static const struct i2c_device_id axp20x_i2c_id[] = { 77 76 { "axp152", 0 }, 77 + { "axp192", 0 }, 78 78 { "axp202", 0 }, 79 79 { "axp209", 0 }, 80 80 { "axp221", 0 }, ··· 105 103 .of_match_table = of_match_ptr(axp20x_i2c_of_match), 106 104 .acpi_match_table = ACPI_PTR(axp20x_i2c_acpi_match), 107 105 }, 108 - .probe_new = axp20x_i2c_probe, 106 + .probe = axp20x_i2c_probe, 109 107 .remove = axp20x_i2c_remove, 110 108 .id_table = axp20x_i2c_id, 111 109 };
+141
drivers/mfd/axp20x.c
··· 34 34 35 35 static const char * const axp20x_model_names[] = { 36 36 "AXP152", 37 + "AXP192", 37 38 "AXP202", 38 39 "AXP209", 39 40 "AXP221", ··· 93 92 static const struct regmap_access_table axp20x_volatile_table = { 94 93 .yes_ranges = axp20x_volatile_ranges, 95 94 .n_yes_ranges = ARRAY_SIZE(axp20x_volatile_ranges), 95 + }; 96 + 97 + static const struct regmap_range axp192_writeable_ranges[] = { 98 + regmap_reg_range(AXP192_DATACACHE(0), AXP192_DATACACHE(5)), 99 + regmap_reg_range(AXP192_PWR_OUT_CTRL, AXP192_IRQ5_STATE), 100 + regmap_reg_range(AXP20X_DCDC_MODE, AXP192_N_RSTO_CTRL), 101 + regmap_reg_range(AXP20X_CC_CTRL, AXP20X_CC_CTRL), 102 + }; 103 + 104 + static const struct regmap_range axp192_volatile_ranges[] = { 105 + regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP192_USB_OTG_STATUS), 106 + regmap_reg_range(AXP192_IRQ1_STATE, AXP192_IRQ4_STATE), 107 + regmap_reg_range(AXP192_IRQ5_STATE, AXP192_IRQ5_STATE), 108 + regmap_reg_range(AXP20X_ACIN_V_ADC_H, AXP20X_IPSOUT_V_HIGH_L), 109 + regmap_reg_range(AXP20X_TIMER_CTRL, AXP20X_TIMER_CTRL), 110 + regmap_reg_range(AXP192_GPIO2_0_STATE, AXP192_GPIO2_0_STATE), 111 + regmap_reg_range(AXP192_GPIO4_3_STATE, AXP192_GPIO4_3_STATE), 112 + regmap_reg_range(AXP192_N_RSTO_CTRL, AXP192_N_RSTO_CTRL), 113 + regmap_reg_range(AXP20X_CHRG_CC_31_24, AXP20X_CC_CTRL), 114 + }; 115 + 116 + static const struct regmap_access_table axp192_writeable_table = { 117 + .yes_ranges = axp192_writeable_ranges, 118 + .n_yes_ranges = ARRAY_SIZE(axp192_writeable_ranges), 119 + }; 120 + 121 + static const struct regmap_access_table axp192_volatile_table = { 122 + .yes_ranges = axp192_volatile_ranges, 123 + .n_yes_ranges = ARRAY_SIZE(axp192_volatile_ranges), 96 124 }; 97 125 98 126 /* AXP22x ranges are shared with the AXP809, as they cover the same range */ ··· 250 220 DEFINE_RES_IRQ_NAMED(AXP152_IRQ_PEK_FAL_EDGE, "PEK_DBF"), 251 221 }; 252 222 223 + static const struct resource axp192_ac_power_supply_resources[] = { 224 + DEFINE_RES_IRQ_NAMED(AXP192_IRQ_ACIN_PLUGIN, "ACIN_PLUGIN"), 225 + DEFINE_RES_IRQ_NAMED(AXP192_IRQ_ACIN_REMOVAL, "ACIN_REMOVAL"), 226 + DEFINE_RES_IRQ_NAMED(AXP192_IRQ_ACIN_OVER_V, "ACIN_OVER_V"), 227 + }; 228 + 229 + static const struct resource axp192_usb_power_supply_resources[] = { 230 + DEFINE_RES_IRQ_NAMED(AXP192_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"), 231 + DEFINE_RES_IRQ_NAMED(AXP192_IRQ_VBUS_REMOVAL, "VBUS_REMOVAL"), 232 + DEFINE_RES_IRQ_NAMED(AXP192_IRQ_VBUS_VALID, "VBUS_VALID"), 233 + DEFINE_RES_IRQ_NAMED(AXP192_IRQ_VBUS_NOT_VALID, "VBUS_NOT_VALID"), 234 + }; 235 + 253 236 static const struct resource axp20x_ac_power_supply_resources[] = { 254 237 DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_ACIN_PLUGIN, "ACIN_PLUGIN"), 255 238 DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_ACIN_REMOVAL, "ACIN_REMOVAL"), ··· 345 302 .cache_type = REGCACHE_RBTREE, 346 303 }; 347 304 305 + static const struct regmap_config axp192_regmap_config = { 306 + .reg_bits = 8, 307 + .val_bits = 8, 308 + .wr_table = &axp192_writeable_table, 309 + .volatile_table = &axp192_volatile_table, 310 + .max_register = AXP20X_CC_CTRL, 311 + .cache_type = REGCACHE_RBTREE, 312 + }; 313 + 348 314 static const struct regmap_config axp20x_regmap_config = { 349 315 .reg_bits = 8, 350 316 .val_bits = 8, ··· 429 377 INIT_REGMAP_IRQ(AXP152, GPIO2_INPUT, 2, 2), 430 378 INIT_REGMAP_IRQ(AXP152, GPIO1_INPUT, 2, 1), 431 379 INIT_REGMAP_IRQ(AXP152, GPIO0_INPUT, 2, 0), 380 + }; 381 + 382 + static const struct regmap_irq axp192_regmap_irqs[] = { 383 + INIT_REGMAP_IRQ(AXP192, ACIN_OVER_V, 0, 7), 384 + INIT_REGMAP_IRQ(AXP192, ACIN_PLUGIN, 0, 6), 385 + INIT_REGMAP_IRQ(AXP192, ACIN_REMOVAL, 0, 5), 386 + INIT_REGMAP_IRQ(AXP192, VBUS_OVER_V, 0, 4), 387 + INIT_REGMAP_IRQ(AXP192, VBUS_PLUGIN, 0, 3), 388 + INIT_REGMAP_IRQ(AXP192, VBUS_REMOVAL, 0, 2), 389 + INIT_REGMAP_IRQ(AXP192, VBUS_V_LOW, 0, 1), 390 + INIT_REGMAP_IRQ(AXP192, BATT_PLUGIN, 1, 7), 391 + INIT_REGMAP_IRQ(AXP192, BATT_REMOVAL, 1, 6), 392 + INIT_REGMAP_IRQ(AXP192, BATT_ENT_ACT_MODE, 1, 5), 393 + INIT_REGMAP_IRQ(AXP192, BATT_EXIT_ACT_MODE, 1, 4), 394 + INIT_REGMAP_IRQ(AXP192, CHARG, 1, 3), 395 + INIT_REGMAP_IRQ(AXP192, CHARG_DONE, 1, 2), 396 + INIT_REGMAP_IRQ(AXP192, BATT_TEMP_HIGH, 1, 1), 397 + INIT_REGMAP_IRQ(AXP192, BATT_TEMP_LOW, 1, 0), 398 + INIT_REGMAP_IRQ(AXP192, DIE_TEMP_HIGH, 2, 7), 399 + INIT_REGMAP_IRQ(AXP192, CHARG_I_LOW, 2, 6), 400 + INIT_REGMAP_IRQ(AXP192, DCDC1_V_LONG, 2, 5), 401 + INIT_REGMAP_IRQ(AXP192, DCDC2_V_LONG, 2, 4), 402 + INIT_REGMAP_IRQ(AXP192, DCDC3_V_LONG, 2, 3), 403 + INIT_REGMAP_IRQ(AXP192, PEK_SHORT, 2, 1), 404 + INIT_REGMAP_IRQ(AXP192, PEK_LONG, 2, 0), 405 + INIT_REGMAP_IRQ(AXP192, N_OE_PWR_ON, 3, 7), 406 + INIT_REGMAP_IRQ(AXP192, N_OE_PWR_OFF, 3, 6), 407 + INIT_REGMAP_IRQ(AXP192, VBUS_VALID, 3, 5), 408 + INIT_REGMAP_IRQ(AXP192, VBUS_NOT_VALID, 3, 4), 409 + INIT_REGMAP_IRQ(AXP192, VBUS_SESS_VALID, 3, 3), 410 + INIT_REGMAP_IRQ(AXP192, VBUS_SESS_END, 3, 2), 411 + INIT_REGMAP_IRQ(AXP192, LOW_PWR_LVL, 3, 0), 412 + INIT_REGMAP_IRQ(AXP192, TIMER, 4, 7), 413 + INIT_REGMAP_IRQ(AXP192, GPIO2_INPUT, 4, 2), 414 + INIT_REGMAP_IRQ(AXP192, GPIO1_INPUT, 4, 1), 415 + INIT_REGMAP_IRQ(AXP192, GPIO0_INPUT, 4, 0), 432 416 }; 433 417 434 418 static const struct regmap_irq axp20x_regmap_irqs[] = { ··· 703 615 .num_regs = 3, 704 616 }; 705 617 618 + static unsigned int axp192_get_irq_reg(struct regmap_irq_chip_data *data, 619 + unsigned int base, int index) 620 + { 621 + /* linear mapping for IRQ1 to IRQ4 */ 622 + if (index < 4) 623 + return base + index; 624 + 625 + /* handle IRQ5 separately */ 626 + if (base == AXP192_IRQ1_EN) 627 + return AXP192_IRQ5_EN; 628 + 629 + return AXP192_IRQ5_STATE; 630 + } 631 + 632 + static const struct regmap_irq_chip axp192_regmap_irq_chip = { 633 + .name = "axp192_irq_chip", 634 + .status_base = AXP192_IRQ1_STATE, 635 + .ack_base = AXP192_IRQ1_STATE, 636 + .unmask_base = AXP192_IRQ1_EN, 637 + .init_ack_masked = true, 638 + .irqs = axp192_regmap_irqs, 639 + .num_irqs = ARRAY_SIZE(axp192_regmap_irqs), 640 + .num_regs = 5, 641 + .get_irq_reg = axp192_get_irq_reg, 642 + }; 643 + 706 644 static const struct regmap_irq_chip axp20x_regmap_irq_chip = { 707 645 .name = "axp20x_irq_chip", 708 646 .status_base = AXP20X_IRQ1_STATE, ··· 817 703 .irqs = axp15060_regmap_irqs, 818 704 .num_irqs = ARRAY_SIZE(axp15060_regmap_irqs), 819 705 .num_regs = 2, 706 + }; 707 + 708 + static const struct mfd_cell axp192_cells[] = { 709 + { 710 + .name = "axp192-adc", 711 + .of_compatible = "x-powers,axp192-adc", 712 + }, { 713 + .name = "axp20x-battery-power-supply", 714 + .of_compatible = "x-powers,axp192-battery-power-supply", 715 + }, { 716 + .name = "axp20x-ac-power-supply", 717 + .of_compatible = "x-powers,axp202-ac-power-supply", 718 + .num_resources = ARRAY_SIZE(axp192_ac_power_supply_resources), 719 + .resources = axp192_ac_power_supply_resources, 720 + }, { 721 + .name = "axp20x-usb-power-supply", 722 + .of_compatible = "x-powers,axp192-usb-power-supply", 723 + .num_resources = ARRAY_SIZE(axp192_usb_power_supply_resources), 724 + .resources = axp192_usb_power_supply_resources, 725 + }, 726 + { .name = "axp20x-regulator" }, 820 727 }; 821 728 822 729 static const struct mfd_cell axp20x_cells[] = { ··· 1156 1021 axp20x->cells = axp152_cells; 1157 1022 axp20x->regmap_cfg = &axp152_regmap_config; 1158 1023 axp20x->regmap_irq_chip = &axp152_regmap_irq_chip; 1024 + break; 1025 + case AXP192_ID: 1026 + axp20x->nr_cells = ARRAY_SIZE(axp192_cells); 1027 + axp20x->cells = axp192_cells; 1028 + axp20x->regmap_cfg = &axp192_regmap_config; 1029 + axp20x->regmap_irq_chip = &axp192_regmap_irq_chip; 1159 1030 break; 1160 1031 case AXP202_ID: 1161 1032 case AXP209_ID:
+1 -1
drivers/mfd/bcm590xx.c
··· 108 108 .name = "bcm590xx", 109 109 .of_match_table = bcm590xx_of_match, 110 110 }, 111 - .probe_new = bcm590xx_i2c_probe, 111 + .probe = bcm590xx_i2c_probe, 112 112 .id_table = bcm590xx_i2c_id, 113 113 }; 114 114 module_i2c_driver(bcm590xx_i2c_driver);
+1 -1
drivers/mfd/bd9571mwv.c
··· 278 278 .name = "bd9571mwv", 279 279 .of_match_table = bd9571mwv_of_match_table, 280 280 }, 281 - .probe_new = bd9571mwv_probe, 281 + .probe = bd9571mwv_probe, 282 282 .id_table = bd9571mwv_id_table, 283 283 }; 284 284 module_i2c_driver(bd9571mwv_driver);
+1 -1
drivers/mfd/da903x.c
··· 543 543 .driver = { 544 544 .name = "da903x", 545 545 }, 546 - .probe_new = da903x_probe, 546 + .probe = da903x_probe, 547 547 .remove = da903x_remove, 548 548 .id_table = da903x_id_table, 549 549 };
+1 -1
drivers/mfd/da9052-i2c.c
··· 176 176 } 177 177 178 178 static struct i2c_driver da9052_i2c_driver = { 179 - .probe_new = da9052_i2c_probe, 179 + .probe = da9052_i2c_probe, 180 180 .remove = da9052_i2c_remove, 181 181 .id_table = da9052_i2c_id, 182 182 .driver = {
+1 -1
drivers/mfd/da9055-i2c.c
··· 66 66 }; 67 67 68 68 static struct i2c_driver da9055_i2c_driver = { 69 - .probe_new = da9055_i2c_probe, 69 + .probe = da9055_i2c_probe, 70 70 .remove = da9055_i2c_remove, 71 71 .id_table = da9055_i2c_id, 72 72 .driver = {
+1 -1
drivers/mfd/da9062-core.c
··· 726 726 .name = "da9062", 727 727 .of_match_table = da9062_dt_ids, 728 728 }, 729 - .probe_new = da9062_i2c_probe, 729 + .probe = da9062_i2c_probe, 730 730 .remove = da9062_i2c_remove, 731 731 .id_table = da9062_i2c_id, 732 732 };
+1 -1
drivers/mfd/da9063-i2c.c
··· 469 469 .name = "da9063", 470 470 .of_match_table = da9063_dt_ids, 471 471 }, 472 - .probe_new = da9063_i2c_probe, 472 + .probe = da9063_i2c_probe, 473 473 .id_table = da9063_i2c_id, 474 474 }; 475 475
+1 -1
drivers/mfd/da9150-core.c
··· 510 510 .name = "da9150", 511 511 .of_match_table = da9150_of_match, 512 512 }, 513 - .probe_new = da9150_probe, 513 + .probe = da9150_probe, 514 514 .remove = da9150_remove, 515 515 .shutdown = da9150_shutdown, 516 516 .id_table = da9150_i2c_id,
-1
drivers/mfd/dln2.c
··· 14 14 #include <linux/types.h> 15 15 #include <linux/slab.h> 16 16 #include <linux/usb.h> 17 - #include <linux/i2c.h> 18 17 #include <linux/mutex.h> 19 18 #include <linux/platform_device.h> 20 19 #include <linux/mfd/core.h>
+1 -1
drivers/mfd/ene-kb3930.c
··· 196 196 MODULE_DEVICE_TABLE(of, kb3930_dt_ids); 197 197 198 198 static struct i2c_driver kb3930_driver = { 199 - .probe_new = kb3930_probe, 199 + .probe = kb3930_probe, 200 200 .remove = kb3930_remove, 201 201 .driver = { 202 202 .name = "ene-kb3930",
+1 -1
drivers/mfd/gateworks-gsc.c
··· 264 264 .name = "gateworks-gsc", 265 265 .of_match_table = gsc_of_match, 266 266 }, 267 - .probe_new = gsc_probe, 267 + .probe = gsc_probe, 268 268 .remove = gsc_remove, 269 269 }; 270 270 module_i2c_driver(gsc_driver);
+3
drivers/mfd/intel-lpss-acpi.c
··· 183 183 return -ENOMEM; 184 184 185 185 info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 186 + if (!info->mem) 187 + return -ENODEV; 188 + 186 189 info->irq = platform_get_irq(pdev, 0); 187 190 188 191 ret = intel_lpss_probe(&pdev->dev, info);
+2
drivers/mfd/intel-lpss.c
··· 460 460 } 461 461 EXPORT_SYMBOL_GPL(intel_lpss_remove); 462 462 463 + #ifdef CONFIG_PM 463 464 static int resume_lpss_device(struct device *dev, void *data) 464 465 { 465 466 if (!dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND)) ··· 515 514 return 0; 516 515 } 517 516 EXPORT_SYMBOL_GPL(intel_lpss_resume); 517 + #endif 518 518 519 519 static int __init intel_lpss_init(void) 520 520 {
+88 -2
drivers/mfd/intel-m10-bmc-core.c
··· 12 12 #include <linux/mfd/intel-m10-bmc.h> 13 13 #include <linux/module.h> 14 14 15 + void m10bmc_fw_state_set(struct intel_m10bmc *m10bmc, enum m10bmc_fw_state new_state) 16 + { 17 + /* bmcfw_state is only needed if handshake_sys_reg_nranges > 0 */ 18 + if (!m10bmc->info->handshake_sys_reg_nranges) 19 + return; 20 + 21 + down_write(&m10bmc->bmcfw_lock); 22 + m10bmc->bmcfw_state = new_state; 23 + up_write(&m10bmc->bmcfw_lock); 24 + } 25 + EXPORT_SYMBOL_NS_GPL(m10bmc_fw_state_set, INTEL_M10_BMC_CORE); 26 + 27 + /* 28 + * For some Intel FPGA devices, the BMC firmware is not available to service 29 + * handshake registers during a secure update. 30 + */ 31 + static bool m10bmc_reg_always_available(struct intel_m10bmc *m10bmc, unsigned int offset) 32 + { 33 + if (!m10bmc->info->handshake_sys_reg_nranges) 34 + return true; 35 + 36 + return !regmap_reg_in_ranges(offset, m10bmc->info->handshake_sys_reg_ranges, 37 + m10bmc->info->handshake_sys_reg_nranges); 38 + } 39 + 40 + /* 41 + * m10bmc_handshake_reg_unavailable - Checks if reg access collides with secure update state 42 + * @m10bmc: M10 BMC structure 43 + * 44 + * For some Intel FPGA devices, the BMC firmware is not available to service 45 + * handshake registers during a secure update erase and write phases. 46 + * 47 + * Context: @m10bmc->bmcfw_lock must be held. 48 + */ 49 + static bool m10bmc_handshake_reg_unavailable(struct intel_m10bmc *m10bmc) 50 + { 51 + return m10bmc->bmcfw_state == M10BMC_FW_STATE_SEC_UPDATE_PREPARE || 52 + m10bmc->bmcfw_state == M10BMC_FW_STATE_SEC_UPDATE_WRITE; 53 + } 54 + 55 + /* 56 + * This function helps to simplify the accessing of the system registers. 57 + * 58 + * The base of the system registers is configured through the struct 59 + * csr_map. 60 + */ 61 + int m10bmc_sys_read(struct intel_m10bmc *m10bmc, unsigned int offset, unsigned int *val) 62 + { 63 + const struct m10bmc_csr_map *csr_map = m10bmc->info->csr_map; 64 + int ret; 65 + 66 + if (m10bmc_reg_always_available(m10bmc, offset)) 67 + return m10bmc_raw_read(m10bmc, csr_map->base + offset, val); 68 + 69 + down_read(&m10bmc->bmcfw_lock); 70 + if (m10bmc_handshake_reg_unavailable(m10bmc)) 71 + ret = -EBUSY; /* Reg not available during secure update */ 72 + else 73 + ret = m10bmc_raw_read(m10bmc, csr_map->base + offset, val); 74 + up_read(&m10bmc->bmcfw_lock); 75 + 76 + return ret; 77 + } 78 + EXPORT_SYMBOL_NS_GPL(m10bmc_sys_read, INTEL_M10_BMC_CORE); 79 + 80 + int m10bmc_sys_update_bits(struct intel_m10bmc *m10bmc, unsigned int offset, 81 + unsigned int msk, unsigned int val) 82 + { 83 + const struct m10bmc_csr_map *csr_map = m10bmc->info->csr_map; 84 + int ret; 85 + 86 + if (m10bmc_reg_always_available(m10bmc, offset)) 87 + return regmap_update_bits(m10bmc->regmap, csr_map->base + offset, msk, val); 88 + 89 + down_read(&m10bmc->bmcfw_lock); 90 + if (m10bmc_handshake_reg_unavailable(m10bmc)) 91 + ret = -EBUSY; /* Reg not available during secure update */ 92 + else 93 + ret = regmap_update_bits(m10bmc->regmap, csr_map->base + offset, msk, val); 94 + up_read(&m10bmc->bmcfw_lock); 95 + 96 + return ret; 97 + } 98 + EXPORT_SYMBOL_NS_GPL(m10bmc_sys_update_bits, INTEL_M10_BMC_CORE); 99 + 15 100 static ssize_t bmc_version_show(struct device *dev, 16 101 struct device_attribute *attr, char *buf) 17 102 { ··· 183 98 &m10bmc_group, 184 99 NULL, 185 100 }; 186 - EXPORT_SYMBOL_GPL(m10bmc_dev_groups); 101 + EXPORT_SYMBOL_NS_GPL(m10bmc_dev_groups, INTEL_M10_BMC_CORE); 187 102 188 103 int m10bmc_dev_init(struct intel_m10bmc *m10bmc, const struct intel_m10bmc_platform_info *info) 189 104 { ··· 191 106 192 107 m10bmc->info = info; 193 108 dev_set_drvdata(m10bmc->dev, m10bmc); 109 + init_rwsem(&m10bmc->bmcfw_lock); 194 110 195 111 ret = devm_mfd_add_devices(m10bmc->dev, PLATFORM_DEVID_AUTO, 196 112 info->cells, info->n_cells, ··· 201 115 202 116 return ret; 203 117 } 204 - EXPORT_SYMBOL_GPL(m10bmc_dev_init); 118 + EXPORT_SYMBOL_NS_GPL(m10bmc_dev_init, INTEL_M10_BMC_CORE); 205 119 206 120 MODULE_DESCRIPTION("Intel MAX 10 BMC core driver"); 207 121 MODULE_AUTHOR("Intel Corporation");
+1
drivers/mfd/intel-m10-bmc-pmci.c
··· 453 453 MODULE_DESCRIPTION("MAX10 BMC PMCI-based interface"); 454 454 MODULE_AUTHOR("Intel Corporation"); 455 455 MODULE_LICENSE("GPL"); 456 + MODULE_IMPORT_NS(INTEL_M10_BMC_CORE);
+15
drivers/mfd/intel-m10-bmc-spi.c
··· 116 116 { .name = "d5005bmc-sec-update" }, 117 117 }; 118 118 119 + static const struct regmap_range m10bmc_d5005_fw_handshake_regs[] = { 120 + regmap_reg_range(M10BMC_N3000_TELEM_START, M10BMC_D5005_TELEM_END), 121 + }; 122 + 119 123 static struct mfd_cell m10bmc_pacn3000_subdevs[] = { 120 124 { .name = "n3000bmc-hwmon" }, 121 125 { .name = "n3000bmc-retimer" }, 122 126 { .name = "n3000bmc-sec-update" }, 127 + }; 128 + 129 + static const struct regmap_range m10bmc_n3000_fw_handshake_regs[] = { 130 + regmap_reg_range(M10BMC_N3000_TELEM_START, M10BMC_N3000_TELEM_END), 123 131 }; 124 132 125 133 static struct mfd_cell m10bmc_n5010_subdevs[] = { ··· 137 129 static const struct intel_m10bmc_platform_info m10bmc_spi_n3000 = { 138 130 .cells = m10bmc_pacn3000_subdevs, 139 131 .n_cells = ARRAY_SIZE(m10bmc_pacn3000_subdevs), 132 + .handshake_sys_reg_ranges = m10bmc_n3000_fw_handshake_regs, 133 + .handshake_sys_reg_nranges = ARRAY_SIZE(m10bmc_n3000_fw_handshake_regs), 140 134 .csr_map = &m10bmc_n3000_csr_map, 141 135 }; 142 136 143 137 static const struct intel_m10bmc_platform_info m10bmc_spi_d5005 = { 144 138 .cells = m10bmc_d5005_subdevs, 145 139 .n_cells = ARRAY_SIZE(m10bmc_d5005_subdevs), 140 + .handshake_sys_reg_ranges = m10bmc_d5005_fw_handshake_regs, 141 + .handshake_sys_reg_nranges = ARRAY_SIZE(m10bmc_d5005_fw_handshake_regs), 146 142 .csr_map = &m10bmc_n3000_csr_map, 147 143 }; 148 144 149 145 static const struct intel_m10bmc_platform_info m10bmc_spi_n5010 = { 150 146 .cells = m10bmc_n5010_subdevs, 151 147 .n_cells = ARRAY_SIZE(m10bmc_n5010_subdevs), 148 + .handshake_sys_reg_ranges = m10bmc_n3000_fw_handshake_regs, 149 + .handshake_sys_reg_nranges = ARRAY_SIZE(m10bmc_n3000_fw_handshake_regs), 152 150 .csr_map = &m10bmc_n3000_csr_map, 153 151 }; 154 152 ··· 180 166 MODULE_AUTHOR("Intel Corporation"); 181 167 MODULE_LICENSE("GPL v2"); 182 168 MODULE_ALIAS("spi:intel-m10-bmc"); 169 + MODULE_IMPORT_NS(INTEL_M10_BMC_CORE);
+1 -1
drivers/mfd/intel_soc_pmic_chtdc_ti.c
··· 172 172 .pm = pm_sleep_ptr(&chtdc_ti_pm_ops), 173 173 .acpi_match_table = chtdc_ti_acpi_ids, 174 174 }, 175 - .probe_new = chtdc_ti_probe, 175 + .probe = chtdc_ti_probe, 176 176 .shutdown = chtdc_ti_shutdown, 177 177 }; 178 178 module_i2c_driver(chtdc_ti_i2c_driver);
+1 -1
drivers/mfd/intel_soc_pmic_chtwc.c
··· 272 272 .pm = pm_sleep_ptr(&cht_wc_pm_ops), 273 273 .acpi_match_table = cht_wc_acpi_ids, 274 274 }, 275 - .probe_new = cht_wc_probe, 275 + .probe = cht_wc_probe, 276 276 .shutdown = cht_wc_shutdown, 277 277 .id_table = cht_wc_i2c_id, 278 278 };
+1 -1
drivers/mfd/intel_soc_pmic_crc.c
··· 263 263 .pm = pm_sleep_ptr(&crystal_cove_pm_ops), 264 264 .acpi_match_table = crystal_cove_acpi_match, 265 265 }, 266 - .probe_new = crystal_cove_i2c_probe, 266 + .probe = crystal_cove_i2c_probe, 267 267 .remove = crystal_cove_i2c_remove, 268 268 .shutdown = crystal_cove_shutdown, 269 269 };
+1 -1
drivers/mfd/iqs62x.c
··· 1069 1069 .of_match_table = iqs62x_of_match, 1070 1070 .pm = &iqs62x_pm, 1071 1071 }, 1072 - .probe_new = iqs62x_probe, 1072 + .probe = iqs62x_probe, 1073 1073 .remove = iqs62x_remove, 1074 1074 }; 1075 1075 module_i2c_driver(iqs62x_i2c_driver);
+1 -1
drivers/mfd/khadas-mcu.c
··· 134 134 .name = "khadas-mcu-core", 135 135 .of_match_table = of_match_ptr(khadas_mcu_of_match), 136 136 }, 137 - .probe_new = khadas_mcu_probe, 137 + .probe = khadas_mcu_probe, 138 138 }; 139 139 module_i2c_driver(khadas_mcu_driver); 140 140
+1 -3
drivers/mfd/lm3533-core.c
··· 485 485 486 486 lm3533->gpio_hwen = pdata->gpio_hwen; 487 487 488 - dev_set_drvdata(lm3533->dev, lm3533); 489 - 490 488 if (gpio_is_valid(lm3533->gpio_hwen)) { 491 489 ret = devm_gpio_request_one(lm3533->dev, lm3533->gpio_hwen, 492 490 GPIOF_OUT_INIT_LOW, "lm3533-hwen"); ··· 624 626 .name = "lm3533", 625 627 }, 626 628 .id_table = lm3533_i2c_ids, 627 - .probe_new = lm3533_i2c_probe, 629 + .probe = lm3533_i2c_probe, 628 630 .remove = lm3533_i2c_remove, 629 631 }; 630 632
+1 -1
drivers/mfd/lochnagar-i2c.c
··· 382 382 .of_match_table = of_match_ptr(lochnagar_of_match), 383 383 .suppress_bind_attrs = true, 384 384 }, 385 - .probe_new = lochnagar_i2c_probe, 385 + .probe = lochnagar_i2c_probe, 386 386 }; 387 387 388 388 static int __init lochnagar_i2c_init(void)
+1 -1
drivers/mfd/lp3943.c
··· 140 140 #endif 141 141 142 142 static struct i2c_driver lp3943_driver = { 143 - .probe_new = lp3943_probe, 143 + .probe = lp3943_probe, 144 144 .driver = { 145 145 .name = "lp3943", 146 146 .of_match_table = of_match_ptr(lp3943_of_match),
+1 -1
drivers/mfd/lp873x.c
··· 78 78 .name = "lp873x", 79 79 .of_match_table = of_lp873x_match_table, 80 80 }, 81 - .probe_new = lp873x_probe, 81 + .probe = lp873x_probe, 82 82 .id_table = lp873x_id_table, 83 83 }; 84 84 module_i2c_driver(lp873x_driver);
+1 -1
drivers/mfd/lp87565.c
··· 119 119 .name = "lp87565", 120 120 .of_match_table = of_lp87565_match_table, 121 121 }, 122 - .probe_new = lp87565_probe, 122 + .probe = lp87565_probe, 123 123 .shutdown = lp87565_shutdown, 124 124 .id_table = lp87565_id_table, 125 125 };
+1 -1
drivers/mfd/lp8788.c
··· 225 225 .driver = { 226 226 .name = "lp8788", 227 227 }, 228 - .probe_new = lp8788_probe, 228 + .probe = lp8788_probe, 229 229 .remove = lp8788_remove, 230 230 .id_table = lp8788_ids, 231 231 };
+1 -1
drivers/mfd/madera-i2c.c
··· 139 139 .pm = &madera_pm_ops, 140 140 .of_match_table = of_match_ptr(madera_of_match), 141 141 }, 142 - .probe_new = madera_i2c_probe, 142 + .probe = madera_i2c_probe, 143 143 .remove = madera_i2c_remove, 144 144 .id_table = madera_i2c_id, 145 145 };
+1 -1
drivers/mfd/max14577.c
··· 518 518 .pm = pm_sleep_ptr(&max14577_pm), 519 519 .of_match_table = max14577_dt_match, 520 520 }, 521 - .probe_new = max14577_i2c_probe, 521 + .probe = max14577_i2c_probe, 522 522 .remove = max14577_i2c_remove, 523 523 .id_table = max14577_i2c_id, 524 524 };
+224
drivers/mfd/max77541.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + /* 3 + * Copyright (c) 2022 Analog Devices, Inc. 4 + * Driver for the MAX77540 and MAX77541 5 + */ 6 + 7 + #include <linux/i2c.h> 8 + #include <linux/interrupt.h> 9 + #include <linux/mfd/core.h> 10 + #include <linux/mfd/max77541.h> 11 + #include <linux/property.h> 12 + #include <linux/regmap.h> 13 + 14 + static const struct regmap_config max77541_regmap_config = { 15 + .reg_bits = 8, 16 + .val_bits = 8, 17 + }; 18 + 19 + static const struct regmap_irq max77541_src_irqs[] = { 20 + { .mask = MAX77541_BIT_INT_SRC_TOPSYS }, 21 + { .mask = MAX77541_BIT_INT_SRC_BUCK }, 22 + }; 23 + 24 + static const struct regmap_irq_chip max77541_src_irq_chip = { 25 + .name = "max77541-src", 26 + .status_base = MAX77541_REG_INT_SRC, 27 + .mask_base = MAX77541_REG_INT_SRC_M, 28 + .num_regs = 1, 29 + .irqs = max77541_src_irqs, 30 + .num_irqs = ARRAY_SIZE(max77541_src_irqs), 31 + }; 32 + 33 + static const struct regmap_irq max77541_topsys_irqs[] = { 34 + { .mask = MAX77541_BIT_TOPSYS_INT_TJ_120C }, 35 + { .mask = MAX77541_BIT_TOPSYS_INT_TJ_140C }, 36 + { .mask = MAX77541_BIT_TOPSYS_INT_TSHDN }, 37 + { .mask = MAX77541_BIT_TOPSYS_INT_UVLO }, 38 + { .mask = MAX77541_BIT_TOPSYS_INT_ALT_SWO }, 39 + { .mask = MAX77541_BIT_TOPSYS_INT_EXT_FREQ_DET }, 40 + }; 41 + 42 + static const struct regmap_irq_chip max77541_topsys_irq_chip = { 43 + .name = "max77541-topsys", 44 + .status_base = MAX77541_REG_TOPSYS_INT, 45 + .mask_base = MAX77541_REG_TOPSYS_INT_M, 46 + .num_regs = 1, 47 + .irqs = max77541_topsys_irqs, 48 + .num_irqs = ARRAY_SIZE(max77541_topsys_irqs), 49 + }; 50 + 51 + static const struct regmap_irq max77541_buck_irqs[] = { 52 + { .mask = MAX77541_BIT_BUCK_INT_M1_POK_FLT }, 53 + { .mask = MAX77541_BIT_BUCK_INT_M2_POK_FLT }, 54 + { .mask = MAX77541_BIT_BUCK_INT_M1_SCFLT }, 55 + { .mask = MAX77541_BIT_BUCK_INT_M2_SCFLT }, 56 + }; 57 + 58 + static const struct regmap_irq_chip max77541_buck_irq_chip = { 59 + .name = "max77541-buck", 60 + .status_base = MAX77541_REG_BUCK_INT, 61 + .mask_base = MAX77541_REG_BUCK_INT_M, 62 + .num_regs = 1, 63 + .irqs = max77541_buck_irqs, 64 + .num_irqs = ARRAY_SIZE(max77541_buck_irqs), 65 + }; 66 + 67 + static const struct regmap_irq max77541_adc_irqs[] = { 68 + { .mask = MAX77541_BIT_ADC_INT_CH1_I }, 69 + { .mask = MAX77541_BIT_ADC_INT_CH2_I }, 70 + { .mask = MAX77541_BIT_ADC_INT_CH3_I }, 71 + { .mask = MAX77541_BIT_ADC_INT_CH6_I }, 72 + }; 73 + 74 + static const struct regmap_irq_chip max77541_adc_irq_chip = { 75 + .name = "max77541-adc", 76 + .status_base = MAX77541_REG_ADC_INT, 77 + .mask_base = MAX77541_REG_ADC_INT_M, 78 + .num_regs = 1, 79 + .irqs = max77541_adc_irqs, 80 + .num_irqs = ARRAY_SIZE(max77541_adc_irqs), 81 + }; 82 + 83 + static const struct mfd_cell max77540_devs[] = { 84 + MFD_CELL_OF("max77540-regulator", NULL, NULL, 0, 0, NULL), 85 + }; 86 + 87 + static const struct mfd_cell max77541_devs[] = { 88 + MFD_CELL_OF("max77541-regulator", NULL, NULL, 0, 0, NULL), 89 + MFD_CELL_OF("max77541-adc", NULL, NULL, 0, 0, NULL), 90 + }; 91 + 92 + static int max77541_pmic_irq_init(struct device *dev) 93 + { 94 + struct max77541 *max77541 = dev_get_drvdata(dev); 95 + int irq = max77541->i2c->irq; 96 + int ret; 97 + 98 + ret = devm_regmap_add_irq_chip(dev, max77541->regmap, irq, 99 + IRQF_ONESHOT | IRQF_SHARED, 0, 100 + &max77541_src_irq_chip, 101 + &max77541->irq_data); 102 + if (ret) 103 + return ret; 104 + 105 + ret = devm_regmap_add_irq_chip(dev, max77541->regmap, irq, 106 + IRQF_ONESHOT | IRQF_SHARED, 0, 107 + &max77541_topsys_irq_chip, 108 + &max77541->irq_topsys); 109 + if (ret) 110 + return ret; 111 + 112 + ret = devm_regmap_add_irq_chip(dev, max77541->regmap, irq, 113 + IRQF_ONESHOT | IRQF_SHARED, 0, 114 + &max77541_buck_irq_chip, 115 + &max77541->irq_buck); 116 + if (ret) 117 + return ret; 118 + 119 + if (max77541->id == MAX77541) { 120 + ret = devm_regmap_add_irq_chip(dev, max77541->regmap, irq, 121 + IRQF_ONESHOT | IRQF_SHARED, 0, 122 + &max77541_adc_irq_chip, 123 + &max77541->irq_adc); 124 + if (ret) 125 + return ret; 126 + } 127 + 128 + return 0; 129 + } 130 + 131 + static int max77541_pmic_setup(struct device *dev) 132 + { 133 + struct max77541 *max77541 = dev_get_drvdata(dev); 134 + const struct mfd_cell *cells; 135 + int n_devs; 136 + int ret; 137 + 138 + switch (max77541->id) { 139 + case MAX77540: 140 + cells = max77540_devs; 141 + n_devs = ARRAY_SIZE(max77540_devs); 142 + break; 143 + case MAX77541: 144 + cells = max77541_devs; 145 + n_devs = ARRAY_SIZE(max77541_devs); 146 + break; 147 + default: 148 + return -EINVAL; 149 + } 150 + 151 + ret = max77541_pmic_irq_init(dev); 152 + if (ret) 153 + return dev_err_probe(dev, ret, "Failed to initialize IRQ\n"); 154 + 155 + ret = device_init_wakeup(dev, true); 156 + if (ret) 157 + return dev_err_probe(dev, ret, "Unable to init wakeup\n"); 158 + 159 + return devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, 160 + cells, n_devs, NULL, 0, NULL); 161 + } 162 + 163 + static int max77541_probe(struct i2c_client *client) 164 + { 165 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 166 + struct device *dev = &client->dev; 167 + struct max77541 *max77541; 168 + 169 + max77541 = devm_kzalloc(dev, sizeof(*max77541), GFP_KERNEL); 170 + if (!max77541) 171 + return -ENOMEM; 172 + 173 + i2c_set_clientdata(client, max77541); 174 + max77541->i2c = client; 175 + 176 + max77541->id = (enum max7754x_ids)device_get_match_data(dev); 177 + if (!max77541->id) 178 + max77541->id = (enum max7754x_ids)id->driver_data; 179 + 180 + if (!max77541->id) 181 + return -EINVAL; 182 + 183 + max77541->regmap = devm_regmap_init_i2c(client, 184 + &max77541_regmap_config); 185 + if (IS_ERR(max77541->regmap)) 186 + return dev_err_probe(dev, PTR_ERR(max77541->regmap), 187 + "Failed to allocate register map\n"); 188 + 189 + return max77541_pmic_setup(dev); 190 + } 191 + 192 + static const struct of_device_id max77541_of_id[] = { 193 + { 194 + .compatible = "adi,max77540", 195 + .data = (void *)MAX77540, 196 + }, 197 + { 198 + .compatible = "adi,max77541", 199 + .data = (void *)MAX77541, 200 + }, 201 + { } 202 + }; 203 + MODULE_DEVICE_TABLE(of, max77541_of_id); 204 + 205 + static const struct i2c_device_id max77541_id[] = { 206 + { "max77540", MAX77540 }, 207 + { "max77541", MAX77541 }, 208 + { } 209 + }; 210 + MODULE_DEVICE_TABLE(i2c, max77541_id); 211 + 212 + static struct i2c_driver max77541_driver = { 213 + .driver = { 214 + .name = "max77541", 215 + .of_match_table = max77541_of_id, 216 + }, 217 + .probe = max77541_probe, 218 + .id_table = max77541_id, 219 + }; 220 + module_i2c_driver(max77541_driver); 221 + 222 + MODULE_DESCRIPTION("MAX7740/MAX7741 Driver"); 223 + MODULE_AUTHOR("Okan Sahin <okan.sahin@analog.com>"); 224 + MODULE_LICENSE("GPL");
+1 -1
drivers/mfd/max77620.c
··· 698 698 .name = "max77620", 699 699 .pm = pm_sleep_ptr(&max77620_pm_ops), 700 700 }, 701 - .probe_new = max77620_probe, 701 + .probe = max77620_probe, 702 702 .id_table = max77620_id, 703 703 }; 704 704 builtin_i2c_driver(max77620_driver);
+1 -1
drivers/mfd/max77650.c
··· 222 222 .name = "max77650", 223 223 .of_match_table = max77650_of_match, 224 224 }, 225 - .probe_new = max77650_i2c_probe, 225 + .probe = max77650_i2c_probe, 226 226 }; 227 227 module_i2c_driver(max77650_i2c_driver); 228 228
+1 -1
drivers/mfd/max77686.c
··· 269 269 .pm = pm_sleep_ptr(&max77686_pm), 270 270 .of_match_table = max77686_pmic_dt_match, 271 271 }, 272 - .probe_new = max77686_i2c_probe, 272 + .probe = max77686_i2c_probe, 273 273 }; 274 274 275 275 module_i2c_driver(max77686_i2c_driver);
+1 -1
drivers/mfd/max77693.c
··· 356 356 .pm = &max77693_pm, 357 357 .of_match_table = of_match_ptr(max77693_dt_match), 358 358 }, 359 - .probe_new = max77693_i2c_probe, 359 + .probe = max77693_i2c_probe, 360 360 .remove = max77693_i2c_remove, 361 361 .id_table = max77693_i2c_id, 362 362 };
+1 -1
drivers/mfd/max77714.c
··· 143 143 .name = "max77714", 144 144 .of_match_table = max77714_dt_match, 145 145 }, 146 - .probe_new = max77714_probe, 146 + .probe = max77714_probe, 147 147 }; 148 148 module_i2c_driver(max77714_driver); 149 149
+1 -1
drivers/mfd/max77843.c
··· 207 207 .of_match_table = max77843_dt_match, 208 208 .suppress_bind_attrs = true, 209 209 }, 210 - .probe_new = max77843_probe, 210 + .probe = max77843_probe, 211 211 .id_table = max77843_id, 212 212 }; 213 213
+1 -3
drivers/mfd/max8907.c
··· 201 201 } 202 202 203 203 max8907->dev = &i2c->dev; 204 - dev_set_drvdata(max8907->dev, max8907); 205 - 206 204 max8907->i2c_gen = i2c; 207 205 i2c_set_clientdata(i2c, max8907); 208 206 max8907->regmap_gen = devm_regmap_init_i2c(i2c, ··· 311 313 .name = "max8907", 312 314 .of_match_table = of_match_ptr(max8907_of_match), 313 315 }, 314 - .probe_new = max8907_i2c_probe, 316 + .probe = max8907_i2c_probe, 315 317 .remove = max8907_i2c_remove, 316 318 .id_table = max8907_i2c_id, 317 319 };
+1 -2
drivers/mfd/max8925-i2c.c
··· 172 172 chip->i2c = client; 173 173 chip->dev = &client->dev; 174 174 i2c_set_clientdata(client, chip); 175 - dev_set_drvdata(chip->dev, chip); 176 175 mutex_init(&chip->io_lock); 177 176 178 177 chip->rtc = i2c_new_dummy_device(chip->i2c->adapter, RTC_I2C_ADDR); ··· 239 240 .pm = pm_sleep_ptr(&max8925_pm_ops), 240 241 .of_match_table = max8925_dt_ids, 241 242 }, 242 - .probe_new = max8925_probe, 243 + .probe = max8925_probe, 243 244 .remove = max8925_remove, 244 245 .id_table = max8925_id_table, 245 246 };
+1 -1
drivers/mfd/max8997.c
··· 478 478 .suppress_bind_attrs = true, 479 479 .of_match_table = of_match_ptr(max8997_pmic_dt_match), 480 480 }, 481 - .probe_new = max8997_i2c_probe, 481 + .probe = max8997_i2c_probe, 482 482 .id_table = max8997_i2c_id, 483 483 }; 484 484
+1 -1
drivers/mfd/max8998.c
··· 348 348 .suppress_bind_attrs = true, 349 349 .of_match_table = of_match_ptr(max8998_dt_match), 350 350 }, 351 - .probe_new = max8998_i2c_probe, 351 + .probe = max8998_i2c_probe, 352 352 .id_table = max8998_i2c_id, 353 353 }; 354 354
+1 -1
drivers/mfd/mc13xxx-i2c.c
··· 95 95 .name = "mc13xxx", 96 96 .of_match_table = mc13xxx_dt_ids, 97 97 }, 98 - .probe_new = mc13xxx_i2c_probe, 98 + .probe = mc13xxx_i2c_probe, 99 99 .remove = mc13xxx_i2c_remove, 100 100 }; 101 101
+1 -1
drivers/mfd/menelaus.c
··· 1240 1240 .driver = { 1241 1241 .name = DRIVER_NAME, 1242 1242 }, 1243 - .probe_new = menelaus_probe, 1243 + .probe = menelaus_probe, 1244 1244 .remove = menelaus_remove, 1245 1245 .id_table = menelaus_id, 1246 1246 };
+1 -1
drivers/mfd/menf21bmc.c
··· 111 111 static struct i2c_driver menf21bmc_driver = { 112 112 .driver.name = "menf21bmc", 113 113 .id_table = menf21bmc_id_table, 114 - .probe_new = menf21bmc_probe, 114 + .probe = menf21bmc_probe, 115 115 }; 116 116 117 117 module_i2c_driver(menf21bmc_driver);
+1 -5
drivers/mfd/mfd-core.c
··· 102 102 { 103 103 #if IS_ENABLED(CONFIG_OF) 104 104 struct mfd_of_node_entry *of_entry; 105 - const __be32 *reg; 106 105 u64 of_node_addr; 107 106 108 107 /* Skip if OF node has previously been allocated to a device */ ··· 114 115 goto allocate_of_node; 115 116 116 117 /* We only care about each node's first defined address */ 117 - reg = of_get_address(np, 0, NULL, NULL); 118 - if (!reg) 118 + if (of_property_read_reg(np, 0, &of_node_addr, NULL)) 119 119 /* OF node does not contatin a 'reg' property to match to */ 120 120 return -EAGAIN; 121 - 122 - of_node_addr = of_read_number(reg, of_n_addr_cells(np)); 123 121 124 122 if (cell->of_reg != of_node_addr) 125 123 /* No match */
+1 -1
drivers/mfd/mp2629.c
··· 70 70 .name = "mp2629", 71 71 .of_match_table = mp2629_of_match, 72 72 }, 73 - .probe_new = mp2629_probe, 73 + .probe = mp2629_probe, 74 74 }; 75 75 module_i2c_driver(mp2629_driver); 76 76
+1 -1
drivers/mfd/mt6360-core.c
··· 623 623 .pm = &mt6360_pm_ops, 624 624 .of_match_table = of_match_ptr(mt6360_of_id), 625 625 }, 626 - .probe_new = mt6360_probe, 626 + .probe = mt6360_probe, 627 627 }; 628 628 module_i2c_driver(mt6360_driver); 629 629
+1 -1
drivers/mfd/mt6370.c
··· 303 303 .name = "mt6370", 304 304 .of_match_table = mt6370_match_table, 305 305 }, 306 - .probe_new = mt6370_probe, 306 + .probe = mt6370_probe, 307 307 }; 308 308 module_i2c_driver(mt6370_driver); 309 309
+1 -1
drivers/mfd/ntxec.c
··· 260 260 .name = "ntxec", 261 261 .of_match_table = of_ntxec_match_table, 262 262 }, 263 - .probe_new = ntxec_probe, 263 + .probe = ntxec_probe, 264 264 .remove = ntxec_remove, 265 265 }; 266 266 module_i2c_driver(ntxec_driver);
+1 -1
drivers/mfd/palmas.c
··· 725 725 .name = "palmas", 726 726 .of_match_table = of_palmas_match_tbl, 727 727 }, 728 - .probe_new = palmas_i2c_probe, 728 + .probe = palmas_i2c_probe, 729 729 .remove = palmas_i2c_remove, 730 730 .id_table = palmas_i2c_id, 731 731 };
+1 -1
drivers/mfd/pcf50633-core.c
··· 282 282 .pm = pm_sleep_ptr(&pcf50633_pm), 283 283 }, 284 284 .id_table = pcf50633_id_table, 285 - .probe_new = pcf50633_probe, 285 + .probe = pcf50633_probe, 286 286 .remove = pcf50633_remove, 287 287 }; 288 288
+2 -2
drivers/mfd/qcom-pm8008.c
··· 199 199 { .compatible = "qcom,pm8008", }, 200 200 { }, 201 201 }; 202 + MODULE_DEVICE_TABLE(of, pm8008_match); 202 203 203 204 static struct i2c_driver pm8008_mfd_driver = { 204 205 .driver = { 205 206 .name = "pm8008", 206 207 .of_match_table = pm8008_match, 207 208 }, 208 - .probe_new = pm8008_probe, 209 + .probe = pm8008_probe, 209 210 }; 210 211 module_i2c_driver(pm8008_mfd_driver); 211 212 212 213 MODULE_LICENSE("GPL v2"); 213 - MODULE_ALIAS("i2c:qcom-pm8008");
+1 -1
drivers/mfd/rc5t583-irq.c
··· 8 8 * based on code 9 9 * Copyright (C) 2011 RICOH COMPANY,LTD 10 10 */ 11 + #include <linux/device.h> 11 12 #include <linux/interrupt.h> 12 13 #include <linux/irq.h> 13 - #include <linux/i2c.h> 14 14 #include <linux/mfd/rc5t583.h> 15 15 16 16 enum int_type {
+1 -1
drivers/mfd/rc5t583.c
··· 288 288 .driver = { 289 289 .name = "rc5t583", 290 290 }, 291 - .probe_new = rc5t583_i2c_probe, 291 + .probe = rc5t583_i2c_probe, 292 292 .id_table = rc5t583_i2c_id, 293 293 }; 294 294
+1 -1
drivers/mfd/retu-mfd.c
··· 318 318 .name = "retu-mfd", 319 319 .of_match_table = retu_of_match, 320 320 }, 321 - .probe_new = retu_probe, 321 + .probe = retu_probe, 322 322 .remove = retu_remove, 323 323 .id_table = retu_id, 324 324 };
+1 -1
drivers/mfd/rk8xx-i2c.c
··· 173 173 .of_match_table = rk8xx_i2c_of_match, 174 174 .pm = &rk8xx_i2c_pm_ops, 175 175 }, 176 - .probe_new = rk8xx_i2c_probe, 176 + .probe = rk8xx_i2c_probe, 177 177 .shutdown = rk8xx_i2c_shutdown, 178 178 }; 179 179 module_i2c_driver(rk8xx_i2c_driver);
+1 -1
drivers/mfd/rn5t618.c
··· 280 280 .of_match_table = of_match_ptr(rn5t618_of_match), 281 281 .pm = &rn5t618_i2c_dev_pm_ops, 282 282 }, 283 - .probe_new = rn5t618_i2c_probe, 283 + .probe = rn5t618_i2c_probe, 284 284 .remove = rn5t618_i2c_remove, 285 285 }; 286 286
+1 -1
drivers/mfd/rohm-bd71828.c
··· 564 564 .name = "rohm-bd71828", 565 565 .of_match_table = bd71828_of_match, 566 566 }, 567 - .probe_new = &bd71828_i2c_probe, 567 + .probe = bd71828_i2c_probe, 568 568 }; 569 569 module_i2c_driver(bd71828_drv); 570 570
+1 -1
drivers/mfd/rohm-bd718x7.c
··· 208 208 .name = "rohm-bd718x7", 209 209 .of_match_table = bd718xx_of_match, 210 210 }, 211 - .probe_new = bd718xx_i2c_probe, 211 + .probe = bd718xx_i2c_probe, 212 212 }; 213 213 214 214 static int __init bd718xx_i2c_init(void)
+1 -1
drivers/mfd/rohm-bd9576.c
··· 178 178 .name = "rohm-bd957x", 179 179 .of_match_table = bd957x_of_match, 180 180 }, 181 - .probe_new = &bd957x_i2c_probe, 181 + .probe = bd957x_i2c_probe, 182 182 }; 183 183 module_i2c_driver(bd957x_drv); 184 184
+1 -1
drivers/mfd/rsmu_i2c.c
··· 279 279 .name = "rsmu-i2c", 280 280 .of_match_table = of_match_ptr(rsmu_i2c_of_match), 281 281 }, 282 - .probe_new = rsmu_i2c_probe, 282 + .probe = rsmu_i2c_probe, 283 283 .remove = rsmu_i2c_remove, 284 284 .id_table = rsmu_i2c_id, 285 285 };
+1 -1
drivers/mfd/rt4831.c
··· 109 109 .name = "rt4831", 110 110 .of_match_table = rt4831_of_match, 111 111 }, 112 - .probe_new = rt4831_probe, 112 + .probe = rt4831_probe, 113 113 .remove = rt4831_remove, 114 114 }; 115 115 module_i2c_driver(rt4831_driver);
+4 -6
drivers/mfd/rt5033.c
··· 41 41 .name = "rt5033-charger", 42 42 .of_compatible = "richtek,rt5033-charger", 43 43 }, { 44 - .name = "rt5033-battery", 45 - .of_compatible = "richtek,rt5033-battery", 46 - }, { 47 44 .name = "rt5033-led", 48 45 .of_compatible = "richtek,rt5033-led", 49 46 }, ··· 55 58 static int rt5033_i2c_probe(struct i2c_client *i2c) 56 59 { 57 60 struct rt5033_dev *rt5033; 58 - unsigned int dev_id; 61 + unsigned int dev_id, chip_rev; 59 62 int ret; 60 63 61 64 rt5033 = devm_kzalloc(&i2c->dev, sizeof(*rt5033), GFP_KERNEL); ··· 78 81 dev_err(&i2c->dev, "Device not found\n"); 79 82 return -ENODEV; 80 83 } 81 - dev_info(&i2c->dev, "Device found Device ID: %04x\n", dev_id); 84 + chip_rev = dev_id & RT5033_CHIP_REV_MASK; 85 + dev_info(&i2c->dev, "Device found (rev. %d)\n", chip_rev); 82 86 83 87 ret = regmap_add_irq_chip(rt5033->regmap, rt5033->irq, 84 88 IRQF_TRIGGER_FALLING | IRQF_ONESHOT, ··· 120 122 .name = "rt5033", 121 123 .of_match_table = rt5033_dt_match, 122 124 }, 123 - .probe_new = rt5033_i2c_probe, 125 + .probe = rt5033_i2c_probe, 124 126 .id_table = rt5033_i2c_id, 125 127 }; 126 128 module_i2c_driver(rt5033_driver);
+1 -1
drivers/mfd/rt5120.c
··· 114 114 .name = "rt5120", 115 115 .of_match_table = rt5120_device_match_table, 116 116 }, 117 - .probe_new = rt5120_probe, 117 + .probe = rt5120_probe, 118 118 }; 119 119 module_i2c_driver(rt5120_driver); 120 120
+1 -1
drivers/mfd/sec-core.c
··· 450 450 .pm = pm_sleep_ptr(&sec_pmic_pm_ops), 451 451 .of_match_table = sec_dt_match, 452 452 }, 453 - .probe_new = sec_pmic_probe, 453 + .probe = sec_pmic_probe, 454 454 .shutdown = sec_pmic_shutdown, 455 455 }; 456 456 module_i2c_driver(sec_pmic_driver);
+1 -1
drivers/mfd/si476x-i2c.c
··· 866 866 .driver = { 867 867 .name = "si476x-core", 868 868 }, 869 - .probe_new = si476x_core_probe, 869 + .probe = si476x_core_probe, 870 870 .remove = si476x_core_remove, 871 871 .id_table = si476x_id, 872 872 };
+10 -10
drivers/mfd/simple-mfd-i2c.c
··· 72 72 .mfd_cell_size = ARRAY_SIZE(sy7636a_cells), 73 73 }; 74 74 75 - static const struct mfd_cell max597x_cells[] = { 76 - { .name = "max597x-regulator", }, 77 - { .name = "max597x-iio", }, 78 - { .name = "max597x-led", }, 75 + static const struct mfd_cell max5970_cells[] = { 76 + { .name = "max5970-regulator", }, 77 + { .name = "max5970-iio", }, 78 + { .name = "max5970-led", }, 79 79 }; 80 80 81 - static const struct simple_mfd_data maxim_max597x = { 82 - .mfd_cell = max597x_cells, 83 - .mfd_cell_size = ARRAY_SIZE(max597x_cells), 81 + static const struct simple_mfd_data maxim_max5970 = { 82 + .mfd_cell = max5970_cells, 83 + .mfd_cell_size = ARRAY_SIZE(max5970_cells), 84 84 }; 85 85 86 86 static const struct of_device_id simple_mfd_i2c_of_match[] = { 87 87 { .compatible = "kontron,sl28cpld" }, 88 88 { .compatible = "silergy,sy7636a", .data = &silergy_sy7636a}, 89 - { .compatible = "maxim,max5970", .data = &maxim_max597x}, 90 - { .compatible = "maxim,max5978", .data = &maxim_max597x}, 89 + { .compatible = "maxim,max5970", .data = &maxim_max5970}, 90 + { .compatible = "maxim,max5978", .data = &maxim_max5970}, 91 91 {} 92 92 }; 93 93 MODULE_DEVICE_TABLE(of, simple_mfd_i2c_of_match); 94 94 95 95 static struct i2c_driver simple_mfd_i2c_driver = { 96 - .probe_new = simple_mfd_i2c_probe, 96 + .probe = simple_mfd_i2c_probe, 97 97 .driver = { 98 98 .name = "simple-mfd-i2c", 99 99 .of_match_table = simple_mfd_i2c_of_match,
+1 -1
drivers/mfd/sky81452.c
··· 77 77 .name = "sky81452", 78 78 .of_match_table = of_match_ptr(sky81452_of_match), 79 79 }, 80 - .probe_new = sky81452_probe, 80 + .probe = sky81452_probe, 81 81 .id_table = sky81452_ids, 82 82 }; 83 83
+1 -1
drivers/mfd/smpro-core.c
··· 125 125 MODULE_DEVICE_TABLE(of, smpro_core_of_match); 126 126 127 127 static struct i2c_driver smpro_core_driver = { 128 - .probe_new = smpro_core_probe, 128 + .probe = smpro_core_probe, 129 129 .driver = { 130 130 .name = "smpro-core", 131 131 .of_match_table = smpro_core_of_match,
+4 -5
drivers/mfd/stmfx.c
··· 330 330 stmfx->vdd = devm_regulator_get_optional(&client->dev, "vdd"); 331 331 ret = PTR_ERR_OR_ZERO(stmfx->vdd); 332 332 if (ret) { 333 - if (ret == -ENODEV) 334 - stmfx->vdd = NULL; 335 - else 333 + stmfx->vdd = NULL; 334 + if (ret != -ENODEV) 336 335 return dev_err_probe(&client->dev, ret, "Failed to get VDD regulator\n"); 337 336 } 338 337 ··· 386 387 387 388 err: 388 389 if (stmfx->vdd) 389 - return regulator_disable(stmfx->vdd); 390 + regulator_disable(stmfx->vdd); 390 391 391 392 return ret; 392 393 } ··· 552 553 .of_match_table = stmfx_of_match, 553 554 .pm = pm_sleep_ptr(&stmfx_dev_pm_ops), 554 555 }, 555 - .probe_new = stmfx_probe, 556 + .probe = stmfx_probe, 556 557 .remove = stmfx_remove, 557 558 }; 558 559 module_i2c_driver(stmfx_driver);
+1 -1
drivers/mfd/stmpe-i2c.c
··· 118 118 .pm = pm_sleep_ptr(&stmpe_dev_pm_ops), 119 119 .of_match_table = stmpe_of_match, 120 120 }, 121 - .probe_new = stmpe_i2c_probe, 121 + .probe = stmpe_i2c_probe, 122 122 .remove = stmpe_i2c_remove, 123 123 .id_table = stmpe_i2c_id, 124 124 };
+2 -2
drivers/mfd/stmpe.c
··· 1485 1485 1486 1486 void stmpe_remove(struct stmpe *stmpe) 1487 1487 { 1488 - if (!IS_ERR(stmpe->vio)) 1488 + if (!IS_ERR(stmpe->vio) && regulator_is_enabled(stmpe->vio)) 1489 1489 regulator_disable(stmpe->vio); 1490 - if (!IS_ERR(stmpe->vcc)) 1490 + if (!IS_ERR(stmpe->vcc) && regulator_is_enabled(stmpe->vcc)) 1491 1491 regulator_disable(stmpe->vcc); 1492 1492 1493 1493 __stmpe_disable(stmpe, STMPE_BLOCK_ADC);
+24 -3
drivers/mfd/stpmic1.c
··· 7 7 #include <linux/mfd/core.h> 8 8 #include <linux/mfd/stpmic1.h> 9 9 #include <linux/module.h> 10 + #include <linux/reboot.h> 10 11 #include <linux/of.h> 11 12 #include <linux/of_irq.h> 12 13 #include <linux/of_platform.h> ··· 20 19 21 20 static const struct regmap_range stpmic1_readable_ranges[] = { 22 21 regmap_reg_range(TURN_ON_SR, VERSION_SR), 23 - regmap_reg_range(SWOFF_PWRCTRL_CR, LDO6_STDBY_CR), 22 + regmap_reg_range(MAIN_CR, LDO6_STDBY_CR), 24 23 regmap_reg_range(BST_SW_CR, BST_SW_CR), 25 24 regmap_reg_range(INT_PENDING_R1, INT_PENDING_R4), 26 25 regmap_reg_range(INT_CLEAR_R1, INT_CLEAR_R4), ··· 31 30 }; 32 31 33 32 static const struct regmap_range stpmic1_writeable_ranges[] = { 34 - regmap_reg_range(SWOFF_PWRCTRL_CR, LDO6_STDBY_CR), 33 + regmap_reg_range(MAIN_CR, LDO6_STDBY_CR), 35 34 regmap_reg_range(BST_SW_CR, BST_SW_CR), 36 35 regmap_reg_range(INT_CLEAR_R1, INT_CLEAR_R4), 37 36 regmap_reg_range(INT_SET_MASK_R1, INT_SET_MASK_R4), ··· 118 117 .num_irqs = ARRAY_SIZE(stpmic1_irqs), 119 118 }; 120 119 120 + static int stpmic1_power_off(struct sys_off_data *data) 121 + { 122 + struct stpmic1 *ddata = data->cb_data; 123 + 124 + regmap_update_bits(ddata->regmap, MAIN_CR, 125 + SOFTWARE_SWITCH_OFF, SOFTWARE_SWITCH_OFF); 126 + 127 + return NOTIFY_DONE; 128 + } 129 + 121 130 static int stpmic1_probe(struct i2c_client *i2c) 122 131 { 123 132 struct stpmic1 *ddata; ··· 167 156 &ddata->irq_data); 168 157 if (ret) { 169 158 dev_err(dev, "IRQ Chip registration failed: %d\n", ret); 159 + return ret; 160 + } 161 + 162 + ret = devm_register_sys_off_handler(ddata->dev, 163 + SYS_OFF_MODE_POWER_OFF, 164 + SYS_OFF_PRIO_DEFAULT, 165 + stpmic1_power_off, 166 + ddata); 167 + if (ret) { 168 + dev_err(ddata->dev, "failed to register sys-off handler: %d\n", ret); 170 169 return ret; 171 170 } 172 171 ··· 222 201 .of_match_table = of_match_ptr(stpmic1_of_match), 223 202 .pm = pm_sleep_ptr(&stpmic1_pm), 224 203 }, 225 - .probe_new = stpmic1_probe, 204 + .probe = stpmic1_probe, 226 205 }; 227 206 228 207 module_i2c_driver(stpmic1_driver);
+1 -1
drivers/mfd/stw481x.c
··· 239 239 .name = "stw481x", 240 240 .of_match_table = stw481x_match, 241 241 }, 242 - .probe_new = stw481x_probe, 242 + .probe = stw481x_probe, 243 243 .id_table = stw481x_id, 244 244 }; 245 245
+1 -1
drivers/mfd/tc3589x.c
··· 485 485 .pm = pm_sleep_ptr(&tc3589x_dev_pm_ops), 486 486 .of_match_table = of_match_ptr(tc3589x_match), 487 487 }, 488 - .probe_new = tc3589x_probe, 488 + .probe = tc3589x_probe, 489 489 .remove = tc3589x_remove, 490 490 .id_table = tc3589x_id, 491 491 };
+1 -1
drivers/mfd/ti-lmu.c
··· 217 217 MODULE_DEVICE_TABLE(i2c, ti_lmu_ids); 218 218 219 219 static struct i2c_driver ti_lmu_driver = { 220 - .probe_new = ti_lmu_probe, 220 + .probe = ti_lmu_probe, 221 221 .driver = { 222 222 .name = "ti-lmu", 223 223 .of_match_table = ti_lmu_of_match,
+1 -1
drivers/mfd/tps6105x.c
··· 209 209 .name = "tps6105x", 210 210 .of_match_table = tps6105x_of_match, 211 211 }, 212 - .probe_new = tps6105x_probe, 212 + .probe = tps6105x_probe, 213 213 .remove = tps6105x_remove, 214 214 .id_table = tps6105x_id, 215 215 };
+1 -1
drivers/mfd/tps65010.c
··· 664 664 .driver = { 665 665 .name = "tps65010", 666 666 }, 667 - .probe_new = tps65010_probe, 667 + .probe = tps65010_probe, 668 668 .remove = tps65010_remove, 669 669 .id_table = tps65010_id, 670 670 };
+1 -1
drivers/mfd/tps6507x.c
··· 122 122 .name = "tps6507x", 123 123 .of_match_table = of_match_ptr(tps6507x_of_match), 124 124 }, 125 - .probe_new = tps6507x_i2c_probe, 125 + .probe = tps6507x_i2c_probe, 126 126 .id_table = tps6507x_i2c_id, 127 127 }; 128 128
+1 -1
drivers/mfd/tps65086.c
··· 129 129 .name = "tps65086", 130 130 .of_match_table = tps65086_of_match_table, 131 131 }, 132 - .probe_new = tps65086_probe, 132 + .probe = tps65086_probe, 133 133 .remove = tps65086_remove, 134 134 .id_table = tps65086_id_table, 135 135 };
+1 -1
drivers/mfd/tps65090.c
··· 236 236 .suppress_bind_attrs = true, 237 237 .of_match_table = of_match_ptr(tps65090_of_match), 238 238 }, 239 - .probe_new = tps65090_i2c_probe, 239 + .probe = tps65090_i2c_probe, 240 240 .id_table = tps65090_id_table, 241 241 }; 242 242
+1 -1
drivers/mfd/tps65217.c
··· 402 402 .of_match_table = tps65217_of_match, 403 403 }, 404 404 .id_table = tps65217_id_table, 405 - .probe_new = tps65217_probe, 405 + .probe = tps65217_probe, 406 406 .remove = tps65217_remove, 407 407 }; 408 408
+1 -1
drivers/mfd/tps65218.c
··· 347 347 .name = "tps65218", 348 348 .of_match_table = of_tps65218_match_table, 349 349 }, 350 - .probe_new = tps65218_probe, 350 + .probe = tps65218_probe, 351 351 .id_table = tps65218_id_table, 352 352 }; 353 353
+30 -12
drivers/mfd/tps65219.c
··· 25 25 TPS65219_MFP_COLD_RESET_I2C_CTRL_MASK); 26 26 } 27 27 28 - static int tps65219_restart(struct notifier_block *this, 29 - unsigned long reboot_mode, void *cmd) 28 + static int tps65219_soft_shutdown(struct tps65219 *tps) 30 29 { 31 - struct tps65219 *tps; 30 + return regmap_update_bits(tps->regmap, TPS65219_REG_MFP_CTRL, 31 + TPS65219_MFP_I2C_OFF_REQ_MASK, 32 + TPS65219_MFP_I2C_OFF_REQ_MASK); 33 + } 32 34 33 - tps = container_of(this, struct tps65219, nb); 35 + static int tps65219_power_off_handler(struct sys_off_data *data) 36 + { 37 + tps65219_soft_shutdown(data->cb_data); 38 + return NOTIFY_DONE; 39 + } 34 40 41 + static int tps65219_restart(struct tps65219 *tps, unsigned long reboot_mode) 42 + { 35 43 if (reboot_mode == REBOOT_WARM) 36 44 tps65219_warm_reset(tps); 37 45 else ··· 48 40 return NOTIFY_DONE; 49 41 } 50 42 51 - static struct notifier_block pmic_rst_restart_nb = { 52 - .notifier_call = tps65219_restart, 53 - .priority = 200, 54 - }; 43 + static int tps65219_restart_handler(struct sys_off_data *data) 44 + { 45 + tps65219_restart(data->cb_data, data->mode); 46 + return NOTIFY_DONE; 47 + } 55 48 56 49 static const struct resource tps65219_pwrbutton_resources[] = { 57 50 DEFINE_RES_IRQ_NAMED(TPS65219_INT_PB_FALLING_EDGE_DETECT, "falling"), ··· 115 106 .resources = tps65219_regulator_resources, 116 107 .num_resources = ARRAY_SIZE(tps65219_regulator_resources), 117 108 }, 118 - { .name = "tps65219-gpios", }, 109 + { .name = "tps65219-gpio", }, 119 110 }; 120 111 121 112 static const struct mfd_cell tps65219_pwrbutton_cell = { ··· 278 269 } 279 270 } 280 271 281 - tps->nb = pmic_rst_restart_nb; 282 - ret = register_restart_handler(&tps->nb); 272 + ret = devm_register_restart_handler(tps->dev, 273 + tps65219_restart_handler, 274 + tps); 275 + 283 276 if (ret) { 284 277 dev_err(tps->dev, "cannot register restart handler, %d\n", ret); 285 278 return ret; 286 279 } 287 280 281 + ret = devm_register_power_off_handler(tps->dev, 282 + tps65219_power_off_handler, 283 + tps); 284 + if (ret) { 285 + dev_err(tps->dev, "failed to register power-off handler: %d\n", ret); 286 + return ret; 287 + } 288 288 return 0; 289 289 } 290 290 ··· 308 290 .name = "tps65219", 309 291 .of_match_table = of_tps65219_match_table, 310 292 }, 311 - .probe_new = tps65219_probe, 293 + .probe = tps65219_probe, 312 294 }; 313 295 module_i2c_driver(tps65219_driver); 314 296
+1 -1
drivers/mfd/tps6586x.c
··· 619 619 .of_match_table = of_match_ptr(tps6586x_of_match), 620 620 .pm = &tps6586x_pm_ops, 621 621 }, 622 - .probe_new = tps6586x_i2c_probe, 622 + .probe = tps6586x_i2c_probe, 623 623 .remove = tps6586x_i2c_remove, 624 624 .id_table = tps6586x_id_table, 625 625 };
+1 -1
drivers/mfd/tps65910.c
··· 535 535 .name = "tps65910", 536 536 .of_match_table = of_match_ptr(tps65910_of_match), 537 537 }, 538 - .probe_new = tps65910_i2c_probe, 538 + .probe = tps65910_i2c_probe, 539 539 .id_table = tps65910_i2c_id, 540 540 }; 541 541
+1 -1
drivers/mfd/tps65912-i2c.c
··· 60 60 .name = "tps65912", 61 61 .of_match_table = tps65912_i2c_of_match_table, 62 62 }, 63 - .probe_new = tps65912_i2c_probe, 63 + .probe = tps65912_i2c_probe, 64 64 .remove = tps65912_i2c_remove, 65 65 .id_table = tps65912_i2c_id_table, 66 66 };
+2 -2
drivers/mfd/tps6594-i2c.c
··· 222 222 223 223 match = of_match_device(tps6594_i2c_of_match_table, dev); 224 224 if (!match) 225 - return dev_err_probe(dev, PTR_ERR(match), "Failed to find matching chip ID\n"); 225 + return dev_err_probe(dev, -EINVAL, "Failed to find matching chip ID\n"); 226 226 tps->chip_id = (unsigned long)match->data; 227 227 228 228 crc8_populate_msb(tps6594_i2c_crc_table, TPS6594_CRC8_POLYNOMIAL); ··· 235 235 .name = "tps6594", 236 236 .of_match_table = tps6594_i2c_of_match_table, 237 237 }, 238 - .probe_new = tps6594_i2c_probe, 238 + .probe = tps6594_i2c_probe, 239 239 }; 240 240 module_i2c_driver(tps6594_i2c_driver); 241 241
+1 -1
drivers/mfd/tps6594-spi.c
··· 107 107 108 108 match = of_match_device(tps6594_spi_of_match_table, dev); 109 109 if (!match) 110 - return dev_err_probe(dev, PTR_ERR(match), "Failed to find matching chip ID\n"); 110 + return dev_err_probe(dev, -EINVAL, "Failed to find matching chip ID\n"); 111 111 tps->chip_id = (unsigned long)match->data; 112 112 113 113 crc8_populate_msb(tps6594_spi_crc_table, TPS6594_CRC8_POLYNOMIAL);
+1 -1
drivers/mfd/twl-core.c
··· 890 890 .driver.name = DRIVER_NAME, 891 891 .driver.pm = &twl_dev_pm_ops, 892 892 .id_table = twl_ids, 893 - .probe_new = twl_probe, 893 + .probe = twl_probe, 894 894 .remove = twl_remove, 895 895 }; 896 896 builtin_i2c_driver(twl_driver);
+2 -2
drivers/mfd/twl6040.c
··· 608 608 .volatile_reg = twl6040_volatile_reg, 609 609 .writeable_reg = twl6040_writeable_reg, 610 610 611 - .cache_type = REGCACHE_RBTREE, 611 + .cache_type = REGCACHE_MAPLE, 612 612 .use_single_read = true, 613 613 .use_single_write = true, 614 614 }; ··· 829 829 .driver = { 830 830 .name = "twl6040", 831 831 }, 832 - .probe_new = twl6040_probe, 832 + .probe = twl6040_probe, 833 833 .remove = twl6040_remove, 834 834 .id_table = twl6040_i2c_id, 835 835 };
+14 -14
drivers/mfd/wcd934x.c
··· 227 227 "Failed to get IRQ\n"); 228 228 229 229 ddata->extclk = devm_clk_get(dev, "extclk"); 230 - if (IS_ERR(ddata->extclk)) { 231 - dev_err(dev, "Failed to get extclk"); 232 - return PTR_ERR(ddata->extclk); 233 - } 230 + if (IS_ERR(ddata->extclk)) 231 + return dev_err_probe(dev, PTR_ERR(ddata->extclk), 232 + "Failed to get extclk"); 234 233 235 234 ddata->supplies[0].supply = "vdd-buck"; 236 235 ddata->supplies[1].supply = "vdd-buck-sido"; ··· 238 239 ddata->supplies[4].supply = "vdd-io"; 239 240 240 241 ret = regulator_bulk_get(dev, WCD934X_MAX_SUPPLY, ddata->supplies); 241 - if (ret) { 242 - dev_err(dev, "Failed to get supplies: err = %d\n", ret); 243 - return ret; 244 - } 242 + if (ret) 243 + return dev_err_probe(dev, ret, "Failed to get supplies\n"); 245 244 246 245 ret = regulator_bulk_enable(WCD934X_MAX_SUPPLY, ddata->supplies); 247 - if (ret) { 248 - dev_err(dev, "Failed to enable supplies: err = %d\n", ret); 249 - return ret; 250 - } 246 + if (ret) 247 + return dev_err_probe(dev, ret, "Failed to enable supplies\n"); 251 248 252 249 /* 253 250 * For WCD934X, it takes about 600us for the Vout_A and ··· 253 258 usleep_range(600, 650); 254 259 reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); 255 260 if (IS_ERR(reset_gpio)) { 256 - return dev_err_probe(dev, PTR_ERR(reset_gpio), 257 - "Failed to get reset gpio: err = %ld\n", PTR_ERR(reset_gpio)); 261 + ret = dev_err_probe(dev, PTR_ERR(reset_gpio), 262 + "Failed to get reset gpio\n"); 263 + goto err_disable_regulators; 258 264 } 259 265 msleep(20); 260 266 gpiod_set_value(reset_gpio, 1); ··· 265 269 dev_set_drvdata(dev, ddata); 266 270 267 271 return 0; 272 + 273 + err_disable_regulators: 274 + regulator_bulk_disable(WCD934X_MAX_SUPPLY, ddata->supplies); 275 + return ret; 268 276 } 269 277 270 278 static void wcd934x_slim_remove(struct slim_device *sdev)
+1 -1
drivers/mfd/wl1273-core.c
··· 232 232 .driver = { 233 233 .name = WL1273_FM_DRIVER_NAME, 234 234 }, 235 - .probe_new = wl1273_core_probe, 235 + .probe = wl1273_core_probe, 236 236 .id_table = wl1273_driver_id_table, 237 237 }; 238 238
+1 -1
drivers/mfd/wm831x-core.c
··· 1430 1430 .reg_bits = 16, 1431 1431 .val_bits = 16, 1432 1432 1433 - .cache_type = REGCACHE_RBTREE, 1433 + .cache_type = REGCACHE_MAPLE, 1434 1434 1435 1435 .max_register = WM831X_DBE_CHECK_DATA, 1436 1436 .readable_reg = wm831x_reg_readable,
+1 -1
drivers/mfd/wm831x-i2c.c
··· 102 102 .of_match_table = of_match_ptr(wm831x_of_match), 103 103 .suppress_bind_attrs = true, 104 104 }, 105 - .probe_new = wm831x_i2c_probe, 105 + .probe = wm831x_i2c_probe, 106 106 .id_table = wm831x_i2c_id, 107 107 }; 108 108
+1 -1
drivers/mfd/wm8350-i2c.c
··· 52 52 .name = "wm8350", 53 53 .suppress_bind_attrs = true, 54 54 }, 55 - .probe_new = wm8350_i2c_probe, 55 + .probe = wm8350_i2c_probe, 56 56 .id_table = wm8350_i2c_id, 57 57 }; 58 58
+1 -3
drivers/mfd/wm8400-core.c
··· 54 54 unsigned int reg; 55 55 int ret; 56 56 57 - dev_set_drvdata(wm8400->dev, wm8400); 58 - 59 57 /* Check that this is actually a WM8400 */ 60 58 ret = regmap_read(wm8400->regmap, WM8400_RESET_ID, &reg); 61 59 if (ret != 0) { ··· 143 145 .driver = { 144 146 .name = "WM8400", 145 147 }, 146 - .probe_new = wm8400_i2c_probe, 148 + .probe = wm8400_i2c_probe, 147 149 .id_table = wm8400_i2c_id, 148 150 }; 149 151 #endif
+1 -3
drivers/mfd/wm8994-core.c
··· 320 320 if (ret != 0) 321 321 return ret; 322 322 323 - dev_set_drvdata(wm8994->dev, wm8994); 324 - 325 323 /* Add the on-chip regulators first for bootstrapping */ 326 324 ret = mfd_add_devices(wm8994->dev, 0, 327 325 wm8994_regulator_devs, ··· 670 672 .pm = pm_ptr(&wm8994_pm_ops), 671 673 .of_match_table = wm8994_of_match, 672 674 }, 673 - .probe_new = wm8994_i2c_probe, 675 + .probe = wm8994_i2c_probe, 674 676 .remove = wm8994_i2c_remove, 675 677 .id_table = wm8994_i2c_id, 676 678 };
+8
drivers/power/supply/Kconfig
··· 766 766 The fuelgauge calculates and determines the battery state of charge 767 767 according to battery open circuit voltage. 768 768 769 + config CHARGER_RT5033 770 + tristate "RT5033 battery charger support" 771 + depends on MFD_RT5033 772 + help 773 + This adds support for battery charger in Richtek RT5033 PMIC. 774 + The device supports pre-charge mode, fast charge mode and 775 + constant voltage mode. 776 + 769 777 config CHARGER_RT9455 770 778 tristate "Richtek RT9455 battery charger driver" 771 779 depends on I2C
+1
drivers/power/supply/Makefile
··· 54 54 obj-$(CONFIG_BATTERY_MAX17042) += max17042_battery.o 55 55 obj-$(CONFIG_BATTERY_MAX1721X) += max1721x_battery.o 56 56 obj-$(CONFIG_BATTERY_RT5033) += rt5033_battery.o 57 + obj-$(CONFIG_CHARGER_RT5033) += rt5033_charger.o 57 58 obj-$(CONFIG_CHARGER_RT9455) += rt9455_charger.o 58 59 obj-$(CONFIG_CHARGER_RT9467) += rt9467-charger.o 59 60 obj-$(CONFIG_CHARGER_RT9471) += rt9471.o
+31 -7
drivers/power/supply/rt5033_battery.c
··· 6 6 * Author: Beomho Seo <beomho.seo@samsung.com> 7 7 */ 8 8 9 + #include <linux/i2c.h> 9 10 #include <linux/module.h> 10 11 #include <linux/platform_device.h> 11 12 #include <linux/power_supply.h> 13 + #include <linux/regmap.h> 12 14 #include <linux/mfd/rt5033-private.h> 13 - #include <linux/mfd/rt5033.h> 15 + 16 + struct rt5033_battery { 17 + struct i2c_client *client; 18 + struct regmap *regmap; 19 + struct power_supply *psy; 20 + }; 21 + 22 + static int rt5033_battery_get_status(struct i2c_client *client) 23 + { 24 + struct rt5033_battery *battery = i2c_get_clientdata(client); 25 + union power_supply_propval val; 26 + int ret; 27 + 28 + ret = power_supply_get_property_from_supplier(battery->psy, 29 + POWER_SUPPLY_PROP_STATUS, 30 + &val); 31 + if (ret) 32 + val.intval = POWER_SUPPLY_STATUS_UNKNOWN; 33 + 34 + return val.intval; 35 + } 14 36 15 37 static int rt5033_battery_get_capacity(struct i2c_client *client) 16 38 { ··· 106 84 case POWER_SUPPLY_PROP_CAPACITY: 107 85 val->intval = rt5033_battery_get_capacity(battery->client); 108 86 break; 87 + case POWER_SUPPLY_PROP_STATUS: 88 + val->intval = rt5033_battery_get_status(battery->client); 89 + break; 109 90 default: 110 91 return -EINVAL; 111 92 } ··· 121 96 POWER_SUPPLY_PROP_VOLTAGE_OCV, 122 97 POWER_SUPPLY_PROP_PRESENT, 123 98 POWER_SUPPLY_PROP_CAPACITY, 99 + POWER_SUPPLY_PROP_STATUS, 124 100 }; 125 101 126 102 static const struct regmap_config rt5033_battery_regmap_config = { ··· 143 117 struct i2c_adapter *adapter = client->adapter; 144 118 struct power_supply_config psy_cfg = {}; 145 119 struct rt5033_battery *battery; 146 - u32 ret; 147 120 148 121 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE)) 149 122 return -EIO; ··· 160 135 } 161 136 162 137 i2c_set_clientdata(client, battery); 138 + psy_cfg.of_node = client->dev.of_node; 163 139 psy_cfg.drv_data = battery; 164 140 165 141 battery->psy = power_supply_register(&client->dev, 166 142 &rt5033_battery_desc, &psy_cfg); 167 - if (IS_ERR(battery->psy)) { 168 - dev_err(&client->dev, "Failed to register power supply\n"); 169 - ret = PTR_ERR(battery->psy); 170 - return ret; 171 - } 143 + if (IS_ERR(battery->psy)) 144 + return dev_err_probe(&client->dev, PTR_ERR(battery->psy), 145 + "Failed to register power supply\n"); 172 146 173 147 return 0; 174 148 }
+472
drivers/power/supply/rt5033_charger.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Battery charger driver for RT5033 4 + * 5 + * Copyright (C) 2014 Samsung Electronics, Co., Ltd. 6 + * Author: Beomho Seo <beomho.seo@samsung.com> 7 + */ 8 + 9 + #include <linux/module.h> 10 + #include <linux/of_device.h> 11 + #include <linux/platform_device.h> 12 + #include <linux/power_supply.h> 13 + #include <linux/regmap.h> 14 + #include <linux/mfd/rt5033-private.h> 15 + 16 + struct rt5033_charger_data { 17 + unsigned int pre_uamp; 18 + unsigned int pre_uvolt; 19 + unsigned int const_uvolt; 20 + unsigned int eoc_uamp; 21 + unsigned int fast_uamp; 22 + }; 23 + 24 + struct rt5033_charger { 25 + struct device *dev; 26 + struct regmap *regmap; 27 + struct power_supply *psy; 28 + struct rt5033_charger_data *chg; 29 + }; 30 + 31 + static int rt5033_get_charger_state(struct rt5033_charger *charger) 32 + { 33 + struct regmap *regmap = charger->regmap; 34 + unsigned int reg_data; 35 + int state; 36 + 37 + if (!regmap) 38 + return POWER_SUPPLY_STATUS_UNKNOWN; 39 + 40 + regmap_read(regmap, RT5033_REG_CHG_STAT, &reg_data); 41 + 42 + switch (reg_data & RT5033_CHG_STAT_MASK) { 43 + case RT5033_CHG_STAT_DISCHARGING: 44 + state = POWER_SUPPLY_STATUS_DISCHARGING; 45 + break; 46 + case RT5033_CHG_STAT_CHARGING: 47 + state = POWER_SUPPLY_STATUS_CHARGING; 48 + break; 49 + case RT5033_CHG_STAT_FULL: 50 + state = POWER_SUPPLY_STATUS_FULL; 51 + break; 52 + case RT5033_CHG_STAT_NOT_CHARGING: 53 + state = POWER_SUPPLY_STATUS_NOT_CHARGING; 54 + break; 55 + default: 56 + state = POWER_SUPPLY_STATUS_UNKNOWN; 57 + } 58 + 59 + return state; 60 + } 61 + 62 + static int rt5033_get_charger_type(struct rt5033_charger *charger) 63 + { 64 + struct regmap *regmap = charger->regmap; 65 + unsigned int reg_data; 66 + int state; 67 + 68 + regmap_read(regmap, RT5033_REG_CHG_STAT, &reg_data); 69 + 70 + switch (reg_data & RT5033_CHG_STAT_TYPE_MASK) { 71 + case RT5033_CHG_STAT_TYPE_FAST: 72 + state = POWER_SUPPLY_CHARGE_TYPE_FAST; 73 + break; 74 + case RT5033_CHG_STAT_TYPE_PRE: 75 + state = POWER_SUPPLY_CHARGE_TYPE_TRICKLE; 76 + break; 77 + default: 78 + state = POWER_SUPPLY_CHARGE_TYPE_NONE; 79 + } 80 + 81 + return state; 82 + } 83 + 84 + static int rt5033_get_charger_current_limit(struct rt5033_charger *charger) 85 + { 86 + struct regmap *regmap = charger->regmap; 87 + unsigned int state, reg_data, data; 88 + 89 + regmap_read(regmap, RT5033_REG_CHG_CTRL5, &reg_data); 90 + 91 + state = (reg_data & RT5033_CHGCTRL5_ICHG_MASK) 92 + >> RT5033_CHGCTRL5_ICHG_SHIFT; 93 + 94 + data = RT5033_CHARGER_FAST_CURRENT_MIN + 95 + RT5033_CHARGER_FAST_CURRENT_STEP_NUM * state; 96 + 97 + return data; 98 + } 99 + 100 + static int rt5033_get_charger_const_voltage(struct rt5033_charger *charger) 101 + { 102 + struct regmap *regmap = charger->regmap; 103 + unsigned int state, reg_data, data; 104 + 105 + regmap_read(regmap, RT5033_REG_CHG_CTRL2, &reg_data); 106 + 107 + state = (reg_data & RT5033_CHGCTRL2_CV_MASK) 108 + >> RT5033_CHGCTRL2_CV_SHIFT; 109 + 110 + data = RT5033_CHARGER_CONST_VOLTAGE_LIMIT_MIN + 111 + RT5033_CHARGER_CONST_VOLTAGE_STEP_NUM * state; 112 + 113 + return data; 114 + } 115 + 116 + static inline int rt5033_init_const_charge(struct rt5033_charger *charger) 117 + { 118 + struct rt5033_charger_data *chg = charger->chg; 119 + int ret; 120 + unsigned int val; 121 + u8 reg_data; 122 + 123 + /* Set constant voltage mode */ 124 + if (chg->const_uvolt < RT5033_CHARGER_CONST_VOLTAGE_LIMIT_MIN || 125 + chg->const_uvolt > RT5033_CHARGER_CONST_VOLTAGE_LIMIT_MAX) { 126 + dev_err(charger->dev, 127 + "Value 'constant-charge-voltage-max-microvolt' out of range\n"); 128 + return -EINVAL; 129 + } 130 + 131 + if (chg->const_uvolt == RT5033_CHARGER_CONST_VOLTAGE_LIMIT_MIN) 132 + reg_data = 0x00; 133 + else if (chg->const_uvolt == RT5033_CHARGER_CONST_VOLTAGE_LIMIT_MAX) 134 + reg_data = RT5033_CV_MAX_VOLTAGE; 135 + else { 136 + val = chg->const_uvolt; 137 + val -= RT5033_CHARGER_CONST_VOLTAGE_LIMIT_MIN; 138 + val /= RT5033_CHARGER_CONST_VOLTAGE_STEP_NUM; 139 + reg_data = val; 140 + } 141 + 142 + ret = regmap_update_bits(charger->regmap, RT5033_REG_CHG_CTRL2, 143 + RT5033_CHGCTRL2_CV_MASK, 144 + reg_data << RT5033_CHGCTRL2_CV_SHIFT); 145 + if (ret) { 146 + dev_err(charger->dev, "Failed regmap update\n"); 147 + return -EINVAL; 148 + } 149 + 150 + /* Set end of charge current */ 151 + if (chg->eoc_uamp < RT5033_CHARGER_EOC_MIN || 152 + chg->eoc_uamp > RT5033_CHARGER_EOC_MAX) { 153 + dev_err(charger->dev, 154 + "Value 'charge-term-current-microamp' out of range\n"); 155 + return -EINVAL; 156 + } 157 + 158 + if (chg->eoc_uamp == RT5033_CHARGER_EOC_MIN) 159 + reg_data = 0x01; 160 + else if (chg->eoc_uamp == RT5033_CHARGER_EOC_MAX) 161 + reg_data = 0x07; 162 + else { 163 + val = chg->eoc_uamp; 164 + if (val < RT5033_CHARGER_EOC_REF) { 165 + val -= RT5033_CHARGER_EOC_MIN; 166 + val /= RT5033_CHARGER_EOC_STEP_NUM1; 167 + reg_data = 0x01 + val; 168 + } else if (val > RT5033_CHARGER_EOC_REF) { 169 + val -= RT5033_CHARGER_EOC_REF; 170 + val /= RT5033_CHARGER_EOC_STEP_NUM2; 171 + reg_data = 0x04 + val; 172 + } else { 173 + reg_data = 0x04; 174 + } 175 + } 176 + 177 + ret = regmap_update_bits(charger->regmap, RT5033_REG_CHG_CTRL4, 178 + RT5033_CHGCTRL4_EOC_MASK, reg_data); 179 + if (ret) { 180 + dev_err(charger->dev, "Failed regmap update\n"); 181 + return -EINVAL; 182 + } 183 + 184 + return 0; 185 + } 186 + 187 + static inline int rt5033_init_fast_charge(struct rt5033_charger *charger) 188 + { 189 + struct rt5033_charger_data *chg = charger->chg; 190 + int ret; 191 + unsigned int val; 192 + u8 reg_data; 193 + 194 + /* Set limit input current */ 195 + ret = regmap_update_bits(charger->regmap, RT5033_REG_CHG_CTRL1, 196 + RT5033_CHGCTRL1_IAICR_MASK, RT5033_AICR_2000_MODE); 197 + if (ret) { 198 + dev_err(charger->dev, "Failed regmap update\n"); 199 + return -EINVAL; 200 + } 201 + 202 + /* Set fast-charge mode charging current */ 203 + if (chg->fast_uamp < RT5033_CHARGER_FAST_CURRENT_MIN || 204 + chg->fast_uamp > RT5033_CHARGER_FAST_CURRENT_MAX) { 205 + dev_err(charger->dev, 206 + "Value 'constant-charge-current-max-microamp' out of range\n"); 207 + return -EINVAL; 208 + } 209 + 210 + if (chg->fast_uamp == RT5033_CHARGER_FAST_CURRENT_MIN) 211 + reg_data = 0x00; 212 + else if (chg->fast_uamp == RT5033_CHARGER_FAST_CURRENT_MAX) 213 + reg_data = RT5033_CHG_MAX_CURRENT; 214 + else { 215 + val = chg->fast_uamp; 216 + val -= RT5033_CHARGER_FAST_CURRENT_MIN; 217 + val /= RT5033_CHARGER_FAST_CURRENT_STEP_NUM; 218 + reg_data = val; 219 + } 220 + 221 + ret = regmap_update_bits(charger->regmap, RT5033_REG_CHG_CTRL5, 222 + RT5033_CHGCTRL5_ICHG_MASK, 223 + reg_data << RT5033_CHGCTRL5_ICHG_SHIFT); 224 + if (ret) { 225 + dev_err(charger->dev, "Failed regmap update\n"); 226 + return -EINVAL; 227 + } 228 + 229 + return 0; 230 + } 231 + 232 + static inline int rt5033_init_pre_charge(struct rt5033_charger *charger) 233 + { 234 + struct rt5033_charger_data *chg = charger->chg; 235 + int ret; 236 + unsigned int val; 237 + u8 reg_data; 238 + 239 + /* Set pre-charge threshold voltage */ 240 + if (chg->pre_uvolt < RT5033_CHARGER_PRE_THRESHOLD_LIMIT_MIN || 241 + chg->pre_uvolt > RT5033_CHARGER_PRE_THRESHOLD_LIMIT_MAX) { 242 + dev_err(charger->dev, 243 + "Value 'precharge-upper-limit-microvolt' out of range\n"); 244 + return -EINVAL; 245 + } 246 + 247 + if (chg->pre_uvolt == RT5033_CHARGER_PRE_THRESHOLD_LIMIT_MIN) 248 + reg_data = 0x00; 249 + else if (chg->pre_uvolt == RT5033_CHARGER_PRE_THRESHOLD_LIMIT_MAX) 250 + reg_data = 0x0f; 251 + else { 252 + val = chg->pre_uvolt; 253 + val -= RT5033_CHARGER_PRE_THRESHOLD_LIMIT_MIN; 254 + val /= RT5033_CHARGER_PRE_THRESHOLD_STEP_NUM; 255 + reg_data = val; 256 + } 257 + 258 + ret = regmap_update_bits(charger->regmap, RT5033_REG_CHG_CTRL5, 259 + RT5033_CHGCTRL5_VPREC_MASK, reg_data); 260 + if (ret) { 261 + dev_err(charger->dev, "Failed regmap update\n"); 262 + return -EINVAL; 263 + } 264 + 265 + /* Set pre-charge mode charging current */ 266 + if (chg->pre_uamp < RT5033_CHARGER_PRE_CURRENT_LIMIT_MIN || 267 + chg->pre_uamp > RT5033_CHARGER_PRE_CURRENT_LIMIT_MAX) { 268 + dev_err(charger->dev, 269 + "Value 'precharge-current-microamp' out of range\n"); 270 + return -EINVAL; 271 + } 272 + 273 + if (chg->pre_uamp == RT5033_CHARGER_PRE_CURRENT_LIMIT_MIN) 274 + reg_data = 0x00; 275 + else if (chg->pre_uamp == RT5033_CHARGER_PRE_CURRENT_LIMIT_MAX) 276 + reg_data = RT5033_CHG_MAX_PRE_CURRENT; 277 + else { 278 + val = chg->pre_uamp; 279 + val -= RT5033_CHARGER_PRE_CURRENT_LIMIT_MIN; 280 + val /= RT5033_CHARGER_PRE_CURRENT_STEP_NUM; 281 + reg_data = val; 282 + } 283 + 284 + ret = regmap_update_bits(charger->regmap, RT5033_REG_CHG_CTRL4, 285 + RT5033_CHGCTRL4_IPREC_MASK, 286 + reg_data << RT5033_CHGCTRL4_IPREC_SHIFT); 287 + if (ret) { 288 + dev_err(charger->dev, "Failed regmap update\n"); 289 + return -EINVAL; 290 + } 291 + 292 + return 0; 293 + } 294 + 295 + static int rt5033_charger_reg_init(struct rt5033_charger *charger) 296 + { 297 + int ret = 0; 298 + 299 + /* Enable charging termination */ 300 + ret = regmap_update_bits(charger->regmap, RT5033_REG_CHG_CTRL1, 301 + RT5033_CHGCTRL1_TE_EN_MASK, RT5033_TE_ENABLE); 302 + if (ret) { 303 + dev_err(charger->dev, "Failed to enable charging termination.\n"); 304 + return -EINVAL; 305 + } 306 + 307 + /* 308 + * Disable minimum input voltage regulation (MIVR), this improves 309 + * the charging performance. 310 + */ 311 + ret = regmap_update_bits(charger->regmap, RT5033_REG_CHG_CTRL4, 312 + RT5033_CHGCTRL4_MIVR_MASK, RT5033_CHARGER_MIVR_DISABLE); 313 + if (ret) { 314 + dev_err(charger->dev, "Failed to disable MIVR.\n"); 315 + return -EINVAL; 316 + } 317 + 318 + ret = rt5033_init_pre_charge(charger); 319 + if (ret) 320 + return ret; 321 + 322 + ret = rt5033_init_fast_charge(charger); 323 + if (ret) 324 + return ret; 325 + 326 + ret = rt5033_init_const_charge(charger); 327 + if (ret) 328 + return ret; 329 + 330 + return 0; 331 + } 332 + 333 + static enum power_supply_property rt5033_charger_props[] = { 334 + POWER_SUPPLY_PROP_STATUS, 335 + POWER_SUPPLY_PROP_CHARGE_TYPE, 336 + POWER_SUPPLY_PROP_CURRENT_MAX, 337 + POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE, 338 + POWER_SUPPLY_PROP_MODEL_NAME, 339 + POWER_SUPPLY_PROP_MANUFACTURER, 340 + POWER_SUPPLY_PROP_ONLINE, 341 + }; 342 + 343 + static int rt5033_charger_get_property(struct power_supply *psy, 344 + enum power_supply_property psp, 345 + union power_supply_propval *val) 346 + { 347 + struct rt5033_charger *charger = power_supply_get_drvdata(psy); 348 + 349 + switch (psp) { 350 + case POWER_SUPPLY_PROP_STATUS: 351 + val->intval = rt5033_get_charger_state(charger); 352 + break; 353 + case POWER_SUPPLY_PROP_CHARGE_TYPE: 354 + val->intval = rt5033_get_charger_type(charger); 355 + break; 356 + case POWER_SUPPLY_PROP_CURRENT_MAX: 357 + val->intval = rt5033_get_charger_current_limit(charger); 358 + break; 359 + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE: 360 + val->intval = rt5033_get_charger_const_voltage(charger); 361 + break; 362 + case POWER_SUPPLY_PROP_MODEL_NAME: 363 + val->strval = RT5033_CHARGER_MODEL; 364 + break; 365 + case POWER_SUPPLY_PROP_MANUFACTURER: 366 + val->strval = RT5033_MANUFACTURER; 367 + break; 368 + case POWER_SUPPLY_PROP_ONLINE: 369 + val->intval = (rt5033_get_charger_state(charger) == 370 + POWER_SUPPLY_STATUS_CHARGING); 371 + break; 372 + default: 373 + return -EINVAL; 374 + } 375 + 376 + return 0; 377 + } 378 + 379 + static struct rt5033_charger_data *rt5033_charger_dt_init( 380 + struct rt5033_charger *charger) 381 + { 382 + struct rt5033_charger_data *chg; 383 + struct power_supply_battery_info *info; 384 + int ret; 385 + 386 + chg = devm_kzalloc(charger->dev, sizeof(*chg), GFP_KERNEL); 387 + if (!chg) 388 + return ERR_PTR(-ENOMEM); 389 + 390 + ret = power_supply_get_battery_info(charger->psy, &info); 391 + if (ret) 392 + return ERR_PTR(dev_err_probe(charger->dev, -EINVAL, 393 + "missing battery info\n")); 394 + 395 + /* Assign data. Validity will be checked in the init functions. */ 396 + chg->pre_uamp = info->precharge_current_ua; 397 + chg->fast_uamp = info->constant_charge_current_max_ua; 398 + chg->eoc_uamp = info->charge_term_current_ua; 399 + chg->pre_uvolt = info->precharge_voltage_max_uv; 400 + chg->const_uvolt = info->constant_charge_voltage_max_uv; 401 + 402 + return chg; 403 + } 404 + 405 + static const struct power_supply_desc rt5033_charger_desc = { 406 + .name = "rt5033-charger", 407 + .type = POWER_SUPPLY_TYPE_USB, 408 + .properties = rt5033_charger_props, 409 + .num_properties = ARRAY_SIZE(rt5033_charger_props), 410 + .get_property = rt5033_charger_get_property, 411 + }; 412 + 413 + static int rt5033_charger_probe(struct platform_device *pdev) 414 + { 415 + struct rt5033_charger *charger; 416 + struct power_supply_config psy_cfg = {}; 417 + int ret; 418 + 419 + charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); 420 + if (!charger) 421 + return -ENOMEM; 422 + 423 + platform_set_drvdata(pdev, charger); 424 + charger->dev = &pdev->dev; 425 + charger->regmap = dev_get_regmap(pdev->dev.parent, NULL); 426 + 427 + psy_cfg.of_node = pdev->dev.of_node; 428 + psy_cfg.drv_data = charger; 429 + 430 + charger->psy = devm_power_supply_register(&pdev->dev, 431 + &rt5033_charger_desc, 432 + &psy_cfg); 433 + if (IS_ERR(charger->psy)) 434 + return dev_err_probe(&pdev->dev, PTR_ERR(charger->psy), 435 + "Failed to register power supply\n"); 436 + 437 + charger->chg = rt5033_charger_dt_init(charger); 438 + if (IS_ERR_OR_NULL(charger->chg)) 439 + return PTR_ERR(charger->chg); 440 + 441 + ret = rt5033_charger_reg_init(charger); 442 + if (ret) 443 + return ret; 444 + 445 + return 0; 446 + } 447 + 448 + static const struct platform_device_id rt5033_charger_id[] = { 449 + { "rt5033-charger", }, 450 + { } 451 + }; 452 + MODULE_DEVICE_TABLE(platform, rt5033_charger_id); 453 + 454 + static const struct of_device_id rt5033_charger_of_match[] = { 455 + { .compatible = "richtek,rt5033-charger", }, 456 + { } 457 + }; 458 + MODULE_DEVICE_TABLE(of, rt5033_charger_of_match); 459 + 460 + static struct platform_driver rt5033_charger_driver = { 461 + .driver = { 462 + .name = "rt5033-charger", 463 + .of_match_table = rt5033_charger_of_match, 464 + }, 465 + .probe = rt5033_charger_probe, 466 + .id_table = rt5033_charger_id, 467 + }; 468 + module_platform_driver(rt5033_charger_driver); 469 + 470 + MODULE_DESCRIPTION("Richtek RT5033 charger driver"); 471 + MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>"); 472 + MODULE_LICENSE("GPL v2");
+11
drivers/regulator/Kconfig
··· 556 556 The MAX5970/5978 is a smart switch with no output regulation, but 557 557 fault protection and voltage and current monitoring capabilities. 558 558 559 + config REGULATOR_MAX77541 560 + tristate "Analog Devices MAX77541/77540 Regulator" 561 + depends on MFD_MAX77541 562 + help 563 + This driver controls a Analog Devices MAX77541/77540 regulators 564 + via I2C bus. Both MAX77540 and MAX77541 are dual-phase 565 + high-efficiency buck converter. Say Y here to 566 + enable the regulator driver. 567 + Say M here if you want to include support for the regulator as a 568 + module. 569 + 559 570 config REGULATOR_MAX77620 560 571 tristate "Maxim 77620/MAX20024 voltage regulator" 561 572 depends on MFD_MAX77620 || COMPILE_TEST
+1
drivers/regulator/Makefile
··· 68 68 obj-$(CONFIG_REGULATOR_MAX14577) += max14577-regulator.o 69 69 obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o 70 70 obj-$(CONFIG_REGULATOR_MAX597X) += max597x-regulator.o 71 + obj-$(CONFIG_REGULATOR_MAX77541) += max77541-regulator.o 71 72 obj-$(CONFIG_REGULATOR_MAX77620) += max77620-regulator.o 72 73 obj-$(CONFIG_REGULATOR_MAX77650) += max77650-regulator.o 73 74 obj-$(CONFIG_REGULATOR_MAX8649) += max8649.o
+153
drivers/regulator/max77541-regulator.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + /* 3 + * Copyright (c) 2022 Analog Devices, Inc. 4 + * ADI Regulator driver for the MAX77540 and MAX77541 5 + */ 6 + 7 + #include <linux/mfd/max77541.h> 8 + #include <linux/mod_devicetable.h> 9 + #include <linux/platform_device.h> 10 + #include <linux/regmap.h> 11 + #include <linux/regulator/driver.h> 12 + 13 + static const struct regulator_ops max77541_buck_ops = { 14 + .enable = regulator_enable_regmap, 15 + .disable = regulator_disable_regmap, 16 + .is_enabled = regulator_is_enabled_regmap, 17 + .list_voltage = regulator_list_voltage_pickable_linear_range, 18 + .get_voltage_sel = regulator_get_voltage_sel_pickable_regmap, 19 + .set_voltage_sel = regulator_set_voltage_sel_pickable_regmap, 20 + }; 21 + 22 + static const struct linear_range max77540_buck_ranges[] = { 23 + /* Ranges when VOLT_SEL bits are 0x00 */ 24 + REGULATOR_LINEAR_RANGE(500000, 0x00, 0x8B, 5000), 25 + REGULATOR_LINEAR_RANGE(1200000, 0x8C, 0xFF, 0), 26 + /* Ranges when VOLT_SEL bits are 0x40 */ 27 + REGULATOR_LINEAR_RANGE(1200000, 0x00, 0x8B, 10000), 28 + REGULATOR_LINEAR_RANGE(2400000, 0x8C, 0xFF, 0), 29 + /* Ranges when VOLT_SEL bits are 0x80 */ 30 + REGULATOR_LINEAR_RANGE(2000000, 0x00, 0x9F, 20000), 31 + REGULATOR_LINEAR_RANGE(5200000, 0xA0, 0xFF, 0), 32 + }; 33 + 34 + static const struct linear_range max77541_buck_ranges[] = { 35 + /* Ranges when VOLT_SEL bits are 0x00 */ 36 + REGULATOR_LINEAR_RANGE(300000, 0x00, 0xB3, 5000), 37 + REGULATOR_LINEAR_RANGE(1200000, 0xB4, 0xFF, 0), 38 + /* Ranges when VOLT_SEL bits are 0x40 */ 39 + REGULATOR_LINEAR_RANGE(1200000, 0x00, 0x8B, 10000), 40 + REGULATOR_LINEAR_RANGE(2400000, 0x8C, 0xFF, 0), 41 + /* Ranges when VOLT_SEL bits are 0x80 */ 42 + REGULATOR_LINEAR_RANGE(2000000, 0x00, 0x9F, 20000), 43 + REGULATOR_LINEAR_RANGE(5200000, 0xA0, 0xFF, 0), 44 + }; 45 + 46 + static const unsigned int max77541_buck_volt_range_sel[] = { 47 + 0x00, 0x00, 0x40, 0x40, 0x80, 0x80, 48 + }; 49 + 50 + enum max77541_regulators { 51 + MAX77541_BUCK1 = 1, 52 + MAX77541_BUCK2, 53 + }; 54 + 55 + #define MAX77540_BUCK(_id, _ops) \ 56 + { .id = MAX77541_BUCK ## _id, \ 57 + .name = "buck"#_id, \ 58 + .of_match = "buck"#_id, \ 59 + .regulators_node = "regulators", \ 60 + .enable_reg = MAX77541_REG_EN_CTRL, \ 61 + .enable_mask = MAX77541_BIT_M ## _id ## _EN, \ 62 + .ops = &(_ops), \ 63 + .type = REGULATOR_VOLTAGE, \ 64 + .linear_ranges = max77540_buck_ranges, \ 65 + .n_linear_ranges = ARRAY_SIZE(max77540_buck_ranges), \ 66 + .vsel_reg = MAX77541_REG_M ## _id ## _VOUT, \ 67 + .vsel_mask = MAX77541_BITS_MX_VOUT, \ 68 + .vsel_range_reg = MAX77541_REG_M ## _id ## _CFG1, \ 69 + .vsel_range_mask = MAX77541_BITS_MX_CFG1_RNG, \ 70 + .linear_range_selectors = max77541_buck_volt_range_sel, \ 71 + .owner = THIS_MODULE, \ 72 + } 73 + 74 + #define MAX77541_BUCK(_id, _ops) \ 75 + { .id = MAX77541_BUCK ## _id, \ 76 + .name = "buck"#_id, \ 77 + .of_match = "buck"#_id, \ 78 + .regulators_node = "regulators", \ 79 + .enable_reg = MAX77541_REG_EN_CTRL, \ 80 + .enable_mask = MAX77541_BIT_M ## _id ## _EN, \ 81 + .ops = &(_ops), \ 82 + .type = REGULATOR_VOLTAGE, \ 83 + .linear_ranges = max77541_buck_ranges, \ 84 + .n_linear_ranges = ARRAY_SIZE(max77541_buck_ranges), \ 85 + .vsel_reg = MAX77541_REG_M ## _id ## _VOUT, \ 86 + .vsel_mask = MAX77541_BITS_MX_VOUT, \ 87 + .vsel_range_reg = MAX77541_REG_M ## _id ## _CFG1, \ 88 + .vsel_range_mask = MAX77541_BITS_MX_CFG1_RNG, \ 89 + .linear_range_selectors = max77541_buck_volt_range_sel, \ 90 + .owner = THIS_MODULE, \ 91 + } 92 + 93 + static const struct regulator_desc max77540_regulators_desc[] = { 94 + MAX77540_BUCK(1, max77541_buck_ops), 95 + MAX77540_BUCK(2, max77541_buck_ops), 96 + }; 97 + 98 + static const struct regulator_desc max77541_regulators_desc[] = { 99 + MAX77541_BUCK(1, max77541_buck_ops), 100 + MAX77541_BUCK(2, max77541_buck_ops), 101 + }; 102 + 103 + static int max77541_regulator_probe(struct platform_device *pdev) 104 + { 105 + struct regulator_config config = {}; 106 + const struct regulator_desc *desc; 107 + struct device *dev = &pdev->dev; 108 + struct regulator_dev *rdev; 109 + struct max77541 *max77541 = dev_get_drvdata(dev->parent); 110 + unsigned int i; 111 + 112 + config.dev = dev->parent; 113 + 114 + switch (max77541->id) { 115 + case MAX77540: 116 + desc = max77540_regulators_desc; 117 + break; 118 + case MAX77541: 119 + desc = max77541_regulators_desc; 120 + break; 121 + default: 122 + return -EINVAL; 123 + } 124 + 125 + for (i = 0; i < MAX77541_MAX_REGULATORS; i++) { 126 + rdev = devm_regulator_register(dev, &desc[i], &config); 127 + if (IS_ERR(rdev)) 128 + return dev_err_probe(dev, PTR_ERR(rdev), 129 + "Failed to register regulator\n"); 130 + } 131 + 132 + return 0; 133 + } 134 + 135 + static const struct platform_device_id max77541_regulator_platform_id[] = { 136 + { "max77540-regulator" }, 137 + { "max77541-regulator" }, 138 + { } 139 + }; 140 + MODULE_DEVICE_TABLE(platform, max77541_regulator_platform_id); 141 + 142 + static struct platform_driver max77541_regulator_driver = { 143 + .driver = { 144 + .name = "max77541-regulator", 145 + }, 146 + .probe = max77541_regulator_probe, 147 + .id_table = max77541_regulator_platform_id, 148 + }; 149 + module_platform_driver(max77541_regulator_driver); 150 + 151 + MODULE_AUTHOR("Okan Sahin <Okan.Sahin@analog.com>"); 152 + MODULE_DESCRIPTION("MAX77540/MAX77541 regulator driver"); 153 + MODULE_LICENSE("GPL");
+1
include/dt-bindings/mfd/stm32f7-rcc.h
··· 64 64 #define STM32F7_RCC_APB1_TIM14 8 65 65 #define STM32F7_RCC_APB1_LPTIM1 9 66 66 #define STM32F7_RCC_APB1_WWDG 11 67 + #define STM32F7_RCC_APB1_CAN3 13 67 68 #define STM32F7_RCC_APB1_SPI2 14 68 69 #define STM32F7_RCC_APB1_SPI3 15 69 70 #define STM32F7_RCC_APB1_SPDIFRX 16
+84
include/linux/mfd/axp20x.h
··· 12 12 13 13 enum axp20x_variants { 14 14 AXP152_ID = 0, 15 + AXP192_ID, 15 16 AXP202_ID, 16 17 AXP209_ID, 17 18 AXP221_ID, ··· 27 26 NR_AXP20X_VARIANTS, 28 27 }; 29 28 29 + #define AXP192_DATACACHE(m) (0x06 + (m)) 30 30 #define AXP20X_DATACACHE(m) (0x04 + (m)) 31 31 32 32 /* Power supply */ ··· 48 46 #define AXP152_PEK_KEY 0x36 49 47 #define AXP152_DCDC_FREQ 0x37 50 48 #define AXP152_DCDC_MODE 0x80 49 + 50 + #define AXP192_USB_OTG_STATUS 0x04 51 + #define AXP192_PWR_OUT_CTRL 0x12 52 + #define AXP192_DCDC2_V_OUT 0x23 53 + #define AXP192_DCDC1_V_OUT 0x26 54 + #define AXP192_DCDC3_V_OUT 0x27 55 + #define AXP192_LDO2_3_V_OUT 0x28 51 56 52 57 #define AXP20X_PWR_INPUT_STATUS 0x00 53 58 #define AXP20X_PWR_OP_MODE 0x01 ··· 194 185 #define AXP152_IRQ2_STATE 0x49 195 186 #define AXP152_IRQ3_STATE 0x4a 196 187 188 + #define AXP192_IRQ1_EN 0x40 189 + #define AXP192_IRQ2_EN 0x41 190 + #define AXP192_IRQ3_EN 0x42 191 + #define AXP192_IRQ4_EN 0x43 192 + #define AXP192_IRQ1_STATE 0x44 193 + #define AXP192_IRQ2_STATE 0x45 194 + #define AXP192_IRQ3_STATE 0x46 195 + #define AXP192_IRQ4_STATE 0x47 196 + #define AXP192_IRQ5_EN 0x4a 197 + #define AXP192_IRQ5_STATE 0x4d 198 + 197 199 #define AXP20X_IRQ1_EN 0x40 198 200 #define AXP20X_IRQ2_EN 0x41 199 201 #define AXP20X_IRQ3_EN 0x42 ··· 224 204 #define AXP15060_IRQ2_STATE 0x49 225 205 226 206 /* ADC */ 207 + #define AXP192_GPIO2_V_ADC_H 0x68 208 + #define AXP192_GPIO2_V_ADC_L 0x69 209 + #define AXP192_GPIO3_V_ADC_H 0x6a 210 + #define AXP192_GPIO3_V_ADC_L 0x6b 211 + 227 212 #define AXP20X_ACIN_V_ADC_H 0x56 228 213 #define AXP20X_ACIN_V_ADC_L 0x57 229 214 #define AXP20X_ACIN_I_ADC_H 0x58 ··· 258 233 #define AXP20X_IPSOUT_V_HIGH_L 0x7f 259 234 260 235 /* Power supply */ 236 + #define AXP192_GPIO30_IN_RANGE 0x85 237 + 261 238 #define AXP20X_DCDC_MODE 0x80 262 239 #define AXP20X_ADC_EN1 0x82 263 240 #define AXP20X_ADC_EN2 0x83 ··· 287 260 #define AXP152_PWM1_FREQ_X 0x9b 288 261 #define AXP152_PWM1_FREQ_Y 0x9c 289 262 #define AXP152_PWM1_DUTY_CYCLE 0x9d 263 + 264 + #define AXP192_GPIO0_CTRL 0x90 265 + #define AXP192_LDO_IO0_V_OUT 0x91 266 + #define AXP192_GPIO1_CTRL 0x92 267 + #define AXP192_GPIO2_CTRL 0x93 268 + #define AXP192_GPIO2_0_STATE 0x94 269 + #define AXP192_GPIO4_3_CTRL 0x95 270 + #define AXP192_GPIO4_3_STATE 0x96 271 + #define AXP192_GPIO2_0_PULL 0x97 272 + #define AXP192_N_RSTO_CTRL 0x9e 290 273 291 274 #define AXP20X_GPIO0_CTRL 0x90 292 275 #define AXP20X_LDO5_V_OUT 0x91 ··· 377 340 #define AXP288_FG_TUNE5 0xed 378 341 379 342 /* Regulators IDs */ 343 + enum { 344 + AXP192_DCDC1 = 0, 345 + AXP192_DCDC2, 346 + AXP192_DCDC3, 347 + AXP192_LDO1, 348 + AXP192_LDO2, 349 + AXP192_LDO3, 350 + AXP192_LDO_IO0, 351 + AXP192_REG_ID_MAX 352 + }; 353 + 380 354 enum { 381 355 AXP20X_LDO1 = 0, 382 356 AXP20X_LDO2, ··· 577 529 AXP152_IRQ_GPIO2_INPUT, 578 530 AXP152_IRQ_GPIO1_INPUT, 579 531 AXP152_IRQ_GPIO0_INPUT, 532 + }; 533 + 534 + enum axp192_irqs { 535 + AXP192_IRQ_ACIN_OVER_V = 1, 536 + AXP192_IRQ_ACIN_PLUGIN, 537 + AXP192_IRQ_ACIN_REMOVAL, 538 + AXP192_IRQ_VBUS_OVER_V, 539 + AXP192_IRQ_VBUS_PLUGIN, 540 + AXP192_IRQ_VBUS_REMOVAL, 541 + AXP192_IRQ_VBUS_V_LOW, 542 + AXP192_IRQ_BATT_PLUGIN, 543 + AXP192_IRQ_BATT_REMOVAL, 544 + AXP192_IRQ_BATT_ENT_ACT_MODE, 545 + AXP192_IRQ_BATT_EXIT_ACT_MODE, 546 + AXP192_IRQ_CHARG, 547 + AXP192_IRQ_CHARG_DONE, 548 + AXP192_IRQ_BATT_TEMP_HIGH, 549 + AXP192_IRQ_BATT_TEMP_LOW, 550 + AXP192_IRQ_DIE_TEMP_HIGH, 551 + AXP192_IRQ_CHARG_I_LOW, 552 + AXP192_IRQ_DCDC1_V_LONG, 553 + AXP192_IRQ_DCDC2_V_LONG, 554 + AXP192_IRQ_DCDC3_V_LONG, 555 + AXP192_IRQ_PEK_SHORT = 22, 556 + AXP192_IRQ_PEK_LONG, 557 + AXP192_IRQ_N_OE_PWR_ON, 558 + AXP192_IRQ_N_OE_PWR_OFF, 559 + AXP192_IRQ_VBUS_VALID, 560 + AXP192_IRQ_VBUS_NOT_VALID, 561 + AXP192_IRQ_VBUS_SESS_VALID, 562 + AXP192_IRQ_VBUS_SESS_END, 563 + AXP192_IRQ_LOW_PWR_LVL = 31, 564 + AXP192_IRQ_TIMER, 565 + AXP192_IRQ_GPIO2_INPUT = 37, 566 + AXP192_IRQ_GPIO1_INPUT, 567 + AXP192_IRQ_GPIO0_INPUT, 580 568 }; 581 569 582 570 enum {
+31 -14
include/linux/mfd/intel-m10-bmc.h
··· 11 11 #include <linux/bits.h> 12 12 #include <linux/dev_printk.h> 13 13 #include <linux/regmap.h> 14 + #include <linux/rwsem.h> 14 15 15 16 #define M10BMC_N3000_LEGACY_BUILD_VER 0x300468 16 17 #define M10BMC_N3000_SYS_BASE 0x300800 ··· 39 38 #define M10BMC_N3000_VER_MAJOR_MSK GENMASK(23, 16) 40 39 #define M10BMC_N3000_VER_PCB_INFO_MSK GENMASK(31, 24) 41 40 #define M10BMC_N3000_VER_LEGACY_INVALID 0xffffffff 41 + 42 + /* Telemetry registers */ 43 + #define M10BMC_N3000_TELEM_START 0x100 44 + #define M10BMC_N3000_TELEM_END 0x250 45 + #define M10BMC_D5005_TELEM_END 0x300 42 46 43 47 /* Secure update doorbell register, in system register region */ 44 48 #define M10BMC_N3000_DOORBELL 0x400 ··· 211 205 * struct intel_m10bmc_platform_info - Intel MAX 10 BMC platform specific information 212 206 * @cells: MFD cells 213 207 * @n_cells: MFD cells ARRAY_SIZE() 208 + * @handshake_sys_reg_ranges: array of register ranges for fw handshake regs 209 + * @handshake_sys_reg_nranges: number of register ranges for fw handshake regs 214 210 * @csr_map: the mappings for register definition of MAX10 BMC 215 211 */ 216 212 struct intel_m10bmc_platform_info { 217 213 struct mfd_cell *cells; 218 214 int n_cells; 215 + const struct regmap_range *handshake_sys_reg_ranges; 216 + unsigned int handshake_sys_reg_nranges; 219 217 const struct m10bmc_csr_map *csr_map; 220 218 }; 221 219 ··· 242 232 void (*unlock_write)(struct intel_m10bmc *m10bmc); 243 233 }; 244 234 235 + enum m10bmc_fw_state { 236 + M10BMC_FW_STATE_NORMAL, 237 + M10BMC_FW_STATE_SEC_UPDATE_PREPARE, 238 + M10BMC_FW_STATE_SEC_UPDATE_WRITE, 239 + M10BMC_FW_STATE_SEC_UPDATE_PROGRAM, 240 + }; 241 + 245 242 /** 246 243 * struct intel_m10bmc - Intel MAX 10 BMC parent driver data structure 247 244 * @dev: this device 248 245 * @regmap: the regmap used to access registers by m10bmc itself 249 246 * @info: the platform information for MAX10 BMC 250 247 * @flash_bulk_ops: optional device specific operations for flash R/W 248 + * @bmcfw_lock: read/write semaphore to BMC firmware running state 249 + * @bmcfw_state: BMC firmware running state. Available only when 250 + * handshake_sys_reg_nranges > 0. 251 251 */ 252 252 struct intel_m10bmc { 253 253 struct device *dev; 254 254 struct regmap *regmap; 255 255 const struct intel_m10bmc_platform_info *info; 256 256 const struct intel_m10bmc_flash_bulk_ops *flash_bulk_ops; 257 + struct rw_semaphore bmcfw_lock; /* Protects bmcfw_state */ 258 + enum m10bmc_fw_state bmcfw_state; 257 259 }; 258 260 259 261 /* ··· 273 251 * 274 252 * m10bmc_raw_read - read m10bmc register per addr 275 253 * m10bmc_sys_read - read m10bmc system register per offset 254 + * m10bmc_sys_update_bits - update m10bmc system register per offset 276 255 */ 277 256 static inline int 278 257 m10bmc_raw_read(struct intel_m10bmc *m10bmc, unsigned int addr, ··· 289 266 return ret; 290 267 } 291 268 292 - /* 293 - * The base of the system registers could be configured by HW developers, and 294 - * in HW SPEC, the base is not added to the addresses of the system registers. 295 - * 296 - * This function helps to simplify the accessing of the system registers. And if 297 - * the base is reconfigured in HW, SW developers could simply change the 298 - * csr_map's base accordingly. 299 - */ 300 - static inline int m10bmc_sys_read(struct intel_m10bmc *m10bmc, unsigned int offset, 301 - unsigned int *val) 302 - { 303 - const struct m10bmc_csr_map *csr_map = m10bmc->info->csr_map; 269 + int m10bmc_sys_read(struct intel_m10bmc *m10bmc, unsigned int offset, unsigned int *val); 270 + int m10bmc_sys_update_bits(struct intel_m10bmc *m10bmc, unsigned int offset, 271 + unsigned int msk, unsigned int val); 304 272 305 - return m10bmc_raw_read(m10bmc, csr_map->base + offset, val); 306 - } 273 + /* 274 + * Track the state of the firmware, as it is not available for register 275 + * handshakes during secure updates on some MAX 10 cards. 276 + */ 277 + void m10bmc_fw_state_set(struct intel_m10bmc *m10bmc, enum m10bmc_fw_state new_state); 307 278 308 279 /* 309 280 * MAX10 BMC Core support
+8 -8
include/linux/mfd/max597x.h include/linux/mfd/max5970.h
··· 7 7 * Author: Patrick Rudolph <patrick.rudolph@9elements.com> 8 8 */ 9 9 10 - #ifndef _MFD_MAX597X_H 11 - #define _MFD_MAX597X_H 10 + #ifndef _MFD_MAX5970_H 11 + #define _MFD_MAX5970_H 12 12 13 13 #include <linux/regmap.h> 14 14 15 15 #define MAX5970_NUM_SWITCHES 2 16 16 #define MAX5978_NUM_SWITCHES 1 17 - #define MAX597X_NUM_LEDS 4 17 + #define MAX5970_NUM_LEDS 4 18 18 19 - struct max597x_data { 19 + struct max5970_data { 20 20 int num_switches; 21 21 u32 irng[MAX5970_NUM_SWITCHES]; 22 22 u32 mon_rng[MAX5970_NUM_SWITCHES]; 23 23 u32 shunt_micro_ohms[MAX5970_NUM_SWITCHES]; 24 24 }; 25 25 26 - enum max597x_chip_type { 27 - MAX597x_TYPE_MAX5978 = 1, 28 - MAX597x_TYPE_MAX5970, 26 + enum max5970_chip_type { 27 + TYPE_MAX5978 = 1, 28 + TYPE_MAX5970, 29 29 }; 30 30 31 31 #define MAX5970_REG_CURRENT_L(ch) (0x01 + (ch) * 4) ··· 93 93 #define MAX_REGISTERS 0x49 94 94 #define ADC_MASK 0x3FF 95 95 96 - #endif /* _MFD_MAX597X_H */ 96 + #endif /* _MFD_MAX5970_H */
+91
include/linux/mfd/max77541.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 + 3 + #ifndef __MFD_MAX77541_H 4 + #define __MFD_MAX77541_H 5 + 6 + #include <linux/bits.h> 7 + #include <linux/types.h> 8 + 9 + /* REGISTERS */ 10 + #define MAX77541_REG_INT_SRC 0x00 11 + #define MAX77541_REG_INT_SRC_M 0x01 12 + 13 + #define MAX77541_BIT_INT_SRC_TOPSYS BIT(0) 14 + #define MAX77541_BIT_INT_SRC_BUCK BIT(1) 15 + 16 + #define MAX77541_REG_TOPSYS_INT 0x02 17 + #define MAX77541_REG_TOPSYS_INT_M 0x03 18 + 19 + #define MAX77541_BIT_TOPSYS_INT_TJ_120C BIT(0) 20 + #define MAX77541_BIT_TOPSYS_INT_TJ_140C BIT(1) 21 + #define MAX77541_BIT_TOPSYS_INT_TSHDN BIT(2) 22 + #define MAX77541_BIT_TOPSYS_INT_UVLO BIT(3) 23 + #define MAX77541_BIT_TOPSYS_INT_ALT_SWO BIT(4) 24 + #define MAX77541_BIT_TOPSYS_INT_EXT_FREQ_DET BIT(5) 25 + 26 + /* REGULATORS */ 27 + #define MAX77541_REG_BUCK_INT 0x20 28 + #define MAX77541_REG_BUCK_INT_M 0x21 29 + 30 + #define MAX77541_BIT_BUCK_INT_M1_POK_FLT BIT(0) 31 + #define MAX77541_BIT_BUCK_INT_M2_POK_FLT BIT(1) 32 + #define MAX77541_BIT_BUCK_INT_M1_SCFLT BIT(4) 33 + #define MAX77541_BIT_BUCK_INT_M2_SCFLT BIT(5) 34 + 35 + #define MAX77541_REG_EN_CTRL 0x0B 36 + 37 + #define MAX77541_BIT_M1_EN BIT(0) 38 + #define MAX77541_BIT_M2_EN BIT(1) 39 + 40 + #define MAX77541_REG_M1_VOUT 0x23 41 + #define MAX77541_REG_M2_VOUT 0x33 42 + 43 + #define MAX77541_BITS_MX_VOUT GENMASK(7, 0) 44 + 45 + #define MAX77541_REG_M1_CFG1 0x25 46 + #define MAX77541_REG_M2_CFG1 0x35 47 + 48 + #define MAX77541_BITS_MX_CFG1_RNG GENMASK(7, 6) 49 + 50 + /* ADC */ 51 + #define MAX77541_REG_ADC_INT 0x70 52 + #define MAX77541_REG_ADC_INT_M 0x71 53 + 54 + #define MAX77541_BIT_ADC_INT_CH1_I BIT(0) 55 + #define MAX77541_BIT_ADC_INT_CH2_I BIT(1) 56 + #define MAX77541_BIT_ADC_INT_CH3_I BIT(2) 57 + #define MAX77541_BIT_ADC_INT_CH6_I BIT(5) 58 + 59 + #define MAX77541_REG_ADC_DATA_CH1 0x72 60 + #define MAX77541_REG_ADC_DATA_CH2 0x73 61 + #define MAX77541_REG_ADC_DATA_CH3 0x74 62 + #define MAX77541_REG_ADC_DATA_CH6 0x77 63 + 64 + /* INTERRUPT MASKS*/ 65 + #define MAX77541_REG_INT_SRC_MASK 0x00 66 + #define MAX77541_REG_TOPSYS_INT_MASK 0x00 67 + #define MAX77541_REG_BUCK_INT_MASK 0x00 68 + 69 + #define MAX77541_MAX_REGULATORS 2 70 + 71 + enum max7754x_ids { 72 + MAX77540 = 1, 73 + MAX77541, 74 + }; 75 + 76 + struct regmap; 77 + struct regmap_irq_chip_data; 78 + struct i2c_client; 79 + 80 + struct max77541 { 81 + struct i2c_client *i2c; 82 + struct regmap *regmap; 83 + enum max7754x_ids id; 84 + 85 + struct regmap_irq_chip_data *irq_data; 86 + struct regmap_irq_chip_data *irq_buck; 87 + struct regmap_irq_chip_data *irq_topsys; 88 + struct regmap_irq_chip_data *irq_adc; 89 + }; 90 + 91 + #endif /* __MFD_MAX77541_H */
+42 -20
include/linux/mfd/rt5033-private.h
··· 55 55 }; 56 56 57 57 /* RT5033 Charger state register */ 58 - #define RT5033_CHG_STAT_MASK 0x20 58 + #define RT5033_CHG_STAT_TYPE_MASK 0x60 59 + #define RT5033_CHG_STAT_TYPE_PRE 0x20 60 + #define RT5033_CHG_STAT_TYPE_FAST 0x60 61 + #define RT5033_CHG_STAT_MASK 0x30 59 62 #define RT5033_CHG_STAT_DISCHARGING 0x00 60 63 #define RT5033_CHG_STAT_FULL 0x10 61 64 #define RT5033_CHG_STAT_CHARGING 0x20 62 65 #define RT5033_CHG_STAT_NOT_CHARGING 0x30 63 - #define RT5033_CHG_STAT_TYPE_MASK 0x60 64 - #define RT5033_CHG_STAT_TYPE_PRE 0x20 65 - #define RT5033_CHG_STAT_TYPE_FAST 0x60 66 66 67 67 /* RT5033 CHGCTRL1 register */ 68 68 #define RT5033_CHGCTRL1_IAICR_MASK 0xe0 69 + #define RT5033_CHGCTRL1_TE_EN_MASK 0x08 70 + #define RT5033_CHGCTRL1_HZ_MASK 0x02 69 71 #define RT5033_CHGCTRL1_MODE_MASK 0x01 70 72 71 73 /* RT5033 CHGCTRL2 register */ 72 74 #define RT5033_CHGCTRL2_CV_MASK 0xfc 75 + #define RT5033_CHGCTRL2_CV_SHIFT 0x02 76 + 77 + /* RT5033 DEVICE_ID register */ 78 + #define RT5033_VENDOR_ID_MASK 0xf0 79 + #define RT5033_CHIP_REV_MASK 0x0f 73 80 74 81 /* RT5033 CHGCTRL3 register */ 75 82 #define RT5033_CHGCTRL3_CFO_EN_MASK 0x40 ··· 84 77 #define RT5033_CHGCTRL3_TIMER_EN_MASK 0x01 85 78 86 79 /* RT5033 CHGCTRL4 register */ 87 - #define RT5033_CHGCTRL4_EOC_MASK 0x07 80 + #define RT5033_CHGCTRL4_MIVR_MASK 0xe0 88 81 #define RT5033_CHGCTRL4_IPREC_MASK 0x18 82 + #define RT5033_CHGCTRL4_IPREC_SHIFT 0x03 83 + #define RT5033_CHGCTRL4_EOC_MASK 0x07 89 84 90 85 /* RT5033 CHGCTRL5 register */ 91 - #define RT5033_CHGCTRL5_VPREC_MASK 0x0f 92 86 #define RT5033_CHGCTRL5_ICHG_MASK 0xf0 93 87 #define RT5033_CHGCTRL5_ICHG_SHIFT 0x04 94 - #define RT5033_CHG_MAX_CURRENT 0x0d 88 + #define RT5033_CHGCTRL5_VPREC_MASK 0x0f 95 89 96 90 /* RT5033 RT CTRL1 register */ 97 91 #define RT5033_RT_CTRL1_UUG_MASK 0x02 98 - #define RT5033_RT_HZ_MASK 0x01 99 92 100 93 /* RT5033 control register */ 101 94 #define RT5033_CTRL_FCCM_BUCK_MASK BIT(0) ··· 122 115 * register), AICR mode limits the input current. For example, the AIRC 100 123 116 * mode limits the input current to 100 mA. 124 117 */ 118 + #define RT5033_AICR_DISABLE 0x00 125 119 #define RT5033_AICR_100_MODE 0x20 126 120 #define RT5033_AICR_500_MODE 0x40 127 121 #define RT5033_AICR_700_MODE 0x60 128 122 #define RT5033_AICR_900_MODE 0x80 123 + #define RT5033_AICR_1000_MODE 0xa0 129 124 #define RT5033_AICR_1500_MODE 0xc0 130 125 #define RT5033_AICR_2000_MODE 0xe0 131 - #define RT5033_AICR_MODE_MASK 0xe0 126 + 127 + /* RT5033 charger minimum input voltage regulation */ 128 + #define RT5033_CHARGER_MIVR_DISABLE 0x00 129 + #define RT5033_CHARGER_MIVR_4200MV 0x20 130 + #define RT5033_CHARGER_MIVR_4300MV 0x40 131 + #define RT5033_CHARGER_MIVR_4400MV 0x60 132 + #define RT5033_CHARGER_MIVR_4500MV 0x80 133 + #define RT5033_CHARGER_MIVR_4600MV 0xa0 134 + #define RT5033_CHARGER_MIVR_4700MV 0xc0 135 + #define RT5033_CHARGER_MIVR_4800MV 0xe0 132 136 133 137 /* RT5033 use internal timer need to set time */ 134 - #define RT5033_FAST_CHARGE_TIMER4 0x00 135 - #define RT5033_FAST_CHARGE_TIMER6 0x01 136 - #define RT5033_FAST_CHARGE_TIMER8 0x02 137 - #define RT5033_FAST_CHARGE_TIMER9 0x03 138 - #define RT5033_FAST_CHARGE_TIMER12 0x04 139 - #define RT5033_FAST_CHARGE_TIMER14 0x05 140 - #define RT5033_FAST_CHARGE_TIMER16 0x06 138 + #define RT5033_FAST_CHARGE_TIMER4 0x00 /* 4 hrs */ 139 + #define RT5033_FAST_CHARGE_TIMER6 0x08 /* 6 hrs */ 140 + #define RT5033_FAST_CHARGE_TIMER8 0x10 /* 8 hrs */ 141 + #define RT5033_FAST_CHARGE_TIMER10 0x18 /* 10 hrs */ 142 + #define RT5033_FAST_CHARGE_TIMER12 0x20 /* 12 hrs */ 143 + #define RT5033_FAST_CHARGE_TIMER14 0x28 /* 14 hrs */ 144 + #define RT5033_FAST_CHARGE_TIMER16 0x30 /* 16 hrs */ 141 145 146 + #define RT5033_INT_TIMER_DISABLE 0x00 142 147 #define RT5033_INT_TIMER_ENABLE 0x01 143 - 144 - /* RT5033 charger termination enable mask */ 145 - #define RT5033_TE_ENABLE_MASK 0x08 146 148 147 149 /* 148 150 * RT5033 charger opa mode. RT5033 has two opa modes for OTG: charger mode ··· 161 145 #define RT5033_BOOST_MODE 0x01 162 146 163 147 /* RT5033 charger termination enable */ 148 + #define RT5033_TE_DISABLE 0x00 164 149 #define RT5033_TE_ENABLE 0x08 165 150 166 151 /* RT5033 charger CFO enable */ 152 + #define RT5033_CFO_DISABLE 0x00 167 153 #define RT5033_CFO_ENABLE 0x40 168 154 169 155 /* RT5033 charger constant charge voltage (as in CHGCTRL2 register), uV */ 170 156 #define RT5033_CHARGER_CONST_VOLTAGE_LIMIT_MIN 3650000U 171 157 #define RT5033_CHARGER_CONST_VOLTAGE_STEP_NUM 25000U 172 158 #define RT5033_CHARGER_CONST_VOLTAGE_LIMIT_MAX 4400000U 159 + #define RT5033_CV_MAX_VOLTAGE 0x1e 173 160 174 161 /* RT5033 charger pre-charge current limits (as in CHGCTRL4 register), uA */ 175 162 #define RT5033_CHARGER_PRE_CURRENT_LIMIT_MIN 350000U 176 163 #define RT5033_CHARGER_PRE_CURRENT_STEP_NUM 100000U 177 164 #define RT5033_CHARGER_PRE_CURRENT_LIMIT_MAX 650000U 165 + #define RT5033_CHG_MAX_PRE_CURRENT 0x03 178 166 179 167 /* RT5033 charger fast-charge current (as in CHGCTRL5 register), uA */ 180 168 #define RT5033_CHARGER_FAST_CURRENT_MIN 700000U 181 169 #define RT5033_CHARGER_FAST_CURRENT_STEP_NUM 100000U 182 170 #define RT5033_CHARGER_FAST_CURRENT_MAX 2000000U 171 + #define RT5033_CHG_MAX_CURRENT 0x0d 183 172 184 173 /* 185 174 * RT5033 charger const-charge end of charger current ( ··· 208 187 * RT5033 charger UUG. It enables MOS auto control by H/W charger 209 188 * circuit. 210 189 */ 190 + #define RT5033_CHARGER_UUG_DISABLE 0x00 211 191 #define RT5033_CHARGER_UUG_ENABLE 0x02 212 192 213 193 /* RT5033 charger high impedance mode */ 214 194 #define RT5033_CHARGER_HZ_DISABLE 0x00 215 - #define RT5033_CHARGER_HZ_ENABLE 0x01 195 + #define RT5033_CHARGER_HZ_ENABLE 0x02 216 196 217 197 /* RT5033 regulator BUCK output voltage uV */ 218 198 #define RT5033_REGULATOR_BUCK_VOLTAGE_MIN 1000000U
-24
include/linux/mfd/rt5033.h
··· 12 12 #include <linux/regulator/consumer.h> 13 13 #include <linux/i2c.h> 14 14 #include <linux/regmap.h> 15 - #include <linux/power_supply.h> 16 15 17 16 /* RT5033 regulator IDs */ 18 17 enum rt5033_regulators { ··· 29 30 struct regmap_irq_chip_data *irq_data; 30 31 int irq; 31 32 bool wakeup; 32 - }; 33 - 34 - struct rt5033_battery { 35 - struct i2c_client *client; 36 - struct rt5033_dev *rt5033; 37 - struct regmap *regmap; 38 - struct power_supply *psy; 39 - }; 40 - 41 - /* RT5033 charger platform data */ 42 - struct rt5033_charger_data { 43 - unsigned int pre_uamp; 44 - unsigned int pre_uvolt; 45 - unsigned int const_uvolt; 46 - unsigned int eoc_uamp; 47 - unsigned int fast_uamp; 48 - }; 49 - 50 - struct rt5033_charger { 51 - struct device *dev; 52 - struct rt5033_dev *rt5033; 53 - struct power_supply psy; 54 - struct rt5033_charger_data *chg; 55 33 }; 56 34 57 35 #endif /* __RT5033_H__ */
+6 -6
include/linux/mfd/stpmic1.h
··· 15 15 #define RREQ_STATE_SR 0x5 16 16 #define VERSION_SR 0x6 17 17 18 - #define SWOFF_PWRCTRL_CR 0x10 18 + #define MAIN_CR 0x10 19 19 #define PADS_PULL_CR 0x11 20 20 #define BUCKS_PD_CR 0x12 21 21 #define LDO14_PD_CR 0x13 ··· 148 148 #define LDO_BYPASS_MASK BIT(7) 149 149 150 150 /* Main PMIC Control Register 151 - * SWOFF_PWRCTRL_CR 151 + * MAIN_CR 152 152 * Address : 0x10 153 153 */ 154 - #define ICC_EVENT_ENABLED BIT(4) 154 + #define OCP_OFF_DBG BIT(4) 155 155 #define PWRCTRL_POLARITY_HIGH BIT(3) 156 - #define PWRCTRL_PIN_VALID BIT(2) 157 - #define RESTART_REQUEST_ENABLED BIT(1) 158 - #define SOFTWARE_SWITCH_OFF_ENABLED BIT(0) 156 + #define PWRCTRL_ENABLE BIT(2) 157 + #define RESTART_REQUEST_ENABLE BIT(1) 158 + #define SOFTWARE_SWITCH_OFF BIT(0) 159 159 160 160 /* Main PMIC PADS Control Register 161 161 * PADS_PULL_CR