]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: ti: davinci-mcasp: Streamline pdir behavior across rx & tx streams
authorSen Wang <sen@ti.com>
Tue, 3 Feb 2026 00:37:02 +0000 (18:37 -0600)
committerMark Brown <broonie@kernel.org>
Wed, 4 Feb 2026 18:21:51 +0000 (18:21 +0000)
Simplify the mcasp_set_clk_pdir caller convention in start/stop stream
function, to make it so that set_clk_pdir gets called regardless when
stream starts and also disables when stream ends.

Functionality-wise, everything remains the same as the previously skipped
calls are now either correctly configured
(when McASP is SND_SOC_DAIFMT_BP_FC - pdir needs to be enabled)
or called with a bitmask of zero (when McASP is SND_SOC_DAIFMT_BC_FC - pdir
gets disabled).

On brief regarding McASP Clock and Frame sync configurations, refer to [0].

[0]:TRM Section 12.1.1.4.2 https://www.ti.com/lit/ug/sprujd4a/sprujd4a.pdf

Signed-off-by: Sen Wang <sen@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Tested-by: Paresh Bhagat <p-bhagat@ti.com>
Link: https://patch.msgid.link/20260203003703.2334443-4-sen@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/ti/davinci-mcasp.c

index c0cb271e43cb61807a2d3a7ee548bf5ce6134194..12b7d0c65624d84825014d6fc104f1fdb0fed1e3 100644 (file)
@@ -236,8 +236,8 @@ static void mcasp_start_rx(struct davinci_mcasp *mcasp)
        if (mcasp_is_frame_producer(mcasp) && mcasp_is_synchronous(mcasp)) {
                mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXHCLKRST);
                mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXCLKRST);
-               mcasp_set_clk_pdir(mcasp, true);
        }
+       mcasp_set_clk_pdir(mcasp, true);
 
        /* Activate serializer(s) */
        mcasp_set_reg(mcasp, DAVINCI_MCASP_RXSTAT_REG, 0xFFFFFFFF);
@@ -312,10 +312,10 @@ static void mcasp_stop_rx(struct davinci_mcasp *mcasp)
         * In synchronous mode stop the TX clocks if no other stream is
         * running
         */
-       if (mcasp_is_frame_producer(mcasp) && mcasp_is_synchronous(mcasp) && !mcasp->streams) {
+       if (!mcasp->streams)
                mcasp_set_clk_pdir(mcasp, false);
+       if (mcasp_is_frame_producer(mcasp) && mcasp_is_synchronous(mcasp) && !mcasp->streams)
                mcasp_set_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, 0);
-       }
 
        mcasp_set_reg(mcasp, DAVINCI_MCASP_GBLCTLR_REG, 0);
        mcasp_set_reg(mcasp, DAVINCI_MCASP_RXSTAT_REG, 0xFFFFFFFF);
@@ -341,7 +341,7 @@ static void mcasp_stop_tx(struct davinci_mcasp *mcasp)
         */
        if (mcasp_is_frame_producer(mcasp) && mcasp_is_synchronous(mcasp) && mcasp->streams)
                val =  TXHCLKRST | TXCLKRST | TXFSRST;
-       else
+       if (!mcasp->streams)
                mcasp_set_clk_pdir(mcasp, false);