Commit 79a8f1b1 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: hda - possible read past array alc88[02]_parse_auto_config()
  sound: rawmidi: fix MIDI device O_APPEND error handling
  sound: rawmidi: fix checking of O_APPEND when opening MIDI device
  sound: rawmidi: fix double init when opening MIDI device with O_APPEND
  ALSA: hda - Avoid quirk for HP dc5750
  ALSA: hda - Tweak OLPC XO-1.5 microphone bias
  ALSA: hda: Use model=auto quirk for Sony VAIO VGN-FW170J using ALC262
parents 55871bdd cc2cef50
...@@ -248,7 +248,8 @@ static int assign_substream(struct snd_rawmidi *rmidi, int subdevice, ...@@ -248,7 +248,8 @@ static int assign_substream(struct snd_rawmidi *rmidi, int subdevice,
list_for_each_entry(substream, &s->substreams, list) { list_for_each_entry(substream, &s->substreams, list) {
if (substream->opened) { if (substream->opened) {
if (stream == SNDRV_RAWMIDI_STREAM_INPUT || if (stream == SNDRV_RAWMIDI_STREAM_INPUT ||
!(mode & SNDRV_RAWMIDI_LFLG_APPEND)) !(mode & SNDRV_RAWMIDI_LFLG_APPEND) ||
!substream->append)
continue; continue;
} }
if (subdevice < 0 || subdevice == substream->number) { if (subdevice < 0 || subdevice == substream->number) {
...@@ -266,17 +267,21 @@ static int open_substream(struct snd_rawmidi *rmidi, ...@@ -266,17 +267,21 @@ static int open_substream(struct snd_rawmidi *rmidi,
{ {
int err; int err;
if (substream->use_count == 0) {
err = snd_rawmidi_runtime_create(substream); err = snd_rawmidi_runtime_create(substream);
if (err < 0) if (err < 0)
return err; return err;
err = substream->ops->open(substream); err = substream->ops->open(substream);
if (err < 0) if (err < 0) {
snd_rawmidi_runtime_free(substream);
return err; return err;
}
substream->opened = 1; substream->opened = 1;
if (substream->use_count++ == 0)
substream->active_sensing = 0; substream->active_sensing = 0;
if (mode & SNDRV_RAWMIDI_LFLG_APPEND) if (mode & SNDRV_RAWMIDI_LFLG_APPEND)
substream->append = 1; substream->append = 1;
}
substream->use_count++;
rmidi->streams[substream->stream].substream_opened++; rmidi->streams[substream->stream].substream_opened++;
return 0; return 0;
} }
...@@ -297,27 +302,27 @@ static int rawmidi_open_priv(struct snd_rawmidi *rmidi, int subdevice, int mode, ...@@ -297,27 +302,27 @@ static int rawmidi_open_priv(struct snd_rawmidi *rmidi, int subdevice, int mode,
SNDRV_RAWMIDI_STREAM_INPUT, SNDRV_RAWMIDI_STREAM_INPUT,
mode, &sinput); mode, &sinput);
if (err < 0) if (err < 0)
goto __error; return err;
} }
if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) { if (mode & SNDRV_RAWMIDI_LFLG_OUTPUT) {
err = assign_substream(rmidi, subdevice, err = assign_substream(rmidi, subdevice,
SNDRV_RAWMIDI_STREAM_OUTPUT, SNDRV_RAWMIDI_STREAM_OUTPUT,
mode, &soutput); mode, &soutput);
if (err < 0) if (err < 0)
goto __error; return err;
} }
if (sinput) { if (sinput) {
err = open_substream(rmidi, sinput, mode); err = open_substream(rmidi, sinput, mode);
if (err < 0) if (err < 0)
goto __error; return err;
} }
if (soutput) { if (soutput) {
err = open_substream(rmidi, soutput, mode); err = open_substream(rmidi, soutput, mode);
if (err < 0) { if (err < 0) {
if (sinput) if (sinput)
close_substream(rmidi, sinput, 0); close_substream(rmidi, sinput, 0);
goto __error; return err;
} }
} }
...@@ -325,13 +330,6 @@ static int rawmidi_open_priv(struct snd_rawmidi *rmidi, int subdevice, int mode, ...@@ -325,13 +330,6 @@ static int rawmidi_open_priv(struct snd_rawmidi *rmidi, int subdevice, int mode,
rfile->input = sinput; rfile->input = sinput;
rfile->output = soutput; rfile->output = soutput;
return 0; return 0;
__error:
if (sinput && sinput->runtime)
snd_rawmidi_runtime_free(sinput);
if (soutput && soutput->runtime)
snd_rawmidi_runtime_free(soutput);
return err;
} }
/* called from sound/core/seq/seq_midi.c */ /* called from sound/core/seq/seq_midi.c */
......
...@@ -110,6 +110,7 @@ struct conexant_spec { ...@@ -110,6 +110,7 @@ struct conexant_spec {
unsigned int dell_automute; unsigned int dell_automute;
unsigned int port_d_mode; unsigned int port_d_mode;
unsigned char ext_mic_bias;
}; };
static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo, static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo,
...@@ -1927,6 +1928,11 @@ static hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 }; ...@@ -1927,6 +1928,11 @@ static hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 };
static hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 }; static hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 };
#define CXT5066_SPDIF_OUT 0x21 #define CXT5066_SPDIF_OUT 0x21
/* OLPC's microphone port is DC coupled for use with external sensors,
* therefore we use a 50% mic bias in order to center the input signal with
* the DC input range of the codec. */
#define CXT5066_OLPC_EXT_MIC_BIAS PIN_VREF50
static struct hda_channel_mode cxt5066_modes[1] = { static struct hda_channel_mode cxt5066_modes[1] = {
{ 2, NULL }, { 2, NULL },
}; };
...@@ -1980,9 +1986,10 @@ static int cxt5066_hp_master_sw_put(struct snd_kcontrol *kcontrol, ...@@ -1980,9 +1986,10 @@ static int cxt5066_hp_master_sw_put(struct snd_kcontrol *kcontrol,
/* toggle input of built-in and mic jack appropriately */ /* toggle input of built-in and mic jack appropriately */
static void cxt5066_automic(struct hda_codec *codec) static void cxt5066_automic(struct hda_codec *codec)
{ {
static struct hda_verb ext_mic_present[] = { struct conexant_spec *spec = codec->spec;
struct hda_verb ext_mic_present[] = {
/* enable external mic, port B */ /* enable external mic, port B */
{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, spec->ext_mic_bias},
/* switch to external mic input */ /* switch to external mic input */
{0x17, AC_VERB_SET_CONNECT_SEL, 0}, {0x17, AC_VERB_SET_CONNECT_SEL, 0},
...@@ -2235,7 +2242,7 @@ static struct hda_verb cxt5066_init_verbs_olpc[] = { ...@@ -2235,7 +2242,7 @@ static struct hda_verb cxt5066_init_verbs_olpc[] = {
{0x19, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC1 */ {0x19, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC1 */
/* Port B: external microphone */ /* Port B: external microphone */
{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, CXT5066_OLPC_EXT_MIC_BIAS},
/* Port C: internal microphone */ /* Port C: internal microphone */
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
...@@ -2353,6 +2360,7 @@ static int patch_cxt5066(struct hda_codec *codec) ...@@ -2353,6 +2360,7 @@ static int patch_cxt5066(struct hda_codec *codec)
spec->input_mux = &cxt5066_capture_source; spec->input_mux = &cxt5066_capture_source;
spec->port_d_mode = PIN_HP; spec->port_d_mode = PIN_HP;
spec->ext_mic_bias = PIN_VREF80;
spec->num_init_verbs = 1; spec->num_init_verbs = 1;
spec->init_verbs[0] = cxt5066_init_verbs; spec->init_verbs[0] = cxt5066_init_verbs;
...@@ -2384,6 +2392,7 @@ static int patch_cxt5066(struct hda_codec *codec) ...@@ -2384,6 +2392,7 @@ static int patch_cxt5066(struct hda_codec *codec)
spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc;
spec->mixers[spec->num_mixers++] = cxt5066_mixers; spec->mixers[spec->num_mixers++] = cxt5066_mixers;
spec->port_d_mode = 0; spec->port_d_mode = 0;
spec->ext_mic_bias = CXT5066_OLPC_EXT_MIC_BIAS;
/* no S/PDIF out */ /* no S/PDIF out */
spec->multiout.dig_out_nid = 0; spec->multiout.dig_out_nid = 0;
......
...@@ -4684,9 +4684,9 @@ static int alc880_parse_auto_config(struct hda_codec *codec) ...@@ -4684,9 +4684,9 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
spec->multiout.dig_out_nid = dig_nid; spec->multiout.dig_out_nid = dig_nid;
else { else {
spec->multiout.slave_dig_outs = spec->slave_dig_outs; spec->multiout.slave_dig_outs = spec->slave_dig_outs;
spec->slave_dig_outs[i - 1] = dig_nid; if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
break; break;
spec->slave_dig_outs[i - 1] = dig_nid;
} }
} }
if (spec->autocfg.dig_in_pin) if (spec->autocfg.dig_in_pin)
...@@ -6249,7 +6249,7 @@ static struct snd_pci_quirk alc260_cfg_tbl[] = { ...@@ -6249,7 +6249,7 @@ static struct snd_pci_quirk alc260_cfg_tbl[] = {
SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
...@@ -9813,9 +9813,9 @@ static int alc882_parse_auto_config(struct hda_codec *codec) ...@@ -9813,9 +9813,9 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
spec->multiout.dig_out_nid = dig_nid; spec->multiout.dig_out_nid = dig_nid;
else { else {
spec->multiout.slave_dig_outs = spec->slave_dig_outs; spec->multiout.slave_dig_outs = spec->slave_dig_outs;
spec->slave_dig_outs[i - 1] = dig_nid; if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
break; break;
spec->slave_dig_outs[i - 1] = dig_nid;
} }
} }
if (spec->autocfg.dig_in_pin) if (spec->autocfg.dig_in_pin)
...@@ -11460,6 +11460,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { ...@@ -11460,6 +11460,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
ALC262_SONY_ASSAMD), ALC262_SONY_ASSAMD),
SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment