[ Upstream commit ddd4e9d78057383704a84cbe462bb63598c9baef ]
Statically allocated array of pointers to hwmon_channel_info can be made
const for safety.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230511175627.282246-3-krzysztof.kozlowski@linaro.org
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
Changes from v1:
- Set kbled_type for old ACPI logic
- Use kbled_type instead of kb_color for conditional logic
- Set common kb_led values before conditional logic
- Do not set color for white backlit keyboards
- Do not register kb_led device if keyboard has no backlight
Signed-off-by: Tim Crawford <tcrawford@system76.com>
The EC has been updated to detect if a white or RGB backlit keyboard is
attached at run-time instead of being set at compile-time. The ACPI
methods in coreboot have been updated to handle this new functionality.
Check for the new ACPI method `GKBK` "Get Keyboard Kind" to determine if
the module should use the new logic or the old logic.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
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>
Signed-off-by: Tim Crawford <tcrawford@system76.com>
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>
Managed devices do not need to be explicitly unregistered or freed, as
this is handled by devres. Drop the call to input_free_device.
Signed-off-by: Tim Crawford <tcrawford@system76.com>
input_free_device only needs to be called if input_register_device
failed, not in all error cases. Per devm_input_allocate_device
documentation, managed devices do not need to be explicitly unregistered
or freed, so do not add any other cleanup for the device.
Fixes: c169971892 ("Address feedback from upstream")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
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>