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 ;
@@ -32,11 +34,26 @@ static int tps6594_esm_probe(struct platform_device *pdev)
32
34
{
33
35
struct tps6594 * tps = dev_get_drvdata (pdev -> dev .parent );
34
36
struct device * dev = & pdev -> dev ;
37
+ unsigned int rev ;
35
38
int irq ;
36
39
int ret ;
37
40
int i ;
38
41
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 ++ ) {
40
57
irq = platform_get_irq_byname (pdev , pdev -> resource [i ].name );
41
58
if (irq < 0 )
42
59
return dev_err_probe (dev , irq , "Failed to get %s irq\n" ,
0 commit comments