mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Liam Girdwood <lrg@ti.com>, Samuel Ortiz <samuel.ortiz@intel.com>,
	Dmitry Torokhov <dtor@mail.ru>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	alsa-devel@alsa-project.org,
	Misael Lopez Cruz <misael.lopez@ti.com>
Subject: [PATCH v3 4/5] Input: twl6040-vibra: Check the selected path for vibra
Date: Wed, 12 Oct 2011 11:57:56 +0300	[thread overview]
Message-ID: <1318409877-21681-5-git-send-email-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <1318409877-21681-1-git-send-email-peter.ujfalusi@ti.com>

The VIBSELL/R bit in the VIBCTLL/R register tells the source of the data,
which is going to be used to drive the attached motor(s).
Do not allow effect execution if any of the channels are set to receive
audio data.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
---
 drivers/input/misc/twl6040-vibra.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c
index cb74185..2a828e5 100644
--- a/drivers/input/misc/twl6040-vibra.c
+++ b/drivers/input/misc/twl6040-vibra.c
@@ -201,6 +201,13 @@ static int vibra_play(struct input_dev *input, void *data,
 	struct vibra_info *info = input_get_drvdata(input);
 	int ret;
 
+	/* Do not allow effect, while the routing is set to use audio */
+	ret = twl6040_get_vibralr_status(info->twl6040);
+	if (ret & TWL6040_VIBSEL) {
+		dev_info(&input->dev, "Vibra is configured for audio\n");
+		return -EBUSY;
+	}
+
 	info->weak_speed = effect->u.rumble.weak_magnitude;
 	info->strong_speed = effect->u.rumble.strong_magnitude;
 	info->direction = effect->direction < EFFECT_DIR_180_DEG ? 1 : -1;
-- 
1.7.7


  parent reply	other threads:[~2011-10-12  8:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-12  8:57 [PATCH v3 0/5] ASoC/MFD/Input: twl6040: Support for audio driven vibra Peter Ujfalusi
2011-10-12  8:57 ` [PATCH v3 1/5] Input: twl6040: Simplify vibra regsiter definitions Peter Ujfalusi
2011-10-12  8:57 ` [PATCH v3 2/5] MFD: twl6040: Cache the vibra control registers Peter Ujfalusi
2011-10-12  8:57 ` [PATCH v3 3/5] MFD: twl6040: function to query the vibra status for clients Peter Ujfalusi
2011-10-12  8:57 ` Peter Ujfalusi [this message]
2011-10-12  8:57 ` [PATCH v3 5/5] ASoC: twl6040: Support for vibra output paths Peter Ujfalusi
2011-10-12 10:49 ` [PATCH v3 0/5] ASoC/MFD/Input: twl6040: Support for audio driven vibra Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1318409877-21681-5-git-send-email-peter.ujfalusi@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dtor@mail.ru \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=misael.lopez@ti.com \
    --cc=samuel.ortiz@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®