r3211 - branches/src/target/kernel/2.6.23.x/patches
shoragan at sita.openmoko.org
shoragan at sita.openmoko.org
Thu Oct 18 00:45:20 CEST 2007
Author: shoragan
Date: 2007-10-18 00:45:18 +0200 (Thu, 18 Oct 2007)
New Revision: 3211
Modified:
branches/src/target/kernel/2.6.23.x/patches/gta01-backlight.patch
branches/src/target/kernel/2.6.23.x/patches/gta01-vibrator.patch
branches/src/target/kernel/2.6.23.x/patches/s3c2410-pwm.patch
Log:
Restructure gta01 backlight and vibrator for the new s3c2410-pwm.
Modified: branches/src/target/kernel/2.6.23.x/patches/gta01-backlight.patch
===================================================================
--- branches/src/target/kernel/2.6.23.x/patches/gta01-backlight.patch 2007-10-17 21:49:31 UTC (rev 3210)
+++ branches/src/target/kernel/2.6.23.x/patches/gta01-backlight.patch 2007-10-17 22:45:18 UTC (rev 3211)
@@ -1,10 +1,10 @@
This is a backlight driver for FIC's Neo1973 Phone (codename GTA01)
-Index: linux-2.6.22.5-moko/drivers/video/backlight/Kconfig
+Index: linux-2.6.23/drivers/video/backlight/Kconfig
===================================================================
---- linux-2.6.22.5-moko.orig/drivers/video/backlight/Kconfig
-+++ linux-2.6.22.5-moko/drivers/video/backlight/Kconfig
-@@ -48,6 +48,14 @@
+--- linux-2.6.23.orig/drivers/video/backlight/Kconfig
++++ linux-2.6.23/drivers/video/backlight/Kconfig
+@@ -54,6 +54,14 @@
If you have a Sharp Zaurus SL-5500 (Collie) or SL-5600 (Poodle) say y to
enable the LCD/backlight driver.
@@ -19,10 +19,10 @@
config BACKLIGHT_HP680
tristate "HP Jornada 680 Backlight Driver"
depends on BACKLIGHT_CLASS_DEVICE && SH_HP6XX
-Index: linux-2.6.22.5-moko/drivers/video/backlight/Makefile
+Index: linux-2.6.23/drivers/video/backlight/Makefile
===================================================================
---- linux-2.6.22.5-moko.orig/drivers/video/backlight/Makefile
-+++ linux-2.6.22.5-moko/drivers/video/backlight/Makefile
+--- linux-2.6.23.orig/drivers/video/backlight/Makefile
++++ linux-2.6.23/drivers/video/backlight/Makefile
@@ -3,6 +3,7 @@
obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o
obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o
@@ -31,11 +31,11 @@
obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o
obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o
-Index: linux-2.6.22.5-moko/drivers/video/backlight/gta01_bl.c
+Index: linux-2.6.23/drivers/video/backlight/gta01_bl.c
===================================================================
--- /dev/null
-+++ linux-2.6.22.5-moko/drivers/video/backlight/gta01_bl.c
-@@ -0,0 +1,253 @@
++++ linux-2.6.23/drivers/video/backlight/gta01_bl.c
+@@ -0,0 +1,257 @@
+/*
+ * Backlight Driver for FIC GTA01 (Neo1973) GSM Phone
+ *
@@ -144,6 +144,10 @@
+{
+ int rc;
+
++ rc = s3c2410_pwm_init(>a01bl.pwm);
++ if (rc)
++ return rc;
++
+ gta01bl.pwm.timerid = PWM0;
+ gta01bl.pwm.prescaler = (4 - 1);
+ gta01bl.pwm.divider = S3C2410_TCFG1_MUX0_DIV8;
@@ -289,4 +293,3 @@
+
+MODULE_AUTHOR("Harald Welte <laforge at openmoko.org>");
+MODULE_DESCRIPTION("FIC GTA01 (Neo1973) Backlight Driver");
-+MODULE_LICENSE("GPL");
Modified: branches/src/target/kernel/2.6.23.x/patches/gta01-vibrator.patch
===================================================================
--- branches/src/target/kernel/2.6.23.x/patches/gta01-vibrator.patch 2007-10-17 21:49:31 UTC (rev 3210)
+++ branches/src/target/kernel/2.6.23.x/patches/gta01-vibrator.patch 2007-10-17 22:45:18 UTC (rev 3211)
@@ -5,8 +5,8 @@
Index: linux-2.6.23/drivers/leds/leds-gta01.c
===================================================================
--- /dev/null
-+++ linux-2.6.22.5-moko/drivers/leds/leds-gta01.c
-@@ -0,0 +1,189 @@
++++ linux-2.6.23/drivers/leds/leds-gta01.c
+@@ -0,0 +1,177 @@
+/*
+ * LED driver for the FIC GTA01 (Neo1973) GSM Phone Vibrator
+ *
@@ -43,20 +43,11 @@
+ struct s3c2410_pwm 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 dev_get_drvdata(led_cdev->dev);
-+}
-+
+static void gta01vib_vib_set(struct led_classdev *led_cdev,
+ enum led_brightness value)
+{
-+ struct gta01_vib_priv *vp = to_vpriv(led_cdev);
++ struct gta01_vib_priv *vp =
++ container_of(led_cdev, struct gta01_vib_priv, cdev);
+
+ /*
+ * value == 255 -> 99% duty cycle (full power)
@@ -76,21 +67,23 @@
+ mutex_unlock(&vp->mutex);
+}
+
-+static struct led_classdev gta01_vib_led = {
-+ .name = "gta01:vibrator",
-+ .brightness_set = gta01vib_vib_set,
++static struct gta01_vib_priv gta01_vib_led = {
++ .cdev = {
++ .name = "gta01:vibrator",
++ .brightness_set = gta01vib_vib_set,
++ },
+};
+
+#ifdef CONFIG_PM
+static int gta01vib_suspend(struct platform_device *dev, pm_message_t state)
+{
-+ led_classdev_suspend(>a01_vib_led);
++ led_classdev_suspend(>a01_vib_led.cdev);
+ return 0;
+}
+
+static int gta01vib_resume(struct platform_device *dev)
+{
-+ led_classdev_resume(>a01_vib_led);
++ led_classdev_resume(>a01_vib_led.cdev);
+ return 0;
+}
+#endif
@@ -99,7 +92,12 @@
+{
+ int rc;
+
-+ vp->pwm.timerid= PWM3;
++ rc = s3c2410_pwm_init(&vp->pwm);
++ if (rc) {
++ return rc;
++ }
++
++ vp->pwm.timerid = PWM3;
+ /* use same prescaler as arch/arm/plat-s3c24xx/time.c */
+ vp->pwm.prescaler = (6 - 1) / 2;
+ vp->pwm.divider = S3C2410_TCFG1_MUX3_DIV2;
@@ -107,8 +105,9 @@
+ vp->pwm.comparer = COUNTER;
+
+ rc = s3c2410_pwm_enable(&vp->pwm);
-+ if (rc)
++ if (rc) {
+ return rc;
++ }
+
+ s3c2410_pwm_start(&vp->pwm);
+
@@ -117,8 +116,8 @@
+
+static int __init gta01vib_probe(struct platform_device *pdev)
+{
-+ struct gta01_vib_priv *vp;
+ struct resource *r;
++ int rc;
+
+ if (!machine_is_neo1973_gta01())
+ return -EIO;
@@ -127,45 +126,34 @@
+ if (!r || !r->start)
+ return -EIO;
+
-+ vp = kzalloc(sizeof(struct gta01_vib_priv), GFP_KERNEL);
-+ if (!vp)
-+ return -ENOMEM;
++ gta01_vib_led.gpio = r->start;
+
-+ vp->gpio = r->start;
-+
+ /* TOUT3 */
-+ if (vp->gpio == S3C2410_GPB3) {
-+ int rc;
-+
-+ rc = gta01vib_init_hw(vp);
++ if (gta01_vib_led.gpio == S3C2410_GPB3) {
++ rc = gta01vib_init_hw(>a01_vib_led);
+ if (rc) {
-+ kfree(vp);
+ return rc;
+ }
+
-+ s3c2410_gpio_cfgpin(vp->gpio, S3C2410_GPB3_TOUT3);
-+ vp->has_pwm = 1;
++ s3c2410_pwm_duty_cycle(0, >a01_vib_led.pwm);
++ s3c2410_gpio_cfgpin(gta01_vib_led.gpio, S3C2410_GPB3_TOUT3);
++ gta01_vib_led.has_pwm = 1;
+ }
+
-+ mutex_init(&vp->mutex);
-+ platform_set_drvdata(pdev, vp);
++ mutex_init(>a01_vib_led.mutex);
+
-+ return led_classdev_register(&pdev->dev, >a01_vib_led);
++ return led_classdev_register(&pdev->dev, >a01_vib_led.cdev);
+}
+
+static int gta01vib_remove(struct platform_device *pdev)
+{
-+ struct gta01_vib_priv *vp = pdev_to_vpriv(pdev);
++ if (gta01_vib_led.has_pwm)
++ s3c2410_pwm_disable(>a01_vib_led.pwm);
+
-+ if (vp->has_pwm)
-+ s3c2410_pwm_disable(&vp->pwm);
++ led_classdev_unregister(>a01_vib_led.cdev);
+
-+ led_classdev_unregister(>a01_vib_led);
-+ platform_set_drvdata(pdev, NULL);
-+ kfree(vp);
++ mutex_destroy(>a01_vib_led.mutex);
+
-+ mutex_destroy(&vp->mutex);
-+
+ return 0;
+}
+
@@ -196,7 +184,6 @@
+
+MODULE_AUTHOR("Harald Welte <laforge at openmoko.org>");
+MODULE_DESCRIPTION("FIC GTA01 Vibrator driver");
-+MODULE_LICENSE("GPL");
Index: linux-2.6.23/drivers/leds/Kconfig
===================================================================
--- linux-2.6.23.orig/drivers/leds/Kconfig
Modified: branches/src/target/kernel/2.6.23.x/patches/s3c2410-pwm.patch
===================================================================
--- branches/src/target/kernel/2.6.23.x/patches/s3c2410-pwm.patch 2007-10-17 21:49:31 UTC (rev 3210)
+++ branches/src/target/kernel/2.6.23.x/patches/s3c2410-pwm.patch 2007-10-17 22:45:18 UTC (rev 3211)
@@ -38,7 +38,7 @@
===================================================================
--- /dev/null
+++ linux-2.6.23/arch/arm/mach-s3c2410/pwm.c
-@@ -0,0 +1,210 @@
+@@ -0,0 +1,214 @@
+/*
+ * arch/arm/mach-s3c2410/3c2410-pwm.c
+ *
@@ -70,29 +70,33 @@
+ unsigned long tcon;
+
+ /* stop timer */
-+ tcon = __raw_readl(S3C2410_TCON);
-+ tcon &= 0xffffff00;
-+ __raw_writel(tcon, S3C2410_TCON);
++ tcon = __raw_readl(S3C2410_TCON);
++ tcon &= 0xffffff00;
++ __raw_writel(tcon, S3C2410_TCON);
+
+ clk_disable(pwm->pclk);
+ clk_put(pwm->pclk);
+
-+ kfree(pwm);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(s3c2410_pwm_disable);
+
-+int s3c2410_pwm_enable(struct s3c2410_pwm *pwm)
++int s3c2410_pwm_init(struct s3c2410_pwm *pwm)
+{
-+ unsigned long tcfg0, tcfg1, tcnt, tcmp;
-+
+ pwm->pclk = clk_get(NULL, "timers");
+ if (IS_ERR(pwm->pclk))
+ return PTR_ERR(pwm->pclk);
+
+ clk_enable(pwm->pclk);
+ pwm->pclk_rate = clk_get_rate(pwm->pclk);
++ return 0;
++}
++EXPORT_SYMBOL_GPL(s3c2410_pwm_init);
+
++int s3c2410_pwm_enable(struct s3c2410_pwm *pwm)
++{
++ unsigned long tcfg0, tcfg1, tcnt, tcmp;
++
+ /* control registers bits */
+ tcfg1 = __raw_readl(S3C2410_TCFG1);
+ tcfg0 = __raw_readl(S3C2410_TCFG0);
@@ -253,7 +257,7 @@
===================================================================
--- /dev/null
+++ linux-2.6.23/include/asm-arm/arch-s3c2410/pwm.h
-@@ -0,0 +1,38 @@
+@@ -0,0 +1,40 @@
+#ifndef __S3C2410_PWM_H
+#define __S3C2410_PWM_H
+
@@ -264,6 +268,7 @@
+#include <asm-arm/io.h>
+#include <asm/arch/hardware.h>
+#include <asm/mach-types.h>
++#include <asm/plat-s3c/regs-timer.h>
+#include <asm/arch/gta01.h>
+
+enum pwm_timer {
@@ -284,6 +289,7 @@
+ unsigned long comparer;
+};
+
++int s3c2410_pwm_init(struct s3c2410_pwm *s3c2410_pwm);
+int s3c2410_pwm_enable(struct s3c2410_pwm *s3c2410_pwm);
+int s3c2410_pwm_disable(struct s3c2410_pwm *s3c2410_pwm);
+int s3c2410_pwm_start(struct s3c2410_pwm *s3c2410_pwm);
More information about the commitlog
mailing list