[PATCH v4 0/4] TI TPS6594 PMIC support (Core, ESM, PFSM)

From: Julien Panis
Date: Mon Mar 27 2023 - 11:41:34 EST


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). The SoC and the PMIC can
communicate through the I2C or SPI interfaces.
TPS6594 is the super-set device while TPS6593 and LP8764X are derivatives.

This series adds support to TI TPS6594 PMIC and its derivatives.

The features implemented in this series are:
- Core (MFD I2C and SPI entry points)
- ESM (child device)
- PFSM (child device)

- Core description:
I2C and SPI interface protocols are implemented, with and without
the bit-integrity error detection feature (CRC mode).
In multi-PMIC configuration, all instances share a single GPIO of
the SoC to generate interrupt requests via their respective nINT
output pin.

- ESM description:
This device monitors the SoC error output signal at its nERR_SOC
input pin. In error condition, ESM toggles its nRSTOUT_SOC pin
to reset the SoC.
Basically, ESM driver starts ESM hardware.

- PFSM description:
Strictly speaking, PFSM is not hardware. It is a piece of code.
PMIC integrates a state machine which manages operational modes.
Depending on the current operational mode, some voltage domains
remain energized while others can be off.
PFSM driver can be used to trigger transitions between configured
states.

Changes since v3:
* [dt-bindings] Remove 'x' from 'ti,lp8764x' compatible.
* [MFD i2c/spi drivers] Remove 'x' from 'ti,lp8764x' compatible.
* [MFD core driver] Drop Lee's Ack on patch 2/4 because additional
testing revealed a major bug in 'tps6594-core.c':
Based on the assumption that CRC feature is disabled on PMIC at power
on, the first I2C command sent ('PFSM I2C_2 trigger') to enable CRC
feature is sent without CRC. Though, there are situations where CRC
feature can be enabled already on PMIC at I2C/SPI modprobe:
- when I2C/SPI module is unloaded/reloaded,
- when a PMIC transition (from RETENTION to ACTIVE state) is triggered
by an RTC alarm (SoC is powered on).
In these situations, the first I2C command sent to enable CRC feature
generates an error (because of missing CRC in that command !). This v4
fixes the issue: first the 'CRC_EN' bit is tested, and then, if CRC
feature is not already enabled, the I2C command enabling it is sent.
Functions slightly modified:
- tps6594_device_init(),
- tps6594_set_crc_feature().

Link to v3:
https://lore.kernel.org/all/20230321171020.74736-1-jpanis@xxxxxxxxxxxx/

Others series will be submitted over the next few weeks, providing
drivers for others child devices like GPIOs (pinctrl), RTC, and
regulators. Board support will also be added (device trees).

Julien Panis (4):
dt-bindings: mfd: Add TI TPS6594 PMIC
mfd: tps6594: Add driver for TI TPS6594 PMIC
misc: tps6594-esm: Add driver for TI TPS6594 ESM
misc: tps6594-pfsm: Add driver for TI TPS6594 PFSM

.../devicetree/bindings/mfd/ti,tps6594.yaml | 231 ++++
.../userspace-api/ioctl/ioctl-number.rst | 1 +
drivers/mfd/Kconfig | 32 +
drivers/mfd/Makefile | 3 +
drivers/mfd/tps6594-core.c | 462 ++++++++
drivers/mfd/tps6594-i2c.c | 244 ++++
drivers/mfd/tps6594-spi.c | 129 +++
drivers/misc/Kconfig | 23 +
drivers/misc/Makefile | 2 +
drivers/misc/tps6594-esm.c | 132 +++
drivers/misc/tps6594-pfsm.c | 304 +++++
include/linux/mfd/tps6594.h | 1020 +++++++++++++++++
include/uapi/linux/tps6594_pfsm.h | 45 +
13 files changed, 2628 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mfd/ti,tps6594.yaml
create mode 100644 drivers/mfd/tps6594-core.c
create mode 100644 drivers/mfd/tps6594-i2c.c
create mode 100644 drivers/mfd/tps6594-spi.c
create mode 100644 drivers/misc/tps6594-esm.c
create mode 100644 drivers/misc/tps6594-pfsm.c
create mode 100644 include/linux/mfd/tps6594.h
create mode 100644 include/uapi/linux/tps6594_pfsm.h


base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
--
2.37.3