r1584 - trunk/src/target/kernel/patches
laforge at sita.openmoko.org
laforge at sita.openmoko.org
Fri Mar 30 23:00:44 CEST 2007
Author: laforge
Date: 2007-03-30 23:00:43 +0200 (Fri, 30 Mar 2007)
New Revision: 1584
Modified:
trunk/src/target/kernel/patches/gta01-vibrator.patch
Log:
* make gta01-vibrator actually compile (missing Kconfig/Makefile hunks)
* use platform_device's resource to determine GPIO
Modified: trunk/src/target/kernel/patches/gta01-vibrator.patch
===================================================================
--- trunk/src/target/kernel/patches/gta01-vibrator.patch 2007-03-30 20:50:35 UTC (rev 1583)
+++ trunk/src/target/kernel/patches/gta01-vibrator.patch 2007-03-30 21:00:43 UTC (rev 1584)
@@ -2,15 +2,15 @@
uses the existing LED class driver framework, since there's a lot of
similarity between the LED and the vibrator function.
-Index: linux-2.6.17.14-fic4.test/drivers/leds/leds-gta01.c
+Index: linux-2.6.20.4/drivers/leds/leds-gta01.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.17.14-fic4.test/drivers/leds/leds-gta01.c 2007-01-08 22:51:15.000000000 +0100
-@@ -0,0 +1,95 @@
++++ linux-2.6.20.4/drivers/leds/leds-gta01.c 2007-03-30 22:58:37.000000000 +0200
+@@ -0,0 +1,133 @@
+/*
-+ * LED driver for the FIC GTA01 (Neo1973) GSM Phone
++ * LED driver for the FIC GTA01 (Neo1973) GSM Phone Vibrator
+ *
-+ * (C) 2006 by OpenMoko, Inc.
++ * (C) 2006-2007 by OpenMoko, Inc.
+ * Author: Harald Welte <laforge at openmoko.org>
+ * All rights reserved.
+ *
@@ -18,24 +18,42 @@
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
++ * TODO: Implement PWM support for GTA01Bv4 and later
+ */
+
-+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/leds.h>
-+#include <asm/hardware/scoop.h>
++#include <asm/hardware.h>
+#include <asm/mach-types.h>
-+#include <asm/arch/hardware.h>
+#include <asm/arch/gta01.h>
+
++struct gta01_vib_priv
++{
++ struct led_classdev cdev;
++ unsigned int gpio;
++ unsigned int has_pwm;
++};
++
++static inline struct gta01_vib_priv *pdev_to_vpriv(struct platform_device *dev)
++{
++ return platform_get_drvdata(dev);
++}
++
++static inline struct gta01_vib_priv *to_vpriv(struct led_classdev *led_cdev)
++{
++ return container_of(led_cdev, struct gta01_vib_priv, cdev);
++}
++
+static void gta01led_vib_set(struct led_classdev *led_cdev, enum led_brightness value)
+{
++ struct gta01_vib_priv *vp = to_vpriv(led_cdev);
++
+ if (value)
-+ s3c2410_gpio_setpin(GTA01_GPIO_VIBRATOR_ON, 1);
++ s3c2410_gpio_setpin(vp->gpio, 1);
+ else
-+ s3c2410_gpio_setpin(GTA01_GPIO_VIBRATOR_ON, 0);
++ s3c2410_gpio_setpin(vp->gpio, 0);
+}
+
+static struct led_classdev gta01_vib_led = {
@@ -59,17 +77,37 @@
+
+static int gta01led_probe(struct platform_device *pdev)
+{
-+ int ret;
++ struct gta01_vib_priv *vp;
++ struct resource *r;
+
+ if (!machine_is_gta01())
+ return -EIO;
+
++ r = platform_get_resource(pdev, 0, 0);
++ if (!r || !r->start)
++ return -EIO;
++
++ vp = kzalloc(sizeof(struct gta01_vib_priv), GFP_KERNEL);
++ if (!vp)
++ return -ENOMEM;
++
++ platform_set_drvdata(pdev, vp);
++
++ vp->gpio = r->start;
++
++ if (vp->gpio == S3C2410_GPB3)
++ vp->has_pwm = 1;
++
+ return led_classdev_register(&pdev->dev, >a01_vib_led);
+}
+
+static int gta01led_remove(struct platform_device *pdev)
+{
++ struct gta01_vib_priv *vp = pdev_to_vpriv(pdev);
++
+ led_classdev_unregister(>a01_vib_led);
++ platform_set_drvdata(pdev, NULL);
++ kfree(vp);
+
+ return 0;
+}
@@ -86,19 +124,48 @@
+ },
+};
+
-+static int __init spitzled_init(void)
++static int __init gta01led_init(void)
+{
+ return platform_driver_register(>a01led_driver);
+}
+
-+static void __exit spitzled_exit(void)
++static void __exit gta01led_exit(void)
+{
+ platform_driver_unregister(>a01led_driver);
+}
+
-+module_init(spitzled_init);
-+module_exit(spitzled_exit);
++module_init(gta01led_init);
++module_exit(gta01led_exit);
+
+MODULE_AUTHOR("Harald Welte <laforge at openmoko.org>");
+MODULE_DESCRIPTION("FIC GTA01 LED driver");
+MODULE_LICENSE("GPL");
+Index: linux-2.6.20.4/drivers/leds/Kconfig
+===================================================================
+--- linux-2.6.20.4.orig/drivers/leds/Kconfig 2007-03-30 22:55:57.000000000 +0200
++++ linux-2.6.20.4/drivers/leds/Kconfig 2007-03-30 22:56:03.000000000 +0200
+@@ -82,6 +82,12 @@
+ help
+ This option enables support for the PCEngines WRAP programmable LEDs.
+
++config LEDS_GTA01
++ tristate "LED Support for the FIC Neo1973 Vibrator"
++ depends on LEDS_CLASS && MACH_GTA01
++ help
++ This option enables support for the Vibrator on the FIC Neo1973.
++
+ comment "LED Triggers"
+
+ config LEDS_TRIGGERS
+Index: linux-2.6.20.4/drivers/leds/Makefile
+===================================================================
+--- linux-2.6.20.4.orig/drivers/leds/Makefile 2007-03-30 22:55:59.000000000 +0200
++++ linux-2.6.20.4/drivers/leds/Makefile 2007-03-30 22:56:03.000000000 +0200
+@@ -14,6 +14,7 @@
+ obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o
+ obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o
+ obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o
++obj-$(CONFIG_LEDS_GTA01) += leds-gta01.o
+
+ # LED Triggers
+ obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o
More information about the commitlog
mailing list