MLK-19168-4: ASoC: fsl_rpmsg_i2s: support more codec

support more codecs, codec is specified by compatible string

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 7c92a75fcf83ec0aa3fe6773e4cb5f5e88a1ff09)
This commit is contained in:
Shengjiu Wang 2018-08-08 15:07:43 +08:00 committed by Dong Aisheng
parent 997f8ece23
commit 08cf70aa23
3 changed files with 28 additions and 5 deletions

View File

@ -7,7 +7,7 @@ serial interfaces with frame synchronization such as I2S.
Required properties:
- compatible : Compatible list, contains "fsl,imx7ulp-rpmsg-i2s".
"fsl,imx8mq-rpmsg-i2s"
"fsl,imx8mq-rpmsg-i2s", "fsl,imx8qxp-rpmsg-i2s"
- fsl,audioindex : This is an index indicating the audio device index in
the M4 side.

View File

@ -107,6 +107,7 @@ static const struct snd_soc_component_driver fsl_component = {
static const struct of_device_id fsl_rpmsg_i2s_ids[] = {
{ .compatible = "fsl,imx7ulp-rpmsg-i2s"},
{ .compatible = "fsl,imx8mq-rpmsg-i2s"},
{ .compatible = "fsl,imx8qxp-rpmsg-i2s"},
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, fsl_rpmsg_i2s_ids);
@ -170,7 +171,7 @@ static int fsl_rpmsg_i2s_probe(struct platform_device *pdev)
if (of_device_is_compatible(pdev->dev.of_node,
"fsl,imx7ulp-rpmsg-i2s")) {
rpmsg_i2s->codec = 1;
rpmsg_i2s->codec_wm8960 = 1;
rpmsg_i2s->version = 1;
rpmsg_i2s->rates = SNDRV_PCM_RATE_8000 |
SNDRV_PCM_RATE_16000 |
@ -182,9 +183,16 @@ static int fsl_rpmsg_i2s_probe(struct platform_device *pdev)
fsl_rpmsg_i2s_dai.capture.formats = rpmsg_i2s->formats;
}
if (of_device_is_compatible(pdev->dev.of_node,
"fsl,imx8qxp-rpmsg-i2s")) {
rpmsg_i2s->codec_wm8960 = 1 + (1 << 16);
rpmsg_i2s->version = 1;
rpmsg_i2s->codec_cs42888 = 1 + (2 << 16);
}
if (of_device_is_compatible(pdev->dev.of_node,
"fsl,imx8mq-rpmsg-i2s")) {
rpmsg_i2s->codec = 0;
rpmsg_i2s->codec_wm8960 = 0;
rpmsg_i2s->version = 2;
rpmsg_i2s->rates = SNDRV_PCM_RATE_32000 |
SNDRV_PCM_RATE_48000 |

View File

@ -410,7 +410,8 @@ struct fsl_rpmsg_i2s {
struct platform_device *pdev;
struct i2s_info i2s_info;
struct pm_qos_request pm_qos_req;
int codec;
int codec_wm8960;
int codec_cs42888;
int force_lpa;
int version;
int rates;
@ -418,6 +419,20 @@ struct fsl_rpmsg_i2s {
int enable_lpa;
};
#define RPMSG_CODEC_DRV_NAME "rpmsg-audio-codec"
#define RPMSG_CODEC_DRV_NAME_WM8960 "rpmsg-audio-codec-wm8960"
#define RPMSG_CODEC_DRV_NAME_CS42888 "rpmsg-audio-codec-cs42888"
struct fsl_rpmsg_codec {
int audioindex;
/*property for wm8960*/
bool capless;
bool shared_lrclk;
/*property for cs42xx8*/
char name[32];
int num_adcs;
};
#endif /* __FSL_RPMSG_I2S_H */