• Maxim Mikityanskiy's avatar
    platform/x86: msi-laptop: Fix rfkill out-of-sync on MSI Wind U100 · ad084a6d
    Maxim Mikityanskiy authored
    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: 0816392b ("msi-laptop: merge quirk tables to one")
    Fixes: 0de6575a ("msi-laptop: Add MSI Wind U90/U100 support")
    Signed-off-by: default avatarMaxim Mikityanskiy <maxtram95@gmail.com>
    Link: https://lore.kernel.org/r/20230721145423.161057-1-maxtram95@gmail.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    ad084a6d
msi-laptop.c 26.1 KB