Skip to content

Commit 3ab345f

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda/realtek - Fix lost speaker volume controls ALSA: hda/realtek - Create "Bass Speaker" for two speaker pins ALSA: hda/realtek - Don't create extra controls with channel suffix ALSA: hda - Fix remaining VREF mute-LED NID check in post-3.1 changes ALSA: hda - Fix GPIO LED setup for IDT 92HD75 codecs ASoC: Provide a more complete DMA driver stub ASoC: Remove references to corgi and spitz from machine driver document ASoC: Make SND_SOC_MX27VIS_AIC32X4 depend on I2C ASoC: Fix dependency for SND_SOC_RAUMFELD and SND_PXA2XX_SOC_HX4700 ASoC: uda1380: Return proper error in uda1380_modinit failure path ASoC: kirkwood: Make SND_KIRKWOOD_SOC_OPENRD and SND_KIRKWOOD_SOC_T5325 depend on I2C ASoC: Mark WM8994 ADC muxes as virtual ALSA: hda/realtek - Fix Oops in alc_mux_select() ALSA: sis7019 - give slow codecs more time to reset
2 parents 975e32c + 0a34b42 commit 3ab345f

File tree

10 files changed

+172
-65
lines changed

10 files changed

+172
-65
lines changed

Documentation/sound/alsa/soc/machine.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ Machine DAI Configuration
5050
The machine DAI configuration glues all the codec and CPU DAIs together. It can
5151
also be used to set up the DAI system clock and for any machine related DAI
5252
initialisation e.g. the machine audio map can be connected to the codec audio
53-
map, unconnected codec pins can be set as such. Please see corgi.c, spitz.c
54-
for examples.
53+
map, unconnected codec pins can be set as such.
5554

5655
struct snd_soc_dai_link is used to set up each DAI in your machine. e.g.
5756

@@ -83,8 +82,7 @@ Machine Power Map
8382
The machine driver can optionally extend the codec power map and to become an
8483
audio power map of the audio subsystem. This allows for automatic power up/down
8584
of speaker/HP amplifiers, etc. Codec pins can be connected to the machines jack
86-
sockets in the machine init function. See soc/pxa/spitz.c and dapm.txt for
87-
details.
85+
sockets in the machine init function.
8886

8987

9088
Machine Controls

sound/pci/hda/patch_realtek.c

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx,
297297
imux = &spec->input_mux[mux_idx];
298298
if (!imux->num_items && mux_idx > 0)
299299
imux = &spec->input_mux[0];
300+
if (!imux->num_items)
301+
return 0;
300302

301303
if (idx >= imux->num_items)
302304
idx = imux->num_items - 1;
@@ -2629,6 +2631,8 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch,
26292631
case AUTO_PIN_SPEAKER_OUT:
26302632
if (cfg->line_outs == 1)
26312633
return "Speaker";
2634+
if (cfg->line_outs == 2)
2635+
return ch ? "Bass Speaker" : "Speaker";
26322636
break;
26332637
case AUTO_PIN_HP_OUT:
26342638
/* for multi-io case, only the primary out */
@@ -2902,7 +2906,7 @@ static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
29022906
if (!nid)
29032907
continue;
29042908
if (found_in_nid_list(nid, spec->multiout.dac_nids,
2905-
spec->multiout.num_dacs))
2909+
ARRAY_SIZE(spec->private_dac_nids)))
29062910
continue;
29072911
if (found_in_nid_list(nid, spec->multiout.hp_out_nid,
29082912
ARRAY_SIZE(spec->multiout.hp_out_nid)))
@@ -2923,6 +2927,7 @@ static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin)
29232927
return 0;
29242928
}
29252929

2930+
/* return 0 if no possible DAC is found, 1 if one or more found */
29262931
static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs,
29272932
const hda_nid_t *pins, hda_nid_t *dacs)
29282933
{
@@ -2940,7 +2945,7 @@ static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs,
29402945
if (!dacs[i])
29412946
dacs[i] = alc_auto_look_for_dac(codec, pins[i]);
29422947
}
2943-
return 0;
2948+
return 1;
29442949
}
29452950

29462951
static int alc_auto_fill_multi_ios(struct hda_codec *codec,
@@ -2950,7 +2955,7 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec,
29502955
static int alc_auto_fill_dac_nids(struct hda_codec *codec)
29512956
{
29522957
struct alc_spec *spec = codec->spec;
2953-
const struct auto_pin_cfg *cfg = &spec->autocfg;
2958+
struct auto_pin_cfg *cfg = &spec->autocfg;
29542959
bool redone = false;
29552960
int i;
29562961

@@ -2961,6 +2966,7 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec)
29612966
spec->multiout.extra_out_nid[0] = 0;
29622967
memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
29632968
spec->multiout.dac_nids = spec->private_dac_nids;
2969+
spec->multi_ios = 0;
29642970

29652971
/* fill hard-wired DACs first */
29662972
if (!redone) {
@@ -2994,10 +3000,12 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec)
29943000
for (i = 0; i < cfg->line_outs; i++) {
29953001
if (spec->private_dac_nids[i])
29963002
spec->multiout.num_dacs++;
2997-
else
3003+
else {
29983004
memmove(spec->private_dac_nids + i,
29993005
spec->private_dac_nids + i + 1,
30003006
sizeof(hda_nid_t) * (cfg->line_outs - i - 1));
3007+
spec->private_dac_nids[cfg->line_outs - 1] = 0;
3008+
}
30013009
}
30023010

30033011
if (cfg->line_outs == 1 && cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
@@ -3019,9 +3027,28 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec)
30193027
if (cfg->line_out_type != AUTO_PIN_HP_OUT)
30203028
alc_auto_fill_extra_dacs(codec, cfg->hp_outs, cfg->hp_pins,
30213029
spec->multiout.hp_out_nid);
3022-
if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
3023-
alc_auto_fill_extra_dacs(codec, cfg->speaker_outs, cfg->speaker_pins,
3024-
spec->multiout.extra_out_nid);
3030+
if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
3031+
int err = alc_auto_fill_extra_dacs(codec, cfg->speaker_outs,
3032+
cfg->speaker_pins,
3033+
spec->multiout.extra_out_nid);
3034+
/* if no speaker volume is assigned, try again as the primary
3035+
* output
3036+
*/
3037+
if (!err && cfg->speaker_outs > 0 &&
3038+
cfg->line_out_type == AUTO_PIN_HP_OUT) {
3039+
cfg->hp_outs = cfg->line_outs;
3040+
memcpy(cfg->hp_pins, cfg->line_out_pins,
3041+
sizeof(cfg->hp_pins));
3042+
cfg->line_outs = cfg->speaker_outs;
3043+
memcpy(cfg->line_out_pins, cfg->speaker_pins,
3044+
sizeof(cfg->speaker_pins));
3045+
cfg->speaker_outs = 0;
3046+
memset(cfg->speaker_pins, 0, sizeof(cfg->speaker_pins));
3047+
cfg->line_out_type = AUTO_PIN_SPEAKER_OUT;
3048+
redone = false;
3049+
goto again;
3050+
}
3051+
}
30253052

30263053
return 0;
30273054
}
@@ -3171,7 +3198,8 @@ static int alc_auto_create_multi_out_ctls(struct hda_codec *codec,
31713198
}
31723199

31733200
static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
3174-
hda_nid_t dac, const char *pfx)
3201+
hda_nid_t dac, const char *pfx,
3202+
int cidx)
31753203
{
31763204
struct alc_spec *spec = codec->spec;
31773205
hda_nid_t sw, vol;
@@ -3187,15 +3215,15 @@ static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
31873215
if (is_ctl_used(spec->sw_ctls, val))
31883216
return 0; /* already created */
31893217
mark_ctl_usage(spec->sw_ctls, val);
3190-
return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
3218+
return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, cidx, val);
31913219
}
31923220

31933221
sw = alc_look_for_out_mute_nid(codec, pin, dac);
31943222
vol = alc_look_for_out_vol_nid(codec, pin, dac);
3195-
err = alc_auto_add_stereo_vol(codec, pfx, 0, vol);
3223+
err = alc_auto_add_stereo_vol(codec, pfx, cidx, vol);
31963224
if (err < 0)
31973225
return err;
3198-
err = alc_auto_add_stereo_sw(codec, pfx, 0, sw);
3226+
err = alc_auto_add_stereo_sw(codec, pfx, cidx, sw);
31993227
if (err < 0)
32003228
return err;
32013229
return 0;
@@ -3236,16 +3264,21 @@ static int alc_auto_create_extra_outs(struct hda_codec *codec, int num_pins,
32363264
hda_nid_t dac = *dacs;
32373265
if (!dac)
32383266
dac = spec->multiout.dac_nids[0];
3239-
return alc_auto_create_extra_out(codec, *pins, dac, pfx);
3267+
return alc_auto_create_extra_out(codec, *pins, dac, pfx, 0);
32403268
}
32413269

32423270
if (dacs[num_pins - 1]) {
32433271
/* OK, we have a multi-output system with individual volumes */
32443272
for (i = 0; i < num_pins; i++) {
3245-
snprintf(name, sizeof(name), "%s %s",
3246-
pfx, channel_name[i]);
3247-
err = alc_auto_create_extra_out(codec, pins[i], dacs[i],
3248-
name);
3273+
if (num_pins >= 3) {
3274+
snprintf(name, sizeof(name), "%s %s",
3275+
pfx, channel_name[i]);
3276+
err = alc_auto_create_extra_out(codec, pins[i], dacs[i],
3277+
name, 0);
3278+
} else {
3279+
err = alc_auto_create_extra_out(codec, pins[i], dacs[i],
3280+
pfx, i);
3281+
}
32493282
if (err < 0)
32503283
return err;
32513284
}

sound/pci/hda/patch_sigmatel.c

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ struct sigmatel_spec {
215215
unsigned int gpio_mute;
216216
unsigned int gpio_led;
217217
unsigned int gpio_led_polarity;
218+
unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */
218219
unsigned int vref_led;
219220

220221
/* stream */
@@ -4318,12 +4319,10 @@ static void stac_store_hints(struct hda_codec *codec)
43184319
spec->eapd_switch = val;
43194320
get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity);
43204321
if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) {
4321-
if (spec->gpio_led <= 8) {
4322-
spec->gpio_mask |= spec->gpio_led;
4323-
spec->gpio_dir |= spec->gpio_led;
4324-
if (spec->gpio_led_polarity)
4325-
spec->gpio_data |= spec->gpio_led;
4326-
}
4322+
spec->gpio_mask |= spec->gpio_led;
4323+
spec->gpio_dir |= spec->gpio_led;
4324+
if (spec->gpio_led_polarity)
4325+
spec->gpio_data |= spec->gpio_led;
43274326
}
43284327
}
43294328

@@ -4443,7 +4442,7 @@ static int stac92xx_init(struct hda_codec *codec)
44434442
/* power on when no jack detection is available */
44444443
/* or when the VREF is used for controlling LED */
44454444
if (!spec->hp_detect ||
4446-
(spec->gpio_led > 8 && spec->gpio_led == nid)) {
4445+
spec->vref_mute_led_nid == nid) {
44474446
stac_toggle_power_map(codec, nid, 1);
44484447
continue;
44494448
}
@@ -4915,8 +4914,14 @@ static int find_mute_led_gpio(struct hda_codec *codec, int default_polarity)
49154914
if (sscanf(dev->name, "HP_Mute_LED_%d_%x",
49164915
&spec->gpio_led_polarity,
49174916
&spec->gpio_led) == 2) {
4918-
if (spec->gpio_led < 4)
4917+
unsigned int max_gpio;
4918+
max_gpio = snd_hda_param_read(codec, codec->afg,
4919+
AC_PAR_GPIO_CAP);
4920+
max_gpio &= AC_GPIO_IO_COUNT;
4921+
if (spec->gpio_led < max_gpio)
49194922
spec->gpio_led = 1 << spec->gpio_led;
4923+
else
4924+
spec->vref_mute_led_nid = spec->gpio_led;
49204925
return 1;
49214926
}
49224927
if (sscanf(dev->name, "HP_Mute_LED_%d",
@@ -5045,15 +5050,12 @@ static int stac92xx_pre_resume(struct hda_codec *codec)
50455050
struct sigmatel_spec *spec = codec->spec;
50465051

50475052
/* sync mute LED */
5048-
if (spec->gpio_led) {
5049-
if (spec->gpio_led <= 8) {
5050-
stac_gpio_set(codec, spec->gpio_mask,
5051-
spec->gpio_dir, spec->gpio_data);
5052-
} else {
5053-
stac_vrefout_set(codec,
5054-
spec->gpio_led, spec->vref_led);
5055-
}
5056-
}
5053+
if (spec->vref_mute_led_nid)
5054+
stac_vrefout_set(codec, spec->vref_mute_led_nid,
5055+
spec->vref_led);
5056+
else if (spec->gpio_led)
5057+
stac_gpio_set(codec, spec->gpio_mask,
5058+
spec->gpio_dir, spec->gpio_data);
50575059
return 0;
50585060
}
50595061

@@ -5064,7 +5066,7 @@ static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg,
50645066
struct sigmatel_spec *spec = codec->spec;
50655067

50665068
if (power_state == AC_PWRST_D3) {
5067-
if (spec->gpio_led > 8) {
5069+
if (spec->vref_mute_led_nid) {
50685070
/* with vref-out pin used for mute led control
50695071
* codec AFG is prevented from D3 state
50705072
*/
@@ -5117,7 +5119,7 @@ static int stac92xx_update_led_status(struct hda_codec *codec)
51175119
}
51185120
}
51195121
/*polarity defines *not* muted state level*/
5120-
if (spec->gpio_led <= 8) {
5122+
if (!spec->vref_mute_led_nid) {
51215123
if (muted)
51225124
spec->gpio_data &= ~spec->gpio_led; /* orange */
51235125
else
@@ -5135,7 +5137,8 @@ static int stac92xx_update_led_status(struct hda_codec *codec)
51355137
muted_lvl = spec->gpio_led_polarity ?
51365138
AC_PINCTL_VREF_GRD : AC_PINCTL_VREF_HIZ;
51375139
spec->vref_led = muted ? muted_lvl : notmtd_lvl;
5138-
stac_vrefout_set(codec, spec->gpio_led, spec->vref_led);
5140+
stac_vrefout_set(codec, spec->vref_mute_led_nid,
5141+
spec->vref_led);
51395142
}
51405143
return 0;
51415144
}
@@ -5649,7 +5652,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
56495652

56505653
#ifdef CONFIG_SND_HDA_POWER_SAVE
56515654
if (spec->gpio_led) {
5652-
if (spec->gpio_led <= 8) {
5655+
if (!spec->vref_mute_led_nid) {
56535656
spec->gpio_mask |= spec->gpio_led;
56545657
spec->gpio_dir |= spec->gpio_led;
56555658
spec->gpio_data |= spec->gpio_led;
@@ -5962,7 +5965,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
59625965

59635966
#ifdef CONFIG_SND_HDA_POWER_SAVE
59645967
if (spec->gpio_led) {
5965-
if (spec->gpio_led <= 8) {
5968+
if (!spec->vref_mute_led_nid) {
59665969
spec->gpio_mask |= spec->gpio_led;
59675970
spec->gpio_dir |= spec->gpio_led;
59685971
spec->gpio_data |= spec->gpio_led;

0 commit comments

Comments
 (0)