r3194 - branches/src/target/kernel/2.6.23.x/patches
shoragan at sita.openmoko.org
shoragan at sita.openmoko.org
Tue Oct 16 18:20:01 CEST 2007
Author: shoragan
Date: 2007-10-16 18:19:59 +0200 (Tue, 16 Oct 2007)
New Revision: 3194
Modified:
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:
Follow changes in 2.6.22:
(orig r3173): laforge | 2007-10-15 14:49:23 +0200
increase vibrator PWM frequency to 257kHz (66MHz / 2 / 2 / 64) to be outside
the human-audible range. It's a vibrator, not a 4kHz beeper!
(orig r3171): laforge | 2007-10-15 12:54:10 +0200
S3c24xx timer4 doesn't have PWM support, so don't even try to use it for that.
Also, refuse to reconfigure the prescaler 1 (shared between timer 2,3,4), since
that would modify the kernel timer clock tick.
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-16 15:43:33 UTC (rev 3193)
+++ branches/src/target/kernel/2.6.23.x/patches/gta01-vibrator.patch 2007-10-16 16:19:59 UTC (rev 3194)
@@ -5,7 +5,7 @@
Index: linux-2.6.23/drivers/leds/leds-gta01.c
===================================================================
--- /dev/null
-+++ linux-2.6.23/drivers/leds/leds-gta01.c
++++ linux-2.6.22.5-moko/drivers/leds/leds-gta01.c
@@ -0,0 +1,188 @@
+/*
+ * LED driver for the FIC GTA01 (Neo1973) GSM Phone Vibrator
@@ -32,7 +32,7 @@
+#include <asm/arch/gta01.h>
+#include <asm/plat-s3c/regs-timer.h>
+
-+#define COUNTER 256
++#define COUNTER 64
+
+struct gta01_vib_priv
+{
@@ -65,7 +65,7 @@
+ */
+ mutex_lock(&vp->mutex);
+ if (vp->has_pwm) {
-+ s3c2410_pwm_duty_cycle(value, vp->pwm);
++ s3c2410_pwm_duty_cycle(value/4, vp->pwm);
+ s3c2410_gpio_cfgpin(vp->gpio, S3C2410_GPB3_TOUT3);
+ } else {
+ if (value)
@@ -101,8 +101,9 @@
+ struct gta01_vib_priv *vp = pdev_to_vpriv(pdev);
+
+ vp->pwm->timerid= PWM3;
-+ vp->pwm->prescaler = 0x0000;
-+ vp->pwm->divider = S3C2410_TCFG1_MUX3_DIV8;
++ /* use same prescaler as arch/arm/plat-s3c24xx/time.c */
++ vp->pwm->prescaler = (6 - 1) / 2;
++ vp->pwm->divider = S3C2410_TCFG1_MUX3_DIV2;
+ vp->pwm->counter = COUNTER;
+ vp->pwm->comparer = COUNTER;
+
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-16 15:43:33 UTC (rev 3193)
+++ branches/src/target/kernel/2.6.23.x/patches/s3c2410-pwm.patch 2007-10-16 16:19:59 UTC (rev 3194)
@@ -38,7 +38,7 @@
===================================================================
--- /dev/null
+++ linux-2.6.22/arch/arm/mach-s3c2410/pwm.c
-@@ -0,0 +1,222 @@
+@@ -0,0 +1,234 @@
+/*
+ * arch/arm/mach-s3c2410/3c2410-pwm.c
+ *
@@ -118,7 +118,7 @@
+ tcfg0 = __raw_readl(S3C2410_TCFG0);
+
+ /* divider & scaler slection */
-+ switch(s3c2410_pwm->timerid) {
++ switch (s3c2410_pwm->timerid) {
+ case PWM0:
+ tcfg1 &= ~S3C2410_TCFG1_MUX0_MASK;
+ tcfg0 &= ~S3C2410_TCFG_PRESCALER0_MASK;
@@ -136,8 +136,7 @@
+ tcfg0 &= ~S3C2410_TCFG_PRESCALER1_MASK;
+ break;
+ case PWM4:
-+ tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
-+ tcfg0 &= ~S3C2410_TCFG_PRESCALER1_MASK;
++ /* timer four is not capable of doing PWM */
+ break;
+ default:
+ return -1;
@@ -145,11 +144,23 @@
+
+ /* divider & scaler values */
+ tcfg1 |= s3c2410_pwm->divider;
-+ tcfg0 |= s3c2410_pwm->prescaler;
-+
+ __raw_writel(tcfg1, S3C2410_TCFG1);
-+ __raw_writel(tcfg0, S3C2410_TCFG0);
+
++ switch (s3c2410_pwm->timerid) {
++ case PWM0:
++ case PWM1:
++ tcfg0 |= s3c2410_pwm->prescaler;
++ __raw_writel(tcfg0, S3C2410_TCFG0);
++ break;
++ default:
++ if ((tcfg0 | s3c2410_pwm->prescaler) != tcfg0) {
++ printk(KERN_WARNING "not changing prescaler of PWM %u,"
++ " since it's shared with timer4 (clock tick)\n",
++ s3c2410_pwm->timerid);
++ }
++ break;
++ }
++
+ /* timer count and compare buffer initial values */
+ tcnt = s3c2410_pwm->counter;
+ tcmp = s3c2410_pwm->comparer;
@@ -189,8 +200,9 @@
+ tcon &= ~S3C2410_TCON_T3MANUALUPD;
+ break;
+ case PWM4:
-+ tcon |= S3C2410_TCON_T4START;
-+ tcon &= ~S3C2410_TCON_T4MANUALUPD;
++ /* timer four is not capable of doing PWM */
++ default:
++ return -1;
+ }
+
+ __raw_writel(tcon, S3C2410_TCON);
@@ -228,9 +240,9 @@
+ tcon |= S3C2410_TCON_T3MANUALUPD;
+ break;
+ case PWM4:
-+ tcon &= ~0x00080000;
-+ tcon |= S3C2410_TCON_T4RELOAD;
-+ tcon |= S3C2410_TCON_T3MANUALUPD;
++ /* timer four is not capable of doing PWM */
++ default:
++ return -1;
+ }
+
+ __raw_writel(tcon, S3C2410_TCON);
More information about the commitlog
mailing list