Commit a53d1aec authored by Tobin Davis's avatar Tobin Davis Committed by Jaroslav Kysela
Browse files

[ALSA] hda-codec - Add toshiba model to ALC861 codec



This patch adds support for Toshiba laptops.  Code is from
RealTek's alsa-driver-1.0.12-4.05b tree.

Signed-off-by: default avatarTobin Davis <tdavis@dsl-only.net>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 12e74f7d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -826,6 +826,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
	  6stack-dig	6-jack with SPDIF I/O
	  3stack-660	3-jack (for ALC660)
	  uniwill-m31	Uniwill M31 laptop
	  toshiba	Toshiba laptop support
	  auto		auto-config reading BIOS (default)

	CMI9880
+75 −2
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ enum {
	ALC861_3ST_DIG,
	ALC861_6ST_DIG,
	ALC861_UNIWILL_M31,
	ALC861_TOSHIBA,
	ALC861_AUTO,
	ALC861_MODEL_LAST,
};
@@ -6207,6 +6208,28 @@ static struct snd_kcontrol_new alc861_3ST_mixer[] = {
	},
	{ } /* end */
};

static snd_kcontrol_new_t alc861_toshiba_mixer[] = {
        /* output mixer control */
	HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
	HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
	HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
	
        /*Capture mixer control */
	HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
	HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
	{
		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
		.name = "Capture Source",
		.count = 1,
		.info = alc_mux_enum_info,
		.get = alc_mux_enum_get,
		.put = alc_mux_enum_put,
	},

	{ } /* end */
};	

static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
        /* output mixer control */
	HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
@@ -6489,6 +6512,39 @@ static struct hda_verb alc861_auto_init_verbs[] = {
	{ }
};

static struct hda_verb alc861_toshiba_init_verbs[] = {
	{0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
        
	{ }
};

/* toggle speaker-output according to the hp-jack state */
static void alc861_toshiba_automute(struct hda_codec *codec)
{
	unsigned int present;

	present = snd_hda_codec_read(codec, 0x0f, 0,
				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
	snd_hda_codec_amp_update(codec, 0x16, 0, HDA_INPUT, 0,
				 0x80, present ? 0x80 : 0);
	snd_hda_codec_amp_update(codec, 0x16, 1, HDA_INPUT, 0,
				 0x80, present ? 0x80 : 0);
	snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_INPUT, 3,
				 0x80, present ? 0 : 0x80);
	snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_INPUT, 3,
				 0x80, present ? 0 : 0x80);
}

static void alc861_toshiba_unsol_event(struct hda_codec *codec,
				       unsigned int res)
{
	/* Looks like the unsol event is incompatible with the standard
	 * definition.  6bit tag is placed at 26 bit!
	 */
	if ((res >> 26) == ALC880_HP_EVENT)
		alc861_toshiba_automute(codec);
}

/* pcm configuration: identiacal with ALC880 */
#define alc861_pcm_analog_playback	alc880_pcm_analog_playback
#define alc861_pcm_analog_capture	alc880_pcm_analog_capture
@@ -6774,6 +6830,11 @@ static struct hda_board_config alc861_cfg_tbl[] = {
	{ .modelname = "uniwill-m31", .config = ALC861_UNIWILL_M31},
	{ .pci_subvendor = 0x1584, .pci_subdevice = 0x9072,
	  .config = ALC861_UNIWILL_M31 },
	{ .modelname = "toshiba", .config = ALC861_TOSHIBA },
	{ .pci_subvendor = 0x1043, .pci_subdevice = 0x1338,
	  .config = ALC861_TOSHIBA },
	{ .pci_subvendor = 0x1179, .pci_subdevice = 0xff10,
	  .config = ALC861_TOSHIBA },
	{ .modelname = "auto", .config = ALC861_AUTO },
	{}
};
@@ -6841,7 +6902,19 @@ static struct alc_config_preset alc861_presets[] = {
		.adc_nids = alc861_adc_nids,
		.input_mux = &alc861_capture_source,
	},

	[ALC861_TOSHIBA] = {
		.mixers = { alc861_toshiba_mixer },
		.init_verbs = { alc861_base_init_verbs, alc861_toshiba_init_verbs },
		.num_dacs = ARRAY_SIZE(alc861_dac_nids),
		.dac_nids = alc861_dac_nids,
		.num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
		.channel_mode = alc883_3ST_2ch_modes,
		.num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
		.adc_nids = alc861_adc_nids,
		.input_mux = &alc861_capture_source,
		.unsol_event = alc861_toshiba_unsol_event,
		.init_hook = alc861_toshiba_automute,
	},
};