Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 353023
b: refs/heads/master
c: 27d3153
h: refs/heads/master
i:
  353021: 1e1ad2a
  353019: 9234d55
  353015: ddf3355
  353007: e43c32a
  352991: 74d0161
  352959: 1a4448f
  352895: e61a585
  352767: 586b3a9
v: v3
  • Loading branch information
Takashi Iwai committed Jan 12, 2013
1 parent bf0e6ab commit c7fb17e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 37 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 666a70d42b0fc04daaba64635741b649ed918fce
refs/heads/master: 27d31536517aa3609c592b68f1a69b6b687061f8
56 changes: 20 additions & 36 deletions trunk/sound/pci/hda/patch_realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ struct alc_spec {
/* codec parameterization */
const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
unsigned int num_mixers;
const struct snd_kcontrol_new *cap_mixer; /* capture mixer */
unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */

char stream_name_analog[32]; /* analog PCM stream */
Expand All @@ -152,8 +151,7 @@ struct alc_spec {

/* capture */
unsigned int num_adc_nids;
const hda_nid_t *adc_nids;
const hda_nid_t *capsrc_nids;
hda_nid_t adc_nids[AUTO_CFG_MAX_OUTS];
hda_nid_t dig_in_nid; /* digital-in NID; optional */
hda_nid_t mixer_nid; /* analog-mixer NID */

Expand All @@ -164,7 +162,7 @@ struct alc_spec {

/* capture source */
unsigned int num_mux_defs;
const struct hda_input_mux *input_mux;
struct hda_input_mux input_mux;
unsigned int cur_mux[3];
hda_nid_t ext_mic_pin;
hda_nid_t dock_mic_pin;
Expand All @@ -184,10 +182,7 @@ struct alc_spec {
struct auto_pin_cfg autocfg;
struct alc_customize_define cdefine;
struct snd_array kctls;
struct hda_input_mux private_imux[3];
hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
hda_nid_t imux_pins[HDA_MAX_NUM_INPUTS];
unsigned int dyn_adc_idx[HDA_MAX_NUM_INPUTS];
int int_mic_idx, ext_mic_idx, dock_mic_idx; /* for auto-mic */
Expand Down Expand Up @@ -291,7 +286,7 @@ static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
{
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
struct alc_spec *spec = codec->spec;
return snd_hda_input_mux_info(&spec->input_mux[0], uinfo);
return snd_hda_input_mux_info(&spec->input_mux, uinfo);
}

static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
Expand Down Expand Up @@ -374,8 +369,8 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx,
const struct hda_input_mux *imux;
struct nid_path *path;

imux = spec->input_mux;
if (!imux || !imux->num_items)
imux = &spec->input_mux;
if (!imux->num_items)
return 0;

if (idx >= imux->num_items)
Expand Down Expand Up @@ -632,8 +627,6 @@ static void alc_mic_automute(struct hda_codec *codec, struct hda_jack_tbl *jack)

if (!spec->auto_mic || !spec->auto_mic_valid_imux)
return;
if (snd_BUG_ON(!spec->adc_nids))
return;
if (snd_BUG_ON(spec->int_mic_idx < 0 || spec->ext_mic_idx < 0))
return;

Expand Down Expand Up @@ -998,7 +991,7 @@ static bool alc_auto_mic_check_imux(struct hda_codec *codec)
struct alc_spec *spec = codec->spec;
const struct hda_input_mux *imux;

imux = spec->input_mux;
imux = &spec->input_mux;
spec->ext_mic_idx = find_idx_in_nid_list(spec->ext_mic_pin,
spec->imux_pins, imux->num_items);
spec->int_mic_idx = find_idx_in_nid_list(spec->int_mic_pin,
Expand Down Expand Up @@ -1441,7 +1434,7 @@ static int alc_cap_put_caller(struct snd_kcontrol *kcontrol,
struct nid_path *path;
int i, adc_idx, err = 0;

imux = spec->input_mux;
imux = &spec->input_mux;
adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
mutex_lock(&codec->control_mutex);
codec->cached_write = 1;
Expand Down Expand Up @@ -1488,7 +1481,7 @@ static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
static void alc_inv_dmic_sync_adc(struct hda_codec *codec, int adc_idx)
{
struct alc_spec *spec = codec->spec;
struct hda_input_mux *imux = &spec->private_imux[0];
struct hda_input_mux *imux = &spec->input_mux;
struct nid_path *path;
hda_nid_t nid;
int i, dir, parm;
Expand Down Expand Up @@ -1650,11 +1643,6 @@ static int __alc_build_controls(struct hda_codec *codec)
if (err < 0)
return err;
}
if (spec->cap_mixer) {
err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
if (err < 0)
return err;
}
if (spec->multiout.dig_out_nid) {
err = snd_hda_create_dig_out_ctls(codec,
spec->multiout.dig_out_nid,
Expand Down Expand Up @@ -2014,7 +2002,7 @@ static int alc_build_pcms(struct hda_codec *codec)
info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap =
snd_pcm_2_1_chmaps;
}
if (spec->adc_nids) {
if (spec->num_adc_nids) {
p = spec->stream_analog_capture;
if (!p) {
if (spec->dyn_adc_switch)
Expand Down Expand Up @@ -2074,8 +2062,7 @@ static int alc_build_pcms(struct hda_codec *codec)
* model, configure a second analog capture-only PCM.
*/
have_multi_adcs = (spec->num_adc_nids > 1) &&
!spec->dyn_adc_switch && !spec->auto_mic &&
(!spec->input_mux || spec->input_mux->num_items > 1);
!spec->dyn_adc_switch && !spec->auto_mic;
/* Additional Analaog capture for index #2 */
if (spec->alt_dac_nid || have_multi_adcs) {
codec->num_pcms = 3;
Expand Down Expand Up @@ -2442,8 +2429,8 @@ static int alc_auto_fill_adc_nids(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
hda_nid_t nid;
hda_nid_t *adc_nids = spec->private_adc_nids;
int max_nums = ARRAY_SIZE(spec->private_adc_nids);
hda_nid_t *adc_nids = spec->adc_nids;
int max_nums = ARRAY_SIZE(spec->adc_nids);
int i, nums = 0;

nid = codec->start_nid;
Expand All @@ -2457,7 +2444,6 @@ static int alc_auto_fill_adc_nids(struct hda_codec *codec)
if (++nums >= max_nums)
break;
}
spec->adc_nids = spec->private_adc_nids;
spec->num_adc_nids = nums;
return nums;
}
Expand All @@ -2468,8 +2454,8 @@ static int alc_auto_fill_adc_nids(struct hda_codec *codec)
static int check_dyn_adc_switch(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
struct hda_input_mux *imux = &spec->private_imux[0];
hda_nid_t adc_nids[ARRAY_SIZE(spec->private_adc_nids)];
struct hda_input_mux *imux = &spec->input_mux;
hda_nid_t adc_nids[ARRAY_SIZE(spec->adc_nids)];
int i, n, nums;
hda_nid_t pin, adc;

Expand All @@ -2489,7 +2475,7 @@ static int check_dyn_adc_switch(struct hda_codec *codec)
if (!nums) {
if (spec->shared_mic_hp) {
spec->shared_mic_hp = 0;
spec->private_imux[0].num_items = 1;
imux->num_items = 1;
goto again;
}

Expand All @@ -2508,12 +2494,11 @@ static int check_dyn_adc_switch(struct hda_codec *codec)
snd_printdd("realtek: enabling ADC switching\n");
spec->dyn_adc_switch = 1;
} else if (nums != spec->num_adc_nids) {
memcpy(spec->private_adc_nids, adc_nids,
nums * sizeof(hda_nid_t));
memcpy(spec->adc_nids, adc_nids, nums * sizeof(hda_nid_t));
spec->num_adc_nids = nums;
}

if (spec->input_mux->num_items == 1 || spec->shared_mic_hp) {
if (imux->num_items == 1 || spec->shared_mic_hp) {
snd_printdd("realtek: reducing to a single ADC\n");
spec->num_adc_nids = 1; /* reduce to a single ADC */
}
Expand Down Expand Up @@ -2592,7 +2577,7 @@ static int parse_capvol_in_path(struct hda_codec *codec, struct nid_path *path)
static int create_capture_mixers(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
struct hda_input_mux *imux = &spec->private_imux[0];
struct hda_input_mux *imux = &spec->input_mux;
struct snd_kcontrol_new *knew;
int i, n, nums;

Expand Down Expand Up @@ -2654,7 +2639,7 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec)
struct alc_spec *spec = codec->spec;
const struct auto_pin_cfg *cfg = &spec->autocfg;
hda_nid_t mixer = spec->mixer_nid;
struct hda_input_mux *imux = &spec->private_imux[0];
struct hda_input_mux *imux = &spec->input_mux;
int num_adcs;
int i, c, err, type_idx = 0;
const char *prev_label = NULL;
Expand Down Expand Up @@ -2718,7 +2703,6 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec)
}
}

spec->input_mux = imux;
return 0;
}

Expand Down Expand Up @@ -4187,7 +4171,7 @@ static void alc_auto_init_multi_io(struct hda_codec *codec)
static void alc_auto_init_input_src(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
struct hda_input_mux *imux = &spec->private_imux[0];
struct hda_input_mux *imux = &spec->input_mux;
struct nid_path *path;
int i, c, nums;

Expand Down

0 comments on commit c7fb17e

Please sign in to comment.