diff options
author | Jack Yu <jack.yu@realtek.com> | 2021-09-29 08:43:44 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-09-30 17:23:47 +0300 |
commit | 57589f82762e40bdaa975d840fa2bc5157b5be95 (patch) | |
tree | 357e3df52fabf18f2f86e08d408309da854c142c /sound/soc/codecs/rt5682-i2c.c | |
parent | 2cbf90a6d52d52fc017f3caf36f7b516f689150e (diff) | |
download | linux-57589f82762e40bdaa975d840fa2bc5157b5be95.tar.xz |
ASoC: rt5682: move clk related code to rt5682_i2c_probe
The DAI clock is only used in I2S mode, to make it clear
and to fix clock resource release issue, we move CCF clock
related code to rt5682_i2c_probe to fix clock
register/unregister issue.
Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20210929054344.12112-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/rt5682-i2c.c')
-rw-r--r-- | sound/soc/codecs/rt5682-i2c.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c index b9d5d7a0975b..a30e42932cf7 100644 --- a/sound/soc/codecs/rt5682-i2c.c +++ b/sound/soc/codecs/rt5682-i2c.c @@ -139,6 +139,8 @@ static int rt5682_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, rt5682); + rt5682->i2c_dev = &i2c->dev; + rt5682->pdata = i2s_default_platform_data; if (pdata) @@ -276,6 +278,26 @@ static int rt5682_i2c_probe(struct i2c_client *i2c, dev_err(&i2c->dev, "Failed to reguest IRQ: %d\n", ret); } +#ifdef CONFIG_COMMON_CLK + /* Check if MCLK provided */ + rt5682->mclk = devm_clk_get(&i2c->dev, "mclk"); + if (IS_ERR(rt5682->mclk)) { + if (PTR_ERR(rt5682->mclk) != -ENOENT) { + ret = PTR_ERR(rt5682->mclk); + return ret; + } + rt5682->mclk = NULL; + } + + /* Register CCF DAI clock control */ + ret = rt5682_register_dai_clks(rt5682); + if (ret) + return ret; + + /* Initial setup for CCF */ + rt5682->lrck[RT5682_AIF1] = 48000; +#endif + return devm_snd_soc_register_component(&i2c->dev, &rt5682_soc_component_dev, rt5682_dai, ARRAY_SIZE(rt5682_dai)); |