Patch "ASoC: cpcap: fix microphone timeslot mask" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ASoC: cpcap: fix microphone timeslot mask

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-cpcap-fix-microphone-timeslot-mask.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 9d2d02be320a894333f1e11573eadcc441c7ff6e
Author: Sebastian Reichel <sre@xxxxxxxxxx>
Date:   Sat Jan 23 18:29:45 2021 +0100

    ASoC: cpcap: fix microphone timeslot mask
    
    [ Upstream commit de5bfae2fd962a9da99f56382305ec7966a604b9 ]
    
    The correct mask is 0x1f8 (Bit 3-8), but due to missing BIT() 0xf (Bit
    0-3) was set instead. This means setting of CPCAP_BIT_MIC1_RX_TIMESLOT0
    (Bit 3) still worked (part of both masks). On the other hand the code
    does not properly clear the other MIC timeslot bits. I think this
    is not a problem, since they are probably initialized to 0 and not
    touched by the driver anywhere else. But the mask also contains some
    wrong bits, that will be cleared. Bit 0 (CPCAP_BIT_SMB_CDC) should be
    safe, since the driver enforces it to be 0 anyways.
    
    Bit 1-2 are CPCAP_BIT_FS_INV and CPCAP_BIT_CLK_INV. This means enabling
    audio recording forces the codec into SND_SOC_DAIFMT_NB_NF mode, which
    is obviously bad.
    
    The bug probably remained undetected, because there are not many use
    cases for routing microphone to the CPU on platforms using cpcap and
    user base is small. I do remember having some issues with bad sound
    quality when testing voice recording back when I wrote the driver.
    It probably was this bug.
    
    Fixes: f6cdf2d3445d ("ASoC: cpcap: new codec")
    Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Signed-off-by: Sebastian Reichel <sre@xxxxxxxxxx>
    Reviewed-by: Tony Lindgren <tony@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210123172945.3958622-1-sre@xxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/codecs/cpcap.c b/sound/soc/codecs/cpcap.c
index d7f05b384f1fb..1902689c5ea2c 100644
--- a/sound/soc/codecs/cpcap.c
+++ b/sound/soc/codecs/cpcap.c
@@ -1263,12 +1263,12 @@ static int cpcap_voice_hw_params(struct snd_pcm_substream *substream,
 
 	if (direction == SNDRV_PCM_STREAM_CAPTURE) {
 		mask = 0x0000;
-		mask |= CPCAP_BIT_MIC1_RX_TIMESLOT0;
-		mask |= CPCAP_BIT_MIC1_RX_TIMESLOT1;
-		mask |= CPCAP_BIT_MIC1_RX_TIMESLOT2;
-		mask |= CPCAP_BIT_MIC2_TIMESLOT0;
-		mask |= CPCAP_BIT_MIC2_TIMESLOT1;
-		mask |= CPCAP_BIT_MIC2_TIMESLOT2;
+		mask |= BIT(CPCAP_BIT_MIC1_RX_TIMESLOT0);
+		mask |= BIT(CPCAP_BIT_MIC1_RX_TIMESLOT1);
+		mask |= BIT(CPCAP_BIT_MIC1_RX_TIMESLOT2);
+		mask |= BIT(CPCAP_BIT_MIC2_TIMESLOT0);
+		mask |= BIT(CPCAP_BIT_MIC2_TIMESLOT1);
+		mask |= BIT(CPCAP_BIT_MIC2_TIMESLOT2);
 		val = 0x0000;
 		if (channels >= 2)
 			val = BIT(CPCAP_BIT_MIC1_RX_TIMESLOT0);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux