Commit 8af42130 authored by Bard Liao's avatar Bard Liao Committed by Takashi Iwai

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: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent bd2956e4
...@@ -358,6 +358,9 @@ struct hdac_bus { ...@@ -358,6 +358,9 @@ struct hdac_bus {
bool align_bdle_4k:1; /* BDLE align 4K boundary */ bool align_bdle_4k:1; /* BDLE align 4K boundary */
bool reverse_assign:1; /* assign devices in reverse order */ bool reverse_assign:1; /* assign devices in reverse order */
bool corbrp_self_clear:1; /* CORBRP clears itself after reset */ bool corbrp_self_clear:1; /* CORBRP clears itself after reset */
bool polling_mode:1;
int poll_count;
int bdl_pos_adj; /* BDL position adjustment */ int bdl_pos_adj; /* BDL position adjustment */
......
...@@ -806,11 +806,11 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr, ...@@ -806,11 +806,11 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr,
for (loopcounter = 0;; loopcounter++) { for (loopcounter = 0;; loopcounter++) {
spin_lock_irq(&bus->reg_lock); spin_lock_irq(&bus->reg_lock);
if (chip->polling_mode || do_poll) if (bus->polling_mode || do_poll)
snd_hdac_bus_update_rirb(bus); snd_hdac_bus_update_rirb(bus);
if (!bus->rirb.cmds[addr]) { if (!bus->rirb.cmds[addr]) {
if (!do_poll) if (!do_poll)
chip->poll_count = 0; bus->poll_count = 0;
if (res) if (res)
*res = bus->rirb.res[addr]; /* the last value */ *res = bus->rirb.res[addr]; /* the last value */
spin_unlock_irq(&bus->reg_lock); spin_unlock_irq(&bus->reg_lock);
...@@ -830,21 +830,21 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr, ...@@ -830,21 +830,21 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr,
if (hbus->no_response_fallback) if (hbus->no_response_fallback)
return -EIO; return -EIO;
if (!chip->polling_mode && chip->poll_count < 2) { if (!bus->polling_mode && bus->poll_count < 2) {
dev_dbg(chip->card->dev, dev_dbg(chip->card->dev,
"azx_get_response timeout, polling the codec once: last cmd=0x%08x\n", "azx_get_response timeout, polling the codec once: last cmd=0x%08x\n",
bus->last_cmd[addr]); bus->last_cmd[addr]);
do_poll = 1; do_poll = 1;
chip->poll_count++; bus->poll_count++;
goto again; goto again;
} }
if (!chip->polling_mode) { if (!bus->polling_mode) {
dev_warn(chip->card->dev, dev_warn(chip->card->dev,
"azx_get_response timeout, switching to polling mode: last cmd=0x%08x\n", "azx_get_response timeout, switching to polling mode: last cmd=0x%08x\n",
bus->last_cmd[addr]); bus->last_cmd[addr]);
chip->polling_mode = 1; bus->polling_mode = 1;
goto again; goto again;
} }
......
...@@ -142,11 +142,9 @@ struct azx { ...@@ -142,11 +142,9 @@ struct azx {
/* flags */ /* flags */
int bdl_pos_adj; int bdl_pos_adj;
int poll_count;
unsigned int running:1; unsigned int running:1;
unsigned int fallback_to_single_cmd:1; unsigned int fallback_to_single_cmd:1;
unsigned int single_cmd:1; unsigned int single_cmd:1;
unsigned int polling_mode:1;
unsigned int msi:1; unsigned int msi:1;
unsigned int probing:1; /* codec probing phase */ unsigned int probing:1; /* codec probing phase */
unsigned int snoop:1; unsigned int snoop:1;
......
...@@ -1710,7 +1710,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, ...@@ -1710,7 +1710,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
/* Workaround for a communication error on CFL (bko#199007) and CNL */ /* Workaround for a communication error on CFL (bko#199007) and CNL */
if (IS_CFL(pci) || IS_CNL(pci)) if (IS_CFL(pci) || IS_CNL(pci))
chip->polling_mode = 1; azx_bus(chip)->polling_mode = 1;
if (chip->driver_type == AZX_DRIVER_NVIDIA) { if (chip->driver_type == AZX_DRIVER_NVIDIA) {
dev_dbg(chip->card->dev, "Enable delay in RIRB handling\n"); dev_dbg(chip->card->dev, "Enable delay in RIRB handling\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment