container freezer: document the cgroup freezer subsystem.
[linux-2.6/mini2440.git] / drivers / leds / leds-cm-x270.c
blob836a43d776e61db134f2ec0c37d5323650cbd4a1
1 /*
2 * drivers/leds/leds-cm-x270.c
4 * Copyright 2007 CompuLab Ltd.
5 * Author: Mike Rapoport <mike@compulab.co.il>
7 * Based on leds-corgi.c
8 * Author: Richard Purdie <rpurdie@openedhand.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/platform_device.h>
19 #include <linux/leds.h>
21 #include <mach/hardware.h>
22 #include <mach/pxa-regs.h>
24 #define GPIO_RED_LED (93)
25 #define GPIO_GREEN_LED (94)
27 static void cmx270_red_set(struct led_classdev *led_cdev,
28 enum led_brightness value)
30 if (value)
31 GPCR(GPIO_RED_LED) = GPIO_bit(GPIO_RED_LED);
32 else
33 GPSR(GPIO_RED_LED) = GPIO_bit(GPIO_RED_LED);
36 static void cmx270_green_set(struct led_classdev *led_cdev,
37 enum led_brightness value)
39 if (value)
40 GPCR(GPIO_GREEN_LED) = GPIO_bit(GPIO_GREEN_LED);
41 else
42 GPSR(GPIO_GREEN_LED) = GPIO_bit(GPIO_GREEN_LED);
45 static struct led_classdev cmx270_red_led = {
46 .name = "cm-x270:red",
47 .default_trigger = "nand-disk",
48 .brightness_set = cmx270_red_set,
51 static struct led_classdev cmx270_green_led = {
52 .name = "cm-x270:green",
53 .default_trigger = "heartbeat",
54 .brightness_set = cmx270_green_set,
57 #ifdef CONFIG_PM
58 static int cmx270led_suspend(struct platform_device *dev, pm_message_t state)
60 led_classdev_suspend(&cmx270_red_led);
61 led_classdev_suspend(&cmx270_green_led);
62 return 0;
65 static int cmx270led_resume(struct platform_device *dev)
67 led_classdev_resume(&cmx270_red_led);
68 led_classdev_resume(&cmx270_green_led);
69 return 0;
71 #endif
73 static int cmx270led_probe(struct platform_device *pdev)
75 int ret;
77 ret = led_classdev_register(&pdev->dev, &cmx270_red_led);
78 if (ret < 0)
79 return ret;
81 ret = led_classdev_register(&pdev->dev, &cmx270_green_led);
82 if (ret < 0)
83 led_classdev_unregister(&cmx270_red_led);
85 return ret;
88 static int cmx270led_remove(struct platform_device *pdev)
90 led_classdev_unregister(&cmx270_red_led);
91 led_classdev_unregister(&cmx270_green_led);
92 return 0;
95 static struct platform_driver cmx270led_driver = {
96 .probe = cmx270led_probe,
97 .remove = cmx270led_remove,
98 #ifdef CONFIG_PM
99 .suspend = cmx270led_suspend,
100 .resume = cmx270led_resume,
101 #endif
102 .driver = {
103 .name = "cm-x270-led",
104 .owner = THIS_MODULE,
108 static int __init cmx270led_init(void)
110 return platform_driver_register(&cmx270led_driver);
113 static void __exit cmx270led_exit(void)
115 platform_driver_unregister(&cmx270led_driver);
118 module_init(cmx270led_init);
119 module_exit(cmx270led_exit);
121 MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>");
122 MODULE_DESCRIPTION("CM-x270 LED driver");
123 MODULE_LICENSE("GPL");
124 MODULE_ALIAS("platform:cm-x270-led");