Linux Audio

Check our new training course

Loading...
v6.2
 1// SPDX-License-Identifier: GPL-2.0-only
 2/*
 3 * LED Disk Activity Trigger
 4 *
 5 * Copyright 2006 Openedhand Ltd.
 6 *
 7 * Author: Richard Purdie <rpurdie@openedhand.com>
 
 
 
 
 
 8 */
 9
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/leds.h>
13
14#define BLINK_DELAY 30
15
16DEFINE_LED_TRIGGER(ledtrig_disk);
17DEFINE_LED_TRIGGER(ledtrig_disk_read);
18DEFINE_LED_TRIGGER(ledtrig_disk_write);
19DEFINE_LED_TRIGGER(ledtrig_ide);
20
21void ledtrig_disk_activity(bool write)
22{
23	unsigned long blink_delay = BLINK_DELAY;
24
25	led_trigger_blink_oneshot(ledtrig_disk,
26				  &blink_delay, &blink_delay, 0);
27	led_trigger_blink_oneshot(ledtrig_ide,
28				  &blink_delay, &blink_delay, 0);
29	if (write)
30		led_trigger_blink_oneshot(ledtrig_disk_write,
31					  &blink_delay, &blink_delay, 0);
32	else
33		led_trigger_blink_oneshot(ledtrig_disk_read,
34					  &blink_delay, &blink_delay, 0);
35}
36EXPORT_SYMBOL(ledtrig_disk_activity);
37
38static int __init ledtrig_disk_init(void)
39{
40	led_trigger_register_simple("disk-activity", &ledtrig_disk);
41	led_trigger_register_simple("disk-read", &ledtrig_disk_read);
42	led_trigger_register_simple("disk-write", &ledtrig_disk_write);
43	led_trigger_register_simple("ide-disk", &ledtrig_ide);
44
45	return 0;
46}
47device_initcall(ledtrig_disk_init);
v4.10.11
 
 1/*
 2 * LED Disk Activity Trigger
 3 *
 4 * Copyright 2006 Openedhand Ltd.
 5 *
 6 * Author: Richard Purdie <rpurdie@openedhand.com>
 7 *
 8 * This program is free software; you can redistribute it and/or modify
 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/leds.h>
17
18#define BLINK_DELAY 30
19
20DEFINE_LED_TRIGGER(ledtrig_disk);
 
 
21DEFINE_LED_TRIGGER(ledtrig_ide);
22
23void ledtrig_disk_activity(void)
24{
25	unsigned long blink_delay = BLINK_DELAY;
26
27	led_trigger_blink_oneshot(ledtrig_disk,
28				  &blink_delay, &blink_delay, 0);
29	led_trigger_blink_oneshot(ledtrig_ide,
30				  &blink_delay, &blink_delay, 0);
 
 
 
 
 
 
31}
32EXPORT_SYMBOL(ledtrig_disk_activity);
33
34static int __init ledtrig_disk_init(void)
35{
36	led_trigger_register_simple("disk-activity", &ledtrig_disk);
 
 
37	led_trigger_register_simple("ide-disk", &ledtrig_ide);
38
39	return 0;
40}
41device_initcall(ledtrig_disk_init);