diff mbox series

[PATCHv2] platform/x86: asus-wmi: Add quirk for ASUS Vivobook S14

Message ID a22c2077-4f74-4972-be2b-f60b67f67bab@stravers.net (mailing list archive)
State Changes Requested, archived
Headers show
Series [PATCHv2] platform/x86: asus-wmi: Add quirk for ASUS Vivobook S14 | expand

Commit Message

Kevin Robert Stravers March 21, 2025, 5:04 p.m. UTC
From 9af8ba6cfd6305d7696d6cfc8eedb12405cb572f Mon Sep 17 00:00:00 2001
From: Kevin Robert Stravers <kevin@stravers.net>
Date: Mon, 17 Mar 2025 20:41:44 -0400
Subject: [PATCH] platform/x86: asus-wmi: Add quirk for ASUS Vivobook S14

The ASUS Vivobook S14 will have wifi disabled on boot as well as
resumption from suspend if the asus-wmi driver invokes rfkill functions.

This patch disables asus-wmi's rfkill usage to prevent the wifi card
from being software disabled.
---
  drivers/platform/x86/asus-nb-wmi.c | 13 +++++++++++++
  drivers/platform/x86/asus-wmi.c    |  5 +++++
  2 files changed, 18 insertions(+)

  	mutex_init(&asus->hotplug_lock);

Comments

Ilpo Järvinen March 21, 2025, 5:20 p.m. UTC | #1
On Fri, 21 Mar 2025, Kevin Stravers wrote:

> From 9af8ba6cfd6305d7696d6cfc8eedb12405cb572f Mon Sep 17 00:00:00 2001
> From: Kevin Robert Stravers <kevin@stravers.net>
> Date: Mon, 17 Mar 2025 20:41:44 -0400
> Subject: [PATCH] platform/x86: asus-wmi: Add quirk for ASUS Vivobook S14
> 
> The ASUS Vivobook S14 will have wifi disabled on boot as well as
> resumption from suspend if the asus-wmi driver invokes rfkill functions.
> 
> This patch disables asus-wmi's rfkill usage to prevent the wifi card
> from being software disabled.
> ---
>  drivers/platform/x86/asus-nb-wmi.c | 13 +++++++++++++
>  drivers/platform/x86/asus-wmi.c    |  5 +++++
>  2 files changed, 18 insertions(+)
> 
> diff --git a/drivers/platform/x86/asus-nb-wmi.c
> b/drivers/platform/x86/asus-nb-wmi.c
> index 3f8b2a324efd..1e6fb9308560 100644
> --- a/drivers/platform/x86/asus-nb-wmi.c
> +++ b/drivers/platform/x86/asus-nb-wmi.c
> @@ -150,6 +150,10 @@ static struct quirk_entry quirk_asus_zenbook_duo_kbd = {

When I try various means to have this as file, this line is turned into 
this:

@@ -150,6 +150,10 @@ static struct quirk_entry 
quirk_asus_zenbook_duo_kbd = {

And it obviously results in failure_:

$ patch -p1 --dry-run < 0001
checking file drivers/platform/x86/asus-nb-wmi.c
patch: **** malformed patch at line 35: quirk_asus_zenbook_duo_kbd = {

And if I try to manually fix that, all hunks still fail to apply so I 
think there more wrong with the diff.

Did you try to use git am after mailing the patch to yourself? Please do 
that if you didn't because it might otherwise take many round-trips to 
correct the problems.

It might be easier to use git send-email to send patch out as it 
shouldn't mangle the patch in any way.
diff mbox series

Patch

diff --git a/drivers/platform/x86/asus-nb-wmi.c 
b/drivers/platform/x86/asus-nb-wmi.c
index 3f8b2a324efd..1e6fb9308560 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -150,6 +150,10 @@  static struct quirk_entry 
quirk_asus_zenbook_duo_kbd = {
  	.ignore_key_wlan = true,
  };

+static struct quirk_entry quirk_asus_vivobook_s14 = {
+	.skip_rfkill = true,
+};
+
  static int dmi_matched(const struct dmi_system_id *dmi)
  {
  	pr_info("Identified laptop model '%s'\n", dmi->ident);
@@ -530,6 +534,15 @@  static const struct dmi_system_id asus_quirks[] = {
  		},
  		.driver_data = &quirk_asus_zenbook_duo_kbd,
  	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUS VivoBook S14",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "S5406SA"),
+		},
+		.driver_data = &quirk_asus_vivobook_s14,
+	},
  	{},
  };

diff --git a/drivers/platform/x86/asus-wmi.c 
b/drivers/platform/x86/asus-wmi.c
index 38ef778e8c19..42e58a28c3e2 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -2138,6 +2138,8 @@  static int asus_new_rfkill(struct asus_wmi *asus,

  static void asus_wmi_rfkill_exit(struct asus_wmi *asus)
  {
+	if (asus->driver->quirks->skip_rfkill)
+		return;
  	if (asus->driver->wlan_ctrl_by_user && ashs_present())
  		return;

@@ -2188,6 +2190,9 @@  static void asus_wmi_rfkill_exit(struct asus_wmi 
*asus)

  static int asus_wmi_rfkill_init(struct asus_wmi *asus)
  {
+	if (asus->driver->quirks->skip_rfkill)
+		return 0;
+
  	int result = 0;