• Joseph Strauss's avatar
    leds: Add multicolor support to BlinkM LED driver · 56e8c56c
    Joseph Strauss authored
    Add multicolor support to the BlinkM driver, making it easier to control
    from userspace. The BlinkM LED is a programmable RGB LED. The driver
    currently supports only the regular LED sysfs class, resulting in the
    creation of three distinct classes, one for red, green, and blue. The
    user then has to input three values into the three seperate brightness
    files within those classes. The multicolor LED framework makes the
    device easier to control with the multi_intensity file: the user can
    input three values at once to form a color, while still controlling the
    lightness with the brightness file.
    
    The main struct blinkm_led has changed slightly. The struct led_classdev
    for the regular sysfs classes remain. The blinkm_probe function checks
    CONFIG_LEDS_BLINKM_MULTICOLOR to decide whether to load the seperate
    sysfs classes or the single multicolor one, but never both. The
    blinkm_set_mc_brightness() function had to be added to calculate the
    three color components and then set the fields of the blinkm_data
    structure accordingly.
    Signed-off-by: default avatarJoseph Strauss <jstrauss@mailbox.org>
    Link: https://lore.kernel.org/r/20240710184844.108006-1-jstrauss@mailbox.orgSigned-off-by: default avatarLee Jones <lee@kernel.org>
    56e8c56c
leds-blinkm.rst 2.75 KB