- 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
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmSinHkACgkQUa+KL4f8
 d2Gj3A/9EimIwZKau8OeHCVue1mNrEVkVsCiWIZF1eHliufNbH0g3+9gzTB1yQfL
 PmE2tN+vxdHNPJKzPnrmEEdJpm+rV6RikUD3I1mVN0wPSXDmZPx9kYuJD8SmMtZo
 aDLQIMwqY0ZijGgAoVWmRtYo5praWSFvyutiD1yYEI4yAz/QcLoNvWjt3qb0H+fq
 Un1LYErrLxLar0GllzQa5lzoNEAoSBvO1TmS8z4Cm5uiU6Orahh2DlsE/Do40GSc
 5YYntAEsuJ1Bkg7JB+bxdU4BJnJskqzaasLIe3Fc4rXf6zdh/21EpmhpFGY+BS8s
 51f+NjViMwi+3uiBe5g8f/pIy6dIpkfvdukzbqDhDwqXnexftpy3+i99PJiWludR
 Xpr6s+g6zpxLAoKzHNA1jm5B3I0IPJEBoWe8jAalIcGIQBdjiF9UAkas3z9NTEoa
 8TrjW1Abxow1TB9ouT0kE7hvQk2UpYLEbNdDAByE4mM33d5AF7UpcEBrhmbFDA/E
 12q5EMoV9uXIzf+LS2TdYroo8SVYHufiIoiwU6QPJzWVVFJ3lrU3pA1Oe+aICMNu
 90EVDI1Ve37WTJfN9+FAlncaWF99AEqZwrES25QrKhMQO4w6LS35shlzTzpUcB4k
 q+upr81cWLz0t7fmjgn4yVa1CWzaQ19nylqXF/Nb4RP/6ZiP2Dw=
 =EmOj
 -----END PGP SIGNATURE-----

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
  ...
This commit is contained in:
Linus Torvalds 2023-07-03 10:55:04 -07:00
commit b8ec70ab66
146 changed files with 2374 additions and 300 deletions

View File

@ -275,6 +275,10 @@ Krzysztof Kozlowski <krzk@kernel.org> <k.kozlowski@samsung.com>
Krzysztof Kozlowski <krzk@kernel.org> <krzysztof.kozlowski@canonical.com>
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Kuogee Hsieh <quic_khsieh@quicinc.com> <khsieh@codeaurora.org>
Lee Jones <lee@kernel.org> <joneslee@google.com>
Lee Jones <lee@kernel.org> <lee.jones@canonical.com>
Lee Jones <lee@kernel.org> <lee.jones@linaro.org>
Lee Jones <lee@kernel.org> <lee@ubuntu.com>
Leonard Crestez <leonard.crestez@nxp.com> Leonard Crestez <cdleonard@gmail.com>
Leonardo Bras <leobras.c@gmail.com> <leonardo@linux.ibm.com>
Leonard Göhrs <l.goehrs@pengutronix.de>

View File

@ -0,0 +1,68 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/mfd/adi,max77541.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: MAX77540/MAX77541 PMIC from ADI
maintainers:
- Okan Sahin <okan.sahin@analog.com>
description: |
MAX77540 is a Power Management IC with 2 buck regulators.
MAX77541 is a Power Management IC with 2 buck regulators and 1 ADC.
properties:
compatible:
enum:
- adi,max77540
- adi,max77541
reg:
maxItems: 1
interrupts:
maxItems: 1
regulators:
$ref: /schemas/regulator/adi,max77541-regulator.yaml#
required:
- compatible
- reg
- interrupts
additionalProperties: false
examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
pmic@69 {
compatible = "adi,max77541";
reg = <0x69>;
interrupt-parent = <&gpio>;
interrupts = <16 IRQ_TYPE_EDGE_FALLING>;
regulators {
buck1 {
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <5200000>;
regulator-boot-on;
regulator-always-on;
};
buck2 {
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <5200000>;
regulator-boot-on;
regulator-always-on;
};
};
};
};

View File

@ -122,12 +122,6 @@ patternProperties:
compatible:
const: gw,gsc-fan
"#address-cells":
const: 1
"#size-cells":
const: 0
reg:
description: The fan controller base address
maxItems: 1
@ -135,8 +129,6 @@ patternProperties:
required:
- compatible
- reg
- "#address-cells"
- "#size-cells"
required:
- compatible
@ -194,8 +186,6 @@ examples:
};
fan-controller@2c {
#address-cells = <1>;
#size-cells = <0>;
compatible = "gw,gsc-fan";
reg = <0x2c>;
};

View File

@ -146,6 +146,10 @@ patternProperties:
type: object
$ref: /schemas/nvmem/qcom,spmi-sdam.yaml#
"phy@[0-9a-f]+$":
type: object
$ref: /schemas/phy/qcom,snps-eusb2-repeater.yaml#
"pon@[0-9a-f]+$":
type: object
$ref: /schemas/power/reset/qcom,pon.yaml#

View File

@ -34,6 +34,7 @@ properties:
- qcom,tcsr-ipq5332
- qcom,tcsr-ipq6018
- qcom,tcsr-ipq8064
- qcom,tcsr-ipq8074
- qcom,tcsr-ipq9574
- qcom,tcsr-mdm9615
- qcom,tcsr-msm8226

View File

@ -0,0 +1,138 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/mfd/richtek,rt5033.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Richtek RT5033 Power Management Integrated Circuit
maintainers:
- Jakob Hauser <jahau@rocketmail.com>
description:
RT5033 is a multifunction device which includes battery charger, fuel gauge,
flash LED current source, LDO and synchronous Buck converter for portable
applications. It is interfaced to host controller using I2C interface. The
battery fuel gauge uses a separate I2C bus.
properties:
compatible:
const: richtek,rt5033
reg:
maxItems: 1
interrupts:
maxItems: 1
regulators:
description:
The regulators of RT5033 have to be instantiated under a sub-node named
"regulators". For SAFE_LDO voltage there is only one value of 4.9 V. LDO
voltage ranges from 1.2 V to 3.0 V in 0.1 V steps. BUCK voltage ranges
from 1.0 V to 3.0 V in 0.1 V steps.
type: object
patternProperties:
"^(SAFE_LDO|LDO|BUCK)$":
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
additionalProperties: false
charger:
type: object
$ref: /schemas/power/supply/richtek,rt5033-charger.yaml#
required:
- compatible
- reg
- interrupts
additionalProperties: false
examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
battery: battery {
compatible = "simple-battery";
precharge-current-microamp = <450000>;
constant-charge-current-max-microamp = <1000000>;
charge-term-current-microamp = <150000>;
precharge-upper-limit-microvolt = <3500000>;
constant-charge-voltage-max-microvolt = <4350000>;
};
extcon {
usb_con: connector {
compatible = "usb-b-connector";
label = "micro-USB";
type = "micro";
};
};
i2c {
#address-cells = <1>;
#size-cells = <0>;
i2c@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
fuel-gauge@35 {
compatible = "richtek,rt5033-battery";
reg = <0x35>;
interrupt-parent = <&msmgpio>;
interrupts = <121 IRQ_TYPE_EDGE_FALLING>;
pinctrl-names = "default";
pinctrl-0 = <&fg_alert_default>;
power-supplies = <&rt5033_charger>;
};
};
i2c@1 {
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;
pmic@34 {
compatible = "richtek,rt5033";
reg = <0x34>;
interrupt-parent = <&msmgpio>;
interrupts = <62 IRQ_TYPE_EDGE_FALLING>;
pinctrl-names = "default";
pinctrl-0 = <&pmic_int_default>;
regulators {
safe_ldo_reg: SAFE_LDO {
regulator-name = "SAFE_LDO";
regulator-min-microvolt = <4900000>;
regulator-max-microvolt = <4900000>;
regulator-always-on;
};
ldo_reg: LDO {
regulator-name = "LDO";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
};
buck_reg: BUCK {
regulator-name = "BUCK";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1200000>;
};
};
rt5033_charger: charger {
compatible = "richtek,rt5033-charger";
monitored-battery = <&battery>;
richtek,usb-connector = <&usb_con>;
};
};
};
};

View File

@ -153,29 +153,18 @@ dependencies:
additionalProperties: false
allOf:
- if:
- not:
required:
- s5m8767,pmic-buck2-uses-gpio-dvs
then:
properties:
s5m8767,pmic-buck3-uses-gpio-dvs: false
s5m8767,pmic-buck4-uses-gpio-dvs: false
- if:
- s5m8767,pmic-buck3-uses-gpio-dvs
- not:
required:
- s5m8767,pmic-buck2-uses-gpio-dvs
- s5m8767,pmic-buck4-uses-gpio-dvs
- not:
required:
- s5m8767,pmic-buck3-uses-gpio-dvs
then:
properties:
s5m8767,pmic-buck2-uses-gpio-dvs: false
s5m8767,pmic-buck4-uses-gpio-dvs: false
- if:
required:
- s5m8767,pmic-buck4-uses-gpio-dvs
then:
properties:
s5m8767,pmic-buck2-uses-gpio-dvs: false
s5m8767,pmic-buck3-uses-gpio-dvs: false
examples:
- |

View File

@ -184,7 +184,7 @@ properties:
additionalProperties: false
patternProperties:
"^(buck[1-4]|ldo[1-6]|boost|pwr_sw[1-2])-supply$":
"^(buck[1-4]|ldo[1-6]|vref_ddr|boost|pwr_sw[1-2])-supply$":
description: STPMIC1 voltage regulators supplies
"^(buck[1-4]|ldo[1-6]|boost|vref_ddr|pwr_sw[1-2])$":

View File

@ -0,0 +1,193 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/mfd/ti,tps6594.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: TI TPS6594 Power Management Integrated Circuit
maintainers:
- Julien Panis <jpanis@baylibre.com>
description:
TPS6594 is a Power Management IC which provides regulators and others
features like GPIOs, RTC, watchdog, ESMs (Error Signal Monitor), and
PFSM (Pre-configurable Finite State Machine) managing the state of the device.
TPS6594 is the super-set device while TPS6593 and LP8764 are derivatives.
properties:
compatible:
enum:
- ti,lp8764-q1
- ti,tps6593-q1
- ti,tps6594-q1
reg:
description: I2C slave address or SPI chip select number.
maxItems: 1
ti,primary-pmic:
type: boolean
description: |
Identify the primary PMIC on SPMI bus.
A multi-PMIC synchronization scheme is implemented in the PMIC device
to synchronize the power state changes with other PMIC devices. This is
accomplished through a SPMI bus: the primary PMIC is the controller
device on the SPMI bus, and the secondary PMICs are the target devices
on the SPMI bus.
system-power-controller: true
gpio-controller: true
'#gpio-cells':
const: 2
description: |
The first cell is the pin number, the second cell is used to specify flags.
See ../gpio/gpio.txt for more information.
interrupts:
maxItems: 1
regulators:
type: object
description: List of regulators provided by this controller.
patternProperties:
"^buck([1-5]|12|34|123|1234)$":
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
"^ldo[1-4]$":
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
allOf:
- if:
required:
- buck12
then:
properties:
buck123: false
buck1234: false
- if:
required:
- buck123
then:
properties:
buck34: false
- if:
required:
- buck1234
then:
properties:
buck34: false
additionalProperties: false
patternProperties:
"^buck([1-5]|12|34|123|1234)-supply$":
description: Input supply phandle for each buck.
"^ldo[1-4]-supply$":
description: Input supply phandle for each ldo.
required:
- compatible
- reg
- interrupts
additionalProperties: false
examples:
- |
#include <dt-bindings/interrupt-controller/arm-gic.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
tps6593: pmic@48 {
compatible = "ti,tps6593-q1";
reg = <0x48>;
ti,primary-pmic;
system-power-controller;
gpio-controller;
#gpio-cells = <2>;
pinctrl-names = "default";
pinctrl-0 = <&pmic_irq_pins_default>;
interrupt-parent = <&mcu_gpio0>;
interrupts = <0 IRQ_TYPE_EDGE_FALLING>;
buck123-supply = <&vcc_3v3_sys>;
buck4-supply = <&vcc_3v3_sys>;
buck5-supply = <&vcc_3v3_sys>;
ldo1-supply = <&vcc_3v3_sys>;
ldo2-supply = <&vcc_3v3_sys>;
ldo3-supply = <&buck5>;
ldo4-supply = <&vcc_3v3_sys>;
regulators {
buck123: buck123 {
regulator-name = "vcc_core";
regulator-min-microvolt = <750000>;
regulator-max-microvolt = <850000>;
regulator-boot-on;
regulator-always-on;
};
buck4: buck4 {
regulator-name = "vcc_1v1";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1100000>;
regulator-boot-on;
regulator-always-on;
};
buck5: buck5 {
regulator-name = "vcc_1v8_sys";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-boot-on;
regulator-always-on;
};
ldo1: ldo1 {
regulator-name = "vddshv5_sdio";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
regulator-always-on;
};
ldo2: ldo2 {
regulator-name = "vpp_1v8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-boot-on;
regulator-always-on;
};
ldo3: ldo3 {
regulator-name = "vcc_0v85";
regulator-min-microvolt = <850000>;
regulator-max-microvolt = <850000>;
regulator-boot-on;
regulator-always-on;
};
ldo4: ldo4 {
regulator-name = "vdda_1v8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-boot-on;
regulator-always-on;
};
};
};
};

View File

@ -90,6 +90,7 @@ properties:
oneOf:
- enum:
- x-powers,axp152
- x-powers,axp192
- x-powers,axp202
- x-powers,axp209
- x-powers,axp221

View File

@ -26,7 +26,7 @@ required:
- compatible
- reg
additionalProperties: false
unevaluatedProperties: false
examples:
- |

View File

@ -0,0 +1,65 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/supply/richtek,rt5033-charger.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Richtek RT5033 PMIC Battery Charger
maintainers:
- Jakob Hauser <jahau@rocketmail.com>
description:
The battery charger of the multifunction device RT5033 has to be instantiated
under sub-node named "charger" using the following format.
properties:
compatible:
const: richtek,rt5033-charger
monitored-battery:
$ref: /schemas/types.yaml#/definitions/phandle
description: |
Phandle to the monitored battery according to battery.yaml. The battery
node needs to contain five parameters.
precharge-current-microamp:
Current of pre-charge mode. The pre-charge current levels are 350 mA
to 650 mA programmed by I2C per 100 mA.
constant-charge-current-max-microamp:
Current of fast-charge mode. The fast-charge current levels are 700 mA
to 2000 mA programmed by I2C per 100 mA.
charge-term-current-microamp:
This property is end of charge current. Its level ranges from 150 mA
to 600 mA. Between 150 mA and 300 mA in 50 mA steps, between 300 mA and
600 mA in 100 mA steps.
precharge-upper-limit-microvolt:
Voltage of pre-charge mode. If the battery voltage is below the pre-charge
threshold voltage, the charger is in pre-charge mode with pre-charge
current. Its levels are 2.3 V to 3.8 V programmed by I2C per 0.1 V.
constant-charge-voltage-max-microvolt:
Battery regulation voltage of constant voltage mode. This voltage levels
from 3.65 V to 4.4 V by I2C per 0.025 V.
richtek,usb-connector:
$ref: /schemas/types.yaml#/definitions/phandle
description:
Phandle to a USB connector according to usb-connector.yaml. The connector
should be a child of the extcon device.
required:
- monitored-battery
additionalProperties: false
examples:
- |
charger {
compatible = "richtek,rt5033-charger";
monitored-battery = <&battery>;
richtek,usb-connector = <&usb_con>;
};

View File

@ -0,0 +1,38 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/adi,max77541-regulator.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Buck Converter for MAX77540/MAX77541
maintainers:
- Okan Sahin <okan.sahin@analog.com>
description: |
This is a part of device tree bindings for ADI MAX77540/MAX77541
The buck converter is represented as a sub-node of the PMIC node on the device tree.
The device has two buck regulators.
See also Documentation/devicetree/bindings/mfd/adi,max77541.yaml for
additional information and example.
patternProperties:
"^buck[12]$":
type: object
$ref: regulator.yaml#
additionalProperties: false
description: |
Buck regulator.
properties:
regulator-name: true
regulator-always-on: true
regulator-boot-on: true
regulator-min-microvolt:
minimum: 300000
regulator-max-microvolt:
maximum: 5200000
additionalProperties: false

View File

@ -376,12 +376,11 @@ static enum fw_upload_err rsu_update_init(struct m10bmc_sec *sec)
u32 doorbell_reg, progress, status;
int ret, err;
ret = regmap_update_bits(sec->m10bmc->regmap,
csr_map->base + csr_map->doorbell,
DRBL_RSU_REQUEST | DRBL_HOST_STATUS,
DRBL_RSU_REQUEST |
FIELD_PREP(DRBL_HOST_STATUS,
HOST_STATUS_IDLE));
ret = m10bmc_sys_update_bits(sec->m10bmc, csr_map->doorbell,
DRBL_RSU_REQUEST | DRBL_HOST_STATUS,
DRBL_RSU_REQUEST |
FIELD_PREP(DRBL_HOST_STATUS,
HOST_STATUS_IDLE));
if (ret)
return FW_UPLOAD_ERR_RW_ERROR;
@ -450,11 +449,10 @@ static enum fw_upload_err rsu_send_data(struct m10bmc_sec *sec)
u32 doorbell_reg, status;
int ret;
ret = regmap_update_bits(sec->m10bmc->regmap,
csr_map->base + csr_map->doorbell,
DRBL_HOST_STATUS,
FIELD_PREP(DRBL_HOST_STATUS,
HOST_STATUS_WRITE_DONE));
ret = m10bmc_sys_update_bits(sec->m10bmc, csr_map->doorbell,
DRBL_HOST_STATUS,
FIELD_PREP(DRBL_HOST_STATUS,
HOST_STATUS_WRITE_DONE));
if (ret)
return FW_UPLOAD_ERR_RW_ERROR;
@ -517,11 +515,10 @@ static enum fw_upload_err rsu_cancel(struct m10bmc_sec *sec)
if (rsu_prog(doorbell) != RSU_PROG_READY)
return FW_UPLOAD_ERR_BUSY;
ret = regmap_update_bits(sec->m10bmc->regmap,
csr_map->base + csr_map->doorbell,
DRBL_HOST_STATUS,
FIELD_PREP(DRBL_HOST_STATUS,
HOST_STATUS_ABORT_RSU));
ret = m10bmc_sys_update_bits(sec->m10bmc, csr_map->doorbell,
DRBL_HOST_STATUS,
FIELD_PREP(DRBL_HOST_STATUS,
HOST_STATUS_ABORT_RSU));
if (ret)
return FW_UPLOAD_ERR_RW_ERROR;
@ -547,21 +544,28 @@ static enum fw_upload_err m10bmc_sec_prepare(struct fw_upload *fwl,
if (ret != FW_UPLOAD_ERR_NONE)
goto unlock_flash;
m10bmc_fw_state_set(sec->m10bmc, M10BMC_FW_STATE_SEC_UPDATE_PREPARE);
ret = rsu_update_init(sec);
if (ret != FW_UPLOAD_ERR_NONE)
goto unlock_flash;
goto fw_state_exit;
ret = rsu_prog_ready(sec);
if (ret != FW_UPLOAD_ERR_NONE)
goto unlock_flash;
goto fw_state_exit;
if (sec->cancel_request) {
ret = rsu_cancel(sec);
goto unlock_flash;
goto fw_state_exit;
}
m10bmc_fw_state_set(sec->m10bmc, M10BMC_FW_STATE_SEC_UPDATE_WRITE);
return FW_UPLOAD_ERR_NONE;
fw_state_exit:
m10bmc_fw_state_set(sec->m10bmc, M10BMC_FW_STATE_NORMAL);
unlock_flash:
if (sec->m10bmc->flash_bulk_ops)
sec->m10bmc->flash_bulk_ops->unlock_write(sec->m10bmc);
@ -610,6 +614,8 @@ static enum fw_upload_err m10bmc_sec_poll_complete(struct fw_upload *fwl)
if (sec->cancel_request)
return rsu_cancel(sec);
m10bmc_fw_state_set(sec->m10bmc, M10BMC_FW_STATE_SEC_UPDATE_PROGRAM);
result = rsu_send_data(sec);
if (result != FW_UPLOAD_ERR_NONE)
return result;
@ -653,6 +659,8 @@ static void m10bmc_sec_cleanup(struct fw_upload *fwl)
(void)rsu_cancel(sec);
m10bmc_fw_state_set(sec->m10bmc, M10BMC_FW_STATE_NORMAL);
if (sec->m10bmc->flash_bulk_ops)
sec->m10bmc->flash_bulk_ops->unlock_write(sec->m10bmc);
}
@ -764,3 +772,4 @@ module_platform_driver(intel_m10bmc_sec_driver);
MODULE_AUTHOR("Intel Corporation");
MODULE_DESCRIPTION("Intel MAX10 BMC Secure Update");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(INTEL_M10_BMC_CORE);

View File

@ -794,3 +794,4 @@ MODULE_DEVICE_TABLE(platform, intel_m10bmc_hwmon_ids);
MODULE_AUTHOR("Intel Corporation");
MODULE_DESCRIPTION("Intel MAX 10 BMC hardware monitor");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(INTEL_M10_BMC_CORE);

View File

@ -735,6 +735,17 @@ config MAX1363
To compile this driver as a module, choose M here: the module will be
called max1363.
config MAX77541_ADC
tristate "Analog Devices MAX77541 ADC driver"
depends on MFD_MAX77541
help
This driver controls a Analog Devices MAX77541 ADC
via I2C bus. This device has one adc. Say yes here to build
support for Analog Devices MAX77541 ADC interface.
To compile this driver as a module, choose M here:
the module will be called max77541-adc.
config MAX9611
tristate "Maxim max9611/max9612 ADC driver"
depends on I2C

View File

@ -67,6 +67,7 @@ obj-$(CONFIG_MAX11205) += max11205.o
obj-$(CONFIG_MAX11410) += max11410.o
obj-$(CONFIG_MAX1241) += max1241.o
obj-$(CONFIG_MAX1363) += max1363.o
obj-$(CONFIG_MAX77541_ADC) += max77541-adc.o
obj-$(CONFIG_MAX9611) += max9611.o
obj-$(CONFIG_MCP320X) += mcp320x.o
obj-$(CONFIG_MCP3422) += mcp3422.o

View File

@ -0,0 +1,194 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2022 Analog Devices, Inc.
* ADI MAX77541 ADC Driver with IIO interface
*/
#include <linux/bitfield.h>
#include <linux/iio/iio.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/units.h>
#include <linux/mfd/max77541.h>
enum max77541_adc_range {
LOW_RANGE,
MID_RANGE,
HIGH_RANGE,
};
enum max77541_adc_channel {
MAX77541_ADC_VSYS_V,
MAX77541_ADC_VOUT1_V,
MAX77541_ADC_VOUT2_V,
MAX77541_ADC_TEMP,
};
static int max77541_adc_offset(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2)
{
switch (chan->channel) {
case MAX77541_ADC_TEMP:
*val = DIV_ROUND_CLOSEST(ABSOLUTE_ZERO_MILLICELSIUS, 1725);
return IIO_VAL_INT;
default:
return -EINVAL;
}
}
static int max77541_adc_scale(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2)
{
struct regmap **regmap = iio_priv(indio_dev);
unsigned int reg_val;
int ret;
switch (chan->channel) {
case MAX77541_ADC_VSYS_V:
*val = 25;
return IIO_VAL_INT;
case MAX77541_ADC_VOUT1_V:
case MAX77541_ADC_VOUT2_V:
ret = regmap_read(*regmap, MAX77541_REG_M2_CFG1, &reg_val);
if (ret)
return ret;
reg_val = FIELD_GET(MAX77541_BITS_MX_CFG1_RNG, reg_val);
switch (reg_val) {
case LOW_RANGE:
*val = 6;
*val2 = 250000;
break;
case MID_RANGE:
*val = 12;
*val2 = 500000;
break;
case HIGH_RANGE:
*val = 25;
return IIO_VAL_INT;
default:
return -EINVAL;
}
return IIO_VAL_INT_PLUS_MICRO;
case MAX77541_ADC_TEMP:
*val = 1725;
return IIO_VAL_INT;
default:
return -EINVAL;
}
}
static int max77541_adc_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val)
{
struct regmap **regmap = iio_priv(indio_dev);
int ret;
ret = regmap_read(*regmap, chan->address, val);
if (ret)
return ret;
return IIO_VAL_INT;
}
#define MAX77541_ADC_CHANNEL_V(_channel, _name, _type, _reg) \
{ \
.type = _type, \
.indexed = 1, \
.channel = _channel, \
.address = _reg, \
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
BIT(IIO_CHAN_INFO_SCALE), \
.datasheet_name = _name, \
}
#define MAX77541_ADC_CHANNEL_TEMP(_channel, _name, _type, _reg) \
{ \
.type = _type, \
.indexed = 1, \
.channel = _channel, \
.address = _reg, \
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
BIT(IIO_CHAN_INFO_SCALE) |\
BIT(IIO_CHAN_INFO_OFFSET),\
.datasheet_name = _name, \
}
static const struct iio_chan_spec max77541_adc_channels[] = {
MAX77541_ADC_CHANNEL_V(MAX77541_ADC_VSYS_V, "vsys_v", IIO_VOLTAGE,
MAX77541_REG_ADC_DATA_CH1),
MAX77541_ADC_CHANNEL_V(MAX77541_ADC_VOUT1_V, "vout1_v", IIO_VOLTAGE,
MAX77541_REG_ADC_DATA_CH2),
MAX77541_ADC_CHANNEL_V(MAX77541_ADC_VOUT2_V, "vout2_v", IIO_VOLTAGE,
MAX77541_REG_ADC_DATA_CH3),
MAX77541_ADC_CHANNEL_TEMP(MAX77541_ADC_TEMP, "temp", IIO_TEMP,
MAX77541_REG_ADC_DATA_CH6),
};
static int max77541_adc_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{
switch (mask) {
case IIO_CHAN_INFO_OFFSET:
return max77541_adc_offset(indio_dev, chan, val, val2);
case IIO_CHAN_INFO_SCALE:
return max77541_adc_scale(indio_dev, chan, val, val2);
case IIO_CHAN_INFO_RAW:
return max77541_adc_raw(indio_dev, chan, val);
default:
return -EINVAL;
}
}
static const struct iio_info max77541_adc_info = {
.read_raw = max77541_adc_read_raw,
};
static int max77541_adc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct iio_dev *indio_dev;
struct regmap **regmap;
indio_dev = devm_iio_device_alloc(dev, sizeof(*regmap));
if (!indio_dev)
return -ENOMEM;
regmap = iio_priv(indio_dev);
*regmap = dev_get_regmap(dev->parent, NULL);
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->name = "max77541";
indio_dev->info = &max77541_adc_info;
indio_dev->channels = max77541_adc_channels;
indio_dev->num_channels = ARRAY_SIZE(max77541_adc_channels);
return devm_iio_device_register(dev, indio_dev);
}
static const struct platform_device_id max77541_adc_platform_id[] = {
{ "max77541-adc" },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, max77541_adc_platform_id);
static struct platform_driver max77541_adc_driver = {
.driver = {
.name = "max77541-adc",
},
.probe = max77541_adc_probe,
.id_table = max77541_adc_platform_id,
};
module_platform_driver(max77541_adc_driver);
MODULE_AUTHOR("Okan Sahin <Okan.Sahin@analog.com>");
MODULE_DESCRIPTION("MAX77541 ADC driver");
MODULE_LICENSE("GPL");

View File

@ -597,7 +597,7 @@ static struct i2c_driver pm800_driver = {
.name = "88PM800",
.pm = pm_sleep_ptr(&pm80x_pm_ops),
},
.probe_new = pm800_probe,
.probe = pm800_probe,
.remove = pm800_remove,
.id_table = pm80x_id_table,
};

View File

@ -253,7 +253,7 @@ static struct i2c_driver pm805_driver = {
.name = "88PM805",
.pm = pm_sleep_ptr(&pm80x_pm_ops),
},
.probe_new = pm805_probe,
.probe = pm805_probe,
.remove = pm805_remove,
.id_table = pm80x_id_table,
};

View File

@ -74,7 +74,6 @@ int pm80x_init(struct i2c_client *client)
chip->irq = client->irq;
chip->dev = &client->dev;
dev_set_drvdata(chip->dev, chip);
i2c_set_clientdata(chip->client, chip);
ret = regmap_read(chip->regmap, PM80X_CHIP_ID, &val);

View File

@ -1166,7 +1166,6 @@ static int pm860x_probe(struct i2c_client *client)
chip->client = client;
i2c_set_clientdata(client, chip);
chip->dev = &client->dev;
dev_set_drvdata(chip->dev, chip);
/*
* Both client and companion client shares same platform driver.
@ -1251,7 +1250,7 @@ static struct i2c_driver pm860x_driver = {
.pm = pm_sleep_ptr(&pm860x_pm_ops),
.of_match_table = pm860x_dt_ids,
},
.probe_new = pm860x_probe,
.probe = pm860x_probe,
.remove = pm860x_remove,
.id_table = pm860x_id_table,
};

View File

@ -266,8 +266,8 @@ config MFD_MADERA_SPI
Support for the Cirrus Logic Madera platform audio SoC
core functionality controlled via SPI.
config MFD_MAX597X
tristate "Maxim 597x power switch and monitor"
config MFD_MAX5970
tristate "Maxim 5970/5978 power switch and monitor"
depends on (I2C && OF)
select MFD_SIMPLE_MFD_I2C
help
@ -784,6 +784,19 @@ config MFD_MAX14577
additional drivers must be enabled in order to use the functionality
of the device.
config MFD_MAX77541
tristate "Analog Devices MAX77541/77540 PMIC Support"
depends on I2C=y
select MFD_CORE
select REGMAP_I2C
select REGMAP_IRQ
help
Say yes here to add support for Analog Devices MAX77541 and
MAX77540 Power Management ICs. This driver provides
common support for accessing the device; additional drivers
must be enabled in order to use the functionality of the device.
There are regulators and adc.
config MFD_MAX77620
bool "Maxim Semiconductor MAX77620 and MAX20024 PMIC Support"
depends on I2C=y

View File

@ -154,6 +154,7 @@ obj-$(CONFIG_MFD_DA9063) += da9063.o
obj-$(CONFIG_MFD_DA9150) += da9150-core.o
obj-$(CONFIG_MFD_MAX14577) += max14577.o
obj-$(CONFIG_MFD_MAX77541) += max77541.o
obj-$(CONFIG_MFD_MAX77620) += max77620.o
obj-$(CONFIG_MFD_MAX77650) += max77650.o
obj-$(CONFIG_MFD_MAX77686) += max77686.o

View File

@ -345,8 +345,6 @@ static int aat2870_i2c_probe(struct i2c_client *client)
return -ENOMEM;
aat2870->dev = &client->dev;
dev_set_drvdata(aat2870->dev, aat2870);
aat2870->client = client;
i2c_set_clientdata(client, aat2870);
@ -451,7 +449,7 @@ static struct i2c_driver aat2870_i2c_driver = {
.pm = pm_sleep_ptr(&aat2870_pm_ops),
.suppress_bind_attrs = true,
},
.probe_new = aat2870_i2c_probe,
.probe = aat2870_i2c_probe,
.id_table = aat2870_i2c_id_table,
};

View File

@ -190,7 +190,7 @@ static struct i2c_driver a500_ec_driver = {
.name = "acer-a500-embedded-controller",
.of_match_table = a500_ec_match,
},
.probe_new = a500_ec_probe,
.probe = a500_ec_probe,
.remove = a500_ec_remove,
};
module_i2c_driver(a500_ec_driver);

View File

@ -70,7 +70,7 @@ static struct i2c_driver act8945a_i2c_driver = {
.name = "act8945a",
.of_match_table = of_match_ptr(act8945a_of_match),
},
.probe_new = act8945a_i2c_probe,
.probe = act8945a_i2c_probe,
.id_table = act8945a_i2c_id,
};

View File

@ -340,7 +340,7 @@ static struct i2c_driver adp5520_driver = {
.pm = pm_sleep_ptr(&adp5520_pm),
.suppress_bind_attrs = true,
},
.probe_new = adp5520_probe,
.probe = adp5520_probe,
.id_table = adp5520_id,
};
builtin_i2c_driver(adp5520_driver);

View File

@ -121,7 +121,7 @@ static struct i2c_driver arizona_i2c_driver = {
.pm = pm_ptr(&arizona_pm_ops),
.of_match_table = of_match_ptr(arizona_i2c_of_match),
},
.probe_new = arizona_i2c_probe,
.probe = arizona_i2c_probe,
.remove = arizona_i2c_remove,
.id_table = arizona_i2c_id,
};

View File

@ -201,7 +201,7 @@ static struct i2c_driver as3711_i2c_driver = {
.name = "as3711",
.of_match_table = of_match_ptr(as3711_of_match),
},
.probe_new = as3711_i2c_probe,
.probe = as3711_i2c_probe,
.id_table = as3711_i2c_id,
};

View File

@ -445,7 +445,7 @@ static struct i2c_driver as3722_i2c_driver = {
.of_match_table = as3722_of_match,
.pm = &as3722_pm_ops,
},
.probe_new = as3722_i2c_probe,
.probe = as3722_i2c_probe,
.id_table = as3722_i2c_id,
};

View File

@ -53,7 +53,7 @@ static struct i2c_driver atc260x_i2c_driver = {
.name = "atc260x",
.of_match_table = atc260x_i2c_of_match,
},
.probe_new = atc260x_i2c_probe,
.probe = atc260x_i2c_probe,
};
module_i2c_driver(atc260x_i2c_driver);

View File

@ -59,6 +59,7 @@ static void axp20x_i2c_remove(struct i2c_client *i2c)
#ifdef CONFIG_OF
static const struct of_device_id axp20x_i2c_of_match[] = {
{ .compatible = "x-powers,axp152", .data = (void *)AXP152_ID },
{ .compatible = "x-powers,axp192", .data = (void *)AXP192_ID },
{ .compatible = "x-powers,axp202", .data = (void *)AXP202_ID },
{ .compatible = "x-powers,axp209", .data = (void *)AXP209_ID },
{ .compatible = "x-powers,axp221", .data = (void *)AXP221_ID },
@ -74,6 +75,7 @@ MODULE_DEVICE_TABLE(of, axp20x_i2c_of_match);
static const struct i2c_device_id axp20x_i2c_id[] = {
{ "axp152", 0 },
{ "axp192", 0 },
{ "axp202", 0 },
{ "axp209", 0 },
{ "axp221", 0 },
@ -103,7 +105,7 @@ static struct i2c_driver axp20x_i2c_driver = {
.of_match_table = of_match_ptr(axp20x_i2c_of_match),
.acpi_match_table = ACPI_PTR(axp20x_i2c_acpi_match),
},
.probe_new = axp20x_i2c_probe,
.probe = axp20x_i2c_probe,
.remove = axp20x_i2c_remove,
.id_table = axp20x_i2c_id,
};

View File

@ -34,6 +34,7 @@
static const char * const axp20x_model_names[] = {
"AXP152",
"AXP192",
"AXP202",
"AXP209",
"AXP221",
@ -94,6 +95,35 @@ static const struct regmap_access_table axp20x_volatile_table = {
.n_yes_ranges = ARRAY_SIZE(axp20x_volatile_ranges),
};
static const struct regmap_range axp192_writeable_ranges[] = {
regmap_reg_range(AXP192_DATACACHE(0), AXP192_DATACACHE(5)),
regmap_reg_range(AXP192_PWR_OUT_CTRL, AXP192_IRQ5_STATE),
regmap_reg_range(AXP20X_DCDC_MODE, AXP192_N_RSTO_CTRL),
regmap_reg_range(AXP20X_CC_CTRL, AXP20X_CC_CTRL),
};
static const struct regmap_range axp192_volatile_ranges[] = {
regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP192_USB_OTG_STATUS),
regmap_reg_range(AXP192_IRQ1_STATE, AXP192_IRQ4_STATE),
regmap_reg_range(AXP192_IRQ5_STATE, AXP192_IRQ5_STATE),
regmap_reg_range(AXP20X_ACIN_V_ADC_H, AXP20X_IPSOUT_V_HIGH_L),
regmap_reg_range(AXP20X_TIMER_CTRL, AXP20X_TIMER_CTRL),
regmap_reg_range(AXP192_GPIO2_0_STATE, AXP192_GPIO2_0_STATE),
regmap_reg_range(AXP192_GPIO4_3_STATE, AXP192_GPIO4_3_STATE),
regmap_reg_range(AXP192_N_RSTO_CTRL, AXP192_N_RSTO_CTRL),
regmap_reg_range(AXP20X_CHRG_CC_31_24, AXP20X_CC_CTRL),
};
static const struct regmap_access_table axp192_writeable_table = {
.yes_ranges = axp192_writeable_ranges,
.n_yes_ranges = ARRAY_SIZE(axp192_writeable_ranges),
};
static const struct regmap_access_table axp192_volatile_table = {
.yes_ranges = axp192_volatile_ranges,
.n_yes_ranges = ARRAY_SIZE(axp192_volatile_ranges),
};
/* AXP22x ranges are shared with the AXP809, as they cover the same range */
static const struct regmap_range axp22x_writeable_ranges[] = {
regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
@ -220,6 +250,19 @@ static const struct resource axp152_pek_resources[] = {
DEFINE_RES_IRQ_NAMED(AXP152_IRQ_PEK_FAL_EDGE, "PEK_DBF"),
};
static const struct resource axp192_ac_power_supply_resources[] = {
DEFINE_RES_IRQ_NAMED(AXP192_IRQ_ACIN_PLUGIN, "ACIN_PLUGIN"),
DEFINE_RES_IRQ_NAMED(AXP192_IRQ_ACIN_REMOVAL, "ACIN_REMOVAL"),
DEFINE_RES_IRQ_NAMED(AXP192_IRQ_ACIN_OVER_V, "ACIN_OVER_V"),
};
static const struct resource axp192_usb_power_supply_resources[] = {
DEFINE_RES_IRQ_NAMED(AXP192_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"),
DEFINE_RES_IRQ_NAMED(AXP192_IRQ_VBUS_REMOVAL, "VBUS_REMOVAL"),
DEFINE_RES_IRQ_NAMED(AXP192_IRQ_VBUS_VALID, "VBUS_VALID"),
DEFINE_RES_IRQ_NAMED(AXP192_IRQ_VBUS_NOT_VALID, "VBUS_NOT_VALID"),
};
static const struct resource axp20x_ac_power_supply_resources[] = {
DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_ACIN_PLUGIN, "ACIN_PLUGIN"),
DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_ACIN_REMOVAL, "ACIN_REMOVAL"),
@ -302,6 +345,15 @@ static const struct regmap_config axp152_regmap_config = {
.cache_type = REGCACHE_RBTREE,
};
static const struct regmap_config axp192_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.wr_table = &axp192_writeable_table,
.volatile_table = &axp192_volatile_table,
.max_register = AXP20X_CC_CTRL,
.cache_type = REGCACHE_RBTREE,
};
static const struct regmap_config axp20x_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
@ -379,6 +431,42 @@ static const struct regmap_irq axp152_regmap_irqs[] = {
INIT_REGMAP_IRQ(AXP152, GPIO0_INPUT, 2, 0),
};
static const struct regmap_irq axp192_regmap_irqs[] = {
INIT_REGMAP_IRQ(AXP192, ACIN_OVER_V, 0, 7),
INIT_REGMAP_IRQ(AXP192, ACIN_PLUGIN, 0, 6),
INIT_REGMAP_IRQ(AXP192, ACIN_REMOVAL, 0, 5),
INIT_REGMAP_IRQ(AXP192, VBUS_OVER_V, 0, 4),
INIT_REGMAP_IRQ(AXP192, VBUS_PLUGIN, 0, 3),
INIT_REGMAP_IRQ(AXP192, VBUS_REMOVAL, 0, 2),
INIT_REGMAP_IRQ(AXP192, VBUS_V_LOW, 0, 1),
INIT_REGMAP_IRQ(AXP192, BATT_PLUGIN, 1, 7),
INIT_REGMAP_IRQ(AXP192, BATT_REMOVAL, 1, 6),
INIT_REGMAP_IRQ(AXP192, BATT_ENT_ACT_MODE, 1, 5),
INIT_REGMAP_IRQ(AXP192, BATT_EXIT_ACT_MODE, 1, 4),
INIT_REGMAP_IRQ(AXP192, CHARG, 1, 3),
INIT_REGMAP_IRQ(AXP192, CHARG_DONE, 1, 2),
INIT_REGMAP_IRQ(AXP192, BATT_TEMP_HIGH, 1, 1),
INIT_REGMAP_IRQ(AXP192, BATT_TEMP_LOW, 1, 0),
INIT_REGMAP_IRQ(AXP192, DIE_TEMP_HIGH, 2, 7),
INIT_REGMAP_IRQ(AXP192, CHARG_I_LOW, 2, 6),
INIT_REGMAP_IRQ(AXP192, DCDC1_V_LONG, 2, 5),
INIT_REGMAP_IRQ(AXP192, DCDC2_V_LONG, 2, 4),
INIT_REGMAP_IRQ(AXP192, DCDC3_V_LONG, 2, 3),
INIT_REGMAP_IRQ(AXP192, PEK_SHORT, 2, 1),
INIT_REGMAP_IRQ(AXP192, PEK_LONG, 2, 0),
INIT_REGMAP_IRQ(AXP192, N_OE_PWR_ON, 3, 7),
INIT_REGMAP_IRQ(AXP192, N_OE_PWR_OFF, 3, 6),
INIT_REGMAP_IRQ(AXP192, VBUS_VALID, 3, 5),
INIT_REGMAP_IRQ(AXP192, VBUS_NOT_VALID, 3, 4),
INIT_REGMAP_IRQ(AXP192, VBUS_SESS_VALID, 3, 3),
INIT_REGMAP_IRQ(AXP192, VBUS_SESS_END, 3, 2),
INIT_REGMAP_IRQ(AXP192, LOW_PWR_LVL, 3, 0),
INIT_REGMAP_IRQ(AXP192, TIMER, 4, 7),
INIT_REGMAP_IRQ(AXP192, GPIO2_INPUT, 4, 2),
INIT_REGMAP_IRQ(AXP192, GPIO1_INPUT, 4, 1),
INIT_REGMAP_IRQ(AXP192, GPIO0_INPUT, 4, 0),
};
static const struct regmap_irq axp20x_regmap_irqs[] = {
INIT_REGMAP_IRQ(AXP20X, ACIN_OVER_V, 0, 7),
INIT_REGMAP_IRQ(AXP20X, ACIN_PLUGIN, 0, 6),
@ -615,6 +703,32 @@ static const struct regmap_irq_chip axp152_regmap_irq_chip = {
.num_regs = 3,
};
static unsigned int axp192_get_irq_reg(struct regmap_irq_chip_data *data,
unsigned int base, int index)
{
/* linear mapping for IRQ1 to IRQ4 */
if (index < 4)
return base + index;
/* handle IRQ5 separately */
if (base == AXP192_IRQ1_EN)
return AXP192_IRQ5_EN;
return AXP192_IRQ5_STATE;
}
static const struct regmap_irq_chip axp192_regmap_irq_chip = {
.name = "axp192_irq_chip",
.status_base = AXP192_IRQ1_STATE,
.ack_base = AXP192_IRQ1_STATE,
.unmask_base = AXP192_IRQ1_EN,
.init_ack_masked = true,
.irqs = axp192_regmap_irqs,
.num_irqs = ARRAY_SIZE(axp192_regmap_irqs),
.num_regs = 5,
.get_irq_reg = axp192_get_irq_reg,
};
static const struct regmap_irq_chip axp20x_regmap_irq_chip = {
.name = "axp20x_irq_chip",
.status_base = AXP20X_IRQ1_STATE,
@ -705,6 +819,27 @@ static const struct regmap_irq_chip axp15060_regmap_irq_chip = {
.num_regs = 2,
};
static const struct mfd_cell axp192_cells[] = {
{
.name = "axp192-adc",
.of_compatible = "x-powers,axp192-adc",
}, {
.name = "axp20x-battery-power-supply",
.of_compatible = "x-powers,axp192-battery-power-supply",
}, {
.name = "axp20x-ac-power-supply",
.of_compatible = "x-powers,axp202-ac-power-supply",
.num_resources = ARRAY_SIZE(axp192_ac_power_supply_resources),
.resources = axp192_ac_power_supply_resources,
}, {
.name = "axp20x-usb-power-supply",
.of_compatible = "x-powers,axp192-usb-power-supply",
.num_resources = ARRAY_SIZE(axp192_usb_power_supply_resources),
.resources = axp192_usb_power_supply_resources,
},
{ .name = "axp20x-regulator" },
};
static const struct mfd_cell axp20x_cells[] = {
{
.name = "axp20x-gpio",
@ -1022,6 +1157,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
axp20x->regmap_cfg = &axp152_regmap_config;
axp20x->regmap_irq_chip = &axp152_regmap_irq_chip;
break;
case AXP192_ID:
axp20x->nr_cells = ARRAY_SIZE(axp192_cells);
axp20x->cells = axp192_cells;
axp20x->regmap_cfg = &axp192_regmap_config;
axp20x->regmap_irq_chip = &axp192_regmap_irq_chip;
break;
case AXP202_ID:
case AXP209_ID:
axp20x->nr_cells = ARRAY_SIZE(axp20x_cells);

View File

@ -108,7 +108,7 @@ static struct i2c_driver bcm590xx_i2c_driver = {
.name = "bcm590xx",
.of_match_table = bcm590xx_of_match,
},
.probe_new = bcm590xx_i2c_probe,
.probe = bcm590xx_i2c_probe,
.id_table = bcm590xx_i2c_id,
};
module_i2c_driver(bcm590xx_i2c_driver);

View File

@ -278,7 +278,7 @@ static struct i2c_driver bd9571mwv_driver = {
.name = "bd9571mwv",
.of_match_table = bd9571mwv_of_match_table,
},
.probe_new = bd9571mwv_probe,
.probe = bd9571mwv_probe,
.id_table = bd9571mwv_id_table,
};
module_i2c_driver(bd9571mwv_driver);

View File

@ -543,7 +543,7 @@ static struct i2c_driver da903x_driver = {
.driver = {
.name = "da903x",
},
.probe_new = da903x_probe,
.probe = da903x_probe,
.remove = da903x_remove,
.id_table = da903x_id_table,
};

View File

@ -176,7 +176,7 @@ static void da9052_i2c_remove(struct i2c_client *client)
}
static struct i2c_driver da9052_i2c_driver = {
.probe_new = da9052_i2c_probe,
.probe = da9052_i2c_probe,
.remove = da9052_i2c_remove,
.id_table = da9052_i2c_id,
.driver = {

View File

@ -66,7 +66,7 @@ static const struct of_device_id da9055_of_match[] = {
};
static struct i2c_driver da9055_i2c_driver = {
.probe_new = da9055_i2c_probe,
.probe = da9055_i2c_probe,
.remove = da9055_i2c_remove,
.id_table = da9055_i2c_id,
.driver = {

View File

@ -726,7 +726,7 @@ static struct i2c_driver da9062_i2c_driver = {
.name = "da9062",
.of_match_table = da9062_dt_ids,
},
.probe_new = da9062_i2c_probe,
.probe = da9062_i2c_probe,
.remove = da9062_i2c_remove,
.id_table = da9062_i2c_id,
};

View File

@ -469,7 +469,7 @@ static struct i2c_driver da9063_i2c_driver = {
.name = "da9063",
.of_match_table = da9063_dt_ids,
},
.probe_new = da9063_i2c_probe,
.probe = da9063_i2c_probe,
.id_table = da9063_i2c_id,
};

View File

@ -510,7 +510,7 @@ static struct i2c_driver da9150_driver = {
.name = "da9150",
.of_match_table = da9150_of_match,
},
.probe_new = da9150_probe,
.probe = da9150_probe,
.remove = da9150_remove,
.shutdown = da9150_shutdown,
.id_table = da9150_i2c_id,

View File

@ -14,7 +14,6 @@
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/i2c.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/mfd/core.h>

View File

@ -196,7 +196,7 @@ static const struct of_device_id kb3930_dt_ids[] = {
MODULE_DEVICE_TABLE(of, kb3930_dt_ids);
static struct i2c_driver kb3930_driver = {
.probe_new = kb3930_probe,
.probe = kb3930_probe,
.remove = kb3930_remove,
.driver = {
.name = "ene-kb3930",

View File

@ -264,7 +264,7 @@ static struct i2c_driver gsc_driver = {
.name = "gateworks-gsc",
.of_match_table = gsc_of_match,
},
.probe_new = gsc_probe,
.probe = gsc_probe,
.remove = gsc_remove,
};
module_i2c_driver(gsc_driver);

View File

@ -183,6 +183,9 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev)
return -ENOMEM;
info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!info->mem)
return -ENODEV;
info->irq = platform_get_irq(pdev, 0);
ret = intel_lpss_probe(&pdev->dev, info);

View File

@ -460,6 +460,7 @@ void intel_lpss_remove(struct device *dev)
}
EXPORT_SYMBOL_GPL(intel_lpss_remove);
#ifdef CONFIG_PM
static int resume_lpss_device(struct device *dev, void *data)
{
if (!dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND))
@ -514,6 +515,7 @@ int intel_lpss_resume(struct device *dev)
return 0;
}
EXPORT_SYMBOL_GPL(intel_lpss_resume);
#endif
static int __init intel_lpss_init(void)
{

View File

@ -12,6 +12,91 @@
#include <linux/mfd/intel-m10-bmc.h>
#include <linux/module.h>
void m10bmc_fw_state_set(struct intel_m10bmc *m10bmc, enum m10bmc_fw_state new_state)
{
/* bmcfw_state is only needed if handshake_sys_reg_nranges > 0 */
if (!m10bmc->info->handshake_sys_reg_nranges)
return;
down_write(&m10bmc->bmcfw_lock);
m10bmc->bmcfw_state = new_state;
up_write(&m10bmc->bmcfw_lock);
}
EXPORT_SYMBOL_NS_GPL(m10bmc_fw_state_set, INTEL_M10_BMC_CORE);
/*
* For some Intel FPGA devices, the BMC firmware is not available to service
* handshake registers during a secure update.
*/
static bool m10bmc_reg_always_available(struct intel_m10bmc *m10bmc, unsigned int offset)
{
if (!m10bmc->info->handshake_sys_reg_nranges)
return true;
return !regmap_reg_in_ranges(offset, m10bmc->info->handshake_sys_reg_ranges,
m10bmc->info->handshake_sys_reg_nranges);
}
/*
* m10bmc_handshake_reg_unavailable - Checks if reg access collides with secure update state
* @m10bmc: M10 BMC structure
*
* For some Intel FPGA devices, the BMC firmware is not available to service
* handshake registers during a secure update erase and write phases.
*
* Context: @m10bmc->bmcfw_lock must be held.
*/
static bool m10bmc_handshake_reg_unavailable(struct intel_m10bmc *m10bmc)
{
return m10bmc->bmcfw_state == M10BMC_FW_STATE_SEC_UPDATE_PREPARE ||
m10bmc->bmcfw_state == M10BMC_FW_STATE_SEC_UPDATE_WRITE;
}
/*
* This function helps to simplify the accessing of the system registers.
*
* The base of the system registers is configured through the struct
* csr_map.
*/
int m10bmc_sys_read(struct intel_m10bmc *m10bmc, unsigned int offset, unsigned int *val)
{
const struct m10bmc_csr_map *csr_map = m10bmc->info->csr_map;
int ret;
if (m10bmc_reg_always_available(m10bmc, offset))
return m10bmc_raw_read(m10bmc, csr_map->base + offset, val);
down_read(&m10bmc->bmcfw_lock);
if (m10bmc_handshake_reg_unavailable(m10bmc))
ret = -EBUSY; /* Reg not available during secure update */
else
ret = m10bmc_raw_read(m10bmc, csr_map->base + offset, val);
up_read(&m10bmc->bmcfw_lock);
return ret;
}
EXPORT_SYMBOL_NS_GPL(m10bmc_sys_read, INTEL_M10_BMC_CORE);
int m10bmc_sys_update_bits(struct intel_m10bmc *m10bmc, unsigned int offset,
unsigned int msk, unsigned int val)
{
const struct m10bmc_csr_map *csr_map = m10bmc->info->csr_map;
int ret;
if (m10bmc_reg_always_available(m10bmc, offset))
return regmap_update_bits(m10bmc->regmap, csr_map->base + offset, msk, val);
down_read(&m10bmc->bmcfw_lock);
if (m10bmc_handshake_reg_unavailable(m10bmc))
ret = -EBUSY; /* Reg not available during secure update */
else
ret = regmap_update_bits(m10bmc->regmap, csr_map->base + offset, msk, val);
up_read(&m10bmc->bmcfw_lock);
return ret;
}
EXPORT_SYMBOL_NS_GPL(m10bmc_sys_update_bits, INTEL_M10_BMC_CORE);
static ssize_t bmc_version_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@ -98,7 +183,7 @@ const struct attribute_group *m10bmc_dev_groups[] = {
&m10bmc_group,
NULL,
};
EXPORT_SYMBOL_GPL(m10bmc_dev_groups);
EXPORT_SYMBOL_NS_GPL(m10bmc_dev_groups, INTEL_M10_BMC_CORE);
int m10bmc_dev_init(struct intel_m10bmc *m10bmc, const struct intel_m10bmc_platform_info *info)
{
@ -106,6 +191,7 @@ int m10bmc_dev_init(struct intel_m10bmc *m10bmc, const struct intel_m10bmc_platf
m10bmc->info = info;
dev_set_drvdata(m10bmc->dev, m10bmc);
init_rwsem(&m10bmc->bmcfw_lock);
ret = devm_mfd_add_devices(m10bmc->dev, PLATFORM_DEVID_AUTO,
info->cells, info->n_cells,
@ -115,7 +201,7 @@ int m10bmc_dev_init(struct intel_m10bmc *m10bmc, const struct intel_m10bmc_platf
return ret;
}
EXPORT_SYMBOL_GPL(m10bmc_dev_init);
EXPORT_SYMBOL_NS_GPL(m10bmc_dev_init, INTEL_M10_BMC_CORE);
MODULE_DESCRIPTION("Intel MAX 10 BMC core driver");
MODULE_AUTHOR("Intel Corporation");

View File

@ -453,3 +453,4 @@ module_dfl_driver(m10bmc_pmci_driver);
MODULE_DESCRIPTION("MAX10 BMC PMCI-based interface");
MODULE_AUTHOR("Intel Corporation");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(INTEL_M10_BMC_CORE);

View File

@ -116,12 +116,20 @@ static struct mfd_cell m10bmc_d5005_subdevs[] = {
{ .name = "d5005bmc-sec-update" },
};
static const struct regmap_range m10bmc_d5005_fw_handshake_regs[] = {
regmap_reg_range(M10BMC_N3000_TELEM_START, M10BMC_D5005_TELEM_END),
};
static struct mfd_cell m10bmc_pacn3000_subdevs[] = {
{ .name = "n3000bmc-hwmon" },
{ .name = "n3000bmc-retimer" },
{ .name = "n3000bmc-sec-update" },
};
static const struct regmap_range m10bmc_n3000_fw_handshake_regs[] = {
regmap_reg_range(M10BMC_N3000_TELEM_START, M10BMC_N3000_TELEM_END),
};
static struct mfd_cell m10bmc_n5010_subdevs[] = {
{ .name = "n5010bmc-hwmon" },
};
@ -129,18 +137,24 @@ static struct mfd_cell m10bmc_n5010_subdevs[] = {
static const struct intel_m10bmc_platform_info m10bmc_spi_n3000 = {
.cells = m10bmc_pacn3000_subdevs,
.n_cells = ARRAY_SIZE(m10bmc_pacn3000_subdevs),
.handshake_sys_reg_ranges = m10bmc_n3000_fw_handshake_regs,
.handshake_sys_reg_nranges = ARRAY_SIZE(m10bmc_n3000_fw_handshake_regs),
.csr_map = &m10bmc_n3000_csr_map,
};
static const struct intel_m10bmc_platform_info m10bmc_spi_d5005 = {
.cells = m10bmc_d5005_subdevs,
.n_cells = ARRAY_SIZE(m10bmc_d5005_subdevs),
.handshake_sys_reg_ranges = m10bmc_d5005_fw_handshake_regs,
.handshake_sys_reg_nranges = ARRAY_SIZE(m10bmc_d5005_fw_handshake_regs),
.csr_map = &m10bmc_n3000_csr_map,
};
static const struct intel_m10bmc_platform_info m10bmc_spi_n5010 = {
.cells = m10bmc_n5010_subdevs,
.n_cells = ARRAY_SIZE(m10bmc_n5010_subdevs),
.handshake_sys_reg_ranges = m10bmc_n3000_fw_handshake_regs,
.handshake_sys_reg_nranges = ARRAY_SIZE(m10bmc_n3000_fw_handshake_regs),
.csr_map = &m10bmc_n3000_csr_map,
};
@ -166,3 +180,4 @@ MODULE_DESCRIPTION("Intel MAX 10 BMC SPI bus interface");
MODULE_AUTHOR("Intel Corporation");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("spi:intel-m10-bmc");
MODULE_IMPORT_NS(INTEL_M10_BMC_CORE);

View File

@ -172,7 +172,7 @@ static struct i2c_driver chtdc_ti_i2c_driver = {
.pm = pm_sleep_ptr(&chtdc_ti_pm_ops),
.acpi_match_table = chtdc_ti_acpi_ids,
},
.probe_new = chtdc_ti_probe,
.probe = chtdc_ti_probe,
.shutdown = chtdc_ti_shutdown,
};
module_i2c_driver(chtdc_ti_i2c_driver);

View File

@ -272,7 +272,7 @@ static struct i2c_driver cht_wc_driver = {
.pm = pm_sleep_ptr(&cht_wc_pm_ops),
.acpi_match_table = cht_wc_acpi_ids,
},
.probe_new = cht_wc_probe,
.probe = cht_wc_probe,
.shutdown = cht_wc_shutdown,
.id_table = cht_wc_i2c_id,
};

View File

@ -263,7 +263,7 @@ static struct i2c_driver crystal_cove_i2c_driver = {
.pm = pm_sleep_ptr(&crystal_cove_pm_ops),
.acpi_match_table = crystal_cove_acpi_match,
},
.probe_new = crystal_cove_i2c_probe,
.probe = crystal_cove_i2c_probe,
.remove = crystal_cove_i2c_remove,
.shutdown = crystal_cove_shutdown,
};

View File

@ -1069,7 +1069,7 @@ static struct i2c_driver iqs62x_i2c_driver = {
.of_match_table = iqs62x_of_match,
.pm = &iqs62x_pm,
},
.probe_new = iqs62x_probe,
.probe = iqs62x_probe,
.remove = iqs62x_remove,
};
module_i2c_driver(iqs62x_i2c_driver);

View File

@ -134,7 +134,7 @@ static struct i2c_driver khadas_mcu_driver = {
.name = "khadas-mcu-core",
.of_match_table = of_match_ptr(khadas_mcu_of_match),
},
.probe_new = khadas_mcu_probe,
.probe = khadas_mcu_probe,
};
module_i2c_driver(khadas_mcu_driver);

View File

@ -485,8 +485,6 @@ static int lm3533_device_init(struct lm3533 *lm3533)
lm3533->gpio_hwen = pdata->gpio_hwen;
dev_set_drvdata(lm3533->dev, lm3533);
if (gpio_is_valid(lm3533->gpio_hwen)) {
ret = devm_gpio_request_one(lm3533->dev, lm3533->gpio_hwen,
GPIOF_OUT_INIT_LOW, "lm3533-hwen");
@ -626,7 +624,7 @@ static struct i2c_driver lm3533_i2c_driver = {
.name = "lm3533",
},
.id_table = lm3533_i2c_ids,
.probe_new = lm3533_i2c_probe,
.probe = lm3533_i2c_probe,
.remove = lm3533_i2c_remove,
};

View File

@ -382,7 +382,7 @@ static struct i2c_driver lochnagar_i2c_driver = {
.of_match_table = of_match_ptr(lochnagar_of_match),
.suppress_bind_attrs = true,
},
.probe_new = lochnagar_i2c_probe,
.probe = lochnagar_i2c_probe,
};
static int __init lochnagar_i2c_init(void)

View File

@ -140,7 +140,7 @@ MODULE_DEVICE_TABLE(of, lp3943_of_match);
#endif
static struct i2c_driver lp3943_driver = {
.probe_new = lp3943_probe,
.probe = lp3943_probe,
.driver = {
.name = "lp3943",
.of_match_table = of_match_ptr(lp3943_of_match),

View File

@ -78,7 +78,7 @@ static struct i2c_driver lp873x_driver = {
.name = "lp873x",
.of_match_table = of_lp873x_match_table,
},
.probe_new = lp873x_probe,
.probe = lp873x_probe,
.id_table = lp873x_id_table,
};
module_i2c_driver(lp873x_driver);

View File

@ -119,7 +119,7 @@ static struct i2c_driver lp87565_driver = {
.name = "lp87565",
.of_match_table = of_lp87565_match_table,
},
.probe_new = lp87565_probe,
.probe = lp87565_probe,
.shutdown = lp87565_shutdown,
.id_table = lp87565_id_table,
};

View File

@ -225,7 +225,7 @@ static struct i2c_driver lp8788_driver = {
.driver = {
.name = "lp8788",
},
.probe_new = lp8788_probe,
.probe = lp8788_probe,
.remove = lp8788_remove,
.id_table = lp8788_ids,
};

View File

@ -139,7 +139,7 @@ static struct i2c_driver madera_i2c_driver = {
.pm = &madera_pm_ops,
.of_match_table = of_match_ptr(madera_of_match),
},
.probe_new = madera_i2c_probe,
.probe = madera_i2c_probe,
.remove = madera_i2c_remove,
.id_table = madera_i2c_id,
};

View File

@ -518,7 +518,7 @@ static struct i2c_driver max14577_i2c_driver = {
.pm = pm_sleep_ptr(&max14577_pm),
.of_match_table = max14577_dt_match,
},
.probe_new = max14577_i2c_probe,
.probe = max14577_i2c_probe,
.remove = max14577_i2c_remove,
.id_table = max14577_i2c_id,
};

224
drivers/mfd/max77541.c Normal file
View File

@ -0,0 +1,224 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2022 Analog Devices, Inc.
* Driver for the MAX77540 and MAX77541
*/
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/mfd/core.h>
#include <linux/mfd/max77541.h>
#include <linux/property.h>
#include <linux/regmap.h>
static const struct regmap_config max77541_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
};
static const struct regmap_irq max77541_src_irqs[] = {
{ .mask = MAX77541_BIT_INT_SRC_TOPSYS },
{ .mask = MAX77541_BIT_INT_SRC_BUCK },
};
static const struct regmap_irq_chip max77541_src_irq_chip = {
.name = "max77541-src",
.status_base = MAX77541_REG_INT_SRC,
.mask_base = MAX77541_REG_INT_SRC_M,
.num_regs = 1,
.irqs = max77541_src_irqs,
.num_irqs = ARRAY_SIZE(max77541_src_irqs),
};
static const struct regmap_irq max77541_topsys_irqs[] = {
{ .mask = MAX77541_BIT_TOPSYS_INT_TJ_120C },
{ .mask = MAX77541_BIT_TOPSYS_INT_TJ_140C },
{ .mask = MAX77541_BIT_TOPSYS_INT_TSHDN },
{ .mask = MAX77541_BIT_TOPSYS_INT_UVLO },
{ .mask = MAX77541_BIT_TOPSYS_INT_ALT_SWO },
{ .mask = MAX77541_BIT_TOPSYS_INT_EXT_FREQ_DET },
};
static const struct regmap_irq_chip max77541_topsys_irq_chip = {
.name = "max77541-topsys",
.status_base = MAX77541_REG_TOPSYS_INT,
.mask_base = MAX77541_REG_TOPSYS_INT_M,
.num_regs = 1,
.irqs = max77541_topsys_irqs,
.num_irqs = ARRAY_SIZE(max77541_topsys_irqs),
};
static const struct regmap_irq max77541_buck_irqs[] = {
{ .mask = MAX77541_BIT_BUCK_INT_M1_POK_FLT },
{ .mask = MAX77541_BIT_BUCK_INT_M2_POK_FLT },
{ .mask = MAX77541_BIT_BUCK_INT_M1_SCFLT },
{ .mask = MAX77541_BIT_BUCK_INT_M2_SCFLT },
};
static const struct regmap_irq_chip max77541_buck_irq_chip = {
.name = "max77541-buck",
.status_base = MAX77541_REG_BUCK_INT,
.mask_base = MAX77541_REG_BUCK_INT_M,
.num_regs = 1,
.irqs = max77541_buck_irqs,
.num_irqs = ARRAY_SIZE(max77541_buck_irqs),
};
static const struct regmap_irq max77541_adc_irqs[] = {
{ .mask = MAX77541_BIT_ADC_INT_CH1_I },
{ .mask = MAX77541_BIT_ADC_INT_CH2_I },
{ .mask = MAX77541_BIT_ADC_INT_CH3_I },
{ .mask = MAX77541_BIT_ADC_INT_CH6_I },
};
static const struct regmap_irq_chip max77541_adc_irq_chip = {
.name = "max77541-adc",
.status_base = MAX77541_REG_ADC_INT,
.mask_base = MAX77541_REG_ADC_INT_M,
.num_regs = 1,
.irqs = max77541_adc_irqs,
.num_irqs = ARRAY_SIZE(max77541_adc_irqs),
};
static const struct mfd_cell max77540_devs[] = {
MFD_CELL_OF("max77540-regulator", NULL, NULL, 0, 0, NULL),
};
static const struct mfd_cell max77541_devs[] = {
MFD_CELL_OF("max77541-regulator", NULL, NULL, 0, 0, NULL),
MFD_CELL_OF("max77541-adc", NULL, NULL, 0, 0, NULL),
};
static int max77541_pmic_irq_init(struct device *dev)
{
struct max77541 *max77541 = dev_get_drvdata(dev);
int irq = max77541->i2c->irq;
int ret;
ret = devm_regmap_add_irq_chip(dev, max77541->regmap, irq,
IRQF_ONESHOT | IRQF_SHARED, 0,
&max77541_src_irq_chip,
&max77541->irq_data);
if (ret)
return ret;
ret = devm_regmap_add_irq_chip(dev, max77541->regmap, irq,
IRQF_ONESHOT | IRQF_SHARED, 0,
&max77541_topsys_irq_chip,
&max77541->irq_topsys);
if (ret)
return ret;
ret = devm_regmap_add_irq_chip(dev, max77541->regmap, irq,
IRQF_ONESHOT | IRQF_SHARED, 0,
&max77541_buck_irq_chip,
&max77541->irq_buck);
if (ret)
return ret;
if (max77541->id == MAX77541) {
ret = devm_regmap_add_irq_chip(dev, max77541->regmap, irq,
IRQF_ONESHOT | IRQF_SHARED, 0,
&max77541_adc_irq_chip,
&max77541->irq_adc);
if (ret)
return ret;
}
return 0;
}
static int max77541_pmic_setup(struct device *dev)
{
struct max77541 *max77541 = dev_get_drvdata(dev);
const struct mfd_cell *cells;
int n_devs;
int ret;
switch (max77541->id) {
case MAX77540:
cells = max77540_devs;
n_devs = ARRAY_SIZE(max77540_devs);
break;
case MAX77541:
cells = max77541_devs;
n_devs = ARRAY_SIZE(max77541_devs);
break;
default:
return -EINVAL;
}
ret = max77541_pmic_irq_init(dev);
if (ret)
return dev_err_probe(dev, ret, "Failed to initialize IRQ\n");
ret = device_init_wakeup(dev, true);
if (ret)
return dev_err_probe(dev, ret, "Unable to init wakeup\n");
return devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
cells, n_devs, NULL, 0, NULL);
}
static int max77541_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct device *dev = &client->dev;
struct max77541 *max77541;
max77541 = devm_kzalloc(dev, sizeof(*max77541), GFP_KERNEL);
if (!max77541)
return -ENOMEM;
i2c_set_clientdata(client, max77541);
max77541->i2c = client;
max77541->id = (enum max7754x_ids)device_get_match_data(dev);
if (!max77541->id)
max77541->id = (enum max7754x_ids)id->driver_data;
if (!max77541->id)
return -EINVAL;
max77541->regmap = devm_regmap_init_i2c(client,
&max77541_regmap_config);
if (IS_ERR(max77541->regmap))
return dev_err_probe(dev, PTR_ERR(max77541->regmap),
"Failed to allocate register map\n");
return max77541_pmic_setup(dev);
}
static const struct of_device_id max77541_of_id[] = {
{
.compatible = "adi,max77540",
.data = (void *)MAX77540,
},
{
.compatible = "adi,max77541",
.data = (void *)MAX77541,
},
{ }
};
MODULE_DEVICE_TABLE(of, max77541_of_id);
static const struct i2c_device_id max77541_id[] = {
{ "max77540", MAX77540 },
{ "max77541", MAX77541 },
{ }
};
MODULE_DEVICE_TABLE(i2c, max77541_id);
static struct i2c_driver max77541_driver = {
.driver = {
.name = "max77541",
.of_match_table = max77541_of_id,
},
.probe = max77541_probe,
.id_table = max77541_id,
};
module_i2c_driver(max77541_driver);
MODULE_DESCRIPTION("MAX7740/MAX7741 Driver");
MODULE_AUTHOR("Okan Sahin <okan.sahin@analog.com>");
MODULE_LICENSE("GPL");

View File

@ -698,7 +698,7 @@ static struct i2c_driver max77620_driver = {
.name = "max77620",
.pm = pm_sleep_ptr(&max77620_pm_ops),
},
.probe_new = max77620_probe,
.probe = max77620_probe,
.id_table = max77620_id,
};
builtin_i2c_driver(max77620_driver);

View File

@ -222,7 +222,7 @@ static struct i2c_driver max77650_i2c_driver = {
.name = "max77650",
.of_match_table = max77650_of_match,
},
.probe_new = max77650_i2c_probe,
.probe = max77650_i2c_probe,
};
module_i2c_driver(max77650_i2c_driver);

View File

@ -269,7 +269,7 @@ static struct i2c_driver max77686_i2c_driver = {
.pm = pm_sleep_ptr(&max77686_pm),
.of_match_table = max77686_pmic_dt_match,
},
.probe_new = max77686_i2c_probe,
.probe = max77686_i2c_probe,
};
module_i2c_driver(max77686_i2c_driver);

View File

@ -356,7 +356,7 @@ static struct i2c_driver max77693_i2c_driver = {
.pm = &max77693_pm,
.of_match_table = of_match_ptr(max77693_dt_match),
},
.probe_new = max77693_i2c_probe,
.probe = max77693_i2c_probe,
.remove = max77693_i2c_remove,
.id_table = max77693_i2c_id,
};

View File

@ -143,7 +143,7 @@ static struct i2c_driver max77714_driver = {
.name = "max77714",
.of_match_table = max77714_dt_match,
},
.probe_new = max77714_probe,
.probe = max77714_probe,
};
module_i2c_driver(max77714_driver);

View File

@ -207,7 +207,7 @@ static struct i2c_driver max77843_i2c_driver = {
.of_match_table = max77843_dt_match,
.suppress_bind_attrs = true,
},
.probe_new = max77843_probe,
.probe = max77843_probe,
.id_table = max77843_id,
};

View File

@ -201,8 +201,6 @@ static int max8907_i2c_probe(struct i2c_client *i2c)
}
max8907->dev = &i2c->dev;
dev_set_drvdata(max8907->dev, max8907);
max8907->i2c_gen = i2c;
i2c_set_clientdata(i2c, max8907);
max8907->regmap_gen = devm_regmap_init_i2c(i2c,
@ -313,7 +311,7 @@ static struct i2c_driver max8907_i2c_driver = {
.name = "max8907",
.of_match_table = of_match_ptr(max8907_of_match),
},
.probe_new = max8907_i2c_probe,
.probe = max8907_i2c_probe,
.remove = max8907_i2c_remove,
.id_table = max8907_i2c_id,
};

View File

@ -172,7 +172,6 @@ static int max8925_probe(struct i2c_client *client)
chip->i2c = client;
chip->dev = &client->dev;
i2c_set_clientdata(client, chip);
dev_set_drvdata(chip->dev, chip);
mutex_init(&chip->io_lock);
chip->rtc = i2c_new_dummy_device(chip->i2c->adapter, RTC_I2C_ADDR);
@ -240,7 +239,7 @@ static struct i2c_driver max8925_driver = {
.pm = pm_sleep_ptr(&max8925_pm_ops),
.of_match_table = max8925_dt_ids,
},
.probe_new = max8925_probe,
.probe = max8925_probe,
.remove = max8925_remove,
.id_table = max8925_id_table,
};

View File

@ -478,7 +478,7 @@ static struct i2c_driver max8997_i2c_driver = {
.suppress_bind_attrs = true,
.of_match_table = of_match_ptr(max8997_pmic_dt_match),
},
.probe_new = max8997_i2c_probe,
.probe = max8997_i2c_probe,
.id_table = max8997_i2c_id,
};

View File

@ -348,7 +348,7 @@ static struct i2c_driver max8998_i2c_driver = {
.suppress_bind_attrs = true,
.of_match_table = of_match_ptr(max8998_dt_match),
},
.probe_new = max8998_i2c_probe,
.probe = max8998_i2c_probe,
.id_table = max8998_i2c_id,
};

View File

@ -95,7 +95,7 @@ static struct i2c_driver mc13xxx_i2c_driver = {
.name = "mc13xxx",
.of_match_table = mc13xxx_dt_ids,
},
.probe_new = mc13xxx_i2c_probe,
.probe = mc13xxx_i2c_probe,
.remove = mc13xxx_i2c_remove,
};

View File

@ -1240,7 +1240,7 @@ static struct i2c_driver menelaus_i2c_driver = {
.driver = {
.name = DRIVER_NAME,
},
.probe_new = menelaus_probe,
.probe = menelaus_probe,
.remove = menelaus_remove,
.id_table = menelaus_id,
};

View File

@ -111,7 +111,7 @@ MODULE_DEVICE_TABLE(i2c, menf21bmc_id_table);
static struct i2c_driver menf21bmc_driver = {
.driver.name = "menf21bmc",
.id_table = menf21bmc_id_table,
.probe_new = menf21bmc_probe,
.probe = menf21bmc_probe,
};
module_i2c_driver(menf21bmc_driver);

View File

@ -102,7 +102,6 @@ static int mfd_match_of_node_to_dev(struct platform_device *pdev,
{
#if IS_ENABLED(CONFIG_OF)
struct mfd_of_node_entry *of_entry;
const __be32 *reg;
u64 of_node_addr;
/* Skip if OF node has previously been allocated to a device */
@ -115,13 +114,10 @@ static int mfd_match_of_node_to_dev(struct platform_device *pdev,
goto allocate_of_node;
/* We only care about each node's first defined address */
reg = of_get_address(np, 0, NULL, NULL);
if (!reg)
if (of_property_read_reg(np, 0, &of_node_addr, NULL))
/* OF node does not contatin a 'reg' property to match to */
return -EAGAIN;
of_node_addr = of_read_number(reg, of_n_addr_cells(np));
if (cell->of_reg != of_node_addr)
/* No match */
return -EAGAIN;

View File

@ -70,7 +70,7 @@ static struct i2c_driver mp2629_driver = {
.name = "mp2629",
.of_match_table = mp2629_of_match,
},
.probe_new = mp2629_probe,
.probe = mp2629_probe,
};
module_i2c_driver(mp2629_driver);

View File

@ -623,7 +623,7 @@ static struct i2c_driver mt6360_driver = {
.pm = &mt6360_pm_ops,
.of_match_table = of_match_ptr(mt6360_of_id),
},
.probe_new = mt6360_probe,
.probe = mt6360_probe,
};
module_i2c_driver(mt6360_driver);

View File

@ -303,7 +303,7 @@ static struct i2c_driver mt6370_driver = {
.name = "mt6370",
.of_match_table = mt6370_match_table,
},
.probe_new = mt6370_probe,
.probe = mt6370_probe,
};
module_i2c_driver(mt6370_driver);

View File

@ -260,7 +260,7 @@ static struct i2c_driver ntxec_driver = {
.name = "ntxec",
.of_match_table = of_ntxec_match_table,
},
.probe_new = ntxec_probe,
.probe = ntxec_probe,
.remove = ntxec_remove,
};
module_i2c_driver(ntxec_driver);

View File

@ -725,7 +725,7 @@ static struct i2c_driver palmas_i2c_driver = {
.name = "palmas",
.of_match_table = of_palmas_match_tbl,
},
.probe_new = palmas_i2c_probe,
.probe = palmas_i2c_probe,
.remove = palmas_i2c_remove,
.id_table = palmas_i2c_id,
};

View File

@ -282,7 +282,7 @@ static struct i2c_driver pcf50633_driver = {
.pm = pm_sleep_ptr(&pcf50633_pm),
},
.id_table = pcf50633_id_table,
.probe_new = pcf50633_probe,
.probe = pcf50633_probe,
.remove = pcf50633_remove,
};

View File

@ -199,15 +199,15 @@ static const struct of_device_id pm8008_match[] = {
{ .compatible = "qcom,pm8008", },
{ },
};
MODULE_DEVICE_TABLE(of, pm8008_match);
static struct i2c_driver pm8008_mfd_driver = {
.driver = {
.name = "pm8008",
.of_match_table = pm8008_match,
},
.probe_new = pm8008_probe,
.probe = pm8008_probe,
};
module_i2c_driver(pm8008_mfd_driver);
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("i2c:qcom-pm8008");

View File

@ -8,9 +8,9 @@
* based on code
* Copyright (C) 2011 RICOH COMPANY,LTD
*/
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/i2c.h>
#include <linux/mfd/rc5t583.h>
enum int_type {

View File

@ -288,7 +288,7 @@ static struct i2c_driver rc5t583_i2c_driver = {
.driver = {
.name = "rc5t583",
},
.probe_new = rc5t583_i2c_probe,
.probe = rc5t583_i2c_probe,
.id_table = rc5t583_i2c_id,
};

View File

@ -318,7 +318,7 @@ static struct i2c_driver retu_driver = {
.name = "retu-mfd",
.of_match_table = retu_of_match,
},
.probe_new = retu_probe,
.probe = retu_probe,
.remove = retu_remove,
.id_table = retu_id,
};

View File

@ -173,7 +173,7 @@ static struct i2c_driver rk8xx_i2c_driver = {
.of_match_table = rk8xx_i2c_of_match,
.pm = &rk8xx_i2c_pm_ops,
},
.probe_new = rk8xx_i2c_probe,
.probe = rk8xx_i2c_probe,
.shutdown = rk8xx_i2c_shutdown,
};
module_i2c_driver(rk8xx_i2c_driver);

View File

@ -280,7 +280,7 @@ static struct i2c_driver rn5t618_i2c_driver = {
.of_match_table = of_match_ptr(rn5t618_of_match),
.pm = &rn5t618_i2c_dev_pm_ops,
},
.probe_new = rn5t618_i2c_probe,
.probe = rn5t618_i2c_probe,
.remove = rn5t618_i2c_remove,
};

View File

@ -564,7 +564,7 @@ static struct i2c_driver bd71828_drv = {
.name = "rohm-bd71828",
.of_match_table = bd71828_of_match,
},
.probe_new = &bd71828_i2c_probe,
.probe = bd71828_i2c_probe,
};
module_i2c_driver(bd71828_drv);

View File

@ -208,7 +208,7 @@ static struct i2c_driver bd718xx_i2c_driver = {
.name = "rohm-bd718x7",
.of_match_table = bd718xx_of_match,
},
.probe_new = bd718xx_i2c_probe,
.probe = bd718xx_i2c_probe,
};
static int __init bd718xx_i2c_init(void)

View File

@ -178,7 +178,7 @@ static struct i2c_driver bd957x_drv = {
.name = "rohm-bd957x",
.of_match_table = bd957x_of_match,
},
.probe_new = &bd957x_i2c_probe,
.probe = bd957x_i2c_probe,
};
module_i2c_driver(bd957x_drv);

View File

@ -279,7 +279,7 @@ static struct i2c_driver rsmu_i2c_driver = {
.name = "rsmu-i2c",
.of_match_table = of_match_ptr(rsmu_i2c_of_match),
},
.probe_new = rsmu_i2c_probe,
.probe = rsmu_i2c_probe,
.remove = rsmu_i2c_remove,
.id_table = rsmu_i2c_id,
};

View File

@ -109,7 +109,7 @@ static struct i2c_driver rt4831_driver = {
.name = "rt4831",
.of_match_table = rt4831_of_match,
},
.probe_new = rt4831_probe,
.probe = rt4831_probe,
.remove = rt4831_remove,
};
module_i2c_driver(rt4831_driver);

View File

@ -40,9 +40,6 @@ static const struct mfd_cell rt5033_devs[] = {
{
.name = "rt5033-charger",
.of_compatible = "richtek,rt5033-charger",
}, {
.name = "rt5033-battery",
.of_compatible = "richtek,rt5033-battery",
}, {
.name = "rt5033-led",
.of_compatible = "richtek,rt5033-led",
@ -58,7 +55,7 @@ static const struct regmap_config rt5033_regmap_config = {
static int rt5033_i2c_probe(struct i2c_client *i2c)
{
struct rt5033_dev *rt5033;
unsigned int dev_id;
unsigned int dev_id, chip_rev;
int ret;
rt5033 = devm_kzalloc(&i2c->dev, sizeof(*rt5033), GFP_KERNEL);
@ -81,7 +78,8 @@ static int rt5033_i2c_probe(struct i2c_client *i2c)
dev_err(&i2c->dev, "Device not found\n");
return -ENODEV;
}
dev_info(&i2c->dev, "Device found Device ID: %04x\n", dev_id);
chip_rev = dev_id & RT5033_CHIP_REV_MASK;
dev_info(&i2c->dev, "Device found (rev. %d)\n", chip_rev);
ret = regmap_add_irq_chip(rt5033->regmap, rt5033->irq,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
@ -122,7 +120,7 @@ static struct i2c_driver rt5033_driver = {
.name = "rt5033",
.of_match_table = rt5033_dt_match,
},
.probe_new = rt5033_i2c_probe,
.probe = rt5033_i2c_probe,
.id_table = rt5033_i2c_id,
};
module_i2c_driver(rt5033_driver);

View File

@ -114,7 +114,7 @@ static struct i2c_driver rt5120_driver = {
.name = "rt5120",
.of_match_table = rt5120_device_match_table,
},
.probe_new = rt5120_probe,
.probe = rt5120_probe,
};
module_i2c_driver(rt5120_driver);

View File

@ -450,7 +450,7 @@ static struct i2c_driver sec_pmic_driver = {
.pm = pm_sleep_ptr(&sec_pmic_pm_ops),
.of_match_table = sec_dt_match,
},
.probe_new = sec_pmic_probe,
.probe = sec_pmic_probe,
.shutdown = sec_pmic_shutdown,
};
module_i2c_driver(sec_pmic_driver);

View File

@ -866,7 +866,7 @@ static struct i2c_driver si476x_core_driver = {
.driver = {
.name = "si476x-core",
},
.probe_new = si476x_core_probe,
.probe = si476x_core_probe,
.remove = si476x_core_remove,
.id_table = si476x_id,
};

View File

@ -72,28 +72,28 @@ static const struct simple_mfd_data silergy_sy7636a = {
.mfd_cell_size = ARRAY_SIZE(sy7636a_cells),
};
static const struct mfd_cell max597x_cells[] = {
{ .name = "max597x-regulator", },
{ .name = "max597x-iio", },
{ .name = "max597x-led", },
static const struct mfd_cell max5970_cells[] = {
{ .name = "max5970-regulator", },
{ .name = "max5970-iio", },
{ .name = "max5970-led", },
};
static const struct simple_mfd_data maxim_max597x = {
.mfd_cell = max597x_cells,
.mfd_cell_size = ARRAY_SIZE(max597x_cells),
static const struct simple_mfd_data maxim_max5970 = {
.mfd_cell = max5970_cells,
.mfd_cell_size = ARRAY_SIZE(max5970_cells),
};
static const struct of_device_id simple_mfd_i2c_of_match[] = {
{ .compatible = "kontron,sl28cpld" },
{ .compatible = "silergy,sy7636a", .data = &silergy_sy7636a},
{ .compatible = "maxim,max5970", .data = &maxim_max597x},
{ .compatible = "maxim,max5978", .data = &maxim_max597x},
{ .compatible = "maxim,max5970", .data = &maxim_max5970},
{ .compatible = "maxim,max5978", .data = &maxim_max5970},
{}
};
MODULE_DEVICE_TABLE(of, simple_mfd_i2c_of_match);
static struct i2c_driver simple_mfd_i2c_driver = {
.probe_new = simple_mfd_i2c_probe,
.probe = simple_mfd_i2c_probe,
.driver = {
.name = "simple-mfd-i2c",
.of_match_table = simple_mfd_i2c_of_match,

Some files were not shown because too many files have changed in this diff Show More