Add full description of USB-MUIC (MAX77693 MUIC) and MUIC-MHL
connections, along with proper USB connector and OTG mode for DWC2 USB
controller.
This fixes dtc W=1 warnings:
Warning (graph_child_address): /i2c-mhl/hdmi-bridge@39/ports: graph node has single child node 'port@0', #address-cells/#size-cells are not necessary
Cc: Marek Szyprowski <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: ~postmarketos/[email protected]
Cc: Martin Jücker <[email protected]>
Cc: Henrik Grimler <[email protected]>
Cc: Artur Weber <[email protected]>
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
Changes in v2:
1. Put connector node in the muic node (Henrik)
Not tested on hardware. Please kindly check if peripheral mode is not
broken. Or maybe OTG started to work?
---
.../boot/dts/samsung/exynos4412-midas.dtsi | 50 ++++++++++++++++++-
1 file changed, 49 insertions(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/samsung/exynos4412-midas.dtsi b/arch/arm/boot/dts/samsung/exynos4412-midas.dtsi
index 57836d5554d0..7daf25865551 100644
--- a/arch/arm/boot/dts/samsung/exynos4412-midas.dtsi
+++ b/arch/arm/boot/dts/samsung/exynos4412-midas.dtsi
@@ -182,6 +182,38 @@ pmic@66 {
pinctrl-0 = <&max77693_irq>;
reg = <0x66>;
+ muic {
+ compatible = "maxim,max77693-muic";
+
+ connector {
+ compatible = "samsung,usb-connector-11pin",
+ "usb-b-connector";
+ label = "micro-USB";
+ type = "micro";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+
+ muic_to_usb: endpoint {
+ remote-endpoint = <&usb_to_muic>;
+ };
+ };
+
+ port@3 {
+ reg = <3>;
+
+ muic_to_mhl: endpoint {
+ remote-endpoint = <&mhl_to_muic>;
+ };
+ };
+ };
+ };
+ };
+
regulators {
esafeout1_reg: ESAFEOUT1 {
regulator-name = "ESAFEOUT1";
@@ -287,6 +319,14 @@ mhl_to_hdmi: endpoint {
remote-endpoint = <&hdmi_to_mhl>;
};
};
+
+ port@1 {
+ reg = <1>;
+
+ mhl_to_muic: endpoint {
+ remote-endpoint = <&muic_to_mhl>;
+ };
+ };
};
};
};
@@ -545,8 +585,16 @@ hdmi_to_mhl: endpoint {
&hsotg {
vusb_d-supply = <&ldo15_reg>;
vusb_a-supply = <&ldo12_reg>;
- dr_mode = "peripheral";
+ dr_mode = "otg";
+ role-switch-default-mode = "peripheral";
+ usb-role-switch;
status = "okay";
+
+ port {
+ usb_to_muic: endpoint {
+ remote-endpoint = <&muic_to_usb>;
+ };
+ };
};
&i2c_0 {
--
2.34.1
On Sun, Jul 23, 2023 at 04:24:17PM +0200, Krzysztof Kozlowski wrote:
> Add full description of USB-MUIC (MAX77693 MUIC) and MUIC-MHL
> connections, along with proper USB connector and OTG mode for DWC2 USB
> controller.
>
> This fixes dtc W=1 warnings:
>
> Warning (graph_child_address): /i2c-mhl/hdmi-bridge@39/ports: graph node has single child node 'port@0', #address-cells/#size-cells are not necessary
>
> Cc: Marek Szyprowski <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: ~postmarketos/[email protected]
> Cc: Martin J?cker <[email protected]>
> Cc: Henrik Grimler <[email protected]>
> Cc: Artur Weber <[email protected]>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
Tested-by: Henrik Grimler <[email protected]>
* Peripheral mode (still) works
* MHL somewhat works
* OTG (still) does not work
Further details for those interested:
MHL works reliably if cable is attached before boot, but if cable is
attached on already running device it sometimes work after detaching
and attaching cable a few times. On cable attach, when it does not
work, we get:
[ 252.831734] max77693-muic max77693-muic: external connector is detached(chg_type:0x0, prev_chg_type:0x0)
[ 253.733916] max77693-muic max77693-muic: external connector is attached(chg_type:0x1, prev_chg_type:0x1)
[ 253.735232] max77693-muic max77693-muic: CONTROL1 : 0x09, CONTROL2 : 0x04, state : attached
[ 254.691877] i2c i2c-15: sendbytes: NAK bailout.
[ 254.692150] sii9234 15-0039: writebm: TPI[0x3d] <- 0x3e
[ 255.984336] sii9234 15-0039: RGND is not 1k
[ 256.068970] sii9234 15-0039: RSEN_HIGH without RGND_1K
[ 256.104457] sii9234 15-0039: discovery failed, no power for MHL?
[ 256.118272] i2c i2c-15: sendbytes: NAK bailout.
[ 256.118539] sii9234 15-0039: writebm: TPI[0x3d] <- 0x3e
[ 256.375966] sii9234 15-0039: RSEN_HIGH without RGND_1K
[ 256.411561] sii9234 15-0039: discovery failed, no power for MHL?
while when it works:
[ 175.348307] max77693-muic max77693-muic: external connector is detached(chg_type:0x1, prev_chg_type:0x0)
[ 175.349576] max77693-muic max77693-muic: CONTROL1 : 0x00, CONTROL2 : 0x01, state : detached
[ 179.304373] dwc2 12480000.usb: new device is full-speed
[ 179.305920] max77693-muic max77693-muic: external connector is detached(chg_type:0x0, prev_chg_type:0x0)
[ 180.205735] max77693-muic max77693-muic: external connector is attached(chg_type:0x1, prev_chg_type:0x1)
[ 180.207211] max77693-muic max77693-muic: CONTROL1 : 0x09, CONTROL2 : 0x04, state : attached
[ 180.309727] i2c i2c-15: sendbytes: NAK bailout.
[ 180.309996] sii9234 15-0039: writebm: TPI[0x3d] <- 0x3e
Not sure if issue here is in muic driver or sii9234 driver.
OTG still does not seem to work, the muic driver detects (only) a
detach when OTG cable is attached:
max77693-muic max77693-muic: external connector is detached(chg_type:0x0, prev_chg_type:0x0)
Same happened when otg cable was attached before these hsotg changes
as well. I suppose issue here is with max77693-muic driver.
Best regards,
Henrik Grimler
> ---
>
> Changes in v2:
> 1. Put connector node in the muic node (Henrik)
>
> Not tested on hardware. Please kindly check if peripheral mode is not
> broken. Or maybe OTG started to work?
> ---
> .../boot/dts/samsung/exynos4412-midas.dtsi | 50 ++++++++++++++++++-
> 1 file changed, 49 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/boot/dts/samsung/exynos4412-midas.dtsi b/arch/arm/boot/dts/samsung/exynos4412-midas.dtsi
> index 57836d5554d0..7daf25865551 100644
> --- a/arch/arm/boot/dts/samsung/exynos4412-midas.dtsi
> +++ b/arch/arm/boot/dts/samsung/exynos4412-midas.dtsi
> @@ -182,6 +182,38 @@ pmic@66 {
> pinctrl-0 = <&max77693_irq>;
> reg = <0x66>;
>
> + muic {
> + compatible = "maxim,max77693-muic";
> +
> + connector {
> + compatible = "samsung,usb-connector-11pin",
> + "usb-b-connector";
> + label = "micro-USB";
> + type = "micro";
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> +
> + muic_to_usb: endpoint {
> + remote-endpoint = <&usb_to_muic>;
> + };
> + };
> +
> + port@3 {
> + reg = <3>;
> +
> + muic_to_mhl: endpoint {
> + remote-endpoint = <&mhl_to_muic>;
> + };
> + };
> + };
> + };
> + };
> +
> regulators {
> esafeout1_reg: ESAFEOUT1 {
> regulator-name = "ESAFEOUT1";
> @@ -287,6 +319,14 @@ mhl_to_hdmi: endpoint {
> remote-endpoint = <&hdmi_to_mhl>;
> };
> };
> +
> + port@1 {
> + reg = <1>;
> +
> + mhl_to_muic: endpoint {
> + remote-endpoint = <&muic_to_mhl>;
> + };
> + };
> };
> };
> };
> @@ -545,8 +585,16 @@ hdmi_to_mhl: endpoint {
> &hsotg {
> vusb_d-supply = <&ldo15_reg>;
> vusb_a-supply = <&ldo12_reg>;
> - dr_mode = "peripheral";
> + dr_mode = "otg";
> + role-switch-default-mode = "peripheral";
> + usb-role-switch;
> status = "okay";
> +
> + port {
> + usb_to_muic: endpoint {
> + remote-endpoint = <&muic_to_usb>;
> + };
> + };
> };
>
> &i2c_0 {
> --
> 2.34.1
>
On 25/07/2023 21:15, Henrik Grimler wrote:
> On Sun, Jul 23, 2023 at 04:24:17PM +0200, Krzysztof Kozlowski wrote:
>> Add full description of USB-MUIC (MAX77693 MUIC) and MUIC-MHL
>> connections, along with proper USB connector and OTG mode for DWC2 USB
>> controller.
>>
>> This fixes dtc W=1 warnings:
>>
>> Warning (graph_child_address): /i2c-mhl/hdmi-bridge@39/ports: graph node has single child node 'port@0', #address-cells/#size-cells are not necessary
>>
>> Cc: Marek Szyprowski <[email protected]>
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: ~postmarketos/[email protected]
>> Cc: Martin Jücker <[email protected]>
>> Cc: Henrik Grimler <[email protected]>
>> Cc: Artur Weber <[email protected]>
>> Signed-off-by: Krzysztof Kozlowski <[email protected]>
>
> Tested-by: Henrik Grimler <[email protected]>
>
> * Peripheral mode (still) works
> * MHL somewhat works
> * OTG (still) does not work
>
> Further details for those interested:
>
> MHL works reliably if cable is attached before boot, but if cable is
> attached on already running device it sometimes work after detaching
> and attaching cable a few times. On cable attach, when it does not
> work, we get:
>
> [ 252.831734] max77693-muic max77693-muic: external connector is detached(chg_type:0x0, prev_chg_type:0x0)
> [ 253.733916] max77693-muic max77693-muic: external connector is attached(chg_type:0x1, prev_chg_type:0x1)
> [ 253.735232] max77693-muic max77693-muic: CONTROL1 : 0x09, CONTROL2 : 0x04, state : attached
> [ 254.691877] i2c i2c-15: sendbytes: NAK bailout.
> [ 254.692150] sii9234 15-0039: writebm: TPI[0x3d] <- 0x3e
> [ 255.984336] sii9234 15-0039: RGND is not 1k
> [ 256.068970] sii9234 15-0039: RSEN_HIGH without RGND_1K
> [ 256.104457] sii9234 15-0039: discovery failed, no power for MHL?
> [ 256.118272] i2c i2c-15: sendbytes: NAK bailout.
> [ 256.118539] sii9234 15-0039: writebm: TPI[0x3d] <- 0x3e
> [ 256.375966] sii9234 15-0039: RSEN_HIGH without RGND_1K
> [ 256.411561] sii9234 15-0039: discovery failed, no power for MHL?
>
> while when it works:
>
> [ 175.348307] max77693-muic max77693-muic: external connector is detached(chg_type:0x1, prev_chg_type:0x0)
> [ 175.349576] max77693-muic max77693-muic: CONTROL1 : 0x00, CONTROL2 : 0x01, state : detached
> [ 179.304373] dwc2 12480000.usb: new device is full-speed
> [ 179.305920] max77693-muic max77693-muic: external connector is detached(chg_type:0x0, prev_chg_type:0x0)
> [ 180.205735] max77693-muic max77693-muic: external connector is attached(chg_type:0x1, prev_chg_type:0x1)
> [ 180.207211] max77693-muic max77693-muic: CONTROL1 : 0x09, CONTROL2 : 0x04, state : attached
> [ 180.309727] i2c i2c-15: sendbytes: NAK bailout.
> [ 180.309996] sii9234 15-0039: writebm: TPI[0x3d] <- 0x3e
>
> Not sure if issue here is in muic driver or sii9234 driver.
>
> OTG still does not seem to work, the muic driver detects (only) a
> detach when OTG cable is attached:
>
> max77693-muic max77693-muic: external connector is detached(chg_type:0x0, prev_chg_type:0x0)
>
> Same happened when otg cable was attached before these hsotg changes
> as well. I suppose issue here is with max77693-muic driver.
>
Thanks for testing. I miss here one important thing - did anything
regressed? Is MHL behaving not worse than before? OTG, as non-working,
matters less in such case.
Best regards,
Krzysztof
Hi Krzysztof,
On Tue, Jul 25, 2023 at 10:08:00PM +0200, Krzysztof Kozlowski wrote:
> On 25/07/2023 21:15, Henrik Grimler wrote:
> > On Sun, Jul 23, 2023 at 04:24:17PM +0200, Krzysztof Kozlowski wrote:
> >> Add full description of USB-MUIC (MAX77693 MUIC) and MUIC-MHL
> >> connections, along with proper USB connector and OTG mode for DWC2 USB
> >> controller.
> >>
> >> This fixes dtc W=1 warnings:
> >>
> >> Warning (graph_child_address): /i2c-mhl/hdmi-bridge@39/ports: graph node has single child node 'port@0', #address-cells/#size-cells are not necessary
> >>
> >> Cc: Marek Szyprowski <[email protected]>
> >> Cc: [email protected]
> >> Cc: [email protected]
> >> Cc: ~postmarketos/[email protected]
> >> Cc: Martin J?cker <[email protected]>
> >> Cc: Henrik Grimler <[email protected]>
> >> Cc: Artur Weber <[email protected]>
> >> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> >
> > Tested-by: Henrik Grimler <[email protected]>
> >
> > * Peripheral mode (still) works
> > * MHL somewhat works
> > * OTG (still) does not work
> >
> > Further details for those interested:
> >
> > MHL works reliably if cable is attached before boot, but if cable is
> > attached on already running device it sometimes work after detaching
> > and attaching cable a few times. On cable attach, when it does not
> > work, we get:
> >
> > [ 252.831734] max77693-muic max77693-muic: external connector is detached(chg_type:0x0, prev_chg_type:0x0)
> > [ 253.733916] max77693-muic max77693-muic: external connector is attached(chg_type:0x1, prev_chg_type:0x1)
> > [ 253.735232] max77693-muic max77693-muic: CONTROL1 : 0x09, CONTROL2 : 0x04, state : attached
> > [ 254.691877] i2c i2c-15: sendbytes: NAK bailout.
> > [ 254.692150] sii9234 15-0039: writebm: TPI[0x3d] <- 0x3e
> > [ 255.984336] sii9234 15-0039: RGND is not 1k
> > [ 256.068970] sii9234 15-0039: RSEN_HIGH without RGND_1K
> > [ 256.104457] sii9234 15-0039: discovery failed, no power for MHL?
> > [ 256.118272] i2c i2c-15: sendbytes: NAK bailout.
> > [ 256.118539] sii9234 15-0039: writebm: TPI[0x3d] <- 0x3e
> > [ 256.375966] sii9234 15-0039: RSEN_HIGH without RGND_1K
> > [ 256.411561] sii9234 15-0039: discovery failed, no power for MHL?
> >
> > while when it works:
> >
> > [ 175.348307] max77693-muic max77693-muic: external connector is detached(chg_type:0x1, prev_chg_type:0x0)
> > [ 175.349576] max77693-muic max77693-muic: CONTROL1 : 0x00, CONTROL2 : 0x01, state : detached
> > [ 179.304373] dwc2 12480000.usb: new device is full-speed
> > [ 179.305920] max77693-muic max77693-muic: external connector is detached(chg_type:0x0, prev_chg_type:0x0)
> > [ 180.205735] max77693-muic max77693-muic: external connector is attached(chg_type:0x1, prev_chg_type:0x1)
> > [ 180.207211] max77693-muic max77693-muic: CONTROL1 : 0x09, CONTROL2 : 0x04, state : attached
> > [ 180.309727] i2c i2c-15: sendbytes: NAK bailout.
> > [ 180.309996] sii9234 15-0039: writebm: TPI[0x3d] <- 0x3e
> >
> > Not sure if issue here is in muic driver or sii9234 driver.
> >
> > OTG still does not seem to work, the muic driver detects (only) a
> > detach when OTG cable is attached:
> >
> > max77693-muic max77693-muic: external connector is detached(chg_type:0x0, prev_chg_type:0x0)
> >
> > Same happened when otg cable was attached before these hsotg changes
> > as well. I suppose issue here is with max77693-muic driver.
> >
>
> Thanks for testing. I miss here one important thing - did anything
> regressed? Is MHL behaving not worse than before? OTG, as non-working,
> matters less in such case.
No regressions as far as I can tell, only improvements. We want the
muic node and mhl_to_muic/muic_to_mhl ports so that muic can notify
the mhl chip of cable attachment/detachment (with requires an
additional patch to the sii9234 driver that I will send soon [1]).
The alternative, having the mhl chip always on, has caused issues with
some GUIs [2].
> Best regards,
> Krzysztof
[1] https://gitlab.com/exynos4-mainline/linux/-/commit/742d05797799
[2] https://gitlab.gnome.org/World/Phosh/phosh/-/issues/828#note_1542189
Best regards,
Henrik Grimler
On 25/07/2023 23:22, Henrik Grimler wrote:
>>> MHL works reliably if cable is attached before boot, but if cable is
>>> attached on already running device it sometimes work after detaching
>>> and attaching cable a few times. On cable attach, when it does not
>>> work, we get:
>>>
>>> [ 252.831734] max77693-muic max77693-muic: external connector is detached(chg_type:0x0, prev_chg_type:0x0)
>>> [ 253.733916] max77693-muic max77693-muic: external connector is attached(chg_type:0x1, prev_chg_type:0x1)
>>> [ 253.735232] max77693-muic max77693-muic: CONTROL1 : 0x09, CONTROL2 : 0x04, state : attached
>>> [ 254.691877] i2c i2c-15: sendbytes: NAK bailout.
>>> [ 254.692150] sii9234 15-0039: writebm: TPI[0x3d] <- 0x3e
>>> [ 255.984336] sii9234 15-0039: RGND is not 1k
>>> [ 256.068970] sii9234 15-0039: RSEN_HIGH without RGND_1K
>>> [ 256.104457] sii9234 15-0039: discovery failed, no power for MHL?
>>> [ 256.118272] i2c i2c-15: sendbytes: NAK bailout.
>>> [ 256.118539] sii9234 15-0039: writebm: TPI[0x3d] <- 0x3e
>>> [ 256.375966] sii9234 15-0039: RSEN_HIGH without RGND_1K
>>> [ 256.411561] sii9234 15-0039: discovery failed, no power for MHL?
>>>
>>> while when it works:
>>>
>>> [ 175.348307] max77693-muic max77693-muic: external connector is detached(chg_type:0x1, prev_chg_type:0x0)
>>> [ 175.349576] max77693-muic max77693-muic: CONTROL1 : 0x00, CONTROL2 : 0x01, state : detached
>>> [ 179.304373] dwc2 12480000.usb: new device is full-speed
>>> [ 179.305920] max77693-muic max77693-muic: external connector is detached(chg_type:0x0, prev_chg_type:0x0)
>>> [ 180.205735] max77693-muic max77693-muic: external connector is attached(chg_type:0x1, prev_chg_type:0x1)
>>> [ 180.207211] max77693-muic max77693-muic: CONTROL1 : 0x09, CONTROL2 : 0x04, state : attached
>>> [ 180.309727] i2c i2c-15: sendbytes: NAK bailout.
>>> [ 180.309996] sii9234 15-0039: writebm: TPI[0x3d] <- 0x3e
>>>
>>> Not sure if issue here is in muic driver or sii9234 driver.
>>>
>>> OTG still does not seem to work, the muic driver detects (only) a
>>> detach when OTG cable is attached:
>>>
>>> max77693-muic max77693-muic: external connector is detached(chg_type:0x0, prev_chg_type:0x0)
>>>
>>> Same happened when otg cable was attached before these hsotg changes
>>> as well. I suppose issue here is with max77693-muic driver.
>>>
>>
>> Thanks for testing. I miss here one important thing - did anything
>> regressed? Is MHL behaving not worse than before? OTG, as non-working,
>> matters less in such case.
>
> No regressions as far as I can tell, only improvements. We want the
> muic node and mhl_to_muic/muic_to_mhl ports so that muic can notify
> the mhl chip of cable attachment/detachment (with requires an
> additional patch to the sii9234 driver that I will send soon [1]).
> The alternative, having the mhl chip always on, has caused issues with
> some GUIs [2].
Awesome, thank you!
Best regards,
Krzysztof
On Sun, 23 Jul 2023 16:24:17 +0200, Krzysztof Kozlowski wrote:
> Add full description of USB-MUIC (MAX77693 MUIC) and MUIC-MHL
> connections, along with proper USB connector and OTG mode for DWC2 USB
> controller.
>
> This fixes dtc W=1 warnings:
>
> Warning (graph_child_address): /i2c-mhl/hdmi-bridge@39/ports: graph node has single child node 'port@0', #address-cells/#size-cells are not necessary
>
> [...]
Applied, thanks!
[1/1] ARM: dts: samsung: exynos4412-midas: add USB connector and USB OTG
https://git.kernel.org/krzk/linux/c/57f706bf73079379a9e9f5490c94c2473077bb2e
Best regards,
--
Krzysztof Kozlowski <[email protected]>