|
From: <mar...@us...> - 2006-10-21 21:46:13
|
Revision: 641
http://svn.sourceforge.net/hackndev/?rev=641&view=rev
Author: marex_z71
Date: 2006-10-21 14:45:59 -0700 (Sat, 21 Oct 2006)
Log Message:
-----------
l4p: PalmLD LED driver - use over sysfs, no triggers set
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c
linux4palm/linux/trunk/drivers/leds/Kconfig
linux4palm/linux/trunk/drivers/leds/Makefile
Added Paths:
-----------
linux4palm/linux/trunk/drivers/leds/leds-palmld.c
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c 2006-10-21 09:47:47 UTC (rev 640)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c 2006-10-21 21:45:59 UTC (rev 641)
@@ -195,6 +195,14 @@
/* platform */
+/*
+ * LEDs
+ */
+static struct platform_device palmldled_device = {
+ .name = "palmld-led",
+ .id = -1,
+};
+
/**
* Backlight
*/
@@ -278,6 +286,7 @@
static struct platform_device *devices[] __initdata = {
&palmld_kbd, &palmld_ac97, &palmld_ide, &palmld_backlight,
+ &palmldled_device,
};
/*********************************************************
Modified: linux4palm/linux/trunk/drivers/leds/Kconfig
===================================================================
--- linux4palm/linux/trunk/drivers/leds/Kconfig 2006-10-21 09:47:47 UTC (rev 640)
+++ linux4palm/linux/trunk/drivers/leds/Kconfig 2006-10-21 21:45:59 UTC (rev 641)
@@ -76,6 +76,12 @@
This option enables support for the LEDs connected to the
AIC3 MA17635 0450 v1.1 MPU Timing Generator.
+config LEDS_PALMLD
+ tristate "LED Support for Palm LifeDrive"
+ depends LEDS_CLASS && MACH_XSCALE_PALMLD
+ help
+ This option enables support for the LEDs on Palm LifeDrive.
+
comment "LED Triggers"
config LEDS_TRIGGERS
Modified: linux4palm/linux/trunk/drivers/leds/Makefile
===================================================================
--- linux4palm/linux/trunk/drivers/leds/Makefile 2006-10-21 09:47:47 UTC (rev 640)
+++ linux4palm/linux/trunk/drivers/leds/Makefile 2006-10-21 21:45:59 UTC (rev 641)
@@ -13,6 +13,7 @@
obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o
obj-$(CONFIG_LEDS_H2200) += h2200_leds.o
obj-$(CONFIG_LEDS_MAGICIAN) += leds-magician.o
+obj-$(CONFIG_LEDS_PALMLD) += leds-palmld.o
# LED Triggers
obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o
Added: linux4palm/linux/trunk/drivers/leds/leds-palmld.c
===================================================================
--- linux4palm/linux/trunk/drivers/leds/leds-palmld.c (rev 0)
+++ linux4palm/linux/trunk/drivers/leds/leds-palmld.c 2006-10-21 21:45:59 UTC (rev 641)
@@ -0,0 +1,114 @@
+/*
+ * Palm LifeDrive LED Driver
+ *
+ * Author: Marek Vasut <mar...@gm...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/leds.h>
+#include <asm/mach-types.h>
+#include <asm/arch/palmld-gpio.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/pxa-regs.h>
+#include <asm/hardware/scoop.h>
+
+static void palmldled_amber_set(struct led_classdev *led_cdev, enum led_brightness value)
+{
+ if (value)
+ SET_PALMLD_GPIO(ORANGE_LED,1);
+ else
+ SET_PALMLD_GPIO(ORANGE_LED,0);
+}
+
+static void palmldled_green_set(struct led_classdev *led_cdev, enum led_brightness value)
+{
+ if (value)
+ SET_PALMLD_GPIO(GREEN_LED,1);
+ else
+ SET_PALMLD_GPIO(GREEN_LED,0);
+}
+
+static struct led_classdev palmld_amber_led = {
+ .name = "palmld:amber",
+ .brightness_set = palmldled_amber_set,
+};
+
+static struct led_classdev palmld_green_led = {
+ .name = "palmld:green",
+ .brightness_set = palmldled_green_set,
+};
+
+#ifdef CONFIG_PM
+static int palmldled_suspend(struct platform_device *dev, pm_message_t state)
+{
+ led_classdev_suspend(&palmld_amber_led);
+ led_classdev_suspend(&palmld_green_led);
+ return 0;
+}
+
+static int palmldled_resume(struct platform_device *dev)
+{
+ led_classdev_resume(&palmld_amber_led);
+ led_classdev_resume(&palmld_green_led);
+ return 0;
+}
+#endif
+
+static int palmldled_probe(struct platform_device *pdev)
+{
+ int ret;
+
+ ret = led_classdev_register(&pdev->dev, &palmld_amber_led);
+ if (ret < 0)
+ return ret;
+
+ ret = led_classdev_register(&pdev->dev, &palmld_green_led);
+ if (ret < 0)
+ led_classdev_unregister(&palmld_amber_led);
+
+ return ret;
+}
+
+static int palmldled_remove(struct platform_device *pdev)
+{
+ led_classdev_unregister(&palmld_amber_led);
+ led_classdev_unregister(&palmld_green_led);
+ return 0;
+}
+
+static struct platform_driver palmldled_driver = {
+ .probe = palmldled_probe,
+ .remove = palmldled_remove,
+#ifdef CONFIG_PM
+ .suspend = palmldled_suspend,
+ .resume = palmldled_resume,
+#endif
+ .driver = {
+ .name = "palmld-led",
+ },
+};
+
+static int __init palmldled_init(void)
+{
+ return platform_driver_register(&palmldled_driver);
+}
+
+static void __exit palmldled_exit(void)
+{
+ platform_driver_unregister(&palmldled_driver);
+}
+
+module_init(palmldled_init);
+module_exit(palmldled_exit);
+
+MODULE_AUTHOR("Marek Vasut <mar...@gm...>");
+MODULE_DESCRIPTION("Palm LifeDrive LED driver");
+MODULE_LICENSE("GPL");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|