diff --git a/modules/x1e80100.nix b/modules/x1e80100.nix index 05f6196..c850f5e 100644 --- a/modules/x1e80100.nix +++ b/modules/x1e80100.nix @@ -26,6 +26,11 @@ "phy_qcom_qmp_pcie" "pcie_qcom" "panel_samsung_atna33xc20" + + # Needed with the DP altmode patches + "ps883x" + "pmic_glink_altmode" + "qrtr" ]; boot.kernelParams = [ diff --git a/packages/lenovo-yoga-slim7x-dp-altmode.patch b/packages/lenovo-yoga-slim7x-dp-altmode.patch new file mode 100644 index 0000000..7cd2287 --- /dev/null +++ b/packages/lenovo-yoga-slim7x-dp-altmode.patch @@ -0,0 +1,647 @@ +diff --git a/arch/arm64/boot/dts/qcom/x1e80100-lenovo-yoga-slim7x.dts b/arch/arm64/boot/dts/qcom/x1e80100-lenovo-yoga-slim7x.dts +index 40e59558aef4..b5fed73bcf8a 100644 +--- a/arch/arm64/boot/dts/qcom/x1e80100-lenovo-yoga-slim7x.dts ++++ b/arch/arm64/boot/dts/qcom/x1e80100-lenovo-yoga-slim7x.dts +@@ -48,7 +48,15 @@ port@1 { + reg = <1>; + + pmic_glink_ss0_ss_in: endpoint { +- remote-endpoint = <&usb_1_ss0_qmpphy_out>; ++ remote-endpoint = <&retimer_ss0_ss_out>; ++ }; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ ++ pmic_glink_ss0_con_sbu_in: endpoint { ++ remote-endpoint = <&retimer_ss0_con_sbu_out>; + }; + }; + }; +@@ -77,7 +85,15 @@ port@1 { + reg = <1>; + + pmic_glink_ss1_ss_in: endpoint { +- remote-endpoint = <&usb_1_ss1_qmpphy_out>; ++ remote-endpoint = <&retimer_ss1_ss_out>; ++ }; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ ++ pmic_glink_ss1_con_sbu_in: endpoint { ++ remote-endpoint = <&retimer_ss1_con_sbu_out>; + }; + }; + }; +@@ -106,7 +122,15 @@ port@1 { + reg = <1>; + + pmic_glink_ss2_ss_in: endpoint { +- remote-endpoint = <&usb_1_ss2_qmpphy_out>; ++ remote-endpoint = <&retimer_ss2_ss_out>; ++ }; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ ++ pmic_glink_ss2_con_sbu_in: endpoint { ++ remote-endpoint = <&retimer_ss2_con_sbu_out>; + }; + }; + }; +@@ -182,6 +206,134 @@ vreg_edp_3p3: regulator-edp-3p3 { + regulator-boot-on; + }; + ++ vreg_rtmr0_1p15: regulator-rtmr0-1p15 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR0_1P15"; ++ regulator-min-microvolt = <1150000>; ++ regulator-max-microvolt = <1150000>; ++ ++ gpio = <&pm8550ve_8_gpios 8 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-0 = <&rtmr0_1p15_reg_en>; ++ pinctrl-names = "default"; ++ }; ++ ++ vreg_rtmr0_1p8: regulator-rtmr0-1p8 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR0_1P8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ++ gpio = <&pm8550ve_9_gpios 8 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-0 = <&rtmr0_1p8_reg_en>; ++ pinctrl-names = "default"; ++ }; ++ ++ vreg_rtmr0_3p3: regulator-rtmr0-3p3 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR0_3P3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ ++ gpio = <&pm8550_gpios 11 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-0 = <&rtmr0_3p3_reg_en>; ++ pinctrl-names = "default"; ++ }; ++ ++ vreg_rtmr1_1p15: regulator-rtmr1-1p15 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR1_1P15"; ++ regulator-min-microvolt = <1150000>; ++ regulator-max-microvolt = <1150000>; ++ ++ gpio = <&tlmm 188 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rtmr1_1p15_reg_en>; ++ }; ++ ++ vreg_rtmr1_1p8: regulator-rtmr1-1p8 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR1_1P8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ++ gpio = <&tlmm 175 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rtmr1_1p8_reg_en>; ++ }; ++ ++ vreg_rtmr1_3p3: regulator-rtmr1-3p3 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR1_3P3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ ++ gpio = <&tlmm 186 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rtmr1_3p3_reg_en>; ++ }; ++ ++ vreg_rtmr2_1p15: regulator-rtmr2-1p15 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR2_1P15"; ++ regulator-min-microvolt = <1150000>; ++ regulator-max-microvolt = <1150000>; ++ ++ gpio = <&tlmm 189 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rtmr2_1p15_reg_en>; ++ }; ++ ++ vreg_rtmr2_1p8: regulator-rtmr2-1p8 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR2_1P8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ++ gpio = <&tlmm 126 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rtmr2_1p8_reg_en>; ++ }; ++ ++ vreg_rtmr2_3p3: regulator-rtmr2-3p3 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR2_3P3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ ++ gpio = <&tlmm 187 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rtmr2_3p3_reg_en>; ++ }; ++ ++ ++ + vreg_nvme: regulator-nvme { + compatible = "regulator-fixed"; + +@@ -208,6 +360,141 @@ vph_pwr: regulator-vph-pwr { + regulator-always-on; + regulator-boot-on; + }; ++ ++ vreg_rtmr0_1p15: regulator-rtmr0-1p15 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR0_1P15"; ++ regulator-min-microvolt = <1150000>; ++ regulator-max-microvolt = <1150000>; ++ regulator-boot-on; ++ ++ gpio = <&pm8550ve_8_gpios 8 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-0 = <&rtmr0_1p15_reg_en>; ++ pinctrl-names = "default"; ++ }; ++ ++ vreg_rtmr0_1p8: regulator-rtmr0-1p8 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR0_1P8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-boot-on; ++ ++ gpio = <&pm8550ve_9_gpios 8 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-0 = <&rtmr0_1p8_reg_en>; ++ pinctrl-names = "default"; ++ }; ++ ++ vreg_rtmr0_3p3: regulator-rtmr0-3p3 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR0_3P3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ ++ gpio = <&pm8550_gpios 11 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-0 = <&rtmr0_3p3_reg_en>; ++ pinctrl-names = "default"; ++ }; ++ ++ vreg_rtmr1_1p15: regulator-rtmr1-1p15 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR1_1P15"; ++ regulator-min-microvolt = <1150000>; ++ regulator-max-microvolt = <1150000>; ++ regulator-boot-on; ++ ++ gpio = <&tlmm 188 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-0 = <&rtmr1_1p15_reg_en>; ++ pinctrl-names = "default"; ++ }; ++ ++ vreg_rtmr1_1p8: regulator-rtmr1-1p8 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR1_1P8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-boot-on; ++ ++ gpio = <&tlmm 175 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-0 = <&rtmr1_1p8_reg_en>; ++ pinctrl-names = "default"; ++ }; ++ ++ vreg_rtmr1_3p3: regulator-rtmr1-3p3 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR1_3P3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ ++ gpio = <&tlmm 186 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-0 = <&rtmr1_3p3_reg_en>; ++ pinctrl-names = "default"; ++ }; ++ ++ vreg_rtmr2_1p15: regulator-rtmr2-1p15 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR2_1P15"; ++ regulator-min-microvolt = <1150000>; ++ regulator-max-microvolt = <1150000>; ++ regulator-boot-on; ++ ++ gpio = <&tlmm 189 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-0 = <&rtmr2_1p15_reg_en>; ++ pinctrl-names = "default"; ++ }; ++ ++ vreg_rtmr2_1p8: regulator-rtmr2-1p8 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR2_1P8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-boot-on; ++ ++ gpio = <&tlmm 126 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-0 = <&rtmr2_1p8_reg_en>; ++ pinctrl-names = "default"; ++ }; ++ ++ vreg_rtmr2_3p3: regulator-rtmr2-3p3 { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "VREG_RTMR2_3P3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ ++ gpio = <&tlmm 187 GPIO_ACTIVE_HIGH>; ++ enable-active-high; ++ ++ pinctrl-0 = <&rtmr2_3p3_reg_en>; ++ pinctrl-names = "default"; ++ }; + }; + + &apps_rsc { +@@ -538,6 +825,172 @@ keyboard@3a { + }; + }; + ++&i2c1 { ++ clock-frequency = <400000>; ++ ++ status = "okay"; ++ ++ typec-mux@8 { ++ compatible = "parade,ps8830"; ++ reg = <0x08>; ++ ++ clocks = <&rpmhcc RPMH_RF_CLK5>; ++ clock-names = "xo"; ++ ++ vdd-supply = <&vreg_rtmr2_1p15>; ++ vdd33-supply = <&vreg_rtmr2_3p3>; ++ vdd33-cap-supply = <&vreg_rtmr2_3p3>; ++ vddar-supply = <&vreg_rtmr2_1p15>; ++ vddat-supply = <&vreg_rtmr2_1p15>; ++ vddio-supply = <&vreg_rtmr2_1p8>; ++ ++ reset-gpios = <&tlmm 185 GPIO_ACTIVE_HIGH>; ++ ++ orientation-switch; ++ retimer-switch; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ ++ retimer_ss2_ss_out: endpoint { ++ remote-endpoint = <&pmic_glink_ss2_ss_in>; ++ }; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ ++ retimer_ss2_ss_in: endpoint { ++ remote-endpoint = <&usb_1_ss2_qmpphy_out>; ++ }; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ ++ retimer_ss2_con_sbu_out: endpoint { ++ remote-endpoint = <&pmic_glink_ss2_con_sbu_in>; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&i2c3 { ++ clock-frequency = <400000>; ++ ++ status = "okay"; ++ ++ typec-mux@8 { ++ compatible = "parade,ps8830"; ++ reg = <0x08>; ++ ++ clocks = <&rpmhcc RPMH_RF_CLK3>; ++ clock-names = "xo"; ++ ++ vdd-supply = <&vreg_rtmr0_1p15>; ++ vdd33-supply = <&vreg_rtmr0_3p3>; ++ vdd33-cap-supply = <&vreg_rtmr0_3p3>; ++ vddar-supply = <&vreg_rtmr0_1p15>; ++ vddat-supply = <&vreg_rtmr0_1p15>; ++ vddio-supply = <&vreg_rtmr0_1p8>; ++ ++ reset-gpios = <&pm8550_gpios 10 GPIO_ACTIVE_HIGH>; ++ ++ retimer-switch; ++ orientation-switch; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ ++ retimer_ss0_ss_out: endpoint { ++ remote-endpoint = <&pmic_glink_ss0_ss_in>; ++ }; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ ++ retimer_ss0_ss_in: endpoint { ++ remote-endpoint = <&usb_1_ss0_qmpphy_out>; ++ }; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ ++ retimer_ss0_con_sbu_out: endpoint { ++ remote-endpoint = <&pmic_glink_ss0_con_sbu_in>; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&i2c7 { ++ clock-frequency = <400000>; ++ ++ status = "okay"; ++ ++ typec-mux@8 { ++ compatible = "parade,ps8830"; ++ reg = <0x8>; ++ ++ clocks = <&rpmhcc RPMH_RF_CLK4>; ++ clock-names = "xo"; ++ ++ vdd-supply = <&vreg_rtmr1_1p15>; ++ vdd33-supply = <&vreg_rtmr1_3p3>; ++ vdd33-cap-supply = <&vreg_rtmr1_3p3>; ++ vddar-supply = <&vreg_rtmr1_1p15>; ++ vddat-supply = <&vreg_rtmr1_1p15>; ++ vddio-supply = <&vreg_rtmr1_1p8>; ++ ++ reset-gpios = <&tlmm 176 GPIO_ACTIVE_HIGH>; ++ ++ retimer-switch; ++ orientation-switch; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ ++ retimer_ss1_ss_out: endpoint { ++ remote-endpoint = <&pmic_glink_ss1_ss_in>; ++ }; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ ++ retimer_ss1_ss_in: endpoint { ++ remote-endpoint = <&usb_1_ss1_qmpphy_out>; ++ }; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ ++ retimer_ss1_con_sbu_out: endpoint { ++ remote-endpoint = <&pmic_glink_ss1_con_sbu_in>; ++ }; ++ }; ++ ++ }; ++ }; ++}; ++ + &i2c8 { + clock-frequency = <400000>; + +@@ -585,6 +1038,33 @@ &mdss { + status = "okay"; + }; + ++&mdss_dp0 { ++ status = "okay"; ++}; ++ ++&mdss_dp0_out { ++ data-lanes = <0 1 2 3>; ++ /* data-lanes = <0 1>; */ ++}; ++ ++&mdss_dp1 { ++ status = "okay"; ++}; ++ ++&mdss_dp1_out { ++ data-lanes = <0 1 2 3>; ++ /* data-lanes = <0 1>; */ ++}; ++ ++&mdss_dp2 { ++ status = "okay"; ++}; ++ ++&mdss_dp2_out { ++ data-lanes = <0 1 2 3>; ++ /* data-lanes = <0 1>; */ ++}; ++ + &mdss_dp3 { + compatible = "qcom,x1e80100-dp"; + /delete-property/ #sound-dai-cells; +@@ -674,6 +1154,33 @@ &pcie6a_phy { + status = "okay"; + }; + ++&pm8550_gpios { ++ rtmr0_3p3_reg_en: rtmr0-3p3-reg-en-state { ++ pins = "gpio11"; ++ function = "func1"; ++ input-disable; ++ output-enable; ++ }; ++}; ++ ++&pm8550ve_8_gpios { ++ rtmr0_1p15_reg_en: rtmr0-1p15-reg-en-state { ++ pins = "gpio8"; ++ function = "func1"; ++ input-disable; ++ output-enable; ++ }; ++}; ++ ++&pm8550ve_9_gpios { ++ rtmr0_1p8_reg_en: rtmr0-1p8-reg-en-state { ++ pins = "gpio8"; ++ function = "func1"; ++ input-disable; ++ output-enable; ++ }; ++}; ++ + &pmc8380_3_gpios { + edp_bl_en: edp-bl-en-state { + pins = "gpio4"; +@@ -862,6 +1369,48 @@ wake-n-pins { + }; + }; + ++ rtmr1_1p15_reg_en: rtmr1-1p15-reg-en-state { ++ pins = "gpio188"; ++ function = "gpio"; ++ drive-strength = <2>; ++ bias-disable; ++ }; ++ ++ rtmr1_1p8_reg_en: rtmr1-1p8-reg-en-state { ++ pins = "gpio175"; ++ function = "gpio"; ++ drive-strength = <2>; ++ bias-disable; ++ }; ++ ++ rtmr1_3p3_reg_en: rtmr1-3p3-reg-en-state { ++ pins = "gpio186"; ++ function = "gpio"; ++ drive-strength = <2>; ++ bias-disable; ++ }; ++ ++ rtmr2_1p15_reg_en: rtmr2-1p15-reg-en-state { ++ pins = "gpio189"; ++ function = "gpio"; ++ drive-strength = <2>; ++ bias-disable; ++ }; ++ ++ rtmr2_1p8_reg_en: rtmr2-1p8-reg-en-state { ++ pins = "gpio126"; ++ function = "gpio"; ++ drive-strength = <2>; ++ bias-disable; ++ }; ++ ++ rtmr2_3p3_reg_en: rtmr2-3p3-reg-en-state { ++ pins = "gpio187"; ++ function = "gpio"; ++ drive-strength = <2>; ++ bias-disable; ++ }; ++ + tpad_default: tpad-default-state { + pins = "gpio3"; + function = "gpio"; +@@ -916,7 +1465,7 @@ &usb_1_ss0_dwc3_hs { + }; + + &usb_1_ss0_qmpphy_out { +- remote-endpoint = <&pmic_glink_ss0_ss_in>; ++ remote-endpoint = <&retimer_ss0_ss_in>; + }; + + &usb_1_ss1_hsphy { +@@ -950,7 +1499,7 @@ &usb_1_ss1_dwc3_hs { + }; + + &usb_1_ss1_qmpphy_out { +- remote-endpoint = <&pmic_glink_ss1_ss_in>; ++ remote-endpoint = <&retimer_ss1_ss_in>; + }; + + &usb_1_ss2_hsphy { +@@ -982,5 +1531,5 @@ &usb_1_ss2_dwc3_hs { + }; + + &usb_1_ss2_qmpphy_out { +- remote-endpoint = <&pmic_glink_ss2_ss_in>; ++ remote-endpoint = <&retimer_ss2_ss_in>; + }; diff --git a/packages/x1e80100-linux.nix b/packages/x1e80100-linux.nix index 17ddf49..5c13bef 100644 --- a/packages/x1e80100-linux.nix +++ b/packages/x1e80100-linux.nix @@ -72,5 +72,14 @@ linuxPackagesFor (buildLinux { # Adapted from: https://lore.kernel.org/linux-kernel/20241015004945.3676-6-jonathan@marek.ca/ patch = ./lenovo-yoga-slim7x-rtc.patch; } + + # DP altmode + { + name = "arm64: dts: qcom: x1e80100-slim7x: Enable external DP support"; + # From these two commits: + # https://git.launchpad.net/~ubuntu-concept/ubuntu/+source/linux/+git/oracular/commit/?h=qcom-x1e&id=87f07f4fe54477cd3219a0553192ab0bcba97945 + # https://git.launchpad.net/~ubuntu-concept/ubuntu/+source/linux/+git/oracular/commit/?h=qcom-x1e&id=350f8e8802bef1a2aac3dc17c3db138022296a94 + patch = ./lenovo-yoga-slim7x-dp-altmode.patch; + } ]; })