diff options
Diffstat (limited to 'sound/pci/hda/hda_tegra.c')
| -rw-r--r-- | sound/pci/hda/hda_tegra.c | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index 375e94f4cf52..2e4fd5c56d3b 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c | |||
| @@ -37,7 +37,6 @@ | |||
| 37 | 37 | ||
| 38 | #include "hda_codec.h" | 38 | #include "hda_codec.h" |
| 39 | #include "hda_controller.h" | 39 | #include "hda_controller.h" |
| 40 | #include "hda_priv.h" | ||
| 41 | 40 | ||
| 42 | /* Defines for Nvidia Tegra HDA support */ | 41 | /* Defines for Nvidia Tegra HDA support */ |
| 43 | #define HDA_BAR0 0x8000 | 42 | #define HDA_BAR0 0x8000 |
| @@ -82,7 +81,7 @@ module_param(power_save, bint, 0644); | |||
| 82 | MODULE_PARM_DESC(power_save, | 81 | MODULE_PARM_DESC(power_save, |
| 83 | "Automatic power-saving timeout (in seconds, 0 = disable)."); | 82 | "Automatic power-saving timeout (in seconds, 0 = disable)."); |
| 84 | #else | 83 | #else |
| 85 | static int power_save = 0; | 84 | #define power_save 0 |
| 86 | #endif | 85 | #endif |
| 87 | 86 | ||
| 88 | /* | 87 | /* |
| @@ -250,14 +249,9 @@ static int hda_tegra_suspend(struct device *dev) | |||
| 250 | { | 249 | { |
| 251 | struct snd_card *card = dev_get_drvdata(dev); | 250 | struct snd_card *card = dev_get_drvdata(dev); |
| 252 | struct azx *chip = card->private_data; | 251 | struct azx *chip = card->private_data; |
| 253 | struct azx_pcm *p; | ||
| 254 | struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); | 252 | struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); |
| 255 | 253 | ||
| 256 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 254 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
| 257 | list_for_each_entry(p, &chip->pcm_list, list) | ||
| 258 | snd_pcm_suspend_all(p->pcm); | ||
| 259 | if (chip->initialized) | ||
| 260 | snd_hda_suspend(chip->bus); | ||
| 261 | 255 | ||
| 262 | azx_stop_chip(chip); | 256 | azx_stop_chip(chip); |
| 263 | azx_enter_link_reset(chip); | 257 | azx_enter_link_reset(chip); |
| @@ -278,7 +272,6 @@ static int hda_tegra_resume(struct device *dev) | |||
| 278 | 272 | ||
| 279 | azx_init_chip(chip, 1); | 273 | azx_init_chip(chip, 1); |
| 280 | 274 | ||
| 281 | snd_hda_resume(chip->bus); | ||
| 282 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 275 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
| 283 | 276 | ||
| 284 | return 0; | 277 | return 0; |
| @@ -297,8 +290,6 @@ static int hda_tegra_dev_free(struct snd_device *device) | |||
| 297 | int i; | 290 | int i; |
| 298 | struct azx *chip = device->device_data; | 291 | struct azx *chip = device->device_data; |
| 299 | 292 | ||
| 300 | azx_notifier_unregister(chip); | ||
| 301 | |||
| 302 | if (chip->initialized) { | 293 | if (chip->initialized) { |
| 303 | for (i = 0; i < chip->num_streams; i++) | 294 | for (i = 0; i < chip->num_streams; i++) |
| 304 | azx_stream_stop(chip, &chip->azx_dev[i]); | 295 | azx_stream_stop(chip, &chip->azx_dev[i]); |
| @@ -344,17 +335,6 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev) | |||
| 344 | return 0; | 335 | return 0; |
| 345 | } | 336 | } |
| 346 | 337 | ||
| 347 | /* | ||
| 348 | * The codecs were powered up in snd_hda_codec_new(). | ||
| 349 | * Now all initialization done, so turn them down if possible | ||
| 350 | */ | ||
| 351 | static void power_down_all_codecs(struct azx *chip) | ||
| 352 | { | ||
| 353 | struct hda_codec *codec; | ||
| 354 | list_for_each_entry(codec, &chip->bus->codec_list, list) | ||
| 355 | snd_hda_power_down(codec); | ||
| 356 | } | ||
| 357 | |||
| 358 | static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) | 338 | static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) |
| 359 | { | 339 | { |
| 360 | struct snd_card *card = chip->card; | 340 | struct snd_card *card = chip->card; |
| @@ -503,21 +483,15 @@ static int hda_tegra_probe(struct platform_device *pdev) | |||
| 503 | goto out_free; | 483 | goto out_free; |
| 504 | 484 | ||
| 505 | /* create codec instances */ | 485 | /* create codec instances */ |
| 506 | err = azx_codec_create(chip, NULL, 0, &power_save); | 486 | err = azx_bus_create(chip, NULL); |
| 507 | if (err < 0) | 487 | if (err < 0) |
| 508 | goto out_free; | 488 | goto out_free; |
| 509 | 489 | ||
| 510 | err = azx_codec_configure(chip); | 490 | err = azx_probe_codecs(chip, 0); |
| 511 | if (err < 0) | 491 | if (err < 0) |
| 512 | goto out_free; | 492 | goto out_free; |
| 513 | 493 | ||
| 514 | /* create PCM streams */ | 494 | err = azx_codec_configure(chip); |
| 515 | err = snd_hda_build_pcms(chip->bus); | ||
| 516 | if (err < 0) | ||
| 517 | goto out_free; | ||
| 518 | |||
| 519 | /* create mixer controls */ | ||
| 520 | err = azx_mixer_create(chip); | ||
| 521 | if (err < 0) | 495 | if (err < 0) |
| 522 | goto out_free; | 496 | goto out_free; |
| 523 | 497 | ||
| @@ -526,8 +500,7 @@ static int hda_tegra_probe(struct platform_device *pdev) | |||
| 526 | goto out_free; | 500 | goto out_free; |
| 527 | 501 | ||
| 528 | chip->running = 1; | 502 | chip->running = 1; |
| 529 | power_down_all_codecs(chip); | 503 | snd_hda_set_power_save(chip->bus, power_save * 1000); |
| 530 | azx_notifier_register(chip); | ||
| 531 | 504 | ||
| 532 | return 0; | 505 | return 0; |
| 533 | 506 | ||
| @@ -541,6 +514,18 @@ static int hda_tegra_remove(struct platform_device *pdev) | |||
| 541 | return snd_card_free(dev_get_drvdata(&pdev->dev)); | 514 | return snd_card_free(dev_get_drvdata(&pdev->dev)); |
| 542 | } | 515 | } |
| 543 | 516 | ||
| 517 | static void hda_tegra_shutdown(struct platform_device *pdev) | ||
| 518 | { | ||
| 519 | struct snd_card *card = dev_get_drvdata(&pdev->dev); | ||
| 520 | struct azx *chip; | ||
| 521 | |||
| 522 | if (!card) | ||
| 523 | return; | ||
| 524 | chip = card->private_data; | ||
| 525 | if (chip && chip->running) | ||
| 526 | azx_stop_chip(chip); | ||
| 527 | } | ||
| 528 | |||
| 544 | static struct platform_driver tegra_platform_hda = { | 529 | static struct platform_driver tegra_platform_hda = { |
| 545 | .driver = { | 530 | .driver = { |
| 546 | .name = "tegra-hda", | 531 | .name = "tegra-hda", |
| @@ -549,6 +534,7 @@ static struct platform_driver tegra_platform_hda = { | |||
| 549 | }, | 534 | }, |
| 550 | .probe = hda_tegra_probe, | 535 | .probe = hda_tegra_probe, |
| 551 | .remove = hda_tegra_remove, | 536 | .remove = hda_tegra_remove, |
| 537 | .shutdown = hda_tegra_shutdown, | ||
| 552 | }; | 538 | }; |
| 553 | module_platform_driver(tegra_platform_hda); | 539 | module_platform_driver(tegra_platform_hda); |
| 554 | 540 | ||
