summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBard Liao <yung-chuan.liao@linux.intel.com>2019-05-26 12:58:34 -0400
committerTakashi Iwai <tiwai@suse.de>2019-05-28 01:52:02 -0400
commit8af42130b50c4d38f48fa82f3f7be4606d01f595 (patch)
tree182bbd60e5530a4e00187f6d91a47f1ba4a78bae
parentbd2956e40edf2160f5c1a623d6d6c6ab7f8cd831 (diff)
ALSA: hda: move polling_mode flag to struct hdac_bus
polling mode is a useful function in the get_response function. Move polling_mode flag from struct azx to struct hdac_bus so people can implement polling mode in their own get_response function without adding a polling_mode flag in their local chip structure. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--include/sound/hdaudio.h3
-rw-r--r--sound/pci/hda/hda_controller.c12
-rw-r--r--sound/pci/hda/hda_controller.h2
-rw-r--r--sound/pci/hda/hda_intel.c2
4 files changed, 10 insertions, 9 deletions
diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
index e8346784cf3f..f49af557bdb0 100644
--- a/include/sound/hdaudio.h
+++ b/include/sound/hdaudio.h
@@ -358,6 +358,9 @@ struct hdac_bus {
358 bool align_bdle_4k:1; /* BDLE align 4K boundary */ 358 bool align_bdle_4k:1; /* BDLE align 4K boundary */
359 bool reverse_assign:1; /* assign devices in reverse order */ 359 bool reverse_assign:1; /* assign devices in reverse order */
360 bool corbrp_self_clear:1; /* CORBRP clears itself after reset */ 360 bool corbrp_self_clear:1; /* CORBRP clears itself after reset */
361 bool polling_mode:1;
362
363 int poll_count;
361 364
362 int bdl_pos_adj; /* BDL position adjustment */ 365 int bdl_pos_adj; /* BDL position adjustment */
363 366
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 532e081f8b8a..53feaeef1553 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -806,11 +806,11 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr,
806 806
807 for (loopcounter = 0;; loopcounter++) { 807 for (loopcounter = 0;; loopcounter++) {
808 spin_lock_irq(&bus->reg_lock); 808 spin_lock_irq(&bus->reg_lock);
809 if (chip->polling_mode || do_poll) 809 if (bus->polling_mode || do_poll)
810 snd_hdac_bus_update_rirb(bus); 810 snd_hdac_bus_update_rirb(bus);
811 if (!bus->rirb.cmds[addr]) { 811 if (!bus->rirb.cmds[addr]) {
812 if (!do_poll) 812 if (!do_poll)
813 chip->poll_count = 0; 813 bus->poll_count = 0;
814 if (res) 814 if (res)
815 *res = bus->rirb.res[addr]; /* the last value */ 815 *res = bus->rirb.res[addr]; /* the last value */
816 spin_unlock_irq(&bus->reg_lock); 816 spin_unlock_irq(&bus->reg_lock);
@@ -830,21 +830,21 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr,
830 if (hbus->no_response_fallback) 830 if (hbus->no_response_fallback)
831 return -EIO; 831 return -EIO;
832 832
833 if (!chip->polling_mode && chip->poll_count < 2) { 833 if (!bus->polling_mode && bus->poll_count < 2) {
834 dev_dbg(chip->card->dev, 834 dev_dbg(chip->card->dev,
835 "azx_get_response timeout, polling the codec once: last cmd=0x%08x\n", 835 "azx_get_response timeout, polling the codec once: last cmd=0x%08x\n",
836 bus->last_cmd[addr]); 836 bus->last_cmd[addr]);
837 do_poll = 1; 837 do_poll = 1;
838 chip->poll_count++; 838 bus->poll_count++;
839 goto again; 839 goto again;
840 } 840 }
841 841
842 842
843 if (!chip->polling_mode) { 843 if (!bus->polling_mode) {
844 dev_warn(chip->card->dev, 844 dev_warn(chip->card->dev,
845 "azx_get_response timeout, switching to polling mode: last cmd=0x%08x\n", 845 "azx_get_response timeout, switching to polling mode: last cmd=0x%08x\n",
846 bus->last_cmd[addr]); 846 bus->last_cmd[addr]);
847 chip->polling_mode = 1; 847 bus->polling_mode = 1;
848 goto again; 848 goto again;
849 } 849 }
850 850
diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h
index 7185ed574b41..8d886791cf0f 100644
--- a/sound/pci/hda/hda_controller.h
+++ b/sound/pci/hda/hda_controller.h
@@ -142,11 +142,9 @@ struct azx {
142 142
143 /* flags */ 143 /* flags */
144 int bdl_pos_adj; 144 int bdl_pos_adj;
145 int poll_count;
146 unsigned int running:1; 145 unsigned int running:1;
147 unsigned int fallback_to_single_cmd:1; 146 unsigned int fallback_to_single_cmd:1;
148 unsigned int single_cmd:1; 147 unsigned int single_cmd:1;
149 unsigned int polling_mode:1;
150 unsigned int msi:1; 148 unsigned int msi:1;
151 unsigned int probing:1; /* codec probing phase */ 149 unsigned int probing:1; /* codec probing phase */
152 unsigned int snoop:1; 150 unsigned int snoop:1;
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 489fb53c9b06..c0b466c96340 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1710,7 +1710,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
1710 1710
1711 /* Workaround for a communication error on CFL (bko#199007) and CNL */ 1711 /* Workaround for a communication error on CFL (bko#199007) and CNL */
1712 if (IS_CFL(pci) || IS_CNL(pci)) 1712 if (IS_CFL(pci) || IS_CNL(pci))
1713 chip->polling_mode = 1; 1713 azx_bus(chip)->polling_mode = 1;
1714 1714
1715 if (chip->driver_type == AZX_DRIVER_NVIDIA) { 1715 if (chip->driver_type == AZX_DRIVER_NVIDIA) {
1716 dev_dbg(chip->card->dev, "Enable delay in RIRB handling\n"); 1716 dev_dbg(chip->card->dev, "Enable delay in RIRB handling\n");