* [PATCH 0/2] ASoC: imx-card: add cs42888 codec support
@ 2024-10-09 7:46 Shengjiu Wang
2024-10-09 7:46 ` [PATCH 1/2] ASoC: imx-card: Set mclk for codec Shengjiu Wang
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Shengjiu Wang @ 2024-10-09 7:46 UTC (permalink / raw)
To: shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood,
broonie, perex, tiwai, alsa-devel, linuxppc-dev, linux-sound,
linux-kernel, chancel.liu
add cs42888 codec support
Chancel Liu (2):
ASoC: imx-card: Set mclk for codec
ASoC: imx-card: Add CS42888 support
sound/soc/fsl/imx-card.c | 59 +++++++++++++++++++++++++++++++++++-----
1 file changed, 52 insertions(+), 7 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] ASoC: imx-card: Set mclk for codec
2024-10-09 7:46 [PATCH 0/2] ASoC: imx-card: add cs42888 codec support Shengjiu Wang
@ 2024-10-09 7:46 ` Shengjiu Wang
2024-10-09 7:46 ` [PATCH 2/2] ASoC: imx-card: Add CS42888 support Shengjiu Wang
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Shengjiu Wang @ 2024-10-09 7:46 UTC (permalink / raw)
To: shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood,
broonie, perex, tiwai, alsa-devel, linuxppc-dev, linux-sound,
linux-kernel, chancel.liu
From: Chancel Liu <chancel.liu@nxp.com>
In some cases, ASoC machine driver may modify the mclk frequency
according to sample rate but the value in codec is still initial
frequency which should be replaced. For example, we should update
mclk before setup for cs42xx8 mclk relating registers.
Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
sound/soc/fsl/imx-card.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c
index a7215bad6484..2f3dbbd15791 100644
--- a/sound/soc/fsl/imx-card.c
+++ b/sound/soc/fsl/imx-card.c
@@ -370,6 +370,11 @@ static int imx_aif_hw_params(struct snd_pcm_substream *substream,
dev_err(dev, "failed to set cpui dai mclk1 rate (%lu): %d\n", mclk_freq, ret);
return ret;
}
+ ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk_freq, SND_SOC_CLOCK_IN);
+ if (ret && ret != -ENOTSUPP) {
+ dev_err(dev, "failed to set codec dai mclk rate (%lu): %d\n", mclk_freq, ret);
+ return ret;
+ }
return 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] ASoC: imx-card: Add CS42888 support
2024-10-09 7:46 [PATCH 0/2] ASoC: imx-card: add cs42888 codec support Shengjiu Wang
2024-10-09 7:46 ` [PATCH 1/2] ASoC: imx-card: Set mclk for codec Shengjiu Wang
@ 2024-10-09 7:46 ` Shengjiu Wang
2024-10-10 8:11 ` [PATCH 0/2] ASoC: imx-card: add cs42888 codec support Iuliana Prodan
2024-10-12 12:50 ` Mark Brown
3 siblings, 0 replies; 5+ messages in thread
From: Shengjiu Wang @ 2024-10-09 7:46 UTC (permalink / raw)
To: shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood,
broonie, perex, tiwai, alsa-devel, linuxppc-dev, linux-sound,
linux-kernel, chancel.liu
From: Chancel Liu <chancel.liu@nxp.com>
CS42888 codec provides 4 multi-bit ADC and 8 multi-bit DAC.
Add support for this codec in imx-card ASoC machine driver.
Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
sound/soc/fsl/imx-card.c | 54 ++++++++++++++++++++++++++++++++++------
1 file changed, 47 insertions(+), 7 deletions(-)
diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c
index 2f3dbbd15791..306168b164d3 100644
--- a/sound/soc/fsl/imx-card.c
+++ b/sound/soc/fsl/imx-card.c
@@ -25,6 +25,7 @@ enum codec_type {
CODEC_AK4458,
CODEC_AK4497,
CODEC_AK5552,
+ CODEC_CS42888,
};
/*
@@ -185,6 +186,16 @@ static struct imx_akcodec_tdm_fs_mul ak5558_tdm_fs_mul[] = {
{ .min = 512, .max = 512, .mul = 1024 },
};
+static struct imx_akcodec_fs_mul cs42888_fs_mul[] = {
+ { .rmin = 8000, .rmax = 48000, .wmin = 256, .wmax = 1024, },
+ { .rmin = 64000, .rmax = 96000, .wmin = 128, .wmax = 512, },
+ { .rmin = 176400, .rmax = 192000, .wmin = 64, .wmax = 256, },
+};
+
+static struct imx_akcodec_tdm_fs_mul cs42888_tdm_fs_mul[] = {
+ { .min = 256, .max = 256, .mul = 256 },
+};
+
static const u32 akcodec_rates[] = {
8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200,
96000, 176400, 192000, 352800, 384000, 705600, 768000,
@@ -210,6 +221,14 @@ static const u32 ak5558_tdm_channels[] = {
1, 2, 3, 4, 5, 6, 7, 8,
};
+static const u32 cs42888_channels[] = {
+ 1, 2, 4, 6, 8,
+};
+
+static const u32 cs42888_tdm_channels[] = {
+ 1, 2, 3, 4, 5, 6, 7, 8,
+};
+
static bool format_is_dsd(struct snd_pcm_hw_params *params)
{
snd_pcm_format_t format = params_format(params);
@@ -241,6 +260,7 @@ static bool codec_is_akcodec(unsigned int type)
case CODEC_AK4497:
case CODEC_AK5558:
case CODEC_AK5552:
+ case CODEC_CS42888:
return true;
default:
break;
@@ -340,13 +360,15 @@ static int imx_aif_hw_params(struct snd_pcm_substream *substream,
return ret;
}
- ret = snd_soc_dai_set_tdm_slot(codec_dai,
- BIT(slots) - 1,
- BIT(slots) - 1,
- slots, slot_width);
- if (ret && ret != -ENOTSUPP) {
- dev_err(dev, "failed to set codec dai[%d] tdm slot: %d\n", i, ret);
- return ret;
+ if (format_is_tdm(link_data)) {
+ ret = snd_soc_dai_set_tdm_slot(codec_dai,
+ BIT(slots) - 1,
+ BIT(slots) - 1,
+ slots, slot_width);
+ if (ret && ret != -ENOTSUPP) {
+ dev_err(dev, "failed to set codec dai[%d] tdm slot: %d\n", i, ret);
+ return ret;
+ }
}
}
@@ -609,6 +631,8 @@ static int imx_card_parse_of(struct imx_card_data *data)
plat_data->type = CODEC_AK5558;
else if (!strcmp(link->codecs->dai_name, "ak5552-aif"))
plat_data->type = CODEC_AK5552;
+ else if (!strcmp(link->codecs->dai_name, "cs42888"))
+ plat_data->type = CODEC_CS42888;
} else {
link->codecs = &snd_soc_dummy_dlc;
@@ -766,6 +790,12 @@ static int imx_card_probe(struct platform_device *pdev)
data->dapm_routes[i].sink = "ASRC-Capture";
data->dapm_routes[i].source = "CPU-Capture";
break;
+ case CODEC_CS42888:
+ data->dapm_routes[0].sink = "Playback";
+ data->dapm_routes[0].source = "CPU-Playback";
+ data->dapm_routes[1].sink = "CPU-Capture";
+ data->dapm_routes[1].source = "Capture";
+ break;
default:
break;
}
@@ -805,6 +835,16 @@ static int imx_card_probe(struct platform_device *pdev)
plat_data->support_tdm_channels = ak5558_tdm_channels;
plat_data->num_tdm_channels = ARRAY_SIZE(ak5558_tdm_channels);
break;
+ case CODEC_CS42888:
+ plat_data->fs_mul = cs42888_fs_mul;
+ plat_data->num_fs_mul = ARRAY_SIZE(cs42888_fs_mul);
+ plat_data->tdm_fs_mul = cs42888_tdm_fs_mul;
+ plat_data->num_tdm_fs_mul = ARRAY_SIZE(cs42888_tdm_fs_mul);
+ plat_data->support_channels = cs42888_channels;
+ plat_data->num_channels = ARRAY_SIZE(cs42888_channels);
+ plat_data->support_tdm_channels = cs42888_tdm_channels;
+ plat_data->num_tdm_channels = ARRAY_SIZE(cs42888_tdm_channels);
+ break;
default:
break;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] ASoC: imx-card: add cs42888 codec support
2024-10-09 7:46 [PATCH 0/2] ASoC: imx-card: add cs42888 codec support Shengjiu Wang
2024-10-09 7:46 ` [PATCH 1/2] ASoC: imx-card: Set mclk for codec Shengjiu Wang
2024-10-09 7:46 ` [PATCH 2/2] ASoC: imx-card: Add CS42888 support Shengjiu Wang
@ 2024-10-10 8:11 ` Iuliana Prodan
2024-10-12 12:50 ` Mark Brown
3 siblings, 0 replies; 5+ messages in thread
From: Iuliana Prodan @ 2024-10-10 8:11 UTC (permalink / raw)
To: Shengjiu Wang, shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka,
lgirdwood, broonie, perex, tiwai, alsa-devel, linuxppc-dev,
linux-sound, linux-kernel, chancel.liu
On 10/9/2024 10:46 AM, Shengjiu Wang wrote:
> add cs42888 codec support
>
> Chancel Liu (2):
> ASoC: imx-card: Set mclk for codec
> ASoC: imx-card: Add CS42888 support
For the series:
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Thanks,
Iulia
> sound/soc/fsl/imx-card.c | 59 +++++++++++++++++++++++++++++++++++-----
> 1 file changed, 52 insertions(+), 7 deletions(-)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] ASoC: imx-card: add cs42888 codec support
2024-10-09 7:46 [PATCH 0/2] ASoC: imx-card: add cs42888 codec support Shengjiu Wang
` (2 preceding siblings ...)
2024-10-10 8:11 ` [PATCH 0/2] ASoC: imx-card: add cs42888 codec support Iuliana Prodan
@ 2024-10-12 12:50 ` Mark Brown
3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2024-10-12 12:50 UTC (permalink / raw)
To: shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood,
perex, tiwai, alsa-devel, linuxppc-dev, linux-sound, linux-kernel,
chancel.liu, Shengjiu Wang
On Wed, 09 Oct 2024 15:46:42 +0800, Shengjiu Wang wrote:
> add cs42888 codec support
>
> Chancel Liu (2):
> ASoC: imx-card: Set mclk for codec
> ASoC: imx-card: Add CS42888 support
>
> sound/soc/fsl/imx-card.c | 59 +++++++++++++++++++++++++++++++++++-----
> 1 file changed, 52 insertions(+), 7 deletions(-)
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: imx-card: Set mclk for codec
commit: 892373e4de626c61e91816e3d3970d82beb50c4b
[2/2] ASoC: imx-card: Add CS42888 support
commit: b39eec95b84d5dc326c3d7c89e4e08b898dbc73c
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-10-12 12:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 7:46 [PATCH 0/2] ASoC: imx-card: add cs42888 codec support Shengjiu Wang
2024-10-09 7:46 ` [PATCH 1/2] ASoC: imx-card: Set mclk for codec Shengjiu Wang
2024-10-09 7:46 ` [PATCH 2/2] ASoC: imx-card: Add CS42888 support Shengjiu Wang
2024-10-10 8:11 ` [PATCH 0/2] ASoC: imx-card: add cs42888 codec support Iuliana Prodan
2024-10-12 12:50 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).