summaryrefslogtreecommitdiff
path: root/Documentation
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:01:41 +0200
commit05f4e15da7ed2daf165d9472e1834e07ce44b9ab (patch)
tree90c4f67f631b2afb440eae222e8dd1e0670057bc /Documentation
parentcb1a5c1823a07db65bdf14dcf175ebf3136ad811 (diff)
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>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/DocBook/Makefile2
-rw-r--r--Documentation/DocBook/ste_timed_vibra.tmpl278
2 files changed, 279 insertions, 1 deletions
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 @@
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
+
+<book id="STE-Timed-Output-Vibrator-API-Guide">
+ <bookinfo>
+ <title>Timed Output Vibrator Driver</title>
+
+ <authorgroup>
+ <author>
+ <firstname>Marcin</firstname>
+ <surname>Mielczarczyk</surname>
+ <affiliation>
+ <address>
+ <email>marcin.mielczarczyk@tieto.com</email>
+ </address>
+ </affiliation>
+ </author>
+ </authorgroup>
+
+ <copyright>
+ <year>2010</year>
+ <holder>ST-Ericsson</holder>
+ </copyright>
+
+ <subjectset>
+ <subject>
+ <subjectterm>Linux standard functions</subjectterm>
+ </subject>
+ </subjectset>
+
+ <legalnotice>
+
+ <para>
+ 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.
+ </para>
+
+ <para>
+ 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.
+ </para>
+
+ <para>
+ 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
+ </para>
+
+ <para>
+ For more details see the file COPYING in the source
+ distribution of Linux.
+ </para>
+ </legalnotice>
+ </bookinfo>
+
+ <toc></toc>
+
+ <chapter id="intro">
+ <title>Introduction</title>
+ <para>
+ This documentation describes the implementation of ST-Ericsson's
+ Timed Output Vibrator driver for the ST-Ericsson Linux platforms.
+ </para>
+ </chapter>
+
+ <chapter id="gettingstarted">
+ <title>Getting Started</title>
+ <para>
+ There are no special compilation flags needed to build the
+ Timed Output Vibrator driver.
+ </para>
+
+ <section id="basic-tutorial">
+ <title>Basic Tutorial</title>
+ <para>
+ Before using this driver few parameters shall be defined in the platform data structure:
+ <itemizedlist>
+ <listitem><para>Boost level - vibrator speed in the the startup stage</para></listitem>
+ <listitem><para>Boost time - vibrator startup period</para></listitem>
+ <listitem><para>On level - vibrator moderate speed</para></listitem>
+ <listitem><para>On time - vibrator moderate period</para></listitem>
+ <listitem><para>Off level - vibrator speed in the stop stage</para></listitem>
+ <listitem><para>Off time - vibrator stop period</para></listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ 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.
+ </para>
+ <para>
+ To enable the Timed Output Vibrator driver using Kconfig, go to
+ <constant> Device Drivers -&gt; Staging -&gt; Android </constant>
+ and enable the following:
+ </para>
+ <itemizedlist>
+ <listitem><para>ST-Ericsson Timed Output Vibrator driver</para></listitem>
+ </itemizedlist>
+ </section>
+
+ </chapter>
+
+ <chapter id="concepts">
+ <title>Concepts</title>
+ <para>
+ Vibrator driver registers as timed output class device (implemented for Android).
+ </para>
+ </chapter>
+
+ <chapter id="tasks">
+ <title>Tasks</title>
+ <para>
+ Timed Output Vibrator can be controlled from user space using following device:
+ <itemizedlist>
+ <listitem><para>/sys/class/timed_output/vibrator/enable</para></listitem>
+ </itemizedlist>
+ To turn on the vibrator for 1s, following command should be executed:
+ <itemizedlist>
+ <listitem><para>echo 1000 &gt; /sys/class/timed_output/vibrator/enable</para></listitem>
+ </itemizedlist>
+ To turn off the vibrator if enabled, then the following command should be executed:
+ <itemizedlist>
+ <listitem><para>echo 0 &gt; /sys/class/timed_output/vibrator/enable</para></listitem>
+ </itemizedlist>
+ To get the remaining time, the following command should be executed:
+ <itemizedlist>
+ <listitem><para>cat /sys/class/timed_output/vibrator/enable</para></listitem>
+ </itemizedlist>
+ </para>
+
+ </chapter>
+
+ <chapter id="driver-configuration">
+ <title>Driver Configuration and Interaction</title>
+ <para>
+ There are no configuration parameters for Timed Output Vibrator Driver.
+ </para>
+ <section id="driver-implemented-operations">
+ <title>Implemented operations in driver</title>
+ <para>
+ All available operations are provided by Timed Output class driver.
+ </para>
+ <para>
+ <table>
+ <title> Supported device driver operations </title>
+ <tgroup cols="2"><tbody>
+ <row><entry> enable </entry> <entry> Calls vibra_enable() function which controls timer and workqueue </entry> </row>
+ <row><entry> get_time </entry> <entry> Calls vibra_get_time() function which returns time remaining to the end of vibration </entry> </row>
+ </tbody></tgroup>
+ </table>
+ </para>
+
+ </section>
+ <section id="driver-loading">
+ <title>Driver loading parameters</title>
+ <para>
+ Not Applicable.
+ </para>
+ </section>
+ <section id="driver-ioctl">
+ <title>Driver IO Control</title>
+ <para>
+ Not Applicable.
+ </para>
+ </section>
+
+ <section id="driver-sysfs">
+ <title>Driver Interaction with Sysfs</title>
+ <para>
+ Timed Output Vibrator driver is available in sysfs as <filename>/sys/class/timed_output/vibrator</filename>
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term>enable</term>
+ <listitem>
+ <variablelist>
+ <varlistentry>
+ <term>Direction</term>
+ <listitem><para>read-write</para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Attribute file type</term>
+ <listitem>
+ <para>Text file</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>File path</term>
+ <listitem><para><filename>/sys/class/timed_output/vibrator/enable</filename></para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Description</term>
+ <listitem>
+ <para>
+ Vibrator is enabled for given period of time on file write (in miliseconds).
+ </para>
+ <para>
+ When written 0, vibrator stops.
+ </para>
+ <para>
+ When file is read, it gives remaining time to disable vibrator (in miliseconds).
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </section>
+ <section id="driver-proc">
+ <title>Driver Interaction using /proc filesystem</title>
+ <para>
+ Not Applicable.
+ </para>
+
+ </section>
+
+ <section id="driver-other">
+ <title>Other means for Driver Interaction</title>
+ <para>
+ Not Applicable.
+ </para>
+ </section>
+
+ <section id="driver-node">
+ <title>Driver Node File</title>
+ <para>
+ Not aplicable.
+ </para>
+ </section>
+
+
+ </chapter>
+
+
+ <chapter id="bugs">
+ <title>Known Bugs And Assumptions</title>
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term>None.</term>
+ <listitem>
+ <para>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </para>
+ </chapter>
+
+<chapter id="pubfunctions">
+ <title>Public Functions Provided</title>
+ <para>
+ Not Applicable.
+ </para>
+</chapter>
+
+<chapter id="internal-functions">
+ <title>Internal Functions Provided</title>
+ <para>
+ This chapter contains the autogenerated documentation of the internal functions.
+ </para>
+!Edrivers/staging/android/ste_timed_vibra.c
+</chapter>
+
+</book>