hh.org updates
[hh.org.git] / arch / arm / mach-pxa / hx4700 / hx4700_leds.c
blobbb7e43643fa90fa8a05e56960b1011d0e31833e1
1 /*
2 * LEDs support for the HP iPaq hx4700
4 * Copyright (c) 2006 Anton Vorontsov <cbou@mail.ru>
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive for
8 * more details.
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/leds.h>
17 #include <asm/hardware/ipaq-asic3.h>
18 #include <linux/soc/asic3_base.h>
19 #include <asm/mach-types.h>
20 #include <asm/arch/ipaq.h>
21 #include <asm/hardware/asic3_leds.h>
23 DEFINE_LED_TRIGGER_SHARED_GLOBAL(hx4700_radio_trig);
24 EXPORT_LED_TRIGGER_SHARED(hx4700_radio_trig);
26 extern struct platform_device hx4700_asic3;
28 struct asic3_led hx4700_leds[] = {
30 .led_cdev = {
31 .name = "hx4700:amber",
32 .default_trigger = "hx4700-charging",
34 .hw_num = 0,
38 .led_cdev = {
39 .name = "hx4700:green",
40 .default_trigger = "hx4700-chargefull",
42 .hw_num = 1,
45 .led_cdev = {
46 .name = "hx4700:blue",
47 .default_trigger = "hx4700-radio",
49 .hw_num = 2,
53 void hx4700_leds_release(struct device *dev)
55 return;
58 static
59 struct asic3_leds_machinfo hx4700_leds_machinfo = {
60 .num_leds = ARRAY_SIZE(hx4700_leds),
61 .leds = hx4700_leds,
62 .asic3_pdev = &hx4700_asic3,
65 static
66 struct platform_device hx4700_leds_pdev = {
67 .name = "asic3-leds",
68 .dev = {
69 .platform_data = &hx4700_leds_machinfo,
70 .release = hx4700_leds_release,
74 static
75 int __init hx4700_leds_init(void)
77 int ret;
78 printk("hx4700 LEDs Driver\n");
79 led_trigger_register_shared("hx4700-radio", &hx4700_radio_trig);
81 ret = asic3_leds_register();
82 if (ret) goto asic3_leds_failed;
84 ret = platform_device_register(&hx4700_leds_pdev);
85 if (ret) goto platform_device_failed;
87 goto success;
89 platform_device_failed:
90 asic3_leds_unregister();
91 asic3_leds_failed:
92 led_trigger_unregister_shared(hx4700_radio_trig);
93 printk("hx4700 LEDs Driver failed to init");
94 success:
95 return ret;
98 static
99 void __exit hx4700_leds_exit(void)
101 led_trigger_unregister_shared(hx4700_radio_trig);
102 platform_device_unregister(&hx4700_leds_pdev);
103 asic3_leds_unregister();
104 return;
107 module_init(hx4700_leds_init);
108 module_exit(hx4700_leds_exit);
110 MODULE_AUTHOR("Anton Vorontsov <cbou@mail.ru>");
111 MODULE_DESCRIPTION("HP iPAQ hx4700 LEDs driver");
112 MODULE_LICENSE("GPL");