aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorDylan Reid <dgreid@chromium.org>2014-02-28 18:41:16 -0500
committerTakashi Iwai <tiwai@suse.de>2014-03-01 05:21:13 -0500
commitf46ea609d1484818f39e6760c33a1629c756116e (patch)
tree5efc408fd00355a9782532154f7544354ac36ab8 /sound/pci
parent8928756dbd956b474fc92ce0556fa3c35673c97c (diff)
ALSA: hda - Add function pointer for disabling MSI
This is a PCI-only feature, but adding a callback for it in the chip structure breaks the PCI dependency in the RIRB code allowing the logic there to be re-used by the platform HDA driver. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_intel.c23
-rw-r--r--sound/pci/hda/hda_priv.h4
2 files changed, 22 insertions, 5 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 7630622e7f0f..c4b6447bfc7e 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -600,11 +600,8 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
600 dev_warn(chip->card->dev, 600 dev_warn(chip->card->dev,
601 "No response from codec, disabling MSI: last cmd=0x%08x\n", 601 "No response from codec, disabling MSI: last cmd=0x%08x\n",
602 chip->last_cmd[addr]); 602 chip->last_cmd[addr]);
603 free_irq(chip->irq, chip); 603 if (chip->ops->disable_msi_reset_irq &&
604 chip->irq = -1; 604 chip->ops->disable_msi_reset_irq(chip) < 0) {
605 pci_disable_msi(chip->pci);
606 chip->msi = 0;
607 if (azx_acquire_irq(chip, 1) < 0) {
608 bus->rirb_error = 1; 605 bus->rirb_error = 1;
609 return -1; 606 return -1;
610 } 607 }
@@ -3469,6 +3466,21 @@ static u8 pci_azx_readb(u8 *addr)
3469 return readb(addr); 3466 return readb(addr);
3470} 3467}
3471 3468
3469static int disable_msi_reset_irq(struct azx *chip)
3470{
3471 int err;
3472
3473 free_irq(chip->irq, chip);
3474 chip->irq = -1;
3475 pci_disable_msi(chip->pci);
3476 chip->msi = 0;
3477 err = azx_acquire_irq(chip, 1);
3478 if (err < 0)
3479 return err;
3480
3481 return 0;
3482}
3483
3472static const struct hda_controller_ops pci_hda_ops = { 3484static const struct hda_controller_ops pci_hda_ops = {
3473 .writel = pci_azx_writel, 3485 .writel = pci_azx_writel,
3474 .readl = pci_azx_readl, 3486 .readl = pci_azx_readl,
@@ -3476,6 +3488,7 @@ static const struct hda_controller_ops pci_hda_ops = {
3476 .readw = pci_azx_readw, 3488 .readw = pci_azx_readw,
3477 .writeb = pci_azx_writeb, 3489 .writeb = pci_azx_writeb,
3478 .readb = pci_azx_readb, 3490 .readb = pci_azx_readb,
3491 .disable_msi_reset_irq = disable_msi_reset_irq,
3479}; 3492};
3480 3493
3481static int azx_probe(struct pci_dev *pci, 3494static int azx_probe(struct pci_dev *pci,
diff --git a/sound/pci/hda/hda_priv.h b/sound/pci/hda/hda_priv.h
index 17afe90e90de..c231c11d8669 100644
--- a/sound/pci/hda/hda_priv.h
+++ b/sound/pci/hda/hda_priv.h
@@ -285,6 +285,8 @@ struct azx_rb {
285 u32 res[AZX_MAX_CODECS]; /* last read value */ 285 u32 res[AZX_MAX_CODECS]; /* last read value */
286}; 286};
287 287
288struct azx;
289
288/* Functions to read/write to hda registers. */ 290/* Functions to read/write to hda registers. */
289struct hda_controller_ops { 291struct hda_controller_ops {
290 /* Register Access */ 292 /* Register Access */
@@ -294,6 +296,8 @@ struct hda_controller_ops {
294 u16 (*readw)(u16 *addr); 296 u16 (*readw)(u16 *addr);
295 void (*writeb)(u8 value, u8 *addr); 297 void (*writeb)(u8 value, u8 *addr);
296 u8 (*readb)(u8 *addr); 298 u8 (*readb)(u8 *addr);
299 /* Disable msi if supported, PCI only */
300 int (*disable_msi_reset_irq)(struct azx *);
297}; 301};
298 302
299struct azx_pcm { 303struct azx_pcm {