Re: [PATCH 02/11] leds: add binding to check support for LED hw control

From: Andrew Lunn
Date: Sun Apr 30 2023 - 14:08:51 EST


> + /*
> + * Check if the LED driver supports the requested mode provided by the
> + * defined supported trigger to setup the LED to hw control mode.
> + */
> + int (*hw_control_is_supported)(struct led_classdev *led_cdev,
> + unsigned long flags);

Hi Christian

This needs better documentation. What is the expected return value? My
initial implementation for the Marvell driver did not work. I returned
-EINVAL if it was not supported and some value >= 0 if it was
supported. And most times, it was > 0, not 0.

However, when i look at the trigger code:

/* Check if the requested mode is supported */
ret = led_cdev->hw_control_is_supported(led_cdev, hw_mode);
if (ret)
return ret;

*can_use_hw_control = true;

Anything other than 0 means it is not supported.

Andrew