summaryrefslogtreecommitdiffstats
path: root/sound/hda
diff options
context:
space:
mode:
authorRander Wang <rander.wang@linux.intel.com>2019-07-01 03:46:30 -0400
committerTakashi Iwai <tiwai@suse.de>2019-07-01 10:27:27 -0400
commit7c2b3629d09ddec810dc4c1d3a6657c32def8f71 (patch)
treec18f782f5c2da30e30bb344fcf262417530c0064 /sound/hda
parent973b059ca98054f9400562ae90bea5069b9b9274 (diff)
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. Reviewed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Rander Wang <rander.wang@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/hda')
-rw-r--r--sound/hda/hdac_controller.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c
index d6a91429c058..c24fc8d266a9 100644
--- a/sound/hda/hdac_controller.c
+++ b/sound/hda/hdac_controller.c
@@ -78,6 +78,8 @@ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus)
78 snd_hdac_chip_writew(bus, RINTCNT, 1); 78 snd_hdac_chip_writew(bus, RINTCNT, 1);
79 /* enable rirb dma and response irq */ 79 /* enable rirb dma and response irq */
80 snd_hdac_chip_writeb(bus, RIRBCTL, AZX_RBCTL_DMA_EN | AZX_RBCTL_IRQ_EN); 80 snd_hdac_chip_writeb(bus, RIRBCTL, AZX_RBCTL_DMA_EN | AZX_RBCTL_IRQ_EN);
81 /* Accept unsolicited responses */
82 snd_hdac_chip_updatel(bus, GCTL, AZX_GCTL_UNSOL, AZX_GCTL_UNSOL);
81 spin_unlock_irq(&bus->reg_lock); 83 spin_unlock_irq(&bus->reg_lock);
82} 84}
83EXPORT_SYMBOL_GPL(snd_hdac_bus_init_cmd_io); 85EXPORT_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)
416 return -EBUSY; 418 return -EBUSY;
417 } 419 }
418 420
419 /* Accept unsolicited responses */
420 snd_hdac_chip_updatel(bus, GCTL, AZX_GCTL_UNSOL, AZX_GCTL_UNSOL);
421
422 /* detect codecs */ 421 /* detect codecs */
423 if (!bus->codec_mask) { 422 if (!bus->codec_mask) {
424 bus->codec_mask = snd_hdac_chip_readw(bus, STATESTS); 423 bus->codec_mask = snd_hdac_chip_readw(bus, STATESTS);