From: Takashi Iwai Subject: Re: [PATCH] hda: add PCM for 2nd ADC on ALC260 Date: Tue, 07 Feb 2006 22:15:22 +0100 Message-ID: References: <200602060025.k160PfnO016229@auster.physics.adelaide.edu.au> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <200602060025.k160PfnO016229@auster.physics.adelaide.edu.au> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Jonathan Woithe Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Mon, 6 Feb 2006 10:55:41 +1030 (CST), Jonathan Woithe wrote: > > Hi all > > The following patch against alsa 1.0.11rc3 creates a PCM device (pcm1c) for > the second ADC present on the ALC260 codec used by the hda driver. It also > defines a new mixer control allowing the mode of retasking pins to be set; > this means a user can (for example) designate the headphone jack to be a > second input. With this patch in place it is possible to do 4 channel > recording on laptops equipped with an ALC260 codec assuming both a stereo > line-in jack is provided in addition to a headphone jack. > > Mixer controls are provided to allow the headphone jack to be switched as > an input. In addition, an (input only) mode control is configured for > the line-in jack to allow a bias voltage to be requested (VREF80 or VREF50) > so headsets based on condensor microphones have a chance of working. > > This patch has been tested on a Fujitsu S7020 laptop and as such these > features are currently only configured for the "fujitsu" model. Thanks for the patch. The vref tuning might be necessary for other models, too. > +static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) > { > - uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; > + signed int item_num = uinfo->value.enumerated.item; > + signed char dir = (kcontrol->private_value >> 16) & 0xff; Why signed? unsigned whould be safer in such a case. > @@ -2408,11 +2478,12 @@ > static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { > HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), > HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), > - ALC_PINCTL_SWITCH("Headphone Amp Switch", 0x14, PIN_HP_AMP), > + ALC_PIN_MODE("Headphone jack mode", 0x14, ALC_PIN_DIR_INOUT), Using capital for each word is conventional for control names. > HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), > HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), > HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), > HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), > + ALC_PIN_MODE("Mic/Line jack mode", 0x12, ALC_PIN_DIR_IN), Ditto. BTW, some codecs have functions to detect the jack impedence, IIRC. Could it be implemented somehow to improve the automatic jack detection? Takashi ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642