mbox series

[v3,0/3] Support wakeup methods of Atmel maXTouch controllers

Message ID 20201206212217.6857-1-digetx@gmail.com (mailing list archive)
Headers show
Series Support wakeup methods of Atmel maXTouch controllers | expand

Message

Dmitry Osipenko Dec. 6, 2020, 9:22 p.m. UTC
Some Atmel maXTouch controllers, like mXT1386 and mXT3432S1 for example,
have a WAKE line that needs to be asserted in order to wake controller
from a deep sleep, otherwise it will be unusable. This series implements
support for the wakeup methods in accordance to the mXT1386 datasheet [1],
see page 29 (chapter "5.8 WAKE Line").

The mXT1386 is a widely used controller found on many older Android tablet
devices. Touchscreen on Acer A500 tablet now works properly after this
series.

This patchset is a continuation of the work originally started by
Jiada Wang [2].

[1] https://ww1.microchip.com/downloads/en/DeviceDoc/mXT1386_1vx_Datasheet_LX.pdf
[2] https://patchwork.kernel.org/project/linux-input/list/?series=357875

Changelog:

v3: - Added "default: 0" to the atmel,wakeup-method property in the binding.

    - Added r-b from Linus Walleij to the binding patch.

    - The wake-GPIO is now toggled on touchscreen's start/stop in order to
      allow it to sleep during suspend. Suggested by Linus Walleij.

v2: - Fixed copy-paste bug in the code.

Dmitry Osipenko (3):
  dt-bindings: input: atmel_mxt_ts: Document atmel,wakeup-method and
    wake-GPIO
  Input: atmel_mxt_ts - support wakeup methods
  ARM: tegra: acer-a500: Add atmel,wakeup-method property

 .../bindings/input/atmel,maxtouch.yaml        | 29 +++++++
 .../boot/dts/tegra20-acer-a500-picasso.dts    |  3 +
 drivers/input/touchscreen/atmel_mxt_ts.c      | 78 +++++++++++++++++++
 include/dt-bindings/input/atmel-maxtouch.h    | 10 +++
 4 files changed, 120 insertions(+)
 create mode 100644 include/dt-bindings/input/atmel-maxtouch.h

Comments

Dmitry Torokhov Dec. 12, 2020, 2:43 a.m. UTC | #1
Hi Dmitry,

On Mon, Dec 07, 2020 at 12:22:14AM +0300, Dmitry Osipenko wrote:
> Some Atmel maXTouch controllers, like mXT1386 and mXT3432S1 for example,
> have a WAKE line that needs to be asserted in order to wake controller
> from a deep sleep, otherwise it will be unusable. This series implements
> support for the wakeup methods in accordance to the mXT1386 datasheet [1],
> see page 29 (chapter "5.8 WAKE Line").
> 
> The mXT1386 is a widely used controller found on many older Android tablet
> devices. Touchscreen on Acer A500 tablet now works properly after this
> series.

I am trying to understand how your controller is configured on that
system. Could you please enable all debug messages in the driver and
post the logs? I am a bit confused why the controller needs to be woken
up twice in mxt_start() given that according to the spec it is supposed
to stay up for 2 seconds after successful I2C transfer...

Thanks!
Dmitry Osipenko Dec. 12, 2020, 7:54 a.m. UTC | #2
Hello,

12.12.2020 05:43, Dmitry Torokhov пишет:
> Hi Dmitry,
> 
> On Mon, Dec 07, 2020 at 12:22:14AM +0300, Dmitry Osipenko wrote:
>> Some Atmel maXTouch controllers, like mXT1386 and mXT3432S1 for example,
>> have a WAKE line that needs to be asserted in order to wake controller
>> from a deep sleep, otherwise it will be unusable. This series implements
>> support for the wakeup methods in accordance to the mXT1386 datasheet [1],
>> see page 29 (chapter "5.8 WAKE Line").
>>
>> The mXT1386 is a widely used controller found on many older Android tablet
>> devices. Touchscreen on Acer A500 tablet now works properly after this
>> series.
> 
> I am trying to understand how your controller is configured on that
> system. Could you please enable all debug messages in the driver and
> post the logs? I am a bit confused why the controller needs to be woken
> up twice in mxt_start() given that according to the spec it is supposed
> to stay up for 2 seconds after successful I2C transfer...

From the page 30 in the datasheet:

"Note that when the mXT1386 is sent into deep sleep mode, it goes to
sleep immediately. In this case the two-second timeout does not apply
until the WAKE pin is asserted."

The debug log seems confirm that quote:

...
[ 1.196404] Family: 160 Variant: 0 Firmware V1.0.AA Objects: 18
[ 1.196572] T37 Start:118 Size:130 Instances:1 Report IDs:0-0
[ 1.196586] T44 Start:248 Size:1 Instances:1 Report IDs:0-0
[ 1.196597] T5 Start:249 Size:9 Instances:1 Report IDs:0-0
[ 1.196608] T6 Start:258 Size:6 Instances:1 Report IDs:1-1
[ 1.196617] T38 Start:264 Size:64 Instances:1 Report IDs:0-0
[ 1.196628] T7 Start:328 Size:3 Instances:1 Report IDs:0-0
[ 1.196638] T8 Start:331 Size:10 Instances:1 Report IDs:0-0
[ 1.196648] T9 Start:341 Size:34 Instances:1 Report IDs:2-17
[ 1.196658] T15 Start:375 Size:11 Instances:2 Report IDs:18-19
[ 1.196668] T18 Start:397 Size:2 Instances:1 Report IDs:0-0
[ 1.196678] T22 Start:399 Size:17 Instances:1 Report IDs:20-20
[ 1.196688] T24 Start:416 Size:19 Instances:1 Report IDs:21-24
[ 1.196698] T25 Start:435 Size:14 Instances:1 Report IDs:25-25
[ 1.196708] T27 Start:449 Size:7 Instances:1 Report IDs:26-26
[ 1.196718] T28 Start:456 Size:6 Instances:1 Report IDs:27-27
[ 1.196728] T40 Start:462 Size:5 Instances:1 Report IDs:0-0
[ 1.196738] T41 Start:467 Size:6 Instances:1 Report IDs:0-0
[ 1.196748] T43 Start:473 Size:6 Instances:1 Report IDs:0-0
[ 1.196852] Direct firmware load for maxtouch.cfg failed with error -2
[ 1.197305] T6 Config Checksum: 0x8D7459
[ 1.197318] T6 Status 0x90 RESET CAL
[ 1.197543] Initialized power cfg: ACTV 10, IDLE 50
[ 1.198387] Touchscreen size X1279Y799
...
[ 1.211686] T6 Status 0x00 OK
...
[15.576573] Set T7 ACTV:10 IDLE:50
[15.592142] T6 Status 0x10 CAL
[15.597920] T6 Status 0x00 OK
[15.604846] Set T7 ACTV:0 IDLE:0
[15.831477] waking up controller
[15.862912] Set T7 ACTV:10 IDLE:50
[15.872783] Set T7 ACTV:0 IDLE:0
[15.880333] T6 Status 0x10 CAL
[15.946853] Set T7 ACTV:10 IDLE:50
[15.956582] Set T7 ACTV:0 IDLE:0
...
[27.897337] waking up controller
[27.924172] Set T7 ACTV:10 IDLE:50
[27.947286] T6 Status 0x00 OK
[27.959754] Set T7 ACTV:0 IDLE:0
[27.970258] Set T7 ACTV:10 IDLE:50
[27.987546] T6 Status 0x10 CAL
[27.993327] T6 Status 0x00 OK
Dmitry Torokhov Dec. 13, 2020, 4:41 a.m. UTC | #3
On Sat, Dec 12, 2020 at 10:54:35AM +0300, Dmitry Osipenko wrote:
> Hello,
> 
> 12.12.2020 05:43, Dmitry Torokhov пишет:
> > Hi Dmitry,
> > 
> > On Mon, Dec 07, 2020 at 12:22:14AM +0300, Dmitry Osipenko wrote:
> >> Some Atmel maXTouch controllers, like mXT1386 and mXT3432S1 for example,
> >> have a WAKE line that needs to be asserted in order to wake controller
> >> from a deep sleep, otherwise it will be unusable. This series implements
> >> support for the wakeup methods in accordance to the mXT1386 datasheet [1],
> >> see page 29 (chapter "5.8 WAKE Line").
> >>
> >> The mXT1386 is a widely used controller found on many older Android tablet
> >> devices. Touchscreen on Acer A500 tablet now works properly after this
> >> series.
> > 
> > I am trying to understand how your controller is configured on that
> > system. Could you please enable all debug messages in the driver and
> > post the logs? I am a bit confused why the controller needs to be woken
> > up twice in mxt_start() given that according to the spec it is supposed
> > to stay up for 2 seconds after successful I2C transfer...
> 
> From the page 30 in the datasheet:
> 
> "Note that when the mXT1386 is sent into deep sleep mode, it goes to
> sleep immediately. In this case the two-second timeout does not apply
> until the WAKE pin is asserted."
> 
> The debug log seems confirm that quote:
> 
> ...
> [ 1.196404] Family: 160 Variant: 0 Firmware V1.0.AA Objects: 18
> [ 1.196572] T37 Start:118 Size:130 Instances:1 Report IDs:0-0
> [ 1.196586] T44 Start:248 Size:1 Instances:1 Report IDs:0-0
> [ 1.196597] T5 Start:249 Size:9 Instances:1 Report IDs:0-0
> [ 1.196608] T6 Start:258 Size:6 Instances:1 Report IDs:1-1
> [ 1.196617] T38 Start:264 Size:64 Instances:1 Report IDs:0-0
> [ 1.196628] T7 Start:328 Size:3 Instances:1 Report IDs:0-0
> [ 1.196638] T8 Start:331 Size:10 Instances:1 Report IDs:0-0
> [ 1.196648] T9 Start:341 Size:34 Instances:1 Report IDs:2-17
> [ 1.196658] T15 Start:375 Size:11 Instances:2 Report IDs:18-19
> [ 1.196668] T18 Start:397 Size:2 Instances:1 Report IDs:0-0
> [ 1.196678] T22 Start:399 Size:17 Instances:1 Report IDs:20-20
> [ 1.196688] T24 Start:416 Size:19 Instances:1 Report IDs:21-24
> [ 1.196698] T25 Start:435 Size:14 Instances:1 Report IDs:25-25
> [ 1.196708] T27 Start:449 Size:7 Instances:1 Report IDs:26-26
> [ 1.196718] T28 Start:456 Size:6 Instances:1 Report IDs:27-27
> [ 1.196728] T40 Start:462 Size:5 Instances:1 Report IDs:0-0
> [ 1.196738] T41 Start:467 Size:6 Instances:1 Report IDs:0-0
> [ 1.196748] T43 Start:473 Size:6 Instances:1 Report IDs:0-0
> [ 1.196852] Direct firmware load for maxtouch.cfg failed with error -2
> [ 1.197305] T6 Config Checksum: 0x8D7459
> [ 1.197318] T6 Status 0x90 RESET CAL
> [ 1.197543] Initialized power cfg: ACTV 10, IDLE 50
> [ 1.198387] Touchscreen size X1279Y799
> ...
> [ 1.211686] T6 Status 0x00 OK
> ...
> [15.576573] Set T7 ACTV:10 IDLE:50
> [15.592142] T6 Status 0x10 CAL
> [15.597920] T6 Status 0x00 OK
> [15.604846] Set T7 ACTV:0 IDLE:0
> [15.831477] waking up controller
> [15.862912] Set T7 ACTV:10 IDLE:50
> [15.872783] Set T7 ACTV:0 IDLE:0

Thank you for the logs. I am confused where these calls to put the
controller into deep sleep are coming from. Does something constantly
open and close input device? Do you have any additional patches? We
definitely do not issue deep sleep request in mxt_start(). Do you mind
putting dump_stack() into mxt_set_t7_power_cfg() to see where the calls
are coming from?

I also do not see additional "waking up controller" messages after
requesting the chip via T7 to be configured to be active, which I'd
expected to see if we indeed needed to wake it up again for T6 to
succeed.

Thanks.
Dmitry Osipenko Dec. 13, 2020, 9:26 a.m. UTC | #4
13.12.2020 07:41, Dmitry Torokhov пишет:
> Thank you for the logs. I am confused where these calls to put the
> controller into deep sleep are coming from. Does something constantly
> open and close input device?

Input devices are re-opened multiple times during Linux distro boot-up,
a regular Ubuntu 20.10 in this case.

> Do you have any additional patches?

No, I'm using next-20201211 + this "wakeup methods" patchset.

> We definitely do not issue deep sleep request in mxt_start(). Do you mind
> putting dump_stack() into mxt_set_t7_power_cfg() to see where the calls
> are coming from?

Please see the log below, I added it like this:

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c
b/drivers/input/touchscreen/atmel_mxt_ts.c
index e3342fdfe9f3..bbc5a5ee158a 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -2271,6 +2271,8 @@ static int mxt_set_t7_power_cfg(struct mxt_data
*data, u8 sleep)
 	dev_dbg(dev, "Set T7 ACTV:%d IDLE:%d\n",
 		new_config->active, new_config->idle);

+	dump_stack();
+
 	return 0;
 }

> I also do not see additional "waking up controller" messages after
> requesting the chip via T7 to be configured to be active, which I'd
> expected to see if we indeed needed to wake it up again for T6 to
> succeed.

I'm not familiar with what controller does internally, hence no clue.


[ 1.195295] Family: 160 Variant: 0 Firmware V1.0.AA Objects: 18
[ 1.195468] T37 Start:118 Size:130 Instances:1 Report IDs:0-0
[ 1.195482] T44 Start:248 Size:1 Instances:1 Report IDs:0-0
[ 1.195493] T5 Start:249 Size:9 Instances:1 Report IDs:0-0
[ 1.195503] T6 Start:258 Size:6 Instances:1 Report IDs:1-1
[ 1.195513] T38 Start:264 Size:64 Instances:1 Report IDs:0-0
[ 1.195523] T7 Start:328 Size:3 Instances:1 Report IDs:0-0
[ 1.195533] T8 Start:331 Size:10 Instances:1 Report IDs:0-0
[ 1.195543] T9 Start:341 Size:34 Instances:1 Report IDs:2-17
[ 1.195553] T15 Start:375 Size:11 Instances:2 Report IDs:18-19
[ 1.195563] T18 Start:397 Size:2 Instances:1 Report IDs:0-0
[ 1.195573] T22 Start:399 Size:17 Instances:1 Report IDs:20-20
[ 1.195583] T24 Start:416 Size:19 Instances:1 Report IDs:21-24
[ 1.195593] T25 Start:435 Size:14 Instances:1 Report IDs:25-25
[ 1.195602] T27 Start:449 Size:7 Instances:1 Report IDs:26-26
[ 1.195612] T28 Start:456 Size:6 Instances:1 Report IDs:27-27
[ 1.195622] T40 Start:462 Size:5 Instances:1 Report IDs:0-0
[ 1.195631] T41 Start:467 Size:6 Instances:1 Report IDs:0-0
[ 1.195641] T43 Start:473 Size:6 Instances:1 Report IDs:0-0
[ 1.195746] Direct firmware load for maxtouch.cfg failed with error -2
[ 1.196199] T6 Config Checksum: 0x8D7459
[ 1.196212] T6 Status 0x90 RESET CAL
[ 1.196428] Initialized power cfg: ACTV 10, IDLE 50
[ 1.197275] Touchscreen size X1279Y799
[ 1.210563] T6 Status 0x00 OK
[14.866461] Set T7 ACTV:10 IDLE:50
[14.866495] CPU: 1 PID: 209 Comm: systemd-udevd Tainted: G        W
[14.866507] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
[14.866523]  (unwind_backtrace) from  (show_stack)
[14.866568]  (show_stack) from  (dump_stack)
[14.866599]  (dump_stack) from  (mxt_set_t7_power_cfg)
[14.866635]  (mxt_set_t7_power_cfg) from  (mxt_start)
[14.866654]  (mxt_start) from  (mxt_input_open)
[14.866673]  (mxt_input_open) from  (input_open_device)
[14.866708]  (input_open_device) from  (evdev_open+0x113/0x134)
[14.866735]  (evdev_open) from  (chrdev_openc)
[14.866763]  (chrdev_open) from  (do_dentry_open4)
[14.866791]  (do_dentry_open) from  (path_openat+0x6b9/0xa04)
[14.866815]  (path_openat) from  (do_filp_open)
[14.866833]  (do_filp_open) from  (do_sys_openat2+0x1bf/0x23c)
[14.866850]  (do_sys_openat2) from  (do_sys_open)
[14.866872]  (do_sys_open) from  (__sys_trace_return+0x1/0x16)
[14.894683] Set T7 ACTV:0 IDLE:0
[14.894719] CPU: 1 PID: 209 Comm: systemd-udevd Tainted: G        W
[14.894732] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
[14.894748]  (unwind_backtrace) from  (show_stack)
[14.894791]  (show_stack) from  (dump_stack)
[14.894822]  (dump_stack) from  (mxt_set_t7_power_cfg)
[14.894856]  (mxt_set_t7_power_cfg) from  (mxt_stop)
[14.894875]  (mxt_stop) from  (input_close_device)
[14.894908]  (input_close_device) from  (evdev_release)
[14.894934]  (evdev_release) from  (__fput8)
[14.894958]  (__fput) from  (task_work_run)
[14.894975]  (task_work_run) from  (do_work_pending+0x38d/0x438)
[14.894991]  (do_work_pending) from  (slow_work_pending+0x9/0x16)
[14.898242] T6 Status 0x10 CAL
[15.186570] Set T7 ACTV:10 IDLE:50
[15.186594] CPU: 0 PID: 212 Comm: libinput-fuzz-e Tainted: G        W
[15.186605] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
[15.186615]  (unwind_backtrace) from  (show_stack)
[15.186648]  (show_stack) from  (dump_stack)
[15.186671]  (dump_stack) from  (mxt_set_t7_power_cfg)
[15.186699]  (mxt_set_t7_power_cfg) from  (mxt_start)
[15.186715]  (mxt_start) from  (mxt_input_open)
[15.186732]  (mxt_input_open) from  (input_open_device)
[15.186764]  (input_open_device) from  (evdev_open+0x113/0x134)
[15.186786]  (evdev_open) from  (chrdev_openc)
[15.186808]  (chrdev_open) from  (do_dentry_open4)
[15.186830]  (do_dentry_open) from  (path_openat+0x6b9/0xa04)
[15.186848]  (path_openat) from  (do_filp_open)
[15.186863]  (do_filp_open) from  (do_sys_openat2+0x1bf/0x23c)
[15.186878]  (do_sys_openat2) from  (do_sys_open)
[15.186895]  (do_sys_open) from  (__sys_trace_return+0x1/0x16)
[15.210404] T6 Status 0x00 OK
[15.229106] Set T7 ACTV:0 IDLE:0
[15.229132] CPU: 0 PID: 212 Comm: libinput-fuzz-e Tainted: G        W
[15.229148] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
[15.229164]  (unwind_backtrace) from  (show_stack)
[15.229208]  (show_stack) from  (dump_stack)
[15.229237]  (dump_stack) from  (mxt_set_t7_power_cfg)
[15.229273]  (mxt_set_t7_power_cfg) from  (mxt_stop)
[15.229294]  (mxt_stop) from  (input_close_device)
[15.229323]  (input_close_device) from  (evdev_release)
[15.229350]  (evdev_release) from  (__fput8)
[15.229370]  (__fput) from  (task_work_run)
[15.229386]  (task_work_run) from  (do_work_pending+0x38d/0x438)
[15.229402]  (do_work_pending) from  (slow_work_pending+0x9/0x16)
[15.322473] waking up controller
[15.357423] Set T7 ACTV:10 IDLE:50
[15.357450] CPU: 1 PID: 216 Comm: libinput-fuzz-t Tainted: G        W
[15.357463] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
[15.357476]  (unwind_backtrace) from  (show_stack)
[15.357510]  (show_stack) from  (dump_stack)
[15.357537]  (dump_stack) from  (mxt_set_t7_power_cfg)
[15.357566]  (mxt_set_t7_power_cfg) from  (mxt_start)
[15.357586]  (mxt_start) from  (mxt_input_open)
[15.357604]  (mxt_input_open) from  (input_open_device)
[15.357632]  (input_open_device) from  (evdev_open+0x113/0x134)
[15.357655]  (evdev_open) from  (chrdev_openc)
[15.357679]  (chrdev_open) from  (do_dentry_open4)
[15.357702]  (do_dentry_open) from  (path_openat+0x6b9/0xa04)
[15.357721]  (path_openat) from  (do_filp_open)
[15.357737]  (do_filp_open) from  (do_sys_openat2+0x1bf/0x23c)
[15.357754]  (do_sys_openat2) from  (do_sys_open)
[15.357773]  (do_sys_open) from  (__sys_trace_return+0x1/0x16)
[15.373658] Set T7 ACTV:0 IDLE:0
[15.373683] CPU: 1 PID: 216 Comm: libinput-fuzz-t Tainted: G        W
[15.373696] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
[15.373708]  (unwind_backtrace) from  (show_stack)
[15.373744]  (show_stack) from  (dump_stack)
[15.373770]  (dump_stack) from  (mxt_set_t7_power_cfg)
[15.373817]  (mxt_set_t7_power_cfg) from  (mxt_stop)
[15.373856]  (mxt_stop) from  (input_close_device)
[15.373904]  (input_close_device) from  (evdev_release)
[15.373947]  (evdev_release) from  (__fput8)
[15.373971]  (__fput) from  (task_work_run)
[15.373987]  (task_work_run) from  (do_work_pending+0x38d/0x438)
[15.374003]  (do_work_pending) from  (slow_work_pending+0x9/0x16)
[15.375130] T6 Status 0x10 CAL
[26.500032] waking up controller
[26.526733] Set T7 ACTV:10 IDLE:50
[26.526772] CPU: 1 PID: 497 Comm: Xorg Tainted: G        W
[26.526788] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
[26.526809]  (unwind_backtrace) from  (show_stack)
[26.526862]  (show_stack) from  (dump_stack)
[26.526903]  (dump_stack) from  (mxt_set_t7_power_cfg)
[26.526943]  (mxt_set_t7_power_cfg) from  (mxt_start)
[26.526965]  (mxt_start) from  (mxt_input_open)
[26.526986]  (mxt_input_open) from  (input_open_device)
[26.527023]  (input_open_device) from  (evdev_open+0x113/0x134)
[26.527051]  (evdev_open) from  (chrdev_openc)
[26.527080]  (chrdev_open) from  (do_dentry_open4)
[26.527108]  (do_dentry_open) from  (path_openat+0x6b9/0xa04)
[26.527130]  (path_openat) from  (do_filp_open)
[26.527149]  (do_filp_open) from  (do_sys_openat2+0x1bf/0x23c)
[26.527167]  (do_sys_openat2) from  (do_sys_open)
[26.527189]  (do_sys_open) from  (ret_fast_syscall+0x1/0x26)
[26.550377] T6 Status 0x00 OK
[26.564628] Set T7 ACTV:0 IDLE:0
[26.564659] CPU: 0 PID: 497 Comm: Xorg Tainted: G        W
[26.564672] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
[26.564688]  (unwind_backtrace) from  (show_stack)
[26.564729]  (show_stack) from  (dump_stack)
[26.564759]  (dump_stack) from  (mxt_set_t7_power_cfg)
[26.564793]  (mxt_set_t7_power_cfg) from  (mxt_stop)
[26.564811]  (mxt_stop) from  (input_close_device)
[26.564844]  (input_close_device) from  (evdev_release)
[26.564871]  (evdev_release) from  (__fput8)
[26.564892]  (__fput) from  (task_work_run)
[26.564909]  (task_work_run) from  (do_work_pending+0x38d/0x438)
[26.564924]  (do_work_pending) from  (slow_work_pending+0x9/0x16)
[26.575062] Set T7 ACTV:10 IDLE:50
[26.575097] CPU: 1 PID: 497 Comm: Xorg Tainted: G        W
[26.575114] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
[26.575132]  (unwind_backtrace) from  (show_stack)
[26.575189]  (show_stack) from  (dump_stack)
[26.575228]  (dump_stack) from  (mxt_set_t7_power_cfg)
[26.575269]  (mxt_set_t7_power_cfg) from  (mxt_start)
[26.575294]  (mxt_start) from  (mxt_input_open)
[26.575319]  (mxt_input_open) from  (input_open_device)
[26.575363]  (input_open_device) from  (evdev_open+0x113/0x134)
[26.575398]  (evdev_open) from  (chrdev_openc)
[26.575433]  (chrdev_open) from  (do_dentry_open4)
[26.575469]  (do_dentry_open) from  (path_openat+0x6b9/0xa04)
[26.575495]  (path_openat) from  (do_filp_open)
[26.575518]  (do_filp_open) from  (do_sys_openat2+0x1bf/0x23c)
[26.575540]  (do_sys_openat2) from  (do_sys_open)
[26.575566]  (do_sys_open) from  (ret_fast_syscall+0x1/0x26)
[26.577569] waking up controller
[26.656736] T6 Status 0x10 CAL
[26.662621] T6 Status 0x00 OK
Dmitry Osipenko Jan. 7, 2021, 10:05 p.m. UTC | #5
13.12.2020 12:26, Dmitry Osipenko пишет:
> 13.12.2020 07:41, Dmitry Torokhov пишет:
>> Thank you for the logs. I am confused where these calls to put the
>> controller into deep sleep are coming from. Does something constantly
>> open and close input device?
> 
> Input devices are re-opened multiple times during Linux distro boot-up,
> a regular Ubuntu 20.10 in this case.
> 
>> Do you have any additional patches?
> 
> No, I'm using next-20201211 + this "wakeup methods" patchset.
> 
>> We definitely do not issue deep sleep request in mxt_start(). Do you mind
>> putting dump_stack() into mxt_set_t7_power_cfg() to see where the calls
>> are coming from?
> 
> Please see the log below, I added it like this:
> 
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c
> b/drivers/input/touchscreen/atmel_mxt_ts.c
> index e3342fdfe9f3..bbc5a5ee158a 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -2271,6 +2271,8 @@ static int mxt_set_t7_power_cfg(struct mxt_data
> *data, u8 sleep)
>  	dev_dbg(dev, "Set T7 ACTV:%d IDLE:%d\n",
>  		new_config->active, new_config->idle);
> 
> +	dump_stack();
> +
>  	return 0;
>  }
> 
>> I also do not see additional "waking up controller" messages after
>> requesting the chip via T7 to be configured to be active, which I'd
>> expected to see if we indeed needed to wake it up again for T6 to
>> succeed.
> 
> I'm not familiar with what controller does internally, hence no clue.
> 
> 
> [ 1.195295] Family: 160 Variant: 0 Firmware V1.0.AA Objects: 18
> [ 1.195468] T37 Start:118 Size:130 Instances:1 Report IDs:0-0
...
Dmitry Torokhov, do you have any more comments? Are you okay with v3? If
yes, could you please pick up patches into -next?