ALSA: hda: fix the missing ptr initialization
PATCH 1/2 ALSA: hda: fix the missing ptr initialization
ebus is a member of extended device and was never initialized, so do this at device creation.
--- sound/hda/ext/hdac_ext_bus.c | 1 + 1 file changed, 1 insertion(+)
sound/hda/ext/hdac_ext_bus.c +1 -0
@@ -144,6 +144,7 @@ int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *ebus, int addr)if (!edev)return -ENOMEM ; hdev = &edev->hdac; + edev->ebus = ebus;snprintf (name,sizeof (name),"ehdaudio%dD%d" , ebus->idx, addr);
Signature · 1 line
1.9.1
PATCH 2/2 ALSA: hda: fix to wait for RIRB & CORB DMA to set
From: Jeeja KP <[email protected]>
After setting the stop bit of RIRB/CORB DMA, we should wait for stop bit to be set.
--- sound/hda/hdac_controller.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-)
sound/hda/hdac_controller.c +31 -2
@@ -80,6 +80,35 @@ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus) }EXPORT_SYMBOL_GPL (snd_hdac_bus_init_cmd_io); + +/* Stop CORB DMA and poll till they are stopped */ +static void hdac_stop_corb_dma (struct hdac_bus *bus) +{ +unsigned long timeout; + +snd_hdac_chip_writew (bus,CORBCTL ,0 ); + +udelay (3 ); + timeout = jiffies +msecs_to_jiffies (100 ); +while ((snd_hdac_chip_readb (bus,CORBCTL ) &AZX_CORBCTL_RUN ) + &&time_before (jiffies, timeout)) +udelay (10 ); +} + +/* Stop RIRB DMA and poll till they are stopped */ +static void hdac_stop_rirb_dma (struct hdac_bus *bus) +{ +unsigned long timeout; + +snd_hdac_chip_writew (bus,RIRBCTL ,0 ); + +udelay (3 ); + timeout = jiffies +msecs_to_jiffies (100 ); +while ((snd_hdac_chip_readb (bus,RIRBCTL ) &AZX_RBCTL_DMA_EN ) + &&time_before (jiffies, timeout)) +udelay (10 ); +} +/** * snd_hdac_bus_stop_cmd_io - clean up CORB/RIRB buffers * @bus: HD-audio core bus
@@ -88,8 +117,8 @@ void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus) {spin_lock_irq (&bus->reg_lock);/* disable ringbuffer DMAs */ -snd_hdac_chip_writeb (bus,RIRBCTL ,0 ); -snd_hdac_chip_writeb (bus,CORBCTL ,0 ); +hdac_stop_rirb_dma (bus); +hdac_stop_corb_dma (bus);/* disable unsolicited responses */ snd_hdac_chip_updatel (bus,GCTL ,AZX_GCTL_UNSOL ,0 );spin_unlock_irq (&bus->reg_lock);
Signature · 1 line
1.9.1
Re: [PATCH 2/2] ALSA: hda: fix to wait for RIRB & CORB DMA to set
Quoted 5 lines · Vinod Koul
From: Jeeja KP <[email protected]>
After setting the stop bit of RIRB/CORB DMA, we should wait for stop bit to be set.
What does this actually fix?
Quoted 47 lines
Signed-off-by Jeeja KP <[email protected]>Signed-off-by Vinod Koul <[email protected]>--- sound/hda/hdac_controller.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-)sound/hda/hdac_controller.c +29
-0@@ -80,6 +80,35 @@ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus) }EXPORT_SYMBOL_GPL (snd_hdac_bus_init_cmd_io); + +/* Stop CORB DMA and poll till they are stopped */ +static void hdac_stop_corb_dma (struct hdac_bus *bus) +{ +unsigned long timeout; + +snd_hdac_chip_writew (bus,CORBCTL ,0 ); + +udelay (3 ); + timeout = jiffies +msecs_to_jiffies (100 ); +while ((snd_hdac_chip_readb (bus,CORBCTL ) &AZX_CORBCTL_RUN ) + &&time_before (jiffies, timeout)) +udelay (10 ); +} + +/* Stop RIRB DMA and poll till they are stopped */ +static void hdac_stop_rirb_dma (struct hdac_bus *bus) +{ +unsigned long timeout; + +snd_hdac_chip_writew (bus,RIRBCTL ,0 ); + +udelay (3 ); + timeout = jiffies +msecs_to_jiffies (100 ); +while ((snd_hdac_chip_readb (bus,RIRBCTL ) &AZX_RBCTL_DMA_EN ) + &&time_before (jiffies, timeout)) +udelay (10 ); +} +/** * snd_hdac_bus_stop_cmd_io - clean up CORB/RIRB buffers * @bus: HD-audio core bus
sound/hda/hdac_controller.c void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus) · line 121
Quoted 7 lines
sound/hda/hdac_controller.c +2
-2@@ -88,8 +117,8 @@ void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus) {spin_lock_irq (&bus->reg_lock);/* disable ringbuffer DMAs */ -snd_hdac_chip_writeb (bus,RIRBCTL ,0 ); -snd_hdac_chip_writeb (bus,CORBCTL ,0 ); +hdac_stop_rirb_dma (bus); +hdac_stop_corb_dma (bus);
Doing these one after another sequentially is a waste of time. Clear two once, then sync them.
thanks,
Takashi
Re: [PATCH 2/2] ALSA: hda: fix to wait for RIRB & CORB DMA to set
Quoted 9 lines · Takashi Iwai
Quoted 5 lines · Vinod Koul
From: Jeeja KP <[email protected]>
After setting the stop bit of RIRB/CORB DMA, we should wait for stop bit to be set.
What does this actually fix?
We some some stablity issues on SKL that were attributed to DMAs not being quisced properly so recommendation was to to wait till DMAs are stopped
Quoted 11 lines
sound/hda/hdac_controller.c void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus) · line 121
Quoted 8 lines
sound/hda/hdac_controller.c +2
-2@@ -88,8 +117,8 @@ void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus) {spin_lock_irq (&bus->reg_lock);/* disable ringbuffer DMAs */ -snd_hdac_chip_writeb (bus,RIRBCTL ,0 ); -snd_hdac_chip_writeb (bus,CORBCTL ,0 ); +hdac_stop_rirb_dma (bus); +hdac_stop_corb_dma (bus);Doing these one after another sequentially is a waste of time. Clear two once, then sync them.
Yes agreed, that sounds better, something like adding a new wait function:
hdac_stop_rirb_dma(bus); hdac_stop_corb_dma(bus); hdac_wait_for_cmd_dmas(bus);
Thanks
Signature · 1 line
~Vinod
Re: [PATCH 2/2] ALSA: hda: fix to wait for RIRB & CORB DMA to set
Quoted 7 lines · Vinod Koul
Quoted 5 lines · Takashi Iwai
Quoted 3 lines · Vinod Koul
From: Jeeja KP <[email protected]>
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
After setting the stop bit of RIRB/CORB DMA, we should wait for stop bit to be set.
What does this actually fix?
We some some stablity issues on SKL that were attributed to DMAs not being quisced properly so recommendation was to to wait till DMAs are stopped
Then please write it up in the changelog.
And, did it actually improve the stability? That's the biggest question :)
Quoted 12 lines
Quoted 11 lines
sound/hda/hdac_controller.c void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus) · line 121
Quoted 8 lines
sound/hda/hdac_controller.c +2
-2@@ -88,8 +117,8 @@ void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus) {spin_lock_irq (&bus->reg_lock);/* disable ringbuffer DMAs */ -snd_hdac_chip_writeb (bus,RIRBCTL ,0 ); -snd_hdac_chip_writeb (bus,CORBCTL ,0 ); +hdac_stop_rirb_dma (bus); +hdac_stop_corb_dma (bus);Doing these one after another sequentially is a waste of time. Clear two once, then sync them.
Quoted 5 lines
Yes agreed, that sounds better, something like adding a new wait function:
hdac_stop_rirb_dma(bus); hdac_stop_corb_dma(bus); hdac_wait_for_cmd_dmas(bus);
Yep, that looks better.
thanks,
Takashi
Re: [PATCH 2/2] ALSA: hda: fix to wait for RIRB & CORB DMA to set
Quoted 12 lines · Takashi Iwai
Quoted 10 lines · Vinod Koul
Quoted 8 lines · Takashi Iwai
Quoted 5 lines · Vinod Koul
From: Jeeja KP <[email protected]>
After setting the stop bit of RIRB/CORB DMA, we should wait for stop bit to be set.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
What does this actually fix?
We some some stablity issues on SKL that were attributed to DMAs not being quisced properly so recommendation was to to wait till DMAs are stopped
Then please write it up in the changelog.
Sure thing
Quoted 3 lines
And, did it actually improve the stability? That's the biggest question :)
Yes it did :)
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
sound/hda/hdac_controller.c void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus) · line 121
Quoted 8 lines
sound/hda/hdac_controller.c +2
-2@@ -88,8 +117,8 @@ void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus) {spin_lock_irq (&bus->reg_lock);/* disable ringbuffer DMAs */ -snd_hdac_chip_writeb (bus,RIRBCTL ,0 ); -snd_hdac_chip_writeb (bus,CORBCTL ,0 ); +hdac_stop_rirb_dma (bus); +hdac_stop_corb_dma (bus);Doing these one after another sequentially is a waste of time. Clear two once, then sync them.
Quoted 7 lines
Quoted 5 lines
Yes agreed, that sounds better, something like adding a new wait function:
hdac_stop_rirb_dma(bus); hdac_stop_corb_dma(bus); hdac_wait_for_cmd_dmas(bus);Yep, that looks better.
Okay will update and post v2
Signature · 1 line
~Vinod