From patchwork Thu Jan 24 09:33:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hebbar, Gururaja" X-Patchwork-Id: 2030131 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id A9C973FDBC for ; Thu, 24 Jan 2013 09:36:29 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TyJBu-0001dT-Qd; Thu, 24 Jan 2013 09:33:50 +0000 Received: from comal.ext.ti.com ([198.47.26.152]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TyJBs-0001dB-82 for linux-arm-kernel@lists.infradead.org; Thu, 24 Jan 2013 09:33:49 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r0O9XfAf024557; Thu, 24 Jan 2013 03:33:42 -0600 Received: from DBDE71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id r0O9XZvH018486; Thu, 24 Jan 2013 15:03:36 +0530 (IST) Received: from DBDE01.ent.ti.com ([fe80::d5df:c4b5:9919:4e10]) by DBDE71.ent.ti.com ([fe80::692c:15fd:9507:b54%21]) with mapi id 14.01.0323.003; Thu, 24 Jan 2013 15:03:35 +0530 From: "Hebbar, Gururaja" To: Mark Brown Subject: RE: [alsa-devel] [PATCH V2 2/2] ASoC: Davinci: machine: Add device tree binding Thread-Topic: [alsa-devel] [PATCH V2 2/2] ASoC: Davinci: machine: Add device tree binding Thread-Index: AQHN+YEX5mdJGMimIk6+yhi+9UfYCZhX8ngw Date: Thu, 24 Jan 2013 09:33:34 +0000 Message-ID: <1BAFE6F6C881BF42822005164F1491C33EB52FD9@DBDE01.ent.ti.com> References: <1357293277-25543-1-git-send-email-gururaja.hebbar@ti.com> <1357293277-25543-3-git-send-email-gururaja.hebbar@ti.com> <20130104122612.GM4627@opensource.wolfsonmicro.com> <1BAFE6F6C881BF42822005164F1491C33EB50DCF@DBDE01.ent.ti.com> <20130123154804.GB4565@opensource.wolfsonmicro.com> In-Reply-To: <20130123154804.GB4565@opensource.wolfsonmicro.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.24.162.25] MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130124_043348_379471_7D61DBBC X-CRM114-Status: GOOD ( 16.09 ) X-Spam-Score: -7.6 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.152 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: "davinci-linux-open-source@linux.davincidsp.com" , "alsa-devel@alsa-project.org" , "linux-doc@vger.kernel.org" , "tony@atomide.com" , "devicetree-discuss@lists.ozlabs.org" , "Nori, Sekhar" , "linux-kernel@vger.kernel.org" , "rob@landley.net" , "Girdwood, Liam" , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Wed, Jan 23, 2013 at 21:18:12, Mark Brown wrote: > On Wed, Jan 23, 2013 at 12:39:35PM +0000, Hebbar, Gururaja wrote: > > On Fri, Jan 04, 2013 at 17:56:12, Mark Brown wrote: > > > > The CODEC driver biases should be changed over to be supplies, this > > > makes the above much more natural - the routing there is a hack for > > > older versions of ASoc. Otherwise this looks fine. > > > ON TLV320AIC3x Codec, MIC Bias power on/off share the same register bits > > with Bias voltage output. > > So you need to use an event to write the actual enable bit. Yes. Bias Enable/Disable is possible using SND_SOC_DAPM_SUPPLY. However the actual Bias voltage should be user selectable. > > > SGTL5000 --> Single register for MIC BIAS enable & output impedance of MIC > > Bias. The driver uses SND_SOC_DAPM_POST_PMU & SND_SOC_DAPM_PRE_PMD macro to > > handle the MIC Bias enable & disable event. > > This is the way these things should be handled. However, as mentioned before, TLV320AIC3x Codec there is no separate enable/disable bit. It is mixed with Bias Voltage settings. So it is either a. Bias is disabled b. Bias is enabled with some voltage. This voltage should be user configurable. So, by just using the SND_SOC_DAPM_POST_PMU & SND_SOC_DAPM_PRE_PMD I can mask & handle one particular voltage. Now I am not able understand how to make this user configurable using SND_SOC_DAPM_xx macro. I believe the below code change [1] should work in this situation. What is your opinion? Thanks & Regards Gururaja diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 5708a97..2c17e46 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c @@ -268,6 +268,11 @@ static DECLARE_TLV_DB_SCALE(adc_tlv, 0, 50, 0); */ static DECLARE_TLV_DB_SCALE(output_stage_tlv, -5900, 50, 1); +static const char *mic_bias_level_txt[] = { "off", "2V", "2.5V", "AVDD" }; + +static const struct soc_enum mic_bias_level = +SOC_ENUM_SINGLE(MICBIAS_CTRL, 6, 4, mic_bias_level_txt); + static const struct snd_kcontrol_new aic3x_snd_controls[] = { /* Output */ SOC_DOUBLE_R_TLV("PCM Playback Volume", @@ -391,6 +396,9 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = { SOC_DOUBLE_R("PGA Capture Switch", LADC_VOL, RADC_VOL, 7, 0x01, 1), SOC_ENUM("ADC HPF Cut-off", aic3x_enum[ADC_HPF_ENUM]), + + /* Mic Bias Level */ + SOC_ENUM("Mic Bias Level", mic_bias_level), }; /* @@ -596,12 +604,7 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { AIC3X_ASD_INTF_CTRLA, 0, 3, 3, 0), /* Mic Bias */ - SND_SOC_DAPM_REG(snd_soc_dapm_micbias, "Mic Bias 2V", - MICBIAS_CTRL, 6, 3, 1, 0), - SND_SOC_DAPM_REG(snd_soc_dapm_micbias, "Mic Bias 2.5V", - MICBIAS_CTRL, 6, 3, 2, 0), - SND_SOC_DAPM_REG(snd_soc_dapm_micbias, "Mic Bias AVDD", - MICBIAS_CTRL, 6, 3, 3, 0), + SND_SOC_DAPM_SUPPLY("Mic Bias", MICBIAS_CTRL, 6, 0, NULL, 0), /* Output mixers */ SND_SOC_DAPM_MIXER("Left Line Mixer", SND_SOC_NOPM, 0, 0, diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 82d29a5..37b8e78 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -128,9 +128,9 @@ static const struct snd_soc_dapm_route audio_map[] = { {"Line Out", NULL, "RLOUT"}, /* Mic connected to (MIC3L | MIC3R) */ - {"MIC3L", NULL, "Mic Bias 2V"}, - {"MIC3R", NULL, "Mic Bias 2V"}, - {"Mic Bias 2V", NULL, "Mic Jack"}, + {"MIC3L", NULL, "Mic Bias"}, + {"MIC3R", NULL, "Mic Bias"}, + {"Mic Bias", NULL, "Mic Jack"}, /* Line In connected to (LINE1L | LINE2L), (LINE1R | LINE2R) */ {"LINE1L", NULL, "Line In"},