Skip to content

Commit ad084a6

Browse files
gentoo-rootjwrdegoede
authored andcommitted
platform/x86: msi-laptop: Fix rfkill out-of-sync on MSI Wind U100
Only the HW rfkill state is toggled on laptops with quirks->ec_read_only (so far only MSI Wind U90/U100). There are, however, a few issues with the implementation: 1. The initial HW state is always unblocked, regardless of the actual state on boot, because msi_init_rfkill only sets the SW state, regardless of ec_read_only. 2. The initial SW state corresponds to the actual state on boot, but it can't be changed afterwards, because set_device_state returns -EOPNOTSUPP. It confuses the userspace, making Wi-Fi and/or Bluetooth unusable if it was blocked on boot, and breaking the airplane mode if the rfkill was unblocked on boot. Address the above issues by properly initializing the HW state on ec_read_only laptops and by allowing the userspace to toggle the SW state. Don't set the SW state ourselves and let the userspace fully control it. Toggling the SW state is a no-op, however, it allows the userspace to properly toggle the airplane mode. The actual SW radio disablement is handled by the corresponding rtl818x_pci and btusb drivers that have their own rfkills. Tested on MSI Wind U100 Plus, BIOS ver 1.0G, EC ver 130. Fixes: 0816392 ("msi-laptop: merge quirk tables to one") Fixes: 0de6575 ("msi-laptop: Add MSI Wind U90/U100 support") Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com> Link: https://lore.kernel.org/r/20230721145423.161057-1-maxtram95@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent 6a758a3 commit ad084a6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/platform/x86/msi-laptop.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static ssize_t set_device_state(const char *buf, size_t count, u8 mask)
208208
return -EINVAL;
209209

210210
if (quirks->ec_read_only)
211-
return -EOPNOTSUPP;
211+
return 0;
212212

213213
/* read current device state */
214214
result = ec_read(MSI_STANDARD_EC_COMMAND_ADDRESS, &rdata);
@@ -838,15 +838,15 @@ static bool msi_laptop_i8042_filter(unsigned char data, unsigned char str,
838838
static void msi_init_rfkill(struct work_struct *ignored)
839839
{
840840
if (rfk_wlan) {
841-
rfkill_set_sw_state(rfk_wlan, !wlan_s);
841+
msi_rfkill_set_state(rfk_wlan, !wlan_s);
842842
rfkill_wlan_set(NULL, !wlan_s);
843843
}
844844
if (rfk_bluetooth) {
845-
rfkill_set_sw_state(rfk_bluetooth, !bluetooth_s);
845+
msi_rfkill_set_state(rfk_bluetooth, !bluetooth_s);
846846
rfkill_bluetooth_set(NULL, !bluetooth_s);
847847
}
848848
if (rfk_threeg) {
849-
rfkill_set_sw_state(rfk_threeg, !threeg_s);
849+
msi_rfkill_set_state(rfk_threeg, !threeg_s);
850850
rfkill_threeg_set(NULL, !threeg_s);
851851
}
852852
}

0 commit comments

Comments
 (0)