• Hans de Goede's avatar
    platform/x86: x86-android-tablets: Create LED device for Xiaomi Pad 2 bottom bezel touch buttons · 9426adb0
    Hans de Goede authored
    The Xiaomi [Mi]Pad 2 has 3 menu / home / back capacitive touch-buttons
    on its bottom bezel. These are backlit by LEDs attached to a TPS61158 LED
    controller which is controlled by the "pwm_soc_lpss_2" PWM output.
    
    Create a LED class device for this, using the new input-events trigger
    as default trigger so that the buttons automatically light up on any
    input activity.
    
    Note alternatively a "leds_pwm" platform device could be created together
    with the necessary fwnode_s_ and a fwnode link to the PWM controller.
    There are 2 downsides to this approach:
    
    1. The code would still need to pwm_get() the PWM controller to get/attach
    a fwnode for the PWM controller fwnode link and setting up the necessary
    fwnodes is non-trivial. So this would likely require more code then simply
    registering the LED class device directly.
    
    2. Currently the leds_pwm driver and its devicetree bindings do not support
    limiting the maximum dutycycle to less then 100% which is required in this
    case (the leds_pwm driver can probably be extended to allow this).
    Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20240509141207.63570-2-hdegoede@redhat.com
    9426adb0
other.c 20.6 KB