Lines Matching +full:tdm +full:- +full:sync +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0
52 /* DIS->DIS, do nothing */
54 /* DIS->TDM1*/
55 { .tdms = 1, .clk = 1, .msg = "DIS->TDM1: TDM1 not started!\n" },
56 /* DIS->TDM2*/
57 { .tdms = 2, .clk = 2, .msg = "DIS->TDM2: TDM2 not started!\n" },
58 /* DIS->MIX */
59 { .tdms = 3, .clk = 0, .msg = "DIS->MIX: Please start both TDMs!\n" }
60 }, { /* TDM1->DIS */
61 { .tdms = 1, .clk = 0, .msg = "TDM1->DIS: TDM1 not started!\n" },
62 /* TDM1->TDM1, do nothing */
64 /* TDM1->TDM2 */
65 { .tdms = 3, .clk = 2, .msg = "TDM1->TDM2: Please start both TDMs!\n" },
66 /* TDM1->MIX */
67 { .tdms = 3, .clk = 0, .msg = "TDM1->MIX: Please start both TDMs!\n" }
68 }, { /* TDM2->DIS */
69 { .tdms = 2, .clk = 0, .msg = "TDM2->DIS: TDM2 not started!\n" },
70 /* TDM2->TDM1 */
71 { .tdms = 3, .clk = 1, .msg = "TDM2->TDM1: Please start both TDMs!\n" },
72 /* TDM2->TDM2, do nothing */
74 /* TDM2->MIX */
75 { .tdms = 3, .clk = 0, .msg = "TDM2->MIX: Please start both TDMs!\n" }
76 }, { /* MIX->DIS */
77 { .tdms = 3, .clk = 0, .msg = "MIX->DIS: Please start both TDMs!\n" },
78 /* MIX->TDM1 */
79 { .tdms = 3, .clk = 1, .msg = "MIX->TDM1: Please start both TDMs!\n" },
80 /* MIX->TDM2 */
81 { .tdms = 3, .clk = 2, .msg = "MIX->TDM2: Please start both TDMs!\n" },
82 /* MIX->MIX, do nothing */
92 if ((priv->tdms & prm.tdms) != prm.tdms) { in fsl_audmix_state_trans()
93 dev_dbg(comp->dev, "%s", prm.msg); in fsl_audmix_state_trans()
94 return -EINVAL; in fsl_audmix_state_trans()
102 (*ctr) |= FSL_AUDMIX_CTR_MIXCLK(prm.clk - 1); in fsl_audmix_state_trans()
116 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; in fsl_audmix_put_mix_clk_src()
117 unsigned int *item = ucontrol->value.enumerated.item; in fsl_audmix_put_mix_clk_src()
126 dev_dbg(comp->dev, "TDMs=x%08x, val=x%08x\n", priv->tdms, val); in fsl_audmix_put_mix_clk_src()
132 if (!(priv->tdms & BIT(mix_clk))) { in fsl_audmix_put_mix_clk_src()
133 dev_err(comp->dev, in fsl_audmix_put_mix_clk_src()
134 "Started TDM%d needed for config propagation!\n", in fsl_audmix_put_mix_clk_src()
136 return -EINVAL; in fsl_audmix_put_mix_clk_src()
139 if (!(priv->tdms & BIT(val))) { in fsl_audmix_put_mix_clk_src()
140 dev_err(comp->dev, in fsl_audmix_put_mix_clk_src()
141 "The selected clock source has no TDM%d enabled!\n", in fsl_audmix_put_mix_clk_src()
143 return -EINVAL; in fsl_audmix_put_mix_clk_src()
154 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; in fsl_audmix_put_out_src()
155 unsigned int *item = ucontrol->value.enumerated.item; in fsl_audmix_put_out_src()
172 dev_dbg(comp->dev, "TDMs=x%08x, val=x%08x\n", priv->tdms, val); in fsl_audmix_put_out_src()
181 if (!(priv->tdms & BIT(mix_clk))) { in fsl_audmix_put_out_src()
182 dev_err(comp->dev, in fsl_audmix_put_out_src()
183 "Started TDM%d needed for config propagation!\n", in fsl_audmix_put_out_src()
185 return -EINVAL; in fsl_audmix_put_out_src()
209 SOC_ENUM("Sync Mode Config", fsl_audmix_enum[5]),
210 SOC_ENUM("Sync Mode Clk Source", fsl_audmix_enum[6]),
241 struct snd_soc_component *comp = dai->component; in fsl_audmix_dai_set_fmt()
249 return -EINVAL; in fsl_audmix_dai_set_fmt()
258 return -EINVAL; in fsl_audmix_dai_set_fmt()
271 return -EINVAL; in fsl_audmix_dai_set_fmt()
286 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) in fsl_audmix_dai_trigger()
293 spin_lock_irqsave(&priv->lock, lock_flags); in fsl_audmix_dai_trigger()
294 priv->tdms |= BIT(dai->driver->id); in fsl_audmix_dai_trigger()
295 spin_unlock_irqrestore(&priv->lock, lock_flags); in fsl_audmix_dai_trigger()
300 spin_lock_irqsave(&priv->lock, lock_flags); in fsl_audmix_dai_trigger()
301 priv->tdms &= ~BIT(dai->driver->id); in fsl_audmix_dai_trigger()
302 spin_unlock_irqrestore(&priv->lock, lock_flags); in fsl_audmix_dai_trigger()
305 return -EINVAL; in fsl_audmix_dai_trigger()
319 .name = "audmix-0",
321 .stream_name = "AUDMIX-Playback-0",
333 .name = "audmix-1",
335 .stream_name = "AUDMIX-Playback-1",
347 .name = "audmix-2",
349 .stream_name = "AUDMIX-Capture-0",
362 .name = "fsl-audmix-dai",
445 .compatible = "fsl,imx8qm-audmix",
453 struct device *dev = &pdev->dev; in fsl_audmix_probe()
460 return -ENOMEM; in fsl_audmix_probe()
467 priv->regmap = devm_regmap_init_mmio(dev, regs, &fsl_audmix_regmap_config); in fsl_audmix_probe()
468 if (IS_ERR(priv->regmap)) { in fsl_audmix_probe()
470 return PTR_ERR(priv->regmap); in fsl_audmix_probe()
473 priv->ipg_clk = devm_clk_get(dev, "ipg"); in fsl_audmix_probe()
474 if (IS_ERR(priv->ipg_clk)) { in fsl_audmix_probe()
476 return PTR_ERR(priv->ipg_clk); in fsl_audmix_probe()
479 spin_lock_init(&priv->lock); in fsl_audmix_probe()
491 priv->pdev = platform_device_register_data(dev, "imx-audmix", 0, NULL, 0); in fsl_audmix_probe()
492 if (IS_ERR(priv->pdev)) { in fsl_audmix_probe()
493 ret = PTR_ERR(priv->pdev); in fsl_audmix_probe()
507 struct fsl_audmix *priv = dev_get_drvdata(&pdev->dev); in fsl_audmix_remove()
509 pm_runtime_disable(&pdev->dev); in fsl_audmix_remove()
511 if (priv->pdev) in fsl_audmix_remove()
512 platform_device_unregister(priv->pdev); in fsl_audmix_remove()
520 ret = clk_prepare_enable(priv->ipg_clk); in fsl_audmix_runtime_resume()
526 regcache_cache_only(priv->regmap, false); in fsl_audmix_runtime_resume()
527 regcache_mark_dirty(priv->regmap); in fsl_audmix_runtime_resume()
529 return regcache_sync(priv->regmap); in fsl_audmix_runtime_resume()
536 regcache_cache_only(priv->regmap, true); in fsl_audmix_runtime_suspend()
538 clk_disable_unprepare(priv->ipg_clk); in fsl_audmix_runtime_suspend()
553 .name = "fsl-audmix",
562 MODULE_ALIAS("platform:fsl-audmix");