3 * For the HP Jornada 620/660/680/690 handhelds
5 * Copyright 2008 Kristoffer Ericson <kristoffer.ericson@gmail.com>
6 * this driver is based on leds-spitz.c by Richard Purdie.
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.
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>
20 static void hp6xxled_green_set(struct led_classdev
*led_cdev
, enum led_brightness value
)
26 outb(v8
& (~PKDR_LED_GREEN
), PKDR
);
28 outb(v8
| PKDR_LED_GREEN
, PKDR
);
31 static void hp6xxled_red_set(struct led_classdev
*led_cdev
, enum led_brightness value
)
35 v16
= inw(HD64461_GPBDR
);
37 outw(v16
& (~HD64461_GPBDR_LED_RED
), HD64461_GPBDR
);
39 outw(v16
| HD64461_GPBDR_LED_RED
, HD64461_GPBDR
);
42 static struct led_classdev hp6xx_red_led
= {
44 .default_trigger
= "hp6xx-charge",
45 .brightness_set
= hp6xxled_red_set
,
48 static struct led_classdev hp6xx_green_led
= {
49 .name
= "hp6xx:green",
50 .default_trigger
= "ide-disk",
51 .brightness_set
= hp6xxled_green_set
,
55 static int hp6xxled_suspend(struct platform_device
*dev
, pm_message_t state
)
57 led_classdev_suspend(&hp6xx_red_led
);
58 led_classdev_suspend(&hp6xx_green_led
);
62 static int hp6xxled_resume(struct platform_device
*dev
)
64 led_classdev_resume(&hp6xx_red_led
);
65 led_classdev_resume(&hp6xx_green_led
);
70 static int hp6xxled_probe(struct platform_device
*pdev
)
74 ret
= led_classdev_register(&pdev
->dev
, &hp6xx_red_led
);
78 ret
= led_classdev_register(&pdev
->dev
, &hp6xx_green_led
);
80 led_classdev_unregister(&hp6xx_red_led
);
85 static int hp6xxled_remove(struct platform_device
*pdev
)
87 led_classdev_unregister(&hp6xx_red_led
);
88 led_classdev_unregister(&hp6xx_green_led
);
93 static struct platform_driver hp6xxled_driver
= {
94 .probe
= hp6xxled_probe
,
95 .remove
= hp6xxled_remove
,
97 .suspend
= hp6xxled_suspend
,
98 .resume
= hp6xxled_resume
,
105 static int __init
hp6xxled_init(void)
107 return platform_driver_register(&hp6xxled_driver
);
110 static void __exit
hp6xxled_exit(void)
112 platform_driver_unregister(&hp6xxled_driver
);
115 module_init(hp6xxled_init
);
116 module_exit(hp6xxled_exit
);
118 MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>");
119 MODULE_DESCRIPTION("HP Jornada 6xx LED driver");
120 MODULE_LICENSE("GPL");