Re: [PATCH v4 12/18] usb: typec: qcom: Add Qualcomm PMIC TCPM support

Bryan O'Donoghue
2023-03-24T02:37:21Z

On 24/03/2023 01:13, Jianhua Lu wrote:
>> Can you show the printout of *(pmic_typec->base + TYPEC_SM_STATUS_REG) ?
> [ 53.120005] hub 1-1:1.0: 4 ports detected
> [ 58.675134] typec base is 0x1500
> [ 58.675148] TYPEC_SM_STATUS_REG is 0xa
> [ 58.675153] typec status reg is 0x150a
> It should be correct.

So that is some very very strange value you have in that register.

This is from my WIP tree so the filename has changed but

+#define DEBUG 1
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/interrupt.h>
@@ -181,6 +181,17 @@ int qcom_pmic_typec_port_set_vbus(struct
pmic_typec_port *pmic_typec_port, bool
if (ret)
dev_err(pmic_typec_port->dev, "vbus vsafe%dv fail\n",
on ? 5 : 0);

+ dev_info(pmic_typec_port->dev, "%s sm_stat output 0x%08x\n",
__func__, sm_stat);
+
+ ret = regmap_read(pmic_typec_port->regmap,
+ pmic_typec_port->base + TYPEC_MISC_STATUS_REG,
+ &val);
+ dev_info(pmic_typec_port->dev, "%s misc 0x%08x\n", __func__, val);
+ ret = regmap_read(pmic_typec_port->regmap,
+ pmic_typec_port->base + TYPEC_SM_STATUS_REG,
+ &val);
+ dev_info(pmic_typec_port->dev, "%s sm_status 0x%08x\n",
__func__, val);

[ 17.098067] qcom,pmic-typec c440000.spmi:pmic@2:typec@1500:
qcom_pmic_typec_port_set_vbus sm_stat output 0x000000b9

[ 17.108819] qcom,pmic-typec c440000.spmi:pmic@2:typec@1500:
qcom_pmic_typec_port_set_vbus misc 0x000000cb

[ 17.118659] qcom,pmic-typec c440000.spmi:pmic@2:typec@1500:
qcom_pmic_typec_port_set_vbus sm_status 0x000000b9

SM_STAT == 0xb9 => 10111001

1 : TYPEC_SM_USBIN_LT_LV
0 : TYPEC_SM_VBUS_VSAFE0V
1 : TYPEC_SM_VBUS_VSAFE5V
1 : not mapped
1 : not mapped
0 : not mapped
0 : not mapped
1 : not mapped

In other words, my hardware gives a clear indication of the appropriate
transition.

Would appreciate if you could apply the above "patch"

That said I _am_ included to believe you and to do something about it, I
will downgrade to a warning instead of returning on error in failure to
transition to VSafeVX

Yeah though I'd appreciate seeing the output of the above patch to see
if there's something we are missing.

Thanks for your review/time/input

---
bod