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/module.h>
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/platform_device.h>
17 #include <linux/leds.h>
18 #include <asm/hd64461.h>
19 #include <mach/hp6xx.h>
21 static void hp6xxled_green_set(struct led_classdev *led_cdev,
22 enum led_brightness value)
28 outb(v8 & (~PKDR_LED_GREEN), PKDR);
30 outb(v8 | PKDR_LED_GREEN, PKDR);
33 static void hp6xxled_red_set(struct led_classdev *led_cdev,
34 enum led_brightness value)
38 v16 = inw(HD64461_GPBDR);
40 outw(v16 & (~HD64461_GPBDR_LED_RED), HD64461_GPBDR);
42 outw(v16 | HD64461_GPBDR_LED_RED, HD64461_GPBDR);
45 static struct led_classdev hp6xx_red_led = {
47 .default_trigger = "hp6xx-charge",
48 .brightness_set = hp6xxled_red_set,
49 .flags = LED_CORE_SUSPENDRESUME,
52 static struct led_classdev hp6xx_green_led = {
53 .name = "hp6xx:green",
54 .default_trigger = "ide-disk",
55 .brightness_set = hp6xxled_green_set,
56 .flags = LED_CORE_SUSPENDRESUME,
59 static int hp6xxled_probe(struct platform_device *pdev)
63 ret = led_classdev_register(&pdev->dev, &hp6xx_red_led);
67 ret = led_classdev_register(&pdev->dev, &hp6xx_green_led);
69 led_classdev_unregister(&hp6xx_red_led);
74 static int hp6xxled_remove(struct platform_device *pdev)
76 led_classdev_unregister(&hp6xx_red_led);
77 led_classdev_unregister(&hp6xx_green_led);
82 static struct platform_driver hp6xxled_driver = {
83 .probe = hp6xxled_probe,
84 .remove = hp6xxled_remove,
91 module_platform_driver(hp6xxled_driver);
93 MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>");
94 MODULE_DESCRIPTION("HP Jornada 6xx LED driver");
95 MODULE_LICENSE("GPL");
96 MODULE_ALIAS("platform:hp6xx-led");