Commit Graph

8 Commits

Author SHA1 Message Date
Rafael J. Wysocki
a2676ead25 platform/chrome: chromeos_tbmc: Convert to a platform driver
In all cases in which a struct acpi_driver is used for binding a driver
to an ACPI device object, a corresponding platform device is created by
the ACPI core and that device is regarded as a proper representation of
underlying hardware.  Accordingly, a struct platform_driver should be
used by driver code to bind to that device.  There are multiple reasons
why drivers should not bind directly to ACPI device objects [1].

Overall, it is better to bind drivers to platform devices than to their
ACPI companions, so convert the ChromeOS tablet mode change (TBMC) ACPI
driver to a platform one.

After this change, the subordinate input device and wakeup source class
device will be registered under the platform device used for driver
binding instead of its ACPI companion.

While this is not expected to alter functionality, it changes sysfs
layout and so it will be visible to user space.

Link: https://lore.kernel.org/all/2396510.ElGaqSPkdT@rafael.j.wysocki/ [1]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/10827297.nUPlyArG6x@rafael.j.wysocki
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
2026-03-06 04:35:07 +00:00
Rafael J. Wysocki
de1260139d platform/chrome: chromeos_tbmc: Register ACPI notify handler
To facilitate subsequent conversion of the driver to a platform one,
make it install an ACPI notify handler directly instead of using
a .notify() callback in struct acpi_driver.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/3413961.aeNJFYEL58@rafael.j.wysocki
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
2026-03-06 04:35:07 +00:00
Rafael J. Wysocki
5d441a4bc9 platform/chrome: chromeos_tbmc: Drop wakeup source on remove
The wakeup source added by device_init_wakeup() in chromeos_tbmc_add()
needs to be dropped during driver removal, so add a .remove() callback
to the driver for this purpose.

Fixes: 0144c00ed8 ("platform/chrome: chromeos_tbmc: Report wake events")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/6151957.MhkbZ0Pkbq@rafael.j.wysocki
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
2026-03-06 04:35:07 +00:00
Ravi Chandra Sadineni
0144c00ed8 platform/chrome: chromeos_tbmc: Report wake events
Mark chromeos_tbmc as wake capable and report wake events. This helps to
abort suspend on seeing a tablet mode switch event when kernel is
suspending. This also helps identifying if chromeos_tbmc is the wake
source.

Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-09-12 16:01:35 +02:00
Nathan Chancellor
bc3f4b5c60 platform/chrome: chromeos_tbmc - Remove unneeded const
Clang warns:

drivers/platform/chrome/chromeos_tbmc.c:102:14: warning: duplicate
'const' declaration specifier [-Wduplicate-decl-specifier]
static const SIMPLE_DEV_PM_OPS(chromeos_tbmc_pm_ops, NULL,
             ^
./include/linux/pm.h:365:56: note: expanded from macro
'SIMPLE_DEV_PM_OPS'
                                                       ^
1 warning generated.

SIMPLE_DEV_PM_OPS is already declared as const, this one is unnecessary
so remove it.

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-10-09 22:40:12 -07:00
Benson Leung
c474e9f2be platform/chrome: chromeos_tbmc - fix SPDX identifier
Original submission was GPLv2 only, so mark as GPL-2.0.
Also restored some descriptive lines that were there before.

Signed-off-by: Benson Leung <bleung@chromium.org>
2018-06-16 16:52:59 -07:00
Benson Leung
4574d1d61d platform/chrome: chromeos_tbmc - add SPDX identifier
Replace the original license statement with the SPDX identifier.
Add also one line of description as recommended by the COPYING file.

Signed-off-by: Benson Leung <bleung@chromium.org>
2018-05-23 12:00:47 -07:00
Gwendal Grignou
b418f74170 platform: chrome: Add Tablet Switch ACPI driver
Add a kernel driver for GOOG0006, an ACPI driver reporting an event when
the tablet switch status changes.

On an ACPI based convertible chromebook check evtest display tablet mode
switch changes:
Available devices:
..
/dev/input/event3:      Tablet Mode Switch
..
Testing ... (interrupt to exit)
Event: time 1484879712.604360, type 5 (EV_SW), code 1 (SW_TABLET_MODE),
value 1
Event: time 1484879712.604360, -------------- SYN_REPORT ------------
Event: time 1484879715.132228, type 5 (EV_SW), code 1 (SW_TABLET_MODE),
value 0
Event: time 1484879715.132228, -------------- SYN_REPORT ------------
...
Check state is updated at resume time when different from suspend time.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-05-23 11:56:45 -07:00