Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946068AbbEOOJM (ORCPT ); Fri, 15 May 2015 10:09:12 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:34754 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422897AbbEOOJJ (ORCPT ); Fri, 15 May 2015 10:09:09 -0400 X-AuditID: cbfec7f5-f794b6d000001495-28-5555fe02dc14 Message-id: <5555FDFF.5060402@samsung.com> Date: Fri, 15 May 2015 16:09:03 +0200 From: Jacek Anaszewski User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8 MIME-version: 1.0 To: Stas Sergeev Cc: linux-leds@vger.kernel.org, Linux kernel , Bryan Wu , Richard Purdie , Kyungmin Park , Stas Sergeev Subject: Re: [PATCH v2] leds: fix brightness changing when software blinking is active References: <5554BE12.7050209@list.ru> <5555AA7F.1000001@samsung.com> In-reply-to: <5555AA7F.1000001@samsung.com> Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRmVeSWpSXmKPExsVy+t/xa7pM/0JDDeZvNLA4unMik8XZpjfs Fpd3zWGz2PpmHaPF7l1PWS1aNzUwW3T2TWNxYPfYOesuu8e9LZeZPfbM/8Hq0bdlFaNH06l2 Vo/Pm+QC2KK4bFJSczLLUov07RK4Mk5t3Mha0CNW8ebcCfYGxlWCXYycHBICJhLPf55lhLDF JC7cW8/WxcjFISSwlFHixuzbrBDOM0aJCQ3PWUGqeAW0JDqbGsBsFgFViYfbO5lBbDYBQ4mf L14zgdiiAhESf07vg6oXlPgx+R5LFyMHh4iAvMSGxjKQmcwCrxglXr56CLZZGKi+fdphFhBb SMBV4umJCWwgNqeAtsTJC8fB4swCZhKPWtYxQ9jyEpvXvGWewCgwC8mKWUjKZiEpW8DIvIpR NLU0uaA4KT3XSK84Mbe4NC9dLzk/dxMjJOC/7mBceszqEKMAB6MSD+8J1tBQIdbEsuLK3EOM EhzMSiK8v14AhXhTEiurUovy44tKc1KLDzFKc7AoifPO3PU+REggPbEkNTs1tSC1CCbLxMEp 1cCYNyXavXyimP7+E223nko2rVHTW5rGVPlJYeXfbV17W3glD///tvbN7MOp8aFuh++ETzF6 nzavNjIrqcZdfUJCeWBEQOGrFDmliW8ucZbce/JYfEdHswTbm28zTaWXz+aXd4x5uXXiGz6j 2x2Xt7WJnTrzf+oDdg7v3U0aC/Z+DNZV2L3namSOEktxRqKhFnNRcSIAaar6U3QCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2996 Lines: 82 On 05/15/2015 10:12 AM, Jacek Anaszewski wrote: > Hi Stas, > > On 05/14/2015 05:24 PM, Stas Sergeev wrote: >> >> The following sequence: >> echo timer >/sys/class/leds//trigger >> echo 1 >/sys/class/leds//brightness >> should change the ON brightness for blinking. >> The function led_set_brightness() was mistakenly initiating the >> delayed blink stop procedure, which resulted in no blinking with >> the timer trigger still active. >> >> This patch fixes the problem by changing led_set_brightness() >> to not initiate the delayed blink stop when brightness is not 0. This commit message is not valid for this version of the patch. Current patch just allows to change the LED brightness while timer trigger is active. Please fix this description. >> >> CC: Bryan Wu >> CC: Richard Purdie >> CC: Jacek Anaszewski >> CC: Kyungmin Park >> CC: linux-leds@vger.kernel.org >> CC: linux-kernel@vger.kernel.org >> >> Signed-off-by: Stas Sergeev >> --- >> drivers/leds/led-class.c | 5 +++++ >> drivers/leds/led-core.c | 5 +++-- >> 2 files changed, 8 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c >> index 795ec99..65c2c80 100644 >> --- a/drivers/leds/led-class.c >> +++ b/drivers/leds/led-class.c >> @@ -121,6 +121,11 @@ static void led_timer_function(unsigned long data) >> brightness = led_get_brightness(led_cdev); >> if (!brightness) { >> /* Time to switch the LED on. */ >> + if (led_cdev->delayed_set_value) { >> + led_cdev->blink_brightness = >> + led_cdev->delayed_set_value; >> + led_cdev->delayed_set_value = 0; >> + } >> brightness = led_cdev->blink_brightness; >> delay = led_cdev->blink_delay_on; >> } else { >> diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c >> index 356e851..a90dd26 100644 >> --- a/drivers/leds/led-core.c >> +++ b/drivers/leds/led-core.c >> @@ -119,10 +119,11 @@ void led_set_brightness(struct led_classdev >> *led_cdev, >> { >> int ret = 0; >> >> - /* delay brightness setting if need to stop soft-blink timer */ >> + /* delay brightness if soft-blink is active */ >> if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) { >> led_cdev->delayed_set_value = brightness; >> - schedule_work(&led_cdev->set_brightness_work); >> + if (brightness == LED_OFF) >> + schedule_work(&led_cdev->set_brightness_work); >> return; >> } >> > > Acked-by: Jacek Anaszewski > -- Best Regards, Jacek Anaszewski -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/