2022-12-09 17:46:47

by Doug Anderson

[permalink] [raw]
Subject: [PATCH v3 0/4] arm64: dts: qcom: sc7180: Make pazquel360's touchscreen work

This series of patches adds / fixes problems with pazquel360's
touchscreen. A few notes here:

1. Originally the touchscreen was supposed to be added as part of the
first landing of the pazquel360 device tree. ...but the fact that
Yunlong changed email addresses seems to have messed up Bjorn's
scripts. What landed was v3 [1] instead of v5 [2]. The pazquel360 part
of this series is that diff (minus the incorrect 'hid-descr-addr' property).

2. We delayed sending the fixup till now because soon after the series
landed upstream we found that some laptops were having trouble
initting the touchscreen in cases where the eDP/touchscreen regulator
was left on by the bootloader. We've been struggling to make sense of
all of this. As part of this investigation we landed a85fbd649844
("Input: elants_i2c - properly handle the reset GPIO when power is
off") but that wasn't enough. That fix, together with the fixes in
this series, is enough though.

3. In v1 and v2, this series included an elan driver patch too. That's
landed, so v3 is just device tree stuff. It turns out that with
_just_ the device tree changes things are actually working OK but
the timing is tight, so getting a little extra breathing room
from the Linux driver was nice.

4. Despite the fact that we did debugging here on pazquel360, many of
the changes here are made in general for trogdor devices. I believe
that this will make the timing more correct on those devices even if
we weren't actually seeing problems.

[1] https://lore.kernel.org/r/20220901024827.v3.2.Iea2d2918adfff2825b87d428b5732717425c196f@changeid
[2] https://lore.kernel.org/r/20220923083657.v5.3.Iea2d2918adfff2825b87d428b5732717425c196f@changeid

Changes in v3:
- Removed hid-descr-addr

Changes in v2:
- Fix typo in commit message (Matthias)

Douglas Anderson (4):
arm64: dts: qcom: sc7180: Bump up trogdor ts_reset_l drive strength
arm64: dts: qcom: sc7180: Add trogdor eDP/touchscreen regulator
off-on-time
arm64: dts: qcom: sc7180: Start the trogdor eDP/touchscreen regulator
on
arm64: dts: qcom: sc7180: Add pazquel360 touschreen

.../dts/qcom/sc7180-trogdor-homestar.dtsi | 18 +++++++++++++++++
.../qcom/sc7180-trogdor-parade-ps8640.dtsi | 20 +++++++++++++++++++
.../dts/qcom/sc7180-trogdor-pazquel360.dtsi | 19 ++++++++++++++++++
.../dts/qcom/sc7180-trogdor-ti-sn65dsi86.dtsi | 20 +++++++++++++++++++
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 10 +++++++++-
5 files changed, 86 insertions(+), 1 deletion(-)

--
2.39.0.rc1.256.g54fd8350bd-goog


2022-12-09 17:47:25

by Doug Anderson

[permalink] [raw]
Subject: [PATCH v3 1/4] arm64: dts: qcom: sc7180: Bump up trogdor ts_reset_l drive strength

On at least one board (pazquel360) the reset line for the touchscreen
was scoped and found to take almost 2 ms to fall when we drove it
low. This wasn't great because the Linux driver for the touchscreen
(the elants_i2c driver) thinks it can do a 500 us reset pulse. If we
bump the drive strength to 8 mA then the reset line went down in ~421
us.

NOTE: we could apply this fix just for pazquel360, but:
* Probably other trogdor devices have similar timings and it's just
that nobody has noticed it before.
* There are other trogdor boards using the same elan driver that tries
to do 500 us reset pulses.
* Bumping the drive strength to 8mA across the board won't hurt. This
isn't a high speed signal or anything.

Signed-off-by: Douglas Anderson <[email protected]>
Reviewed-by: Matthias Kaehlcke <[email protected]>
---

(no changes since v1)

arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index f1defb94d670..ff1c7aa6a722 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -1376,7 +1376,15 @@ ts_reset_l: ts-reset-l-state {
pins = "gpio8";
function = "gpio";
bias-disable;
- drive-strength = <2>;
+
+ /*
+ * The reset GPIO to the touchscreen takes almost 2ms to drop
+ * at the default drive strength. When we bump it up to 8mA it
+ * falls in under 500us. We want this to be fast since the Elan
+ * datasheet (and any drivers written based on it) talk about using
+ * a 500 us reset pulse.
+ */
+ drive-strength = <8>;
};

sdc1_on: sdc1-on-state {
--
2.39.0.rc1.256.g54fd8350bd-goog

2022-12-09 17:48:15

by Doug Anderson

[permalink] [raw]
Subject: [PATCH v3 3/4] arm64: dts: qcom: sc7180: Start the trogdor eDP/touchscreen regulator on

Now that we've added the `off-on-delay-us` for the touchpanel
regulator, we can see that we're actually hitting that delay at
bootup. I saw about 200 ms of delay.

Let's avoid that delay by starting the regulator on. We'll only do
this for eDP devices for the time being.

NOTE: we _won't_ do this for homestar. Homestar's panel really likes
to be power cycled. It's why the Linux driver for this panel has a
pm_runtime_put_sync_suspend() when the panel is being unprepared but
the normal panel-edp driver doesn't. It's also why this hardware has a
separate power rail for eDP vs. touchscreen, unlike all the other
trogdor boards. We won't start homestar's regulator on. While this
could mean a slight delay on homestar, it is probably a _correct_
delay. The bootloader might have left the regulator on (it does so in
dev and recovery modes), so if we turned the regulator off at probe
time and we actually hit the delay then we were probably violating T12
in the panel spec.

Signed-off-by: Douglas Anderson <[email protected]>
Reviewed-by: Matthias Kaehlcke <[email protected]>
---

(no changes since v1)

.../boot/dts/qcom/sc7180-trogdor-homestar.dtsi | 18 ++++++++++++++++++
.../dts/qcom/sc7180-trogdor-parade-ps8640.dtsi | 8 ++++++++
.../dts/qcom/sc7180-trogdor-ti-sn65dsi86.dtsi | 8 ++++++++
3 files changed, 34 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi
index d3cf64c16dcd..b3ba23a88a0b 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi
@@ -85,6 +85,24 @@ map1 {
};
};

+/*
+ * ADDITIONS TO FIXED REGULATORS DEFINED IN PARENT DEVICE TREE FILES
+ *
+ * Sort order matches the order in the parent files (parents before children).
+ */
+
+&pp3300_dx_edp {
+ /*
+ * The atna33xc20 really likes to be power cycled to keep it from
+ * getting in a bad state. This is the reason that the touchscreen
+ * rail and eDP rails are separate from each other on homestar (but
+ * not other trogdor devices) Make sure it starts "off" at bootup.
+ */
+ /delete-property/ regulator-boot-on;
+};
+
+/* ADDITIONS TO NODES DEFINED IN PARENT DEVICE TREE FILES */
+
ap_ts_pen_1v8: &i2c4 {
status = "okay";
clock-frequency = <400000>;
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-parade-ps8640.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-parade-ps8640.dtsi
index e27a769f8cd4..5aa7949b5328 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-parade-ps8640.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-parade-ps8640.dtsi
@@ -34,6 +34,14 @@ pp3300_brij_ps8640: pp3300-brij-ps8640-regulator {

&pp3300_dx_edp {
off-on-delay-us = <500000>;
+
+ /*
+ * It's nicer to start with this regulator enabled. The
+ * bootloader may have left it on and it's nice not to cause an
+ * extra power cycle of the touchscreen and eDP panel at bootup.
+ * This should help speed bootup because we have off-on-delay-us.
+ */
+ regulator-boot-on;
};

/* ADDITIONS TO NODES DEFINED IN PARENT DEVICE TREE FILES */
diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-ti-sn65dsi86.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-ti-sn65dsi86.dtsi
index 3188788306d0..e52b8776755d 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-ti-sn65dsi86.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-ti-sn65dsi86.dtsi
@@ -15,6 +15,14 @@

&pp3300_dx_edp {
off-on-delay-us = <500000>;
+
+ /*
+ * It's nicer to start with this regulator enabled. The
+ * bootloader may have left it on and it's nice not to cause an
+ * extra power cycle of the touchscreen and eDP panel at bootup.
+ * This should help speed bootup because we have off-on-delay-us.
+ */
+ regulator-boot-on;
};

/* ADDITIONS TO NODES DEFINED IN PARENT DEVICE TREE FILES */
--
2.39.0.rc1.256.g54fd8350bd-goog

2022-12-09 18:08:19

by Doug Anderson

[permalink] [raw]
Subject: [PATCH v3 4/4] arm64: dts: qcom: sc7180: Add pazquel360 touschreen

The touchscreen was supposed to have been added when pazquel360 first
was added upstream but was missed. Add it now.

Signed-off-by: Douglas Anderson <[email protected]>
Reviewed-by: Matthias Kaehlcke <[email protected]>
---

Changes in v3:
- Removed hid-descr-addr

.../dts/qcom/sc7180-trogdor-pazquel360.dtsi | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel360.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel360.dtsi
index 5702325d0c7b..ff9dd6857f8b 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel360.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel360.dtsi
@@ -14,6 +14,25 @@ &alc5682 {
realtek,dmic-clk-rate-hz = <2048000>;
};

+ap_ts_pen_1v8: &i2c4 {
+ status = "okay";
+ clock-frequency = <400000>;
+
+ ap_ts: touchscreen@10 {
+ compatible = "elan,ekth3915", "elan,ekth3500";
+ reg = <0x10>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&ts_int_l>, <&ts_reset_l>;
+
+ interrupt-parent = <&tlmm>;
+ interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
+
+ vcc33-supply = <&pp3300_ts>;
+ vccio-supply = <&pp1800_l10a>;
+ reset-gpios = <&tlmm 8 GPIO_ACTIVE_LOW>;
+ };
+};
+
&keyboard_controller {
function-row-physmap = <
MATRIX_KEY(0x00, 0x02, 0) /* T1 */
--
2.39.0.rc1.256.g54fd8350bd-goog

2022-12-10 11:35:47

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH v3 1/4] arm64: dts: qcom: sc7180: Bump up trogdor ts_reset_l drive strength



On 9.12.2022 18:12, Douglas Anderson wrote:
> On at least one board (pazquel360) the reset line for the touchscreen
> was scoped and found to take almost 2 ms to fall when we drove it
> low. This wasn't great because the Linux driver for the touchscreen
> (the elants_i2c driver) thinks it can do a 500 us reset pulse. If we
> bump the drive strength to 8 mA then the reset line went down in ~421
> us.
>
> NOTE: we could apply this fix just for pazquel360, but:
> * Probably other trogdor devices have similar timings and it's just
> that nobody has noticed it before.
> * There are other trogdor boards using the same elan driver that tries
> to do 500 us reset pulses.
> * Bumping the drive strength to 8mA across the board won't hurt. This
> isn't a high speed signal or anything.
>
> Signed-off-by: Douglas Anderson <[email protected]>
> Reviewed-by: Matthias Kaehlcke <[email protected]>
> ---
Reviewed-by: Konrad Dybcio <[email protected]>

Konrad
>
> (no changes since v1)
>
> arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
> index f1defb94d670..ff1c7aa6a722 100644
> --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
> @@ -1376,7 +1376,15 @@ ts_reset_l: ts-reset-l-state {
> pins = "gpio8";
> function = "gpio";
> bias-disable;
> - drive-strength = <2>;
> +
> + /*
> + * The reset GPIO to the touchscreen takes almost 2ms to drop
> + * at the default drive strength. When we bump it up to 8mA it
> + * falls in under 500us. We want this to be fast since the Elan
> + * datasheet (and any drivers written based on it) talk about using
> + * a 500 us reset pulse.
> + */
> + drive-strength = <8>;
> };
>
> sdc1_on: sdc1-on-state {

2022-12-28 03:37:47

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH v3 4/4] arm64: dts: qcom: sc7180: Add pazquel360 touschreen

On Fri, Dec 09, 2022 at 09:12:40AM -0800, Douglas Anderson wrote:
> The touchscreen was supposed to have been added when pazquel360 first
> was added upstream but was missed. Add it now.
>
> Signed-off-by: Douglas Anderson <[email protected]>
> Reviewed-by: Matthias Kaehlcke <[email protected]>
> ---
>
> Changes in v3:
> - Removed hid-descr-addr
>
> .../dts/qcom/sc7180-trogdor-pazquel360.dtsi | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel360.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel360.dtsi
> index 5702325d0c7b..ff9dd6857f8b 100644
> --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel360.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel360.dtsi
> @@ -14,6 +14,25 @@ &alc5682 {
> realtek,dmic-clk-rate-hz = <2048000>;
> };
>
> +ap_ts_pen_1v8: &i2c4 {
> + status = "okay";

I'm told that we want status to be the last property, so I moved it
one step down as I applied the patch.

Thanks,
Bjorn

> + clock-frequency = <400000>;
> +
> + ap_ts: touchscreen@10 {
> + compatible = "elan,ekth3915", "elan,ekth3500";
> + reg = <0x10>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&ts_int_l>, <&ts_reset_l>;
> +
> + interrupt-parent = <&tlmm>;
> + interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
> +
> + vcc33-supply = <&pp3300_ts>;
> + vccio-supply = <&pp1800_l10a>;
> + reset-gpios = <&tlmm 8 GPIO_ACTIVE_LOW>;
> + };
> +};
> +
> &keyboard_controller {
> function-row-physmap = <
> MATRIX_KEY(0x00, 0x02, 0) /* T1 */
> --
> 2.39.0.rc1.256.g54fd8350bd-goog
>

2022-12-28 05:26:00

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] arm64: dts: qcom: sc7180: Make pazquel360's touchscreen work

On Fri, 9 Dec 2022 09:12:36 -0800, Douglas Anderson wrote:
> This series of patches adds / fixes problems with pazquel360's
> touchscreen. A few notes here:
>
> 1. Originally the touchscreen was supposed to be added as part of the
> first landing of the pazquel360 device tree. ...but the fact that
> Yunlong changed email addresses seems to have messed up Bjorn's
> scripts. What landed was v3 [1] instead of v5 [2]. The pazquel360 part
> of this series is that diff (minus the incorrect 'hid-descr-addr' property).
>
> [...]

Applied, thanks!

[1/4] arm64: dts: qcom: sc7180: Bump up trogdor ts_reset_l drive strength
commit: 9506a3661258d07a60b186f667b391708ddf63ac
[2/4] arm64: dts: qcom: sc7180: Add trogdor eDP/touchscreen regulator off-on-time
commit: f5b4811e8758fed76da4f54f6efa1452bc878595
[3/4] arm64: dts: qcom: sc7180: Start the trogdor eDP/touchscreen regulator on
commit: 23ff866987de2910de4a1060e9b0e112376c0dd0
[4/4] arm64: dts: qcom: sc7180: Add pazquel360 touschreen
commit: 335fe4b79838a7c722d21c15784f7ed1172a6c81

Best regards,
--
Bjorn Andersson <[email protected]>