From: <z7...@us...> - 2007-01-08 10:22:05
|
Revision: 739 http://svn.sourceforge.net/hackndev/?rev=739&view=rev Author: z72ka Date: 2007-01-08 02:21:59 -0800 (Mon, 08 Jan 2007) Log Message: ----------- Added support for Zire72 LED Modified Paths: -------------- linux4palm/linux/trunk/drivers/leds/Kconfig Added Paths: ----------- linux4palm/linux/trunk/drivers/leds/led-palmz72.c Modified: linux4palm/linux/trunk/drivers/leds/Kconfig =================================================================== --- linux4palm/linux/trunk/drivers/leds/Kconfig 2007-01-08 10:10:11 UTC (rev 738) +++ linux4palm/linux/trunk/drivers/leds/Kconfig 2007-01-08 10:21:59 UTC (rev 739) @@ -82,6 +82,12 @@ help This option enables support for the LEDs on Palm LifeDrive. +config LEDS_PALMZ72 + tristate "LED Support for PalmOne Zire 72" + depends LEDS_CLASS && MACH_PALMZ72 + help + This option enables support for the LED on PalmOne Zire72. + config LEDS_PALMT650 tristate "LED Support for Palm Treo 650" depends LEDS_CLASS && MACH_XSCALE_PALMTREO650 Added: linux4palm/linux/trunk/drivers/leds/led-palmz72.c =================================================================== --- linux4palm/linux/trunk/drivers/leds/led-palmz72.c (rev 0) +++ linux4palm/linux/trunk/drivers/leds/led-palmz72.c 2007-01-08 10:21:59 UTC (rev 739) @@ -0,0 +1,96 @@ +/* + * Palm Zire72 LED Driver + * + * Author: Jan Herman <2h...@se...> + + * Based on driver from Marek Vasut (Palm Life Drive LED Driver) + * + * 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/palmz72-gpio.h> +#include <asm/arch/hardware.h> +#include <asm/arch/pxa-regs.h> +#include <asm/hardware/scoop.h> + + +static void palmz72led_green_set(struct led_classdev *led_cdev, enum led_brightness value) +{ + if (value) + SET_PALMZ72_GPIO(LED,1); + else + SET_PALMZ72_GPIO(LED,0); +} + +static struct led_classdev palmz72_green_led = { + .name = "led", + .brightness_set = palmz72led_green_set, +}; + +#ifdef CONFIG_PM +static int palmz72led_suspend(struct platform_device *dev, pm_message_t state) +{ + led_classdev_suspend(&palmz72_green_led); + return 0; +} + +static int palmz72led_resume(struct platform_device *dev) +{ + led_classdev_resume(&palmz72_green_led); + return 0; +} +#endif + +static int palmz72led_probe(struct platform_device *pdev) +{ + int ret; + ret = led_classdev_register(&pdev->dev, &palmz72_green_led); + if (ret < 0) + led_classdev_unregister(&palmz72_green_led); + + return ret; +} + +static int palmz72led_remove(struct platform_device *pdev) +{ + led_classdev_unregister(&palmz72_green_led); + return 0; +} + +static struct platform_driver palmz72led_driver = { + .probe = palmz72led_probe, + .remove = palmz72led_remove, +#ifdef CONFIG_PM + .suspend = palmz72led_suspend, + .resume = palmz72led_resume, +#endif + .driver = { + .name = "palmz72-led", + }, +}; + +static int __init palmz72led_init(void) +{ + return platform_driver_register(&palmz72led_driver); +} + +static void __exit palmz72led_exit(void) +{ + platform_driver_unregister(&palmz72led_driver); +} + +module_init(palmz72led_init); +module_exit(palmz72led_exit); + +MODULE_AUTHOR("Jan Herman <2h...@se...>"); +MODULE_DESCRIPTION("Palm Zire72 LED driver"); +MODULE_LICENSE("GPL"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |