From 05f4e15da7ed2daf165d9472e1834e07ce44b9ab Mon Sep 17 00:00:00 2001 From: Marcin Mielczarczyk Date: Fri, 18 Jun 2010 10:04:45 +0200 Subject: u8500: Vibrator: Timed output vibrator driver ST-Ericsson vibrator driver which registers in Android specific timed output device class. Signed-off-by: Marcin Mielczarczyk Signed-off-by: Jerzy Kasenberg Signed-off-by: Mian Yousaf Kaukab 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 Signed-off-by: Krzysztof Antonowicz Signed-off-by: srinidhi kasagar 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 android: vibrator: dont directly access ktime_t members Use ktime helper functions for converting ktime values Signed-off-by: Mian Yousaf Kaukab 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 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 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 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 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 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 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 --- Documentation/DocBook/Makefile | 2 +- Documentation/DocBook/ste_timed_vibra.tmpl | 278 +++++++++++++++++++++++++++++ 2 files changed, 279 insertions(+), 1 deletion(-) create mode 100644 Documentation/DocBook/ste_timed_vibra.tmpl (limited to 'Documentation') diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index f0e9b64b910..ae3d4c348c1 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -19,7 +19,7 @@ DOCBOOKS := z8530book.xml mcabook.xml device-drivers.xml \ tc_keypad.xml prcmu-fw-api.xml cg2900_fm_radio.xml \ synaptics_rmi4_touchp.xml db5500_keypad.xml \ u5500_LogicalMailbox.xml cg2900.xml \ - lsm303dlh.xml ske_keypad.xml ste_ff_vibra.xml ux500_usb.xml + lsm303dlh.xml ske_keypad.xml ste_ff_vibra.xml ste_timed_vibra.xml ux500_usb.xml include $(srctree)/Documentation/DocBook/media/Makefile diff --git a/Documentation/DocBook/ste_timed_vibra.tmpl b/Documentation/DocBook/ste_timed_vibra.tmpl new file mode 100644 index 00000000000..ae9e62c9fb1 --- /dev/null +++ b/Documentation/DocBook/ste_timed_vibra.tmpl @@ -0,0 +1,278 @@ + + + + + Timed Output Vibrator Driver + + + + Marcin + Mielczarczyk + +
+ marcin.mielczarczyk@tieto.com +
+
+
+
+ + + 2010 + ST-Ericsson + + + + + Linux standard functions + + + + + + + This documentation is free software; you can redistribute + it and/or modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later + version. + + + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307 USA + + + + For more details see the file COPYING in the source + distribution of Linux. + + +
+ + + + + Introduction + + This documentation describes the implementation of ST-Ericsson's + Timed Output Vibrator driver for the ST-Ericsson Linux platforms. + + + + + Getting Started + + There are no special compilation flags needed to build the + Timed Output Vibrator driver. + + +
+ Basic Tutorial + + Before using this driver few parameters shall be defined in the platform data structure: + + Boost level - vibrator speed in the the startup stage + Boost time - vibrator startup period + On level - vibrator moderate speed + On time - vibrator moderate period + Off level - vibrator speed in the stop stage + Off time - vibrator stop period + + + + NOTE: If the time elapsing between the ON and OFF sequence is smaller than the 'boost' period, + then OFF is delayed until the 'boost' expires. If the time elapsing between the OFF and + ON sequence is smaller than the 'off' period, then ON is delayed until the 'off' period expires. + The ON request when vibrator is in 'boost' or 'on' stage is ignored. + The OFF request when vibrator is in the 'off' stage is ignored. + + + To enable the Timed Output Vibrator driver using Kconfig, go to + Device Drivers -> Staging -> Android + and enable the following: + + + ST-Ericsson Timed Output Vibrator driver + +
+ +
+ + + Concepts + + Vibrator driver registers as timed output class device (implemented for Android). + + + + + Tasks + + Timed Output Vibrator can be controlled from user space using following device: + + /sys/class/timed_output/vibrator/enable + + To turn on the vibrator for 1s, following command should be executed: + + echo 1000 > /sys/class/timed_output/vibrator/enable + + To turn off the vibrator if enabled, then the following command should be executed: + + echo 0 > /sys/class/timed_output/vibrator/enable + + To get the remaining time, the following command should be executed: + + cat /sys/class/timed_output/vibrator/enable + + + + + + + Driver Configuration and Interaction + + There are no configuration parameters for Timed Output Vibrator Driver. + +
+ Implemented operations in driver + + All available operations are provided by Timed Output class driver. + + + + Supported device driver operations + + enable Calls vibra_enable() function which controls timer and workqueue + get_time Calls vibra_get_time() function which returns time remaining to the end of vibration + +
+
+ +
+
+ Driver loading parameters + + Not Applicable. + +
+
+ Driver IO Control + + Not Applicable. + +
+ +
+ Driver Interaction with Sysfs + + Timed Output Vibrator driver is available in sysfs as /sys/class/timed_output/vibrator + + + + enable + + + + Direction + read-write + + + Attribute file type + + Text file + + + + File path + /sys/class/timed_output/vibrator/enable + + + + Description + + + Vibrator is enabled for given period of time on file write (in miliseconds). + + + When written 0, vibrator stops. + + + When file is read, it gives remaining time to disable vibrator (in miliseconds). + + + + + + + + +
+
+ Driver Interaction using /proc filesystem + + Not Applicable. + + +
+ +
+ Other means for Driver Interaction + + Not Applicable. + +
+ +
+ Driver Node File + + Not aplicable. + +
+ + +
+ + + + Known Bugs And Assumptions + + + + None. + + + + + + + + + + + + + Public Functions Provided + + Not Applicable. + + + + + Internal Functions Provided + + This chapter contains the autogenerated documentation of the internal functions. + +!Edrivers/staging/android/ste_timed_vibra.c + + +
-- cgit v1.2.3