• Rander Wang's avatar
    ASoC:soc-pcm:fix a codec fixup issue in TDM case · 24428f8a
    Rander Wang authored
    [ Upstream commit 570f18b6 ]
    
    On HDaudio platforms, if playback is started when capture is working,
    there is no audible output.
    
    This can be root-caused to the use of the rx|tx_mask to store an HDaudio
    stream tag.
    
    If capture is stared before playback, rx_mask would be non-zero on HDaudio
    platform, then the channel number of playback, which is in the same codec
    dai with the capture, would be changed by soc_pcm_codec_params_fixup based
    on the tx_mask at first, then overwritten by this function based on rx_mask
    at last.
    
    According to the author of tx|rx_mask, tx_mask is for playback and rx_mask
    is for capture. And stream direction is checked at all other references of
    tx|rx_mask in ASoC, so here should be an error. This patch checks stream
    direction for tx|rx_mask for fixup function.
    
    This issue would affect not only HDaudio+ASoC, but also I2S codecs if the
    channel number based on rx_mask is not equal to the one for tx_mask. It could
    be rarely reproduecd because most drivers in kernel set the same channel number
    to tx|rx_mask or rx_mask is zero.
    
    Tested on all platforms using stream_tag & HDaudio and intel I2S platforms.
    Signed-off-by: default avatarRander Wang <rander.wang@linux.intel.com>
    Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    24428f8a
soc-pcm.c 83.9 KB