ALSA: hda - Don't call snd_hda_codec_configure in snd_hda_codec_new()
The codec setup call via snd_hda_codec_configure() isn't necessarily called in snd_hda_codec_new(). For the later added feature, it's better to change the code flow like: - create all codec instances - configure each codec Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
8c8145b873
commit
a1e21c9078
|
@ -885,7 +885,7 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
|
|||
* Returns 0 if successful, or a negative error code.
|
||||
*/
|
||||
int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
|
||||
int do_init, struct hda_codec **codecp)
|
||||
struct hda_codec **codecp)
|
||||
{
|
||||
struct hda_codec *codec;
|
||||
char component[31];
|
||||
|
@ -978,11 +978,6 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr
|
|||
codec->afg ? codec->afg : codec->mfg,
|
||||
AC_PWRST_D0);
|
||||
|
||||
if (do_init) {
|
||||
err = snd_hda_codec_configure(codec);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
}
|
||||
snd_hda_codec_proc_new(codec);
|
||||
|
||||
snd_hda_create_hwdep(codec);
|
||||
|
@ -1036,6 +1031,7 @@ int snd_hda_codec_configure(struct hda_codec *codec)
|
|||
err = init_unsol_queue(codec->bus);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_HDA(snd_hda_codec_configure);
|
||||
|
||||
/**
|
||||
* snd_hda_codec_setup_stream - set up the codec for streaming
|
||||
|
|
|
@ -830,7 +830,8 @@ enum {
|
|||
int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp,
|
||||
struct hda_bus **busp);
|
||||
int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
|
||||
int do_init, struct hda_codec **codecp);
|
||||
struct hda_codec **codecp);
|
||||
int snd_hda_codec_configure(struct hda_codec *codec);
|
||||
|
||||
/*
|
||||
* low level functions
|
||||
|
|
|
@ -1286,8 +1286,7 @@ static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = {
|
|||
[AZX_DRIVER_TERA] = 1,
|
||||
};
|
||||
|
||||
static int __devinit azx_codec_create(struct azx *chip, const char *model,
|
||||
int no_init)
|
||||
static int __devinit azx_codec_create(struct azx *chip, const char *model)
|
||||
{
|
||||
struct hda_bus_template bus_temp;
|
||||
int c, codecs, err;
|
||||
|
@ -1346,7 +1345,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model,
|
|||
for (c = 0; c < max_slots; c++) {
|
||||
if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) {
|
||||
struct hda_codec *codec;
|
||||
err = snd_hda_codec_new(chip->bus, c, !no_init, &codec);
|
||||
err = snd_hda_codec_new(chip->bus, c, &codec);
|
||||
if (err < 0)
|
||||
continue;
|
||||
codecs++;
|
||||
|
@ -1356,7 +1355,16 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model,
|
|||
snd_printk(KERN_ERR SFX "no codecs initialized\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* configure each codec instance */
|
||||
static int __devinit azx_codec_configure(struct azx *chip)
|
||||
{
|
||||
struct hda_codec *codec;
|
||||
list_for_each_entry(codec, &chip->bus->codec_list, list) {
|
||||
snd_hda_codec_configure(codec);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2466,9 +2474,14 @@ static int __devinit azx_probe(struct pci_dev *pci,
|
|||
card->private_data = chip;
|
||||
|
||||
/* create codec instances */
|
||||
err = azx_codec_create(chip, model[dev], probe_only[dev]);
|
||||
err = azx_codec_create(chip, model[dev]);
|
||||
if (err < 0)
|
||||
goto out_free;
|
||||
if (!probe_only[dev]) {
|
||||
err = azx_codec_configure(chip);
|
||||
if (err < 0)
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
/* create PCM streams */
|
||||
err = snd_hda_build_pcms(chip->bus);
|
||||
|
|
|
@ -99,7 +99,6 @@ struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec,
|
|||
int snd_hda_add_vmaster(struct hda_codec *codec, char *name,
|
||||
unsigned int *tlv, const char **slaves);
|
||||
int snd_hda_codec_reset(struct hda_codec *codec);
|
||||
int snd_hda_codec_configure(struct hda_codec *codec);
|
||||
|
||||
/* amp value bits */
|
||||
#define HDA_AMP_MUTE 0x80
|
||||
|
|
Loading…
Reference in New Issue