Commit graph

9 commits

Author SHA1 Message Date
Haowen Bai
50d88b1d1e platform/x86: system76_acpi: Use dev_get_drvdata
Eliminate direct accesses to the driver_data field.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Link: https://lore.kernel.org/r/1653989063-20180-1-git-send-email-baihaowen@meizu.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2022-06-12 14:41:22 +02:00
Tim Crawford
c449927256 platform/x86: system76_acpi: Guard System76 EC specific functionality
Certain functionality or its implementation in System76 EC firmware may
be different to the proprietary ODM EC firmware. Introduce a new bool,
`has_open_ec`, to guard our specific logic. Detect the use of this by
looking for a custom ACPI method name used in System76 firmware.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
Link: https://lore.kernel.org/r/20211222185154.4560-1-tcrawford@system76.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-12-23 17:26:28 +01:00
Tim Crawford
97ae45953e platform/x86: system76_acpi: Fix input device error handling
Users on darp6 that do not have Open EC firmware have reported crashes
on boot. Correct the error handling for the input device to fix it.

Managed devices do not need to be explicitly unregistered or freed, as
this is handled by devres. Drop the call to input_free_device.

Fixes: 0de30fc684 ("platform/x86: system76_acpi: Replace Fn+F2 function for OLED models")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Link: https://lore.kernel.org/r/20211030154213.2515-1-tcrawford@system76.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-11-02 11:23:55 +01:00
Tim Crawford
603a7dd08f platform/x86: system76_acpi: Add attribute group for kb_led_color
Create the attribute groups for kb_led_color and set the `groups` field
in kb_led. While touching it, also change its show method to use
sysfs_emit() instead of sprintf().

Signed-off-by: Tim Crawford <tcrawford@system76.com>
Link: https://lore.kernel.org/r/20211006202202.7479-5-tcrawford@system76.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-10-19 16:31:17 +02:00
Tim Crawford
76f7eba3e0 platform/x86: system76_acpi: Add battery charging thresholds
System76 laptops running open source EC firmware support configuring
charging thresholds through ACPI methods. Expose this functionality
through the standard sysfs entries charge_control_{start,end}_threshold.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
Link: https://lore.kernel.org/r/20211006202202.7479-4-tcrawford@system76.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-10-19 16:31:09 +02:00
Jeremy Soller
0de30fc684 platform/x86: system76_acpi: Replace Fn+F2 function for OLED models
System76 laptops models with OLED displays do not support the default
Fn+F2 behavior of turning the embedded display on and off. Some models
instead introduce a new notify event that is used to lock the screen so
the OS will put the display in a low power state.

Signed-off-by: Jeremy Soller <jeremy@system76.com>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Link: https://lore.kernel.org/r/20211006202202.7479-3-tcrawford@system76.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-10-19 16:31:06 +02:00
Jeremy Soller
95563d45b5 platform/x86: system76_acpi: Report temperature and fan speed
Add a hwmon interface to report CPU/GPU temperature and fan speed.
sensors now reports an ACPI interface with the entries:

system76_acpi-acpi-0
Adapter: ACPI interface
CPU fan:        0 RPM
GPU fan:        0 RPM
CPU temp:     +47.0°C
GPU temp:      +0.0°C

Signed-off-by: Jeremy Soller <jeremy@system76.com>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Link: https://lore.kernel.org/r/20211006202202.7479-2-tcrawford@system76.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-10-19 16:30:55 +02:00
Nick Shipp
5b36398dc8 platform/x86: system76-acpi: Fix brightness_set schedule while atomic
system76_set() was set as an LED ->brightness_set() callback, but it calls
acpi_evaluate_object() which is not atomic-safe. Switch to the
->brightness_set_blocking() LED callback instead.

Signed-off-by: Nick Shipp <git@segbrk.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-07-09 22:40:36 +03:00
Jeremy Soller
fd13c8622a platform/x86: Add System76 ACPI driver
Add System76 ACPI driver, which adds support for Fn-Fx key
combinations, keyboard backlight, and airplane mode LEDs
on System76 laptops running open source firmware.

Signed-off-by: Jeremy Soller <jeremy@system76.com>
Cc: platform-driver-x86@vger.kernel.org
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-10-15 10:55:11 +03:00