hh.org updates
[hh.org.git] / arch / arm / mach-pxa / h4000 / h4000_leds.c
blob175ca995cd21919134dc0356ac9df499c0d554da
1 /*
2 * LEDs support for the HP iPaq h4000
4 * Copyright (c) 2006 Anton Vorontsov <cbou@mail.ru>
5 * Copyright (c) 2006 Paul Sokolovsky <pmiscml@gmail.com>
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive for
9 * more details.
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
16 #include <linux/leds.h>
18 #include <asm/hardware/ipaq-asic3.h>
19 #include <linux/soc/asic3_base.h>
20 #include <asm/mach-types.h>
21 #include <asm/arch/ipaq.h>
22 #include <asm/hardware/asic3_leds.h>
24 DEFINE_LED_TRIGGER_SHARED_GLOBAL(h4000_radio_trig);
25 EXPORT_LED_TRIGGER_SHARED(h4000_radio_trig);
27 extern struct platform_device h4000_asic3;
29 struct asic3_led h4000_leds[] = {
31 .led_cdev = {
32 .name = "h4000:red",
33 .default_trigger = "h4000-charging",
35 .hw_num = 0,
39 .led_cdev = {
40 .name = "h4000:right-green",
41 .default_trigger = "h4000-chargefull",
43 .hw_num = 1,
46 .led_cdev = {
47 .name = "h4000:left-green",
48 .default_trigger = "h4000-wifi",
50 .hw_num = -1,
51 .gpio_num = 4,
54 .led_cdev = {
55 .name = "h4000:blue",
56 .default_trigger = "h4000-bt",
58 .hw_num = -1,
59 .gpio_num = 5,
63 void h4000_leds_release(struct device *dev)
65 return;
68 static
69 struct asic3_leds_machinfo h4000_leds_machinfo = {
70 .num_leds = ARRAY_SIZE(h4000_leds),
71 .leds = h4000_leds,
72 .asic3_pdev = &h4000_asic3,
75 static
76 struct platform_device h4000_leds_pdev = {
77 .name = "asic3-leds",
78 .dev = {
79 .platform_data = &h4000_leds_machinfo,
80 .release = h4000_leds_release,
84 static
85 int __init h4000_leds_init(void)
87 int ret;
88 printk("h4000 LEDs Driver\n");
89 led_trigger_register_shared("h4000-radio", &h4000_radio_trig);
91 ret = asic3_leds_register();
92 if (ret) goto asic3_leds_failed;
94 ret = platform_device_register(&h4000_leds_pdev);
95 if (ret) goto platform_device_failed;
97 goto success;
99 platform_device_failed:
100 asic3_leds_unregister();
101 asic3_leds_failed:
102 led_trigger_unregister_shared(h4000_radio_trig);
103 printk("h4000 LEDs Driver failed to init");
104 success:
105 return ret;
108 static
109 void __exit h4000_leds_exit(void)
111 led_trigger_unregister_shared(h4000_radio_trig);
112 platform_device_unregister(&h4000_leds_pdev);
113 asic3_leds_unregister();
114 return;
117 module_init(h4000_leds_init);
118 module_exit(h4000_leds_exit);
120 MODULE_AUTHOR("Paul Sokolovsky <pmiscml@gmail.com>");
121 MODULE_DESCRIPTION("HP iPAQ h4000 LEDs driver");
122 MODULE_LICENSE("GPL");