aboutsummaryrefslogtreecommitdiff
path: root/drivers/leds
diff options
context:
space:
mode:
authormokopatches <mokopatches@openmoko.org>2008-11-19 17:03:18 +0000
committerwarmcat <andy@warmcat.com>2008-11-19 17:03:18 +0000
commit4be3b6cddde0dbf2d66493466f00a1ea930bdfaf (patch)
treed714a215bd70753d104da31606d78bec0c9ac858 /drivers/leds
parent81487a2b118cee39ed13586b17c394935d799216 (diff)
introduce-fiq-migrate-vibrator-gta02-only.patch
On GTA02 we use FIQ to manage the vibrator IO now. That is necessary because we stole timer3 from doing hw pwm for vibrator. This keeps the same UI in /sys but does "bitbang pwm" on the same vibrator GPIO From: Andy Green <andy@openmoko.com> Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/Kconfig1
-rw-r--r--drivers/leds/leds-neo1973-vibrator.c24
2 files changed, 23 insertions, 2 deletions
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 4435859beca..6dad9d030e1 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -168,6 +168,7 @@ config LEDS_DA903X
config LEDS_NEO1973_VIBRATOR
tristate "Vibrator Support for the FIC Neo1973 GSM phone"
depends on LEDS_CLASS && MACH_NEO1973
+ select S3C2440_C_FIQ
help
This option enables support for the vibrator on the FIC Neo1973.
diff --git a/drivers/leds/leds-neo1973-vibrator.c b/drivers/leds/leds-neo1973-vibrator.c
index c943a6a6988..36ed216a504 100644
--- a/drivers/leds/leds-neo1973-vibrator.c
+++ b/drivers/leds/leds-neo1973-vibrator.c
@@ -23,6 +23,8 @@
#include <asm/arch/gta01.h>
#include <asm/plat-s3c/regs-timer.h>
+#include <asm/arch-s3c2410/fiq_ipc_gta02.h>
+
#define COUNTER 64
struct neo1973_vib_priv {
@@ -39,6 +41,11 @@ static void neo1973_vib_vib_set(struct led_classdev *led_cdev,
struct neo1973_vib_priv *vp =
container_of(led_cdev, struct neo1973_vib_priv, cdev);
+ if (machine_is_neo1973_gta02()) { /* use FIQ to control GPIO */
+ fiq_ipc.vib_pwm = value; /* set it for FIQ */
+ fiq_kick(); /* start up FIQs if not already going */
+ return;
+ }
/*
* value == 255 -> 99% duty cycle (full power)
* value == 128 -> 50% duty cycle (medium power)
@@ -46,7 +53,7 @@ static void neo1973_vib_vib_set(struct led_classdev *led_cdev,
*/
mutex_lock(&vp->mutex);
if (vp->has_pwm)
- s3c2410_pwm_duty_cycle(value/4, &vp->pwm);
+ s3c2410_pwm_duty_cycle(value / 4, &vp->pwm);
else {
if (value)
s3c2410_gpio_setpin(vp->gpio, 1);
@@ -123,6 +130,15 @@ static int __init neo1973_vib_probe(struct platform_device *pdev)
neo1973_vib_led.gpio = r->start;
platform_set_drvdata(pdev, &neo1973_vib_led);
+ if (machine_is_neo1973_gta02()) { /* use FIQ to control GPIO */
+ s3c2410_gpio_setpin(neo1973_vib_led.gpio, 0); /* off */
+ s3c2410_gpio_cfgpin(neo1973_vib_led.gpio, S3C2410_GPIO_OUTPUT);
+ /* safe, kmalloc'd copy needed for FIQ ISR */
+ fiq_ipc.vib_gpio_pin = neo1973_vib_led.gpio;
+ fiq_ipc.vib_pwm = 0; /* off */
+ goto configured;
+ }
+
/* TOUT3 */
if (neo1973_vib_led.gpio == S3C2410_GPB3) {
rc = neo1973_vib_init_hw(&neo1973_vib_led);
@@ -133,7 +149,7 @@ static int __init neo1973_vib_probe(struct platform_device *pdev)
s3c2410_gpio_cfgpin(neo1973_vib_led.gpio, S3C2410_GPB3_TOUT3);
neo1973_vib_led.has_pwm = 1;
}
-
+configured:
mutex_init(&neo1973_vib_led.mutex);
return led_classdev_register(&pdev->dev, &neo1973_vib_led.cdev);
@@ -141,6 +157,10 @@ static int __init neo1973_vib_probe(struct platform_device *pdev)
static int neo1973_vib_remove(struct platform_device *pdev)
{
+ if (machine_is_neo1973_gta02()) /* use FIQ to control GPIO */
+ fiq_ipc.vib_pwm = 0; /* off */
+ /* would only need kick if already off so no kick needed */
+
if (neo1973_vib_led.has_pwm)
s3c2410_pwm_disable(&neo1973_vib_led.pwm);