2 * LEDs driver for Amstrad Delta (E3)
4 * Copyright (C) 2006 Jonathan McDowell <noodles@earth.li>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/module.h>
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/leds.h>
16 #include <plat/board-ams-delta.h>
21 struct ams_delta_led
{
22 struct led_classdev cdev
;
26 static void ams_delta_led_set(struct led_classdev
*led_cdev
,
27 enum led_brightness value
)
29 struct ams_delta_led
*led_dev
=
30 container_of(led_cdev
, struct ams_delta_led
, cdev
);
33 ams_delta_latch1_write(led_dev
->bitmask
, led_dev
->bitmask
);
35 ams_delta_latch1_write(led_dev
->bitmask
, 0);
38 static struct ams_delta_led ams_delta_leds
[] = {
41 .name
= "ams-delta::camera",
42 .brightness_set
= ams_delta_led_set
,
44 .bitmask
= AMS_DELTA_LATCH1_LED_CAMERA
,
48 .name
= "ams-delta::advert",
49 .brightness_set
= ams_delta_led_set
,
51 .bitmask
= AMS_DELTA_LATCH1_LED_ADVERT
,
55 .name
= "ams-delta::email",
56 .brightness_set
= ams_delta_led_set
,
58 .bitmask
= AMS_DELTA_LATCH1_LED_EMAIL
,
62 .name
= "ams-delta::handsfree",
63 .brightness_set
= ams_delta_led_set
,
65 .bitmask
= AMS_DELTA_LATCH1_LED_HANDSFREE
,
69 .name
= "ams-delta::voicemail",
70 .brightness_set
= ams_delta_led_set
,
72 .bitmask
= AMS_DELTA_LATCH1_LED_VOICEMAIL
,
76 .name
= "ams-delta::voice",
77 .brightness_set
= ams_delta_led_set
,
79 .bitmask
= AMS_DELTA_LATCH1_LED_VOICE
,
83 static int ams_delta_led_probe(struct platform_device
*pdev
)
87 for (i
= 0; i
< ARRAY_SIZE(ams_delta_leds
); i
++) {
88 ams_delta_leds
[i
].cdev
.flags
|= LED_CORE_SUSPENDRESUME
;
89 ret
= led_classdev_register(&pdev
->dev
,
90 &ams_delta_leds
[i
].cdev
);
98 led_classdev_unregister(&ams_delta_leds
[i
].cdev
);
102 static int ams_delta_led_remove(struct platform_device
*pdev
)
106 for (i
= 0; i
< ARRAY_SIZE(ams_delta_leds
); i
++)
107 led_classdev_unregister(&ams_delta_leds
[i
].cdev
);
112 static struct platform_driver ams_delta_led_driver
= {
113 .probe
= ams_delta_led_probe
,
114 .remove
= ams_delta_led_remove
,
116 .name
= "ams-delta-led",
117 .owner
= THIS_MODULE
,
121 module_platform_driver(ams_delta_led_driver
);
123 MODULE_AUTHOR("Jonathan McDowell <noodles@earth.li>");
124 MODULE_DESCRIPTION("Amstrad Delta LED driver");
125 MODULE_LICENSE("GPL");
126 MODULE_ALIAS("platform:ams-delta-led");