aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/tps6594-esm.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-13 22:14:51 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-13 22:14:51 +0200
commite75850b4573a092078d5ff1493d3d9ee16b98821 (patch)
treeece3bd9b45b43ec13c75de84967043a88fedda6e /drivers/misc/tps6594-esm.c
parent5a652fe5e38d906621e9c54a7d14ca4e030ab4f6 (diff)
parent2ccdd1b13c591d306f0401d98dedc4bdcd02b421 (diff)
downloadlinux-e75850b4573a092078d5ff1493d3d9ee16b98821.tar.gz
Merge 6.5-rc6 into char-misc-next
We need the char/misc fixes in here as well to build on top of. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/tps6594-esm.c')
-rw-r--r--drivers/misc/tps6594-esm.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/misc/tps6594-esm.c b/drivers/misc/tps6594-esm.c
index e8d12e7f2d2a46..b4d67a1a24e44e 100644
--- a/drivers/misc/tps6594-esm.c
+++ b/drivers/misc/tps6594-esm.c
@@ -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,11 +34,26 @@ 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;
- for (i = 0 ; i < pdev->num_resources ; 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)
return irq;