The problem is, however, that with LEDs that are connected directly to the SOC via a GPIO, the LED cannot be switched on or off. Because the 'leds-gpio' device driver does not need a delayed work. If we look at the callstack for the function 'led_set_brightness_sync', then at the end it is checked whether the LED device driver has the function 'brightness_set_blocking' implemented. This is not the case for the 'leds-gpio' device. The function 'brightness_set_blocking' returns LED devices -ENOTSUPP. This is not evaluated in 'ledtrig-tty' trigger. In order for the trigger to also work with LED that does not have the 'brightness_set_blocking' function implemented, we must therefore use the internal API of the LED subsystem and use the function 'led_set_brightness_nosleep'. Signed-off-by: Florian Eckert <fe@xxxxxxxxxx> --- drivers/leds/trigger/ledtrig-tty.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/leds/trigger/ledtrig-tty.c b/drivers/leds/trigger/ledtrig-tty.c index d3407830fa69..132e809898a7 100644 --- a/drivers/leds/trigger/ledtrig-tty.c +++ b/drivers/leds/trigger/ledtrig-tty.c @@ -7,6 +7,8 @@ #include <linux/tty.h> #include <uapi/linux/serial.h> +#include "../leds.h" + enum tty_led_mode { TTY_LED_RXTX, TTY_LED_CTS, @@ -164,9 +166,9 @@ static void ledtrig_tty_flags(struct ledtrig_tty_data *trigger_data, unsigned in status = tty_get_mget(trigger_data->tty); if (status & flag) - led_set_brightness_sync(trigger_data->led_cdev, LED_ON); + led_set_brightness_nosleep(trigger_data->led_cdev, LED_ON); else - led_set_brightness_sync(trigger_data->led_cdev, LED_OFF); + led_set_brightness_nosleep(trigger_data->led_cdev, LED_OFF); } static void ledtrig_tty_work(struct work_struct *work) @@ -229,12 +231,12 @@ static void ledtrig_tty_work(struct work_struct *work) } if (icount.rx != trigger_data->rx || icount.tx != trigger_data->tx) { - led_set_brightness_sync(trigger_data->led_cdev, LED_ON); + led_set_brightness_nosleep(trigger_data->led_cdev, LED_ON); trigger_data->rx = icount.rx; trigger_data->tx = icount.tx; } else { - led_set_brightness_sync(trigger_data->led_cdev, LED_OFF); + led_set_brightness_nosleep(trigger_data->led_cdev, LED_OFF); } break; } -- 2.30.2