← Back to team overview

ac100 team mailing list archive

Re: [PATCH 2/2] Minor changes to side LEDs

 

On Sunday 23 October 2011 04:13:32 Pierre-Hugues Husson wrote:
>  When setting a led effect, setting a null effect. EC behaves randomly
> otherwise. Keep led effect enabled on suspend.
> 
> ---
>  drivers/staging/nvec/nvec_leds.c |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/nvec/nvec_leds.c
> b/drivers/staging/nvec/nvec_leds.c index f4cbcd6..f446573 100644
> --- a/drivers/staging/nvec/nvec_leds.c
> +++ b/drivers/staging/nvec/nvec_leds.c
> @@ -35,8 +35,14 @@ static void nvec_led_brightness_set(struct led_classdev
> *led_cdev, {
>  	struct nvec_led *led = to_nvec_led(led_cdev);
>  	unsigned char buf[] = NVEC_LED_REQ;
> -	buf[4] = value;
> +	struct nvec_msg *msg;
> +
> +	//First write effect 0
> +	msg = nvec_write_sync(led->nvec, buf, sizeof(buf));
> +	nvec_msg_free(led->nvec, msg);
> 
> +	//Then write the effect we want
> +	buf[4] = value;
>  	nvec_write_async(led->nvec, buf, sizeof(buf));

I think there is no need to waste a sync write here. async writes should also 
be in order. 

>  	led->cdev.brightness = value;
> @@ -57,7 +63,6 @@ static int __devinit nvec_led_probe(struct platform_device
> *pdev)
> 
>  	led->cdev.brightness_set = nvec_led_brightness_set;
>  	led->cdev.name = "nvec-led";
> -	led->cdev.flags |= LED_CORE_SUSPENDRESUME;
>  	led->nvec = nvec;
>
>  	platform_set_drvdata(pdev, led);

mmh, looks like the SUSPENDRESUME flag only causes the leds to be off during 
suspend. Is there a reason to preserve them? Does this even work?

Marc


Follow ups

References