Skip to content

Commit 14c200b

Browse files
jwrdegoedeij-intel
authored andcommitted
platform/x86: intel-vbtn: Fix missing tablet-mode-switch events
2 issues have been reported on the Dell Inspiron 7352: 1. Sometimes the tablet-mode-switch stops reporting tablet-mode change events. Add a "VBDL" call to notify_handler() to work around this. 2. Sometimes the tablet-mode is incorrect after suspend/resume Add a detect_tablet_mode() to resume() to fix this. Reported-by: Arnold Gozum <[email protected]> Closes: https://lore.kernel.org/platform-driver-x86/[email protected]/ Tested-by: Arnold Gozum <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent 3494a59 commit 14c200b

File tree

1 file changed

+15
-4
lines changed
  • drivers/platform/x86/intel

1 file changed

+15
-4
lines changed

drivers/platform/x86/intel/vbtn.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ struct intel_vbtn_priv {
7373
bool wakeup_mode;
7474
};
7575

76-
static void detect_tablet_mode(struct platform_device *device)
76+
static void detect_tablet_mode(struct device *dev)
7777
{
78-
struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev);
79-
acpi_handle handle = ACPI_HANDLE(&device->dev);
78+
struct intel_vbtn_priv *priv = dev_get_drvdata(dev);
79+
acpi_handle handle = ACPI_HANDLE(dev);
8080
unsigned long long vgbs;
8181
acpi_status status;
8282
int m;
@@ -89,6 +89,8 @@ static void detect_tablet_mode(struct platform_device *device)
8989
input_report_switch(priv->switches_dev, SW_TABLET_MODE, m);
9090
m = (vgbs & VGBS_DOCK_MODE_FLAG) ? 1 : 0;
9191
input_report_switch(priv->switches_dev, SW_DOCK, m);
92+
93+
input_sync(priv->switches_dev);
9294
}
9395

9496
/*
@@ -134,7 +136,7 @@ static int intel_vbtn_input_setup(struct platform_device *device)
134136
priv->switches_dev->id.bustype = BUS_HOST;
135137

136138
if (priv->has_switches) {
137-
detect_tablet_mode(device);
139+
detect_tablet_mode(&device->dev);
138140

139141
ret = input_register_device(priv->switches_dev);
140142
if (ret)
@@ -198,6 +200,9 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
198200
autorelease = val && (!ke_rel || ke_rel->type == KE_IGNORE);
199201

200202
sparse_keymap_report_event(input_dev, event, val, autorelease);
203+
204+
/* Some devices need this to report further events */
205+
acpi_evaluate_object(handle, "VBDL", NULL, NULL);
201206
}
202207

203208
/*
@@ -352,7 +357,13 @@ static void intel_vbtn_pm_complete(struct device *dev)
352357

353358
static int intel_vbtn_pm_resume(struct device *dev)
354359
{
360+
struct intel_vbtn_priv *priv = dev_get_drvdata(dev);
361+
355362
intel_vbtn_pm_complete(dev);
363+
364+
if (priv->has_switches)
365+
detect_tablet_mode(dev);
366+
356367
return 0;
357368
}
358369

0 commit comments

Comments
 (0)