Skip to content

Commit 1075df4

Browse files
jason77-wangbroonie
authored andcommitted
ASoC: fsl-asoc-card: add nau8822 support
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> Link: https://lore.kernel.org/r/Message-Id: <20220616040046.103524-1-hui.wang@canonical.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 320d0e2 commit 1075df4

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

sound/soc/fsl/fsl-asoc-card.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "../codecs/wm8960.h"
2828
#include "../codecs/wm8994.h"
2929
#include "../codecs/tlv320aic31xx.h"
30+
#include "../codecs/nau8822.h"
3031

3132
#define DRIVER_NAME "fsl-asoc-card"
3233

@@ -47,6 +48,7 @@
4748
* @pll_id: PLL id for set_pll()
4849
*/
4950
struct codec_priv {
51+
struct clk *mclk;
5052
unsigned long mclk_freq;
5153
unsigned long free_freq;
5254
u32 mclk_id;
@@ -524,6 +526,9 @@ static int fsl_asoc_card_late_probe(struct snd_soc_card *card)
524526
return ret;
525527
}
526528

529+
if (!IS_ERR_OR_NULL(codec_priv->mclk))
530+
clk_prepare_enable(codec_priv->mclk);
531+
527532
return 0;
528533
}
529534

@@ -686,6 +691,14 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
686691
priv->codec_priv.free_freq = priv->codec_priv.mclk_freq;
687692
priv->card.dapm_routes = NULL;
688693
priv->card.num_dapm_routes = 0;
694+
} else if (of_device_is_compatible(np, "fsl,imx-audio-nau8822")) {
695+
codec_dai_name = "nau8822-hifi";
696+
priv->codec_priv.mclk_id = NAU8822_CLK_MCLK;
697+
priv->codec_priv.fll_id = NAU8822_CLK_PLL;
698+
priv->codec_priv.pll_id = NAU8822_CLK_PLL;
699+
priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
700+
if (codec_dev)
701+
priv->codec_priv.mclk = devm_clk_get(codec_dev, NULL);
689702
} else {
690703
dev_err(&pdev->dev, "unknown Device Tree compatible\n");
691704
ret = -EINVAL;
@@ -911,6 +924,7 @@ static const struct of_device_id fsl_asoc_card_dt_ids[] = {
911924
{ .compatible = "fsl,imx-audio-wm8524", },
912925
{ .compatible = "fsl,imx-audio-si476x", },
913926
{ .compatible = "fsl,imx-audio-wm8958", },
927+
{ .compatible = "fsl,imx-audio-nau8822", },
914928
{}
915929
};
916930
MODULE_DEVICE_TABLE(of, fsl_asoc_card_dt_ids);

0 commit comments

Comments
 (0)