From 2d9af317bd0f3c94ab6efb0f6c4123c3476b7dbd Mon Sep 17 00:00:00 2001 From: Dan Johansen Date: Wed, 20 Apr 2022 09:54:15 +0200 Subject: [PATCH 1/2] Drop the dp alt mode patches Drop the patches that enable the sometimes working, but mostly broken DP Altmode on the Pinebook Pro and RockPro64 devices. Signed-off-by: Dan Johansen --- ...399-pinebook-pro-Fix-USB-PD-charging.patch | 29 -- ...-pinebook-pro-Improve-Type-C-support.patch | 144 ------- ...-pinebook-pro-Remove-redundant-pinct.patch | 29 -- ...-pinebook-pro-Don-t-allow-usb2-phy-d.patch | 26 -- ...-cdn-dp-Disable-CDN-DP-on-disconnect.patch | 27 -- ...2-Set-the-current-before-enabling-pu.patch | 51 --- ...2-Update-VBUS-state-even-if-VBUS-int.patch | 43 -- ...-typec-fusb302-Add-OF-extcon-support.patch | 38 -- ...pec-fusb302-Fix-register-definitions.patch | 49 --- ...2-Clear-interrupts-before-we-start-t.patch | 41 -- ...extcon-Add-typec-extcon-bridge-drive.patch | 392 ------------------ ...ec-Make-sure-the-plug-orientation-is.patch | 68 --- ...o-usb2-More-robust-charger-detection.patch | 114 ----- ...extcon-Don-t-touch-charger-proprties.patch | 32 -- PKGBUILD | 40 +- 15 files changed, 3 insertions(+), 1120 deletions(-) delete mode 100644 3170-arm64-dts-rk3399-pinebook-pro-Fix-USB-PD-charging.patch delete mode 100644 3172-arm64-dts-rk3399-pinebook-pro-Improve-Type-C-support.patch delete mode 100644 3174-arm64-dts-rk3399-pinebook-pro-Remove-redundant-pinct.patch delete mode 100644 3178-arm64-dts-rk3399-pinebook-pro-Don-t-allow-usb2-phy-d.patch delete mode 100644 3339-drm-rockchip-cdn-dp-Disable-CDN-DP-on-disconnect.patch delete mode 100644 3355-usb-typec-fusb302-Set-the-current-before-enabling-pu.patch delete mode 100644 3359-usb-typec-fusb302-Update-VBUS-state-even-if-VBUS-int.patch delete mode 100644 3361-usb-typec-fusb302-Add-OF-extcon-support.patch delete mode 100644 3362-usb-typec-fusb302-Fix-register-definitions.patch delete mode 100644 3363-usb-typec-fusb302-Clear-interrupts-before-we-start-t.patch delete mode 100644 3364-usb-typec-typec-extcon-Add-typec-extcon-bridge-drive.patch delete mode 100644 3365-phy-rockchip-typec-Make-sure-the-plug-orientation-is.patch delete mode 100644 3372-phy-rockchip-inno-usb2-More-robust-charger-detection.patch delete mode 100644 3373-usb-typec-extcon-Don-t-touch-charger-proprties.patch diff --git a/3170-arm64-dts-rk3399-pinebook-pro-Fix-USB-PD-charging.patch b/3170-arm64-dts-rk3399-pinebook-pro-Fix-USB-PD-charging.patch deleted file mode 100644 index 7a9ce96..0000000 --- a/3170-arm64-dts-rk3399-pinebook-pro-Fix-USB-PD-charging.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 24170d9ce27b0afcc6c21ed153d09b31306779b2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= -Date: Wed, 2 Dec 2020 12:09:45 +0100 -Subject: [PATCH 170/437] arm64: dts: rk3399-pinebook-pro: Fix USB-PD charging - -Signed-off-by: Ondrej Jirman ---- - arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -index c2f021a1a18f0..d7fe1d99b546d 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -@@ -713,9 +713,9 @@ - op-sink-microwatt = <1000000>; - power-role = "dual"; - sink-pdos = -- ; -+ ; - source-pdos = -- ; -+ ; - try-power-role = "sink"; - - ports { --- -2.35.1 - diff --git a/3172-arm64-dts-rk3399-pinebook-pro-Improve-Type-C-support.patch b/3172-arm64-dts-rk3399-pinebook-pro-Improve-Type-C-support.patch deleted file mode 100644 index 6ff8447..0000000 --- a/3172-arm64-dts-rk3399-pinebook-pro-Improve-Type-C-support.patch +++ /dev/null @@ -1,144 +0,0 @@ -From a7c0e582bb9df2320a458bbb70c7b3991df1682d Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= -Date: Sun, 14 Nov 2021 01:16:51 +0100 -Subject: [PATCH 172/437] arm64: dts: rk3399-pinebook-pro: Improve Type-C - support on Pinebook Pro - -This is using the same extcon bridge developed by me for Pinephone Pro. - -Signed-off-by: Ondrej Jirman ---- - .../boot/dts/rockchip/rk3399-pinebook-pro.dts | 51 +++++++++++++++++-- - 1 file changed, 46 insertions(+), 5 deletions(-) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -index d7fe1d99b546d..ae175ee3f4c37 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -@@ -345,7 +345,7 @@ - - /* Regulators supplied by vcc5v0_usb */ - /* Type C port power supply regulator */ -- vbus_5vout: vbus_typec: vbus-5vout { -+ vbus_5vout: vbus-5vout { - compatible = "regulator-fixed"; - enable-active-high; - gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>; -@@ -384,6 +384,14 @@ - pinctrl-names = "default"; - pinctrl-0 = <&dc_det_pin>; - }; -+ -+ typec_extcon_bridge: typec-extcon { -+ compatible = "linux,typec-extcon-bridge"; -+ usb-role-switch; -+ orientation-switch; -+ mode-switch; -+ svid = /bits/ 16 <0xff01>; -+ }; - }; - - &cpu_b0 { -@@ -410,6 +418,12 @@ - cpu-supply = <&vdd_cpu_l>; - }; - -+&cdn_dp { -+ status = "okay"; -+ extcon = <&typec_extcon_bridge>; -+ phys = <&tcphy0_dp>; -+}; -+ - &edp { - force-hpd; - pinctrl-names = "default"; -@@ -704,7 +718,9 @@ - interrupts = ; - pinctrl-names = "default"; - pinctrl-0 = <&fusb0_int_pin>; -- vbus-supply = <&vbus_typec>; -+ vbus-supply = <&vbus_5vout>; -+ usb-role-switch = <&typec_extcon_bridge>; -+ extcon = <&typec_extcon_bridge>; - - connector { - compatible = "usb-c-connector"; -@@ -717,6 +733,15 @@ - source-pdos = - ; - try-power-role = "sink"; -+ mode-switch = <&typec_extcon_bridge>; -+ orientation-switch = <&typec_extcon_bridge>; -+ -+ altmodes { -+ dp { -+ svid = <0xff01>; -+ vdo = <0x0c0046>; -+ }; -+ }; - - ports { - #address-cells = <1>; -@@ -984,6 +1009,7 @@ - }; - - &tcphy0 { -+ extcon = <&typec_extcon_bridge>; - status = "okay"; - }; - -@@ -1017,13 +1043,20 @@ - - &u2phy0 { - status = "okay"; -+ extcon = <&typec_extcon_bridge>; - - u2phy0_otg: otg-port { -+ /* -+ * Type-C port on the left side of the chasis. -+ */ - status = "okay"; - }; - - u2phy0_host: host-port { -- phy-supply = <&vcc5v0_otg>; -+ /* -+ * USB 2.0 host port for the keyboard (internally connected). -+ */ -+ phy-supply = <&vcc5v0_usb>; - status = "okay"; - }; - -@@ -1038,11 +1071,18 @@ - status = "okay"; - - u2phy1_otg: otg-port { -+ /* -+ * USB 3.0 A port on the left side of the chasis. -+ */ - status = "okay"; - }; - - u2phy1_host: host-port { -- phy-supply = <&vcc5v0_otg>; -+ /* -+ * To the HUB that has USB camera and USB 2.0 port on the right -+ * side of the chasis. -+ */ -+ phy-supply = <&vcc5v0_usb>; - status = "okay"; - }; - }; -@@ -1093,7 +1133,8 @@ - }; - - &usbdrd_dwc3_0 { -- dr_mode = "host"; -+ dr_mode = "otg"; -+ extcon = <&typec_extcon_bridge>; - status = "okay"; - }; - --- -2.35.1 - diff --git a/3174-arm64-dts-rk3399-pinebook-pro-Remove-redundant-pinct.patch b/3174-arm64-dts-rk3399-pinebook-pro-Remove-redundant-pinct.patch deleted file mode 100644 index e746e87..0000000 --- a/3174-arm64-dts-rk3399-pinebook-pro-Remove-redundant-pinct.patch +++ /dev/null @@ -1,29 +0,0 @@ -From b8e18413d06d105c82422e348194f2173953a7ec Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= -Date: Sun, 21 Nov 2021 17:01:48 +0100 -Subject: [PATCH 174/437] arm64: dts: rk3399-pinebook-pro: Remove redundant - pinctrl-* properties from edp - -These are already present in rk3399.dtsi. - -Signed-off-by: Ondrej Jirman ---- - arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -index ae175ee3f4c37..8ab78192a63a4 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -@@ -426,8 +426,6 @@ - - &edp { - force-hpd; -- pinctrl-names = "default"; -- pinctrl-0 = <&edp_hpd>; - status = "okay"; - - ports { --- -2.35.1 - diff --git a/3178-arm64-dts-rk3399-pinebook-pro-Don-t-allow-usb2-phy-d.patch b/3178-arm64-dts-rk3399-pinebook-pro-Don-t-allow-usb2-phy-d.patch deleted file mode 100644 index 4de0cc3..0000000 --- a/3178-arm64-dts-rk3399-pinebook-pro-Don-t-allow-usb2-phy-d.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 8e55d9c19833d200c961239acb5ae780eb6baa6c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= -Date: Fri, 4 Feb 2022 02:28:57 +0100 -Subject: [PATCH 178/437] arm64: dts: rk3399-pinebook-pro: Don't allow usb2 phy - driver to update USB role - -Signed-off-by: Ondrej Jirman ---- - arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -index 639f6e7ea63d5..3e8610cc01db6 100644 ---- a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts -@@ -1038,6 +1038,7 @@ - &u2phy0 { - status = "okay"; - extcon = <&typec_extcon_bridge>; -+ extcon,ignore-usb; - - u2phy0_otg: otg-port { - /* --- -2.35.1 - diff --git a/3339-drm-rockchip-cdn-dp-Disable-CDN-DP-on-disconnect.patch b/3339-drm-rockchip-cdn-dp-Disable-CDN-DP-on-disconnect.patch deleted file mode 100644 index 16ee1fa..0000000 --- a/3339-drm-rockchip-cdn-dp-Disable-CDN-DP-on-disconnect.patch +++ /dev/null @@ -1,27 +0,0 @@ -From e5a041a965386baba35b912ffe9ca916276790ea Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= -Date: Sat, 20 Nov 2021 14:35:52 +0100 -Subject: [PATCH 339/437] drm: rockchip: cdn-dp: Disable CDN DP on disconnect - -Why not? - -Signed-off-by: Ondrej Jirman ---- - drivers/gpu/drm/rockchip/cdn-dp-core.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c -index 16497c31d9f91..f4dcd9eefa5f8 100644 ---- a/drivers/gpu/drm/rockchip/cdn-dp-core.c -+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c -@@ -934,6 +934,7 @@ static void cdn_dp_pd_event_work(struct work_struct *work) - DRM_DEV_INFO(dp->dev, "Not connected. Disabling cdn\n"); - dp->connected = false; - -+ cdn_dp_disable(dp); - /* Connected but not enabled, enable the block */ - } else if (!dp->active) { - DRM_DEV_INFO(dp->dev, "Connected, not enabled. Enabling cdn\n"); --- -2.35.1 - diff --git a/3355-usb-typec-fusb302-Set-the-current-before-enabling-pu.patch b/3355-usb-typec-fusb302-Set-the-current-before-enabling-pu.patch deleted file mode 100644 index 160242f..0000000 --- a/3355-usb-typec-fusb302-Set-the-current-before-enabling-pu.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 6dc2526b18c77e448db5ceef9b60e366c00257a7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= -Date: Sun, 7 Nov 2021 19:28:27 +0100 -Subject: [PATCH 355/437] usb: typec: fusb302: Set the current before enabling - pullups - -This seems more reasonable and should avoid short period of incorrect -current setting being applied to CC pin. - -Signed-off-by: Ondrej Jirman ---- - drivers/usb/typec/tcpm/fusb302.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c -index 72f9001b07921..776a949ef6e39 100644 ---- a/drivers/usb/typec/tcpm/fusb302.c -+++ b/drivers/usb/typec/tcpm/fusb302.c -@@ -635,6 +635,14 @@ static int tcpm_set_cc(struct tcpc_dev *dev, enum typec_cc_status cc) - goto done; - } - -+ /* adjust current for SRC */ -+ ret = fusb302_set_src_current(chip, cc_src_current[cc]); -+ if (ret < 0) { -+ fusb302_log(chip, "cannot set src current %s, ret=%d", -+ typec_cc_status_name[cc], ret); -+ goto done; -+ } -+ - ret = fusb302_i2c_mask_write(chip, FUSB_REG_SWITCHES0, - switches0_mask, switches0_data); - if (ret < 0) { -@@ -645,14 +653,6 @@ static int tcpm_set_cc(struct tcpc_dev *dev, enum typec_cc_status cc) - chip->cc1 = TYPEC_CC_OPEN; - chip->cc2 = TYPEC_CC_OPEN; - -- /* adjust current for SRC */ -- ret = fusb302_set_src_current(chip, cc_src_current[cc]); -- if (ret < 0) { -- fusb302_log(chip, "cannot set src current %s, ret=%d", -- typec_cc_status_name[cc], ret); -- goto done; -- } -- - /* enable/disable interrupts, BC_LVL for SNK and COMP_CHNG for SRC */ - switch (cc) { - case TYPEC_CC_RP_DEF: --- -2.35.1 - diff --git a/3359-usb-typec-fusb302-Update-VBUS-state-even-if-VBUS-int.patch b/3359-usb-typec-fusb302-Update-VBUS-state-even-if-VBUS-int.patch deleted file mode 100644 index 2c5168d..0000000 --- a/3359-usb-typec-fusb302-Update-VBUS-state-even-if-VBUS-int.patch +++ /dev/null @@ -1,43 +0,0 @@ -From bdf2ab7d218cbd64daa3054d8bd6585c10b34108 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= -Date: Tue, 23 Nov 2021 17:57:06 +0100 -Subject: [PATCH 359/437] usb: typec: fusb302: Update VBUS state even if VBUS - interrupt is not triggered - -This seems to improve robustness. - -Signed-off-by: Ondrej Jirman ---- - drivers/usb/typec/tcpm/fusb302.c | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c -index 70b0e15992af4..1d5affaabcf3e 100644 ---- a/drivers/usb/typec/tcpm/fusb302.c -+++ b/drivers/usb/typec/tcpm/fusb302.c -@@ -1716,14 +1716,16 @@ static void fusb302_irq_work(struct work_struct *work) - - fusb302_print_state(chip); - -- if (interrupt & FUSB_REG_INTERRUPT_VBUSOK) { -- vbus_present = !!(status0 & FUSB_REG_STATUS0_VBUSOK); -+ vbus_present = !!(status0 & FUSB_REG_STATUS0_VBUSOK); -+ if (interrupt & FUSB_REG_INTERRUPT_VBUSOK) - fusb302_log(chip, "IRQ: VBUS_OK, vbus=%s", - vbus_present ? "On" : "Off"); -- if (vbus_present != chip->vbus_present) { -- chip->vbus_present = vbus_present; -- tcpm_vbus_change(chip->tcpm_port); -- } -+ if (vbus_present != chip->vbus_present) { -+ chip->vbus_present = vbus_present; -+ if (!(interrupt & FUSB_REG_INTERRUPT_VBUSOK)) -+ fusb302_log(chip, "IRQ: VBUS changed without interrupt, vbus=%s", -+ vbus_present ? "On" : "Off"); -+ tcpm_vbus_change(chip->tcpm_port); - } - - if (interrupta & FUSB_REG_INTERRUPTA_TOGDONE) { --- -2.35.1 - diff --git a/3361-usb-typec-fusb302-Add-OF-extcon-support.patch b/3361-usb-typec-fusb302-Add-OF-extcon-support.patch deleted file mode 100644 index cd183bc..0000000 --- a/3361-usb-typec-fusb302-Add-OF-extcon-support.patch +++ /dev/null @@ -1,38 +0,0 @@ -From b4cf42d5af462b90ab50b35850876702604d409b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= -Date: Sun, 14 Nov 2021 01:14:25 +0100 -Subject: [PATCH 361/437] usb: typec: fusb302: Add OF extcon support - -It's possible to create a dependency cycle between fusb302 and -other drivers via extcon device, so we retrieve the device on -demand after probe and not during probe. - -Signed-off-by: Ondrej Jirman ---- - drivers/usb/typec/tcpm/fusb302.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c -index ae3b930d774ff..0c5dd0058f5e3 100644 ---- a/drivers/usb/typec/tcpm/fusb302.c -+++ b/drivers/usb/typec/tcpm/fusb302.c -@@ -518,6 +518,16 @@ static int tcpm_get_current_limit(struct tcpc_dev *dev) - int current_limit = 0; - unsigned long timeout; - -+ /* -+ * To avoid cycles in OF dependencies, we get extcon when necessary -+ * outside of probe function. -+ */ -+ if (of_property_read_bool(chip->dev->of_node, "extcon") && !chip->extcon) { -+ chip->extcon = extcon_get_edev_by_phandle(chip->dev, 0); -+ if (IS_ERR(chip->extcon)) -+ chip->extcon = NULL; -+ } -+ - if (!chip->extcon) - return 0; - --- -2.35.1 - diff --git a/3362-usb-typec-fusb302-Fix-register-definitions.patch b/3362-usb-typec-fusb302-Fix-register-definitions.patch deleted file mode 100644 index b3f9e85..0000000 --- a/3362-usb-typec-fusb302-Fix-register-definitions.patch +++ /dev/null @@ -1,49 +0,0 @@ -From f01b75ffe03d3d38b046982e6d7e24371a5575d0 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= -Date: Sat, 20 Nov 2021 14:33:58 +0100 -Subject: [PATCH 362/437] usb: typec: fusb302: Fix register definitions - -MEASURE_VBUS bit is at position 6. MDAC bits are also wrong. - -Signed-off-by: Ondrej Jirman ---- - drivers/usb/typec/tcpm/fusb302_reg.h | 16 +++++++--------- - 1 file changed, 7 insertions(+), 9 deletions(-) - -diff --git a/drivers/usb/typec/tcpm/fusb302_reg.h b/drivers/usb/typec/tcpm/fusb302_reg.h -index edc0e4b0f1e6b..f37d226c5027f 100644 ---- a/drivers/usb/typec/tcpm/fusb302_reg.h -+++ b/drivers/usb/typec/tcpm/fusb302_reg.h -@@ -27,14 +27,13 @@ - #define FUSB_REG_SWITCHES1_TXCC2_EN BIT(1) - #define FUSB_REG_SWITCHES1_TXCC1_EN BIT(0) - #define FUSB_REG_MEASURE 0x04 --#define FUSB_REG_MEASURE_MDAC5 BIT(7) --#define FUSB_REG_MEASURE_MDAC4 BIT(6) --#define FUSB_REG_MEASURE_MDAC3 BIT(5) --#define FUSB_REG_MEASURE_MDAC2 BIT(4) --#define FUSB_REG_MEASURE_MDAC1 BIT(3) --#define FUSB_REG_MEASURE_MDAC0 BIT(2) --#define FUSB_REG_MEASURE_VBUS BIT(1) --#define FUSB_REG_MEASURE_XXXX5 BIT(0) -+#define FUSB_REG_MEASURE_VBUS BIT(6) -+#define FUSB_REG_MEASURE_MDAC5 BIT(5) -+#define FUSB_REG_MEASURE_MDAC4 BIT(4) -+#define FUSB_REG_MEASURE_MDAC3 BIT(3) -+#define FUSB_REG_MEASURE_MDAC2 BIT(2) -+#define FUSB_REG_MEASURE_MDAC1 BIT(1) -+#define FUSB_REG_MEASURE_MDAC0 BIT(0) - #define FUSB_REG_CONTROL0 0x06 - #define FUSB_REG_CONTROL0_TX_FLUSH BIT(6) - #define FUSB_REG_CONTROL0_INT_MASK BIT(5) -@@ -105,7 +104,6 @@ - #define FUSB_REG_STATUS0A_RX_SOFT_RESET BIT(1) - #define FUSB_REG_STATUS0A_RX_HARD_RESET BIT(0) - #define FUSB_REG_STATUS1A 0x3D --#define FUSB_REG_STATUS1A_TOGSS BIT(3) - #define FUSB_REG_STATUS1A_TOGSS_RUNNING 0x0 - #define FUSB_REG_STATUS1A_TOGSS_SRC1 0x1 - #define FUSB_REG_STATUS1A_TOGSS_SRC2 0x2 --- -2.35.1 - diff --git a/3363-usb-typec-fusb302-Clear-interrupts-before-we-start-t.patch b/3363-usb-typec-fusb302-Clear-interrupts-before-we-start-t.patch deleted file mode 100644 index 1f2f213..0000000 --- a/3363-usb-typec-fusb302-Clear-interrupts-before-we-start-t.patch +++ /dev/null @@ -1,41 +0,0 @@ -From ef42a0990496b7afd2ec50ebf94d86820f3a4eef Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= -Date: Sat, 20 Nov 2021 14:35:10 +0100 -Subject: [PATCH 363/437] usb: typec: fusb302: Clear interrupts before we start - toggling - -This is recommended by the datasheet. - -Signed-off-by: Ondrej Jirman ---- - drivers/usb/typec/tcpm/fusb302.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c -index 0c5dd0058f5e3..011dce5e73a25 100644 ---- a/drivers/usb/typec/tcpm/fusb302.c -+++ b/drivers/usb/typec/tcpm/fusb302.c -@@ -586,6 +586,7 @@ static int fusb302_set_toggling(struct fusb302_chip *chip, - enum toggling_mode mode) - { - int ret = 0; -+ u8 reg; - - /* first disable toggling */ - ret = fusb302_i2c_clear_bits(chip, FUSB_REG_CONTROL2, -@@ -644,6 +645,12 @@ static int fusb302_set_toggling(struct fusb302_chip *chip, - } else { - /* Datasheet says vconn MUST be off when toggling */ - WARN(chip->vconn_on, "Vconn is on during toggle start"); -+ -+ /* clear interrupts */ -+ ret = fusb302_i2c_read(chip, FUSB_REG_INTERRUPT, ®); -+ if (ret < 0) -+ return ret; -+ - /* unmask TOGDONE interrupt */ - ret = fusb302_i2c_clear_bits(chip, FUSB_REG_MASKA, - FUSB_REG_MASKA_TOGDONE); --- -2.35.1 - diff --git a/3364-usb-typec-typec-extcon-Add-typec-extcon-bridge-drive.patch b/3364-usb-typec-typec-extcon-Add-typec-extcon-bridge-drive.patch deleted file mode 100644 index 7ea18ea..0000000 --- a/3364-usb-typec-typec-extcon-Add-typec-extcon-bridge-drive.patch +++ /dev/null @@ -1,392 +0,0 @@ -From eb13dbd9abb43f304c4dac94ff4696fc5c6a340c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= -Date: Sun, 7 Nov 2021 19:24:40 +0100 -Subject: [PATCH 364/437] usb: typec: typec-extcon: Add typec -> extcon bridge - driver - -This bridge connects standard Type C port interfaces for controling -muxes, switches and usb roles to muxes, switches and usb role -drivers controlled via extcon interface. - -Signed-off-by: Ondrej Jirman ---- - drivers/usb/typec/Kconfig | 7 + - drivers/usb/typec/Makefile | 1 + - drivers/usb/typec/typec-extcon.c | 337 +++++++++++++++++++++++++++++++ - 3 files changed, 345 insertions(+) - create mode 100644 drivers/usb/typec/typec-extcon.c - -diff --git a/drivers/usb/typec/Kconfig b/drivers/usb/typec/Kconfig -index ab480f38523aa..01ecc5e590f1d 100644 ---- a/drivers/usb/typec/Kconfig -+++ b/drivers/usb/typec/Kconfig -@@ -88,6 +88,13 @@ config TYPEC_QCOM_PMIC - It will also enable the VBUS output to connected devices when a - DFP connection is made. - -+config TYPEC_EXTCON -+ tristate "Type-C switch/mux -> extcon interface bridge driver" -+ depends on USB_ROLE_SWITCH -+ help -+ Say Y or M here if your system needs bridging between typec class -+ and extcon interfaces. -+ - source "drivers/usb/typec/mux/Kconfig" - - source "drivers/usb/typec/altmodes/Kconfig" -diff --git a/drivers/usb/typec/Makefile b/drivers/usb/typec/Makefile -index 57870a2bd7873..23c812e117d99 100644 ---- a/drivers/usb/typec/Makefile -+++ b/drivers/usb/typec/Makefile -@@ -9,4 +9,5 @@ obj-$(CONFIG_TYPEC_TPS6598X) += tipd/ - obj-$(CONFIG_TYPEC_HD3SS3220) += hd3ss3220.o - obj-$(CONFIG_TYPEC_QCOM_PMIC) += qcom-pmic-typec.o - obj-$(CONFIG_TYPEC_STUSB160X) += stusb160x.o -+obj-$(CONFIG_TYPEC_EXTCON) += typec-extcon.o - obj-$(CONFIG_TYPEC) += mux/ -diff --git a/drivers/usb/typec/typec-extcon.c b/drivers/usb/typec/typec-extcon.c -new file mode 100644 -index 0000000000000..f1fe5e57fdfc9 ---- /dev/null -+++ b/drivers/usb/typec/typec-extcon.c -@@ -0,0 +1,337 @@ -+/* -+ * typec -> extcon bridge -+ * Copyright (c) 2021 OndÅ™ej Jirman -+ * -+ * This driver bridges standard type-c interfaces to drivers that -+ * expect extcon interface. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+struct typec_extcon { -+ struct device *dev; -+ -+ /* consumers */ -+ struct usb_role_switch *role_sw; -+ struct typec_switch *sw; -+ struct typec_mux *mux; -+ -+ /* providers */ -+ struct extcon_dev *extcon; -+ struct notifier_block extcon_nb; -+ -+ /* cached state from typec controller */ -+ enum usb_role role; -+ enum typec_orientation orientation; -+ struct typec_altmode alt; -+ unsigned long mode; -+ bool has_alt; -+ struct mutex lock; -+}; -+ -+static const unsigned int typec_extcon_cable[] = { -+ EXTCON_DISP_DP, -+ -+ EXTCON_USB, -+ EXTCON_USB_HOST, -+ -+ EXTCON_CHG_USB_SDP, -+ EXTCON_CHG_USB_CDP, -+ EXTCON_CHG_USB_DCP, -+ EXTCON_CHG_USB_ACA, -+ -+ EXTCON_NONE, -+}; -+ -+static void typec_extcon_set_cable(struct typec_extcon *tce, int id, bool on, -+ union extcon_property_value prop_ss, -+ union extcon_property_value prop_or) -+{ -+ union extcon_property_value cur_ss, cur_or; -+ bool prop_diff = false; -+ int ret; -+ -+ ret = extcon_get_property(tce->extcon, id, -+ EXTCON_PROP_USB_SS, &cur_ss); -+ if (ret || cur_ss.intval != prop_ss.intval) -+ prop_diff = true; -+ -+ ret = extcon_get_property(tce->extcon, id, -+ EXTCON_PROP_USB_TYPEC_POLARITY, &cur_or); -+ if (ret || cur_or.intval != prop_or.intval) -+ prop_diff = true; -+ -+ if (!on && extcon_get_state(tce->extcon, id)) { -+ extcon_set_state_sync(tce->extcon, id, false); -+ } else if (on && (!extcon_get_state(tce->extcon, id) || prop_diff)) { -+ extcon_set_state(tce->extcon, id, true); -+ extcon_set_property(tce->extcon, id, -+ EXTCON_PROP_USB_SS, prop_ss); -+ extcon_set_property(tce->extcon, id, -+ EXTCON_PROP_USB_TYPEC_POLARITY, prop_or); -+ extcon_sync(tce->extcon, id); -+ } -+} -+ -+static int typec_extcon_sync_extcon(struct typec_extcon *tce) -+{ -+ union extcon_property_value prop_ss, prop_or; -+ bool has_dp = false; -+ -+ mutex_lock(&tce->lock); -+ -+ /* connector is disconnected */ -+ if (tce->orientation == TYPEC_ORIENTATION_NONE) { -+ typec_extcon_set_cable(tce, EXTCON_USB, false, prop_ss, prop_or); -+ typec_extcon_set_cable(tce, EXTCON_USB_HOST, false, prop_ss, prop_or); -+ typec_extcon_set_cable(tce, EXTCON_DISP_DP, false, prop_ss, prop_or); -+ -+ extcon_set_state_sync(tce->extcon, EXTCON_CHG_USB_SDP, false); -+ extcon_set_state_sync(tce->extcon, EXTCON_CHG_USB_DCP, false); -+ extcon_set_state_sync(tce->extcon, EXTCON_CHG_USB_CDP, false); -+ extcon_set_state_sync(tce->extcon, EXTCON_CHG_USB_ACA, false); -+ -+ goto out_unlock; -+ } -+ -+ prop_or.intval = tce->orientation == TYPEC_ORIENTATION_NORMAL ? 0 : 1; -+ prop_ss.intval = 0; -+ -+ if (tce->has_alt && tce->alt.svid == USB_TYPEC_DP_SID) { -+ switch (tce->mode) { -+ case TYPEC_STATE_SAFE: -+ break; -+ case TYPEC_DP_STATE_C: -+ case TYPEC_DP_STATE_E: -+ has_dp = true; -+ break; -+ case TYPEC_DP_STATE_D: -+ has_dp = true; -+ fallthrough; -+ case TYPEC_STATE_USB: -+ prop_ss.intval = 1; -+ break; -+ default: -+ dev_err(tce->dev, "unhandled mux mode=%lu\n", tce->mode); -+ break; -+ } -+ } -+ -+ typec_extcon_set_cable(tce, EXTCON_USB, -+ tce->role == USB_ROLE_DEVICE, prop_ss, prop_or); -+ typec_extcon_set_cable(tce, EXTCON_USB_HOST, -+ tce->role == USB_ROLE_HOST, prop_ss, prop_or); -+ -+ typec_extcon_set_cable(tce, EXTCON_DISP_DP, has_dp, prop_ss, prop_or); -+ -+out_unlock: -+ mutex_unlock(&tce->lock); -+ return 0; -+} -+ -+static int typec_extcon_sw_set(struct typec_switch *sw, -+ enum typec_orientation orientation) -+{ -+ struct typec_extcon *tce = typec_switch_get_drvdata(sw); -+ -+ dev_dbg(tce->dev, "SW SET: orientation=%d\n", orientation); -+ -+ mutex_lock(&tce->lock); -+ tce->orientation = orientation; -+ mutex_unlock(&tce->lock); -+ -+ typec_extcon_sync_extcon(tce); -+ -+ return 0; -+} -+ -+static int typec_extcon_mux_set(struct typec_mux *mux, -+ struct typec_mux_state *state) -+{ -+ struct typec_extcon *tce = typec_mux_get_drvdata(mux); -+ struct typec_altmode *alt = state->alt; -+ -+ dev_dbg(tce->dev, "MUX SET: state->mode=%lu\n", state->mode); -+ if (alt) -+ dev_dbg(tce->dev, " ...alt: svid=%04hx mode=%d vdo=%08x active=%u\n", -+ alt->svid, alt->mode, alt->vdo, alt->active); -+ -+ mutex_lock(&tce->lock); -+ tce->mode = state->mode; -+ tce->has_alt = alt != NULL; -+ if (alt) -+ tce->alt = *alt; -+ mutex_unlock(&tce->lock); -+ -+ typec_extcon_sync_extcon(tce); -+ -+ return 0; -+} -+ -+static int typec_extcon_usb_set_role(struct usb_role_switch *sw, -+ enum usb_role role) -+{ -+ struct typec_extcon *tce = usb_role_switch_get_drvdata(sw); -+ -+ dev_dbg(tce->dev, "ROLE SET: role=%d\n", role); -+ -+ mutex_lock(&tce->lock); -+ tce->role = role; -+ mutex_unlock(&tce->lock); -+ -+ typec_extcon_sync_extcon(tce); -+ -+ return 0; -+} -+ -+static int typec_extcon_notifier(struct notifier_block *nb, -+ unsigned long action, void *data) -+{ -+ struct typec_extcon *tce = container_of(nb, struct typec_extcon, extcon_nb); -+ -+ bool sdp = extcon_get_state(tce->extcon, EXTCON_CHG_USB_SDP); -+ bool cdp = extcon_get_state(tce->extcon, EXTCON_CHG_USB_CDP); -+ bool dcp = extcon_get_state(tce->extcon, EXTCON_CHG_USB_DCP); -+ bool usb = extcon_get_state(tce->extcon, EXTCON_USB); -+ bool usb_host = extcon_get_state(tce->extcon, EXTCON_USB_HOST); -+ bool dp = extcon_get_state(tce->extcon, EXTCON_DISP_DP); -+ -+ dev_info(tce->dev, "extcon changed sdp=%d cdp=%d dcp=%d usb=%d usb_host=%d dp=%d\n", -+ sdp, cdp, dcp, usb, usb_host, dp); -+ -+ return NOTIFY_OK; -+} -+ -+static int typec_extcon_probe(struct platform_device *pdev) -+{ -+ struct typec_switch_desc sw_desc = { }; -+ struct typec_mux_desc mux_desc = { }; -+ struct usb_role_switch_desc role_desc = { }; -+ struct device *dev = &pdev->dev; -+ struct typec_extcon *tce; -+ int ret = 0; -+ -+ tce = devm_kzalloc(dev, sizeof(*tce), GFP_KERNEL); -+ if (!tce) -+ return -ENOMEM; -+ -+ tce->dev = &pdev->dev; -+ mutex_init(&tce->lock); -+ tce->mode = TYPEC_STATE_SAFE; -+ -+ sw_desc.drvdata = tce; -+ sw_desc.fwnode = dev->fwnode; -+ sw_desc.set = typec_extcon_sw_set; -+ -+ tce->sw = typec_switch_register(dev, &sw_desc); -+ if (IS_ERR(tce->sw)) -+ return dev_err_probe(dev, PTR_ERR(tce->sw), -+ "Error registering typec switch\n"); -+ -+ mux_desc.drvdata = tce; -+ mux_desc.fwnode = dev->fwnode; -+ mux_desc.set = typec_extcon_mux_set; -+ -+ tce->mux = typec_mux_register(dev, &mux_desc); -+ if (IS_ERR(tce->mux)) { -+ ret = dev_err_probe(dev, PTR_ERR(tce->mux), -+ "Error registering typec mux\n"); -+ goto err_sw; -+ } -+ -+ role_desc.driver_data = tce; -+ role_desc.fwnode = dev->fwnode; -+ role_desc.name = fwnode_get_name(dev->fwnode); -+ role_desc.set = typec_extcon_usb_set_role; -+ -+ tce->role_sw = usb_role_switch_register(dev, &role_desc); -+ if (IS_ERR(tce->role_sw)) { -+ ret = dev_err_probe(dev, PTR_ERR(tce->role_sw), -+ "Error registering USB role switch\n"); -+ goto err_mux; -+ } -+ -+ tce->extcon = devm_extcon_dev_allocate(dev, typec_extcon_cable); -+ if (IS_ERR(tce->extcon)) { -+ ret = PTR_ERR(tce->extcon); -+ goto err_role; -+ } -+ -+ ret = devm_extcon_dev_register(dev, tce->extcon); -+ if (ret) { -+ ret = dev_err_probe(dev, ret, "failed to register extcon device\n"); -+ goto err_role; -+ } -+ -+ extcon_set_property_capability(tce->extcon, EXTCON_USB, -+ EXTCON_PROP_USB_SS); -+ extcon_set_property_capability(tce->extcon, EXTCON_USB, -+ EXTCON_PROP_USB_TYPEC_POLARITY); -+ extcon_set_property_capability(tce->extcon, EXTCON_USB_HOST, -+ EXTCON_PROP_USB_SS); -+ extcon_set_property_capability(tce->extcon, EXTCON_USB_HOST, -+ EXTCON_PROP_USB_TYPEC_POLARITY); -+ extcon_set_property_capability(tce->extcon, EXTCON_DISP_DP, -+ EXTCON_PROP_USB_SS); -+ extcon_set_property_capability(tce->extcon, EXTCON_DISP_DP, -+ EXTCON_PROP_USB_TYPEC_POLARITY); -+ -+ tce->extcon_nb.notifier_call = typec_extcon_notifier; -+ ret = devm_extcon_register_notifier_all(dev, tce->extcon, &tce->extcon_nb); -+ if (ret) { -+ dev_err_probe(dev, ret, "Failed to register extcon notifier\n"); -+ goto err_role; -+ } -+ -+ return 0; -+ -+err_role: -+ usb_role_switch_unregister(tce->role_sw); -+err_mux: -+ typec_mux_unregister(tce->mux); -+err_sw: -+ typec_switch_unregister(tce->sw); -+ return ret; -+} -+ -+static int typec_extcon_remove(struct platform_device *pdev) -+{ -+ struct typec_extcon *tce = platform_get_drvdata(pdev); -+ -+ usb_role_switch_unregister(tce->role_sw); -+ typec_mux_unregister(tce->mux); -+ typec_switch_unregister(tce->sw); -+ -+ return 0; -+} -+ -+static struct of_device_id typec_extcon_of_match_table[] = { -+ { .compatible = "linux,typec-extcon-bridge" }, -+ { }, -+}; -+MODULE_DEVICE_TABLE(of, typec_extcon_of_match_table); -+ -+static struct platform_driver typec_extcon_driver = { -+ .driver = { -+ .name = "typec-extcon", -+ .of_match_table = typec_extcon_of_match_table, -+ }, -+ .probe = typec_extcon_probe, -+ .remove = typec_extcon_remove, -+}; -+ -+module_platform_driver(typec_extcon_driver); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Ondrej Jirman "); -+MODULE_DESCRIPTION("typec -> extcon bridge driver"); --- -2.35.1 - diff --git a/3365-phy-rockchip-typec-Make-sure-the-plug-orientation-is.patch b/3365-phy-rockchip-typec-Make-sure-the-plug-orientation-is.patch deleted file mode 100644 index c55df6a..0000000 --- a/3365-phy-rockchip-typec-Make-sure-the-plug-orientation-is.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 4ad64a0571fb80a67aae0ad0428ffeba4365b087 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= -Date: Tue, 23 Nov 2021 17:32:18 +0100 -Subject: [PATCH 365/437] phy: rockchip-typec: Make sure the plug orientation - is respected - -RK3399 TRM says about bit 8: - -typec_conn_dir_sel: TypeC connect direction select - -- 0: select typec_conn_dir (bit0 of this register) to TypeC PHY -- 1: select TCPC ouput typec_con_dir to TypeC PHY (default value) - -This means that by default, typec_conn_dir bit is not respected. -Fix setting of typec_conn_dir by setting typec_conn_dir to 0 first. - -Signed-off-by: Ondrej Jirman ---- - drivers/phy/rockchip/phy-rockchip-typec.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c -index d2bbdc96a1672..fa10ee9a5794e 100644 ---- a/drivers/phy/rockchip/phy-rockchip-typec.c -+++ b/drivers/phy/rockchip/phy-rockchip-typec.c -@@ -350,6 +350,7 @@ struct usb3phy_reg { - * struct rockchip_usb3phy_port_cfg - usb3-phy port configuration. - * @reg: the base address for usb3-phy config. - * @typec_conn_dir: the register of type-c connector direction. -+ * @typec_conn_dir_sel: the register of type-c connector direction source. - * @usb3tousb2_en: the register of type-c force usb2 to usb2 enable. - * @external_psm: the register of type-c phy external psm clock. - * @pipe_status: the register of type-c phy pipe status. -@@ -360,6 +361,7 @@ struct usb3phy_reg { - struct rockchip_usb3phy_port_cfg { - unsigned int reg; - struct usb3phy_reg typec_conn_dir; -+ struct usb3phy_reg typec_conn_dir_sel; - struct usb3phy_reg usb3tousb2_en; - struct usb3phy_reg external_psm; - struct usb3phy_reg pipe_status; -@@ -434,6 +436,7 @@ static const struct rockchip_usb3phy_port_cfg rk3399_usb3phy_port_cfgs[] = { - { - .reg = 0xff7c0000, - .typec_conn_dir = { 0xe580, 0, 16 }, -+ .typec_conn_dir_sel = { 0xe580, 8, 16+8 }, - .usb3tousb2_en = { 0xe580, 3, 19 }, - .external_psm = { 0xe588, 14, 30 }, - .pipe_status = { 0xe5c0, 0, 0 }, -@@ -444,6 +447,7 @@ static const struct rockchip_usb3phy_port_cfg rk3399_usb3phy_port_cfgs[] = { - { - .reg = 0xff800000, - .typec_conn_dir = { 0xe58c, 0, 16 }, -+ .typec_conn_dir_sel = { 0xe58c, 8, 16+8 }, - .usb3tousb2_en = { 0xe58c, 3, 19 }, - .external_psm = { 0xe594, 14, 30 }, - .pipe_status = { 0xe5c0, 16, 16 }, -@@ -739,6 +743,7 @@ static int tcphy_phy_init(struct rockchip_typec_phy *tcphy, u8 mode) - - reset_control_deassert(tcphy->tcphy_rst); - -+ property_enable(tcphy, &cfg->typec_conn_dir_sel, 0); - property_enable(tcphy, &cfg->typec_conn_dir, tcphy->flip); - tcphy_dp_aux_set_flip(tcphy); - --- -2.35.1 - diff --git a/3372-phy-rockchip-inno-usb2-More-robust-charger-detection.patch b/3372-phy-rockchip-inno-usb2-More-robust-charger-detection.patch deleted file mode 100644 index c20c8ad..0000000 --- a/3372-phy-rockchip-inno-usb2-More-robust-charger-detection.patch +++ /dev/null @@ -1,114 +0,0 @@ -From f21b804e46b9957b55eeef85b65923e11fae0182 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= -Date: Fri, 4 Feb 2022 02:25:34 +0100 -Subject: [PATCH 372/437] phy: rockchip-inno-usb2: More robust charger - detection extcon updates - -Make sure we always clear the charger detection results. Allow to -disable updates of EXTCON_USB state via extcon,ignore-usb DT property. -The previous method was smart, but assumed !vbus_branch would -always be called. - -Signed-off-by: Ondrej Jirman ---- - drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 39 +++++++++++-------- - 1 file changed, 23 insertions(+), 16 deletions(-) - -diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c -index acc4a955c45b6..273ce9d656d74 100644 ---- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c -+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c -@@ -517,21 +517,27 @@ static const struct phy_ops rockchip_usb2phy_ops = { - .owner = THIS_MODULE, - }; - -+const int rockchip_usb2phy_cable_types[] = { -+ EXTCON_CHG_USB_SDP, -+ EXTCON_CHG_USB_DCP, -+ EXTCON_CHG_USB_CDP, -+ EXTCON_CHG_USB_ACA, -+}; -+ - static void rockchip_usb2phy_otg_sm_work(struct work_struct *work) - { - struct rockchip_usb2phy_port *rport = - container_of(work, struct rockchip_usb2phy_port, - otg_sm_work.work); - struct rockchip_usb2phy *rphy = dev_get_drvdata(rport->phy->dev.parent); -- static unsigned int cable; -+ unsigned int cable = 0, i; - unsigned long delay; -- bool vbus_attach, sch_work, notify_charger; -+ bool vbus_attach, sch_work; - - vbus_attach = property_enabled(rphy->grf, - &rport->port_cfg->utmi_bvalid); - - sch_work = false; -- notify_charger = false; - delay = OTG_SCHEDULE_DELAY; - dev_dbg(&rport->phy->dev, "%s otg sm work\n", - usb_otg_state_string(rport->state)); -@@ -560,14 +566,12 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work) - dev_dbg(&rport->phy->dev, "sdp cable is connected\n"); - rockchip_usb2phy_power_on(rport->phy); - rport->state = OTG_STATE_B_PERIPHERAL; -- notify_charger = true; - sch_work = true; - cable = EXTCON_CHG_USB_SDP; - break; - case POWER_SUPPLY_TYPE_USB_DCP: - dev_dbg(&rport->phy->dev, "dcp cable is connected\n"); - rockchip_usb2phy_power_off(rport->phy); -- notify_charger = true; - sch_work = true; - cable = EXTCON_CHG_USB_DCP; - break; -@@ -575,7 +579,6 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work) - dev_dbg(&rport->phy->dev, "cdp cable is connected\n"); - rockchip_usb2phy_power_on(rport->phy); - rport->state = OTG_STATE_B_PERIPHERAL; -- notify_charger = true; - sch_work = true; - cable = EXTCON_CHG_USB_CDP; - break; -@@ -587,22 +590,26 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct *work) - break; - } - } else { -- notify_charger = true; - rphy->chg_state = USB_CHG_STATE_UNDEFINED; - rphy->chg_type = POWER_SUPPLY_TYPE_UNKNOWN; - } - -- if (rport->vbus_attached != vbus_attach) { -- rport->vbus_attached = vbus_attach; -+ if (rphy->edev && extcon_get_state(rphy->edev, cable) != vbus_attach) { -+ for (i = 0; i < ARRAY_SIZE(rockchip_usb2phy_cable_types); i++) { -+ int type = rockchip_usb2phy_cable_types[i]; - -- if (notify_charger && rphy->edev) { -- extcon_set_state_sync(rphy->edev, -- cable, vbus_attach); -- if (cable == EXTCON_CHG_USB_SDP) -- extcon_set_state_sync(rphy->edev, -- EXTCON_USB, -- vbus_attach); -+ if (extcon_get_state(rphy->edev, type)) -+ extcon_set_state_sync(rphy->edev, type, 0); - } -+ -+ if (vbus_attach) -+ extcon_set_state_sync(rphy->edev, cable, vbus_attach); -+ -+ if ((cable == EXTCON_CHG_USB_SDP || cable == POWER_SUPPLY_TYPE_USB_CDP) -+ && extcon_get_state(rphy->edev, EXTCON_USB) != vbus_attach -+ && !of_property_read_bool(rphy->dev->of_node, "extcon,ignore-usb")) -+ extcon_set_state_sync(rphy->edev, -+ EXTCON_USB, vbus_attach); - } - break; - case OTG_STATE_B_PERIPHERAL: --- -2.35.1 - diff --git a/3373-usb-typec-extcon-Don-t-touch-charger-proprties.patch b/3373-usb-typec-extcon-Don-t-touch-charger-proprties.patch deleted file mode 100644 index 3272061..0000000 --- a/3373-usb-typec-extcon-Don-t-touch-charger-proprties.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 069e7e01dd8ece1b57f8eb9aa7f5806f8dcca140 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= -Date: Fri, 4 Feb 2022 02:26:50 +0100 -Subject: [PATCH 373/437] usb: typec-extcon: Don't touch charger proprties - -These are owned by usb2 phy driver. Touching them here only introduces -race conditions. - -Signed-off-by: Ondrej Jirman ---- - drivers/usb/typec/typec-extcon.c | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/drivers/usb/typec/typec-extcon.c b/drivers/usb/typec/typec-extcon.c -index f1fe5e57fdfc9..447aaafca0c9f 100644 ---- a/drivers/usb/typec/typec-extcon.c -+++ b/drivers/usb/typec/typec-extcon.c -@@ -96,11 +96,6 @@ static int typec_extcon_sync_extcon(struct typec_extcon *tce) - typec_extcon_set_cable(tce, EXTCON_USB_HOST, false, prop_ss, prop_or); - typec_extcon_set_cable(tce, EXTCON_DISP_DP, false, prop_ss, prop_or); - -- extcon_set_state_sync(tce->extcon, EXTCON_CHG_USB_SDP, false); -- extcon_set_state_sync(tce->extcon, EXTCON_CHG_USB_DCP, false); -- extcon_set_state_sync(tce->extcon, EXTCON_CHG_USB_CDP, false); -- extcon_set_state_sync(tce->extcon, EXTCON_CHG_USB_ACA, false); -- - goto out_unlock; - } - --- -2.35.1 - diff --git a/PKGBUILD b/PKGBUILD index 330484b..c27d342 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -5,7 +5,7 @@ pkgbase=linux-rc pkgver=5.18.rc3 -pkgrel=1 +pkgrel=2 _newversion=false _stopbuild=false # Will also stop if ${_newversion} is true _srcname="linux-${pkgver/.rc/-rc}" @@ -23,7 +23,7 @@ source=("https://git.kernel.org/torvalds/t/${_srcname}.tar.gz" '1004-gpu-drm-add-new-display-resolution-2560x1440.patch' # Odroid '1005-panfrost-Silence-Panfrost-gem-shrinker-loggin.patch' # Panfrost '1006-arm64-dts-rockchip-Add-Firefly-Station-p1-support.patch' # Firefly Station P1 - #'1007-drm-rockchip-add-support-for-modeline-32MHz-e.patch' # DP Alt Mode; Disabled, causes one of the Quartz64 development patches not to apply + '1007-drm-rockchip-add-support-for-modeline-32MHz-e.patch' # Rockchip '1008-rk3399-rp64-pcie-Reimplement-rockchip-PCIe-bus-scan-delay.patch' # RockPro64 '1009-drm-meson-encoder-add-YUV422-output-support.patch' # Meson G12B '1010-arm64-dts-amlogic-add-initial-Beelink-GT1-Ultimate-dev.patch' # Beelink GT1 Ultimate @@ -47,22 +47,6 @@ source=("https://git.kernel.org/torvalds/t/${_srcname}.tar.gz" '2007-arm64-dts-allwinner-pinetab-enable-jack-detection.patch' # PineTab Audio '2008-brcmfmac-USB-probing-provides-no-board-type.patch' # Bluetooth; Will be submitted upstream by the author '2009-dts-rockchip-Adapt-and-adopt-Type-C-support-from-Pin.patch' # RockPro64 DP Alt Mode; Not upstreamable - # NOTE: The third set of patches is left unused until @megi makes - # his 5.18 patches available on https://xff.cz/kernels/ - '3170-arm64-dts-rk3399-pinebook-pro-Fix-USB-PD-charging.patch' # Third set of patches: START - '3172-arm64-dts-rk3399-pinebook-pro-Improve-Type-C-support.patch' # Pinebook Pro Type-C patches from megous; original patch numbers found - '3174-arm64-dts-rk3399-pinebook-pro-Remove-redundant-pinct.patch' # on https://xff.cz/kernels/5.17/patches/ are retained, with just the first - '3178-arm64-dts-rk3399-pinebook-pro-Don-t-allow-usb2-phy-d.patch' # digit changed from 0 to 3, to make tracking easier - '3339-drm-rockchip-cdn-dp-Disable-CDN-DP-on-disconnect.patch' - '3355-usb-typec-fusb302-Set-the-current-before-enabling-pu.patch' - '3359-usb-typec-fusb302-Update-VBUS-state-even-if-VBUS-int.patch' - '3361-usb-typec-fusb302-Add-OF-extcon-support.patch' - '3362-usb-typec-fusb302-Fix-register-definitions.patch' - '3363-usb-typec-fusb302-Clear-interrupts-before-we-start-t.patch' - '3364-usb-typec-typec-extcon-Add-typec-extcon-bridge-drive.patch' - '3365-phy-rockchip-typec-Make-sure-the-plug-orientation-is.patch' - '3372-phy-rockchip-inno-usb2-More-robust-charger-detection.patch' - '3373-usb-typec-extcon-Don-t-touch-charger-proprties.patch' # Third set of patches: END '4001-drm-rockchip-Refactor-IOMMU-initialisation.patch' # RK356x VOP2 dependency; From list: https://lore.kernel.org/linux-rockchip/94eee7ab434fe11eb0787f691e9f1ab03a2e91be.1649168685.git.robin.murphy@arm.com/T/#u '4002-drm-rockchip-RK356x-VOP2-support-v10-patchset.patch' # RK356x VOP2 v10 patchset; From list: https://patchwork.freedesktop.org/series/102408/ '4003-dt-bindings-soc-grf-add-rk3566-pipe-grf-compatible.patch' # RK3566 DWC3 OTG; From list: https://patchwork.kernel.org/project/linux-rockchip/patch/20220408151237.3165046-2-pgwipeout@gmail.com/ @@ -86,6 +70,7 @@ md5sums=('dc367615477950c93f8940ddd5ce9399' '6f592c11f6adc1de0f06e5d18f8c2862' 'f8f0b124c741be61d86bea8d44e875f9' '564136ab1c75b6dc67be02b54e695ae5' + '66fae3fc96f0a478a56ff11632f3ef70' '245858f26512dfc48adbf509b6fc8364' '47ebd261e31fe881abafee88c9d33767' '8f4816a1ed98f80eebad49b6446427a9' @@ -109,20 +94,6 @@ md5sums=('dc367615477950c93f8940ddd5ce9399' 'f79300740a7350d2d24ab5e120831b52' 'd2654df7fc87e5c874505a2d98cbce1c' '3d1c9ff232929189de8df70614304e13' - '5e893acf3d94e12b34b8cff473c26218' - 'ac41d6c08c54c55d13c8fe894475ad65' - '78cef676142df1365bba76957c3d3568' - 'dcc69b0564188ba62de6b70a4e3cd3cf' - 'f11053894ecba7af407caf3a72de4d7f' - '6692e09bdea6e156290e22f54e1dc205' - '2f4bd9db5c8f2d5625d3ff0cb46839c2' - 'e50f6fa84cf825cf6d0905a661bdcc42' - '1b9950b3c76a0e43230fa37edd1dd80a' - '55568672d443c4db1438f081e9fbcd92' - '2b4e7d963ce6cc53518a3f6a2b14c30e' - '482a6974207197cff14e77a61f66a810' - 'a76a46e31f4229e7c4349f90ac36601b' - '04eec4b27d9c26f6d53317100fbab7fb' '4292ef381b1251ef28b92941d5f3b802' '0d0e3ce59e9b48ea18909bdc65fe686b' 'be2b44a94532d0b8e91c4afd8efbd84c' @@ -160,11 +131,6 @@ prepare() { # Assorted Pinebook, PinePhone and PineTab patches apply_patches 2 - # Pinebook Pro Type-C patches - # NOTE: The third set of patches is left unused until @megi makes - # his 5.18 patches available on https://xff.cz/kernels/ - #apply_patches 3 - # Assorted Quartz64 development patches, still in flux apply_patches 4 -- GitLab From f32d6bd6ec2763cc06f6749f276634f5fd4bd26e Mon Sep 17 00:00:00 2001 From: Dan Johansen Date: Wed, 20 Apr 2022 10:06:19 +0200 Subject: [PATCH 2/2] modeline patch still fails, so disable it Signed-off-by: Dan Johansen --- PKGBUILD | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index c27d342..b400c45 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -23,7 +23,7 @@ source=("https://git.kernel.org/torvalds/t/${_srcname}.tar.gz" '1004-gpu-drm-add-new-display-resolution-2560x1440.patch' # Odroid '1005-panfrost-Silence-Panfrost-gem-shrinker-loggin.patch' # Panfrost '1006-arm64-dts-rockchip-Add-Firefly-Station-p1-support.patch' # Firefly Station P1 - '1007-drm-rockchip-add-support-for-modeline-32MHz-e.patch' # Rockchip + #'1007-drm-rockchip-add-support-for-modeline-32MHz-e.patch' # Rockchip '1008-rk3399-rp64-pcie-Reimplement-rockchip-PCIe-bus-scan-delay.patch' # RockPro64 '1009-drm-meson-encoder-add-YUV422-output-support.patch' # Meson G12B '1010-arm64-dts-amlogic-add-initial-Beelink-GT1-Ultimate-dev.patch' # Beelink GT1 Ultimate @@ -70,7 +70,6 @@ md5sums=('dc367615477950c93f8940ddd5ce9399' '6f592c11f6adc1de0f06e5d18f8c2862' 'f8f0b124c741be61d86bea8d44e875f9' '564136ab1c75b6dc67be02b54e695ae5' - '66fae3fc96f0a478a56ff11632f3ef70' '245858f26512dfc48adbf509b6fc8364' '47ebd261e31fe881abafee88c9d33767' '8f4816a1ed98f80eebad49b6446427a9' -- GitLab