p9221_chip: check for available power in proprietary mode
Don't assume that the device in propritary mode can support 23W
and check for avaiable power before enabling the cap divider.
Bug: 195153778
Signed-off-by: AleX Pelosi <[email protected]>
Change-Id: I9b5348293a27a80955a8b66c6350d331cdfa05ca
(cherry picked from commit 2bc88bdea1ff8be342ff5d45f664177ede4a4212)
diff --git a/p9221_chip.c b/p9221_chip.c
index a48bc8c..5dd9d89 100644
--- a/p9221_chip.c
+++ b/p9221_chip.c
@@ -1189,14 +1189,26 @@
return 0;
}
- if (val8 == P9XXX_SYS_OP_MODE_PROPRIETARY)
+ if (val8 == P9XXX_SYS_OP_MODE_PROPRIETARY) {
+
+ /* Step0: don't even try if power is not supported */
+ ret = chgr->reg_read_8(chgr, P9412_PROP_TX_POTEN_PWR_REG, &txpwr);
+ txpwr = txpwr / 2;
+ if (ret != 0 || txpwr < HPP_MODE_PWR_REQUIRE) {
+ dev_info(&chgr->client->dev,
+ "PROP_MODE: power=%dW not supported\n", txpwr);
+ chgr->prop_mode_en = false;
+ goto err_exit;
+ }
+
goto enable_capdiv;
+ }
ret = p9xxx_chip_get_tx_mfg_code(chgr, &chgr->mfg);
if (chgr->mfg != WLC_MFG_GOOGLE) {
dev_err(&chgr->client->dev,
"PROP_MODE: mfg code =%02x\n", chgr->mfg);
- return 0;
+ return 0;
}
/*