summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-02-19 20:12:22 +0300
committerTakashi Iwai <tiwai@suse.de>2015-02-19 23:41:40 +0300
commit96d2bd6e3cdf57926f80605d6e28051bb6b24eb3 (patch)
treedd8378bc79a3bda6ef23786970789deb46801564 /sound
parentb8f28d53641f13902790904ab15028ff8ecd0882 (diff)
downloadlinux-96d2bd6e3cdf57926f80605d6e28051bb6b24eb3.tar.xz
ALSA: hda - Split azx_codec_create() to two phases
azx_create_codec() function does actually two things: create a bus and probe codecs. For the future work, split this to two logical functions, azx_bus_create() and azx_probe_codecs(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_controller.c40
-rw-r--r--sound/pci/hda/hda_controller.h5
-rw-r--r--sound/pci/hda/hda_intel.c8
-rw-r--r--sound/pci/hda/hda_tegra.c6
4 files changed, 36 insertions, 23 deletions
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 6fab39133051..2a674525e56f 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -1829,13 +1829,11 @@ static struct hda_bus_ops bus_ops = {
#endif
};
-/* Codec initialization */
-int azx_codec_create(struct azx *chip, const char *model,
- unsigned int max_slots,
- int *power_save_to)
+/* HD-audio bus initialization */
+int azx_bus_create(struct azx *chip, const char *model, int *power_save_to)
{
struct hda_bus *bus;
- int c, codecs, err;
+ int err;
err = snd_hda_bus_new(chip->card, &bus);
if (err < 0)
@@ -1855,6 +1853,26 @@ int azx_codec_create(struct azx *chip, const char *model,
bus->needs_damn_long_delay = 1;
}
+ /* AMD chipsets often cause the communication stalls upon certain
+ * sequence like the pin-detection. It seems that forcing the synced
+ * access works around the stall. Grrr...
+ */
+ if (chip->driver_caps & AZX_DCAPS_SYNC_WRITE) {
+ dev_dbg(chip->card->dev, "Enable sync_write for stable communication\n");
+ bus->sync_write = 1;
+ bus->allow_bus_reset = 1;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(azx_bus_create);
+
+/* Probe codecs */
+int azx_probe_codecs(struct azx *chip, unsigned int max_slots)
+{
+ struct hda_bus *bus = chip->bus;
+ int c, codecs, err;
+
codecs = 0;
if (!max_slots)
max_slots = AZX_DEFAULT_CODECS;
@@ -1882,16 +1900,6 @@ int azx_codec_create(struct azx *chip, const char *model,
}
}
- /* AMD chipsets often cause the communication stalls upon certain
- * sequence like the pin-detection. It seems that forcing the synced
- * access works around the stall. Grrr...
- */
- if (chip->driver_caps & AZX_DCAPS_SYNC_WRITE) {
- dev_dbg(chip->card->dev, "Enable sync_write for stable communication\n");
- bus->sync_write = 1;
- bus->allow_bus_reset = 1;
- }
-
/* Then create codec instances */
for (c = 0; c < max_slots; c++) {
if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) {
@@ -1910,7 +1918,7 @@ int azx_codec_create(struct azx *chip, const char *model,
}
return 0;
}
-EXPORT_SYMBOL_GPL(azx_codec_create);
+EXPORT_SYMBOL_GPL(azx_probe_codecs);
/* configure each codec instance */
int azx_codec_configure(struct azx *chip)
diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h
index 79808e1a79ac..0d09aa6b49ac 100644
--- a/sound/pci/hda/hda_controller.h
+++ b/sound/pci/hda/hda_controller.h
@@ -432,9 +432,8 @@ void azx_enter_link_reset(struct azx *chip);
irqreturn_t azx_interrupt(int irq, void *dev_id);
/* Codec interface */
-int azx_codec_create(struct azx *chip, const char *model,
- unsigned int max_slots,
- int *power_save_to);
+int azx_bus_create(struct azx *chip, const char *model, int *power_save_to);
+int azx_probe_codecs(struct azx *chip, unsigned int max_slots);
int azx_codec_configure(struct azx *chip);
int azx_init_stream(struct azx *chip);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index b0a05691abe7..5e00cc4a722f 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1893,12 +1893,14 @@ static int azx_probe_continue(struct azx *chip)
#endif
/* create codec instances */
- err = azx_codec_create(chip, model[dev],
- azx_max_codecs[chip->driver_type],
- power_save_addr);
+ err = azx_bus_create(chip, model[dev], power_save_addr);
+ if (err < 0)
+ goto out_free;
+ err = azx_probe_codecs(chip, azx_max_codecs[chip->driver_type]);
if (err < 0)
goto out_free;
+
#ifdef CONFIG_SND_HDA_PATCH_LOADER
if (chip->fw) {
err = snd_hda_load_patch(chip->bus, chip->fw->size,
diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c
index f305c2a99206..1bd7a9e04046 100644
--- a/sound/pci/hda/hda_tegra.c
+++ b/sound/pci/hda/hda_tegra.c
@@ -502,7 +502,11 @@ static int hda_tegra_probe(struct platform_device *pdev)
goto out_free;
/* create codec instances */
- err = azx_codec_create(chip, NULL, 0, &power_save);
+ err = azx_bus_create(chip, NULL, &power_save);
+ if (err < 0)
+ goto out_free;
+
+ err = azx_probe_codecs(chip, 0);
if (err < 0)
goto out_free;