Moto G6 USB-C OTG and VBUS support#244
Conversation
The Moto G6 uses the PMI8950 SMBCHG OTG regulator to source VBUS for Type-C host mode. The regulator exists, but the PMIC also needs the downstream SCHG_LITE-style OTG configuration before enabling boost. Without it the regulator framework reports VBUS as enabled while passive OTG devices remain unpowered. Save and restore the USB charge-path and OTG configuration around OTG regulator use, suspend USB input while sourcing VBUS, configure command-control/RID mode with hiccup protection, select the 1 A OTG limit, and disable OTG pulse skip while boost is active. Also set the SDP input current limit explicitly and disable charger inhibit during init so charging recovers correctly after switching between charger, gadget and host roles. Signed-off-by: weidi <jweidacher@gmail.com>
Describe the Moto G6 FUSB302 Type-C controller and connect it to the DWC3 role switch. Model VBUS like the downstream Android device tree: a fixed usb_otg_vreg supplied directly by the SMBCHG OTG regulator, without the unused GPIO109 gate. This lets TCPM request the charger boost regulator when entering source/host mode while keeping the existing sink/device charging path for PC and charger connections. Signed-off-by: weidi <jweidacher@gmail.com>
| usb_type == POWER_SUPPLY_USB_TYPE_CDP)) { | ||
| if (usb_present && !otg_present && | ||
| usb_type == POWER_SUPPLY_USB_TYPE_SDP) { | ||
| ret = smbchg_usb_set_ilim(chip, SDP_CURRENT_UA); |
There was a problem hiding this comment.
It should be set to value which PROP_INPUT_CURRENT_LIMIT was set to (from usb gadget). dwc node needs usb-psy-name = "qcom-smbchg-usb"; for this to happen.
| pinctrl-0 = <&fusb302_int_default>; | ||
|
|
||
| vbus-supply = <&usb_otg_vreg>; | ||
| usb-role-switch = <&usb3>; |
There was a problem hiding this comment.
No such property in bindings. This should only be in USB controller node.
|
|
||
| /* | ||
| * Android treats PMI8950 as SCHG_LITE for OTG boost. Apply this | ||
| * only while sourcing VBUS so charger/sink mode can keep the PMIC |
There was a problem hiding this comment.
This should be in smbchg_init (only for smbchg_lite). No need to cram everything here.
|
|
||
| ret = qcom_pmic_sec_masked_write( | ||
| chip->regmap, chip->base + SMBCHG_OTG_ICFG, | ||
| OTG_ILIMIT_MASK, OTG_ILIMIT_1000MA); |
There was a problem hiding this comment.
This seems to be the default at boot and common downstream kernels don't touch it. If not should be in init.
| enable ? "En" : "Dis"); | ||
|
|
||
| if (enable && !chip->otg_usb_input_suspended) { | ||
| ret = smbchg_usb_enable(chip, false); |
There was a problem hiding this comment.
This and smbchg_usb_path_for_otg seems to be taken from ext_otg_vreg regulator ops. But that regulator isn't used on other devices. Also it doesn't look like it's used on G6 too. It seems to be fake regulator with workarounds for external regulator to not interfere with charger.
|
Hi @vldly, I have completely refactored the patch set to address your review feedback and clean up the implementation. The entire series has been tested and verified on physical hardware. Here is a summary of the refactoring and corrections made: Removed Dynamic Save/Restore Logic: The complex, dynamic register save/restore logic has been completely deleted from the qcom-smbchg driver. |
Enable USB-C OTG host mode on the Motorola Moto G6 (
motorola-ali).The DTS change describes the FUSB302 Type-C controller and models VBUS like the
downstream Android device tree: a fixed
usb_otg_vregregulator fed by theSMBCHG OTG regulator, without the unused GPIO109 gate.
The SMBCHG change provides the missing PMI8950/SCHG_LITE OTG setup needed for
physical VBUS. DTS-only probing can reach source/host state, but passive OTG
devices remain unpowered without the charger boost register setup.
Tested on a Moto G6:
Generated against
6.19.5/main.