* [PATCH] platform/x86: intel-vbtn: Fix missing tablet-mode-switch events
@ 2023-12-04 15:06 Hans de Goede
2023-12-04 15:21 ` Andy Shevchenko
2023-12-08 11:19 ` Ilpo Järvinen
0 siblings, 2 replies; 3+ messages in thread
From: Hans de Goede @ 2023-12-04 15:06 UTC (permalink / raw)
To: Ilpo Järvinen, Andy Shevchenko
Cc: Hans de Goede, platform-driver-x86, Arnold Gozum
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 <arngozum@gmail.com>
Closes: https://lore.kernel.org/platform-driver-x86/87271a74-c831-4eec-b7a4-1371d0e42471@gmail.com/
Tested-by: Arnold Gozum <arngozum@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/intel/vbtn.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/platform/x86/intel/vbtn.c b/drivers/platform/x86/intel/vbtn.c
index 6fa1735ad7a4..210b0a81b7ec 100644
--- a/drivers/platform/x86/intel/vbtn.c
+++ b/drivers/platform/x86/intel/vbtn.c
@@ -73,10 +73,10 @@ struct intel_vbtn_priv {
bool wakeup_mode;
};
-static void detect_tablet_mode(struct platform_device *device)
+static void detect_tablet_mode(struct device *dev)
{
- struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev);
- acpi_handle handle = ACPI_HANDLE(&device->dev);
+ struct intel_vbtn_priv *priv = dev_get_drvdata(dev);
+ acpi_handle handle = ACPI_HANDLE(dev);
unsigned long long vgbs;
acpi_status status;
int m;
@@ -89,6 +89,8 @@ static void detect_tablet_mode(struct platform_device *device)
input_report_switch(priv->switches_dev, SW_TABLET_MODE, m);
m = (vgbs & VGBS_DOCK_MODE_FLAG) ? 1 : 0;
input_report_switch(priv->switches_dev, SW_DOCK, m);
+
+ input_sync(priv->switches_dev);
}
/*
@@ -134,7 +136,7 @@ static int intel_vbtn_input_setup(struct platform_device *device)
priv->switches_dev->id.bustype = BUS_HOST;
if (priv->has_switches) {
- detect_tablet_mode(device);
+ detect_tablet_mode(&device->dev);
ret = input_register_device(priv->switches_dev);
if (ret)
@@ -198,6 +200,9 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
autorelease = val && (!ke_rel || ke_rel->type == KE_IGNORE);
sparse_keymap_report_event(input_dev, event, val, autorelease);
+
+ /* Some devices need this to report further events */
+ acpi_evaluate_object(handle, "VBDL", NULL, NULL);
}
/*
@@ -352,7 +357,13 @@ static void intel_vbtn_pm_complete(struct device *dev)
static int intel_vbtn_pm_resume(struct device *dev)
{
+ struct intel_vbtn_priv *priv = dev_get_drvdata(dev);
+
intel_vbtn_pm_complete(dev);
+
+ if (priv->has_switches)
+ detect_tablet_mode(dev);
+
return 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] platform/x86: intel-vbtn: Fix missing tablet-mode-switch events
2023-12-04 15:06 [PATCH] platform/x86: intel-vbtn: Fix missing tablet-mode-switch events Hans de Goede
@ 2023-12-04 15:21 ` Andy Shevchenko
2023-12-08 11:19 ` Ilpo Järvinen
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2023-12-04 15:21 UTC (permalink / raw)
To: Hans de Goede; +Cc: Ilpo Järvinen, platform-driver-x86, Arnold Gozum
On Mon, Dec 04, 2023 at 04:06:01PM +0100, Hans de Goede wrote:
> 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.
LGTM,
Reviewed-by: Andy Shevchenko <andy@kernel.org>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86: intel-vbtn: Fix missing tablet-mode-switch events
2023-12-04 15:06 [PATCH] platform/x86: intel-vbtn: Fix missing tablet-mode-switch events Hans de Goede
2023-12-04 15:21 ` Andy Shevchenko
@ 2023-12-08 11:19 ` Ilpo Järvinen
1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2023-12-08 11:19 UTC (permalink / raw)
To: Andy Shevchenko, Hans de Goede; +Cc: platform-driver-x86, Arnold Gozum
On Mon, 04 Dec 2023 16:06:01 +0100, Hans de Goede wrote:
> 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.
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo branch. Note it will show up in the public
platform-drivers-x86/review-ilpo branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/1] platform/x86: intel-vbtn: Fix missing tablet-mode-switch events
commit: 14c200b7ca46b9a9f4af9e81d258a58274320b6f
--
i.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-08 11:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-04 15:06 [PATCH] platform/x86: intel-vbtn: Fix missing tablet-mode-switch events Hans de Goede
2023-12-04 15:21 ` Andy Shevchenko
2023-12-08 11:19 ` Ilpo Järvinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox