summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Mielczarczyk <marcin.mielczarczyk@tieto.com>2010-06-18 10:04:45 +0200
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:02:46 +0200
commit3f9681a38f958bac86f014b8812160daca0cf980 (patch)
tree7da8c39d90804602af7bfa94b6fc9a8b1f02a896
parentb42caf2286069108625c88f280ca3362d43a9967 (diff)
ux500: u8500: Vibrator: Timed output vibrator driver
ST-Ericsson vibrator driver which registers in Android specific timed output device class. Signed-off-by: Marcin Mielczarczyk <marcin.mielczarczyk@tieto.com> Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@tieto.com> Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> Timed output vibrator: New functionality. This patch allows to form the vibration characteristic using few parameters defined in the platform data: - boost level and period for start condition - on level as moderate speed - off level and period for brake condition Detailed information can be found here: Documentation\DocBook\ste_timed_vibra.html Signed-off-by: Grzegorz Sygieda <grzegorz.sygieda@tieto.com> Signed-off-by: Krzysztof Antonowicz <krzysztof.antonowicz@tieto.com> Signed-off-by: srinidhi kasagar <srinidhi.kasagar@stericsson.com> vibrator: remove board specific control of vibrator Platform specific control of vibrator should be present in board file (here board-mop500.c). So, for example if GPIO pins are used to control the vibrator, its control function implemenation should be in board file. This patch provides the callback function support in the driver for the same. Signed-off-by: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com> android: vibrator: dont directly access ktime_t members Use ktime helper functions for converting ktime values Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> u8500: vibra: linear vibrators using vibra-pwm Linear vibrators operate on thier required resonance frequency (for COPAL and AAC its ~150Hz). This can be provided using AUDIO DA5 path. This software *workaround* enables linear vibrators using AB8500 vibra-pwm by generating required resonace frequency using software. In addition this patch provides support for separate platform data for Linear and Rotarty vibrators. Signed-off-by: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com> u8500: vibra: disable vibrator after vibration This patch disables vibrator i.e. configures the PWM duty cycle to zero after vibration duration is over. Signed-off-by: Philippe Langlais <philippe.langlais@linaro.org> u8500: optimize: linear vibra drv using vibra-pwm This patch optimizes the current implementation of "linear vibrator driver using vibra-pwm". Current implementation is CPU intensive and uses 100% of a CPU for the time period vibrator is used. ST-Ericsson ID: ER 349958 Signed-off-by: Avinash A <Avinash.a@stericsson.com> u8500: vibra: fix sleeping fn. in atomic context sleepable call - flush_workqueue called from atomic context of vibra_enable. ST-Ericsson ID: ER 351276 Signed-off-by: Avinash A <Avinash.a@stericsson.com> u8500: vibra: remove race condition in timer operation In situation described below, vibra driver can hang. In a scenario where vibra_enable is called and vibrator is running i.e. vibra_work is scheduled and vibra_timer. Suppose vibra_timer is started and has not expired yet. At this moment if vibra_work starts executing and acquires the vibra_lock and just before hrtimer_cancel is called, if old timer expires and timer callback starts executing then it will try to acquire vibra_lock and hence it will wait for vibra_lock, as it is already acquired by vibra_work. Now vibra_work->hrtimer_cancel will wait for timer callback to complete and timer callback will wait for vibra_lock to be free so that it can complete. This result in recursive waiting for vibra_lock and hence deadlock. As timer callback is running in interrupt context so above deadlock may trigger watchdog. ST-Ericsson ID: 405366 Signed-off-by: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com> u8500: vibra: remove race condition in open In situation described below, vibra driver can hang. vibra_enable takes the vibra_lock and timer expires then timer callback will spin for vibra_lock. If vibra_enable tries to do hrtimer_cancel then it will wait for timer callback to complete. In above situation hrtimer_cancel will wait for timer callback to complete and timer callback will wait for vibra_lock to be free so that it can complete. This result in recursive waiting for vibra_lock and hence deadlock. As timer callback is running in interrupt context so above deadlock may trigger watchdog. ST-Ericsson ID: 407253 Signed-off-by: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com> vibra:Remove unnecessary assignment of dev->parent Remove unnecessary assignment of dev->parent, because of this during timed out class unregister it is trying to free resources of parent which does not exist Signed-off-by: Naga Radhesh <naga.radheshy@stericsson.com>
-rw-r--r--arch/arm/mach-ux500/Makefile1
-rw-r--r--arch/arm/mach-ux500/board-mop500-vibra.c54
-rw-r--r--arch/arm/mach-ux500/board-mop500.c6
-rw-r--r--arch/arm/mach-ux500/board-mop500.h1
4 files changed, 62 insertions, 0 deletions
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index 44c5ed44418..4bc27fc908f 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_MACH_MOP500) += board-mop500.o board-mop500-sdi.o \
board-mop500-u8500uib.o board-mop500-pins.o \
board-mop500-bm.o \
board-pins-sleep-force.o
+obj-$(CONFIG_ANDROID_STE_TIMED_VIBRA) += board-mop500-vibra.o
obj-$(CONFIG_MACH_U5500) += board-u5500.o board-u5500-sdi.o \
board-u5500-regulators.o \
board-u5500-pins.o
diff --git a/arch/arm/mach-ux500/board-mop500-vibra.c b/arch/arm/mach-ux500/board-mop500-vibra.c
new file mode 100644
index 00000000000..bb4ba28774f
--- /dev/null
+++ b/arch/arm/mach-ux500/board-mop500-vibra.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2010 ST-Ericsson SA
+ *
+ * License terms:GNU General Public License (GPL) version 2
+ */
+
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <asm/mach-types.h>
+
+#include <linux/ste_timed_vibra.h>
+#include <sound/ux500_ab8500_ext.h>
+
+/* For details check ste_timed_vibra docbook */
+static struct ste_timed_vibra_platform_data rotary_vibra_plat_data = {
+ .is_linear_vibra = false,
+ .boost_level = 100,
+ .boost_time = 60,
+ .on_level = 50,
+ .off_level = 50,
+ .off_time = 60,
+ .timed_vibra_control = ux500_ab8500_audio_pwm_vibra,
+};
+
+static struct ste_timed_vibra_platform_data linear_vibra_plat_data = {
+ .is_linear_vibra = true,
+ .boost_level = 80,
+ .boost_time = 40,
+ .on_level = 80,
+ .off_level = 80,
+ .off_time = 0,
+ .timed_vibra_control = ux500_ab8500_audio_pwm_vibra,
+};
+
+/* Timed output vibrator device */
+static struct platform_device ux500_vibra_device = {
+ .name = "ste_timed_output_vibra",
+};
+
+void __init mop500_vibra_init(void)
+{
+ int ret;
+
+ if (machine_is_hrefv60())
+ ux500_vibra_device.dev.platform_data = &linear_vibra_plat_data;
+ else
+ ux500_vibra_device.dev.platform_data = &rotary_vibra_plat_data;
+
+ ret = platform_device_register(&ux500_vibra_device);
+ if (ret < 0)
+ pr_err("vibra dev register failed");
+}
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 8ce94900a17..754c9dddafb 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -1253,6 +1253,9 @@ static void __init mop500_init_machine(void)
sizeof(mop500_ske_keypad_data));
#endif
+#ifdef CONFIG_ANDROID_STE_TIMED_VIBRA
+ mop500_vibra_init();
+#endif
platform_device_register(&ab8500_device);
i2c_register_board_info(0, mop500_i2c0_devices,
@@ -1387,6 +1390,9 @@ static void __init hrefv60_init_machine(void)
sizeof(mop500_ske_keypad_data));
#endif
+#ifdef CONFIG_ANDROID_STE_TIMED_VIBRA
+ mop500_vibra_init();
+#endif
if (machine_is_u8520()) {
fixup_ab8505_gpio();
platform_device_register(&ab8505_device);
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index 14f3efc22b6..f9daabb7c27 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -91,6 +91,7 @@ void __init mop500_u8500uib_init(void);
void __init mop500_stuib_init(void);
void __init mop500_msp_init(void);
void __init mop500_pins_init(void);
+void __init mop500_vibra_init(void);
void __init hrefv60_pins_init(void);
void __init snowball_pins_init(void);
void mop500_cyttsp_init(void);