Skip to contentSkip to conversation

New: Tablet mode not correctly reported after wake-up from hibernate

Bug 210269 [email protected] 1 participant 11 messages Nov 19, 2020 – Nov 21, 2020 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=210269

            Bug ID: 210269
           Summary: Tablet mode not correctly reported after wake-up from
                    hibernate
           Product: Drivers
           Version: 2.5
    Kernel Version: 5.9.9
          Hardware: All
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Platform_x86
          Assignee: [email protected]
          Reporter: [email protected]
        Regression: No

I'm currently using a Lenovo Thinkpad X1 Yoga 2nd Gen which is a convertible. If I fold it into tablet mode, go to hibernate / suspend, fold it back to laptop mode (while powered off) and resume the system the tablet mode on/off is not reported anymore until I fold it into tablet mode and back one time.

I debugged this via evemu-record which does not show 0 for SW_TABLET_MODE when I resume in laptop mode.

I also tested if normal sleep / suspend to RAM is affected but there SW_TABLET_MODE was correctly reported after resuming.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#1 lore raw

[Bug 210269] Tablet mode not correctly reported after wake-up from hibernate

https://bugzilla.kernel.org/show_bug.cgi?id=210269

Benjamin Berg ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #1 from Benjamin Berg ([email protected]) --- Yeah, the only thing that is missing here should be a call to dytc_lapmode_refresh at resume time.

i.e. should be as simple as:
* Adding a resume handler into dytc_driver_data
* Add a call to dytc_lapmode_refresh there

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#2 lore raw

[Bug 210269] Tablet mode not correctly reported after wake-up from hibernate

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=210269

--- Comment #2 from Benjamin Berg ([email protected]) --- Er, sorry, this is tablet mode, not lapmode …

So, it looks like we already have a call to
hotkey_tablet_mode_notify_change
in the resume handler. So I suspect that the sysfs file "hotkey_tablet_mode" has the correct value. If that is the case, we'll need to add a call to tpacpi_input_send_tabletsw into hotkey_resume.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#3 lore raw

[Bug 210269] Tablet mode not correctly reported after wake-up from hibernate

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=210269

--- Comment #3 from Julian ([email protected]) ---
Is there a way I could find out if this sysfs file has the correct value? I'm not very experienced with Kernel internals so I don't really know how to find out such stuff.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#4 lore raw

[Bug 210269] Tablet mode not correctly reported after wake-up from hibernate

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=210269

Barnabás Pőcze ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #4 from Barnabás Pőcze ([email protected]) --- If I see it correctly

cat /sys/devices/platform/thinkpad_acpi/hotkey_tablet_mode

should be the value you're looking for.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#5 lore raw

[Bug 210269] Tablet mode not correctly reported after wake-up from hibernate

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=210269

--- Comment #5 from Benjamin Berg ([email protected]) --- Yup, that should be the file (which will actually query ACPI for the status each time you read it).

Julian, would you be able to test a patch for the thinkpad module?

I could create a kernel scratch build for Fedora, not sure about other distros.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#8 lore raw

[Bug 210269] Tablet mode not correctly reported after wake-up from hibernate

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=210269

--- Comment #8 from Benjamin Berg ([email protected]) --- Created attachment 293737
--> https://bugzilla.kernel.org/attachment.cgi?id=293737&action=edit
Trivial patch to send the switch key event

I wonder if we should only do this if the switch actually changed. But I suspect the input layer will already take care of that case.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#10 lore raw

[Bug 210269] Tablet mode not correctly reported after wake-up from hibernate

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=210269

Hans de Goede ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------

                 CC|                            |[email protected]
                   |                            |g

--- Comment #10 from Hans de Goede ([email protected]) --- (In reply to Benjamin Berg from comment #8)

Quoted 2 lines

I wonder if we should only do this if the switch actually changed. But I suspect the input layer will already take care of that case.

There is no need to check if the switch actually changed, as you already presumed the input layer will filter out the event if there is no change.

(In reply to Julian from comment #9)

Quoted 1 line

Your patch seems to fix the problem Benjamin, thanks.

Awesome, thank you for testing.

Benjamin, can you submit the fix for this upstream please ? Then I'll pick it up and merge it for the 5.11 cycle.

Note please add the following tags to the commit msg:

Fixes dda3ec0aa631 ("platform/x86: thinkpad_acpi: Implement tablet mode using

GMMS method")

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.