Skip to content

Commit 77107b0

Browse files
Skallwargregkh
authored andcommitted
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: 875fdd0 ("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>
1 parent 101bd90 commit 77107b0

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

drivers/misc/tps6594-esm.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
#include <linux/mfd/tps6594.h>
1515

16+
#define TPS6594_DEV_REV_1 0x08
17+
1618
static irqreturn_t tps6594_esm_isr(int irq, void *dev_id)
1719
{
1820
struct platform_device *pdev = dev_id;
@@ -32,11 +34,26 @@ static int tps6594_esm_probe(struct platform_device *pdev)
3234
{
3335
struct tps6594 *tps = dev_get_drvdata(pdev->dev.parent);
3436
struct device *dev = &pdev->dev;
37+
unsigned int rev;
3538
int irq;
3639
int ret;
3740
int i;
3841

39-
for (i = 0 ; i < pdev->num_resources ; i++) {
42+
/*
43+
* Due to a bug in revision 1 of the PMIC, the GPIO3 used for the
44+
* SoC ESM function is used to power the load switch instead.
45+
* As a consequence, ESM can not be used on those PMIC.
46+
* Check the version and return an error in case of revision 1.
47+
*/
48+
ret = regmap_read(tps->regmap, TPS6594_REG_DEV_REV, &rev);
49+
if (ret)
50+
return dev_err_probe(dev, ret,
51+
"Failed to read PMIC revision\n");
52+
if (rev == TPS6594_DEV_REV_1)
53+
return dev_err_probe(dev, -ENODEV,
54+
"ESM not supported for revision 1 PMIC\n");
55+
56+
for (i = 0; i < pdev->num_resources; i++) {
4057
irq = platform_get_irq_byname(pdev, pdev->resource[i].name);
4158
if (irq < 0)
4259
return dev_err_probe(dev, irq, "Failed to get %s irq\n",

0 commit comments

Comments
 (0)