ALSA: oxygen: remove X-Meridian magic number
[linux-2.6/verdex.git] / drivers / leds / leds-corgi.c
blobbc2dcd89f63545478fb28093ed3ae739cc931b03
1 /*
2 * LED Triggers Core
4 * Copyright 2005-2006 Openedhand Ltd.
6 * Author: Richard Purdie <rpurdie@openedhand.com>
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.
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/platform_device.h>
17 #include <linux/leds.h>
18 #include <mach/corgi.h>
19 #include <mach/hardware.h>
20 #include <mach/pxa-regs.h>
21 #include <asm/hardware/scoop.h>
23 static void corgiled_amber_set(struct led_classdev *led_cdev,
24 enum led_brightness value)
26 if (value)
27 GPSR0 = GPIO_bit(CORGI_GPIO_LED_ORANGE);
28 else
29 GPCR0 = GPIO_bit(CORGI_GPIO_LED_ORANGE);
32 static void corgiled_green_set(struct led_classdev *led_cdev,
33 enum led_brightness value)
35 if (value)
36 set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN);
37 else
38 reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN);
41 static struct led_classdev corgi_amber_led = {
42 .name = "corgi:amber:charge",
43 .default_trigger = "sharpsl-charge",
44 .brightness_set = corgiled_amber_set,
47 static struct led_classdev corgi_green_led = {
48 .name = "corgi:green:mail",
49 .default_trigger = "nand-disk",
50 .brightness_set = corgiled_green_set,
53 #ifdef CONFIG_PM
54 static int corgiled_suspend(struct platform_device *dev, pm_message_t state)
56 #ifdef CONFIG_LEDS_TRIGGERS
57 if (corgi_amber_led.trigger &&
58 strcmp(corgi_amber_led.trigger->name, "sharpsl-charge"))
59 #endif
60 led_classdev_suspend(&corgi_amber_led);
61 led_classdev_suspend(&corgi_green_led);
62 return 0;
65 static int corgiled_resume(struct platform_device *dev)
67 led_classdev_resume(&corgi_amber_led);
68 led_classdev_resume(&corgi_green_led);
69 return 0;
71 #endif
73 static int corgiled_probe(struct platform_device *pdev)
75 int ret;
77 ret = led_classdev_register(&pdev->dev, &corgi_amber_led);
78 if (ret < 0)
79 return ret;
81 ret = led_classdev_register(&pdev->dev, &corgi_green_led);
82 if (ret < 0)
83 led_classdev_unregister(&corgi_amber_led);
85 return ret;
88 static int corgiled_remove(struct platform_device *pdev)
90 led_classdev_unregister(&corgi_amber_led);
91 led_classdev_unregister(&corgi_green_led);
92 return 0;
95 static struct platform_driver corgiled_driver = {
96 .probe = corgiled_probe,
97 .remove = corgiled_remove,
98 #ifdef CONFIG_PM
99 .suspend = corgiled_suspend,
100 .resume = corgiled_resume,
101 #endif
102 .driver = {
103 .name = "corgi-led",
104 .owner = THIS_MODULE,
108 static int __init corgiled_init(void)
110 return platform_driver_register(&corgiled_driver);
113 static void __exit corgiled_exit(void)
115 platform_driver_unregister(&corgiled_driver);
118 module_init(corgiled_init);
119 module_exit(corgiled_exit);
121 MODULE_AUTHOR("Richard Purdie <rpurdie@openedhand.com>");
122 MODULE_DESCRIPTION("Corgi LED driver");
123 MODULE_LICENSE("GPL");
124 MODULE_ALIAS("platform:corgi-led");