From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763433AbdAITaB (ORCPT ); Mon, 9 Jan 2017 14:30:01 -0500 Received: from mail-wj0-f193.google.com ([209.85.210.193]:34533 "EHLO mail-wj0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751456AbdAIT35 (ORCPT ); Mon, 9 Jan 2017 14:29:57 -0500 From: Pali =?utf-8?q?Roh=C3=A1r?= To: Mark Brown Subject: Re: Nokia N900 headset detection & MIC Bias + TVOUT Date: Mon, 9 Jan 2017 20:29:53 +0100 User-Agent: KMail/1.13.7 (Linux/3.13.0-106-generic; KDE/4.14.2; x86_64; ; ) Cc: Tony Lindgren , Peter Ujfalusi , Jarkko Nikula , Liam Girdwood , "Lars-Peter Clausen" , Aaro Koskinen , Nishanth Menon , Sebastian Reichel , Pavel Machek , Ivaylo Dimitrov , joerg Reisenweber , linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org References: <201701070007.49137@pali> <20170109131317.GD26301@pali> <20170109192201.l3mkro3epzf2ns27@sirena.org.uk> In-Reply-To: <20170109192201.l3mkro3epzf2ns27@sirena.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1563104.WODxihMdno"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201701092029.53939@pali> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --nextPart1563104.WODxihMdno Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Monday 09 January 2017 20:22:01 Mark Brown wrote: > On Mon, Jan 09, 2017 at 02:13:17PM +0100, Pali Roh=C3=A1r wrote: > > So... can I call snd_soc_dapm_mutex_lock(dapm) at function startup, > > start doing cable detection and when needed call this? > >=20 > > snd_soc_dapm_enable_pin_unlocked(dapm, "HS Mic"); > > snd_soc_dapm_sync_unlocked(dapm); > >=20 > > And at the end of function revert back "HS Mic" pin status and call > > snd_soc_dapm_mutex_unlock(dapm)? >=20 > You shouldn't need to lock I'd expect, and you'll want to sync at any > point where you need an actual change. Note that if something holds > the microphone bias on (like something using the microphone) > separately then that'll take effect so if you really need things to > get turned off then that won't work but you probably have trouble > anyway in that situation. This is needed for cable/jack detection at time when jack is inserted.=20 So before it there cannot be any user of (disconnected) microphone. What I need is to enable mic bias, measure ADC of some time period,=20 check status of some GPIOs. Then disable mic bias, measure ADC again and=20 check GPIOs. I in this detection procedure I need to ensure that nobody=20 changes mic bias. So I though that locking the whole procedure could=20 ensure that. =2D-=20 Pali Roh=C3=A1r pali.rohar@gmail.com --nextPart1563104.WODxihMdno Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEABECAAYFAlhz5LEACgkQi/DJPQPkQ1J69ACgh6oUmL/M99wHg9bsuorhxlTP kNUAn2qUkO7OqhqtT+1uYJvQMYy7t64+ =tJF5 -----END PGP SIGNATURE----- --nextPart1563104.WODxihMdno--