devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Michael Walle <mwalle@kernel.org>
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Julien Panis <jpanis@baylibre.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-gpio@vger.kernel.org
Subject: Re: [PATCH v2 1/7] mfd: tps6594: Add TI TPS652G1 support
Date: Thu, 10 Jul 2025 10:00:25 +0100	[thread overview]
Message-ID: <20250710090025.GD10134@google.com> (raw)
In-Reply-To: <20250613114518.1772109-2-mwalle@kernel.org>

On Fri, 13 Jun 2025, Michael Walle wrote:

> The TPS652G1 is a stripped down version of the TPS65224. From a software
> point of view, it lacks any voltage monitoring, the watchdog, the ESM
> and the ADC.
> 
> Signed-off-by: Michael Walle <mwalle@kernel.org>
> ---
>  drivers/mfd/tps6594-core.c  | 88 ++++++++++++++++++++++++++++++++++---
>  drivers/mfd/tps6594-i2c.c   | 10 ++++-
>  drivers/mfd/tps6594-spi.c   | 10 ++++-
>  include/linux/mfd/tps6594.h |  1 +
>  4 files changed, 99 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/mfd/tps6594-core.c b/drivers/mfd/tps6594-core.c
> index a7223e873cd1..c16c37e36617 100644
> --- a/drivers/mfd/tps6594-core.c
> +++ b/drivers/mfd/tps6594-core.c
> @@ -1,6 +1,11 @@
>  // SPDX-License-Identifier: GPL-2.0
>  /*
> - * Core functions for TI TPS65224/TPS6594/TPS6593/LP8764 PMICs
> + * Core functions for following TI PMICs:
> + *  - LP8764
> + *  - TPS65224
> + *  - TPS652G1
> + *  - TPS6593
> + *  - TPS6594
>   *
>   * Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/
>   */
> @@ -414,6 +419,61 @@ static const unsigned int tps65224_irq_reg[] = {
>  	TPS6594_REG_INT_FSM_ERR,
>  };
>  
> +/* TPS652G1 Resources */
> +
> +static const struct mfd_cell tps652g1_common_cells[] = {
> +	MFD_CELL_RES("tps6594-pfsm", tps65224_pfsm_resources),
> +	MFD_CELL_RES("tps6594-pinctrl", tps65224_pinctrl_resources),
> +	MFD_CELL_NAME("tps6594-regulator"),
> +};
> +
> +static const struct regmap_irq tps652g1_irqs[] = {
> +	/* INT_GPIO register */
> +	REGMAP_IRQ_REG(TPS65224_IRQ_GPIO1, 2, TPS65224_BIT_GPIO1_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_GPIO2, 2, TPS65224_BIT_GPIO2_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_GPIO3, 2, TPS65224_BIT_GPIO3_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_GPIO4, 2, TPS65224_BIT_GPIO4_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_GPIO5, 2, TPS65224_BIT_GPIO5_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_GPIO6, 2, TPS65224_BIT_GPIO6_INT),
> +
> +	/* INT_STARTUP register */
> +	REGMAP_IRQ_REG(TPS65224_IRQ_VSENSE, 3, TPS65224_BIT_VSENSE_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_ENABLE, 3, TPS6594_BIT_ENABLE_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_PB_SHORT, 3, TPS65224_BIT_PB_SHORT_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_FSD, 3, TPS6594_BIT_FSD_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_SOFT_REBOOT, 3, TPS6594_BIT_SOFT_REBOOT_INT),
> +
> +	/* INT_MISC register */
> +	REGMAP_IRQ_REG(TPS65224_IRQ_BIST_PASS, 4, TPS6594_BIT_BIST_PASS_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_EXT_CLK, 4, TPS6594_BIT_EXT_CLK_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_REG_UNLOCK, 4, TPS65224_BIT_REG_UNLOCK_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_TWARN, 4, TPS6594_BIT_TWARN_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_PB_LONG, 4, TPS65224_BIT_PB_LONG_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_PB_FALL, 4, TPS65224_BIT_PB_FALL_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_PB_RISE, 4, TPS65224_BIT_PB_RISE_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_ADC_CONV_READY, 4, TPS65224_BIT_ADC_CONV_READY_INT),
> +
> +	/* INT_MODERATE_ERR register */
> +	REGMAP_IRQ_REG(TPS65224_IRQ_TSD_ORD, 5, TPS6594_BIT_TSD_ORD_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_BIST_FAIL, 5, TPS6594_BIT_BIST_FAIL_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_REG_CRC_ERR, 5, TPS6594_BIT_REG_CRC_ERR_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_RECOV_CNT, 5, TPS6594_BIT_RECOV_CNT_INT),
> +
> +	/* INT_SEVERE_ERR register */
> +	REGMAP_IRQ_REG(TPS65224_IRQ_TSD_IMM, 6, TPS6594_BIT_TSD_IMM_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_VCCA_OVP, 6, TPS6594_BIT_VCCA_OVP_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_PFSM_ERR, 6, TPS6594_BIT_PFSM_ERR_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_BG_XMON, 6, TPS65224_BIT_BG_XMON_INT),
> +
> +	/* INT_FSM_ERR register */
> +	REGMAP_IRQ_REG(TPS65224_IRQ_IMM_SHUTDOWN, 7, TPS6594_BIT_IMM_SHUTDOWN_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_ORD_SHUTDOWN, 7, TPS6594_BIT_ORD_SHUTDOWN_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_MCU_PWR_ERR, 7, TPS6594_BIT_MCU_PWR_ERR_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_SOC_PWR_ERR, 7, TPS6594_BIT_SOC_PWR_ERR_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_COMM_ERR, 7, TPS6594_BIT_COMM_ERR_INT),
> +	REGMAP_IRQ_REG(TPS65224_IRQ_I2C2_ERR, 7, TPS65224_BIT_I2C2_ERR_INT),
> +};
> +
>  static inline unsigned int tps6594_get_irq_reg(struct regmap_irq_chip_data *data,
>  					       unsigned int base, int index)
>  {
> @@ -443,7 +503,7 @@ static int tps6594_handle_post_irq(void *irq_drv_data)
>  	 * a new interrupt.
>  	 */
>  	if (tps->use_crc) {
> -		if (tps->chip_id == TPS65224) {
> +		if (tps->chip_id == TPS65224 || tps->chip_id == TPS652G1) {
>  			regmap_reg = TPS6594_REG_INT_FSM_ERR;
>  			mask_val = TPS6594_BIT_COMM_ERR_INT;
>  		} else {
> @@ -481,6 +541,18 @@ static struct regmap_irq_chip tps65224_irq_chip = {
>  	.handle_post_irq = tps6594_handle_post_irq,
>  };
>  
> +static struct regmap_irq_chip tps652g1_irq_chip = {
> +	.ack_base = TPS6594_REG_INT_BUCK,
> +	.ack_invert = 1,
> +	.clear_ack = 1,
> +	.init_ack_masked = 1,
> +	.num_regs = ARRAY_SIZE(tps65224_irq_reg),
> +	.irqs = tps652g1_irqs,
> +	.num_irqs = ARRAY_SIZE(tps652g1_irqs),
> +	.get_irq_reg = tps65224_get_irq_reg,
> +	.handle_post_irq = tps6594_handle_post_irq,
> +};
> +
>  static const struct regmap_range tps6594_volatile_ranges[] = {
>  	regmap_reg_range(TPS6594_REG_INT_TOP, TPS6594_REG_STAT_READBACK_ERR),
>  	regmap_reg_range(TPS6594_REG_RTC_STATUS, TPS6594_REG_RTC_STATUS),
> @@ -507,7 +579,7 @@ static int tps6594_check_crc_mode(struct tps6594 *tps, bool primary_pmic)
>  	int ret;
>  	unsigned int regmap_reg, mask_val;
>  
> -	if (tps->chip_id == TPS65224) {
> +	if (tps->chip_id == TPS65224 || tps->chip_id == TPS652G1) {
>  		regmap_reg = TPS6594_REG_CONFIG_2;
>  		mask_val = TPS65224_BIT_I2C1_SPI_CRC_EN;
>  	} else {
> @@ -537,7 +609,7 @@ static int tps6594_set_crc_feature(struct tps6594 *tps)
>  	int ret;
>  	unsigned int regmap_reg, mask_val;
>  
> -	if (tps->chip_id == TPS65224) {
> +	if (tps->chip_id == TPS65224 || tps->chip_id == TPS652G1) {
>  		regmap_reg = TPS6594_REG_CONFIG_2;
>  		mask_val = TPS65224_BIT_I2C1_SPI_CRC_EN;
>  	} else {
> @@ -628,6 +700,10 @@ int tps6594_device_init(struct tps6594 *tps, bool enable_crc)
>  		irq_chip = &tps65224_irq_chip;
>  		n_cells = ARRAY_SIZE(tps65224_common_cells);
>  		cells = tps65224_common_cells;
> +	} else if (tps->chip_id == TPS652G1) {
> +		irq_chip = &tps652g1_irq_chip;
> +		n_cells = ARRAY_SIZE(tps652g1_common_cells);
> +		cells = tps652g1_common_cells;
>  	} else {
>  		irq_chip = &tps6594_irq_chip;
>  		n_cells = ARRAY_SIZE(tps6594_common_cells);
> @@ -651,8 +727,8 @@ int tps6594_device_init(struct tps6594 *tps, bool enable_crc)
>  	if (ret)
>  		return dev_err_probe(dev, ret, "Failed to add common child devices\n");
>  
> -	/* No RTC for LP8764 and TPS65224 */
> -	if (tps->chip_id != LP8764 && tps->chip_id != TPS65224) {
> +	/* No RTC for LP8764, TPS65224 and TPS652G1 */
> +	if (tps->chip_id != LP8764 && tps->chip_id != TPS65224 && tps->chip_id != TPS652G1) {
>  		ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, tps6594_rtc_cells,
>  					   ARRAY_SIZE(tps6594_rtc_cells), NULL, 0,
>  					   regmap_irq_get_domain(tps->irq_data));
> diff --git a/drivers/mfd/tps6594-i2c.c b/drivers/mfd/tps6594-i2c.c
> index 4ab91c34d9fb..7ff7516286fd 100644
> --- a/drivers/mfd/tps6594-i2c.c
> +++ b/drivers/mfd/tps6594-i2c.c
> @@ -1,6 +1,11 @@
>  // SPDX-License-Identifier: GPL-2.0
>  /*
> - * I2C access driver for TI TPS65224/TPS6594/TPS6593/LP8764 PMICs
> + * I2C access driver for the following TI PMICs:
> + *  - LP8764
> + *  - TPS65224
> + *  - TPS652G1
> + *  - TPS6593
> + *  - TPS6594
>   *
>   * Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/
>   */
> @@ -197,6 +202,7 @@ static const struct of_device_id tps6594_i2c_of_match_table[] = {
>  	{ .compatible = "ti,tps6593-q1", .data = (void *)TPS6593, },
>  	{ .compatible = "ti,lp8764-q1",  .data = (void *)LP8764,  },
>  	{ .compatible = "ti,tps65224-q1", .data = (void *)TPS65224, },
> +	{ .compatible = "ti,tps652g1", .data = (void *)TPS652G1, },
>  	{}
>  };
>  MODULE_DEVICE_TABLE(of, tps6594_i2c_of_match_table);
> @@ -222,7 +228,7 @@ static int tps6594_i2c_probe(struct i2c_client *client)
>  		return dev_err_probe(dev, -EINVAL, "Failed to find matching chip ID\n");
>  	tps->chip_id = (unsigned long)match->data;
>  
> -	if (tps->chip_id == TPS65224)
> +	if (tps->chip_id == TPS65224 || tps->chip_id == TPS652G1)
>  		tps6594_i2c_regmap_config.volatile_table = &tps65224_volatile_table;
>  
>  	tps->regmap = devm_regmap_init(dev, NULL, client, &tps6594_i2c_regmap_config);
> diff --git a/drivers/mfd/tps6594-spi.c b/drivers/mfd/tps6594-spi.c
> index 6ebccb79f0cc..944b7313a1d9 100644
> --- a/drivers/mfd/tps6594-spi.c
> +++ b/drivers/mfd/tps6594-spi.c
> @@ -1,6 +1,11 @@
>  // SPDX-License-Identifier: GPL-2.0
>  /*
> - * SPI access driver for TI TPS65224/TPS6594/TPS6593/LP8764 PMICs
> + * SPI access driver for the following TI PMICs:
> + *  - LP8764
> + *  - TPS65224
> + *  - TPS652G1
> + *  - TPS6593
> + *  - TPS6594
>   *
>   * Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/
>   */
> @@ -82,6 +87,7 @@ static const struct of_device_id tps6594_spi_of_match_table[] = {
>  	{ .compatible = "ti,tps6593-q1", .data = (void *)TPS6593, },
>  	{ .compatible = "ti,lp8764-q1",  .data = (void *)LP8764,  },
>  	{ .compatible = "ti,tps65224-q1", .data = (void *)TPS65224, },
> +	{ .compatible = "ti,tps652g1", .data = (void *)TPS652G1, },

I get warnings about this being undocumented.

Should it be added to:

  Documentation/devicetree/bindings/mfd/ti,tps6594.yaml

>  	{}
>  };
>  MODULE_DEVICE_TABLE(of, tps6594_spi_of_match_table);
> @@ -107,7 +113,7 @@ static int tps6594_spi_probe(struct spi_device *spi)
>  		return dev_err_probe(dev, -EINVAL, "Failed to find matching chip ID\n");
>  	tps->chip_id = (unsigned long)match->data;
>  
> -	if (tps->chip_id == TPS65224)
> +	if (tps->chip_id == TPS65224 || tps->chip_id == TPS652G1)
>  		tps6594_spi_regmap_config.volatile_table = &tps65224_volatile_table;
>  
>  	tps->regmap = devm_regmap_init(dev, NULL, spi, &tps6594_spi_regmap_config);
> diff --git a/include/linux/mfd/tps6594.h b/include/linux/mfd/tps6594.h
> index 16543fd4d83e..021db8875963 100644
> --- a/include/linux/mfd/tps6594.h
> +++ b/include/linux/mfd/tps6594.h
> @@ -19,6 +19,7 @@ enum pmic_id {
>  	TPS6593,
>  	LP8764,
>  	TPS65224,
> +	TPS652G1,
>  };
>  
>  /* Macro to get page index from register address */
> -- 
> 2.39.5
> 

-- 
Lee Jones [李琼斯]

  parent reply	other threads:[~2025-07-10  9:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-13 11:45 [PATCH v2 0/7] mfd: tps6594: Add TI TPS652G1 support Michael Walle
2025-06-13 11:45 ` [PATCH v2 1/7] " Michael Walle
2025-06-19 13:35   ` Lee Jones
2025-07-10  9:00   ` Lee Jones [this message]
2025-07-10  9:06     ` Michael Walle
2025-07-10  9:47       ` Lee Jones
2025-06-13 11:45 ` [PATCH v2 2/7] misc: tps6594-pfsm: Add TI TPS652G1 PMIC PFSM Michael Walle
2025-06-30  7:48   ` Arnd Bergmann
2025-06-13 11:45 ` [PATCH v2 3/7] pinctrl: pinctrl-tps6594: Add TPS652G1 PMIC pinctrl and GPIO Michael Walle
2025-06-18 11:52   ` Linus Walleij
2025-06-13 11:45 ` [PATCH v2 4/7] regulator: tps6594-regulator: remove interrupt_count Michael Walle
2025-06-13 12:06   ` Mark Brown
2025-06-13 11:45 ` [PATCH v2 5/7] regulator: tps6594-regulator: remove hardcoded buck config Michael Walle
2025-06-13 12:06   ` Mark Brown
2025-06-13 11:45 ` [PATCH v2 6/7] regulator: tps6594-regulator: refactor variant descriptions Michael Walle
2025-06-13 12:07   ` Mark Brown
2025-06-13 11:45 ` [PATCH v2 7/7] regulator: tps6594-regulator: Add TI TPS652G1 PMIC regulators Michael Walle
2025-06-13 12:07   ` Mark Brown
2025-07-02 15:30 ` [PATCH v2 0/7] mfd: tps6594: Add TI TPS652G1 support Lee Jones
2025-07-10  8:58 ` (subset) " Lee Jones
2025-07-10  9:49 ` [GIT PULL] Immutable branch between MFD, Misc and Pinctrl due for the v6.17 merge window Lee Jones
2025-07-10  9:57   ` Mark Brown
2025-07-10 10:46     ` Michael Walle
2025-07-10 11:04       ` Mark Brown
2025-07-18  7:13     ` Lee Jones
2025-07-18 13:27       ` Mark Brown
2025-07-18 13:38         ` Lee Jones
2025-07-18 14:33           ` Mark Brown
2025-07-11 17:37   ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250710090025.GD10134@google.com \
    --to=lee@kernel.org \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jpanis@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mwalle@kernel.org \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).