[ALSA] oxygen: use SPDIF input only if present
[linux-2.6/mini2440.git] / drivers / leds / ledtrig-ide-disk.c
blob54b155c7026f94c72ddc527a949474599d7a3c29
1 /*
2 * LED IDE-Disk Activity Trigger
4 * Copyright 2006 Openedhand Ltd.
6 * Author: Richard Purdie <rpurdie@openedhand.com>
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.
14 #include <linux/module.h>
15 #include <linux/jiffies.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/timer.h>
19 #include <linux/leds.h>
21 static void ledtrig_ide_timerfunc(unsigned long data);
23 DEFINE_LED_TRIGGER(ledtrig_ide);
24 static DEFINE_TIMER(ledtrig_ide_timer, ledtrig_ide_timerfunc, 0, 0);
25 static int ide_activity;
26 static int ide_lastactivity;
28 void ledtrig_ide_activity(void)
30 ide_activity++;
31 if (!timer_pending(&ledtrig_ide_timer))
32 mod_timer(&ledtrig_ide_timer, jiffies + msecs_to_jiffies(10));
34 EXPORT_SYMBOL(ledtrig_ide_activity);
36 static void ledtrig_ide_timerfunc(unsigned long data)
38 if (ide_lastactivity != ide_activity) {
39 ide_lastactivity = ide_activity;
40 led_trigger_event(ledtrig_ide, LED_FULL);
41 mod_timer(&ledtrig_ide_timer, jiffies + msecs_to_jiffies(10));
42 } else {
43 led_trigger_event(ledtrig_ide, LED_OFF);
47 static int __init ledtrig_ide_init(void)
49 led_trigger_register_simple("ide-disk", &ledtrig_ide);
50 return 0;
53 static void __exit ledtrig_ide_exit(void)
55 led_trigger_unregister_simple(ledtrig_ide);
58 module_init(ledtrig_ide_init);
59 module_exit(ledtrig_ide_exit);
61 MODULE_AUTHOR("Richard Purdie <rpurdie@openedhand.com>");
62 MODULE_DESCRIPTION("LED IDE Disk Activity Trigger");
63 MODULE_LICENSE("GPL");