From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S940342AbdAINNY (ORCPT ); Mon, 9 Jan 2017 08:13:24 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33402 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938734AbdAINNV (ORCPT ); Mon, 9 Jan 2017 08:13:21 -0500 Date: Mon, 9 Jan 2017 14:13:17 +0100 From: Pali =?utf-8?B?Um9ow6Fy?= To: Mark Brown 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 Subject: Re: Nokia N900 headset detection & MIC Bias + TVOUT Message-ID: <20170109131317.GD26301@pali> References: <201701070007.49137@pali> <20170109112749.6gmtytxuqzfai57e@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170109112749.6gmtytxuqzfai57e@sirena.org.uk> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday 09 January 2017 11:27:49 Mark Brown wrote: > On Sat, Jan 07, 2017 at 12:07:49AM +0100, Pali Rohár wrote: > > > All that is needed in N900 sound driver, file sound/soc/omap/rx51.c. Can > > you help me which functions should I call to enable/disable it > > correctly? In headset detection code I need to be sure that nobody > > (other kernel drivers or userspace via alsamixer) except current > > function could change Bias settings. > > > MIC Bias is controlled by MICBIAS_CTRL in aic34 'B' part codec, file > > tlv320aic3x.c. > > Microphone biases are normally controlled by supply widgets and managed > via DAPM. You can see quite a few examples of this in existing drivers. So... can I call snd_soc_dapm_mutex_lock(dapm) at function startup, start doing cable detection and when needed call this? snd_soc_dapm_enable_pin_unlocked(dapm, "HS Mic"); snd_soc_dapm_sync_unlocked(dapm); And at the end of function revert back "HS Mic" pin status and call snd_soc_dapm_mutex_unlock(dapm)? -- Pali Rohár pali.rohar@gmail.com