static void hda_tegra_probe_work(struct work_struct *work) { struct hda_tegra *hda = container_of(work, struct hda_tegra, probe_work); struct azx *chip = &hda->chip; struct platform_device *pdev = to_platform_device(hda->dev); int err; pm_runtime_get_sync(hda->dev); err = hda_tegra_first_init(chip, pdev); if (err < 0) goto out_free; /* create codec instances */ err = azx_probe_codecs(chip, 8); if (err < 0) goto out_free; err = azx_codec_configure(chip); if (err < 0) goto out_free; err = snd_card_register(chip->card); if (err < 0) goto out_free; chip->running = 1; snd_hda_set_power_save(&chip->bus, power_save * 1000); out_free: pm_runtime_put(hda->dev); return; /* no error return from async probe */ }
static int hda_tegra_probe(struct platform_device *pdev) { struct snd_card *card; struct azx *chip; struct hda_tegra *hda; int err; const unsigned int driver_flags = AZX_DCAPS_RIRB_DELAY; hda = devm_kzalloc(&pdev->dev, sizeof(*hda), GFP_KERNEL); if (!hda) return -ENOMEM; hda->dev = &pdev->dev; chip = &hda->chip; err = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, THIS_MODULE, 0, &card); if (err < 0) { dev_err(&pdev->dev, "Error creating card!\n"); return err; } err = hda_tegra_create(card, driver_flags, &hda_tegra_ops, hda); if (err < 0) goto out_free; card->private_data = chip; dev_set_drvdata(&pdev->dev, card); err = hda_tegra_first_init(chip, pdev); if (err < 0) goto out_free; /* create codec instances */ err = azx_codec_create(chip, NULL, 0, &power_save); if (err < 0) goto out_free; err = azx_codec_configure(chip); if (err < 0) goto out_free; /* create PCM streams */ err = snd_hda_build_pcms(chip->bus); if (err < 0) goto out_free; /* create mixer controls */ err = azx_mixer_create(chip); if (err < 0) goto out_free; err = snd_card_register(chip->card); if (err < 0) goto out_free; chip->running = 1; power_down_all_codecs(chip); hda_tegra_notifier_register(chip); return 0; out_free: snd_card_free(card); return err; }