arm64: dts: qcom: sc7180: Make pazquel360's touchscreen work
Subsystems (5)
v3 cover 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(-)
Signature · 1 line
2.39.0.rc1.256.g54fd8350bd-goog
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.
---
(no changes since v1)
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +9 -1
@@ -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 {
Signature · 1 line
2.39.0.rc1.256.g54fd8350bd-goog
Re: [PATCH v3 1/4] arm64: dts: qcom: sc7180: Bump up trogdor ts_reset_l drive strength
Quoted 15 lines · Douglas Anderson
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_i2cdriver) 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.
Quoted 3 lines
Signed-off-by Douglas Anderson <[email protected]>Reviewed-by Matthias Kaehlcke <[email protected]>---
Konrad
Quoted 27 lines
(no changes since v1)
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +9
-1@@ -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 {
PATCH v3 2/4 arm64: dts: qcom: sc7180: Add trogdor eDP/touchscreen regulator off-on-time
In reply to Douglas AndersonIn general, the timing diagrams for components specify a minimum time for power cycling the component. When we remove power from a device we need to let the device fully discharge and get to a quiescent state before applying power again. If we power a device on too soon then it might not have fully powered off and might be in a weird in-between / invalid state.
eDP panels typically have a time that's at least 500 ms here. You can see that in Linux's panel-edp driver nearly every device specifies a "unprepare" time of at least 500 ms. This is a common minimum and the 500 ms is even in the example in the eDP spec.
In Linux, the "panel-edp" driver enforces this delay for its own control of the regulator, but the "panel-edp" driver can't do anything about other control of the regulator (for instance, by the touchpanel driver).
Let's add 500 ms as a board constraint for the regulator that's used for eDP/touchpanel on trogdor boards. If a given trogdor board stuffs only panels that can use a shorter time or stuff some panels that need a larger time then they can manually adjust this timing.
We'll only do this minimum delay for trogdor devices with eDP (ones that use either bridge chip), not for devices with MIPI panels. MIPI panels could have similar constraints but the 500 ms isn't necessarily as standard and there are no known cases where this delay is needed.
For most trogdor boards, this doesn't actually seem to affect anything when testing against shipping Linux. However, with pazqel360 it seems that this does make a difference. It seems that the touchscreen on this board _also_ needs some time for the regulator to discharge. That time is much less than 500 ms, so we'll just put the eDP panel 500 ms in there since the board constraint should be the "max" of the components.
---
(no changes since v2)
Changes in v2:
- Fix typo in commit message (Matthias)
.../boot/dts/qcom/sc7180-trogdor-parade-ps8640.dtsi | 12 ++++++++++++ .../boot/dts/qcom/sc7180-trogdor-ti-sn65dsi86.dtsi | 12 ++++++++++++ 2 files changed, 24 insertions(+)
arch/arm64/boot/dts/qcom/sc7180-trogdor-parade-ps8640.dtsi +12 -0
@@ -26,6 +26,18 @@ pp3300_brij_ps8640: pp3300-brij-ps8640-regulator { }; }; +/* + * 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 { + off-on-delay-us = <500000>; +}; + +/* ADDITIONS TO NODES DEFINED IN PARENT DEVICE TREE FILES */ + &dsi0_out { remote-endpoint = <&ps8640_in>; };
arch/arm64/boot/dts/qcom/sc7180-trogdor-ti-sn65dsi86.dtsi +12 -0
@@ -7,6 +7,18 @@ #include <dt-bindings/gpio/gpio.h> +/* + * 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 { + off-on-delay-us = <500000>; +}; + +/* ADDITIONS TO NODES DEFINED IN PARENT DEVICE TREE FILES */ + &dsi0_out { remote-endpoint = <&sn65dsi86_in>; };
Signature · 1 line
2.39.0.rc1.256.g54fd8350bd-goog
PATCH v3 3/4 arm64: dts: qcom: sc7180: Start the trogdor eDP/touchscreen regulator on
In reply to Douglas AndersonNow 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.
---
(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(+)
arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi +18 -0
@@ -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>;
arch/arm64/boot/dts/qcom/sc7180-trogdor-parade-ps8640.dtsi +8 -0
@@ -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 */
arch/arm64/boot/dts/qcom/sc7180-trogdor-ti-sn65dsi86.dtsi +8 -0
@@ -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 */
Signature · 1 line
2.39.0.rc1.256.g54fd8350bd-goog
PATCH v3 4/4 arm64: dts: qcom: sc7180: Add pazquel360 touschreen
In reply to Douglas AndersonThe touchscreen was supposed to have been added when pazquel360 first was added upstream but was missed. Add it now.
---
Changes in v3:
- Removed hid-descr-addr
.../dts/qcom/sc7180-trogdor-pazquel360.dtsi | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel360.dtsi +19 -0
@@ -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 */
Signature · 1 line
2.39.0.rc1.256.g54fd8350bd-goog
Bjorn Andersson
maintainerRe: [PATCH v3 4/4] arm64: dts: qcom: sc7180: Add pazquel360 touschreen
Quoted 18 lines · Douglas Anderson
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(+)arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel360.dtsi +0
-0
arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel360.dtsi &alc5682 { · line 18
Quoted 5 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel360.dtsi +2
-0@@ -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
Quoted 23 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel360.dtsi +17
-0+ 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 */Signature · 1 line
2.39.0.rc1.256.g54fd8350bd-goog
Quoted 10 lines · Douglas Anderson
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: 335fe4b79838a7c722d21c15784f7ed1172a6c81Best regards,
Signature · 1 line
Bjorn Andersson <[email protected]>