aboutsummaryrefslogtreecommitdiff
path: root/drivers/leds/trigger/ledtrig-heartbeat.c
AgeCommit message (Collapse)AuthorFilesLines
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner1-4/+1
Based on 2 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Enrico Weigelt <[email protected]> Reviewed-by: Kate Stewart <[email protected]> Reviewed-by: Allison Randal <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-07-05leds: heartbeat trigger: simplifications from core changesUwe Kleine-König1-22/+19
The trigger core learned error handling for the activate callback and can handle device attributes now. This allows simplifying the driver considerably. Note that .deactivate() is only called when .activate() succeeded, so the check for .activated can go away in .deactivate(). Also make use of module_led_trigger() and the accessor function to get and set trigger_data. Signed-off-by: Uwe Kleine-König <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Jacek Anaszewski <[email protected]>
2018-07-05leds: triggers: let struct led_trigger::activate() return an error codeUwe Kleine-König1-3/+5
Given that activating a trigger can fail, let the callback return an indication. This prevents to have a trigger active according to the "trigger" sysfs attribute but not functional. All users are changed accordingly to return 0 for now. There is no intended change in behaviour. Signed-off-by: Uwe Kleine-König <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Jacek Anaszewski <[email protected]>
2018-07-05leds: triggers: make the MODULE_LICENSE string match the actual licenseUwe Kleine-König1-2/+2
These files are licensed under GPL version 2 only. So use "GPL v2" instead of "GPL" (which means v2 or later). Also remove an empty (but commented) line at the end of the license header which nicely proves in the context that the drivers are really v2 only :-) Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Jacek Anaszewski <[email protected]>
2017-10-06leds: ledtrig-heartbeat: Convert timers to use timer_setup()Kees Cook1-6/+10
Instead of using .data directly, convert to from_timer. Since the trigger_data is allocated separately, the led_cdev must be explicitly tracked for the callback. Cc: Richard Purdie <[email protected]> Cc: Pavel Machek <[email protected]> Cc: Zhang Bo <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: [email protected] Cc: Thomas Gleixner <[email protected]> Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Jacek Anaszewski <[email protected]>
2017-06-13Revert "leds: handle suspend/resume in heartbeat trigger"Zhang Bo1-31/+0
This reverts commit 5ab92a7cb82c66bf30685583a38a18538e3807db. System cannot enter suspend mode because of heartbeat led trigger. In autosleep_wq, try_to_suspend function will try to enter suspend mode in specific period. it will get wakeup_count then call pm_notifier chain callback function and freeze processes. Heartbeat_pm_notifier is called and it call led_trigger_unregister to change the trigger of led device to none. It will send uevent message and the wakeup source count changed. As wakeup_count changed, suspend will abort. Fixes: 5ab92a7cb82c ("leds: handle suspend/resume in heartbeat trigger") Signed-off-by: Zhang Bo <[email protected]> Acked-by: Pavel Machek <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Jacek Anaszewski <[email protected]>
2017-03-02sched/headers: Prepare for new header dependencies before moving code to ↵Ingo Molnar1-0/+1
<linux/sched/loadavg.h> We are going to split <linux/sched/loadavg.h> out of <linux/sched.h>, which will have to be picked up from a couple of .c files. Create a trivial placeholder <linux/sched/topology.h> file that just maps to <linux/sched.h> to make this patch obviously correct and bisectable. Include the new header in the files that are going to need it. Acked-by: Linus Torvalds <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Signed-off-by: Ingo Molnar <[email protected]>
2017-02-14leds: ledtrig-heartbeat: Make top brightness adjustableJacek Anaszewski1-4/+11
LED class heartbeat trigger allowed only for blinking with max_brightness value. This patch adds more flexibility by exploiting part of LED core software blink infrastructure. Signed-off-by: Jacek Anaszewski <[email protected]> Acked-by: Pavel Machek <[email protected]> Reviewed-by: Hans de Goede <[email protected]>
2016-06-08leds: handle suspend/resume in heartbeat triggerLinus Walleij1-0/+31
The following phenomena was observed: when suspending the system, sometimes the heartbeat LED was left on, glowing and wasting power while the rest of the system is asleep, also disturbing power dissapation measures on the odd suspend cycle when it's left on. Clearly this is not how we want the heartbeat trigger to work: it should turn off and leave the LED off during system suspend. This removes the heartbeat trigger when preparing suspend and restores it during resume. The trigger code will make sure all LEDs are left in OFF state after removing the trigger, and will re-enable the trigger on all LEDs after resuming. Cc: [email protected] Signed-off-by: Linus Walleij <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Signed-off-by: Jacek Anaszewski <[email protected]>
2016-01-04leds: core: Add led_set_brightness_nosleep{nopm} functionsJacek Anaszewski1-2/+2
This patch adds led_set_brightness_nosleep() and led_set_brightness_nopm() functions, that guarantee setting LED brightness in a non-blocking way. The latter is used from pm_ops context and doesn't modify the brightness cached in the struct led_classdev. Its execution always ends up with a call to brightness setting op - either directly or through a set_brightness_work, regardless of LED_SUSPENDED flag state. The patch also replaces led_set_brightness_async() with led_set_brightness_nosleep() in all places where the most vital was setting brightness in a non sleeping way but not necessarily asynchronously, which is not needed for non-blocking drivers. Signed-off-by: Jacek Anaszewski <[email protected]> Acked-by: Sakari Ailus <[email protected]>
2015-11-03leds: triggers: add invert to heartbeatJiri Prchal1-2/+45
This patch adds possibility to invert heartbeat blinking. The inverted LED is more time ON then OFF. It's because it looks better when the heartbeat LED is next to other LED which is most time ON. The invert value is exported same way via sysfs in file invert like oneshot. I get inspiration from this trigger. Signed-off-by: Jiri Prchal <[email protected]> Signed-off-by: Jacek Anaszewski <[email protected]>
2014-11-14leds: Add support for setting brightness in a synchronous wayJacek Anaszewski1-1/+1
There are use cases when setting a LED brightness has to have immediate effect (e.g. setting a torch LED brightness). This patch extends LED subsystem to support such operations. The LED subsystem internal API __led_set_brightness is changed to led_set_brightness_async and new led_set_brightness_sync API is added. Signed-off-by: Jacek Anaszewski <[email protected]> Acked-by: Kyungmin Park <[email protected]> Cc: Richard Purdie <[email protected]> Signed-off-by: Bryan Wu <[email protected]>
2013-04-01leds: move LED trigger drivers into new subdirectoryKim, Milo1-0/+161
For better driver management, new subdirectory, 'trigger' is created. All LED trigger drivers are moved into this directory. Internal header, 'leds.h' is included in each LED trigger drivers. Fix the location of header file, "leds.h" -> "../leds.h" in driver files. One exception is here, 'ledtrig-timer.c'. There is no need to include 'leds.h'. so '#include "leds.h"' line was removed. Signed-off-by: Milo(Woogyom) Kim <[email protected]> Signed-off-by: Bryan Wu <[email protected]>