From 51b93acbea693525809d8c93114b63dfc83fef41 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 11:51:42 -0647 Subject: [PATCH 01/26] dt-bindings: gpio: Add the Maxim MAX77779 PMIC block The MAX77779 interface PMIC (Google Pixel 9a) is a set of I2C blocks on one chip; the charger, the fuel gauge and the Type-C port controller have their bindings. The PMIC block at 0x66 owns the chip's interrupt line and eight SGPIO pins with interrupt support, which carry the board's charger side signals (the RT9470 boost's interrupt and enable, the wireless charger's lines). Describe it as a GPIO and interrupt controller. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../bindings/gpio/maxim,max77779-pmic.yaml | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/maxim,max77779-pmic.yaml diff --git a/Documentation/devicetree/bindings/gpio/maxim,max77779-pmic.yaml b/Documentation/devicetree/bindings/gpio/maxim,max77779-pmic.yaml new file mode 100644 index 0000000000..d6ea8eb63f --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/maxim,max77779-pmic.yaml @@ -0,0 +1,70 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/maxim,max77779-pmic.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Maxim Integrated MAX77779 PMIC block (SGPIO) + +maintainers: + - W4HO <87742609+W4HO-ham@users.noreply.github.com> + +description: | + The MAX77779 interface PMIC is a set of I2C blocks on one chip: the + charger (maxim,max77779-charger), the fuel gauge (maxim,max77779-fg), the + Type-C port controller (maxim,max77779-tcpc) and the PMIC block, which + owns the chip's interrupt line and eight SGPIO pins with interrupt + support. This binding describes the PMIC block. + +properties: + compatible: + const: maxim,max77779-pmic + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + description: The chip's interrupt line (INTB), active low. + + "#gpio-cells": + const: 2 + + gpio-controller: true + + gpio-line-names: + minItems: 1 + maxItems: 8 + + "#interrupt-cells": + const: 2 + + interrupt-controller: true + +required: + - compatible + - reg + - "#gpio-cells" + - gpio-controller + +additionalProperties: false + +examples: + - | + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pmic@66 { + compatible = "maxim,max77779-pmic"; + reg = <0x66>; + interrupt-parent = <&gpa8>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + }; From a6e10f2baa9b7013bb79d52eb53b455420d44326 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 11:51:42 -0647 Subject: [PATCH 02/26] gpio: Add the Maxim MAX77779 PMIC's SGPIO block The MAX77779 (Google Pixel 9a) is a set of I2C blocks on one chip. The PMIC block at 0x66 owns the chip's interrupt line (INTB) and eight SGPIO pins; on the 9a they carry the RT9470 OTG boost's interrupt (SGPIO6) and chip enable (SGPIO7) and the wireless charger's lines. Without them the boost can't keep its 40 s I2C watchdog, which Google's driver services from that interrupt. Add a driver for the block: a GPIO chip for the eight pins (direction, level, pull-up and pull-down through set_config) with an interrupt chip. Each pin's edge trigger is programmed in its CNFG register; a level request takes the edge into the level and the handler re-checks the pin, leaving the interrupt uncleared while the level holds, as Google's driver does. The handler reads INTSRC_STS, dispatches the SGPIO source and acknowledges the rest; the other sources the block gathers (charger, gauge, port controller) have their own lines to the SoC on this board and stay masked. The register map is Google's max77779_regs.h (google-modules/bms): ID 0x00, INTSRC_STS 0x22, INTB_MASK 0x24, SGPIO_INT 0xe8, PU 0xe9, PD 0xea, CNFG0-7 0xed-0xf4. Tested on the Pixel 9a against the running kernel, the device instantiated on hsi2c6 without an interrupt line: the block answers with ID 0x79, revision 0x02, OTP 0x21; the chip registers eight lines and the register readout matches the OTP defaults (SGPIO6 an input, pull-down set; SGPIO7 off). The interrupt path and the pin configurations stock applies (pull-up on SGPIO6, SGPIO7 as the enable) wait for the board commit that adds the node and the RT9470's lines. Link: https://android.googlesource.com/kernel/google-modules/bms/+/183509aff980610401869deca9f6ce8836980fe7/max77779_pmic_sgpio.c Link: https://android.googlesource.com/kernel/devices/google/zuma/+/42395e8adcb880aa336f0da6bb2a19ed53929c40/dts/zuma-max777xx.dtsi Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- drivers/gpio/Kconfig | 12 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-max77779.c | 455 +++++++++++++++++++++++++++++++++++ 3 files changed, 468 insertions(+) create mode 100644 drivers/gpio/gpio-max77779.c diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 819f1053eb..6d74a2045d 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -1592,6 +1592,18 @@ config GPIO_MAX77650 GPIO driver for MAX77650/77651 PMIC from Maxim Semiconductor. These chips have a single pin that can be configured as GPIO. +config GPIO_MAX77779 + tristate "Maxim Integrated MAX77779 PMIC SGPIO support" + depends on I2C + select REGMAP_I2C + select GPIOLIB_IRQCHIP + help + GPIO driver for the SGPIO block of the MAX77779 interface PMIC from + Maxim Integrated (Google Pixel 9a). The eight pins can generate + interrupts; the board's charger side signals sit on them. + + Say M to build it as a module, called gpio-max77779. + config GPIO_MAX77759 tristate "Maxim Integrated MAX77759 GPIO support" depends on MFD_MAX77759 diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index ebd234ee7e..c9620ba353 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -113,6 +113,7 @@ obj-$(CONFIG_GPIO_MAX7360) += gpio-max7360.o obj-$(CONFIG_GPIO_MAX77620) += gpio-max77620.o obj-$(CONFIG_GPIO_MAX77650) += gpio-max77650.o obj-$(CONFIG_GPIO_MAX77759) += gpio-max77759.o +obj-$(CONFIG_GPIO_MAX77779) += gpio-max77779.o obj-$(CONFIG_GPIO_MB86S7X) += gpio-mb86s7x.o obj-$(CONFIG_GPIO_MC33880) += gpio-mc33880.o obj-$(CONFIG_GPIO_MENZ127) += gpio-menz127.o diff --git a/drivers/gpio/gpio-max77779.c b/drivers/gpio/gpio-max77779.c new file mode 100644 index 0000000000..423513975a --- /dev/null +++ b/drivers/gpio/gpio-max77779.c @@ -0,0 +1,455 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// GPIO driver for the Maxim MAX77779 interface PMIC's SGPIO block +// +// The MAX77779 (Google Pixel 9a) is a set of I2C blocks on one chip: the +// charger, the fuel gauge, the Type-C port controller and, at 0x66, the +// PMIC block that owns the chip's interrupt line and eight SGPIO pins. The +// pins carry the board's charger side signals (the RT9470 boost's interrupt +// and enable, the wireless charger's lines). This driver binds to the PMIC +// block and exposes the SGPIOs as a GPIO chip with interrupts. The other +// interrupt sources the block gathers (the charger, the gauge, the port +// controller) have their own lines to the SoC on this board and stay masked +// here. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX77779_PMIC_ID 0x00 +#define MAX77779_PMIC_ID_VALUE 0x79 +#define MAX77779_PMIC_REVISION 0x01 +#define MAX77779_PMIC_OTP_REVISION 0x02 +#define MAX77779_PMIC_INTSRC_STS 0x22 /* write 1 to clear */ +#define MAX77779_PMIC_INTSRC_GPIO BIT(5) +#define MAX77779_PMIC_INTB_MASK 0x24 /* 1 = masked */ + +#define MAX77779_SGPIO_INT 0xe8 /* write 1 to clear */ +#define MAX77779_SGPIO_PU 0xe9 +#define MAX77779_SGPIO_PD 0xea +#define MAX77779_SGPIO_CNFG(n) (0xed + (n)) +#define MAX77779_SGPIO_CNFG_DATA BIT(0) +#define MAX77779_SGPIO_CNFG_VGPI_EN BIT(1) +#define MAX77779_SGPIO_CNFG_MODE GENMASK(3, 2) +#define MAX77779_SGPIO_MODE_INPUT 1 +#define MAX77779_SGPIO_MODE_OUTPUT 2 +#define MAX77779_SGPIO_CNFG_DBNC GENMASK(5, 4) +#define MAX77779_SGPIO_CNFG_IRQ GENMASK(7, 6) +#define MAX77779_SGPIO_IRQ_NONE 0 +#define MAX77779_SGPIO_IRQ_FALLING 1 +#define MAX77779_SGPIO_IRQ_RISING 2 +#define MAX77779_SGPIO_IRQ_BOTH 3 +#define MAX77779_VGPI_CNFG 0xfb + +#define MAX77779_N_SGPIO 8 + +struct max77779_gpio { + struct regmap *map; + struct gpio_chip gc; + struct mutex irq_lock; /* the irq bus: trigger and mask changes */ + u8 irq_trig[MAX77779_N_SGPIO]; + unsigned long irq_masked; + unsigned long irq_changed; +}; + +static const struct regmap_range max77779_pmic_volatile_ranges[] = { + regmap_reg_range(MAX77779_PMIC_ID, MAX77779_PMIC_OTP_REVISION), + regmap_reg_range(MAX77779_PMIC_INTSRC_STS, MAX77779_PMIC_INTSRC_STS), + regmap_reg_range(MAX77779_SGPIO_INT, MAX77779_SGPIO_INT), + /* CNFGx carries the pin's live level in DATA */ + regmap_reg_range(MAX77779_SGPIO_CNFG(0), MAX77779_SGPIO_CNFG(7)), +}; + +static const struct regmap_access_table max77779_pmic_volatile_table = { + .yes_ranges = max77779_pmic_volatile_ranges, + .n_yes_ranges = ARRAY_SIZE(max77779_pmic_volatile_ranges), +}; + +static const struct regmap_config max77779_pmic_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = MAX77779_VGPI_CNFG, + .volatile_table = &max77779_pmic_volatile_table, + .cache_type = REGCACHE_NONE, +}; + +static int max77779_gpio_get_direction(struct gpio_chip *gc, unsigned int offset) +{ + struct max77779_gpio *chip = gpiochip_get_data(gc); + unsigned int cnfg; + int ret; + + ret = regmap_read(chip->map, MAX77779_SGPIO_CNFG(offset), &cnfg); + if (ret) + return ret; + + switch (FIELD_GET(MAX77779_SGPIO_CNFG_MODE, cnfg)) { + case MAX77779_SGPIO_MODE_INPUT: + return GPIO_LINE_DIRECTION_IN; + case MAX77779_SGPIO_MODE_OUTPUT: + return GPIO_LINE_DIRECTION_OUT; + default: + /* 0: the pin is off; 3: reserved */ + return -ENODEV; + } +} + +static int max77779_gpio_direction_input(struct gpio_chip *gc, unsigned int offset) +{ + struct max77779_gpio *chip = gpiochip_get_data(gc); + + return regmap_update_bits(chip->map, MAX77779_SGPIO_CNFG(offset), + MAX77779_SGPIO_CNFG_MODE, + FIELD_PREP(MAX77779_SGPIO_CNFG_MODE, + MAX77779_SGPIO_MODE_INPUT)); +} + +static int max77779_gpio_direction_output(struct gpio_chip *gc, + unsigned int offset, int value) +{ + struct max77779_gpio *chip = gpiochip_get_data(gc); + + return regmap_update_bits(chip->map, MAX77779_SGPIO_CNFG(offset), + MAX77779_SGPIO_CNFG_MODE | MAX77779_SGPIO_CNFG_DATA, + FIELD_PREP(MAX77779_SGPIO_CNFG_MODE, + MAX77779_SGPIO_MODE_OUTPUT) | + FIELD_PREP(MAX77779_SGPIO_CNFG_DATA, !!value)); +} + +static int max77779_gpio_get(struct gpio_chip *gc, unsigned int offset) +{ + struct max77779_gpio *chip = gpiochip_get_data(gc); + unsigned int cnfg; + int ret; + + ret = regmap_read(chip->map, MAX77779_SGPIO_CNFG(offset), &cnfg); + if (ret) + return ret; + + return !!(cnfg & MAX77779_SGPIO_CNFG_DATA); +} + +static int max77779_gpio_set(struct gpio_chip *gc, unsigned int offset, int value) +{ + struct max77779_gpio *chip = gpiochip_get_data(gc); + + return regmap_update_bits(chip->map, MAX77779_SGPIO_CNFG(offset), + MAX77779_SGPIO_CNFG_DATA, + FIELD_PREP(MAX77779_SGPIO_CNFG_DATA, !!value)); +} + +static int max77779_gpio_set_config(struct gpio_chip *gc, unsigned int offset, + unsigned long config) +{ + struct max77779_gpio *chip = gpiochip_get_data(gc); + unsigned int pu = 0, pd = 0; + int ret; + + switch (pinconf_to_config_param(config)) { + case PIN_CONFIG_BIAS_PULL_UP: + pu = BIT(offset); + break; + case PIN_CONFIG_BIAS_PULL_DOWN: + pd = BIT(offset); + break; + case PIN_CONFIG_BIAS_DISABLE: + break; + default: + return -ENOTSUPP; + } + + ret = regmap_update_bits(chip->map, MAX77779_SGPIO_PU, BIT(offset), pu); + if (ret) + return ret; + + return regmap_update_bits(chip->map, MAX77779_SGPIO_PD, BIT(offset), pd); +} + +static void max77779_gpio_irq_mask(struct irq_data *d) +{ + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + struct max77779_gpio *chip = gpiochip_get_data(gc); + irq_hw_number_t hwirq = irqd_to_hwirq(d); + + set_bit(hwirq, &chip->irq_masked); + set_bit(hwirq, &chip->irq_changed); + gpiochip_disable_irq(gc, hwirq); +} + +static void max77779_gpio_irq_unmask(struct irq_data *d) +{ + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + struct max77779_gpio *chip = gpiochip_get_data(gc); + irq_hw_number_t hwirq = irqd_to_hwirq(d); + + gpiochip_enable_irq(gc, hwirq); + clear_bit(hwirq, &chip->irq_masked); + set_bit(hwirq, &chip->irq_changed); +} + +static int max77779_gpio_irq_set_type(struct irq_data *d, unsigned int type) +{ + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + struct max77779_gpio *chip = gpiochip_get_data(gc); + irq_hw_number_t hwirq = irqd_to_hwirq(d); + + /* + * The SGPIOs detect edges. A level request takes the edge into the + * level, and the handler re-checks the pin afterwards: while the level + * holds, the interrupt isn't cleared and fires again. + */ + switch (type) { + case IRQ_TYPE_EDGE_RISING: + case IRQ_TYPE_LEVEL_HIGH: + chip->irq_trig[hwirq] = MAX77779_SGPIO_IRQ_RISING; + break; + case IRQ_TYPE_EDGE_FALLING: + case IRQ_TYPE_LEVEL_LOW: + chip->irq_trig[hwirq] = MAX77779_SGPIO_IRQ_FALLING; + break; + case IRQ_TYPE_EDGE_BOTH: + chip->irq_trig[hwirq] = MAX77779_SGPIO_IRQ_BOTH; + break; + default: + return -EINVAL; + } + set_bit(hwirq, &chip->irq_changed); + + return 0; +} + +static void max77779_gpio_irq_bus_lock(struct irq_data *d) +{ + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + struct max77779_gpio *chip = gpiochip_get_data(gc); + + mutex_lock(&chip->irq_lock); +} + +static void max77779_gpio_irq_bus_sync_unlock(struct irq_data *d) +{ + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + struct max77779_gpio *chip = gpiochip_get_data(gc); + unsigned long changed = chip->irq_changed; + unsigned int offset; + int ret; + + for_each_set_bit(offset, &changed, MAX77779_N_SGPIO) { + u8 sel = test_bit(offset, &chip->irq_masked) ? + MAX77779_SGPIO_IRQ_NONE : chip->irq_trig[offset]; + + ret = regmap_update_bits(chip->map, MAX77779_SGPIO_CNFG(offset), + MAX77779_SGPIO_CNFG_IRQ, + FIELD_PREP(MAX77779_SGPIO_CNFG_IRQ, sel)); + if (ret) + dev_err(gc->parent, "SGPIO%u: can't set the trigger: %d\n", + offset, ret); + else + clear_bit(offset, &chip->irq_changed); + } + + mutex_unlock(&chip->irq_lock); +} + +static void max77779_gpio_irq_print_chip(struct irq_data *d, struct seq_file *p) +{ + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + + seq_puts(p, dev_name(gc->parent)); +} + +static const struct irq_chip max77779_gpio_irq_chip = { + .irq_mask = max77779_gpio_irq_mask, + .irq_unmask = max77779_gpio_irq_unmask, + .irq_set_type = max77779_gpio_irq_set_type, + .irq_bus_lock = max77779_gpio_irq_bus_lock, + .irq_bus_sync_unlock = max77779_gpio_irq_bus_sync_unlock, + .irq_print_chip = max77779_gpio_irq_print_chip, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + +/* A level-typed line is done only once the pin has left the active level */ +static bool max77779_gpio_level_done(struct max77779_gpio *chip, unsigned int offset) +{ + struct irq_data *d = irq_get_irq_data(irq_find_mapping(chip->gc.irq.domain, + offset)); + unsigned int cnfg, type; + int ret; + + type = d ? irqd_get_trigger_type(d) : IRQ_TYPE_NONE; + if (!(type & IRQ_TYPE_LEVEL_MASK)) + return true; + + ret = regmap_read(chip->map, MAX77779_SGPIO_CNFG(offset), &cnfg); + if (ret) + return true; + + if (type & IRQ_TYPE_LEVEL_LOW) + return cnfg & MAX77779_SGPIO_CNFG_DATA; + return !(cnfg & MAX77779_SGPIO_CNFG_DATA); +} + +static irqreturn_t max77779_gpio_irq_handler(int irq, void *data) +{ + struct max77779_gpio *chip = data; + struct gpio_chip *gc = &chip->gc; + bool handled = false; + unsigned int src, sts; + unsigned long pending; + unsigned int offset; + u8 done; + int ret; + + ret = regmap_read(chip->map, MAX77779_PMIC_INTSRC_STS, &src); + if (ret) { + dev_err_ratelimited(gc->parent, "can't read INTSRC_STS: %d\n", ret); + return IRQ_NONE; + } + + if (src & MAX77779_PMIC_INTSRC_GPIO) { + ret = regmap_read(chip->map, MAX77779_SGPIO_INT, &sts); + if (ret) { + dev_err_ratelimited(gc->parent, "can't read SGPIO_INT: %d\n", ret); + return IRQ_NONE; + } + + pending = sts; + done = 0; + for_each_set_bit(offset, &pending, MAX77779_N_SGPIO) { + handle_nested_irq(irq_find_mapping(gc->irq.domain, offset)); + if (max77779_gpio_level_done(chip, offset)) + done |= BIT(offset); + handled = true; + } + /* clear only what is done: a held level fires again */ + if (done) + regmap_write(chip->map, MAX77779_SGPIO_INT, done); + } + + /* the other sources are masked; acknowledge whatever is set */ + if (src) + regmap_write(chip->map, MAX77779_PMIC_INTSRC_STS, src); + + return IRQ_RETVAL(handled || src); +} + +static int max77779_gpio_probe(struct i2c_client *client) +{ + struct device *dev = &client->dev; + struct max77779_gpio *chip; + struct gpio_irq_chip *girq; + unsigned int id, rev; + int ret; + + chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; + + chip->map = devm_regmap_init_i2c(client, &max77779_pmic_regmap_config); + if (IS_ERR(chip->map)) + return dev_err_probe(dev, PTR_ERR(chip->map), "can't init the regmap\n"); + + ret = regmap_read(chip->map, MAX77779_PMIC_ID, &id); + if (ret) + return dev_err_probe(dev, ret, "can't read the ID\n"); + if (id != MAX77779_PMIC_ID_VALUE) + return dev_err_probe(dev, -ENODEV, "ID 0x%02x is not a MAX77779\n", id); + ret = regmap_read(chip->map, MAX77779_PMIC_REVISION, &rev); + if (ret) + return dev_err_probe(dev, ret, "can't read the revision\n"); + dev_info(dev, "MAX77779 PMIC revision 0x%02x\n", rev); + + ret = devm_mutex_init(dev, &chip->irq_lock); + if (ret) + return ret; + + /* every pin's interrupt off, everything masked and acknowledged */ + chip->irq_masked = GENMASK(MAX77779_N_SGPIO - 1, 0); + chip->irq_changed = chip->irq_masked; + ret = regmap_write(chip->map, MAX77779_PMIC_INTB_MASK, 0xff); + if (ret) + return dev_err_probe(dev, ret, "can't mask the interrupts\n"); + regmap_write(chip->map, MAX77779_SGPIO_INT, 0xff); + regmap_write(chip->map, MAX77779_PMIC_INTSRC_STS, 0xff); + + chip->gc.base = -1; + chip->gc.label = dev_name(dev); + chip->gc.parent = dev; + chip->gc.owner = THIS_MODULE; + chip->gc.can_sleep = true; + chip->gc.ngpio = MAX77779_N_SGPIO; + chip->gc.get_direction = max77779_gpio_get_direction; + chip->gc.direction_input = max77779_gpio_direction_input; + chip->gc.direction_output = max77779_gpio_direction_output; + chip->gc.get = max77779_gpio_get; + chip->gc.set = max77779_gpio_set; + chip->gc.set_config = max77779_gpio_set_config; + + girq = &chip->gc.irq; + gpio_irq_chip_set_chip(girq, &max77779_gpio_irq_chip); + /* the parent interrupt is handled here */ + girq->parent_handler = NULL; + girq->num_parents = 0; + girq->parents = NULL; + girq->default_type = IRQ_TYPE_NONE; + girq->handler = handle_simple_irq; + girq->threaded = true; + + ret = devm_gpiochip_add_data(dev, &chip->gc, chip); + if (ret) + return dev_err_probe(dev, ret, "can't add the GPIO chip\n"); + + if (client->irq <= 0) { + dev_info(dev, "no interrupt line: the SGPIOs don't interrupt\n"); + return 0; + } + + ret = devm_request_threaded_irq(dev, client->irq, NULL, + max77779_gpio_irq_handler, + IRQF_ONESHOT, dev_name(dev), chip); + if (ret) + return dev_err_probe(dev, ret, "can't request the interrupt\n"); + + /* only the SGPIO source reaches the line; the rest have their own */ + ret = regmap_write(chip->map, MAX77779_PMIC_INTB_MASK, + (u8)~MAX77779_PMIC_INTSRC_GPIO); + if (ret) + return dev_err_probe(dev, ret, "can't unmask the SGPIO source\n"); + + return 0; +} + +static const struct of_device_id max77779_gpio_of_match[] = { + { .compatible = "maxim,max77779-pmic" }, + { } +}; +MODULE_DEVICE_TABLE(of, max77779_gpio_of_match); + +static const struct i2c_device_id max77779_gpio_i2c_id[] = { + { "max77779-pmic" }, + { } +}; +MODULE_DEVICE_TABLE(i2c, max77779_gpio_i2c_id); + +static struct i2c_driver max77779_gpio_driver = { + .driver = { + .name = "max77779-pmic", + .of_match_table = max77779_gpio_of_match, + }, + .probe = max77779_gpio_probe, + .id_table = max77779_gpio_i2c_id, +}; +module_i2c_driver(max77779_gpio_driver); + +MODULE_AUTHOR("W4HO <87742609+W4HO-ham@users.noreply.github.com>"); +MODULE_DESCRIPTION("GPIO driver for the Maxim MAX77779 PMIC's SGPIOs"); +MODULE_LICENSE("GPL"); From 0f96204ff220529939b333ea7986416576ad718b Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 11:52:21 -0647 Subject: [PATCH 03/26] MAINTAINERS: Add the MAX77779 PMIC SGPIO driver Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 00e06c4795..94c19e3872 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16197,6 +16197,13 @@ S: Maintained F: Documentation/devicetree/bindings/power/supply/maxim,max77779-fg.yaml F: drivers/power/supply/max77779_battery.c +MAXIM MAX77779 PMIC SGPIO DRIVER +M: W4HO <87742609+W4HO-ham@users.noreply.github.com> +L: linux-gpio@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/gpio/maxim,max77779-pmic.yaml +F: drivers/gpio/gpio-max77779.c + MAXIM MAX77802 PMIC REGULATOR DEVICE DRIVER M: Javier Martinez Canillas L: linux-kernel@vger.kernel.org From 46cd54e068440a6d113b21ee8a077ea9295336ec Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 19:03:14 -0647 Subject: [PATCH 04/26] dt-bindings: power: supply: maxim,max77779-charger: Add the OTG VBUS regulator Describe the charger's chgin-otg regulator, VBUS out of CHGIN for a device on the USB port, and the external boost it uses (otg-boost-supply), as on the Pixel 9a, where Google's ext-otg-only use case puts the charger in standby and raises an RT9470 boost. Only the Type-C controller may turn VBUS on, after its vSafe0V check, so the regulator may not be always-on or boot-on. The regulator needs the external boost: the charger's own boost mode is not supported. Link: https://android.googlesource.com/kernel/google-modules/bms/+/183509aff980610401869deca9f6ce8836980fe7/max77779_usecase.c Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../power/supply/maxim,max77779-charger.yaml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max77779-charger.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max77779-charger.yaml index 0842c0d00a..73fc0b349e 100644 --- a/Documentation/devicetree/bindings/power/supply/maxim,max77779-charger.yaml +++ b/Documentation/devicetree/bindings/power/supply/maxim,max77779-charger.yaml @@ -32,6 +32,25 @@ properties: description: The charger's interrupt, through the PMIC's interrupt controller. + otg-boost-supply: + description: An external boost that supplies VBUS to a device on the + USB port. For host mode the charger is put in standby and this + supply is enabled. + + chgin-otg-regulator: + type: object + $ref: /schemas/regulator/regulator.yaml# + unevaluatedProperties: false + description: VBUS out of the charger's input (CHGIN) for a device on + the USB port, the supply of the Type-C controller's vbus. Only the + Type-C controller turns it on, after it has seen VBUS at vSafe0V. + properties: + regulator-always-on: false + regulator-boot-on: false + +dependentRequired: + chgin-otg-regulator: [ otg-boost-supply ] + required: - compatible - reg @@ -47,6 +66,11 @@ examples: charger: charger@69 { compatible = "maxim,max77779-charger"; reg = <0x69>; + otg-boost-supply = <&otg_boost>; + + chgin-otg-regulator { + regulator-name = "chgin-otg"; + }; }; fuel-gauge@36 { From 66203ab70da0613e7e1374ec465ef90cf671b772 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 19:05:03 -0647 Subject: [PATCH 05/26] power: supply: max77779: Supply VBUS for USB host mode Add a chgin-otg regulator for the Type-C controller's vbus, over an external boost (otg-boost-supply). Enabling it puts the charger in standby (mode 0) and then enables the boost, the order Google's ext-otg-only use case uses on the Pixel 9a, whose boost is an RT9470; disabling it reverses that. The charger's own boost mode (0xa) is not used: Google writes it on the 9a only for fast role swap, after setting the OTG current limit, and nothing here has run it, so the regulator refuses to enable without the external boost. It also refuses while CHGIN already has an input, so it never boosts into another source. While VBUS is out, CHGIN carries our own boost, so the supply reports no input and Discharging rather than what CHGIN_OK says. Charge inhibit is refused then. The boost is got before the restore action is registered, so on unbind the boost is turned off and charging restored before the boost consumer is put. Tested on the Pixel 9a: with TCPM as a dual-role port whose vbus-supply is this regulator (over the RT9470's OTG boost), a USB flash drive attaches as source, VBUS holds at 5.2 V, and the drive enumerates at high speed; with the drive out and a laptop back in, the port is a sink again and charges. Link: https://android.googlesource.com/kernel/google-modules/bms/+/183509aff980610401869deca9f6ce8836980fe7/max77779_usecase.c Link: https://android.googlesource.com/kernel/devices/google/tegu/+/6276884d9940694b25a6934671918ec8ac412ee8/dts/zumapro-tegu-usecases.dtsi Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- drivers/power/supply/Kconfig | 3 +- drivers/power/supply/max77779_charger.c | 131 +++++++++++++++++++++++- 2 files changed, 128 insertions(+), 6 deletions(-) diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig index 1e63a06a74..4ed1cdd660 100644 --- a/drivers/power/supply/Kconfig +++ b/drivers/power/supply/Kconfig @@ -474,13 +474,14 @@ config CHARGER_MAX77779 tristate "Maxim MAX77779 battery charger" depends on I2C depends on OF + depends on REGULATOR select REGMAP_I2C help Say Y or M here to report the state of the charger in the Maxim MAX77779 power management IC, found in the Google Pixel 9a, and to let userspace stop and restart charging. The charger keeps its own (OTP) charge current and voltage; the driver only reads - them. + them. It also supplies VBUS to a device on the USB port. The module is named max77779_charger. diff --git a/drivers/power/supply/max77779_charger.c b/drivers/power/supply/max77779_charger.c index 8d41ddffee..6e30a6b531 100644 --- a/drivers/power/supply/max77779_charger.c +++ b/drivers/power/supply/max77779_charger.c @@ -1,13 +1,14 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Maxim MAX77779 battery charger: status and charge inhibit. + * Maxim MAX77779 battery charger: status, charge inhibit and USB OTG VBUS. * * The charger runs under its own (OTP) defaults. This driver reports what * it is doing and can stop charging: inhibit-charge puts it in buck-only * mode, so the battery is no longer charged and USB powers the system, * though with the battery near full the battery still supplies part of the - * load. Nothing else is written; the interrupt registers (clear on read) - * are never read, and the state is polled. + * load. For host mode it supplies VBUS (its chgin-otg regulator). Only the + * mode is written; the interrupt registers (clear on read) are never read, + * and the state is polled. * * Register fields from Google's driver (google-modules/bms at 183509aff980: * max77779_charger.c, GPL, and max77779_v20240115_regs.h). @@ -21,6 +22,8 @@ #include #include #include +#include +#include #include #define MAX77779_CHG_INT_OK 0xb6 @@ -31,6 +34,7 @@ #define MAX77779_CHG_DTLS GENMASK(3, 0) #define MAX77779_CHG_CNFG_00 0xbc #define MAX77779_MODE GENMASK(3, 0) +#define MAX77779_MODE_OFF 0x0 #define MAX77779_MODE_BUCK 0x4 #define MAX77779_MODE_CHG_BUCK 0x5 #define MAX77779_CHG_CNFG_02 0xbe @@ -59,6 +63,9 @@ struct max77779_charger { unsigned int last; int behaviour; bool held; + /* the OTG boost that sources VBUS: optional, external */ + struct regulator *boost; + bool otg; }; static bool max77779_charger_readable(struct device *dev, unsigned int reg) @@ -167,12 +174,21 @@ static int max77779_charger_get_property(struct power_supply *psy, switch (psp) { case POWER_SUPPLY_PROP_ONLINE: + /* While it sources VBUS, CHGIN carries our own boost: no input. */ + if (READ_ONCE(chg->otg)) { + val->intval = 0; + return 0; + } ret = regmap_read(chg->map, MAX77779_CHG_INT_OK, &v); if (ret) return ret; val->intval = !!(v & MAX77779_INPUT_OK); return 0; case POWER_SUPPLY_PROP_STATUS: + if (READ_ONCE(chg->otg)) { + val->intval = POWER_SUPPLY_STATUS_DISCHARGING; + return 0; + } return max77779_charger_status(chg, &val->intval); case POWER_SUPPLY_PROP_CHARGE_TYPE: return max77779_charger_charge_type(chg, &val->intval); @@ -224,6 +240,8 @@ static int max77779_charger_set_property(struct power_supply *psy, hold = val->intval == POWER_SUPPLY_CHARGE_BEHAVIOUR_INHIBIT_CHARGE; scoped_guard(mutex, &chg->lock) { + if (chg->otg) + return -EBUSY; if (hold != chg->held) { ret = max77779_charger_set_mode(chg, hold ? MAX77779_MODE_BUCK : @@ -266,6 +284,86 @@ static const struct power_supply_desc max77779_charger_desc = { BIT(POWER_SUPPLY_CHARGE_BEHAVIOUR_INHIBIT_CHARGE), }; +/* + * VBUS for a device on the USB-C port, from an external boost (the Pixel 9a's + * RT9470): the charger is put in standby first and then the boost is enabled, + * as Google's ext-otg-only use case does. The charger's own boost mode (0xa) + * is not used: nothing here has run it. + */ +static int max77779_charger_otg_enable(struct regulator_dev *rdev) +{ + struct max77779_charger *chg = rdev_get_drvdata(rdev); + unsigned int v; + int ret; + + if (!chg->boost) + return -EOPNOTSUPP; + + guard(mutex)(&chg->lock); + /* Something else already drives VBUS: don't boost into it. */ + ret = regmap_read(chg->map, MAX77779_CHG_INT_OK, &v); + if (ret) + return ret; + if (v & MAX77779_INPUT_OK) + return -EBUSY; + + ret = max77779_charger_set_mode(chg, MAX77779_MODE_OFF); + if (ret) + return ret; + + ret = regulator_enable(chg->boost); + if (ret) { + max77779_charger_set_mode(chg, chg->held ? MAX77779_MODE_BUCK : + MAX77779_MODE_CHG_BUCK); + return ret; + } + WRITE_ONCE(chg->otg, true); + + return 0; +} + +static int max77779_charger_otg_disable(struct regulator_dev *rdev) +{ + struct max77779_charger *chg = rdev_get_drvdata(rdev); + int ret; + + guard(mutex)(&chg->lock); + ret = regulator_disable(chg->boost); + if (ret) + return ret; + ret = max77779_charger_set_mode(chg, chg->held ? MAX77779_MODE_BUCK : + MAX77779_MODE_CHG_BUCK); + if (ret) + return ret; + WRITE_ONCE(chg->otg, false); + + return 0; +} + +static int max77779_charger_otg_is_enabled(struct regulator_dev *rdev) +{ + struct max77779_charger *chg = rdev_get_drvdata(rdev); + + guard(mutex)(&chg->lock); + return chg->otg; +} + +static const struct regulator_ops max77779_charger_otg_ops = { + .enable = max77779_charger_otg_enable, + .disable = max77779_charger_otg_disable, + .is_enabled = max77779_charger_otg_is_enabled, +}; + +static const struct regulator_desc max77779_charger_otg_desc = { + .name = "chgin-otg", + .of_match = "chgin-otg-regulator", + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + .ops = &max77779_charger_otg_ops, + .fixed_uV = 5000000, + .n_voltages = 1, +}; + /* Tell the gauge and userspace when the input or the charge state changes. */ static void max77779_charger_poll(struct work_struct *work) { @@ -292,7 +390,9 @@ static void max77779_charger_restore(void *data) { struct max77779_charger *chg = data; - if (chg->held) + if (chg->otg) + regulator_disable(chg->boost); + if (chg->held || chg->otg) max77779_charger_set_mode(chg, MAX77779_MODE_CHG_BUCK); } @@ -306,6 +406,8 @@ static void max77779_charger_cancel_poll(void *data) static int max77779_charger_probe(struct i2c_client *client) { struct power_supply_config cfg = {}; + struct regulator_config rcfg = {}; + struct regulator_dev *rdev; struct device *dev = &client->dev; struct max77779_charger *chg; unsigned int mode; @@ -345,7 +447,19 @@ static int max77779_charger_probe(struct i2c_client *client) dev_warn(dev, "found in mode %#x, not charging and buck\n", mode); } - /* Unwound in reverse: poll stopped, supply gone, then charging back. */ + chg->boost = devm_regulator_get_optional(dev, "otg-boost"); + if (IS_ERR(chg->boost)) { + if (PTR_ERR(chg->boost) != -ENODEV) + return dev_err_probe(dev, PTR_ERR(chg->boost), + "failed to get the OTG boost\n"); + chg->boost = NULL; + } + + /* + * Unwound in reverse: the VBUS regulator gone, poll stopped, supply + * gone, then the boost off and charging back, and only then the boost + * put. + */ ret = devm_add_action_or_reset(dev, max77779_charger_restore, chg); if (ret) return ret; @@ -361,6 +475,13 @@ static int max77779_charger_probe(struct i2c_client *client) if (ret) return ret; + rcfg.dev = dev; + rcfg.driver_data = chg; + rdev = devm_regulator_register(dev, &max77779_charger_otg_desc, &rcfg); + if (IS_ERR(rdev)) + return dev_err_probe(dev, PTR_ERR(rdev), + "failed to register the OTG regulator\n"); + queue_delayed_work(system_freezable_wq, &chg->poll, 0); return 0; } From 87abf320bc4b8a869fed32ad6fcf050de11ecc42 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 11:37:17 -0647 Subject: [PATCH 06/26] arm64: dts: exynos: google: zumapro-tegu: Enable the GPU Turn on CMU_G3D and the Mali-G715 for the Pixel 9a, with its core clock on ACPM's paired "gpu" clock (index 17), which sets the shader (G3D) and L2 (G3DL2) domains together, and coregroup and stacks on CMU_G3D's gates. The operating points are the shader rates of the 9a's GPU DVFS table up to 649 MHz. The levels above it, to 940 MHz, wait for a GPU thermal zone, since nothing throttles the GPU yet. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../boot/dts/exynos/google/zumapro-tegu.dts | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index c8e150e529..95dfe0fbda 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -8,6 +8,7 @@ /dts-v1/; +#include #include #include #include "../exynos-pinctrl.h" @@ -73,6 +74,51 @@ }; }; + /* + * The GPU's levels: the shader rates of the Pixel 9a's GPU DVFS table + * up to 649 MHz, each with its paired L2 rate through the ACPM "gpu" + * clock. The levels above, to 940 MHz, wait for a GPU thermal zone. + */ + gpu_opp: opp-table-gpu { + compatible = "operating-points-v2"; + + opp-150000000 { + opp-hz = /bits/ 64 <150000000>; + }; + + opp-302000000 { + opp-hz = /bits/ 64 <302000000>; + }; + + opp-337000000 { + opp-hz = /bits/ 64 <337000000>; + }; + + opp-376000000 { + opp-hz = /bits/ 64 <376000000>; + }; + + opp-419000000 { + opp-hz = /bits/ 64 <419000000>; + }; + + opp-467000000 { + opp-hz = /bits/ 64 <467000000>; + }; + + opp-521000000 { + opp-hz = /bits/ 64 <521000000>; + }; + + opp-580000000 { + opp-hz = /bits/ 64 <580000000>; + }; + + opp-649000000 { + opp-hz = /bits/ 64 <649000000>; + }; + }; + /* UFS VCC, switched by gpp0-1 as on stock. */ ufs_vcc: regulator-ufs-vcc { compatible = "regulator-fixed"; @@ -135,6 +181,10 @@ status = "okay"; }; +&cmu_g3d { + status = "okay"; +}; + &cmu_hsi0 { status = "okay"; }; @@ -188,6 +238,19 @@ interrupts = ; }; +/* + * The GPU's core clock is ACPM's paired "gpu" clock, which sets the shader + * (G3D) and L2 (G3DL2) domains together; coregroup and stacks stay on + * CMU_G3D's gates. + */ +&gpu { + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_GPU>, + <&cmu_g3d CLK_GOUT_G3D_COREGROUP>, + <&cmu_g3d CLK_GOUT_G3D_STACKS>; + operating-points-v2 = <&gpu_opp>; + status = "okay"; +}; + &pinctrl_alive { status = "okay"; }; From 6bf92d1e1ce08b582f8ef4e1d42bf08cae9c7946 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 11:51:28 -0647 Subject: [PATCH 07/26] arm64: dts: exynos: google: zumapro: Add CPU DVFS and thermal zones Give the three CPU clusters their ACPM DVFS clocks (cpucl0-2, by the zumapro ACPM clock ids) and operating points for cpufreq-dt, with capacities and power coefficients for the energy model from Google's zumapro-cpu.dtsi, and add the ACPM TMU sensor and the big, mid, little and GPU thermal zones. The CPU levels are the APM firmware's own (its DVFS table, read on the Pixel 9a), up to the 9a's thermal headroom: 1950 MHz little (Google's max-freq for that cluster), 2367 MHz mid and 2687 MHz big. The little cluster's 324 and 610 MHz lie below stock's 820 MHz floor. Each CPU zone throttles its cluster from 80 C, forces the cluster's lowest levels from 95 C and shuts down at 105 C, all below stock's 112 C (CPU) and 115 C (GPU) hot trips. gpu-thermal throttles panthor's devfreq from 85 C. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../arm64/boot/dts/exynos/google/zumapro.dtsi | 378 ++++++++++++++++++ 1 file changed, 378 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro.dtsi b/arch/arm64/boot/dts/exynos/google/zumapro.dtsi index 10b018b180..2a8017bea1 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro.dtsi +++ b/arch/arm64/boot/dts/exynos/google/zumapro.dtsi @@ -7,6 +7,7 @@ */ #include +#include #include #include @@ -104,6 +105,11 @@ compatible = "arm,cortex-a520"; reg = <0x000>; enable-method = "psci"; + capacity-dmips-mhz = <193>; + dynamic-power-coefficient = <70>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL0>; + operating-points-v2 = <&cpucl0_opp>; }; cpu1: cpu@100 { @@ -111,6 +117,11 @@ compatible = "arm,cortex-a520"; reg = <0x100>; enable-method = "psci"; + capacity-dmips-mhz = <193>; + dynamic-power-coefficient = <70>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL0>; + operating-points-v2 = <&cpucl0_opp>; }; cpu2: cpu@200 { @@ -118,6 +129,11 @@ compatible = "arm,cortex-a520"; reg = <0x200>; enable-method = "psci"; + capacity-dmips-mhz = <193>; + dynamic-power-coefficient = <70>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL0>; + operating-points-v2 = <&cpucl0_opp>; }; cpu3: cpu@300 { @@ -125,6 +141,11 @@ compatible = "arm,cortex-a520"; reg = <0x300>; enable-method = "psci"; + capacity-dmips-mhz = <193>; + dynamic-power-coefficient = <70>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL0>; + operating-points-v2 = <&cpucl0_opp>; }; cpu4: cpu@400 { @@ -132,6 +153,11 @@ compatible = "arm,cortex-a720"; reg = <0x400>; enable-method = "psci"; + capacity-dmips-mhz = <927>; + dynamic-power-coefficient = <513>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL1>; + operating-points-v2 = <&cpucl1_opp>; }; cpu5: cpu@500 { @@ -139,6 +165,11 @@ compatible = "arm,cortex-a720"; reg = <0x500>; enable-method = "psci"; + capacity-dmips-mhz = <927>; + dynamic-power-coefficient = <513>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL1>; + operating-points-v2 = <&cpucl1_opp>; }; cpu6: cpu@600 { @@ -146,6 +177,11 @@ compatible = "arm,cortex-a720"; reg = <0x600>; enable-method = "psci"; + capacity-dmips-mhz = <927>; + dynamic-power-coefficient = <513>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL1>; + operating-points-v2 = <&cpucl1_opp>; }; cpu7: cpu@700 { @@ -153,6 +189,11 @@ compatible = "arm,cortex-x4"; reg = <0x700>; enable-method = "psci"; + capacity-dmips-mhz = <1024>; + dynamic-power-coefficient = <757>; + #cooling-cells = <2>; + clocks = <&acpm_ipc ZUMAPRO_CLK_ACPM_DVFS_CPUCL2>; + operating-points-v2 = <&cpucl2_opp>; }; }; @@ -214,6 +255,342 @@ mboxes = <&ap2apm_mailbox>; shmem = <&apm_sram>; status = "disabled"; + + acpm_tmu: thermal-sensor { + compatible = "google,zumapro-acpm-tmu"; + #thermal-sensor-cells = <1>; + }; + }; + }; + + /* + * CPU levels: the APM firmware's own DVFS levels, read on the Pixel 9a + * (the little cluster's 324 and 610 MHz are below stock's 820 MHz + * floor), up to the 9a's thermal headroom: the levels above each table's + * top, listed in it, are left out for that board. A board with more + * headroom can add them. The little cluster stops at 1950 MHz, Google's + * max-freq for it. + */ + cpucl0_opp: opp-table-cpucl0 { + compatible = "operating-points-v2"; + opp-shared; + + opp-324000000 { + opp-hz = /bits/ 64 <324000000>; + }; + + opp-610000000 { + opp-hz = /bits/ 64 <610000000>; + }; + + opp-820000000 { + opp-hz = /bits/ 64 <820000000>; + }; + + opp-955000000 { + opp-hz = /bits/ 64 <955000000>; + }; + + opp-1098000000 { + opp-hz = /bits/ 64 <1098000000>; + }; + + opp-1197000000 { + opp-hz = /bits/ 64 <1197000000>; + }; + + opp-1328000000 { + opp-hz = /bits/ 64 <1328000000>; + }; + + opp-1425000000 { + opp-hz = /bits/ 64 <1425000000>; + }; + + opp-1548000000 { + opp-hz = /bits/ 64 <1548000000>; + }; + + opp-1696000000 { + opp-hz = /bits/ 64 <1696000000>; + }; + + opp-1849000000 { + opp-hz = /bits/ 64 <1849000000>; + }; + + opp-1950000000 { + opp-hz = /bits/ 64 <1950000000>; + }; + + }; + + cpucl1_opp: opp-table-cpucl1 { + compatible = "operating-points-v2"; + opp-shared; + + opp-357000000 { + opp-hz = /bits/ 64 <357000000>; + }; + + opp-578000000 { + opp-hz = /bits/ 64 <578000000>; + }; + + opp-648000000 { + opp-hz = /bits/ 64 <648000000>; + }; + + opp-787000000 { + opp-hz = /bits/ 64 <787000000>; + }; + + opp-910000000 { + opp-hz = /bits/ 64 <910000000>; + }; + + opp-1065000000 { + opp-hz = /bits/ 64 <1065000000>; + }; + + opp-1221000000 { + opp-hz = /bits/ 64 <1221000000>; + }; + + opp-1328000000 { + opp-hz = /bits/ 64 <1328000000>; + }; + + opp-1418000000 { + opp-hz = /bits/ 64 <1418000000>; + }; + + opp-1549000000 { + opp-hz = /bits/ 64 <1549000000>; + }; + + opp-1795000000 { + opp-hz = /bits/ 64 <1795000000>; + }; + + opp-1945000000 { + opp-hz = /bits/ 64 <1945000000>; + }; + + opp-2130000000 { + opp-hz = /bits/ 64 <2130000000>; + }; + + opp-2245000000 { + opp-hz = /bits/ 64 <2245000000>; + }; + + opp-2367000000 { + opp-hz = /bits/ 64 <2367000000>; + }; + + /* 2450 and 2600 MHz stay off: above the cluster's thermal headroom. */ + }; + + cpucl2_opp: opp-table-cpucl2 { + compatible = "operating-points-v2"; + opp-shared; + + opp-700000000 { + opp-hz = /bits/ 64 <700000000>; + }; + + opp-1164000000 { + opp-hz = /bits/ 64 <1164000000>; + }; + + opp-1396000000 { + opp-hz = /bits/ 64 <1396000000>; + }; + + opp-1557000000 { + opp-hz = /bits/ 64 <1557000000>; + }; + + opp-1745000000 { + opp-hz = /bits/ 64 <1745000000>; + }; + + opp-1885000000 { + opp-hz = /bits/ 64 <1885000000>; + }; + + opp-1999000000 { + opp-hz = /bits/ 64 <1999000000>; + }; + + opp-2147000000 { + opp-hz = /bits/ 64 <2147000000>; + }; + + opp-2294000000 { + opp-hz = /bits/ 64 <2294000000>; + }; + + opp-2363000000 { + opp-hz = /bits/ 64 <2363000000>; + }; + + opp-2499000000 { + opp-hz = /bits/ 64 <2499000000>; + }; + + opp-2687000000 { + opp-hz = /bits/ 64 <2687000000>; + }; + + /* + * 2802, 2914, 2943, 2970, 3015 and 3105 MHz stay off: above the + * cluster's thermal headroom. + */ + }; + + thermal-zones { + big-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + thermal-sensors = <&acpm_tmu 0>; + + trips { + big_alert: big-alert { + temperature = <80000>; + hysteresis = <5000>; + type = "passive"; + }; + + big_hot: big-hot { + temperature = <95000>; + hysteresis = <10000>; + type = "passive"; + }; + + big_crit: big-crit { + temperature = <105000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&big_alert>; + cooling-device = <&cpu7 0xffffffff 0xffffffff>; + }; + + map1 { + trip = <&big_hot>; + cooling-device = <&cpu7 11 0xffffffff>; + }; + }; + }; + + mid-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + thermal-sensors = <&acpm_tmu 1>; + + trips { + mid_alert: mid-alert { + temperature = <80000>; + hysteresis = <5000>; + type = "passive"; + }; + + mid_hot: mid-hot { + temperature = <95000>; + hysteresis = <10000>; + type = "passive"; + }; + + mid_crit: mid-crit { + temperature = <105000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&mid_alert>; + cooling-device = <&cpu4 0xffffffff 0xffffffff>; + }; + + map1 { + trip = <&mid_hot>; + cooling-device = <&cpu4 14 0xffffffff>; + }; + }; + }; + + little-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + thermal-sensors = <&acpm_tmu 2>; + + trips { + little_alert: little-alert { + temperature = <80000>; + hysteresis = <5000>; + type = "passive"; + }; + + little_hot: little-hot { + temperature = <95000>; + hysteresis = <10000>; + type = "passive"; + }; + + little_crit: little-crit { + temperature = <105000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&little_alert>; + cooling-device = <&cpu0 0xffffffff 0xffffffff>; + }; + + map1 { + trip = <&little_hot>; + cooling-device = <&cpu0 11 0xffffffff>; + }; + }; + }; + + gpu-thermal { + polling-delay-passive = <1000>; + polling-delay = <2000>; + thermal-sensors = <&acpm_tmu 3>; + + trips { + gpu_alert: gpu-alert { + temperature = <85000>; + hysteresis = <5000>; + type = "passive"; + }; + + gpu_crit: gpu-crit { + temperature = <105000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + /* panthor's devfreq cooling: step_wise walks the GPU down its OPPs. */ + cooling-maps { + map0 { + trip = <&gpu_alert>; + cooling-device = <&gpu 0xffffffff 0xffffffff>; + }; + }; }; }; @@ -1115,6 +1492,7 @@ <&cmu_g3d CLK_GOUT_G3D_COREGROUP>, <&cmu_g3d CLK_GOUT_G3D_STACKS>; clock-names = "core", "coregroup", "stacks"; + #cooling-cells = <2>; status = "disabled"; }; From 337040b4a950814d700de3cd275ef4b68288354c Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 11:51:28 -0647 Subject: [PATCH 08/26] arm64: dts: exynos: google: zumapro-tegu: Add the GPU's levels to 890 MHz With gpu-thermal throttling the GPU, add the 9a's GPU levels above 649 MHz: 723, 807, 850 and 890 MHz. The table's top, 940 MHz, stays out until it has run on the 9a. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../boot/dts/exynos/google/zumapro-tegu.dts | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index 95dfe0fbda..d68fd18f82 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -76,8 +76,9 @@ /* * The GPU's levels: the shader rates of the Pixel 9a's GPU DVFS table - * up to 649 MHz, each with its paired L2 rate through the ACPM "gpu" - * clock. The levels above, to 940 MHz, wait for a GPU thermal zone. + * up to 890 MHz, each with its paired L2 rate through the ACPM "gpu" + * clock; gpu-thermal throttles them from 85 C. 940 MHz, the table's + * top, is left out until it has run on the 9a. */ gpu_opp: opp-table-gpu { compatible = "operating-points-v2"; @@ -117,6 +118,22 @@ opp-649000000 { opp-hz = /bits/ 64 <649000000>; }; + + opp-723000000 { + opp-hz = /bits/ 64 <723000000>; + }; + + opp-807000000 { + opp-hz = /bits/ 64 <807000000>; + }; + + opp-850000000 { + opp-hz = /bits/ 64 <850000000>; + }; + + opp-890000000 { + opp-hz = /bits/ 64 <890000000>; + }; }; /* UFS VCC, switched by gpp0-1 as on stock. */ From f1caae27ec2b1b1d4d87f6b0ebd42bc2046a2ada Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 12:16:30 -0647 Subject: [PATCH 09/26] dt-bindings: display: samsung: google,gs201-dsim: Add Tensor G4 The Tensor G4 (zumapro) display pipeline has the gs201 DSIM, at the same register layout and with the same three register windows. Add google,zumapro-dsim with google,gs201-dsim as its fallback. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../bindings/display/samsung/google,gs201-dsim.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/display/samsung/google,gs201-dsim.yaml b/Documentation/devicetree/bindings/display/samsung/google,gs201-dsim.yaml index 663c43b67f..e70bda177c 100644 --- a/Documentation/devicetree/bindings/display/samsung/google,gs201-dsim.yaml +++ b/Documentation/devicetree/bindings/display/samsung/google,gs201-dsim.yaml @@ -14,14 +14,19 @@ description: pipeline. It takes pixel data from a DECON and drives up to four data lanes through a combined D-PHY/C-PHY, in video or command mode, with DSC slice packing and TE-based command scheduling. Panels are described - as child nodes. + as child nodes. The Tensor G4 (zumapro) has the same DSIM, at the same + register layout. allOf: - $ref: /schemas/display/dsi-controller.yaml# properties: compatible: - const: google,gs201-dsim + oneOf: + - const: google,gs201-dsim + - items: + - const: google,zumapro-dsim + - const: google,gs201-dsim reg: minItems: 1 From 86bc3e0639bb7390f6dbe45a7e3cdf81424a814c Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 12:16:31 -0647 Subject: [PATCH 10/26] arm64: dts: exynos: google: zumapro: Add DSIM0 Add DSIM0, the DSI master between DECON0 and the panel: its link and D-PHY register windows and its interrupt (GIC SPI 252), as in Google's GPL zumapro device tree, disabled until a board names its panel. Link: https://android.googlesource.com/kernel/devices/google/zumapro/+/8831630eee2ad095b85ed452944e6353940966a5/dts/zumapro.dtsi Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- arch/arm64/boot/dts/exynos/google/zumapro.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro.dtsi b/arch/arm64/boot/dts/exynos/google/zumapro.dtsi index 2a8017bea1..cb99ace061 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro.dtsi +++ b/arch/arm64/boot/dts/exynos/google/zumapro.dtsi @@ -1457,6 +1457,18 @@ }; }; + dsi0: dsi@19440000 { + compatible = "google,zumapro-dsim", "google,gs201-dsim"; + reg = <0x0 0x19440000 0x300>, + <0x0 0x19460100 0x700>, + <0x0 0x19460000 0x100>; + reg-names = "dsi", "dphy", "dphy-extra"; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + /* Scans out what the bootloader set up; no panel or clock control. */ decon0: display-controller@19470000 { compatible = "google,zumapro-decon"; From 87c994e0322ab79750ae5d23b776efb42a7df5bb Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 12:16:31 -0647 Subject: [PATCH 11/26] arm64: dts: exynos: google: zumapro-tegu: Enable the display Turn on the Pixel 9a's display pipeline: DECON0 with a 64 MiB reusable scanout pool below 4 GiB and the bootloader's splash as its boot framebuffer, scanning out to DSIM0, and the TG4C panel on DSIM0's virtual channel 0. With DECON's output on DSIM0, gs-decon switches the link and the panel between 60 and 120 Hz. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../boot/dts/exynos/google/zumapro-tegu.dts | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index d68fd18f82..5f2a479c35 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -158,6 +158,15 @@ reg = <0x0 0xfac00000 0x009fc900>; no-map; }; + + /* DECON's scanout buffers, below 4 GiB for its 32-bit DMA. */ + display_pool: display-pool { + compatible = "shared-dma-pool"; + reusable; + size = <0x04000000>; + alignment = <0x0 0x00200000>; + alloc-ranges = <0x0 0x98000000 0x06000000>; + }; }; &acpm_ipc { @@ -230,6 +239,37 @@ status = "okay"; }; +/* + * DECON0 scans out to DSIM0, so gs-decon can switch the link and the + * panel between 60 and 120 Hz. + */ +&decon0 { + memory-region = <&display_pool>, <&cont_splash_mem>; + memory-region-names = "pool", "boot-framebuffer"; + status = "okay"; + + port { + decon0_out: endpoint { + remote-endpoint = <&dsi0_in>; + }; + }; +}; + +&dsi0 { + status = "okay"; + + panel@0 { + compatible = "google,tg4c"; + reg = <0>; + }; + + port { + dsi0_in: endpoint { + remote-endpoint = <&decon0_out>; + }; + }; +}; + /* The keys' banks and the touchscreen's raise their own interrupts. */ &gpa4 { interrupt-controller; From 2bd5a792b74688fe4bc8328e7fea2bc75aaf6dc1 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 12:37:19 -0647 Subject: [PATCH 12/26] arm64: dts: exynos: google: zumapro-tegu: Add the haptics and the torch Add the Pixel 9a's haptics, a Cirrus Logic CS40L26 on USI9's I2C bus (0x43, interrupt on gpa6-3, reset on gph2-3), with Google's limits for its LRA (2.5 A boost peak, 10 V boost, 162 Hz, ReDC 14.1 ohm) and VP brownout prevention at 3.008 V, and its torch, a TI LM3644 on USI4's I2C bus (0x63, enable on gpp24-1) driving one white LED from both outputs, limited to 75 mA. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../boot/dts/exynos/google/zumapro-tegu.dts | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index 5f2a479c35..20e72a61a4 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -11,6 +11,7 @@ #include #include #include +#include #include "../exynos-pinctrl.h" #include "zumapro.dtsi" #include "zumapro-reserved-memory.dtsi" @@ -308,6 +309,53 @@ status = "okay"; }; +/* The torch: a TI LM3644 flash driver, both LED outputs on one white LED. */ +&hsi2c4 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&hsi2c4_bus>; + status = "okay"; + + led-controller@63 { + compatible = "ti,lm3644"; + reg = <0x63>; + enable-gpios = <&gpp24 1 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&torch_enable>; + + led { + function = LED_FUNCTION_TORCH; + color = ; + led-sources = <1 2>; + /* A dim flashlight, far below the part's and the LED's limits. */ + led-max-microamp = <75000>; + }; + }; +}; + +/* The haptics: a CS40L26 on the 9a's LRA, with Google's limits for it. */ +&hsi2c9 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&hsi2c9_bus>; + status = "okay"; + + haptic-driver@43 { + compatible = "cirrus,cs40l26a"; + reg = <0x43>; + interrupt-parent = <&gpa6>; + interrupts = <3 IRQ_TYPE_LEVEL_LOW>; + reset-gpios = <&gph2 3 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&haptic_reset>; + cirrus,boost-peak-microamp = <2500000>; + cirrus,boost-ctl-microvolt = <10000000>; + cirrus,lra-f0-hz = <162>; + cirrus,lra-redc-micro-ohms = <14100007>; + cirrus,vpbr-threshold-microvolt = <3008000>; + }; +}; + &pinctrl_alive { status = "okay"; }; @@ -322,6 +370,13 @@ &pinctrl_hsi1 { status = "okay"; + + haptic_reset: haptic-reset-pins { + samsung,pins = "gph2-3"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = <0>; + }; }; &pinctrl_hsi2 { @@ -335,6 +390,13 @@ &pinctrl_peric0 { status = "okay"; + hsi2c4_bus: hsi2c4-bus-pins { + samsung,pins = "gpp8-0", "gpp8-1"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = <0>; + }; + touch_reset_held: touch-reset-held-pins { samsung,pins = "gpp1-1"; samsung,pin-function = ; @@ -344,6 +406,20 @@ &pinctrl_peric1 { status = "okay"; + + hsi2c9_bus: hsi2c9-bus-pins { + samsung,pins = "gpp19-4", "gpp19-5"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = <0>; + }; + + torch_enable: torch-enable-pins { + samsung,pins = "gpp24-1"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = <0>; + }; }; &pmu_system_controller { @@ -441,6 +517,14 @@ status = "okay"; }; +&usi4 { + status = "okay"; +}; + +&usi9 { + status = "okay"; +}; + &watchdog_cl0 { status = "okay"; }; From 79cb808b4e483c3b0b511b364348287307cc9e93 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 19:09:59 -0647 Subject: [PATCH 13/26] dt-bindings: soc: samsung: exynos-pmu: Describe zuma's PMU clock The Tensor G3/G4 PMU (google,zuma-pmu) gates the NFC controller's reference clock pad. Say what #clock-cells numbers there: clock 0 is that pad. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- Documentation/devicetree/bindings/soc/samsung/exynos-pmu.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/soc/samsung/exynos-pmu.yaml b/Documentation/devicetree/bindings/soc/samsung/exynos-pmu.yaml index 2f273e9e5a..e9060543b9 100644 --- a/Documentation/devicetree/bindings/soc/samsung/exynos-pmu.yaml +++ b/Documentation/devicetree/bindings/soc/samsung/exynos-pmu.yaml @@ -63,6 +63,9 @@ properties: '#clock-cells': const: 1 + description: + On the Exynos SoCs, one clock per CLKOUT mux input. On google,zuma-pmu, + clock 0 is the NFC controller's reference clock pad. clock-names: description: From f148682a2de34a8a1becbd314f88c27e5ce01c22 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 19:09:59 -0647 Subject: [PATCH 14/26] soc: samsung: gs101-pmu: Provide zuma's NFC clock pad as a clock The Pixel 9a's NFC controller (an ST54L) asks the SoC for its reference clock on a CLK_REQ line, which reaches the controller only once the PMU follows that line: PMU 0x3e84 bit 16 (EXTPAD_EN), which Google's st21nfc driver sets from its DT (pmu_clk_pad = <0x3e84>, st,extpad_control_en). Without it the controller doesn't ACK its I2C address. When the zuma PMU's node has #clock-cells, register that bit as clock 0, a gate written through the SMC-backed regmap, and add the register to zuma's access table. Tested on the Pixel 9a (7.3.0-rc6-omamobile-tegu-s2mpg15-m1, with this clock and the NFC node's clocks = <&pmu_system_controller 0>): the clock is enabled by nxp-nci's probe (clk_summary: zuma_pmu_nfc_clk_pad, 25-0008), the controller answers CORE_RESET and polls, with no other code touching the pad. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- drivers/soc/samsung/gs101-pmu.c | 82 +++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/drivers/soc/samsung/gs101-pmu.c b/drivers/soc/samsung/gs101-pmu.c index e357744d4a..e70ceb9c20 100644 --- a/drivers/soc/samsung/gs101-pmu.c +++ b/drivers/soc/samsung/gs101-pmu.c @@ -7,7 +7,10 @@ #include #include +#include #include +#include +#include #include #include #include @@ -343,6 +346,8 @@ const struct exynos_pmu_data gs101_pmu_data = { #define ZUMA_CLUSTER1_NONCPU_INT_EN 0x1544 #define ZUMA_HSI0_STATUS 0x2a84 #define ZUMA_PHY_CTRL_UFS 0x3ec0 +#define ZUMA_NFC_CLK_PAD 0x3e84 +#define ZUMA_NFC_CLK_PAD_EXTPAD_EN BIT(16) static const struct regmap_range zuma_pmu_registers[] = { /* reboot mode */ @@ -360,6 +365,8 @@ static const struct regmap_range zuma_pmu_registers[] = { regmap_reg_range(ZUMA_PHY_CTRL_UFS, ZUMA_PHY_CTRL_UFS), /* a hint TF-A reads, not a status register: see zuma_pmu_regmap_init() */ regmap_reg_range(ZUMA_PMU_INFORM0, ZUMA_PMU_INFORM0), + /* the NFC controller's clock pad: see zuma_pmu_nfc_pad_ops */ + regmap_reg_range(ZUMA_NFC_CLK_PAD, ZUMA_NFC_CLK_PAD), }; static const struct regmap_range zuma_pmu_ro_registers[] = { @@ -386,6 +393,77 @@ static const struct regmap_access_table zuma_pmu_wr_table = { * INVALID_PARAMETERS) until the kernel allows C2 in PMU_INFORM0, as Google's * exynos-cpupm does once at init. */ +/* + * The NFC controller's reference clock pad (clock 0 of the PMU): with + * EXTPAD_EN set the PMU follows the controller's CLK_REQ line and feeds it + * the pad clock, as Google's st21nfc driver sets it (pmu_clk_pad 0x3e84, + * st,extpad_control_en). Without it the Pixel 9a's ST54L answers NCI but + * never finds a card. + */ +struct zuma_pmu_clk_pad { + struct clk_hw hw; + struct regmap *regmap; +}; + +static int zuma_pmu_nfc_pad_enable(struct clk_hw *hw) +{ + struct zuma_pmu_clk_pad *pad = container_of(hw, struct zuma_pmu_clk_pad, hw); + + return regmap_set_bits(pad->regmap, ZUMA_NFC_CLK_PAD, + ZUMA_NFC_CLK_PAD_EXTPAD_EN); +} + +static void zuma_pmu_nfc_pad_disable(struct clk_hw *hw) +{ + struct zuma_pmu_clk_pad *pad = container_of(hw, struct zuma_pmu_clk_pad, hw); + + regmap_clear_bits(pad->regmap, ZUMA_NFC_CLK_PAD, + ZUMA_NFC_CLK_PAD_EXTPAD_EN); +} + +static int zuma_pmu_nfc_pad_is_enabled(struct clk_hw *hw) +{ + struct zuma_pmu_clk_pad *pad = container_of(hw, struct zuma_pmu_clk_pad, hw); + + return regmap_test_bits(pad->regmap, ZUMA_NFC_CLK_PAD, + ZUMA_NFC_CLK_PAD_EXTPAD_EN); +} + +static const struct clk_ops zuma_pmu_nfc_pad_ops = { + .enable = zuma_pmu_nfc_pad_enable, + .disable = zuma_pmu_nfc_pad_disable, + .is_enabled = zuma_pmu_nfc_pad_is_enabled, +}; + +static int zuma_pmu_register_clks(struct device *dev, struct regmap *regmap) +{ + struct clk_init_data init = { + .name = "zuma_pmu_nfc_clk_pad", + .ops = &zuma_pmu_nfc_pad_ops, + }; + struct clk_hw_onecell_data *data; + struct zuma_pmu_clk_pad *pad; + int ret; + + if (!of_property_present(dev->of_node, "#clock-cells")) + return 0; + + pad = devm_kzalloc(dev, sizeof(*pad), GFP_KERNEL); + data = devm_kzalloc(dev, struct_size(data, hws, 1), GFP_KERNEL); + if (!pad || !data) + return -ENOMEM; + + pad->regmap = regmap; + pad->hw.init = &init; + ret = devm_clk_hw_register(dev, &pad->hw); + if (ret) + return ret; + + data->num = 1; + data->hws[0] = &pad->hw; + return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, data); +} + static void zuma_pmu_regmap_init(struct device *dev, struct regmap *regmap) { int ret; @@ -393,6 +471,10 @@ static void zuma_pmu_regmap_init(struct device *dev, struct regmap *regmap) ret = regmap_write(regmap, ZUMA_PMU_INFORM0, ZUMA_PMU_ALLOWED_C2); if (ret) dev_warn(dev, "failed to allow C2 in PMU_INFORM0: %d\n", ret); + + ret = zuma_pmu_register_clks(dev, regmap); + if (ret) + dev_warn(dev, "failed to register the PMU clocks: %d\n", ret); } /* From c16fe3e0da7ed6f44dc10a98cc00a9098c541566 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 19:09:59 -0647 Subject: [PATCH 15/26] dt-bindings: net: nfc: nxp,nci: Allow a reference clock Some boards gate the controller's reference clock, or the SoC pad it comes from, in a clock provider: the Pixel 9a's ST54L takes its clock from a pad the PMU enables. Allow one clock. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml b/Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml index fbf2b14f69..a1d4603a57 100644 --- a/Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml +++ b/Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml @@ -26,6 +26,11 @@ properties: - st,st54l - const: nxp,nxp-nci-i2c + clocks: + maxItems: 1 + description: The controller's reference clock, or the SoC clock pad + that feeds it on the controller's request + enable-gpios: description: Output GPIO pin used for enabling/disabling the controller From 23d5a183066cf253841ea90bd22e3abcae8691eb Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 19:09:59 -0647 Subject: [PATCH 16/26] nfc: nxp-nci: i2c: Enable an optional reference clock Take an optional clock and keep it enabled while the device is bound, for boards whose controller clock (or the pad it comes from) is gated: the Pixel 9a's ST54L needs the PMU's NFC clock pad. Tested on the Pixel 9a: the clock is enabled at probe and the controller answers and polls. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- drivers/nfc/nxp-nci/i2c.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c index 92ce096e9b..6d81a97784 100644 --- a/drivers/nfc/nxp-nci/i2c.c +++ b/drivers/nfc/nxp-nci/i2c.c @@ -13,6 +13,7 @@ */ #include +#include #include #include #include @@ -277,6 +278,7 @@ static int nxp_nci_i2c_probe(struct i2c_client *client) struct device *dev = &client->dev; struct nxp_nci_i2c_phy *phy; unsigned long irqflags; + struct clk *clk; int r; if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { @@ -308,6 +310,11 @@ static int nxp_nci_i2c_probe(struct i2c_client *client) return PTR_ERR(phy->gpiod_fw); } + /* a reference clock (or its pad's enable) the controller asks for */ + clk = devm_clk_get_optional_enabled(dev, NULL); + if (IS_ERR(clk)) + return dev_err_probe(dev, PTR_ERR(clk), "Failed to get the clock\n"); + r = nxp_nci_probe(phy, &client->dev, &i2c_phy_ops, NXP_NCI_I2C_MAX_PAYLOAD, &phy->ndev); if (r < 0) From 7078e6085ed2859dbf134c97bfa67245f4862884 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 19:56:39 -0647 Subject: [PATCH 17/26] arm64: dts: exynos: google: zumapro: The PMU provides clocks The zuma PMU provides the NFC controller's clock pad as clock 0; give its node #clock-cells. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- arch/arm64/boot/dts/exynos/google/zumapro.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro.dtsi b/arch/arm64/boot/dts/exynos/google/zumapro.dtsi index cb99ace061..0f116ff4a1 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro.dtsi +++ b/arch/arm64/boot/dts/exynos/google/zumapro.dtsi @@ -1315,6 +1315,7 @@ pmu_system_controller: system-controller@15460000 { compatible = "google,zumapro-pmu", "google,zuma-pmu"; reg = <0x0 0x15460000 0x10000>; + #clock-cells = <1>; status = "disabled"; reboot_mode: reboot-mode { From f1a18de2474a925859fd5033a963503bd762b5da Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 19:56:39 -0647 Subject: [PATCH 18/26] arm64: dts: exynos: google: zumapro-tegu: Add the NFC controller The Pixel 9a's ST54L sits at 0x08 on hsi2c9, its interrupt on gpa7-5 (level high), its RST_N on gph1-6, and its reference clock from the PMU's clock pad. Its chip enable (gpa0-1) powers the whole chip and is held high by a hog: stock's eSE driver raises it, and nothing here drives the eSE. Tested on the Pixel 9a: the controller probes on nxp-nci, polls and reads a contactless card (ISO-DEP over NFC-A) through neard. Link: https://android.googlesource.com/kernel/devices/google/tegu/+/6276884d9940694b25a6934671918ec8ac412ee8/dts/zuma-tegu-nfc.dtsi Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../boot/dts/exynos/google/zumapro-tegu.dts | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index 20e72a61a4..2bd25ff4ab 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -271,6 +271,21 @@ }; }; +/* + * The ST54L's chip enable (gpa0-1) powers the whole chip, NFC and its + * secure element; stock's eSE driver raises it at probe + * (ese_chip_enable-gpio in Google's GPL zuma-tegu-ese.dtsi). Nothing here + * drives the eSE, so hold it high. + */ +&gpa0 { + nfc-chip-enable-hog { + gpio-hog; + gpios = <1 GPIO_ACTIVE_HIGH>; + output-high; + line-name = "nfc-chip-enable"; + }; +}; + /* The keys' banks and the touchscreen's raise their own interrupts. */ &gpa4 { interrupt-controller; @@ -290,6 +305,20 @@ ; }; +/* The NFC controller's interrupt (gpa7-5). */ +&gpa7 { + interrupt-controller; + #interrupt-cells = <2>; + interrupts = , + , + , + , + , + , + , + ; +}; + &gpn0 { interrupt-controller; #interrupt-cells = <2>; @@ -354,6 +383,20 @@ cirrus,lra-redc-micro-ohms = <14100007>; cirrus,vpbr-threshold-microvolt = <3008000>; }; + + /* + * The ST54L NFC controller: plain NCI over I2C, nxp-nci's transport. + * Its "enable" line is the chip's RST_N; the PMU's clock pad gives it + * its reference clock. + */ + nfc@8 { + compatible = "st,st54l", "nxp,nxp-nci-i2c"; + reg = <0x08>; + clocks = <&pmu_system_controller 0>; + interrupt-parent = <&gpa7>; + interrupts = <5 IRQ_TYPE_LEVEL_HIGH>; + enable-gpios = <&gph1 6 GPIO_ACTIVE_HIGH>; + }; }; &pinctrl_alive { From f062ad68255a5d1d2c77ea511d28d75545b25483 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 20:54:58 -0647 Subject: [PATCH 19/26] arm64: dts: exynos: google: zumapro: Enable ramoops The region stock uses for ramoops was only reserved, because zuma's user-build bootloader doesn't keep it across a warm reset. zumapro's does: on the Pixel 9a, after a hang that ended in a watchdog reset, the console zone held the previous kernel's log up to the hang (after the bootloader's own log, which it writes at the start of the zone). Describe it as ramoops with stock zumapro's layout, which every other Google board in this tree also uses: console-size 0x200000 and pmsg-size 0x200000, with no record-size, so the console zone starts where the bootloader writes its log. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../boot/dts/exynos/google/zumapro-reserved-memory.dtsi | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-reserved-memory.dtsi b/arch/arm64/boot/dts/exynos/google/zumapro-reserved-memory.dtsi index 66157671ca..c170f24228 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-reserved-memory.dtsi +++ b/arch/arm64/boot/dts/exynos/google/zumapro-reserved-memory.dtsi @@ -176,10 +176,17 @@ no-map; }; - /* Reserve only; the pstore consumer is not enabled yet. */ + /* + * Stock's ramoops region. zumapro's bootloader keeps it across + * a watchdog reset (it also writes its own log at the start of + * the console zone). + */ ramoops_reserved: ramoops@fd3ff000 { + compatible = "ramoops"; reg = <0x0 0xfd3ff000 0x00400000>; no-map; + console-size = <0x200000>; + pmsg-size = <0x200000>; }; /* Not in Google's list; kept reserved until shown unused. */ From 7b592a7933b958b26066f2dfe34d091f29ebd69d Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 05:11:57 -0647 Subject: [PATCH 20/26] arm64: dts: exynos: google: zumapro-tegu: Add the fuel gauge and USB-C port controller The Pixel 9a's MAX77779 sits on hsi2c6 (USI6, pins gpp12-0/1, 950 kHz as stock): its fuel gauge at 0x36 with the board's 2 mOhm shunt, and its USB-C port controller at 0x25, interrupting on gpa8-3 (active low, as stock's max77759tcpc@25). The port is described as a sink with a dual data role and is not linked to the USB controller's role switch yet: the USB controller stays a peripheral, as today. gpa8 becomes an interrupt controller with its four EINT SPIs (44-47). Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../boot/dts/exynos/google/zumapro-tegu.dts | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index 2bd25ff4ab..67b2f818bc 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -12,6 +12,7 @@ #include #include #include +#include #include "../exynos-pinctrl.h" #include "zumapro.dtsi" #include "zumapro-reserved-memory.dtsi" @@ -319,6 +320,16 @@ ; }; +/* The USB-C port controller's interrupt (gpa8-3). */ +&gpa8 { + interrupt-controller; + #interrupt-cells = <2>; + interrupts = , + , + , + ; +}; + &gpn0 { interrupt-controller; #interrupt-cells = <2>; @@ -362,6 +373,42 @@ }; }; +/* + * The MAX77779's bus: its fuel gauge and its USB-C port controller, a sink + * with no link to the USB controller's role yet. + */ +&hsi2c6 { + clock-frequency = <950000>; + pinctrl-names = "default"; + pinctrl-0 = <&hsi2c6_bus>; + status = "okay"; + + usb_tcpc: tcpc@25 { + compatible = "maxim,max77779-tcpc"; + reg = <0x25>; + interrupt-parent = <&gpa8>; + interrupts = <3 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&usb_pd_irq>; + + connector { + compatible = "usb-c-connector"; + label = "USB-C"; + data-role = "dual"; + power-role = "sink"; + self-powered; + op-sink-microwatt = <2600000>; + sink-pdos = ; + }; + }; + + fuel_gauge: fuel-gauge@36 { + compatible = "maxim,max77779-fg"; + reg = <0x36>; + shunt-resistor-micro-ohms = <2000>; + }; +}; + /* The haptics: a CS40L26 on the 9a's LRA, with Google's limits for it. */ &hsi2c9 { clock-frequency = <100000>; @@ -401,6 +448,13 @@ &pinctrl_alive { status = "okay"; + + usb_pd_irq: usb-pd-irq-pins { + samsung,pins = "gpa8-3"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = <0>; + }; }; &pinctrl_custom_alive { @@ -440,6 +494,13 @@ samsung,pin-drv = <0>; }; + hsi2c6_bus: hsi2c6-bus-pins { + samsung,pins = "gpp12-0", "gpp12-1"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = <0>; + }; + touch_reset_held: touch-reset-held-pins { samsung,pins = "gpp1-1"; samsung,pin-function = ; @@ -564,6 +625,10 @@ status = "okay"; }; +&usi6 { + status = "okay"; +}; + &usi9 { status = "okay"; }; From 21343aff1413474631c54461b3068af77d88ddbe Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 20:12:10 -0647 Subject: [PATCH 21/26] arm64: dts: exynos: google: zumapro: Add USI10 and its I2C controller USI10 on PERIC1 carries the Pixel 9a's RT9470 (the USB OTG boost) at 0x5b. Add the USI and its HSI2C controller, disabled, with the clocks from CMU_PERIC1 (merged as "clk: samsung: zumapro: Add the PERIC1 USI10 clocks"), PERIC1 sysreg offset 0x8 and GIC SPI 658, as on the palmtop's running device tree, which bound it and talked to the RT9470. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../arm64/boot/dts/exynos/google/zumapro.dtsi | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro.dtsi b/arch/arm64/boot/dts/exynos/google/zumapro.dtsi index 0f116ff4a1..f8be1721dd 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro.dtsi +++ b/arch/arm64/boot/dts/exynos/google/zumapro.dtsi @@ -975,6 +975,33 @@ }; }; + usi10: usi@10ca00c0 { + compatible = "google,zumapro-usi", "samsung,exynos850-usi"; + reg = <0x0 0x10ca00c0 0x20>; + clocks = <&cmu_peric1 CLK_GOUT_PERIC1_USI10_PCLK>, + <&cmu_peric1 CLK_GOUT_PERIC1_USI10_IPCLK>; + clock-names = "pclk", "ipclk"; + samsung,sysreg = <&sysreg_peric1 0x8>; + samsung,mode = ; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x10ca0000 0x0 0x10ca0000 0x1000>; + status = "disabled"; + + hsi2c10: i2c@10ca0000 { + compatible = "google,zumapro-hsi2c", + "samsung,exynosautov9-hsi2c"; + reg = <0x10ca0000 0xc0>; + interrupts = ; + clocks = <&cmu_peric1 CLK_GOUT_PERIC1_USI10_IPCLK>, + <&cmu_peric1 CLK_GOUT_PERIC1_USI10_PCLK>; + clock-names = "hsi2c", "hsi2c_pclk"; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + }; + cmu_hsi0: clock-controller@11000000 { compatible = "google,zumapro-cmu-hsi0"; reg = <0x0 0x11000000 0x8000>; From 55b6f0356ab17e17d79f399c8e60ecaeac05f512 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 20:12:36 -0647 Subject: [PATCH 22/26] arm64: dts: exynos: google: zumapro-tegu: USB-C host mode (bring-up, not for merge) The setup behind the 10-28 host-mode run on the Pixel 9a, published so the run can be reproduced; not for merge. hsi2c10 with its pins and the RT9470 as an OTG boost (omamobile,tegu-rt9471-boost, an undocumented bring-up compatible, which checkpatch flags), the MAX77779 charger with its chgin-otg regulator over that boost (derekross/linux-omarchy-mobile#124), the TCPC as a dual-role port that prefers sink with chgin-otg as vbus-supply, and the connector's graph to dwc3, which becomes an OTG controller with a role switch. The source PDO (5 V, 900 mA) is the run's value; it isn't traced to a stock file yet. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../boot/dts/exynos/google/zumapro-tegu.dts | 64 +++++++++++++++++-- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index 67b2f818bc..b5dc652930 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -374,8 +374,11 @@ }; /* - * The MAX77779's bus: its fuel gauge and its USB-C port controller, a sink - * with no link to the USB controller's role yet. + * The MAX77779's bus: its fuel gauge, its charger and its USB-C port + * controller. Bring-up, not for merge: the port is dual-role, sourcing VBUS + * from the charger's chgin-otg regulator over the RT9470's OTG boost (the + * charger in standby, then the boost, as Google's ext-otg-only use case), + * and its data role drives dwc3's role switch. */ &hsi2c6 { clock-frequency = <950000>; @@ -390,15 +393,35 @@ interrupts = <3 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&usb_pd_irq>; + vbus-supply = <&chgin_otg>; connector { compatible = "usb-c-connector"; label = "USB-C"; data-role = "dual"; - power-role = "sink"; + power-role = "dual"; + try-power-role = "sink"; self-powered; op-sink-microwatt = <2600000>; sink-pdos = ; + /* 5 V, 900 mA: the run's value, not yet traced to stock */ + source-pdos = ; + + port { + typec_hs: endpoint { + remote-endpoint = <&usb_hs>; + }; + }; + }; + }; + + charger@69 { + compatible = "maxim,max77779-charger"; + reg = <0x69>; + otg-boost-supply = <&otg_boost>; + + chgin_otg: chgin-otg-regulator { + regulator-name = "chgin-otg"; }; }; @@ -409,6 +432,20 @@ }; }; +/* The RT9470, used only as the USB OTG boost (bring-up, not for merge). */ +&hsi2c10 { + clock-frequency = <400000>; + pinctrl-names = "default"; + pinctrl-0 = <&hsi2c10_bus>; + status = "okay"; + + otg_boost: regulator@5b { + compatible = "omamobile,tegu-rt9471-boost"; + reg = <0x5b>; + regulator-name = "otg-boost"; + }; +}; + /* The haptics: a CS40L26 on the 9a's LRA, with Google's limits for it. */ &hsi2c9 { clock-frequency = <100000>; @@ -511,6 +548,13 @@ &pinctrl_peric1 { status = "okay"; + hsi2c10_bus: hsi2c10-bus-pins { + samsung,pins = "gpp20-0", "gpp20-1"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = <0>; + }; + hsi2c9_bus: hsi2c9-bus-pins { samsung,pins = "gpp19-4", "gpp19-5"; samsung,pin-function = ; @@ -594,11 +638,19 @@ <&cmu_hsi0 CLK_GOUT_HSI0_USB_SUSPEND>, <&cmu_hsi0 CLK_GOUT_HSI0_USB_SUBCTL>; clock-names = "bus_early", "ref", "suspend", "subctl"; - dr_mode = "peripheral"; + dr_mode = "otg"; maximum-speed = "high-speed"; snps,dis-u2-freeclk-exists-quirk; snps,usb2-gadget-lpm-disable; + usb-role-switch; + role-switch-default-mode = "peripheral"; status = "okay"; + + port { + usb_hs: endpoint { + remote-endpoint = <&typec_hs>; + }; + }; }; &usb_hsphy { @@ -633,6 +685,10 @@ status = "okay"; }; +&usi10 { + status = "okay"; +}; + &watchdog_cl0 { status = "okay"; }; From be76a6384170d558d1b38c846fc0cb70b2bf79a7 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 20:13:20 -0647 Subject: [PATCH 23/26] regulator: tegu-rt9471-boost: The Pixel 9a's OTG boost (bring-up, not for merge) The Pixel 9a's RT9470 charger, run by Google's rt9471 driver on stock, used here only as the USB OTG boost: a regulator on OTG_EN (FUNCTION 0x02 bit 1) for the MAX77779 charger's chgin-otg regulator. Bring-up only; its upstream shape (mainline rt9471, or an OTG-only driver) is still open on derekross/linux-omarchy-mobile#124. The compatible, omamobile,tegu-rt9471-boost, is undocumented, which checkpatch flags. With the RT9470's JEITA control (0x0C bit 7) or its I2C watchdog (TOP 0x01 bits 1:0) on, VBUS collapsed under the boost within about 60 ms. Enabling turns both off just before OTG_EN, and disabling clears OTG_EN and puts both back as probe found them, so the chip runs without its temperature cut-off only in host mode. Probe only reads. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- drivers/regulator/Kconfig | 9 ++ drivers/regulator/Makefile | 1 + drivers/regulator/tegu-rt9471-boost.c | 158 ++++++++++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 drivers/regulator/tegu-rt9471-boost.c diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 6cda943820..d7bd2f5ca9 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -1636,6 +1636,15 @@ config REGULATOR_SY8827N help This driver supports SY8827N single output regulator. +config REGULATOR_TEGU_RT9471_BOOST + tristate "Pixel 9a RT9470 USB OTG boost (bring-up)" + depends on I2C && OF + select REGMAP_I2C + help + Bring-up only, not for merge: the Pixel 9a's RT9470 charger used + only as the USB OTG boost, a regulator on its OTG_EN bit, for the + MAX77779 charger's chgin-otg regulator in USB host mode. + config REGULATOR_TPS51632 tristate "TI TPS51632 Power Regulator" depends on I2C diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index bdddb35323..02ff025de6 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -140,6 +140,7 @@ obj-$(CONFIG_REGULATOR_PV88060) += pv88060-regulator.o obj-$(CONFIG_REGULATOR_PV88080) += pv88080-regulator.o obj-$(CONFIG_REGULATOR_PV88090) += pv88090-regulator.o obj-$(CONFIG_REGULATOR_PWM) += pwm-regulator.o +obj-$(CONFIG_REGULATOR_TEGU_RT9471_BOOST) += tegu-rt9471-boost.o obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o obj-$(CONFIG_REGULATOR_PBIAS) += pbias-regulator.o obj-$(CONFIG_REGULATOR_RAA215300) += raa215300.o diff --git a/drivers/regulator/tegu-rt9471-boost.c b/drivers/regulator/tegu-rt9471-boost.c new file mode 100644 index 0000000000..df37e77b3e --- /dev/null +++ b/drivers/regulator/tegu-rt9471-boost.c @@ -0,0 +1,158 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Bring-up only, not for upstream: the Pixel 9a's RT9470 (run by Google's + * rt9471 driver) as an OTG boost only, a regulator on its OTG_EN bit + * (FUNCTION 0x02 bit 1), which the MAX77779 charger enables to give a USB-C + * device VBUS. Probe only reads (the device id, and the JEITA and watchdog + * settings it finds). Enabling turns off JEITA (0x0C bit 7) and the I2C + * watchdog (TOP 0x01 bits 1:0), with either of which VBUS collapsed under + * the boost, and then sets OTG_EN; disabling clears OTG_EN and puts both + * back as probe found them. So the RT9470 runs without its temperature + * cut-off only in host mode. With the watchdog off, nothing turns the boost + * off after a crash. The charger part of the chip (charging, BC1.2, its + * interrupts) is left alone. + * + * Registers from mainline rt9471.c and Google's GPL rt9471_charger.h + * (google-modules/bms at 183509aff980). + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define RT9471_REG_OTGCFG 0x00 +#define RT9471_REG_TOP 0x01 +#define RT9471_WDT GENMASK(1, 0) +#define RT9471_REG_FUNC 0x02 +#define RT9471_OTGEN BIT(1) +#define RT9471_REG_INFO 0x0b +#define RT9471_REG_JEITA 0x0c +#define RT9471_JEITA_EN BIT(7) +#define RT9471_DEVID GENMASK(6, 3) + +static bool rt9471_boost_writeable(struct device *dev, unsigned int reg) +{ + return reg == RT9471_REG_FUNC || reg == RT9471_REG_TOP || + reg == RT9471_REG_JEITA; +} + +static const struct regmap_config rt9471_boost_regmap = { + .reg_bits = 8, + .val_bits = 8, + .max_register = 0x12, + .writeable_reg = rt9471_boost_writeable, + .cache_type = REGCACHE_NONE, +}; + +struct rt9471_boost { + struct regmap *map; + unsigned int jeita; /* JEITA_EN as probe found it */ + unsigned int wdt; /* the watchdog bits as probe found them */ +}; + +static int rt9471_boost_enable(struct regulator_dev *rdev) +{ + struct rt9471_boost *b = rdev_get_drvdata(rdev); + + return regmap_update_bits(b->map, RT9471_REG_JEITA, RT9471_JEITA_EN, 0) ?: + regmap_update_bits(b->map, RT9471_REG_TOP, RT9471_WDT, 0) ?: + regmap_update_bits(b->map, RT9471_REG_FUNC, RT9471_OTGEN, RT9471_OTGEN); +} + +static int rt9471_boost_disable(struct regulator_dev *rdev) +{ + struct rt9471_boost *b = rdev_get_drvdata(rdev); + + return regmap_update_bits(b->map, RT9471_REG_FUNC, RT9471_OTGEN, 0) ?: + regmap_update_bits(b->map, RT9471_REG_JEITA, RT9471_JEITA_EN, b->jeita) ?: + regmap_update_bits(b->map, RT9471_REG_TOP, RT9471_WDT, b->wdt); +} + +static const struct regulator_ops rt9471_boost_ops = { + .enable = rt9471_boost_enable, + .disable = rt9471_boost_disable, + .is_enabled = regulator_is_enabled_regmap, +}; + +static const struct regulator_desc rt9471_boost_desc = { + .name = "rt9471-otg-boost", + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + .ops = &rt9471_boost_ops, + .fixed_uV = 5000000, + .n_voltages = 1, + .enable_reg = RT9471_REG_FUNC, + .enable_mask = RT9471_OTGEN, + .enable_time = 5000, +}; + +static int rt9471_boost_probe(struct i2c_client *client) +{ + struct device *dev = &client->dev; + struct regulator_config cfg = {}; + struct regulator_dev *rdev; + struct rt9471_boost *b; + struct regmap *map; + unsigned int info; + int ret; + + b = devm_kzalloc(dev, sizeof(*b), GFP_KERNEL); + if (!b) + return -ENOMEM; + + map = devm_regmap_init_i2c(client, &rt9471_boost_regmap); + if (IS_ERR(map)) + return PTR_ERR(map); + b->map = map; + + ret = regmap_read(map, RT9471_REG_INFO, &info); + if (ret) + return dev_err_probe(dev, ret, "no answer\n"); + /* RT9470 0x9, RT9470D 0xa, RT9471 0xd, RT9471D 0xe */ + switch (FIELD_GET(RT9471_DEVID, info)) { + case 0x9: case 0xa: case 0xd: case 0xe: + break; + default: + return dev_err_probe(dev, -ENODEV, "unknown id %#x\n", info); + } + dev_info(dev, "id %#lx\n", FIELD_GET(RT9471_DEVID, info)); + + ret = regmap_read(map, RT9471_REG_JEITA, &b->jeita) ?: + regmap_read(map, RT9471_REG_TOP, &b->wdt); + if (ret) + return dev_err_probe(dev, ret, "cannot read JEITA and the watchdog\n"); + b->jeita &= RT9471_JEITA_EN; + b->wdt &= RT9471_WDT; + + cfg.dev = dev; + cfg.regmap = map; + cfg.driver_data = b; + cfg.of_node = dev->of_node; + cfg.init_data = of_get_regulator_init_data(dev, dev->of_node, + &rt9471_boost_desc); + rdev = devm_regulator_register(dev, &rt9471_boost_desc, &cfg); + return PTR_ERR_OR_ZERO(rdev); +} + +static const struct of_device_id rt9471_boost_of_match[] = { + { .compatible = "omamobile,tegu-rt9471-boost" }, + { } +}; +MODULE_DEVICE_TABLE(of, rt9471_boost_of_match); + +static struct i2c_driver rt9471_boost_driver = { + .driver = { + .name = "tegu-rt9471-boost", + .of_match_table = rt9471_boost_of_match, + }, + .probe = rt9471_boost_probe, +}; +module_i2c_driver(rt9471_boost_driver); + +MODULE_DESCRIPTION("RT9471 OTG boost for the Pixel 9a's USB-C port"); +MODULE_LICENSE("GPL"); From 4fa72ab7359d586150d6aaddccb3d7f59598d8f2 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 10:41:58 -0647 Subject: [PATCH 24/26] arm64: dts: exynos: google: zumapro-tegu: Cite stock for the source PDO (bring-up, not for merge) The 5 V, 900 mA source PDO is stock's: Google's zuma max777x9-tcpc.dtsi, which tegu's zuma-tegu-typec.dtsi includes, sets PDO_FIXED(5000, 900, ...) with the comment that the external boost can only do about 1 A. Stock's flags also include PDO_FIXED_SUSPEND and PDO_FIXED_DUAL_ROLE; the 10-28 run advertised USB_COMM and DATA_SWAP only, so the value here stays as the record of that run, and the mergeable board commit takes stock's full set. Link: https://android.googlesource.com/kernel/devices/google/zuma/+/42395e8adcb880aa336f0da6bb2a19ed53929c40/dts/max777x9-tcpc.dtsi Link: https://android.googlesource.com/kernel/devices/google/tegu/+/6276884d9940694b25a6934671918ec8ac412ee8/dts/zuma-tegu-typec.dtsi --- arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index b5dc652930..070312b0a9 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -404,7 +404,13 @@ self-powered; op-sink-microwatt = <2600000>; sink-pdos = ; - /* 5 V, 900 mA: the run's value, not yet traced to stock */ + /* + * 5 V, 900 mA is stock's (zuma/max777x9-tcpc.dtsi: "Extboost + * can only do ~1A", set to 900 mA). Stock also sets + * PDO_FIXED_SUSPEND and PDO_FIXED_DUAL_ROLE; the 10-28 run + * advertised only these two flags, so they stay here as the + * record of that run. The mergeable board takes stock's set. + */ source-pdos = ; port { From 26f0e5cd109171b6e823a27d565fa60f74d803cf Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 11:56:29 -0647 Subject: [PATCH 25/26] regulator: tegu-rt9471-boost: Keep the watchdog and service it as stock does (bring-up, not for merge) The boost ran with the RT9470's I2C watchdog off, so a crash in host mode left it on with nothing to stop it. Stock keeps the watchdog at 40 s (wdt = <40>) and Google's driver kicks it from the chip's own WDT interrupt (IRQ3 bit 5, serviced in rt9471_wdt_irq_handler), which the board carries on the MAX77779 PMIC's SGPIO6 (rt,intr_gpio, PLC_INT_L). Do the same: enabling sets the watchdog to 40 s, kicks it and unmasks the WDT interrupt; the handler kicks the chip and clears the bit. The line comes in as int-gpios with its pull-up, turned into an interrupt, because the pull lives in the PMIC and comes with the GPIO request. Without the line a kernel timer kicks the watchdog every 20 s, so the boost still ends within 40 s of a crash. The chip enable (CEB, stock's rt,ceb_gpio on SGPIO7) is enable-gpios, asserted at probe. Probe reports a boost a previous boot left on and turns it off; shutdown turns it off. JEITA stays off while the boost runs, which is stock's setting too (en-jeita is left out of tegu's rt9471 node and Google's driver reads it as a bool). Built W=1 clean against the palmtop's kernel. Not booted yet: the board commit that follows adds the lines, and the run is attended. Link: https://android.googlesource.com/kernel/google-modules/bms/+/183509aff980610401869deca9f6ce8836980fe7/rt9471_charger.c Link: https://android.googlesource.com/kernel/devices/google/tegu/+/6276884d9940694b25a6934671918ec8ac412ee8/dts/zumapro-buck-charge-rt9471.dtsi --- drivers/regulator/tegu-rt9471-boost.c | 162 +++++++++++++++++++++++--- 1 file changed, 143 insertions(+), 19 deletions(-) diff --git a/drivers/regulator/tegu-rt9471-boost.c b/drivers/regulator/tegu-rt9471-boost.c index df37e77b3e..567b398546 100644 --- a/drivers/regulator/tegu-rt9471-boost.c +++ b/drivers/regulator/tegu-rt9471-boost.c @@ -4,75 +4,152 @@ * rt9471 driver) as an OTG boost only, a regulator on its OTG_EN bit * (FUNCTION 0x02 bit 1), which the MAX77779 charger enables to give a USB-C * device VBUS. Probe only reads (the device id, and the JEITA and watchdog - * settings it finds). Enabling turns off JEITA (0x0C bit 7) and the I2C - * watchdog (TOP 0x01 bits 1:0), with either of which VBUS collapsed under - * the boost, and then sets OTG_EN; disabling clears OTG_EN and puts both - * back as probe found them. So the RT9470 runs without its temperature - * cut-off only in host mode. With the watchdog off, nothing turns the boost - * off after a crash. The charger part of the chip (charging, BC1.2, its - * interrupts) is left alone. + * settings it finds), except for a boost a previous boot left on, which it + * reports and turns off. Enabling turns off JEITA (0x0C bit 7; stock runs + * the RT9470 with it off, tegu's zumapro-buck-charge-rt9471.dtsi leaves + * en-jeita out), keeps the I2C watchdog at stock's 40 s (TOP 0x01 bits 1:0, + * wdt = <40>) and sets OTG_EN; disabling clears OTG_EN and puts JEITA and + * the watchdog back as probe found them. * - * Registers from mainline rt9471.c and Google's GPL rt9471_charger.h - * (google-modules/bms at 183509aff980). + * The watchdog is serviced as stock does it: the chip raises its WDT + * interrupt (IRQ3 bit 5) before the timer runs out and the handler kicks it + * (TOP bit 2). The interrupt line is the MAX77779 PMIC's SGPIO6, taken as a + * GPIO (int-gpios, so the pull-up stock sets on it comes with the request) + * and turned into an interrupt. Without the line, a kernel timer kicks the + * watchdog every 20 s instead, so a crash still ends the boost within 40 s + * either way. The chip enable (CEB, the PMIC's SGPIO7) is enable-gpios, + * asserted at probe. Shutdown turns the boost off. + * + * The charger part of the chip (charging, BC1.2, its other interrupts) is + * left alone. Registers from mainline rt9471.c and Google's GPL + * rt9471_charger.h and rt9471_charger.c (google-modules/bms at + * 183509aff980). */ #include +#include #include +#include #include #include #include #include #include #include +#include #define RT9471_REG_OTGCFG 0x00 #define RT9471_REG_TOP 0x01 #define RT9471_WDT GENMASK(1, 0) +#define RT9471_WDT_40S 1 +#define RT9471_WDT_RST BIT(2) #define RT9471_REG_FUNC 0x02 #define RT9471_OTGEN BIT(1) #define RT9471_REG_INFO 0x0b #define RT9471_REG_JEITA 0x0c #define RT9471_JEITA_EN BIT(7) #define RT9471_DEVID GENMASK(6, 3) +#define RT9471_REG_IRQ3 0x23 /* write 1 to clear */ +#define RT9471_REG_MASK3 0x33 /* 1 = masked */ +#define RT9471_IRQ3_WDT BIT(5) /* interrupt 29 */ + +#define RT9471_KICK_MS 20000 /* half the 40 s watchdog */ static bool rt9471_boost_writeable(struct device *dev, unsigned int reg) { return reg == RT9471_REG_FUNC || reg == RT9471_REG_TOP || - reg == RT9471_REG_JEITA; + reg == RT9471_REG_JEITA || reg == RT9471_REG_IRQ3 || + reg == RT9471_REG_MASK3; } static const struct regmap_config rt9471_boost_regmap = { .reg_bits = 8, .val_bits = 8, - .max_register = 0x12, + .max_register = 0x33, .writeable_reg = rt9471_boost_writeable, .cache_type = REGCACHE_NONE, }; struct rt9471_boost { + struct device *dev; struct regmap *map; + struct gpio_desc *enable; + int irq; + struct delayed_work kick; unsigned int jeita; /* JEITA_EN as probe found it */ unsigned int wdt; /* the watchdog bits as probe found them */ + unsigned int mask3; /* MASK3 as probe found it */ }; -static int rt9471_boost_enable(struct regulator_dev *rdev) +static int rt9471_boost_kick(struct rt9471_boost *b) { - struct rt9471_boost *b = rdev_get_drvdata(rdev); + return regmap_update_bits(b->map, RT9471_REG_TOP, RT9471_WDT_RST, RT9471_WDT_RST); +} - return regmap_update_bits(b->map, RT9471_REG_JEITA, RT9471_JEITA_EN, 0) ?: - regmap_update_bits(b->map, RT9471_REG_TOP, RT9471_WDT, 0) ?: - regmap_update_bits(b->map, RT9471_REG_FUNC, RT9471_OTGEN, RT9471_OTGEN); +static void rt9471_boost_kick_work(struct work_struct *work) +{ + struct rt9471_boost *b = container_of(to_delayed_work(work), + struct rt9471_boost, kick); + + if (rt9471_boost_kick(b)) + dev_err_ratelimited(b->dev, "cannot kick the watchdog\n"); + schedule_delayed_work(&b->kick, msecs_to_jiffies(RT9471_KICK_MS)); } -static int rt9471_boost_disable(struct regulator_dev *rdev) +static irqreturn_t rt9471_boost_irq(int irq, void *data) +{ + struct rt9471_boost *b = data; + unsigned int irq3; + + if (regmap_read(b->map, RT9471_REG_IRQ3, &irq3)) + return IRQ_NONE; + if (!(irq3 & RT9471_IRQ3_WDT)) + return IRQ_NONE; + + rt9471_boost_kick(b); + regmap_write(b->map, RT9471_REG_IRQ3, RT9471_IRQ3_WDT); + return IRQ_HANDLED; +} + +static int rt9471_boost_enable(struct regulator_dev *rdev) { struct rt9471_boost *b = rdev_get_drvdata(rdev); + int ret; + + ret = regmap_update_bits(b->map, RT9471_REG_JEITA, RT9471_JEITA_EN, 0) ?: + regmap_update_bits(b->map, RT9471_REG_TOP, RT9471_WDT, + FIELD_PREP(RT9471_WDT, RT9471_WDT_40S)) ?: + rt9471_boost_kick(b); + if (ret) + return ret; + if (b->irq > 0) { + ret = regmap_write(b->map, RT9471_REG_IRQ3, RT9471_IRQ3_WDT) ?: + regmap_update_bits(b->map, RT9471_REG_MASK3, RT9471_IRQ3_WDT, 0); + if (ret) + return ret; + } else { + schedule_delayed_work(&b->kick, msecs_to_jiffies(RT9471_KICK_MS)); + } + + return regmap_update_bits(b->map, RT9471_REG_FUNC, RT9471_OTGEN, RT9471_OTGEN); +} + +static int rt9471_boost_off(struct rt9471_boost *b) +{ + cancel_delayed_work_sync(&b->kick); return regmap_update_bits(b->map, RT9471_REG_FUNC, RT9471_OTGEN, 0) ?: + regmap_update_bits(b->map, RT9471_REG_MASK3, RT9471_IRQ3_WDT, + b->mask3 & RT9471_IRQ3_WDT) ?: regmap_update_bits(b->map, RT9471_REG_JEITA, RT9471_JEITA_EN, b->jeita) ?: regmap_update_bits(b->map, RT9471_REG_TOP, RT9471_WDT, b->wdt); } +static int rt9471_boost_disable(struct regulator_dev *rdev) +{ + return rt9471_boost_off(rdev_get_drvdata(rdev)); +} + static const struct regulator_ops rt9471_boost_ops = { .enable = rt9471_boost_enable, .disable = rt9471_boost_disable, @@ -96,14 +173,22 @@ static int rt9471_boost_probe(struct i2c_client *client) struct device *dev = &client->dev; struct regulator_config cfg = {}; struct regulator_dev *rdev; + struct gpio_desc *int_gpio; struct rt9471_boost *b; struct regmap *map; - unsigned int info; + unsigned int info, func; int ret; b = devm_kzalloc(dev, sizeof(*b), GFP_KERNEL); if (!b) return -ENOMEM; + b->dev = dev; + INIT_DELAYED_WORK(&b->kick, rt9471_boost_kick_work); + + /* CEB: asserted (low) keeps the chip on; stock drives it from the PMIC */ + b->enable = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH); + if (IS_ERR(b->enable)) + return dev_err_probe(dev, PTR_ERR(b->enable), "cannot get the enable line\n"); map = devm_regmap_init_i2c(client, &rt9471_boost_regmap); if (IS_ERR(map)) @@ -123,12 +208,42 @@ static int rt9471_boost_probe(struct i2c_client *client) dev_info(dev, "id %#lx\n", FIELD_GET(RT9471_DEVID, info)); ret = regmap_read(map, RT9471_REG_JEITA, &b->jeita) ?: - regmap_read(map, RT9471_REG_TOP, &b->wdt); + regmap_read(map, RT9471_REG_TOP, &b->wdt) ?: + regmap_read(map, RT9471_REG_MASK3, &b->mask3) ?: + regmap_read(map, RT9471_REG_FUNC, &func); if (ret) return dev_err_probe(dev, ret, "cannot read JEITA and the watchdog\n"); b->jeita &= RT9471_JEITA_EN; b->wdt &= RT9471_WDT; + dev_info(dev, "JEITA %s, watchdog %s (%#x)\n", + b->jeita ? "on" : "off", b->wdt ? "on" : "off", b->wdt); + if (func & RT9471_OTGEN) { + dev_warn(dev, "the boost was left on (a reset in host mode?); turning it off\n"); + ret = regmap_update_bits(map, RT9471_REG_FUNC, RT9471_OTGEN, 0); + if (ret) + return dev_err_probe(dev, ret, "cannot turn the boost off\n"); + } + + /* the WDT interrupt: stock's PLC_INT_L on the PMIC's SGPIO6, pulled up */ + int_gpio = devm_gpiod_get_optional(dev, "int", GPIOD_IN); + if (IS_ERR(int_gpio)) + return dev_err_probe(dev, PTR_ERR(int_gpio), "cannot get the interrupt line\n"); + if (int_gpio) { + b->irq = gpiod_to_irq(int_gpio); + if (b->irq < 0) + return dev_err_probe(dev, b->irq, "the interrupt line has no interrupt\n"); + ret = devm_request_threaded_irq(dev, b->irq, NULL, rt9471_boost_irq, + IRQF_TRIGGER_LOW | IRQF_ONESHOT, + dev_name(dev), b); + if (ret) + return dev_err_probe(dev, ret, "cannot request the interrupt\n"); + dev_info(dev, "watchdog serviced from interrupt %d\n", b->irq); + } else { + dev_info(dev, "no interrupt line: a timer kicks the watchdog\n"); + } + + i2c_set_clientdata(client, b); cfg.dev = dev; cfg.regmap = map; cfg.driver_data = b; @@ -139,6 +254,14 @@ static int rt9471_boost_probe(struct i2c_client *client) return PTR_ERR_OR_ZERO(rdev); } +static void rt9471_boost_shutdown(struct i2c_client *client) +{ + struct rt9471_boost *b = i2c_get_clientdata(client); + + if (rt9471_boost_off(b)) + dev_err(&client->dev, "cannot turn the boost off at shutdown\n"); +} + static const struct of_device_id rt9471_boost_of_match[] = { { .compatible = "omamobile,tegu-rt9471-boost" }, { } @@ -151,6 +274,7 @@ static struct i2c_driver rt9471_boost_driver = { .of_match_table = rt9471_boost_of_match, }, .probe = rt9471_boost_probe, + .shutdown = rt9471_boost_shutdown, }; module_i2c_driver(rt9471_boost_driver); From e5683bf8be8a8fe15b4c2172b9ca8380f666fac5 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 11:56:29 -0647 Subject: [PATCH 26/26] arm64: dts: exynos: google: zumapro-tegu: The MAX77779 PMIC block and the RT9470's lines (bring-up, not for merge) Add the MAX77779's PMIC block at 0x66 on hsi2c6 (maxim,max77779-pmic, linux-omarchy-mobile#139) with the chip's interrupt line on gpa8-0, pinned as stock's if_pmic_irq (EINT, pull-up; zuma-tegu-battery-common.dtsi), and give the RT9470 boost its two lines on it as stock's zumapro-buck-charge-rt9471.dtsi does: the interrupt on SGPIO6 with a pull-up (rt,intr_gpio) and the chip enable on SGPIO7 (rt,ceb_gpio). Builds; not booted yet. The boot is attended, with the boost's watchdog serviced from the interrupt for the first time. Link: https://android.googlesource.com/kernel/devices/google/tegu/+/6276884d9940694b25a6934671918ec8ac412ee8/dts/zuma-tegu-battery-common.dtsi --- .../boot/dts/exynos/google/zumapro-tegu.dts | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts index 070312b0a9..2c3193fe4a 100644 --- a/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts +++ b/arch/arm64/boot/dts/exynos/google/zumapro-tegu.dts @@ -320,7 +320,7 @@ ; }; -/* The USB-C port controller's interrupt (gpa8-3). */ +/* The USB-C port controller's (gpa8-3) and the MAX77779's (gpa8-0) interrupts. */ &gpa8 { interrupt-controller; #interrupt-cells = <2>; @@ -436,6 +436,23 @@ reg = <0x36>; shunt-resistor-micro-ohms = <2000>; }; + + /* + * The PMIC block: the chip's interrupt line (gpa8-0, stock's + * if_pmic_irq) and the SGPIOs that carry the RT9470's lines. + */ + max77779_pmic: pmic@66 { + compatible = "maxim,max77779-pmic"; + reg = <0x66>; + interrupt-parent = <&gpa8>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&if_pmic_irq>; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; }; /* The RT9470, used only as the USB OTG boost (bring-up, not for merge). */ @@ -449,6 +466,9 @@ compatible = "omamobile,tegu-rt9471-boost"; reg = <0x5b>; regulator-name = "otg-boost"; + /* stock's rt,intr_gpio (PLC_INT_L, pulled up) and rt,ceb_gpio */ + int-gpios = <&max77779_pmic 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + enable-gpios = <&max77779_pmic 7 GPIO_ACTIVE_LOW>; }; }; @@ -498,6 +518,13 @@ samsung,pin-pud = ; samsung,pin-drv = <0>; }; + + if_pmic_irq: if-pmic-irq-pins { + samsung,pins = "gpa8-0"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = <0>; + }; }; &pinctrl_custom_alive {