Commit 213ed4b8 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

Merge branch 'topic/hda-polling-mode' into for-next



Pull the HD-audio polling mode changes, moving the stuff into HD-audio
core for re-using it in ASoC.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parents 98e3e43b 64ca9d9f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -358,6 +358,9 @@ struct hdac_bus {
	bool align_bdle_4k:1;		/* BDLE align 4K boundary */
	bool reverse_assign:1;		/* assign devices in reverse order */
	bool corbrp_self_clear:1;	/* CORBRP clears itself after reset */
	bool polling_mode:1;

	int poll_count;

	int bdl_pos_adj;		/* BDL position adjustment */

+2 −0
Original line number Diff line number Diff line
@@ -239,6 +239,8 @@ int snd_hdac_bus_get_response(struct hdac_bus *bus, unsigned int addr,
	timeout = jiffies + msecs_to_jiffies(1000);

	for (loopcounter = 0;; loopcounter++) {
		if (bus->polling_mode)
			snd_hdac_bus_update_rirb(bus);
		spin_lock_irq(&bus->reg_lock);
		if (!bus->rirb.cmds[addr]) {
			if (res)
+6 −6
Original line number Diff line number Diff line
@@ -806,11 +806,11 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr,

	for (loopcounter = 0;; loopcounter++) {
		spin_lock_irq(&bus->reg_lock);
		if (chip->polling_mode || do_poll)
		if (bus->polling_mode || do_poll)
			snd_hdac_bus_update_rirb(bus);
		if (!bus->rirb.cmds[addr]) {
			if (!do_poll)
				chip->poll_count = 0;
				bus->poll_count = 0;
			if (res)
				*res = bus->rirb.res[addr]; /* the last value */
			spin_unlock_irq(&bus->reg_lock);
@@ -830,21 +830,21 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr,
	if (hbus->no_response_fallback)
		return -EIO;

	if (!chip->polling_mode && chip->poll_count < 2) {
	if (!bus->polling_mode && bus->poll_count < 2) {
		dev_dbg(chip->card->dev,
			"azx_get_response timeout, polling the codec once: last cmd=0x%08x\n",
			bus->last_cmd[addr]);
		do_poll = 1;
		chip->poll_count++;
		bus->poll_count++;
		goto again;
	}


	if (!chip->polling_mode) {
	if (!bus->polling_mode) {
		dev_warn(chip->card->dev,
			 "azx_get_response timeout, switching to polling mode: last cmd=0x%08x\n",
			 bus->last_cmd[addr]);
		chip->polling_mode = 1;
		bus->polling_mode = 1;
		goto again;
	}

+0 −2
Original line number Diff line number Diff line
@@ -142,11 +142,9 @@ struct azx {

	/* flags */
	int bdl_pos_adj;
	int poll_count;
	unsigned int running:1;
	unsigned int fallback_to_single_cmd:1;
	unsigned int single_cmd:1;
	unsigned int polling_mode:1;
	unsigned int msi:1;
	unsigned int probing:1; /* codec probing phase */
	unsigned int snoop:1;
+5 −4
Original line number Diff line number Diff line
@@ -375,6 +375,7 @@ enum {

#define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
#define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348)
#define IS_CNL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8)

static char *driver_short_names[] = {
	[AZX_DRIVER_ICH] = "HDA Intel",
@@ -1700,10 +1701,6 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
	else
		chip->bdl_pos_adj = bdl_pos_adj[dev];

	/* Workaround for a communication error on CFL (bko#199007) */
	if (IS_CFL(pci))
		chip->polling_mode = 1;

	err = azx_bus_init(chip, model[dev], &pci_hda_io_ops);
	if (err < 0) {
		kfree(hda);
@@ -1711,6 +1708,10 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
		return err;
	}

	/* Workaround for a communication error on CFL (bko#199007) and CNL */
	if (IS_CFL(pci) || IS_CNL(pci))
		azx_bus(chip)->polling_mode = 1;

	if (chip->driver_type == AZX_DRIVER_NVIDIA) {
		dev_dbg(chip->card->dev, "Enable delay in RIRB handling\n");
		chip->bus.needs_damn_long_delay = 1;
Loading