ASoC: fsl_ssi: Add DAIFMT define for AC97
authorNicolin Chen <nicoleotsuka@gmail.com>
Mon, 12 Feb 2018 22:03:16 +0000 (14:03 -0800)
committerMark Brown <broonie@kernel.org>
Wed, 21 Feb 2018 12:30:52 +0000 (12:30 +0000)
The _fsl_ssi_set_dai_fmt() bypasses an undefined format for AC97
mode. However, it's not really necessary if AC97 has its complete
format defined.

So this patch adds a DAIFMT macro of complete format including a
clock direction and polarity.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Tested-by: Caleb Crome <caleb@crome.org>
Tested-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Reviewed-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl_ssi.c

index 9f024a9..fc5768d 100644 (file)
         SNDRV_PCM_FMTBIT_S24_LE)
 #endif
 
+/*
+ * In AC97 mode, TXDIR bit is forced to 0 and TFDIR bit is forced to 1:
+ *  - SSI inputs external bit clock and outputs frame sync clock -- CBM_CFS
+ *  - Also have NB_NF to mark these two clocks will not be inverted
+ */
+#define FSLSSI_AC97_DAIFMT \
+       (SND_SOC_DAIFMT_AC97 | \
+        SND_SOC_DAIFMT_CBM_CFS | \
+        SND_SOC_DAIFMT_NB_NF)
+
 #define FSLSSI_SIER_DBG_RX_FLAGS \
        (SSI_SIER_RFF0_EN | \
         SSI_SIER_RLS_EN | \
@@ -964,8 +974,7 @@ static int _fsl_ssi_set_dai_fmt(struct device *dev,
                scr &= ~SSI_SCR_SYS_CLK_EN;
                break;
        default:
-               if (!fsl_ssi_is_ac97(ssi))
-                       return -EINVAL;
+               return -EINVAL;
        }
 
        stcr |= strcr;
@@ -1372,7 +1381,7 @@ static int fsl_ssi_probe(struct platform_device *pdev)
        sprop = of_get_property(np, "fsl,mode", NULL);
        if (sprop) {
                if (!strcmp(sprop, "ac97-slave"))
-                       ssi->dai_fmt = SND_SOC_DAIFMT_AC97;
+                       ssi->dai_fmt = FSLSSI_AC97_DAIFMT;
        }
 
        /* Select DMA or FIQ */