diff mbox series

[1/2] ASoC: fsl-asoc-card: add nau8822 support

Message ID 20220616040046.103524-1-hui.wang@canonical.com (mailing list archive)
State New, archived
Headers show
Series [1/2] ASoC: fsl-asoc-card: add nau8822 support | expand

Commit Message

Hui Wang June 16, 2022, 4 a.m. UTC
This is for an imx6sx EVB which has a nau8822 codec connects to the
SSI2 interface, so add the nau8822 support in this machine driver.

Because the codec driver nau8822.c doesn't handle mclk enabling, here
adding a codec_priv->mclk for nau8822 and similar codecs which need to
enable the mclk in the machine driver, and enable the mclk in the
card_late_probe() conditionally.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
 sound/soc/fsl/fsl-asoc-card.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Mark Brown June 22, 2023, 9:42 p.m. UTC | #1
On Thu, 16 Jun 2022 12:00:45 +0800, Hui Wang wrote:
> This is for an imx6sx EVB which has a nau8822 codec connects to the
> SSI2 interface, so add the nau8822 support in this machine driver.
> 
> Because the codec driver nau8822.c doesn't handle mclk enabling, here
> adding a codec_priv->mclk for nau8822 and similar codecs which need to
> enable the mclk in the machine driver, and enable the mclk in the
> card_late_probe() conditionally.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: fsl-asoc-card: add nau8822 support
      commit: 1075df4bdeb320bbf94a1f6d3761391264eb2c7f
[2/2] ASoC: bindings: fsl-asoc-card: add compatible string for nau8822 codec
      commit: 424a64a2bbc6014c76b9ef6356d38ad8e66d95ad

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index d9a0d4768c4d..89504865cb1d 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -27,6 +27,7 @@ 
 #include "../codecs/wm8960.h"
 #include "../codecs/wm8994.h"
 #include "../codecs/tlv320aic31xx.h"
+#include "../codecs/nau8822.h"
 
 #define CS427x_SYSCLK_MCLK 0
 
@@ -45,6 +46,7 @@ 
  * @pll_id: PLL id for set_pll()
  */
 struct codec_priv {
+	struct clk *mclk;
 	unsigned long mclk_freq;
 	unsigned long free_freq;
 	u32 mclk_id;
@@ -522,6 +524,9 @@  static int fsl_asoc_card_late_probe(struct snd_soc_card *card)
 		return ret;
 	}
 
+	if (!IS_ERR_OR_NULL(codec_priv->mclk))
+		clk_prepare_enable(codec_priv->mclk);
+
 	return 0;
 }
 
@@ -682,6 +687,14 @@  static int fsl_asoc_card_probe(struct platform_device *pdev)
 		priv->codec_priv.free_freq = priv->codec_priv.mclk_freq;
 		priv->card.dapm_routes = NULL;
 		priv->card.num_dapm_routes = 0;
+	} else if (of_device_is_compatible(np, "fsl,imx-audio-nau8822")) {
+		codec_dai_name = "nau8822-hifi";
+		priv->codec_priv.mclk_id = NAU8822_CLK_MCLK;
+		priv->codec_priv.fll_id = NAU8822_CLK_PLL;
+		priv->codec_priv.pll_id = NAU8822_CLK_PLL;
+		priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
+		if (codec_dev)
+			priv->codec_priv.mclk = devm_clk_get(codec_dev, NULL);
 	} else {
 		dev_err(&pdev->dev, "unknown Device Tree compatible\n");
 		ret = -EINVAL;
@@ -907,6 +920,7 @@  static const struct of_device_id fsl_asoc_card_dt_ids[] = {
 	{ .compatible = "fsl,imx-audio-wm8524", },
 	{ .compatible = "fsl,imx-audio-si476x", },
 	{ .compatible = "fsl,imx-audio-wm8958", },
+	{ .compatible = "fsl,imx-audio-nau8822", },
 	{}
 };
 MODULE_DEVICE_TABLE(of, fsl_asoc_card_dt_ids);