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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 23, 2023 at 05:31:26PM +0000, Bryan O'Donoghue wrote:
> On 23/03/2023 14:36, Jianhua Lu wrote:
> >> +	/* Poll waiting for transition to required vSafe5V or vSafe0V */
> >> +	ret = regmap_read_poll_timeout(pmic_typec->regmap,
> >> +				       pmic_typec->base + TYPEC_SM_STATUS_REG,
> >> +				       sm_stat, sm_stat & val,
> >> +				       100, 250000);
> > This statement isn't very useful and will case a error,
> > After I remove it, usb-c works well. What's about dropping this statement?
> > 
> > [   63.030672] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
> > [   63.030702] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 1
> > [   63.030895] xhci-hcd xhci-hcd.1.auto: hcc params 0x0230ffe5 hci version 0x110 quirks 0x0000000000010010
> > [   63.030926] xhci-hcd xhci-hcd.1.auto: irq 168, io mem 0x0a600000
> > [   63.031043] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
> > [   63.031054] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 2
> > [   63.031063] xhci-hcd xhci-hcd.1.auto: Host supports USB 3.1 Enhanced SuperSpeed
> > [   63.031835] hub 1-0:1.0: USB hub found
> > [   63.031863] hub 1-0:1.0: 1 port detected
> > [   63.032151] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
> > [   63.032690] hub 2-0:1.0: USB hub found
> > [   63.032713] hub 2-0:1.0: 1 port detected
> > [   63.168912] qcom,pmic-typec c440000.spmi:pmic@2:typec@1500: vbus vsafe5v fail
> > [   63.169185] xhci-hcd xhci-hcd.1.auto: remove, state 1
> > [   63.169195] usb usb2: USB disconnect, device number 1
> > [   63.178808] xhci-hcd xhci-hcd.1.auto: USB bus 2 deregistered
> > [   63.178825] xhci-hcd xhci-hcd.1.auto: remove, state 1
> > [   63.178832] usb usb1: USB disconnect, device number 1
> > [   63.182114] hub 1-0:1.0: activate --> -19
> > [   63.182791] xhci-hcd xhci-hcd.1.auto: USB bus 1 deregistered
> 
> Interesting.
> 
> What's your hardware configuration ? Could it be you don't have the VBUS 
> regulator pointed to the correct place ?
> 
> &pm8150b_vbus {
> 	regulator-min-microamp = <500000>;
> 	regulator-max-microamp = <3000000>;
> 	status = "okay";
> };
> 
> &pm8150b_typec {
> 	vdd-vbus-supply = <&pm8150b_vbus>;
> };
I think I configure it correctly, I have disassemble the compiled dtb,
don't find anything wrong.

usb-vbus-regulator@1100 {
	compatible = "qcom,pm8150b-vbus-reg";
	status = "okay";
	reg = <0x1100>;
	regulator-min-microamp = <0x7a120>;
	regulator-max-microamp = <0x2dc6c0>;
	phandle = <0xc9>;
};

typec@1500 {
	compatible = "qcom,pm8150b-typec";
	reg = <0x1500>;
	interrupts = <0x02 0x15 0x00 0x01 0x02 0x15 0x01 0x03 0x02 0x15 0x02 0x01 0x02 0x15 0x03 0x03 0x02 0x15 0x04 0x01 0x02 0x15 0x05 0x01 0x02 0x15 0x06 0x03 0x02 0x15 0x07 0x01>;
	interrupt-names = "or-rid-detect-change\0vpd-detect\0cc-state-change\0vconn-oc\0vbus-change\0attach-detach\0legacy-cable-detect\0try-snk-src-detect";
	vdd-vbus-supply = <0xc9>;
	status = "okay";
	phandle = <0x103>;
};
> 
> i.e. something else on your board supplies VBUS ?
pm8150b_vbus only. I try to disable regulator permanently in code and
usb-c doesn't work.
---
static int qcom_pmic_virt_tcpm_set_vbus(struct tcpc_dev *tcpc, bool on,
					bool sink)
{
	struct pmic_virt_tcpm *tcpm = tcpc_to_tcpm(tcpc);
	int ret = 0;

	mutex_lock(&tcpm->lock);
	if (tcpm->vbus_enabled == on)
		goto done;

	ret = qcom_pmic_typec_set_vbus(tcpm->pmic_typec, 0);
---
I hack it here.
> 
> vSafe5V should indicate to the controller that you have successfully 
> switched on vBus, so what this indicates to me is that on your hardware 
> VBUS either hasn't been asserted or hasn't been detected.
> 
> 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.
> And can you check your schematics and verify VBUS is supplied by 
> pm8150b_vbus and not say by an external IC ?
I haven't schematics, so I can only use hacking code to test it.
> 
> ---
> bod



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux