ALSA: hda: Fix a headphone detection issue when using SOF
PATCH 1/1 ALSA: hda: Fix a headphone detection issue when using SOF
To save power, the hda hdmi driver in ASoC invokes snd_hdac_ext_bus_link_put to disable CORB/RIRB buffers DMA if there is no user of bus and invokes snd_hdac_ext_bus_link_get to set up CORB/RIRB buffers when it is used. Unsolicited responses is disabled in snd_hdac_bus_stop_cmd_io called by snd_hdac_ext_bus_link_put , but it is not enabled in snd_hdac_bus_init_cmd_io called by snd_hdac_ext_bus_link_get. So for put-get sequence, Unsolicited responses is disabled and headphone can't be detected by hda codecs.
Now unsolicited responses is only enabled in snd_hdac_bus_reset_link which resets controller. The function is only called for setup of controller. This patch enables Unsolicited responses after RIRB is initialized in snd_hdac_bus_init_cmd_io which works together with snd_hdac_bus_reset_link to set up controller.
Tested legacy hda driver and SOF driver on intel whiskeylake.
--- sound/hda/hdac_controller.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
sound/hda/hdac_controller.c +2 -3
@@ -78,6 +78,8 @@ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus)snd_hdac_chip_writew (bus,RINTCNT ,1 );/* enable rirb dma and response irq */ snd_hdac_chip_writeb (bus,RIRBCTL ,AZX_RBCTL_DMA_EN |AZX_RBCTL_IRQ_EN ); +/* Accept unsolicited responses */ +snd_hdac_chip_updatel (bus,GCTL ,AZX_GCTL_UNSOL ,AZX_GCTL_UNSOL );spin_unlock_irq (&bus->reg_lock); }EXPORT_SYMBOL_GPL (snd_hdac_bus_init_cmd_io);
@@ -416,9 +418,6 @@ int snd_hdac_bus_reset_link(struct hdac_bus *bus, bool full_reset)return -EBUSY ; } -/* Accept unsolicited responses */ -snd_hdac_chip_updatel (bus,GCTL ,AZX_GCTL_UNSOL ,AZX_GCTL_UNSOL ); -/* detect codecs */ if (!bus->codec_mask) { bus->codec_mask =snd_hdac_chip_readw (bus,STATESTS );
Signature · 1 line
2.14.1
Quoted 15 lines · Rander Wang
To save power, the hda hdmi driver in ASoC invokes
snd_hdac_ext_bus_link_putto disable CORB/RIRB buffers DMA if there is no user of bus and invokessnd_hdac_ext_bus_link_getto set up CORB/RIRB buffers when it is used. Unsolicited responses is disabled insnd_hdac_bus_stop_cmd_iocalled bysnd_hdac_ext_bus_link_put, but it is not enabled insnd_hdac_bus_init_cmd_iocalled bysnd_hdac_ext_bus_link_get. So for put-get sequence, Unsolicited responses is disabled and headphone can't be detected by hda codecs.Now unsolicited responses is only enabled in
snd_hdac_bus_reset_linkwhich resets controller. The function is only called for setup of controller. This patch enables Unsolicited responses after RIRB is initialized insnd_hdac_bus_init_cmd_iowhich works together withsnd_hdac_bus_reset_linkto set up controller.
Quoted 4 lines
Tested legacy hda driver and SOF driver on intel whiskeylake.
Reviewed-by Takashi Iwai <[email protected]>Signed-off-by Rander Wang <[email protected]>
Applied now. Thanks.
Takashi