aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorDylan Reid <dgreid@chromium.org>2014-02-28 18:41:15 -0500
committerTakashi Iwai <tiwai@suse.de>2014-03-01 05:21:04 -0500
commit8928756dbd956b474fc92ce0556fa3c35673c97c (patch)
tree8656f204eebc8c16088577d5b3b08e780f54a7a9 /sound/pci/hda
parent9cdc0115e444108cfa7339386eee46ed2c84a2eb (diff)
ALSA: hda - Use device pointer from the card instead of pci
This removes calls to get the device via PCI from other parts of the code that will be able to be re-used by the platform driver. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/hda_intel.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 9fcd1d128464..7630622e7f0f 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -364,7 +364,7 @@ static int azx_alloc_cmd_io(struct azx *chip)
364 364
365 /* single page (at least 4096 bytes) must suffice for both ringbuffes */ 365 /* single page (at least 4096 bytes) must suffice for both ringbuffes */
366 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, 366 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
367 snd_dma_pci_data(chip->pci), 367 chip->card->dev,
368 PAGE_SIZE, &chip->rb); 368 PAGE_SIZE, &chip->rb);
369 if (err < 0) { 369 if (err < 0) {
370 dev_err(chip->card->dev, "cannot allocate CORB/RIRB\n"); 370 dev_err(chip->card->dev, "cannot allocate CORB/RIRB\n");
@@ -1032,7 +1032,7 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id)
1032 1032
1033#ifdef CONFIG_PM_RUNTIME 1033#ifdef CONFIG_PM_RUNTIME
1034 if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME) 1034 if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
1035 if (chip->pci->dev.power.runtime_status != RPM_ACTIVE) 1035 if (chip->card->dev->power.runtime_status != RPM_ACTIVE)
1036 return IRQ_NONE; 1036 return IRQ_NONE;
1037#endif 1037#endif
1038 1038
@@ -2290,7 +2290,7 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,
2290 if (size > MAX_PREALLOC_SIZE) 2290 if (size > MAX_PREALLOC_SIZE)
2291 size = MAX_PREALLOC_SIZE; 2291 size = MAX_PREALLOC_SIZE;
2292 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, 2292 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
2293 snd_dma_pci_data(chip->pci), 2293 chip->card->dev,
2294 size, MAX_PREALLOC_SIZE); 2294 size, MAX_PREALLOC_SIZE);
2295 /* link to codec */ 2295 /* link to codec */
2296 pcm->dev = &codec->dev; 2296 pcm->dev = &codec->dev;
@@ -2405,7 +2405,7 @@ static int azx_load_dsp_prepare(struct hda_bus *bus, unsigned int format,
2405 spin_unlock_irq(&chip->reg_lock); 2405 spin_unlock_irq(&chip->reg_lock);
2406 2406
2407 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, 2407 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG,
2408 snd_dma_pci_data(chip->pci), 2408 chip->card->dev,
2409 byte_size, bufp); 2409 byte_size, bufp);
2410 if (err < 0) 2410 if (err < 0)
2411 goto err_alloc; 2411 goto err_alloc;
@@ -2498,9 +2498,9 @@ static void azx_power_notify(struct hda_bus *bus, bool power_up)
2498 return; 2498 return;
2499 2499
2500 if (power_up) 2500 if (power_up)
2501 pm_runtime_get_sync(&chip->pci->dev); 2501 pm_runtime_get_sync(chip->card->dev);
2502 else 2502 else
2503 pm_runtime_put_sync(&chip->pci->dev); 2503 pm_runtime_put_sync(chip->card->dev);
2504} 2504}
2505 2505
2506static DEFINE_MUTEX(card_list_lock); 2506static DEFINE_MUTEX(card_list_lock);
@@ -2765,8 +2765,8 @@ static void azx_vs_set_state(struct pci_dev *pci,
2765 dev_info(chip->card->dev, "%s via VGA-switcheroo\n", 2765 dev_info(chip->card->dev, "%s via VGA-switcheroo\n",
2766 disabled ? "Disabling" : "Enabling"); 2766 disabled ? "Disabling" : "Enabling");
2767 if (disabled) { 2767 if (disabled) {
2768 pm_runtime_put_sync_suspend(&pci->dev); 2768 pm_runtime_put_sync_suspend(card->dev);
2769 azx_suspend(&pci->dev); 2769 azx_suspend(card->dev);
2770 /* when we get suspended by vga switcheroo we end up in D3cold, 2770 /* when we get suspended by vga switcheroo we end up in D3cold,
2771 * however we have no ACPI handle, so pci/acpi can't put us there, 2771 * however we have no ACPI handle, so pci/acpi can't put us there,
2772 * put ourselves there */ 2772 * put ourselves there */
@@ -2777,9 +2777,9 @@ static void azx_vs_set_state(struct pci_dev *pci,
2777 "Cannot lock devices!\n"); 2777 "Cannot lock devices!\n");
2778 } else { 2778 } else {
2779 snd_hda_unlock_devices(chip->bus); 2779 snd_hda_unlock_devices(chip->bus);
2780 pm_runtime_get_noresume(&pci->dev); 2780 pm_runtime_get_noresume(card->dev);
2781 chip->disabled = false; 2781 chip->disabled = false;
2782 azx_resume(&pci->dev); 2782 azx_resume(card->dev);
2783 } 2783 }
2784 } 2784 }
2785} 2785}
@@ -2833,7 +2833,8 @@ static int register_vga_switcheroo(struct azx *chip)
2833 chip->vga_switcheroo_registered = 1; 2833 chip->vga_switcheroo_registered = 1;
2834 2834
2835 /* register as an optimus hdmi audio power domain */ 2835 /* register as an optimus hdmi audio power domain */
2836 vga_switcheroo_init_domain_pm_optimus_hdmi_audio(&chip->pci->dev, &chip->hdmi_pm_domain); 2836 vga_switcheroo_init_domain_pm_optimus_hdmi_audio(chip->card->dev,
2837 &chip->hdmi_pm_domain);
2837 return 0; 2838 return 0;
2838} 2839}
2839#else 2840#else
@@ -3348,7 +3349,7 @@ static int azx_first_init(struct azx *chip)
3348 dsp_lock_init(&chip->azx_dev[i]); 3349 dsp_lock_init(&chip->azx_dev[i]);
3349 /* allocate memory for the BDL for each stream */ 3350 /* allocate memory for the BDL for each stream */
3350 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, 3351 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
3351 snd_dma_pci_data(chip->pci), 3352 chip->card->dev,
3352 BDL_SIZE, &chip->azx_dev[i].bdl); 3353 BDL_SIZE, &chip->azx_dev[i].bdl);
3353 if (err < 0) { 3354 if (err < 0) {
3354 dev_err(card->dev, "cannot allocate BDL\n"); 3355 dev_err(card->dev, "cannot allocate BDL\n");
@@ -3358,7 +3359,7 @@ static int azx_first_init(struct azx *chip)
3358 } 3359 }
3359 /* allocate memory for the position buffer */ 3360 /* allocate memory for the position buffer */
3360 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, 3361 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
3361 snd_dma_pci_data(chip->pci), 3362 chip->card->dev,
3362 chip->num_streams * 8, &chip->posbuf); 3363 chip->num_streams * 8, &chip->posbuf);
3363 if (err < 0) { 3364 if (err < 0) {
3364 dev_err(card->dev, "cannot allocate posbuf\n"); 3365 dev_err(card->dev, "cannot allocate posbuf\n");