@@ -68,6 +68,7 @@ enum {
TPS_MODE_BOOT,
TPS_MODE_BIST,
TPS_MODE_DISC,
+ TPS_MODE_PTCH,
};
static const char *const modes[] = {
@@ -75,6 +76,7 @@ static const char *const modes[] = {
[TPS_MODE_BOOT] = "BOOT",
[TPS_MODE_BIST] = "BIST",
[TPS_MODE_DISC] = "DISC",
+ [TPS_MODE_PTCH] = "PTCH",
};
/* Unrecognized commands will be replaced with "!CMD" */
@@ -593,12 +595,15 @@ static int tps6598x_check_mode(struct tps6598x *tps)
if (ret)
return ret;
- switch (match_string(modes, ARRAY_SIZE(modes), mode)) {
+ ret = match_string(modes, ARRAY_SIZE(modes), mode);
+
+ switch (ret) {
case TPS_MODE_APP:
- return 0;
+ case TPS_MODE_PTCH:
+ return ret;
case TPS_MODE_BOOT:
dev_warn(tps->dev, "dead-battery condition\n");
- return 0;
+ return ret;
case TPS_MODE_BIST:
case TPS_MODE_DISC:
default:
@@ -765,7 +770,7 @@ static int tps6598x_probe(struct i2c_client *client)
tps->irq_handler = irq_handler;
/* Make sure the controller has application firmware running */
ret = tps6598x_check_mode(tps);
- if (ret)
+ if (ret < 0)
return ret;
ret = tps6598x_write64(tps, TPS_REG_INT_MASK1, mask1);