This improves device-tree of Lenovo Flex/Yoga 5G laptop with these changes:
- fix GPU firmware path (make it use device-specific firmware directory);
- set names for i2c hid nodes (so it is clear which node corresponds to
which device);
- add touchscreen support;
- fix touchpad issue when it gets stuck on right or middle click;
- allow UFS regulators load/mode setting;
- move some pinctrl properties to appropriate nodes.
---
Changes in v2:
- fix the description for touchpad i2c patch;
- move touchscreen reset gpio pinctrl to appropriate node;
- add a patch splitting and moving some other pinctrl stuff, so it is in
correct nodes as well;
- change touchscreen interrupt from edge falling to active low, because
edge falling is apparently against i2c hid specification, and ACPI uses
active low as well.
---
Anton Bambura (6):
arm64: dts: qcom: sc8180x-lenovo-flex-5g: fix GPU firmware path
arm64: dts: qcom: sc8180x-lenovo-flex-5g: set names for i2c hid nodes
arm64: dts: qcom: sc8180x-lenovo-flex-5g: move pinctrl to appropriate
nodes
arm64: dts: qcom: sc8180x-lenovo-flex-5g: enable touchscreen
arm64: dts: qcom: sc8180x-lenovo-flex-5g: set touchpad i2c frequency
to 1 MHz
arm64: dts: qcom: sc8180x-lenovo-flex-5g: Allow UFS regulators
load/mode setting
.../boot/dts/qcom/sc8180x-lenovo-flex-5g.dts | 85 +++++++++++++++----
1 file changed, 68 insertions(+), 17 deletions(-)
--
2.42.0
Split keyboard and touchpad pinctrl nodes since they are for different
devices and move keyboard, touchpad and touchscreen pinctrl references to
appropriate nodes.
Signed-off-by: Anton Bambura <[email protected]>
---
.../boot/dts/qcom/sc8180x-lenovo-flex-5g.dts | 41 +++++++++++++------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
index af61acf58d68..6ae6cb030b70 100644
--- a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
+++ b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
@@ -357,7 +357,7 @@ zap-shader {
&i2c1 {
clock-frequency = <100000>;
- pinctrl-0 = <&i2c1_active>, <&i2c1_hid_active>;
+ pinctrl-0 = <&i2c1_active>;
pinctrl-names = "default";
status = "okay";
@@ -368,13 +368,16 @@ touchscreen@10 {
hid-descr-addr = <0x1>;
interrupts-extended = <&tlmm 122 IRQ_TYPE_LEVEL_LOW>;
+
+ pinctrl-0 = <&ts_int_default>;
+ pinctrl-names = "default";
};
};
&i2c7 {
clock-frequency = <100000>;
- pinctrl-0 = <&i2c7_active>, <&i2c7_hid_active>;
+ pinctrl-0 = <&i2c7_active>;
pinctrl-names = "default";
status = "okay";
@@ -385,6 +388,9 @@ keyboard@5 {
hid-descr-addr = <0x20>;
interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_LOW>;
+
+ pinctrl-0 = <&kb_int_default>;
+ pinctrl-names = "default";
};
touchpad@2c {
@@ -393,6 +399,9 @@ touchpad@2c {
hid-descr-addr = <0x20>;
interrupts-extended = <&tlmm 24 IRQ_TYPE_LEVEL_LOW>;
+
+ pinctrl-0 = <&tp_int_default>;
+ pinctrl-names = "default";
};
};
@@ -669,14 +678,6 @@ i2c1_active: i2c1-active-state {
drive-strength = <2>;
};
- i2c1_hid_active: i2c1-hid-active-state {
- pins = "gpio122";
- function = "gpio";
-
- bias-pull-up;
- drive-strength = <2>;
- };
-
i2c7_active: i2c7-active-state {
pins = "gpio98", "gpio99";
function = "qup7";
@@ -685,8 +686,8 @@ i2c7_active: i2c7-active-state {
drive-strength = <2>;
};
- i2c7_hid_active: i2c7-hid-active-state {
- pins = "gpio37", "gpio24";
+ kb_int_default: kb-int-default-state {
+ pins = "gpio37";
function = "gpio";
bias-pull-up;
@@ -718,6 +719,22 @@ wake-n-pins {
};
};
+ tp_int_default: tp-int-default-state {
+ pins = "gpio24";
+ function = "gpio";
+
+ bias-pull-up;
+ drive-strength = <2>;
+ };
+
+ ts_int_default: ts-int-default-state {
+ pins = "gpio122";
+ function = "gpio";
+
+ bias-pull-up;
+ drive-strength = <2>;
+ };
+
usbprim_sbu_default: usbprim-sbu-state {
oe-n-pins {
pins = "gpio152";
--
2.42.0
Set names, so they correspond to devices connected to these interfaces.
Signed-off-by: Anton Bambura <[email protected]>
Reviewed-by: Konrad Dybcio <[email protected]>
---
arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
index 49b740c54674..af61acf58d68 100644
--- a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
+++ b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
@@ -362,7 +362,7 @@ &i2c1 {
status = "okay";
- hid@10 {
+ touchscreen@10 {
compatible = "hid-over-i2c";
reg = <0x10>;
hid-descr-addr = <0x1>;
@@ -379,7 +379,7 @@ &i2c7 {
status = "okay";
- hid@5 {
+ keyboard@5 {
compatible = "hid-over-i2c";
reg = <0x5>;
hid-descr-addr = <0x20>;
@@ -387,7 +387,7 @@ hid@5 {
interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_LOW>;
};
- hid@2c {
+ touchpad@2c {
compatible = "hid-over-i2c";
reg = <0x2c>;
hid-descr-addr = <0x20>;
--
2.42.0
Set regulators, reset gpio and delays according to ACPI tables.
Signed-off-by: Anton Bambura <[email protected]>
---
.../boot/dts/qcom/sc8180x-lenovo-flex-5g.dts | 30 ++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
index 6ae6cb030b70..5bf6285f905f 100644
--- a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
+++ b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
@@ -271,6 +271,12 @@ vreg_l3c_1p2: ldo3 {
regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
};
+ vreg_l4c_3p3: ldo4 {
+ regulator-min-microvolt = <3296000>;
+ regulator-max-microvolt = <3304000>;
+ regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+ };
+
vreg_l10c_3p3: ldo10 {
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3312000>;
@@ -337,6 +343,12 @@ vreg_l10e_2p9: ldo10 {
regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
};
+ vreg_l12e_1p8: ldo12 {
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+ };
+
vreg_l16e_3p0: ldo16 {
regulator-min-microvolt = <3072000>;
regulator-max-microvolt = <3072000>;
@@ -365,11 +377,19 @@ &i2c1 {
touchscreen@10 {
compatible = "hid-over-i2c";
reg = <0x10>;
+
hid-descr-addr = <0x1>;
+ reset-gpios = <&tlmm 54 GPIO_ACTIVE_LOW>;
+
+ vdd-supply = <&vreg_l4c_3p3>;
+ vddl-supply = <&vreg_l12e_1p8>;
+
+ post-power-on-delay-ms = <3>;
+ post-reset-deassert-delay-ms = <200>;
interrupts-extended = <&tlmm 122 IRQ_TYPE_LEVEL_LOW>;
- pinctrl-0 = <&ts_int_default>;
+ pinctrl-0 = <&ts_int_default>, <&ts_reset_default>;
pinctrl-names = "default";
};
};
@@ -735,6 +755,14 @@ ts_int_default: ts-int-default-state {
drive-strength = <2>;
};
+ ts_reset_default: ts-reset-default-state {
+ pins = "gpio54";
+ function = "gpio";
+
+ bias-disable;
+ drive-strength = <16>;
+ };
+
usbprim_sbu_default: usbprim-sbu-state {
oe-n-pins {
pins = "gpio152";
--
2.42.0
The UFS driver expects to be able to set load (and by extension, mode)
on the supplied regulators. Add the necessary properties to make that
possible.
Based on https://lore.kernel.org/r/[email protected]
Signed-off-by: Anton Bambura <[email protected]>
Reviewed-by: Konrad Dybcio <[email protected]>
---
arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
index 0bfc655e9a31..a41958f9ef2b 100644
--- a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
+++ b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
@@ -335,12 +335,18 @@ vreg_l7e_1p8: ldo7 {
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+ regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
+ RPMH_REGULATOR_MODE_HPM>;
+ regulator-allow-set-load;
};
vreg_l10e_2p9: ldo10 {
regulator-min-microvolt = <2904000>;
regulator-max-microvolt = <2904000>;
regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+ regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
+ RPMH_REGULATOR_MODE_HPM>;
+ regulator-allow-set-load;
};
vreg_l12e_1p8: ldo12 {
--
2.42.0
This solves the issue when touchpad gets stuck on right or middle
click. This also makes touchpad working smoother.
Signed-off-by: Anton Bambura <[email protected]>
---
arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
index 5bf6285f905f..0bfc655e9a31 100644
--- a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
+++ b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
@@ -395,7 +395,7 @@ touchscreen@10 {
};
&i2c7 {
- clock-frequency = <100000>;
+ clock-frequency = <1000000>;
pinctrl-0 = <&i2c7_active>;
pinctrl-names = "default";
--
2.42.0
On 3.02.2024 20:11, Anton Bambura wrote:
> This solves the issue when touchpad gets stuck on right or middle
> click. This also makes touchpad working smoother.
>
> Signed-off-by: Anton Bambura <[email protected]>
> ---
Reviewed-by: Konrad Dybcio <[email protected]>
Konrad
On 3.02.2024 20:11, Anton Bambura wrote:
> Set regulators, reset gpio and delays according to ACPI tables.
>
> Signed-off-by: Anton Bambura <[email protected]>
> ---
Reviewed-by: Konrad Dybcio <[email protected]>
Konrad
On 3.02.2024 20:11, Anton Bambura wrote:
> Split keyboard and touchpad pinctrl nodes since they are for different
> devices and move keyboard, touchpad and touchscreen pinctrl references to
> appropriate nodes.
>
> Signed-off-by: Anton Bambura <[email protected]>
> ---
Reviewed-by: Konrad Dybcio <[email protected]>
Konrad
On Sat, Feb 03, 2024 at 09:11:58PM +0200, Anton Bambura wrote:
> Set regulators, reset gpio and delays according to ACPI tables.
>
> Signed-off-by: Anton Bambura <[email protected]>
> ---
> .../boot/dts/qcom/sc8180x-lenovo-flex-5g.dts | 30 ++++++++++++++++++-
> 1 file changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
> index 6ae6cb030b70..5bf6285f905f 100644
> --- a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
> +++ b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
> @@ -271,6 +271,12 @@ vreg_l3c_1p2: ldo3 {
> regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
> };
>
> + vreg_l4c_3p3: ldo4 {
> + regulator-min-microvolt = <3296000>;
> + regulator-max-microvolt = <3304000>;
> + regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
> + };
> +
> vreg_l10c_3p3: ldo10 {
> regulator-min-microvolt = <3000000>;
> regulator-max-microvolt = <3312000>;
> @@ -337,6 +343,12 @@ vreg_l10e_2p9: ldo10 {
> regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
> };
>
> + vreg_l12e_1p8: ldo12 {
> + regulator-min-microvolt = <1800000>;
> + regulator-max-microvolt = <1800000>;
> + regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
> + };
> +
> vreg_l16e_3p0: ldo16 {
> regulator-min-microvolt = <3072000>;
> regulator-max-microvolt = <3072000>;
> @@ -365,11 +377,19 @@ &i2c1 {
> touchscreen@10 {
> compatible = "hid-over-i2c";
> reg = <0x10>;
> +
> hid-descr-addr = <0x1>;
> + reset-gpios = <&tlmm 54 GPIO_ACTIVE_LOW>;
> +
> + vdd-supply = <&vreg_l4c_3p3>;
> + vddl-supply = <&vreg_l12e_1p8>;
> +
> + post-power-on-delay-ms = <3>;
> + post-reset-deassert-delay-ms = <200>;
As I ran into with the X13s, post-reset-deassert-delay-ms is not an
accepted property for hid-over-i2c. I think the desired path forward is
to extend elan,ekth6915.yaml and i2c-hid-of-elan.c and hard code these
values there instead.
But I suspect you, like me, are unaware of the actual name of the
device? Perhaps it's acceptable to make something up based on the
reported product id?
Regards,
Bjorn
>
> interrupts-extended = <&tlmm 122 IRQ_TYPE_LEVEL_LOW>;
>
> - pinctrl-0 = <&ts_int_default>;
> + pinctrl-0 = <&ts_int_default>, <&ts_reset_default>;
> pinctrl-names = "default";
> };
> };
> @@ -735,6 +755,14 @@ ts_int_default: ts-int-default-state {
> drive-strength = <2>;
> };
>
> + ts_reset_default: ts-reset-default-state {
> + pins = "gpio54";
> + function = "gpio";
> +
> + bias-disable;
> + drive-strength = <16>;
> + };
> +
> usbprim_sbu_default: usbprim-sbu-state {
> oe-n-pins {
> pins = "gpio152";
> --
> 2.42.0
>
On Sat, 03 Feb 2024 21:11:54 +0200, Anton Bambura wrote:
> This improves device-tree of Lenovo Flex/Yoga 5G laptop with these changes:
> - fix GPU firmware path (make it use device-specific firmware directory);
> - set names for i2c hid nodes (so it is clear which node corresponds to
> which device);
> - add touchscreen support;
> - fix touchpad issue when it gets stuck on right or middle click;
> - allow UFS regulators load/mode setting;
> - move some pinctrl properties to appropriate nodes.
>
> [...]
Applied, thanks!
[1/6] arm64: dts: qcom: sc8180x-lenovo-flex-5g: fix GPU firmware path
commit: 4aa609a922e3ce387d18d8e7327d3912f0a85653
[2/6] arm64: dts: qcom: sc8180x-lenovo-flex-5g: set names for i2c hid nodes
commit: 8c28575a4aba092feb5a5ca0b446eb8a0fa39396
[3/6] arm64: dts: qcom: sc8180x-lenovo-flex-5g: move pinctrl to appropriate nodes
commit: 0d76ffe33e5eb5b0a7bd09e4fa8a72f7f4cfbc0d
[5/6] arm64: dts: qcom: sc8180x-lenovo-flex-5g: set touchpad i2c frequency to 1 MHz
commit: 46c2f36e76a018c269d236ec1a1cca03fe5bb47b
[6/6] arm64: dts: qcom: sc8180x-lenovo-flex-5g: Allow UFS regulators load/mode setting
commit: 42ee55cb2e27d8bf3d26b8c4199727df029a5878
Best regards,
--
Bjorn Andersson <[email protected]>
March 18, 2024 at 4:43 AM, "Bjorn Andersson" <[email protected]> wrote:
>
> On Sat, Feb 03, 2024 at 09:11:58PM +0200, Anton Bambura wrote:
>
> >
> > Set regulators, reset gpio and delays according to ACPI tables.
> >
> >
> >
> > Signed-off-by: Anton Bambura <[email protected]>
> >
> > ---
> >
> > .../boot/dts/qcom/sc8180x-lenovo-flex-5g.dts | 30 ++++++++++++++++++-
> >
> > 1 file changed, 29 insertions(+), 1 deletion(-)
> >
> >
> >
> > diff --git a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
> >
> > index 6ae6cb030b70..5bf6285f905f 100644
> >
> > --- a/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
> >
> > +++ b/arch/arm64/boot/dts/qcom/sc8180x-lenovo-flex-5g.dts
> >
> > @@ -271,6 +271,12 @@ vreg_l3c_1p2: ldo3 {
> >
> > regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
> >
> > };
> >
> >
> >
> > + vreg_l4c_3p3: ldo4 {
> >
> > + regulator-min-microvolt = <3296000>;
> >
> > + regulator-max-microvolt = <3304000>;
> >
> > + regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
> >
> > + };
> >
> > +
> >
> > vreg_l10c_3p3: ldo10 {
> >
> > regulator-min-microvolt = <3000000>;
> >
> > regulator-max-microvolt = <3312000>;
> >
> > @@ -337,6 +343,12 @@ vreg_l10e_2p9: ldo10 {
> >
> > regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
> >
> > };
> >
> >
> >
> > + vreg_l12e_1p8: ldo12 {
> >
> > + regulator-min-microvolt = <1800000>;
> >
> > + regulator-max-microvolt = <1800000>;
> >
> > + regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
> >
> > + };
> >
> > +
> >
> > vreg_l16e_3p0: ldo16 {
> >
> > regulator-min-microvolt = <3072000>;
> >
> > regulator-max-microvolt = <3072000>;
> >
> > @@ -365,11 +377,19 @@ &i2c1 {
> >
> > touchscreen@10 {
> >
> > compatible = "hid-over-i2c";
> >
> > reg = <0x10>;
> >
> > +
> >
> > hid-descr-addr = <0x1>;
> >
> > + reset-gpios = <&tlmm 54 GPIO_ACTIVE_LOW>;
> >
> > +
> >
> > + vdd-supply = <&vreg_l4c_3p3>;
> >
> > + vddl-supply = <&vreg_l12e_1p8>;
> >
> > +
> >
> > + post-power-on-delay-ms = <3>;
> >
> > + post-reset-deassert-delay-ms = <200>;
> >
>
> As I ran into with the X13s, post-reset-deassert-delay-ms is not an
>
> accepted property for hid-over-i2c. I think the desired path forward is
>
> to extend elan,ekth6915.yaml and i2c-hid-of-elan.c and hard code these
>
> values there instead.
>
> But I suspect you, like me, are unaware of the actual name of the
>
> device? Perhaps it's acceptable to make something up based on the
>
> reported product id?
Indeed, I don't know the actual IC. evtest reports this:
Input device ID: bus 0x18 vendor 0x4f3 product 0x2a7d version 0x100
Input device name: "hid-over-i2c 04F3:2A7D"
>
> Regards,
>
> Bjorn
>
> >
> > interrupts-extended = <&tlmm 122 IRQ_TYPE_LEVEL_LOW>;
> >
> >
> >
> > - pinctrl-0 = <&ts_int_default>;
> >
> > + pinctrl-0 = <&ts_int_default>, <&ts_reset_default>;
> >
> > pinctrl-names = "default";
> >
> > };
> >
> > };
> >
> > @@ -735,6 +755,14 @@ ts_int_default: ts-int-default-state {
> >
> > drive-strength = <2>;
> >
> > };
> >
> >
> >
> > + ts_reset_default: ts-reset-default-state {
> >
> > + pins = "gpio54";
> >
> > + function = "gpio";
> >
> > +
> >
> > + bias-disable;
> >
> > + drive-strength = <16>;
> >
> > + };
> >
> > +
> >
> > usbprim_sbu_default: usbprim-sbu-state {
> >
> > oe-n-pins {
> >
> > pins = "gpio152";
> >
> > --
> >
> > 2.42.0
> >
>