• Hans de Goede's avatar
    iio: accel: kxcjk1013: Add support for KIOX010A ACPI DSM for setting tablet-mode · e5b1032a
    Hans de Goede authored
    Some 360 degree hinges (yoga) style 2-in-1 devices use 2 KXCJ91008-s
    to allow the OS to determine the angle between the display and the base
    of the device, so that the OS can determine if the 2-in-1 is in laptop
    or in tablet-mode.
    
    On Windows both accelerometers are read by a special HingeAngleService
    process; and this process calls a DSM (Device Specific Method) on the
    ACPI KIOX010A device node for the sensor in the display, to let the
    embedded-controller (EC) know about the mode so that it can disable the
    kbd and touchpad to avoid spurious input while folded into tablet-mode.
    
    This notifying of the EC is problematic because sometimes the EC comes up
    thinking that device is in tablet-mode and the kbd and touchpad do not
    work. This happens for example on Irbis NB111 devices after a suspend /
    resume cycle (after a complete battery drain / hard reset without having
    booted Windows at least once). Other 2-in-1s which are likely affected
    too are e.g. the Teclast F5 and F6 series.
    
    The kxcjk-1013 driver may seem like a strange place to deal with this,
    but since it is *the* driver for the ACPI KIOX010A device, it is also
    the driver which has access to the ACPI handle needed by the DSM.
    
    Add support for calling the DSM and on probe unconditionally tell the
    EC that the device is laptop mode, fixing the kbd and touchpad sometimes
    not working.
    
    Fixes: 7f6232e6 ("iio: accel: kxcjk1013: Add KIOX010A ACPI Hardware-ID")
    Reported-and-tested-by: default avatarrussianneuromancer <russianneuromancer@ya.ru>
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Cc: <Stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20201110133835.129080-3-hdegoede@redhat.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    e5b1032a
kxcjk-1013.c 37.7 KB