Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 875fdd0787e4 ("misc: tps6594-esm: Add driver for TI TPS6594 ESM")
Co-developed-by: Julien Panis <jpanis@baylibre.com>
Signed-off-by: Julien Panis <jpanis@baylibre.com>
Signed-off-by: Esteban Blanc <eblanc@baylibre.com>
Link: https://lore.kernel.org/r/20230726-tps6594_fix_esm_for_v1-v1-1-2adfdcad31c2@baylibre.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Esteban Blanc and committed by
Greg Kroah-Hartman
77107b08 101bd907

+18 -1
+18 -1
drivers/misc/tps6594-esm.c
··· 13 13 14 14 #include <linux/mfd/tps6594.h> 15 15 16 + #define TPS6594_DEV_REV_1 0x08 17 + 16 18 static irqreturn_t tps6594_esm_isr(int irq, void *dev_id) 17 19 { 18 20 struct platform_device *pdev = dev_id; ··· 34 32 { 35 33 struct tps6594 *tps = dev_get_drvdata(pdev->dev.parent); 36 34 struct device *dev = &pdev->dev; 35 + unsigned int rev; 37 36 int irq; 38 37 int ret; 39 38 int i; 40 39 41 - for (i = 0 ; i < pdev->num_resources ; i++) { 40 + /* 41 + * Due to a bug in revision 1 of the PMIC, the GPIO3 used for the 42 + * SoC ESM function is used to power the load switch instead. 43 + * As a consequence, ESM can not be used on those PMIC. 44 + * Check the version and return an error in case of revision 1. 45 + */ 46 + ret = regmap_read(tps->regmap, TPS6594_REG_DEV_REV, &rev); 47 + if (ret) 48 + return dev_err_probe(dev, ret, 49 + "Failed to read PMIC revision\n"); 50 + if (rev == TPS6594_DEV_REV_1) 51 + return dev_err_probe(dev, -ENODEV, 52 + "ESM not supported for revision 1 PMIC\n"); 53 + 54 + for (i = 0; i < pdev->num_resources; i++) { 42 55 irq = platform_get_irq_byname(pdev, pdev->resource[i].name); 43 56 if (irq < 0) 44 57 return dev_err_probe(dev, irq, "Failed to get %s irq\n",