aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorDylan Reid <dgreid@chromium.org>2014-02-28 18:41:29 -0500
committerTakashi Iwai <tiwai@suse.de>2014-03-01 05:23:24 -0500
commitf0b1df88713a3537e056658d860f6631653ec5c6 (patch)
treef3f8904494c6a15c4ebbf58e9b205f44d2904998 /sound/pci
parent7ca954a86b1f2e42af9299eb2ac142bcb5c9bd67 (diff)
ALSA: hda - Move azx_interrupt to hda_controller
This code will be reused by an hda_platform driver as it has no PCI dependencies. This allows update_rirb to be static as all users are now in hda_controller.c. 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_controller.c69
-rw-r--r--sound/pci/hda/hda_controller.h2
-rw-r--r--sound/pci/hda/hda_intel.c65
3 files changed, 68 insertions, 68 deletions
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index bde4935afbab..43b99b495347 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -22,6 +22,7 @@
22 22
23#include <linux/clocksource.h> 23#include <linux/clocksource.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/interrupt.h>
25#include <linux/kernel.h> 26#include <linux/kernel.h>
26#include <linux/module.h> 27#include <linux/module.h>
27#include <linux/slab.h> 28#include <linux/slab.h>
@@ -1162,7 +1163,7 @@ static int azx_corb_send_cmd(struct hda_bus *bus, u32 val)
1162#define ICH6_RIRB_EX_UNSOL_EV (1<<4) 1163#define ICH6_RIRB_EX_UNSOL_EV (1<<4)
1163 1164
1164/* retrieve RIRB entry - called from interrupt handler */ 1165/* retrieve RIRB entry - called from interrupt handler */
1165void azx_update_rirb(struct azx *chip) 1166static void azx_update_rirb(struct azx *chip)
1166{ 1167{
1167 unsigned int rp, wp; 1168 unsigned int rp, wp;
1168 unsigned int addr; 1169 unsigned int addr;
@@ -1205,7 +1206,6 @@ void azx_update_rirb(struct azx *chip)
1205 } 1206 }
1206 } 1207 }
1207} 1208}
1208EXPORT_SYMBOL_GPL(azx_update_rirb);
1209 1209
1210/* receive a response */ 1210/* receive a response */
1211static unsigned int azx_rirb_get_response(struct hda_bus *bus, 1211static unsigned int azx_rirb_get_response(struct hda_bus *bus,
@@ -1747,5 +1747,70 @@ void azx_stop_chip(struct azx *chip)
1747 chip->initialized = 0; 1747 chip->initialized = 0;
1748} 1748}
1749 1749
1750/*
1751 * interrupt handler
1752 */
1753irqreturn_t azx_interrupt(int irq, void *dev_id)
1754{
1755 struct azx *chip = dev_id;
1756 struct azx_dev *azx_dev;
1757 u32 status;
1758 u8 sd_status;
1759 int i;
1760
1761#ifdef CONFIG_PM_RUNTIME
1762 if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
1763 if (chip->card->dev->power.runtime_status != RPM_ACTIVE)
1764 return IRQ_NONE;
1765#endif
1766
1767 spin_lock(&chip->reg_lock);
1768
1769 if (chip->disabled) {
1770 spin_unlock(&chip->reg_lock);
1771 return IRQ_NONE;
1772 }
1773
1774 status = azx_readl(chip, INTSTS);
1775 if (status == 0 || status == 0xffffffff) {
1776 spin_unlock(&chip->reg_lock);
1777 return IRQ_NONE;
1778 }
1779
1780 for (i = 0; i < chip->num_streams; i++) {
1781 azx_dev = &chip->azx_dev[i];
1782 if (status & azx_dev->sd_int_sta_mask) {
1783 sd_status = azx_sd_readb(chip, azx_dev, SD_STS);
1784 azx_sd_writeb(chip, azx_dev, SD_STS, SD_INT_MASK);
1785 if (!azx_dev->substream || !azx_dev->running ||
1786 !(sd_status & SD_INT_COMPLETE))
1787 continue;
1788 /* check whether this IRQ is really acceptable */
1789 if (!chip->ops->position_check ||
1790 chip->ops->position_check(chip, azx_dev)) {
1791 spin_unlock(&chip->reg_lock);
1792 snd_pcm_period_elapsed(azx_dev->substream);
1793 spin_lock(&chip->reg_lock);
1794 }
1795 }
1796 }
1797
1798 /* clear rirb int */
1799 status = azx_readb(chip, RIRBSTS);
1800 if (status & RIRB_INT_MASK) {
1801 if (status & RIRB_INT_RESPONSE) {
1802 if (chip->driver_caps & AZX_DCAPS_RIRB_PRE_DELAY)
1803 udelay(80);
1804 azx_update_rirb(chip);
1805 }
1806 azx_writeb(chip, RIRBSTS, RIRB_INT_MASK);
1807 }
1808
1809 spin_unlock(&chip->reg_lock);
1810
1811 return IRQ_HANDLED;
1812}
1813EXPORT_SYMBOL_GPL(azx_interrupt);
1814
1750MODULE_LICENSE("GPL"); 1815MODULE_LICENSE("GPL");
1751MODULE_DESCRIPTION("Common HDA driver funcitons"); 1816MODULE_DESCRIPTION("Common HDA driver funcitons");
diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h
index 67d9f28a669f..fac929948f19 100644
--- a/sound/pci/hda/hda_controller.h
+++ b/sound/pci/hda/hda_controller.h
@@ -50,7 +50,6 @@ void azx_free_stream_pages(struct azx *chip);
50/* 50/*
51 * CORB / RIRB interface 51 * CORB / RIRB interface
52 */ 52 */
53void azx_update_rirb(struct azx *chip);
54int azx_send_cmd(struct hda_bus *bus, unsigned int val); 53int azx_send_cmd(struct hda_bus *bus, unsigned int val);
55unsigned int azx_get_response(struct hda_bus *bus, 54unsigned int azx_get_response(struct hda_bus *bus,
56 unsigned int addr); 55 unsigned int addr);
@@ -59,5 +58,6 @@ unsigned int azx_get_response(struct hda_bus *bus,
59void azx_init_chip(struct azx *chip, int full_reset); 58void azx_init_chip(struct azx *chip, int full_reset);
60void azx_stop_chip(struct azx *chip); 59void azx_stop_chip(struct azx *chip);
61void azx_enter_link_reset(struct azx *chip); 60void azx_enter_link_reset(struct azx *chip);
61irqreturn_t azx_interrupt(int irq, void *dev_id);
62 62
63#endif /* __SOUND_HDA_CONTROLLER_H */ 63#endif /* __SOUND_HDA_CONTROLLER_H */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 53e4b40a72af..96c22a3a2dc0 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -413,7 +413,6 @@ static void azx_init_pci(struct azx *chip)
413 } 413 }
414} 414}
415 415
416
417static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev); 416static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev);
418 417
419/* called from IRQ */ 418/* called from IRQ */
@@ -434,70 +433,6 @@ static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev)
434} 433}
435 434
436/* 435/*
437 * interrupt handler
438 */
439static irqreturn_t azx_interrupt(int irq, void *dev_id)
440{
441 struct azx *chip = dev_id;
442 struct azx_dev *azx_dev;
443 u32 status;
444 u8 sd_status;
445 int i;
446
447#ifdef CONFIG_PM_RUNTIME
448 if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
449 if (chip->card->dev->power.runtime_status != RPM_ACTIVE)
450 return IRQ_NONE;
451#endif
452
453 spin_lock(&chip->reg_lock);
454
455 if (chip->disabled) {
456 spin_unlock(&chip->reg_lock);
457 return IRQ_NONE;
458 }
459
460 status = azx_readl(chip, INTSTS);
461 if (status == 0 || status == 0xffffffff) {
462 spin_unlock(&chip->reg_lock);
463 return IRQ_NONE;
464 }
465
466 for (i = 0; i < chip->num_streams; i++) {
467 azx_dev = &chip->azx_dev[i];
468 if (status & azx_dev->sd_int_sta_mask) {
469 sd_status = azx_sd_readb(chip, azx_dev, SD_STS);
470 azx_sd_writeb(chip, azx_dev, SD_STS, SD_INT_MASK);
471 if (!azx_dev->substream || !azx_dev->running ||
472 !(sd_status & SD_INT_COMPLETE))
473 continue;
474 /* check whether this IRQ is really acceptable */
475 if (!chip->ops->position_check ||
476 chip->ops->position_check(chip, azx_dev)) {
477 spin_unlock(&chip->reg_lock);
478 snd_pcm_period_elapsed(azx_dev->substream);
479 spin_lock(&chip->reg_lock);
480 }
481 }
482 }
483
484 /* clear rirb int */
485 status = azx_readb(chip, RIRBSTS);
486 if (status & RIRB_INT_MASK) {
487 if (status & RIRB_INT_RESPONSE) {
488 if (chip->driver_caps & AZX_DCAPS_RIRB_PRE_DELAY)
489 udelay(80);
490 azx_update_rirb(chip);
491 }
492 azx_writeb(chip, RIRBSTS, RIRB_INT_MASK);
493 }
494
495 spin_unlock(&chip->reg_lock);
496
497 return IRQ_HANDLED;
498}
499
500/*
501 * Probe the given codec address 436 * Probe the given codec address
502 */ 437 */
503static int probe_codec(struct azx *chip, int addr) 438static int probe_codec(struct azx *chip, int addr)