Re: [PATCH v4 00/18] Add Qualcomm PMIC TPCM support

Luca Weiss
2023-03-31T14:58:56Z

On Fri Mar 31, 2023 at 3:52 PM CEST, Bryan O'Donoghue wrote:
> On 31/03/2023 09:48, Luca Weiss wrote:
> > Hi Bryan,
> >
> > On Fri Mar 24, 2023 at 4:28 PM CET, Bryan O'Donoghue wrote:
> >> On 24/03/2023 15:10, Luca Weiss wrote:
> >>> When plugging in the device with TCPM on into my PC (peripheral mode)
> >>> then the USB device registers and unregisters every couple of seconds,
> >>> never stays stable on. No messages in dmesg when this happens. This only
> >>> happens with the USB-C plug in one direction, in the other it
> >>> works reliable.
> >>
> >> Sounds like we need to do some SoC specific debug on orientation
> >> switching in the PHY.
> >
> > I also know that the phone has a AW35743 chip in the USB path,
> > controlled by DP_AUX_EN and DP_AUX_SEL gpios but I think this is only
> > for displayport, right?
> >
>
> https://www.awinic.com/en/productDetail/AW35743CSR#product-details D+/D-
> looks like USB 2.x ..
>
> Your DP should go over TX1+/1 TX2+/- depending on orientation and # of
> lanes in use.

There's USB0_DP_AUX_P & USB0_DP_AUX_M from the SoC connected on the
D1+/- & D2+/- pins of this awinic chip, and out comes USB_SBU1 and
USB_SBU2 which goes to the USB connector. So just switching polarity of
those pins.
But let's say whatever it does, it's not relevant to this use case now
without DP?

>
> https://www.allaboutcircuits.com/uploads/articles/Fig1m11292018.png
>
> >>
> >> I wonder how many lanes dp_opts->lanes says for your part ?
> >
> > Not sure.. Where is this configured?
>
> Heh - now that I look my lane count == 0, a bug to be fixed..
>
> Hmm, Luca can you test this change
>
> - if (orientation == TYPEC_ORIENTATION_NONE) {
> - if (qmp->init_count)
> - ret = qmp_combo_dp_power_off(dp_phy);
> - } else {
> - if (!qmp->init_count)
> - ret = qmp_combo_dp_power_on(dp_phy);
> - }
> + if (orientation == TYPEC_ORIENTATION_NONE)
> + ret = qmp_combo_dp_power_off(dp_phy);
> + else
> + ret = qmp_combo_dp_power_on(dp_phy);

I unfortunately don't really see any change in behavior with this..

>
>
> > But I also don't have DisplayPort over USB-C (video out) configured yet.
> > Related question: does video out work on sm8250+pm8150b for you?
>
> Nope - WIP. I see getting TCPM upstream and working as a first step,
> then we look at introduction of the redriver, DP work, dt etc.

Clear, I look forward to that landing ;) But also already what the
driver does now is really useful!

Regards
Luca

>
>
> > [ 1722.130836] qcom,pmic-typec c440000.spmi:pmic@2:typec@1500: get_cc: misc 0x000000cb cc1 0x00000001 Ra cc2 0x00000002 Rd attached 1 cc=cc1
> >
> > - unplug -
> >
> > [ 1867.223052] qcom,pmic-typec c440000.spmi:pmic@2:typec@1500: get_cc: misc 0x00000042 cc1 0x00000000 Open cc2 0x00000000 Open attached 0 cc=cc1
> > ==================================================================================
> > USB unstable (device plug orientation 2):
> > ==================================================================================
> >
> > [ 1894.263324] qcom,pmic-typec c440000.spmi:pmic@2:typec@1500: get_cc: misc 0x000000c9 cc1 0x00000002 Rd cc2 0x00000001 Ra attached 1 cc=cc2
> > - unplug -
> >
> > [ 1907.264840] qcom,pmic-typec c440000.spmi:pmic@2:typec@1500: get_cc: misc 0x00000040 cc1 0x00000000 Open cc2 0x00000000 Open attached 0 cc=cc2
>
> Normal, correct.
>
> For reference on 8250
>
> Attached orientation reverse / cc2
>
> [ 77.719278] qcom,pmic-typec c440000.spmi:pmic@2:typec@1500: set_cc:
> currsrc=2 Rp-3.0-330uA mode EN_SRC_ONLY debounce 1 attached 1 cc=cc2
>
> Detached orientation (none)
> [ 82.475667] qcom,pmic-typec c440000.spmi:pmic@2:typec@1500: get_cc:
> misc 0x000000c0 cc1 0x00000000 Open cc2 0x00000000 Open attached 0 cc=cc2
>
> Attached orientation normal / cc1
> [ 82.485375] qcom,pmic-typec c440000.spmi:pmic@2:typec@1500:
> start_toggling: misc 0x00000040 attached 0 port_type 0 current cc 5 new 5
> [ 85.247368] qcom,pmic-typec c440000.spmi:pmic@2:typec@1500: get_cc:
> misc 0x000000cb cc1 0x00000001 Ra cc2 0x00000002 Rd attached 1 cc=cc1
>
> Anyway I reckon that guard I have in the PHY code is wrong, would
> appreciate a test.
>
> ---
> bod