From: Hans de Goede <hdegoede@redhat.com>
To: Arvid Norlander <lkml@vorpal.se>, platform-driver-x86@vger.kernel.org
Cc: linux-acpi@vger.kernel.org, "Len Brown" <lenb@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
linux-input@vger.kernel.org,
"Azael Avalos" <coproscefalo@gmail.com>,
"Barnabás Pőcze" <pobrn@protonmail.com>
Subject: Re: [PATCH v2 2/2] platform/x86: toshiba_acpi: Add quirk for buttons on Z830
Date: Tue, 27 Sep 2022 15:56:17 +0200 [thread overview]
Message-ID: <04c8d948-4d90-69b2-45a3-d992eb0793aa@redhat.com> (raw)
In-Reply-To: <20220922182424.934340-3-lkml@vorpal.se>
Hi,
On 9/22/22 20:24, Arvid Norlander wrote:
> The Z830 has some buttons that will only work properly as "quickstart"
> buttons. To enable them in that mode, a value between 1 and 7 must be
> used for HCI_HOTKEY_EVENT. Windows uses 0x5 on this laptop so use that for
> maximum predictability and compatibility.
>
> As there is not yet a known way of auto detection, this patch uses a DMI
> quirk table. A module parameter is exposed to allow setting this on other
> models for testing.
>
> Signed-off-by: Arvid Norlander <lkml@vorpal.se>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Note I assume that it is best to merge the 2 patches together, so I won't
merge this now. Please add my Reviewed-by to the next version of the patch.
Regards,
Hans
> ---
> drivers/platform/x86/toshiba_acpi.c | 36 ++++++++++++++++++++++++++---
> 1 file changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
> index 9f1394b73895..894afe74d815 100644
> --- a/drivers/platform/x86/toshiba_acpi.c
> +++ b/drivers/platform/x86/toshiba_acpi.c
> @@ -58,6 +58,11 @@ module_param(turn_on_panel_on_resume, int, 0644);
> MODULE_PARM_DESC(turn_on_panel_on_resume,
> "Call HCI_PANEL_POWER_ON on resume (-1 = auto, 0 = no, 1 = yes");
>
> +static int hci_hotkey_quickstart = -1;
> +module_param(hci_hotkey_quickstart, int, 0644);
> +MODULE_PARM_DESC(hci_hotkey_quickstart,
> + "Call HCI_HOTKEY_EVENT with value 0x5 for quickstart button support (-1 = auto, 0 = no, 1 = yes");
> +
> #define TOSHIBA_WMI_EVENT_GUID "59142400-C6A3-40FA-BADB-8A2652834100"
>
> /* Scan code for Fn key on TOS1900 models */
> @@ -137,6 +142,7 @@ MODULE_PARM_DESC(turn_on_panel_on_resume,
> #define HCI_ACCEL_MASK 0x7fff
> #define HCI_ACCEL_DIRECTION_MASK 0x8000
> #define HCI_HOTKEY_DISABLE 0x0b
> +#define HCI_HOTKEY_ENABLE_QUICKSTART 0x05
> #define HCI_HOTKEY_ENABLE 0x09
> #define HCI_HOTKEY_SPECIAL_FUNCTIONS 0x10
> #define HCI_LCD_BRIGHTNESS_BITS 3
> @@ -2731,10 +2737,15 @@ static int toshiba_acpi_enable_hotkeys(struct toshiba_acpi_dev *dev)
> return -ENODEV;
>
> /*
> + * Enable quickstart buttons if supported.
> + *
> * Enable the "Special Functions" mode only if they are
> * supported and if they are activated.
> */
> - if (dev->kbd_function_keys_supported && dev->special_functions)
> + if (hci_hotkey_quickstart)
> + result = hci_write(dev, HCI_HOTKEY_EVENT,
> + HCI_HOTKEY_ENABLE_QUICKSTART);
> + else if (dev->kbd_function_keys_supported && dev->special_functions)
> result = hci_write(dev, HCI_HOTKEY_EVENT,
> HCI_HOTKEY_SPECIAL_FUNCTIONS);
> else
> @@ -3260,7 +3271,14 @@ static const char *find_hci_method(acpi_handle handle)
> * works. toshiba_acpi_resume() uses HCI_PANEL_POWER_ON to avoid changing
> * the configured brightness level.
> */
> -static const struct dmi_system_id turn_on_panel_on_resume_dmi_ids[] = {
> +#define QUIRK_TURN_ON_PANEL_ON_RESUME BIT(0)
> +/*
> + * Some Toshibas use "quickstart" keys. On these, HCI_HOTKEY_EVENT must use
> + * the value HCI_HOTKEY_ENABLE_QUICKSTART.
> + */
> +#define QUIRK_HCI_HOTKEY_QUICKSTART BIT(1)
> +
> +static const struct dmi_system_id toshiba_dmi_quirks[] = {
> {
> /* Toshiba Portégé R700 */
> /* https://bugzilla.kernel.org/show_bug.cgi?id=21012 */
> @@ -3268,6 +3286,7 @@ static const struct dmi_system_id turn_on_panel_on_resume_dmi_ids[] = {
> DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
> DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE R700"),
> },
> + .driver_data = (void *)QUIRK_TURN_ON_PANEL_ON_RESUME,
> },
> {
> /* Toshiba Satellite/Portégé R830 */
> @@ -3277,6 +3296,7 @@ static const struct dmi_system_id turn_on_panel_on_resume_dmi_ids[] = {
> DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
> DMI_MATCH(DMI_PRODUCT_NAME, "R830"),
> },
> + .driver_data = (void *)QUIRK_TURN_ON_PANEL_ON_RESUME,
> },
> {
> /* Toshiba Satellite/Portégé Z830 */
> @@ -3284,6 +3304,7 @@ static const struct dmi_system_id turn_on_panel_on_resume_dmi_ids[] = {
> DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
> DMI_MATCH(DMI_PRODUCT_NAME, "Z830"),
> },
> + .driver_data = (void *)(QUIRK_TURN_ON_PANEL_ON_RESUME | QUIRK_HCI_HOTKEY_QUICKSTART),
> },
> };
>
> @@ -3292,6 +3313,8 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev)
> struct toshiba_acpi_dev *dev;
> const char *hci_method;
> u32 dummy;
> + const struct dmi_system_id *dmi_id;
> + long quirks = 0;
> int ret = 0;
>
> if (toshiba_acpi)
> @@ -3444,8 +3467,15 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev)
> }
> #endif
>
> + dmi_id = dmi_first_match(toshiba_dmi_quirks);
> + if (dmi_id)
> + quirks = (long)dmi_id->driver_data;
> +
> if (turn_on_panel_on_resume == -1)
> - turn_on_panel_on_resume = dmi_check_system(turn_on_panel_on_resume_dmi_ids);
> + turn_on_panel_on_resume = !!(quirks & QUIRK_TURN_ON_PANEL_ON_RESUME);
> +
> + if (hci_hotkey_quickstart == -1)
> + hci_hotkey_quickstart = !!(quirks & QUIRK_HCI_HOTKEY_QUICKSTART);
>
> toshiba_wwan_available(dev);
> if (dev->wwan_supported)
next prev parent reply other threads:[~2022-09-27 13:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-22 18:24 [PATCH RFC v2 0/2] Quickstart buttons driver and Toshiba Z830 Arvid Norlander
2022-09-22 18:24 ` [PATCH RFC v2 1/2] platform/x86: quickstart: Add ACPI quickstart button (PNP0C32) driver Arvid Norlander
2022-09-23 19:24 ` Barnabás Pőcze
2022-09-25 18:19 ` Arvid Norlander
2022-09-27 13:35 ` Hans de Goede
2022-09-27 13:49 ` Hans de Goede
2022-09-27 14:54 ` Arvid Norlander
2022-09-27 13:54 ` Hans de Goede
2022-09-27 13:54 ` Hans de Goede
2022-09-22 18:24 ` [PATCH v2 2/2] platform/x86: toshiba_acpi: Add quirk for buttons on Z830 Arvid Norlander
2022-09-27 13:56 ` Hans de Goede [this message]
2022-10-07 11:42 ` [PATCH RFC v2 0/2] Quickstart buttons driver and Toshiba Z830 Hans de Goede
2022-10-07 23:44 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=04c8d948-4d90-69b2-45a3-d992eb0793aa@redhat.com \
--to=hdegoede@redhat.com \
--cc=coproscefalo@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=lkml@vorpal.se \
--cc=platform-driver-x86@vger.kernel.org \
--cc=pobrn@protonmail.com \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).