Commit 77107b08 authored by Esteban Blanc's avatar Esteban Blanc Committed by Greg Kroah-Hartman
Browse files

misc: tps6594-esm: Disable ESM for rev 1 PMIC



Due to a silicon bug, ESM on TPS6594 PMIC revision 1 is not working
properly. This patch keeps SOC ESM disabled for such PMIC.

Fixes: 875fdd07 ("misc: tps6594-esm: Add driver for TI TPS6594 ESM")
Co-developed-by: default avatarJulien Panis <jpanis@baylibre.com>
Signed-off-by: default avatarJulien Panis <jpanis@baylibre.com>
Signed-off-by: default avatarEsteban Blanc <eblanc@baylibre.com>
Link: https://lore.kernel.org/r/20230726-tps6594_fix_esm_for_v1-v1-1-2adfdcad31c2@baylibre.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 101bd907
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@

#include <linux/mfd/tps6594.h>

#define TPS6594_DEV_REV_1 0x08

static irqreturn_t tps6594_esm_isr(int irq, void *dev_id)
{
	struct platform_device *pdev = dev_id;
@@ -32,10 +34,25 @@ static int tps6594_esm_probe(struct platform_device *pdev)
{
	struct tps6594 *tps = dev_get_drvdata(pdev->dev.parent);
	struct device *dev = &pdev->dev;
	unsigned int rev;
	int irq;
	int ret;
	int i;

	/*
	 * Due to a bug in revision 1 of the PMIC, the GPIO3 used for the
	 * SoC ESM function is used to power the load switch instead.
	 * As a consequence, ESM can not be used on those PMIC.
	 * Check the version and return an error in case of revision 1.
	 */
	ret = regmap_read(tps->regmap, TPS6594_REG_DEV_REV, &rev);
	if (ret)
		return dev_err_probe(dev, ret,
				     "Failed to read PMIC revision\n");
	if (rev == TPS6594_DEV_REV_1)
		return dev_err_probe(dev, -ENODEV,
			      "ESM not supported for revision 1 PMIC\n");

	for (i = 0; i < pdev->num_resources; i++) {
		irq = platform_get_irq_byname(pdev, pdev->resource[i].name);
		if (irq < 0)