/* * reboot notifier for hang-up problem at power-down */ static int hda_tegra_halt(struct notifier_block *nb, unsigned long event, void *buf) { struct azx *chip = container_of(nb, struct azx, reboot_notifier); snd_hda_bus_reboot_notify(chip->bus); azx_stop_chip(chip); return NOTIFY_OK; }
static void hda_tegra_shutdown(struct platform_device *pdev) { struct snd_card *card = dev_get_drvdata(&pdev->dev); struct azx *chip; if (!card) return; chip = card->private_data; if (chip && chip->running) azx_stop_chip(chip); }
/* * power management */ static int hda_tegra_suspend(struct device *dev) { struct snd_card *card = dev_get_drvdata(dev); struct azx *chip = card->private_data; struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); azx_stop_chip(chip); azx_enter_link_reset(chip); hda_tegra_disable_clocks(hda); return 0; }
static int __maybe_unused hda_tegra_runtime_suspend(struct device *dev) { struct snd_card *card = dev_get_drvdata(dev); struct azx *chip = card->private_data; struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); struct hdac_bus *bus = azx_bus(chip); if (chip && chip->running) { azx_stop_chip(chip); synchronize_irq(bus->irq); azx_enter_link_reset(chip); } hda_tegra_disable_clocks(hda); return 0; }
/* * destructor */ static int hda_tegra_dev_free(struct snd_device *device) { struct azx *chip = device->device_data; struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); cancel_work_sync(&hda->probe_work); if (azx_bus(chip)->chip_init) { azx_stop_all_streams(chip); azx_stop_chip(chip); } azx_free_stream_pages(chip); azx_free_streams(chip); snd_hdac_bus_exit(azx_bus(chip)); return 0; }
/* * destructor */ static int hda_tegra_dev_free(struct snd_device *device) { int i; struct azx *chip = device->device_data; hda_tegra_notifier_unregister(chip); if (chip->initialized) { for (i = 0; i < chip->num_streams; i++) azx_stream_stop(chip, &chip->azx_dev[i]); azx_stop_chip(chip); } azx_free_stream_pages(chip); return 0; }
/* * power management */ static int hda_tegra_suspend(struct device *dev) { struct snd_card *card = dev_get_drvdata(dev); struct azx *chip = card->private_data; struct azx_pcm *p; struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); list_for_each_entry(p, &chip->pcm_list, list) snd_pcm_suspend_all(p->pcm); if (chip->initialized) snd_hda_suspend(chip->bus); azx_stop_chip(chip); azx_enter_link_reset(chip); hda_tegra_disable_clocks(hda); return 0; }