diff options
author | Hans de Goede <hdegoede@redhat.com> | 2023-04-30 18:57:59 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2023-05-09 12:33:37 +0200 |
commit | 9acf236e95996f56e9d4d1d6e92008b86d4925b4 (patch) | |
tree | 39e2f68ba4a5728dcac91b46d82a741bcd337688 /drivers/platform/x86 | |
parent | 01d126ff33c30f15f7984ead6ffdc4088051dc98 (diff) | |
download | linux-next-9acf236e95996f56e9d4d1d6e92008b86d4925b4.tar.gz |
platform/x86: lenovo-yogabook: Stop checking adev->power.state
lenovo-yogabook-wmi: controls the power-state itself and stores
this in data->flags so there is no need to poke inside ACPI device
internals.
This is a preparation patch for making lenovo-yogabook-wmi also work
on the Android version of the Yoga Book 1 which does not have a WMI
interface to deal with toggling the keyboard half between
touch-keyboard and wacom-digitizer mode.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430165807.472798-12-hdegoede@redhat.com
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r-- | drivers/platform/x86/lenovo-yogabook-wmi.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/platform/x86/lenovo-yogabook-wmi.c b/drivers/platform/x86/lenovo-yogabook-wmi.c index 44ab8e57902d..e9274bafb9ce 100644 --- a/drivers/platform/x86/lenovo-yogabook-wmi.c +++ b/drivers/platform/x86/lenovo-yogabook-wmi.c @@ -50,13 +50,11 @@ static int yogabook_wmi_set_kbd_backlight(struct yogabook_wmi *data, union acpi_object param; acpi_status status; - if (data->kbd_adev->power.state != ACPI_STATE_D0) { - dev_warn(data->dev, "keyboard touchscreen not in D0, cannot set brightness\n"); - return -ENXIO; - } - dev_dbg(data->dev, "Set KBLC level to %u\n", level); + /* Ensure keyboard touchpad is on before we call KBLC() */ + acpi_device_set_power(data->kbd_adev, ACPI_STATE_D0); + input.count = 1; input.pointer = ¶m; @@ -181,7 +179,7 @@ static int kbd_brightness_set(struct led_classdev *cdev, data->brightness = value; - if (data->kbd_adev->power.state != ACPI_STATE_D0) + if (!test_bit(YB_KBD_IS_ON, &data->flags)) return 0; return yogabook_wmi_set_kbd_backlight(data, data->brightness); @@ -353,11 +351,8 @@ static int yogabook_resume(struct device *dev) { struct yogabook_wmi *data = dev_get_drvdata(dev); - if (test_bit(YB_KBD_IS_ON, &data->flags)) { - /* Ensure keyboard touchpad is on before we call KBLC() */ - acpi_device_set_power(data->kbd_adev, ACPI_STATE_D0); + if (test_bit(YB_KBD_IS_ON, &data->flags)) yogabook_wmi_set_kbd_backlight(data, data->brightness); - } clear_bit(YB_SUSPENDED, &data->flags); |