diff options
author | Kristoffer Ericson <kristoffer.ericson@gmail.com> | 2008-02-07 05:10:28 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2008-02-07 05:10:28 -0500 |
commit | d39a7a63eb3971b1b3cc5c181ed526bf437b1c72 (patch) | |
tree | 057ad536088da0ec3fa705ef42eabaa430677640 /drivers/leds | |
parent | 8fe217e7b6d4f186e269fda8aba73a213fad0fa0 (diff) |
leds: Add HP Jornada 6xx driver
Add support for the LEDs on the HP Jornada 620/660/680/690 devices.
Signed-off-by: Kristoffer Ericson <kristoffer.ericson@gmail.com>
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/Kconfig | 7 | ||||
-rw-r--r-- | drivers/leds/Makefile | 1 | ||||
-rw-r--r-- | drivers/leds/leds-hp6xx.c | 120 |
3 files changed, 128 insertions, 0 deletions
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 1dfe5bbc200b..851a3b01781e 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -91,6 +91,13 @@ config LEDS_COBALT_RAQ | |||
91 | help | 91 | help |
92 | This option enables support for the Cobalt Raq series LEDs. | 92 | This option enables support for the Cobalt Raq series LEDs. |
93 | 93 | ||
94 | config LEDS_HP6XX | ||
95 | tristate "LED Support for the HP Jornada 6xx" | ||
96 | depends on LEDS_CLASS && SH_HP6XX | ||
97 | help | ||
98 | This option enables led support for the handheld | ||
99 | HP Jornada 620/660/680/690. | ||
100 | |||
94 | config LEDS_GPIO | 101 | config LEDS_GPIO |
95 | tristate "LED Support for GPIO connected LEDs" | 102 | tristate "LED Support for GPIO connected LEDs" |
96 | depends on LEDS_CLASS && GENERIC_GPIO | 103 | depends on LEDS_CLASS && GENERIC_GPIO |
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 1ec45552b032..bc6afc8dcb27 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile | |||
@@ -19,6 +19,7 @@ obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o | |||
19 | obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o | 19 | obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o |
20 | obj-$(CONFIG_LEDS_CM_X270) += leds-cm-x270.o | 20 | obj-$(CONFIG_LEDS_CM_X270) += leds-cm-x270.o |
21 | obj-$(CONFIG_LEDS_CLEVO_MAIL) += leds-clevo-mail.o | 21 | obj-$(CONFIG_LEDS_CLEVO_MAIL) += leds-clevo-mail.o |
22 | obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o | ||
22 | 23 | ||
23 | # LED Triggers | 24 | # LED Triggers |
24 | obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o | 25 | obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o |
diff --git a/drivers/leds/leds-hp6xx.c b/drivers/leds/leds-hp6xx.c new file mode 100644 index 000000000000..82d4ec384797 --- /dev/null +++ b/drivers/leds/leds-hp6xx.c | |||
@@ -0,0 +1,120 @@ | |||
1 | /* | ||
2 | * LED Triggers Core | ||
3 | * For the HP Jornada 620/660/680/690 handhelds | ||
4 | * | ||
5 | * Copyright 2008 Kristoffer Ericson <kristoffer.ericson@gmail.com> | ||
6 | * this driver is based on leds-spitz.c by Richard Purdie. | ||
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 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/leds.h> | ||
17 | #include <asm/hd64461.h> | ||
18 | #include <asm/hp6xx.h> | ||
19 | |||
20 | static void hp6xxled_green_set(struct led_classdev *led_cdev, enum led_brightness value) | ||
21 | { | ||
22 | u8 v8; | ||
23 | |||
24 | v8 = inb(PKDR); | ||
25 | if (value) | ||
26 | outb(v8 & (~PKDR_LED_GREEN), PKDR); | ||
27 | else | ||
28 | outb(v8 | PKDR_LED_GREEN, PKDR); | ||
29 | } | ||
30 | |||
31 | static void hp6xxled_red_set(struct led_classdev *led_cdev, enum led_brightness value) | ||
32 | { | ||
33 | u16 v16; | ||
34 | |||
35 | v16 = inw(HD64461_GPBDR); | ||
36 | if (value) | ||
37 | outw(v16 & (~HD64461_GPBDR_LED_RED), HD64461_GPBDR); | ||
38 | else | ||
39 | outw(v16 | HD64461_GPBDR_LED_RED, HD64461_GPBDR); | ||
40 | } | ||
41 | |||
42 | static struct led_classdev hp6xx_red_led = { | ||
43 | .name = "hp6xx:red", | ||
44 | .default_trigger = "hp6xx-charge", | ||
45 | .brightness_set = hp6xxled_red_set, | ||
46 | }; | ||
47 | |||
48 | static struct led_classdev hp6xx_green_led = { | ||
49 | .name = "hp6xx:green", | ||
50 | .default_trigger = "ide-disk", | ||
51 | .brightness_set = hp6xxled_green_set, | ||
52 | }; | ||
53 | |||
54 | #ifdef CONFIG_PM | ||
55 | static int hp6xxled_suspend(struct platform_device *dev, pm_message_t state) | ||
56 | { | ||
57 | led_classdev_suspend(&hp6xx_red_led); | ||
58 | led_classdev_suspend(&hp6xx_green_led); | ||
59 | return 0; | ||
60 | } | ||
61 | |||
62 | static int hp6xxled_resume(struct platform_device *dev) | ||
63 | { | ||
64 | led_classdev_resume(&hp6xx_red_led); | ||
65 | led_classdev_resume(&hp6xx_green_led); | ||
66 | return 0; | ||
67 | } | ||
68 | #endif | ||
69 | |||
70 | static int hp6xxled_probe(struct platform_device *pdev) | ||
71 | { | ||
72 | int ret; | ||
73 | |||
74 | ret = led_classdev_register(&pdev->dev, &hp6xx_red_led); | ||
75 | if (ret < 0) | ||
76 | return ret; | ||
77 | |||
78 | ret = led_classdev_register(&pdev->dev, &hp6xx_green_led); | ||
79 | if (ret < 0) | ||
80 | led_classdev_unregister(&hp6xx_red_led); | ||
81 | |||
82 | return ret; | ||
83 | } | ||
84 | |||
85 | static int hp6xxled_remove(struct platform_device *pdev) | ||
86 | { | ||
87 | led_classdev_unregister(&hp6xx_red_led); | ||
88 | led_classdev_unregister(&hp6xx_green_led); | ||
89 | |||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | static struct platform_driver hp6xxled_driver = { | ||
94 | .probe = hp6xxled_probe, | ||
95 | .remove = hp6xxled_remove, | ||
96 | #ifdef CONFIG_PM | ||
97 | .suspend = hp6xxled_suspend, | ||
98 | .resume = hp6xxled_resume, | ||
99 | #endif | ||
100 | .driver = { | ||
101 | .name = "hp6xx-led", | ||
102 | }, | ||
103 | }; | ||
104 | |||
105 | static int __init hp6xxled_init(void) | ||
106 | { | ||
107 | return platform_driver_register(&hp6xxled_driver); | ||
108 | } | ||
109 | |||
110 | static void __exit hp6xxled_exit(void) | ||
111 | { | ||
112 | platform_driver_unregister(&hp6xxled_driver); | ||
113 | } | ||
114 | |||
115 | module_init(hp6xxled_init); | ||
116 | module_exit(hp6xxled_exit); | ||
117 | |||
118 | MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); | ||
119 | MODULE_DESCRIPTION("HP Jornada 6xx LED driver"); | ||
120 | MODULE_LICENSE("GPL"); | ||