Skip to content

Commit

Permalink
Merge branch 'for-linus' into for-next
Browse files Browse the repository at this point in the history
Back-merged for refactoring beep stuff.
  • Loading branch information
tiwai committed Mar 18, 2013
2 parents 0959f22 + a86b1a2 commit cf30f46
Show file tree
Hide file tree
Showing 21 changed files with 166 additions and 60 deletions.
2 changes: 1 addition & 1 deletion Documentation/sound/alsa/ALSA-Configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
models depending on the codec chip. The list of available models
is found in HD-Audio-Models.txt

The model name "genric" is treated as a special case. When this
The model name "generic" is treated as a special case. When this
model is given, the driver uses the generic codec parser without
"codec-patch". It's sometimes good for testing and debugging.

Expand Down
2 changes: 1 addition & 1 deletion Documentation/sound/alsa/seq_oss.html
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ <H4>
<H4>
7.2.4 Close Callback</H4>
The <TT>close</TT> callback is called when this device is closed by the
applicaion. If any private data was allocated in open callback, it must
application. If any private data was allocated in open callback, it must
be released in the close callback. The deletion of ALSA port should be
done here, too. This callback must not be NULL.
<H4>
Expand Down
14 changes: 12 additions & 2 deletions sound/core/seq/oss/seq_oss_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,12 @@ local_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev
static int
note_on_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, struct snd_seq_event *ev)
{
struct seq_oss_synthinfo *info = &dp->synths[dev];
struct seq_oss_synthinfo *info;

if (!snd_seq_oss_synth_is_valid(dp, dev))
return -ENXIO;

info = &dp->synths[dev];
switch (info->arg.event_passing) {
case SNDRV_SEQ_OSS_PROCESS_EVENTS:
if (! info->ch || ch < 0 || ch >= info->nr_voices) {
Expand Down Expand Up @@ -340,7 +345,12 @@ note_on_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, st
static int
note_off_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, struct snd_seq_event *ev)
{
struct seq_oss_synthinfo *info = &dp->synths[dev];
struct seq_oss_synthinfo *info;

if (!snd_seq_oss_synth_is_valid(dp, dev))
return -ENXIO;

info = &dp->synths[dev];
switch (info->arg.event_passing) {
case SNDRV_SEQ_OSS_PROCESS_EVENTS:
if (! info->ch || ch < 0 || ch >= info->nr_voices) {
Expand Down
8 changes: 4 additions & 4 deletions sound/core/seq/seq_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,10 @@ int snd_seq_timer_open(struct snd_seq_queue *q)
tid.device = SNDRV_TIMER_GLOBAL_SYSTEM;
err = snd_timer_open(&t, str, &tid, q->queue);
}
if (err < 0) {
snd_printk(KERN_ERR "seq fatal error: cannot create timer (%i)\n", err);
return err;
}
}
if (err < 0) {
snd_printk(KERN_ERR "seq fatal error: cannot create timer (%i)\n", err);
return err;
}
t->callback = snd_seq_timer_interrupt;
t->callback_data = q;
Expand Down
5 changes: 4 additions & 1 deletion sound/core/vmaster.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ static int slave_put(struct snd_kcontrol *kcontrol,
}
if (!changed)
return 0;
return slave_put_val(slave, ucontrol);
err = slave_put_val(slave, ucontrol);
if (err < 0)
return err;
return 1;
}

static int slave_tlv_cmd(struct snd_kcontrol *kcontrol,
Expand Down
6 changes: 6 additions & 0 deletions sound/oss/sequencer.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,9 @@ static void seq_chn_common_event(unsigned char *event_rec)
case MIDI_PGM_CHANGE:
if (seq_mode == SEQ_2)
{
if (chn > 15)
break;

synth_devs[dev]->chn_info[chn].pgm_num = p1;
if ((int) dev >= num_synths)
synth_devs[dev]->set_instr(dev, chn, p1);
Expand Down Expand Up @@ -596,6 +599,9 @@ static void seq_chn_common_event(unsigned char *event_rec)
case MIDI_PITCH_BEND:
if (seq_mode == SEQ_2)
{
if (chn > 15)
break;

synth_devs[dev]->chn_info[chn].bender_value = w14;

if ((int) dev < num_synths)
Expand Down
3 changes: 2 additions & 1 deletion sound/pci/asihpi/asihpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2549,14 +2549,15 @@ static int snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi,

static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
{
struct snd_card *card = asihpi->card;
struct snd_card *card;
unsigned int idx = 0;
unsigned int subindex = 0;
int err;
struct hpi_control hpi_ctl, prev_ctl;

if (snd_BUG_ON(!asihpi))
return -EINVAL;
card = asihpi->card;
strcpy(card->mixername, "Asihpi Mixer");

err =
Expand Down
35 changes: 23 additions & 12 deletions sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ static unsigned int get_num_conns(struct hda_codec *codec, hda_nid_t nid)

int snd_hda_get_num_raw_conns(struct hda_codec *codec, hda_nid_t nid)
{
return get_num_conns(codec, nid) & AC_CLIST_LENGTH;
return snd_hda_get_raw_connections(codec, nid, NULL, 0);
}

/**
Expand All @@ -517,9 +517,6 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
hda_nid_t prev_nid;
int null_count = 0;

if (snd_BUG_ON(!conn_list || max_conns <= 0))
return -EINVAL;

parm = get_num_conns(codec, nid);
if (!parm)
return 0;
Expand All @@ -545,7 +542,8 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
AC_VERB_GET_CONNECT_LIST, 0);
if (parm == -1 && codec->bus->rirb_error)
return -EIO;
conn_list[0] = parm & mask;
if (conn_list)
conn_list[0] = parm & mask;
return 1;
}

Expand Down Expand Up @@ -580,14 +578,20 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
continue;
}
for (n = prev_nid + 1; n <= val; n++) {
if (conn_list) {
if (conns >= max_conns)
return -ENOSPC;
conn_list[conns] = n;
}
conns++;
}
} else {
if (conn_list) {
if (conns >= max_conns)
return -ENOSPC;
conn_list[conns++] = n;
conn_list[conns] = val;
}
} else {
if (conns >= max_conns)
return -ENOSPC;
conn_list[conns++] = val;
conns++;
}
prev_nid = val;
}
Expand Down Expand Up @@ -3331,6 +3335,8 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
return -EBUSY;
}
spdif = snd_array_new(&codec->spdif_out);
if (!spdif)
return -ENOMEM;
for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) {
kctl = snd_ctl_new1(dig_mix, codec);
if (!kctl)
Expand Down Expand Up @@ -3428,11 +3434,16 @@ static struct snd_kcontrol_new spdif_share_sw = {
int snd_hda_create_spdif_share_sw(struct hda_codec *codec,
struct hda_multi_out *mout)
{
struct snd_kcontrol *kctl;

if (!mout->dig_out_nid)
return 0;

kctl = snd_ctl_new1(&spdif_share_sw, mout);
if (!kctl)
return -ENOMEM;
/* ATTENTION: here mout is passed as private_data, instead of codec */
return snd_hda_ctl_add(codec, mout->dig_out_nid,
snd_ctl_new1(&spdif_share_sw, mout));
return snd_hda_ctl_add(codec, mout->dig_out_nid, kctl);
}
EXPORT_SYMBOL_HDA(snd_hda_create_spdif_share_sw);

Expand Down
36 changes: 21 additions & 15 deletions sound/pci/hda/patch_ca0132.c
Original file line number Diff line number Diff line change
Expand Up @@ -2298,6 +2298,11 @@ static int dspxfr_one_seg(struct hda_codec *codec,
hda_frame_size_words = ((sample_rate_div == 0) ? 0 :
(num_chans * sample_rate_mul / sample_rate_div));

if (hda_frame_size_words == 0) {
snd_printdd(KERN_ERR "frmsz zero\n");
return -EINVAL;
}

buffer_size_words = min(buffer_size_words,
(unsigned int)(UC_RANGE(chip_addx, 1) ?
65536 : 32768));
Expand All @@ -2308,8 +2313,7 @@ static int dspxfr_one_seg(struct hda_codec *codec,
chip_addx, hda_frame_size_words, num_chans,
sample_rate_mul, sample_rate_div, buffer_size_words);

if ((buffer_addx == NULL) || (hda_frame_size_words == 0) ||
(buffer_size_words < hda_frame_size_words)) {
if (buffer_size_words < hda_frame_size_words) {
snd_printdd(KERN_ERR "dspxfr_one_seg:failed\n");
return -EINVAL;
}
Expand Down Expand Up @@ -3235,7 +3239,7 @@ static int ca0132_set_vipsource(struct hda_codec *codec, int val)
struct ca0132_spec *spec = codec->spec;
unsigned int tmp;

if (!dspload_is_loaded(codec))
if (spec->dsp_state != DSP_DOWNLOADED)
return 0;

/* if CrystalVoice if off, vipsource should be 0 */
Expand Down Expand Up @@ -4263,11 +4267,12 @@ static void ca0132_refresh_widget_caps(struct hda_codec *codec)
*/
static void ca0132_setup_defaults(struct hda_codec *codec)
{
struct ca0132_spec *spec = codec->spec;
unsigned int tmp;
int num_fx;
int idx, i;

if (!dspload_is_loaded(codec))
if (spec->dsp_state != DSP_DOWNLOADED)
return;

/* out, in effects + voicefx */
Expand Down Expand Up @@ -4347,12 +4352,16 @@ static bool ca0132_download_dsp_images(struct hda_codec *codec)
return false;

dsp_os_image = (struct dsp_image_seg *)(fw_entry->data);
dspload_image(codec, dsp_os_image, 0, 0, true, 0);
if (dspload_image(codec, dsp_os_image, 0, 0, true, 0)) {
pr_err("ca0132 dspload_image failed.\n");
goto exit_download;
}

dsp_loaded = dspload_wait_loaded(codec);

exit_download:
release_firmware(fw_entry);


return dsp_loaded;
}

Expand All @@ -4363,16 +4372,13 @@ static void ca0132_download_dsp(struct hda_codec *codec)
#ifndef CONFIG_SND_HDA_CODEC_CA0132_DSP
return; /* NOP */
#endif
spec->dsp_state = DSP_DOWNLOAD_INIT;

if (spec->dsp_state == DSP_DOWNLOAD_INIT) {
chipio_enable_clocks(codec);
spec->dsp_state = DSP_DOWNLOADING;
if (!ca0132_download_dsp_images(codec))
spec->dsp_state = DSP_DOWNLOAD_FAILED;
else
spec->dsp_state = DSP_DOWNLOADED;
}
chipio_enable_clocks(codec);
spec->dsp_state = DSP_DOWNLOADING;
if (!ca0132_download_dsp_images(codec))
spec->dsp_state = DSP_DOWNLOAD_FAILED;
else
spec->dsp_state = DSP_DOWNLOADED;

if (spec->dsp_state == DSP_DOWNLOADED)
ca0132_set_dsp_msr(codec, true);
Expand Down
4 changes: 4 additions & 0 deletions sound/pci/hda/patch_cirrus.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,8 @@ static int patch_cs420x(struct hda_codec *codec)
if (!spec)
return -ENOMEM;

spec->gen.automute_hook = cs_automute;

snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl,
cs420x_fixups);
snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Expand Down Expand Up @@ -893,6 +895,8 @@ static int patch_cs4210(struct hda_codec *codec)
if (!spec)
return -ENOMEM;

spec->gen.automute_hook = cs_automute;

snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl,
cs421x_fixups);
snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Expand Down
16 changes: 11 additions & 5 deletions sound/pci/hda/patch_conexant.c
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ static int patch_cxt5045(struct hda_codec *codec)
}

if (spec->beep_amp)
snd_hda_attach_beep_device(codec, spec->beep_amp);
snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp));

return 0;
}
Expand Down Expand Up @@ -1921,7 +1921,7 @@ static int patch_cxt5051(struct hda_codec *codec)
}

if (spec->beep_amp)
snd_hda_attach_beep_device(codec, spec->beep_amp);
snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp));

return 0;
}
Expand Down Expand Up @@ -3099,7 +3099,7 @@ static int patch_cxt5066(struct hda_codec *codec)
}

if (spec->beep_amp)
snd_hda_attach_beep_device(codec, spec->beep_amp);
snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp));

return 0;
}
Expand Down Expand Up @@ -3191,11 +3191,17 @@ static int cx_auto_build_controls(struct hda_codec *codec)
return 0;
}

static void cx_auto_free(struct hda_codec *codec)
{
snd_hda_detach_beep_device(codec);
snd_hda_gen_free(codec);
}

static const struct hda_codec_ops cx_auto_patch_ops = {
.build_controls = cx_auto_build_controls,
.build_pcms = snd_hda_gen_build_pcms,
.init = snd_hda_gen_init,
.free = snd_hda_gen_free,
.free = cx_auto_free,
.unsol_event = snd_hda_jack_unsol_event,
#ifdef CONFIG_PM
.check_power_status = snd_hda_gen_check_power_status,
Expand Down Expand Up @@ -3390,7 +3396,7 @@ static int patch_conexant_auto(struct hda_codec *codec)

codec->patch_ops = cx_auto_patch_ops;
if (spec->beep_amp)
snd_hda_attach_beep_device(codec, spec->beep_amp);
snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp));

/* Some laptops with Conexant chips show stalls in S3 resume,
* which falls into the single-cmd mode.
Expand Down
2 changes: 2 additions & 0 deletions sound/pci/hda/patch_realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -3182,6 +3182,7 @@ static int patch_alc269(struct hda_codec *codec)
case 0x10ec0290:
spec->codec_variant = ALC269_TYPE_ALC280;
break;
case 0x10ec0233:
case 0x10ec0282:
case 0x10ec0283:
spec->codec_variant = ALC269_TYPE_ALC282;
Expand Down Expand Up @@ -3881,6 +3882,7 @@ static int patch_alc680(struct hda_codec *codec)
*/
static const struct hda_codec_preset snd_hda_preset_realtek[] = {
{ .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 },
{ .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 },
{ .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
{ .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
{ .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
Expand Down
Loading

0 comments on commit cf30f46

Please sign in to comment.