Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 783462 | Differences between
and this patch

Collapse All | Expand All

(-)a/include/sound/hdaudio.h (+1 lines)
Lines 317-322 struct hdac_bus { Link Here
317
	struct hdac_rb corb;
317
	struct hdac_rb corb;
318
	struct hdac_rb rirb;
318
	struct hdac_rb rirb;
319
	unsigned int last_cmd[HDA_MAX_CODECS];	/* last sent command */
319
	unsigned int last_cmd[HDA_MAX_CODECS];	/* last sent command */
320
	wait_queue_head_t rirb_wq;
320
321
321
	/* CORB/RIRB and position buffers */
322
	/* CORB/RIRB and position buffers */
322
	struct snd_dma_buffer rb;
323
	struct snd_dma_buffer rb;
(-)a/sound/hda/hdac_bus.c (+1 lines)
Lines 43-48 int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, Link Here
43
	mutex_init(&bus->cmd_mutex);
43
	mutex_init(&bus->cmd_mutex);
44
	mutex_init(&bus->lock);
44
	mutex_init(&bus->lock);
45
	INIT_LIST_HEAD(&bus->hlink_list);
45
	INIT_LIST_HEAD(&bus->hlink_list);
46
	init_waitqueue_head(&bus->rirb_wq);
46
	bus->irq = -1;
47
	bus->irq = -1;
47
	return 0;
48
	return 0;
48
}
49
}
(-)a/sound/hda/hdac_controller.c (+3 lines)
Lines 216-221 void snd_hdac_bus_update_rirb(struct hdac_bus *bus) Link Here
216
		else if (bus->rirb.cmds[addr]) {
216
		else if (bus->rirb.cmds[addr]) {
217
			bus->rirb.res[addr] = res;
217
			bus->rirb.res[addr] = res;
218
			bus->rirb.cmds[addr]--;
218
			bus->rirb.cmds[addr]--;
219
			if (!bus->rirb.cmds[addr] &&
220
			    waitqueue_active(&bus->rirb_wq))
221
				wake_up(&bus->rirb_wq);
219
		} else {
222
		} else {
220
			dev_err_ratelimited(bus->dev,
223
			dev_err_ratelimited(bus->dev,
221
				"spurious response %#x:%#x, last cmd=%#08x\n",
224
				"spurious response %#x:%#x, last cmd=%#08x\n",
(-)a/sound/pci/hda/hda_controller.c (-15 / +14 lines)
Lines 792-812 static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr, Link Here
792
	struct hda_bus *hbus = &chip->bus;
792
	struct hda_bus *hbus = &chip->bus;
793
	unsigned long timeout;
793
	unsigned long timeout;
794
	unsigned long loopcounter;
794
	unsigned long loopcounter;
795
	int do_poll = 0;
795
	wait_queue_entry_t wait;
796
	bool warned = false;
796
	bool warned = false;
797
797
798
	init_wait_entry(&wait, 0);
798
 again:
799
 again:
799
	timeout = jiffies + msecs_to_jiffies(1000);
800
	timeout = jiffies + msecs_to_jiffies(1000);
800
801
801
	for (loopcounter = 0;; loopcounter++) {
802
	for (loopcounter = 0;; loopcounter++) {
802
		spin_lock_irq(&bus->reg_lock);
803
		spin_lock_irq(&bus->reg_lock);
803
		if (bus->polling_mode || do_poll)
804
		if (!bus->polling_mode)
805
			prepare_to_wait(&bus->rirb_wq, &wait,
806
					TASK_UNINTERRUPTIBLE);
807
		if (bus->polling_mode)
804
			snd_hdac_bus_update_rirb(bus);
808
			snd_hdac_bus_update_rirb(bus);
805
		if (!bus->rirb.cmds[addr]) {
809
		if (!bus->rirb.cmds[addr]) {
806
			if (!do_poll)
807
				bus->poll_count = 0;
808
			if (res)
810
			if (res)
809
				*res = bus->rirb.res[addr]; /* the last value */
811
				*res = bus->rirb.res[addr]; /* the last value */
812
			if (!bus->polling_mode)
813
				finish_wait(&bus->rirb_wq, &wait);
810
			spin_unlock_irq(&bus->reg_lock);
814
			spin_unlock_irq(&bus->reg_lock);
811
			return 0;
815
			return 0;
812
		}
816
		}
Lines 814-820 static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr, Link Here
814
		if (time_after(jiffies, timeout))
818
		if (time_after(jiffies, timeout))
815
			break;
819
			break;
816
#define LOOP_COUNT_MAX	3000
820
#define LOOP_COUNT_MAX	3000
817
		if (hbus->needs_damn_long_delay ||
821
		if (!bus->polling_mode) {
822
			schedule_timeout(msecs_to_jiffies(2));
823
		} else if (hbus->needs_damn_long_delay ||
818
		    loopcounter > LOOP_COUNT_MAX) {
824
		    loopcounter > LOOP_COUNT_MAX) {
819
			if (loopcounter > LOOP_COUNT_MAX && !warned) {
825
			if (loopcounter > LOOP_COUNT_MAX && !warned) {
820
				dev_dbg_ratelimited(chip->card->dev,
826
				dev_dbg_ratelimited(chip->card->dev,
Lines 829-847 static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr, Link Here
829
		}
835
		}
830
	}
836
	}
831
837
838
	if (!bus->polling_mode)
839
		finish_wait(&bus->rirb_wq, &wait);
840
832
	if (hbus->no_response_fallback)
841
	if (hbus->no_response_fallback)
833
		return -EIO;
842
		return -EIO;
834
843
835
	if (!bus->polling_mode && bus->poll_count < 2) {
836
		dev_dbg(chip->card->dev,
837
			"azx_get_response timeout, polling the codec once: last cmd=0x%08x\n",
838
			bus->last_cmd[addr]);
839
		do_poll = 1;
840
		bus->poll_count++;
841
		goto again;
842
	}
843
844
845
	if (!bus->polling_mode) {
844
	if (!bus->polling_mode) {
846
		dev_warn(chip->card->dev,
845
		dev_warn(chip->card->dev,
847
			 "azx_get_response timeout, switching to polling mode: last cmd=0x%08x\n",
846
			 "azx_get_response timeout, switching to polling mode: last cmd=0x%08x\n",

Return to bug 783462