Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/tiwai/sound

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (24 commits)
  ALSA: hda/realtek - Skip invalid digital out pins
  ALSA: hda/sigmatel - Automatically retrieve digital I/O widgets
  ALSA: hda - Remove unused variables
  ALSA: hda/realtek - Don't create alt-stream for capture when unnecessary
  ALSA: hda - Add support for 92HD65 / 92HD66 family of codecs
  ALSA: hda - Disable power-widget control for IDT 92HD83/93 as default
  ALSA: hda - Check NO_PRESENCE pincfg default bit
  ASoC: Ensure we always delay for WM8962 FLL when starting from SYSCLK
  ASoC: Ensure the WM8962 oscillator and PLLs start up disabled
  ASoC: Ensure WM8962 PLL registers are reset
  ALSA: intel8x0 - Fix inclusion of kvm_para.h
  ALSA: hda_hwdep: Fix possible buffer overflow
  ASoC: Fix return value of wm5100_gpio_direction_out()
  ASoC: WM8904: Set `invert' bit for Capture Switch
  ASoC: Leave input audio data bit length settings untouched in wm8711_set_dai_fmt
  ASoC: wm8711: Fix wrong mask for setting input audio data bit length select
  ALSA: intel8x0: Improve performance in virtual environment
  ALSA: hdspm - Enable all firmware ranges for PCI MADI/AES cards
  ALSA: hdsp - Correct HDSP_VERSION_BIT constant, thus partly fixing RPM detection
  ALSA: hdspm - Fix MADI channel format in the status ioctl
  ...
  • Loading branch information
Linus Torvalds committed Nov 4, 2011
2 parents 6b1506c + 6bcbf64 commit b2409fb
Show file tree
Hide file tree
Showing 17 changed files with 145 additions and 95 deletions.
9 changes: 8 additions & 1 deletion sound/core/hwdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,14 @@ static int snd_hwdep_control_ioctl(struct snd_card *card,
if (get_user(device, (int __user *)arg))
return -EFAULT;
mutex_lock(&register_mutex);
device = device < 0 ? 0 : device + 1;

if (device < 0)
device = 0;
else if (device < SNDRV_MINOR_HWDEPS)
device++;
else
device = SNDRV_MINOR_HWDEPS;

while (device < SNDRV_MINOR_HWDEPS) {
if (snd_hwdep_search(card, device))
break;
Expand Down
2 changes: 0 additions & 2 deletions sound/pci/hda/hda_hwdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,6 @@ static int get_line_from_fw(char *buf, int size, struct firmware *fw)
}
if (!fw->size)
return 0;
if (size < fw->size)
size = fw->size;

for (len = 0; len < fw->size; len++) {
if (!*p)
Expand Down
4 changes: 4 additions & 0 deletions sound/pci/hda/hda_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@ struct auto_pin_cfg {
(cfg & AC_DEFCFG_SEQUENCE)
#define get_defcfg_device(cfg) \
((cfg & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT)
#define get_defcfg_misc(cfg) \
((cfg & AC_DEFCFG_MISC) >> AC_DEFCFG_MISC_SHIFT)

/* bit-flags for snd_hda_parse_pin_def_config() behavior */
#define HDA_PINCFG_NO_HP_FIXUP (1 << 0) /* no HP-split */
Expand Down Expand Up @@ -509,6 +511,8 @@ int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid);
static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid)
{
return (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT) &&
!(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) &
AC_DEFCFG_MISC_NO_PRESENCE)) &&
(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP);
}

Expand Down
5 changes: 1 addition & 4 deletions sound/pci/hda/patch_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,6 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
unsigned int caps, config;
int pin_idx;
struct hdmi_spec_per_pin *per_pin;
struct hdmi_eld *eld;
int err;

caps = snd_hda_param_read(codec, pin_nid, AC_PAR_PIN_CAP);
Expand All @@ -1023,7 +1022,6 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)

pin_idx = spec->num_pins;
per_pin = &spec->pins[pin_idx];
eld = &per_pin->sink_eld;

per_pin->pin_nid = pin_nid;

Expand Down Expand Up @@ -1576,7 +1574,7 @@ static int nvhdmi_8ch_7x_pcm_prepare(struct hda_pcm_stream *hinfo,
struct snd_pcm_substream *substream)
{
int chs;
unsigned int dataDCC1, dataDCC2, channel_id;
unsigned int dataDCC2, channel_id;
int i;
struct hdmi_spec *spec = codec->spec;
struct hda_spdif_out *spdif =
Expand All @@ -1586,7 +1584,6 @@ static int nvhdmi_8ch_7x_pcm_prepare(struct hda_pcm_stream *hinfo,

chs = substream->runtime->channels;

dataDCC1 = AC_DIG1_ENABLE | AC_DIG1_COPYRIGHT;
dataDCC2 = 0x2;

/* turn off SPDIF once; otherwise the IEC958 bits won't be updated */
Expand Down
23 changes: 13 additions & 10 deletions sound/pci/hda/patch_realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -1604,27 +1604,29 @@ static void alc_auto_init_digital(struct hda_codec *codec)
static void alc_auto_parse_digital(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
int i, err;
int i, err, nums;
hda_nid_t dig_nid;

/* support multiple SPDIFs; the secondary is set up as a slave */
nums = 0;
for (i = 0; i < spec->autocfg.dig_outs; i++) {
hda_nid_t conn[4];
err = snd_hda_get_connections(codec,
spec->autocfg.dig_out_pins[i],
conn, ARRAY_SIZE(conn));
if (err < 0)
if (err <= 0)
continue;
dig_nid = conn[0]; /* assume the first element is audio-out */
if (!i) {
if (!nums) {
spec->multiout.dig_out_nid = dig_nid;
spec->dig_out_type = spec->autocfg.dig_out_type[0];
} else {
spec->multiout.slave_dig_outs = spec->slave_dig_outs;
if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
if (nums >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
break;
spec->slave_dig_outs[i - 1] = dig_nid;
spec->slave_dig_outs[nums - 1] = dig_nid;
}
nums++;
}

if (spec->autocfg.dig_in_pin) {
Expand Down Expand Up @@ -2270,6 +2272,7 @@ static int alc_build_pcms(struct hda_codec *codec)
struct alc_spec *spec = codec->spec;
struct hda_pcm *info = spec->pcm_rec;
const struct hda_pcm_stream *p;
bool have_multi_adcs;
int i;

codec->num_pcms = 1;
Expand Down Expand Up @@ -2348,8 +2351,11 @@ static int alc_build_pcms(struct hda_codec *codec)
/* If the use of more than one ADC is requested for the current
* 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);
/* Additional Analaog capture for index #2 */
if (spec->alt_dac_nid || spec->num_adc_nids > 1) {
if (spec->alt_dac_nid || have_multi_adcs) {
codec->num_pcms = 3;
info = spec->pcm_rec + 2;
info->name = spec->stream_name_analog;
Expand All @@ -2365,7 +2371,7 @@ static int alc_build_pcms(struct hda_codec *codec)
alc_pcm_null_stream;
info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
}
if (spec->num_adc_nids > 1) {
if (have_multi_adcs) {
p = spec->stream_analog_alt_capture;
if (!p)
p = &alc_pcm_analog_alt_capture;
Expand Down Expand Up @@ -2657,7 +2663,6 @@ static int alc_auto_fill_adc_caps(struct hda_codec *codec)
hda_nid_t *adc_nids = spec->private_adc_nids;
hda_nid_t *cap_nids = spec->private_capsrc_nids;
int max_nums = ARRAY_SIZE(spec->private_adc_nids);
bool indep_capsrc = false;
int i, nums = 0;

nid = codec->start_nid;
Expand All @@ -2679,13 +2684,11 @@ static int alc_auto_fill_adc_caps(struct hda_codec *codec)
break;
if (type == AC_WID_AUD_SEL) {
cap_nids[nums] = src;
indep_capsrc = true;
break;
}
n = snd_hda_get_conn_list(codec, src, &list);
if (n > 1) {
cap_nids[nums] = src;
indep_capsrc = true;
break;
} else if (n != 1)
break;
Expand Down
67 changes: 39 additions & 28 deletions sound/pci/hda/patch_sigmatel.c
Original file line number Diff line number Diff line change
Expand Up @@ -3791,9 +3791,10 @@ static int is_dual_headphones(struct hda_codec *codec)
}


static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in)
static int stac92xx_parse_auto_config(struct hda_codec *codec)
{
struct sigmatel_spec *spec = codec->spec;
hda_nid_t dig_out = 0, dig_in = 0;
int hp_swap = 0;
int i, err;

Expand Down Expand Up @@ -3976,6 +3977,22 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
if (spec->multiout.max_channels > 2)
spec->surr_switch = 1;

/* find digital out and in converters */
for (i = codec->start_nid; i < codec->start_nid + codec->num_nodes; i++) {
unsigned int wid_caps = get_wcaps(codec, i);
if (wid_caps & AC_WCAP_DIGITAL) {
switch (get_wcaps_type(wid_caps)) {
case AC_WID_AUD_OUT:
if (!dig_out)
dig_out = i;
break;
case AC_WID_AUD_IN:
if (!dig_in)
dig_in = i;
break;
}
}
}
if (spec->autocfg.dig_outs)
spec->multiout.dig_out_nid = dig_out;
if (dig_in && spec->autocfg.dig_in_pin)
Expand Down Expand Up @@ -5279,7 +5296,7 @@ static int patch_stac925x(struct hda_codec *codec)
spec->capvols = stac925x_capvols;
spec->capsws = stac925x_capsws;

err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
err = stac92xx_parse_auto_config(codec);
if (!err) {
if (spec->board_config < 0) {
printk(KERN_WARNING "hda_codec: No auto-config is "
Expand Down Expand Up @@ -5420,7 +5437,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
spec->pwr_nids = stac92hd73xx_pwr_nids;

err = stac92xx_parse_auto_config(codec, 0x25, 0x27);
err = stac92xx_parse_auto_config(codec);

if (!err) {
if (spec->board_config < 0) {
Expand Down Expand Up @@ -5629,26 +5646,8 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
stac92xx_set_config_regs(codec,
stac92hd83xxx_brd_tbl[spec->board_config]);

switch (codec->vendor_id) {
case 0x111d76d1:
case 0x111d76d9:
case 0x111d76df:
case 0x111d76e5:
case 0x111d7666:
case 0x111d7667:
case 0x111d7668:
case 0x111d7669:
case 0x111d76e3:
case 0x111d7604:
case 0x111d76d4:
case 0x111d7605:
case 0x111d76d5:
case 0x111d76e7:
if (spec->board_config == STAC_92HD83XXX_PWR_REF)
break;
if (spec->board_config != STAC_92HD83XXX_PWR_REF)
spec->num_pwrs = 0;
break;
}

codec->patch_ops = stac92xx_patch_ops;

Expand All @@ -5675,7 +5674,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
}
#endif

err = stac92xx_parse_auto_config(codec, 0x1d, 0);
err = stac92xx_parse_auto_config(codec);
if (!err) {
if (spec->board_config < 0) {
printk(KERN_WARNING "hda_codec: No auto-config is "
Expand Down Expand Up @@ -5996,7 +5995,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)

spec->multiout.dac_nids = spec->dac_nids;

err = stac92xx_parse_auto_config(codec, 0x21, 0);
err = stac92xx_parse_auto_config(codec);
if (!err) {
if (spec->board_config < 0) {
printk(KERN_WARNING "hda_codec: No auto-config is "
Expand Down Expand Up @@ -6105,7 +6104,7 @@ static int patch_stac922x(struct hda_codec *codec)

spec->multiout.dac_nids = spec->dac_nids;

err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
err = stac92xx_parse_auto_config(codec);
if (!err) {
if (spec->board_config < 0) {
printk(KERN_WARNING "hda_codec: No auto-config is "
Expand Down Expand Up @@ -6230,7 +6229,7 @@ static int patch_stac927x(struct hda_codec *codec)
spec->aloopback_shift = 0;
spec->eapd_switch = 1;

err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
err = stac92xx_parse_auto_config(codec);
if (!err) {
if (spec->board_config < 0) {
printk(KERN_WARNING "hda_codec: No auto-config is "
Expand Down Expand Up @@ -6355,7 +6354,7 @@ static int patch_stac9205(struct hda_codec *codec)
break;
}

err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
err = stac92xx_parse_auto_config(codec);
if (!err) {
if (spec->board_config < 0) {
printk(KERN_WARNING "hda_codec: No auto-config is "
Expand Down Expand Up @@ -6460,7 +6459,7 @@ static int patch_stac9872(struct hda_codec *codec)
spec->capvols = stac9872_capvols;
spec->capsws = stac9872_capsws;

err = stac92xx_parse_auto_config(codec, 0x10, 0x12);
err = stac92xx_parse_auto_config(codec);
if (err < 0) {
stac92xx_free(codec);
return -EINVAL;
Expand Down Expand Up @@ -6565,6 +6564,18 @@ static const struct hda_codec_preset snd_hda_preset_sigmatel[] = {
{ .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76e8, .name = "92HD66B1X5", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76e9, .name = "92HD66B2X5", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76ea, .name = "92HD66B3X5", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76eb, .name = "92HD66C1X5", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76ec, .name = "92HD66C2X5", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76ed, .name = "92HD66C3X5", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76ee, .name = "92HD66B1X3", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76ef, .name = "92HD66B2X3", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76f0, .name = "92HD66B3X3", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76f1, .name = "92HD66C1X3", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76f2, .name = "92HD66C2X3", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76f3, .name = "92HD66C3/65", .patch = patch_stac92hd83xxx},
{} /* terminator */
};

Expand Down
5 changes: 0 additions & 5 deletions sound/pci/hda/patch_via.c
Original file line number Diff line number Diff line change
Expand Up @@ -3700,13 +3700,8 @@ static const struct hda_verb vt1812_init_verbs[] = {
static void set_widgets_power_state_vt1812(struct hda_codec *codec)
{
struct via_spec *spec = codec->spec;
int imux_is_smixer =
snd_hda_codec_read(codec, 0x13, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 3;
unsigned int parm;
unsigned int present;
/* MUX10 (1eh) = stereo mixer */
imux_is_smixer =
snd_hda_codec_read(codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5;
/* inputs */
/* PW 5/6/7 (29h/2ah/2bh) */
parm = AC_PWRST_D3;
Expand Down
Loading

0 comments on commit b2409fb

Please sign in to comment.