Re: [PATCH leds/for-next v1 2/2] leds: turris-omnia: Add support for 256 brightness values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon 2019-04-29 21:44:33, Marek Behún wrote:
> The controller supports setting brightness of each channel of the RGB
> LEDs to values 0-255. We do not support RGB LED class yet, but we can
> use this to be able to have 256 brightness levels for each LED, instead
> of just on/off state.
> 
> Signed-off-by: Marek Behún <marek.behun@xxxxxx>

Have you tested this?

> diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c
> index dc9fac56b13a..0097e62e25d8 100644
> --- a/drivers/leds/leds-turris-omnia.c
> +++ b/drivers/leds/leds-turris-omnia.c
> @@ -54,7 +54,7 @@ static int omnia_led_brightness_set_blocking(struct led_classdev *led,
>  	struct omnia_leds *leds = dev_get_drvdata(led->dev->parent);
>  	int idx = omnia_led_idx(leds, led);
>  	int ret;
> -	u8 state;
> +	u8 buf[5], state;
>  
>  	if (idx < 0)
>  		return idx;
> @@ -63,8 +63,16 @@ static int omnia_led_brightness_set_blocking(struct led_classdev *led,
>  	if (brightness)
>  		state |= CMD_LED_STATE_ON;
>  
> +	buf[0] = CMD_LED_COLOR;
> +	buf[1] = idx;
> +	buf[2] = buf[3] = buf[4] = brightness;
> +
>  	mutex_lock(&leds->lock);
> +
>  	ret = i2c_smbus_write_byte_data(leds->client, CMD_LED_STATE, state);
> +	if (ret >= 0)

&& brightness

?

> +		ret = i2c_master_send(leds->client, buf, 5);
> +
>  	mutex_unlock(&leds->lock);

But more importantly,

        led->cdev.max_brightness = 1;

needs to be changed... right?
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux