From: Takashi Iwai Subject: Re: [PATCH] ALSA: hda - Tweak OLPC XO-1.5 microphone bias Date: Tue, 10 Nov 2009 08:41:35 +0100 Message-ID: References: <20091109151724.73DFC9D404F@zog.reactivated.net> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 8C32210386E for ; Tue, 10 Nov 2009 08:41:35 +0100 (CET) In-Reply-To: <20091109151724.73DFC9D404F@zog.reactivated.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Daniel Drake Cc: alsa-devel@alsa-project.org, devel@lists.laptop.org List-Id: alsa-devel@alsa-project.org At Mon, 9 Nov 2009 15:17:24 +0000 (GMT), Daniel Drake wrote: > > Our contacts at Conexant suggested that we reduce the external > microphone bias to 50% in order to center the input signal with > the DC input range of the codec. This is because the microphone > port is DC coupled for potential use with sensors. > > Signed-off-by: Daniel Drake Although I don't particularly like the dynamic struct array initialization that this patch changes to, its change is pretty small and this is what we'd need at this moment. So I applied it as is for 2.6.32. Thanks! Takashi > > --- > sound/pci/hda/patch_conexant.c | 15 ++++++++++++--- > 1 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c > index 5d3a25d..ace8898 100644 > --- a/sound/pci/hda/patch_conexant.c > +++ b/sound/pci/hda/patch_conexant.c > @@ -110,6 +110,7 @@ struct conexant_spec { > > unsigned int dell_automute; > unsigned int port_d_mode; > + unsigned char ext_mic_bias; > }; > > static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo, > @@ -1917,6 +1918,11 @@ static hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 }; > static hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 }; > #define CXT5066_SPDIF_OUT 0x21 > > +/* OLPC's microphone port is DC coupled for use with external sensors, > + * therefore we use a 50% mic bias in order to center the input signal with > + * the DC input range of the codec. */ > +#define CXT5066_OLPC_EXT_MIC_BIAS PIN_VREF50 > + > static struct hda_channel_mode cxt5066_modes[1] = { > { 2, NULL }, > }; > @@ -1970,9 +1976,10 @@ static int cxt5066_hp_master_sw_put(struct snd_kcontrol *kcontrol, > /* toggle input of built-in and mic jack appropriately */ > static void cxt5066_automic(struct hda_codec *codec) > { > - static struct hda_verb ext_mic_present[] = { > + struct conexant_spec *spec = codec->spec; > + struct hda_verb ext_mic_present[] = { > /* enable external mic, port B */ > - {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, > + {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, spec->ext_mic_bias}, > > /* switch to external mic input */ > {0x17, AC_VERB_SET_CONNECT_SEL, 0}, > @@ -2225,7 +2232,7 @@ static struct hda_verb cxt5066_init_verbs_olpc[] = { > {0x19, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC1 */ > > /* Port B: external microphone */ > - {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, > + {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, CXT5066_OLPC_EXT_MIC_BIAS}, > > /* Port C: internal microphone */ > {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, > @@ -2343,6 +2350,7 @@ static int patch_cxt5066(struct hda_codec *codec) > spec->input_mux = &cxt5066_capture_source; > > spec->port_d_mode = PIN_HP; > + spec->ext_mic_bias = PIN_VREF80; > > spec->num_init_verbs = 1; > spec->init_verbs[0] = cxt5066_init_verbs; > @@ -2374,6 +2382,7 @@ static int patch_cxt5066(struct hda_codec *codec) > spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; > spec->mixers[spec->num_mixers++] = cxt5066_mixers; > spec->port_d_mode = 0; > + spec->ext_mic_bias = CXT5066_OLPC_EXT_MIC_BIAS; > > /* no S/PDIF out */ > spec->multiout.dig_out_nid = 0; > -- > 1.6.2.5 >