Skip to content

Commit df40a23

Browse files
committed
platform/x86: x86-android-tablets: Adjust Xiaomi Pad 2 bottom bezel touch buttons LED
The "input-events" LED trigger used to turn on the backlight LEDs had to be rewritten to use led_trigger_register_simple() + led_trigger_event() to fix a serious locking issue. This means it no longer supports using blink_brightness to set a per LED brightness for the trigger and it no longer sets LED_CORE_SUSPENDRESUME. Adjust the MiPad 2 bottom bezel touch buttons LED class device to match: 1. Make LED_FULL the maximum brightness to fix the LED brightness being very low when on. 2. Set flags = LED_CORE_SUSPENDRESUME. Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 305790d commit df40a23

File tree

1 file changed

+5
-5
lines changed
  • drivers/platform/x86/x86-android-tablets

1 file changed

+5
-5
lines changed

drivers/platform/x86/x86-android-tablets/other.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ static const struct software_node *ktd2026_node_group[] = {
670670
* is controlled by the "pwm_soc_lpss_2" PWM output.
671671
*/
672672
#define XIAOMI_MIPAD2_LED_PERIOD_NS 19200
673-
#define XIAOMI_MIPAD2_LED_DEFAULT_DUTY 6000 /* From Android kernel */
673+
#define XIAOMI_MIPAD2_LED_MAX_DUTY_NS 6000 /* From Android kernel */
674674

675675
static struct pwm_device *xiaomi_mipad2_led_pwm;
676676

@@ -679,7 +679,7 @@ static int xiaomi_mipad2_brightness_set(struct led_classdev *led_cdev,
679679
{
680680
struct pwm_state state = {
681681
.period = XIAOMI_MIPAD2_LED_PERIOD_NS,
682-
.duty_cycle = val,
682+
.duty_cycle = XIAOMI_MIPAD2_LED_MAX_DUTY_NS * val / LED_FULL,
683683
/* Always set PWM enabled to avoid the pin floating */
684684
.enabled = true,
685685
};
@@ -701,11 +701,11 @@ static int __init xiaomi_mipad2_init(struct device *dev)
701701
return -ENOMEM;
702702

703703
led_cdev->name = "mipad2:white:touch-buttons-backlight";
704-
led_cdev->max_brightness = XIAOMI_MIPAD2_LED_PERIOD_NS;
705-
/* "input-events" trigger uses blink_brightness */
706-
led_cdev->blink_brightness = XIAOMI_MIPAD2_LED_DEFAULT_DUTY;
704+
led_cdev->max_brightness = LED_FULL;
707705
led_cdev->default_trigger = "input-events";
708706
led_cdev->brightness_set_blocking = xiaomi_mipad2_brightness_set;
707+
/* Turn LED off during suspend */
708+
led_cdev->flags = LED_CORE_SUSPENDRESUME;
709709

710710
ret = devm_led_classdev_register(dev, led_cdev);
711711
if (ret)

0 commit comments

Comments
 (0)