Release 4.7 drivers/leds/trigger/ledtrig-timer.c
/*
* LED Kernel Timer Trigger
*
* Copyright 2005-2006 Openedhand Ltd.
*
* Author: Richard Purdie <rpurdie@openedhand.com>
*
* 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.
*
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/ctype.h>
#include <linux/leds.h>
static ssize_t led_delay_on_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct led_classdev *led_cdev = dev_get_drvdata(dev);
return sprintf(buf, "%lu\n", led_cdev->blink_delay_on);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
richard purdie | richard purdie | 39 | 92.86% | 2 | 50.00% |
johannes berg | johannes berg | 2 | 4.76% | 1 | 25.00% |
sven wegener | sven wegener | 1 | 2.38% | 1 | 25.00% |
| Total | 42 | 100.00% | 4 | 100.00% |
static ssize_t led_delay_on_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size)
{
struct led_classdev *led_cdev = dev_get_drvdata(dev);
unsigned long state;
ssize_t ret = -EINVAL;
ret = kstrtoul(buf, 10, &state);
if (ret)
return ret;
led_blink_set(led_cdev, &state, &led_cdev->blink_delay_off);
led_cdev->blink_delay_on = state;
return size;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
richard purdie | richard purdie | 53 | 62.35% | 3 | 42.86% |
shuah khan | shuah khan | 16 | 18.82% | 1 | 14.29% |
johan hovold | johan hovold | 6 | 7.06% | 1 | 14.29% |
marton nemeth | marton nemeth | 6 | 7.06% | 1 | 14.29% |
johannes berg | johannes berg | 4 | 4.71% | 1 | 14.29% |
| Total | 85 | 100.00% | 7 | 100.00% |
static ssize_t led_delay_off_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct led_classdev *led_cdev = dev_get_drvdata(dev);
return sprintf(buf, "%lu\n", led_cdev->blink_delay_off);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
richard purdie | richard purdie | 39 | 92.86% | 2 | 50.00% |
johannes berg | johannes berg | 2 | 4.76% | 1 | 25.00% |
sven wegener | sven wegener | 1 | 2.38% | 1 | 25.00% |
| Total | 42 | 100.00% | 4 | 100.00% |
static ssize_t led_delay_off_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size)
{
struct led_classdev *led_cdev = dev_get_drvdata(dev);
unsigned long state;
ssize_t ret = -EINVAL;
ret = kstrtoul(buf, 10, &state);
if (ret)
return ret;
led_blink_set(led_cdev, &led_cdev->blink_delay_on, &state);
led_cdev->blink_delay_off = state;
return size;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
richard purdie | richard purdie | 52 | 61.18% | 3 | 42.86% |
shuah khan | shuah khan | 16 | 18.82% | 1 | 14.29% |
marton nemeth | marton nemeth | 7 | 8.24% | 1 | 14.29% |
johan hovold | johan hovold | 6 | 7.06% | 1 | 14.29% |
johannes berg | johannes berg | 4 | 4.71% | 1 | 14.29% |
| Total | 85 | 100.00% | 7 | 100.00% |
static DEVICE_ATTR(delay_on, 0644, led_delay_on_show, led_delay_on_store);
static DEVICE_ATTR(delay_off, 0644, led_delay_off_show, led_delay_off_store);
static void timer_trig_activate(struct led_classdev *led_cdev)
{
int rc;
led_cdev->trigger_data = NULL;
rc = device_create_file(led_cdev->dev, &dev_attr_delay_on);
if (rc)
return;
rc = device_create_file(led_cdev->dev, &dev_attr_delay_off);
if (rc)
goto err_out_delayon;
led_blink_set(led_cdev, &led_cdev->blink_delay_on,
&led_cdev->blink_delay_off);
led_cdev->activated = true;
return;
err_out_delayon:
device_remove_file(led_cdev->dev, &dev_attr_delay_on);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
richard purdie | richard purdie | 39 | 43.33% | 2 | 28.57% |
jeff garzik | jeff garzik | 28 | 31.11% | 1 | 14.29% |
esben haabendal | esben haabendal | 15 | 16.67% | 1 | 14.29% |
johannes berg | johannes berg | 3 | 3.33% | 1 | 14.29% |
marton nemeth | marton nemeth | 3 | 3.33% | 1 | 14.29% |
shuah khan | shuah khan | 2 | 2.22% | 1 | 14.29% |
| Total | 90 | 100.00% | 7 | 100.00% |
static void timer_trig_deactivate(struct led_classdev *led_cdev)
{
if (led_cdev->activated) {
device_remove_file(led_cdev->dev, &dev_attr_delay_on);
device_remove_file(led_cdev->dev, &dev_attr_delay_off);
led_cdev->activated = false;
}
/* Stop blinking */
led_set_brightness(led_cdev, LED_OFF);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
richard purdie | richard purdie | 36 | 67.92% | 2 | 33.33% |
shuah khan | shuah khan | 8 | 15.09% | 2 | 33.33% |
rodolfo giometti | rodolfo giometti | 5 | 9.43% | 1 | 16.67% |
johannes berg | johannes berg | 4 | 7.55% | 1 | 16.67% |
| Total | 53 | 100.00% | 6 | 100.00% |
static struct led_trigger timer_led_trigger = {
.name = "timer",
.activate = timer_trig_activate,
.deactivate = timer_trig_deactivate,
};
static int __init timer_trig_init(void)
{
return led_trigger_register(&timer_led_trigger);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
richard purdie | richard purdie | 16 | 100.00% | 1 | 100.00% |
| Total | 16 | 100.00% | 1 | 100.00% |
static void __exit timer_trig_exit(void)
{
led_trigger_unregister(&timer_led_trigger);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
richard purdie | richard purdie | 15 | 100.00% | 1 | 100.00% |
| Total | 15 | 100.00% | 1 | 100.00% |
module_init(timer_trig_init);
module_exit(timer_trig_exit);
MODULE_AUTHOR("Richard Purdie <rpurdie@openedhand.com>");
MODULE_DESCRIPTION("Timer LED trigger");
MODULE_LICENSE("GPL");
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
richard purdie | richard purdie | 379 | 73.17% | 3 | 23.08% |
shuah khan | shuah khan | 42 | 8.11% | 3 | 23.08% |
jeff garzik | jeff garzik | 28 | 5.41% | 1 | 7.69% |
johannes berg | johannes berg | 19 | 3.67% | 1 | 7.69% |
marton nemeth | marton nemeth | 16 | 3.09% | 1 | 7.69% |
esben haabendal | esben haabendal | 15 | 2.90% | 1 | 7.69% |
johan hovold | johan hovold | 12 | 2.32% | 1 | 7.69% |
rodolfo giometti | rodolfo giometti | 5 | 0.97% | 1 | 7.69% |
sven wegener | sven wegener | 2 | 0.39% | 1 | 7.69% |
| Total | 518 | 100.00% | 13 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.