From b906f677030bcb1d2591019eb361f99c7e8d84c5 Mon Sep 17 00:00:00 2001 From: Sugar Zhang Date: Wed, 27 Oct 2021 10:24:00 +0800 Subject: [PATCH] ASoC: rk_codec_digital: Add support for rk3588 SoC This patch adds support for rk3588 SoC. Signed-off-by: Sugar Zhang Change-Id: I8dbd270afce20f6c2f3573a15129c4dff8eb1b12 --- sound/soc/codecs/rk_codec_digital.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/sound/soc/codecs/rk_codec_digital.c b/sound/soc/codecs/rk_codec_digital.c index ec91b72fa6de..1cb7baf7ba89 100644 --- a/sound/soc/codecs/rk_codec_digital.c +++ b/sound/soc/codecs/rk_codec_digital.c @@ -24,6 +24,7 @@ #include "rk_codec_digital.h" #define RK3568_GRF_SOC_CON2 (0x0508) +#define RK3588_GRF_SOC_CON6 (0x0318) #define RV1126_GRF_SOC_CON2 (0x0008) struct rk_codec_digital_soc_data { @@ -882,6 +883,33 @@ static const struct rk_codec_digital_soc_data rk3568_data = { .deinit = rk3568_soc_deinit, }; +static int rk3588_soc_init(struct device *dev) +{ + struct rk_codec_digital_priv *rcd = dev_get_drvdata(dev); + + if (IS_ERR(rcd->grf)) + return PTR_ERR(rcd->grf); + + /* enable internal codec to i2s3 */ + return regmap_write(rcd->grf, RK3588_GRF_SOC_CON6, + (BIT(11) << 16 | BIT(11))); +} + +static void rk3588_soc_deinit(struct device *dev) +{ + struct rk_codec_digital_priv *rcd = dev_get_drvdata(dev); + + if (IS_ERR(rcd->grf)) + return; + + regmap_write(rcd->grf, RK3588_GRF_SOC_CON6, (BIT(11) << 16)); +} + +static const struct rk_codec_digital_soc_data rk3588_data = { + .init = rk3588_soc_init, + .deinit = rk3588_soc_deinit, +}; + static int rv1126_soc_init(struct device *dev) { struct rk_codec_digital_priv *rcd = dev_get_drvdata(dev); @@ -913,6 +941,7 @@ static const struct rk_codec_digital_soc_data rv1126_data = { static const struct of_device_id rcd_of_match[] = { { .compatible = "rockchip,codec-digital-v1", }, { .compatible = "rockchip,rk3568-codec-digital", .data = &rk3568_data }, + { .compatible = "rockchip,rk3588-codec-digital", .data = &rk3588_data }, { .compatible = "rockchip,rv1126-codec-digital", .data = &rv1126_data }, {}, };