Lines Matching +full:imx93 +full:- +full:iomuxc
1 // SPDX-License-Identifier: GPL-2.0
5 // Copyright (C) 2014-2015 Freescale Semiconductor, Inc.
12 #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
34 * struct fsl_mqs_soc_data - soc specific data
77 struct snd_soc_component *component = dai->component; in fsl_mqs_hw_params()
83 mclk_rate = clk_get_rate(mqs_priv->mclk); in fsl_mqs_hw_params()
95 regmap_update_bits(mqs_priv->regmap, mqs_priv->soc->ctrl_off, in fsl_mqs_hw_params()
96 mqs_priv->soc->div_mask, in fsl_mqs_hw_params()
97 (div - 1) << mqs_priv->soc->div_shift); in fsl_mqs_hw_params()
98 regmap_update_bits(mqs_priv->regmap, mqs_priv->soc->ctrl_off, in fsl_mqs_hw_params()
99 mqs_priv->soc->osr_mask, 0); in fsl_mqs_hw_params()
101 dev_err(component->dev, "can't get proper divider\n"); in fsl_mqs_hw_params()
114 return -EINVAL; in fsl_mqs_set_dai_fmt()
121 return -EINVAL; in fsl_mqs_set_dai_fmt()
128 return -EINVAL; in fsl_mqs_set_dai_fmt()
137 struct snd_soc_component *component = dai->component; in fsl_mqs_startup()
140 regmap_update_bits(mqs_priv->regmap, mqs_priv->soc->ctrl_off, in fsl_mqs_startup()
141 mqs_priv->soc->en_mask, in fsl_mqs_startup()
142 1 << mqs_priv->soc->en_shift); in fsl_mqs_startup()
149 struct snd_soc_component *component = dai->component; in fsl_mqs_shutdown()
152 regmap_update_bits(mqs_priv->regmap, mqs_priv->soc->ctrl_off, in fsl_mqs_shutdown()
153 mqs_priv->soc->en_mask, 0); in fsl_mqs_shutdown()
168 .name = "fsl-mqs-dai",
189 struct device_node *np = pdev->dev.of_node; in fsl_mqs_probe()
195 mqs_priv = devm_kzalloc(&pdev->dev, sizeof(*mqs_priv), GFP_KERNEL); in fsl_mqs_probe()
197 return -ENOMEM; in fsl_mqs_probe()
203 mqs_priv->soc = of_device_get_match_data(&pdev->dev); in fsl_mqs_probe()
205 if (mqs_priv->soc->use_gpr) { in fsl_mqs_probe()
208 dev_err(&pdev->dev, "failed to get gpr node by phandle\n"); in fsl_mqs_probe()
209 return -EINVAL; in fsl_mqs_probe()
212 mqs_priv->regmap = syscon_node_to_regmap(gpr_np); in fsl_mqs_probe()
214 if (IS_ERR(mqs_priv->regmap)) { in fsl_mqs_probe()
215 dev_err(&pdev->dev, "failed to get gpr regmap\n"); in fsl_mqs_probe()
216 return PTR_ERR(mqs_priv->regmap); in fsl_mqs_probe()
223 mqs_priv->regmap = devm_regmap_init_mmio_clk(&pdev->dev, in fsl_mqs_probe()
227 if (IS_ERR(mqs_priv->regmap)) { in fsl_mqs_probe()
228 dev_err(&pdev->dev, "failed to init regmap: %ld\n", in fsl_mqs_probe()
229 PTR_ERR(mqs_priv->regmap)); in fsl_mqs_probe()
230 return PTR_ERR(mqs_priv->regmap); in fsl_mqs_probe()
233 mqs_priv->ipg = devm_clk_get(&pdev->dev, "core"); in fsl_mqs_probe()
234 if (IS_ERR(mqs_priv->ipg)) { in fsl_mqs_probe()
235 dev_err(&pdev->dev, "failed to get the clock: %ld\n", in fsl_mqs_probe()
236 PTR_ERR(mqs_priv->ipg)); in fsl_mqs_probe()
237 return PTR_ERR(mqs_priv->ipg); in fsl_mqs_probe()
241 mqs_priv->mclk = devm_clk_get(&pdev->dev, "mclk"); in fsl_mqs_probe()
242 if (IS_ERR(mqs_priv->mclk)) { in fsl_mqs_probe()
243 dev_err(&pdev->dev, "failed to get the clock: %ld\n", in fsl_mqs_probe()
244 PTR_ERR(mqs_priv->mclk)); in fsl_mqs_probe()
245 return PTR_ERR(mqs_priv->mclk); in fsl_mqs_probe()
248 dev_set_drvdata(&pdev->dev, mqs_priv); in fsl_mqs_probe()
249 pm_runtime_enable(&pdev->dev); in fsl_mqs_probe()
251 ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_fsl_mqs, in fsl_mqs_probe()
261 pm_runtime_disable(&pdev->dev); in fsl_mqs_remove()
270 ret = clk_prepare_enable(mqs_priv->ipg); in fsl_mqs_runtime_resume()
276 ret = clk_prepare_enable(mqs_priv->mclk); in fsl_mqs_runtime_resume()
279 clk_disable_unprepare(mqs_priv->ipg); in fsl_mqs_runtime_resume()
283 regmap_write(mqs_priv->regmap, mqs_priv->soc->ctrl_off, mqs_priv->reg_mqs_ctrl); in fsl_mqs_runtime_resume()
291 regmap_read(mqs_priv->regmap, mqs_priv->soc->ctrl_off, &mqs_priv->reg_mqs_ctrl); in fsl_mqs_runtime_suspend()
293 clk_disable_unprepare(mqs_priv->mclk); in fsl_mqs_runtime_suspend()
294 clk_disable_unprepare(mqs_priv->ipg); in fsl_mqs_runtime_suspend()
348 { .compatible = "fsl,imx8qm-mqs", .data = &fsl_mqs_imx8qm_data },
349 { .compatible = "fsl,imx6sx-mqs", .data = &fsl_mqs_imx6sx_data },
350 { .compatible = "fsl,imx93-mqs", .data = &fsl_mqs_imx93_data },
359 .name = "fsl-mqs",
370 MODULE_ALIAS("platform:fsl-mqs");