Skip to contentSkip to conversation

Add initial support for ATC260x PMICs

PATCH Superseded Cristian Ciocaltea 2 participants 10 messages Dec 29, 2020 – Jan 3, 2021

Subsystems (7)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Cristian Ciocaltea

author maintainer
#0 lore raw

v4 cover Add initial support for ATC260x PMICs

The ATC260x family of PMICs integrates Audio Codec, Power management, Clock generation and GPIO controller blocks. There are currently 3
variants: ATC2603A, ATC2603C and ATC2609A.

This is re-spin of the v1 patch series submitted some time ago by Mani, who provided the MFD and regulator drivers for ATC2609A:
https://lore.kernel.org/lkml/[email protected]/

Since v2, I added support for ATC2603C, together with some new functionalities for both chips: power controller and onkey input. The ATC2603A chip type remains unsupported for the moment.

This has been tested on RoseapplePi, a SBC based on the Actions Semi S500 SoC, which integrates the ATC2603C variant of the PMIC.

Note that enabling the ATC260x PMICs on compatible Actions Semi Owl SoC based boards depends on:

* the Actions Semi SIRQ driver (for PMIC DTS setup), merged in v5.10:
https://lore.kernel.org/lkml/[email protected]/

* the atomic transfers in Owl I2C driver (for power controller), merged in v5.11:
https://lore.kernel.org/lkml/[email protected]/

Additionally, please note that I have taken the authorship for the MFD and regulator drivers patches, considering the original code has been modified to a large extent.

Thanks,
Cristi

Changes in v4:
- Updated MFD driver according to Lee's review
- Handled ATC2603C's LDO12 fixed regulator per Mark's suggestion
- Rebased patchset on v5.11-rc1

Changes in v3:
- Integrated feedback from Mani, Rob, Mark, Sebastian, Dmitry
- Fixed issues reported by Lee's kernel test robot
- Added new patch for 'reset-time-sec' DT binding property
- Rebased patchset on v5.10-rc6

Changes in v2:
- Reworked MFD core & I2C driver
* Integrated Lee's feedback
* Added support for using the regmap within atomic contexts
* Added support for ATC2603C chip variant
* Reorganized KConfig entries
- Improved regulator driver
* Added support for ATC2603C variant
* Used helper macros for more compact specification of regulator_desc items
* Added more regulator capabilities
- Added power controller driver
* Provides system poweroff/reboot functionalities
* Depends on atomic transfers in the Owl I2C driver
- Added onkey driver: exposes the power button as an input device
- Added yaml binding doc
- Rebased patchset on kernel v5.9-rc1

Cristian Ciocaltea (6):
dt-bindings: input: Add reset-time-sec common property
dt-bindings: mfd: Add Actions Semi ATC260x PMIC binding
mfd: Add MFD driver for ATC260x PMICs
regulator: Add regulator driver for ATC260x PMICs
power: reset: Add poweroff driver for ATC260x PMICs
input: atc260x: Add onkey driver for ATC260x PMICs

Manivannan Sadhasivam (1):
MAINTAINERS: Add entry for ATC260x PMIC

 .../devicetree/bindings/input/input.yaml      |   7 +
 .../bindings/mfd/actions,atc260x.yaml         | 183 ++++++
 MAINTAINERS                                   |  12 +
 drivers/input/misc/Kconfig                    |  11 +
 drivers/input/misc/Makefile                   |   2 +-
 drivers/input/misc/atc260x-onkey.c            | 305 ++++++++++
 drivers/mfd/Kconfig                           |  18 +
 drivers/mfd/Makefile                          |   3 +
 drivers/mfd/atc260x-core.c                    | 293 ++++++++++
 drivers/mfd/atc260x-i2c.c                     |  64 +++
 drivers/power/reset/Kconfig                   |   8 +-
 drivers/power/reset/Makefile                  |   1 +
 drivers/power/reset/atc260x-poweroff.c        | 263 +++++++++
 drivers/regulator/Kconfig                     |   8 +
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/atc260x-regulator.c         | 539 ++++++++++++++++++
 include/linux/mfd/atc260x/atc2603c.h          | 281 +++++++++
 include/linux/mfd/atc260x/atc2609a.h          | 308 ++++++++++
 include/linux/mfd/atc260x/core.h              |  58 ++
 19 files changed, 2363 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/actions,atc260x.yaml
 create mode 100644 drivers/input/misc/atc260x-onkey.c
 create mode 100644 drivers/mfd/atc260x-core.c
 create mode 100644 drivers/mfd/atc260x-i2c.c
 create mode 100644 drivers/power/reset/atc260x-poweroff.c
 create mode 100644 drivers/regulator/atc260x-regulator.c
 create mode 100644 include/linux/mfd/atc260x/atc2603c.h
 create mode 100644 include/linux/mfd/atc260x/atc2609a.h
 create mode 100644 include/linux/mfd/atc260x/core.h
Signature · 1 line
2.30.0
author maintainer
#1 lore raw

PATCH v4 1/7 dt-bindings: input: Add reset-time-sec common property

Add a new common property 'reset-time-sec' to be used in conjunction with the devices supporting the key pressed reset feature.

---
Changes in v4:
- Added Reviewed-by from Rob

Changes in v3:
- This patch was not present in v2

 Documentation/devicetree/bindings/input/input.yaml | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/input/input.yaml +7 -0
index ab407f266bef..caba93209ae7 100644
@@ -34,4 +34,11 @@ properties:
       specify this property.
     $ref: /schemas/types.yaml#/definitions/uint32
 
+  reset-time-sec:
+    description:
+      Duration in seconds which the key should be kept pressed for device to
+      reset automatically. Device with key pressed reset feature can specify
+      this property.
+    $ref: /schemas/types.yaml#/definitions/uint32
+
 additionalProperties: true
Signature · 1 line
2.30.0
author maintainer
#2 lore raw

PATCH v4 2/7 dt-bindings: mfd: Add Actions Semi ATC260x PMIC binding

In reply to Cristian Ciocaltea

Add devicetree binding for Actions Semi ATC260x PMICs.

---
Changes in v4
- Added Reviewed-by from Rob
- Added support for ATC2603C LDO12 fixed regulator per Mark's suggestion

Changes in v3 (according to Rob's review):
- Dropped the 'pwrc' and 'onkey' nodes
- Used a common 'reset-time-sec' property

 .../bindings/mfd/actions,atc260x.yaml         | 183 ++++++++++++++++++
 1 file changed, 183 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/actions,atc260x.yaml
Documentation/devicetree/bindings/mfd/actions,atc260x.yaml new file +183 -0
new file mode 100644
index 000000000000..dd43a0c766f3
@@ -0,0 +1,183 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/actions,atc260x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Actions Semi ATC260x Power Management IC bindings
+
+maintainers:
+  - Manivannan Sadhasivam <[email protected]>
+  - Cristian Ciocaltea <[email protected]>
+
+description: |
+  ATC260x series PMICs integrates Audio Codec, Power Management, RTC, IR
+  and GPIO controller blocks. Currently only the PM related functionalities
+  (i.e. regulators and system power-off/reboot) for the ATC2603C and ATC2609A
+  chip variants are supported.
+  ATC2603C includes 3 programmable DC-DC converters, 9 programmable LDO
+  regulators and 1 fixed LDO regulator.
+  ATC2609A includes 5 programmable DC-DC converters and 10 programmable LDO
+  regulators.
+
+allOf:
+  - $ref: ../input/input.yaml
+
+properties:
+  compatible:
+    enum:
+      - actions,atc2603c
+      - actions,atc2609a
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  reset-time-sec:
+    description: |
+      Duration in seconds which the key should be kept pressed for device
+      to reset automatically. The hardware default is 8. Use 0 to disable
+      this functionality.
+    enum: [0, 6, 8, 10, 12]
+
+  regulators:
+    type: object
+    description: |
+      List of child nodes specifying the regulators, depending on chip variant:
+      * ATC2603C: dcdc[1-3], ldo[1-3,5-8,11,12], switchldo1
+      * ATC2609A: dcdc[0-4], ldo[0-9]
+
+    properties:
+      compatible:
+        enum:
+          - actions,atc2603c-regulator
+          - actions,atc2609a-regulator
+
+      switchldo1:
+        type: object
+        $ref: ../regulator/regulator.yaml
+
+        properties:
+          regulator-name: true
+          regulator-boot-on: true
+          regulator-always-on: true
+          regulator-min-microvolt: true
+          regulator-max-microvolt: true
+          regulator-allow-bypass: true
+          regulator-active-discharge: true
+
+        additionalProperties: false
+
+    patternProperties:
+      "^(dcdc[0-4]|ldo[0-9]|ldo1[1-2]|switchldo1)-supply$":
+        description: ATC260x voltage regulators supplies
+
+      "^(dcdc[0-4]|ldo[0-9]|ldo1[1-2])$":
+        type: object
+        $ref: ../regulator/regulator.yaml
+
+        properties:
+          regulator-name: true
+          regulator-boot-on: true
+          regulator-always-on: true
+          regulator-min-microvolt: true
+          regulator-max-microvolt: true
+          regulator-allow-bypass: true
+
+        additionalProperties: false
+
+    allOf:
+      - if:
+          properties:
+            compatible:
+              contains:
+                const: actions,atc2603c-regulator
+        then:
+          patternProperties:
+            "^(dcdc[0,4]|ldo[0,4,9])(-supply)?$": false
+
+            "^(ldo|dcdc)":
+              properties:
+                regulator-allow-bypass: false
+      - if:
+          properties:
+            compatible:
+              contains:
+                const: actions,atc2609a-regulator
+        then:
+          patternProperties:
+            "^(ldo1[1-2]|switchldo1)(-supply)?$": false
+
+            "^(dcdc|ldo[3-9])":
+              properties:
+                regulator-allow-bypass: false
+
+    required:
+      - compatible
+
+    additionalProperties: false
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    i2c0 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        pmic@65 {
+            compatible = "actions,atc2603c";
+            reg = <0x65>;
+            interrupt-parent = <&sirq>;
+            interrupts = <2 IRQ_TYPE_LEVEL_HIGH>;
+
+            reset-time-sec = <6>;
+
+            regulators {
+                compatible = "actions,atc2603c-regulator";
+
+                dcdc1-supply = <&reg_5v0>;
+                dcdc3-supply = <&reg_5v0>;
+                ldo5-supply = <&reg_5v0>;
+                switchldo1-supply = <&vcc>;
+
+                vdd_cpu: dcdc1 {
+                    regulator-name = "VDD_CPU";
+                    regulator-min-microvolt = <700000>;
+                    regulator-max-microvolt = <1400000>;
+                    regulator-always-on;
+                };
+
+                vcc: dcdc3 {
+                    regulator-name = "VCC";
+                    regulator-min-microvolt = <2600000>;
+                    regulator-max-microvolt = <3300000>;
+                    regulator-always-on;
+                };
+
+                vcc_3v1: ldo5 {
+                    regulator-name = "VCC_3V1";
+                    regulator-min-microvolt = <2600000>;
+                    regulator-max-microvolt = <3300000>;
+                };
+
+                sd_vcc: switchldo1 {
+                    regulator-name = "SD_VCC";
+                    regulator-min-microvolt = <3000000>;
+                    regulator-max-microvolt = <3300000>;
+                    regulator-always-on;
+                    regulator-boot-on;
+                };
+            };
+        };
+    };
+
+...
Signature · 1 line
2.30.0
author maintainer
#3 lore raw

PATCH v4 3/7 mfd: Add MFD driver for ATC260x PMICs

In reply to Cristian Ciocaltea

Add initial support for the Actions Semi ATC260x PMICs which integrates Audio Codec, Power management, Clock generation and GPIO controller blocks.

For the moment this driver only supports Regulator, Poweroff and Onkey functionalities for the ATC2603C and ATC2609A chip variants.

Since the PMICs can be accessed using both I2C and SPI buses, the following driver structure has been adopted:

           -----> atc260x-core.c (Implements core functionalities)
          /
ATC260x --------> atc260x-i2c.c (Implements I2C interface)
          \
           -----> atc260x-spi.c (Implements SPI interface - TODO)

---
Changes in v4 - according to Lee's review:
- Replaced 'regmap_add_irq_chip()' with 'devm' counterpart and dropped 'atc260x_device_remove()' and 'atc260x_i2c_remove()' functions
- Moved kerneldoc sections from prototypes to real functions
- Placed single line entries on one line for mfd_cells[]
- Several other minor changes

Changes in v3:
- Fixed the issues reported by Lee's kernel test robot:
WARNING: modpost: missing MODULE_LICENSE() in drivers/mfd/atc260x-core.o

Quoted 1 line
Quoted 1 line

FATAL: modpost: drivers/mfd/atc260x-i2c: sizeof(struct i2c_device_id)=24 is

not a modulo of the size of section __mod_i2c__<identifier>_device_table=588.

Quoted 1 line
Quoted 1 line

Fix definition of struct i2c_device_id in mod_devicetable.h

- Dropped the usage of '.of_compatible' fields in {atc2603c,atc2609a}_mfd_cells[]
- Added 'Co-developed-by' tag in commit message and dropped [cristian: ...] line

 drivers/mfd/Kconfig                  |  18 ++
 drivers/mfd/Makefile                 |   3 +
 drivers/mfd/atc260x-core.c           | 293 +++++++++++++++++++++++++
 drivers/mfd/atc260x-i2c.c            |  64 ++++++
 include/linux/mfd/atc260x/atc2603c.h | 281 ++++++++++++++++++++++++
 include/linux/mfd/atc260x/atc2609a.h | 308 +++++++++++++++++++++++++++
 include/linux/mfd/atc260x/core.h     |  58 +++++
 7 files changed, 1025 insertions(+)
 create mode 100644 drivers/mfd/atc260x-core.c
 create mode 100644 drivers/mfd/atc260x-i2c.c
 create mode 100644 include/linux/mfd/atc260x/atc2603c.h
 create mode 100644 include/linux/mfd/atc260x/atc2609a.h
 create mode 100644 include/linux/mfd/atc260x/core.h
drivers/mfd/Kconfig +18 -0
index bdfce7b15621..a27ff2e83e7a 100644
@@ -2064,6 +2064,24 @@ config MFD_WCD934X
 	  This driver provides common support WCD934x audio codec and its
 	  associated Pin Controller, Soundwire Controller and Audio codec.
 
+config MFD_ATC260X
+	tristate
+	select MFD_CORE
+	select REGMAP
+	select REGMAP_IRQ
+
+config MFD_ATC260X_I2C
+	tristate "Actions Semi ATC260x PMICs with I2C"
+	select MFD_ATC260X
+	select REGMAP_I2C
+	depends on I2C
+	help
+	  Support for the Actions Semi ATC260x PMICs controlled via I2C.
+
+	  This driver provides common support for accessing the ATC2603C
+	  and ATC2609A chip variants, additional drivers must be enabled
+	  in order to use the functionality of the device.
+
 config MFD_KHADAS_MCU
 	tristate "Support for Khadas System control Microcontroller"
 	depends on I2C
drivers/mfd/Makefile +3 -0
index 14fdb188af02..1ea88d2c83b4 100644
@@ -268,3 +268,6 @@ obj-$(CONFIG_MFD_KHADAS_MCU) 	+= khadas-mcu.o
 obj-$(CONFIG_SGI_MFD_IOC3)	+= ioc3.o
 obj-$(CONFIG_MFD_SIMPLE_MFD_I2C)	+= simple-mfd-i2c.o
 obj-$(CONFIG_MFD_INTEL_M10_BMC)   += intel-m10-bmc.o
+
+obj-$(CONFIG_MFD_ATC260X)	+= atc260x-core.o
+obj-$(CONFIG_MFD_ATC260X_I2C)	+= atc260x-i2c.o
drivers/mfd/atc260x-core.c new file +293 -0

293 lines not on this page · raw message

drivers/mfd/atc260x-i2c.c new file +64 -0

64 lines not on this page · raw message

include/linux/mfd/atc260x/atc2603c.h new file +281 -0

281 lines not on this page · raw message

include/linux/mfd/atc260x/atc2609a.h new file +308 -0

308 lines not on this page · raw message

include/linux/mfd/atc260x/core.h new file +58 -0

58 lines not on this page · raw message

Signature · 1 line
2.30.0
author maintainer
#4 lore raw

PATCH v4 4/7 regulator: Add regulator driver for ATC260x PMICs

In reply to Cristian Ciocaltea

Add support for the DC-DC converters and LDO regulators found in the ATC2603C and ATC2609A chip variants of the Actions Semi ATC260x family of PMICs.

---
Changes in v4
- Included the ATC2603C's LDO12 fixed regulator per Mark's suggestion

Changes in v3:
- Dropped 'last_dcdc_reg_id' from 'atc260x_regulator_data' and, instead, provided separate ops for DCDCs and LDOs, as recommended by Mark
- Removed the unnecessary compatibles, per Mark's review
- Added 'Co-developed-by' tag in commit message and dropped [cristian: ...] line

 drivers/regulator/Kconfig             |   8 +
 drivers/regulator/Makefile            |   1 +
 drivers/regulator/atc260x-regulator.c | 539 ++++++++++++++++++++++++++
 3 files changed, 548 insertions(+)
 create mode 100644 drivers/regulator/atc260x-regulator.c
drivers/regulator/Kconfig +8 -0
index 53fa84f4d1e1..c9e28a79362a 100644
@@ -179,6 +179,14 @@ config REGULATOR_AS3722
 	  AS3722 PMIC. This will enable support for all the software
 	  controllable DCDC/LDO regulators.
 
+config REGULATOR_ATC260X
+	tristate "Actions Semi ATC260x PMIC Regulators"
+	depends on MFD_ATC260X
+	help
+	  This driver provides support for the voltage regulators on the
+	  ATC260x PMICs. This will enable support for all the software
+	  controllable DCDC/LDO regulators.
+
 config REGULATOR_AXP20X
 	tristate "X-POWERS AXP20X PMIC Regulators"
 	depends on MFD_AXP20X
drivers/regulator/Makefile +1 -0
index 680e539f6579..36a069f36346 100644
@@ -27,6 +27,7 @@ obj-$(CONFIG_REGULATOR_ARIZONA_MICSUPP) += arizona-micsupp.o
 obj-$(CONFIG_REGULATOR_ARM_SCMI) += scmi-regulator.o
 obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o
 obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o
+obj-$(CONFIG_REGULATOR_ATC260X) += atc260x-regulator.o
 obj-$(CONFIG_REGULATOR_AXP20X) += axp20x-regulator.o
 obj-$(CONFIG_REGULATOR_BCM590XX) += bcm590xx-regulator.o
 obj-$(CONFIG_REGULATOR_BD70528) += bd70528-regulator.o
drivers/regulator/atc260x-regulator.c new file +539 -0

539 lines not on this page · raw message

Signature · 1 line
2.30.0
author maintainer
#5 lore raw

PATCH v4 5/7 power: reset: Add poweroff driver for ATC260x PMICs

In reply to Cristian Ciocaltea

This driver provides poweroff and reboot support for a system through the ATC2603C and ATC2609A chip variants of the Actions Semi ATC260x family of PMICs.

---
Changes in v4:
- None

Changes in v3:
- Removed the unnecessary driver compatibles

 drivers/power/reset/Kconfig            |   8 +-
 drivers/power/reset/Makefile           |   1 +
 drivers/power/reset/atc260x-poweroff.c | 263 +++++++++++++++++++++++++
 3 files changed, 271 insertions(+), 1 deletion(-)
 create mode 100644 drivers/power/reset/atc260x-poweroff.c
drivers/power/reset/Kconfig +7 -1
index b22c4fdb2561..1737e227b16e 100644
@@ -39,6 +39,13 @@ config POWER_RESET_AT91_SAMA5D2_SHDWC
 	  This driver supports the alternate shutdown controller for some Atmel
 	  SAMA5 SoCs. It is present for example on SAMA5D2 SoC.
 
+config POWER_RESET_ATC260X
+	tristate "Actions Semi ATC260x PMIC power-off driver"
+	depends on MFD_ATC260X
+	help
+	  This driver provides power-off and restart support for a system
+	  through Actions Semi ATC260x series PMICs.
+
 config POWER_RESET_AXXIA
 	bool "LSI Axxia reset driver"
 	depends on ARCH_AXXIA
@@ -292,4 +299,3 @@ config NVMEM_REBOOT_MODE
 	  action according to the mode.
 
 endif
-
drivers/power/reset/Makefile +1 -0
index 9dc49d3a57ff..b4601c0a96ed 100644
@@ -3,6 +3,7 @@ obj-$(CONFIG_POWER_RESET_AS3722) += as3722-poweroff.o
 obj-$(CONFIG_POWER_RESET_AT91_POWEROFF) += at91-poweroff.o
 obj-$(CONFIG_POWER_RESET_AT91_RESET) += at91-reset.o
 obj-$(CONFIG_POWER_RESET_AT91_SAMA5D2_SHDWC) += at91-sama5d2_shdwc.o
+obj-$(CONFIG_POWER_RESET_ATC260X) += atc260x-poweroff.o
 obj-$(CONFIG_POWER_RESET_AXXIA) += axxia-reset.o
 obj-$(CONFIG_POWER_RESET_BRCMKONA) += brcm-kona-reset.o
 obj-$(CONFIG_POWER_RESET_BRCMSTB) += brcmstb-reboot.o
drivers/power/reset/atc260x-poweroff.c new file +263 -0

263 lines not on this page · raw message

Signature · 1 line
2.30.0
#6 lore raw

Re: [PATCH v4 5/7] power: reset: Add poweroff driver for ATC260x PMICs

Hi,

Quoted 60 lines · Cristian Ciocaltea

This driver provides poweroff and reboot support for a system through the ATC2603C and ATC2609A chip variants of the Actions Semi ATC260x family of PMICs.

---
Changes in v4:
- None

Changes in v3:
- Removed the unnecessary driver compatibles

 drivers/power/reset/Kconfig            |   8 +-
 drivers/power/reset/Makefile           |   1 +
 drivers/power/reset/atc260x-poweroff.c | 263 +++++++++++++++++++++++++
 3 files changed, 271 insertions(+), 1 deletion(-)
 create mode 100644 drivers/power/reset/atc260x-poweroff.c
drivers/power/reset/Kconfig +7 -1
index b22c4fdb2561..1737e227b16e 100644
@@ -39,6 +39,13 @@ config POWER_RESET_AT91_SAMA5D2_SHDWC
 	  This driver supports the alternate shutdown controller for some Atmel
 	  SAMA5 SoCs. It is present for example on SAMA5D2 SoC.
 
+config POWER_RESET_ATC260X
+	tristate "Actions Semi ATC260x PMIC power-off driver"
+	depends on MFD_ATC260X
+	help
+	  This driver provides power-off and restart support for a system
+	  through Actions Semi ATC260x series PMICs.
+
 config POWER_RESET_AXXIA
 	bool "LSI Axxia reset driver"
 	depends on ARCH_AXXIA
@@ -292,4 +299,3 @@ config NVMEM_REBOOT_MODE
 	  action according to the mode.
 
 endif
-
drivers/power/reset/Makefile +1 -0
index 9dc49d3a57ff..b4601c0a96ed 100644
@@ -3,6 +3,7 @@ obj-$(CONFIG_POWER_RESET_AS3722) += as3722-poweroff.o
 obj-$(CONFIG_POWER_RESET_AT91_POWEROFF) += at91-poweroff.o
 obj-$(CONFIG_POWER_RESET_AT91_RESET) += at91-reset.o
 obj-$(CONFIG_POWER_RESET_AT91_SAMA5D2_SHDWC) += at91-sama5d2_shdwc.o
+obj-$(CONFIG_POWER_RESET_ATC260X) += atc260x-poweroff.o
 obj-$(CONFIG_POWER_RESET_AXXIA) += axxia-reset.o
 obj-$(CONFIG_POWER_RESET_BRCMKONA) += brcm-kona-reset.o
 obj-$(CONFIG_POWER_RESET_BRCMSTB) += brcmstb-reboot.o
drivers/power/reset/atc260x-poweroff.c new file +1 -0
new file mode 100644
index 000000000000..81b050f99302
@@ -0,0 +1,263 @@
+// SPDX-License-Identifier: GPL-2.0+

drivers/power/reset/atc260x-poweroff.c line 11

Quoted 10 lines
drivers/power/reset/atc260x-poweroff.c new file +10 -0
+/*
+ * Poweroff & reset driver for Actions Semi ATC260x PMICs
+ *
+ * Copyright (c) 2020 Cristian Ciocaltea <[email protected]>
+ */
+
+#include <linux/delay.h>
+#include <linux/mfd/atc260x/core.h>
+#include <linux/module.h>
+#include <linux/of.h>

There is no DT code in this driver?

drivers/power/reset/atc260x-poweroff.c line 13

Quoted 2 lines
drivers/power/reset/atc260x-poweroff.c new file +2 -0
+#include <linux/platform_device.h>
+#include <linux/power_supply.h>

power_supply.h? That's for chargers and battery fuel gauges.

drivers/power/reset/atc260x-poweroff.c

Quoted 4 lines
drivers/power/reset/atc260x-poweroff.c new file +2 -0
+#include <linux/reboot.h>
+#include <linux/regmap.h>
 
[...]

Otherwise LGTM. I suppose I can cherry-pick this patch into my tree, or did I miss some dependencies?

-- Sebastian

author maintainer
#7 lore raw

Re: [PATCH v4 5/7] power: reset: Add poweroff driver for ATC260x PMICs

Hi Sebastian,

Quoted 15 lines · Sebastian Reichel

Hi,

Quoted 12 lines · Cristian Ciocaltea

This driver provides poweroff and reboot support for a system through the ATC2603C and ATC2609A chip variants of the Actions Semi ATC260x family of PMICs.

---
Changes in v4:
- None

Changes in v3:
- Removed the unnecessary driver compatibles

Quoted 7 lines

drivers/power/reset/atc260x-poweroff.c line 11

Quoted 5 lines

[...]

drivers/power/reset/atc260x-poweroff.c new file +4 -0
+#include <linux/delay.h>
+#include <linux/mfd/atc260x/core.h>
+#include <linux/module.h>
+#include <linux/of.h>

There is no DT code in this driver?

Right, this line is not needed anymore, I will drop it and submit a new patch revision.

Quoted 4 lines

drivers/power/reset/atc260x-poweroff.c line 13

Quoted 2 lines
drivers/power/reset/atc260x-poweroff.c new file +2 -0
+#include <linux/platform_device.h>
+#include <linux/power_supply.h>

power_supply.h? That's for chargers and battery fuel gauges.

That is only used for checking if the S4 mode is available - which involves calling 'power_supply_is_system_supplied()'.

Quoted 7 lines

drivers/power/reset/atc260x-poweroff.c

Quoted 4 lines
drivers/power/reset/atc260x-poweroff.c new file +2 -0
+#include <linux/reboot.h>
+#include <linux/regmap.h>
 
[...]

Otherwise LGTM. I suppose I can cherry-pick this patch into my tree, or did I miss some dependencies?

I'm not really sure what is the recommended approach (if any) for merging MFD drivers.

The only dependency is the PMIC core driver in patch 3/7, which is handled in Kconfig through 'depends on MFD_ATC260X'.

So far, Mark applied the regulator driver patch to his tree, while Dmitry suggested to merge the onkey driver through MFD. So I think both approaches are fine.

@Lee: Do you have any preference or recommendation for handling this?

Quoted 1 line

-- Sebastian

Thanks for the review,
Cristi

author maintainer
#8 lore raw

PATCH v4 6/7 input: atc260x: Add onkey driver for ATC260x PMICs

In reply to Cristian Ciocaltea

The Actions Semi ATC260x PMICs are able to manage an onkey button. This driver exposes the ATC260x onkey as an input device. It can also be configured to force a system reset on a long key-press with an adjustable duration.

The currently supported chip variants are ATC2603C and ATC2609A.

---
Changes in v4:
- Added Acked-by from Dmitry

Changes in v3:
- Integrated Dmitry's review:
* Dropped the logic around the check for 'pdev->dev.of_node'
* Renamed 'ret' variable in 'atc260x_onkey_probe()' to 'error'
* Used 'dev_dbg' instead of 'dev_info' on status KEY_RESET_DISABLED
* Dropped 'input_dev->evbit[0] = BIT_MASK(EV_KEY);'
* Removed IRQF_TRIGGER_HIGH flag on 'devm_request_threaded_irq()'
* Implemented open/close to mitigate the racing issue in

     'atc260x_onkey_remove()' which has been dropped now

- Removed the unnecessary driver compatibles
- Used 'reset-time-sec' property of the parent device instead of 'actions,reset-time-sec' of now obsolete and removed 'onkey' DT node

 drivers/input/misc/Kconfig         |  11 ++
 drivers/input/misc/Makefile        |   2 +-
 drivers/input/misc/atc260x-onkey.c | 305 +++++++++++++++++++++++++++++
 3 files changed, 317 insertions(+), 1 deletion(-)
 create mode 100644 drivers/input/misc/atc260x-onkey.c
drivers/input/misc/Kconfig +11 -0
index ad1b6c90bc4d..7237dc440b98 100644
@@ -94,6 +94,17 @@ config INPUT_ARIZONA_HAPTICS
 	  To compile this driver as a module, choose M here: the
 	  module will be called arizona-haptics.
 
+config INPUT_ATC260X_ONKEY
+	tristate "Actions Semi ATC260x PMIC ONKEY"
+	depends on MFD_ATC260X
+	help
+	  Support the ONKEY of ATC260x PMICs as an input device reporting
+	  power button status. ONKEY can be used to wakeup from low power
+	  modes and force a reset on long press.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called atc260x-onkey.
+
 config INPUT_ATMEL_CAPTOUCH
 	tristate "Atmel Capacitive Touch Button Driver"
 	depends on OF || COMPILE_TEST
drivers/input/misc/Makefile +1 -1
index 7f202ba8f775..46db664a8bc4 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_INPUT_ADXL34X_SPI)		+= adxl34x-spi.o
 obj-$(CONFIG_INPUT_APANEL)		+= apanel.o
 obj-$(CONFIG_INPUT_ARIEL_PWRBUTTON)	+= ariel-pwrbutton.o
 obj-$(CONFIG_INPUT_ARIZONA_HAPTICS)	+= arizona-haptics.o
+obj-$(CONFIG_INPUT_ATC260X_ONKEY)	+= atc260x-onkey.o
 obj-$(CONFIG_INPUT_ATI_REMOTE2)		+= ati_remote2.o
 obj-$(CONFIG_INPUT_ATLAS_BTNS)		+= atlas_btns.o
 obj-$(CONFIG_INPUT_ATMEL_CAPTOUCH)	+= atmel_captouch.o
@@ -86,4 +87,3 @@ obj-$(CONFIG_INPUT_WM831X_ON)		+= wm831x-on.o
 obj-$(CONFIG_INPUT_XEN_KBDDEV_FRONTEND)	+= xen-kbdfront.o
 obj-$(CONFIG_INPUT_YEALINK)		+= yealink.o
 obj-$(CONFIG_INPUT_IDEAPAD_SLIDEBAR)	+= ideapad_slidebar.o
-
drivers/input/misc/atc260x-onkey.c new file +305 -0

305 lines not on this page · raw message

Signature · 1 line
2.30.0
author maintainer
#9 lore raw

PATCH v4 7/7 MAINTAINERS: Add entry for ATC260x PMIC

In reply to Cristian Ciocaltea

From: Manivannan Sadhasivam <[email protected]>

Add MAINTAINERS entry for ATC260x PMIC.

[cristian: change binding doc file path, add file patterns for onkey and
poweroff drivers, fix ordering, add myself as co-maintainer]

---
Changes in v4:
- None

Changes in v3:
- Restored the authorship of the patch to Mani

 MAINTAINERS | 12 ++++++++++++
 1 file changed, 12 insertions(+)
MAINTAINERS +12 -0
index 74a6eaae7b31..8bbf7d9b8f23 100644
@@ -2892,6 +2892,18 @@ W:	http://www.openaoe.org/
 F:	Documentation/admin-guide/aoe/
 F:	drivers/block/aoe/
 
+ATC260X PMIC MFD DRIVER
+M:	Manivannan Sadhasivam <[email protected]>
+M:	Cristian Ciocaltea <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/mfd/actions,atc260x.yaml
+F:	drivers/input/misc/atc260x-onkey.c
+F:	drivers/mfd/atc260*
+F:	drivers/power/reset/atc260x-poweroff.c
+F:	drivers/regulator/atc260x-regulator.c
+F:	include/linux/mfd/atc260x/*
+
 ATHEROS 71XX/9XXX GPIO DRIVER
 M:	Alban Bedel <[email protected]>
 S:	Maintained
Signature · 1 line
2.30.0