diff options
author | Oder Chiou <oder_chiou@realtek.com> | 2016-10-25 19:27:26 +0800 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-10-25 14:25:36 +0100 |
commit | a5461fd6c8f70b3d897f5f76612e890ad47a5b93 (patch) | |
tree | 88469f7316b8590c9b1e7484fd5a5a84fdae1767 /sound/soc/codecs/rt5514.c | |
parent | 1001354ca34179f3db924eb66672442a173147dc (diff) | |
download | op-kernel-dev-a5461fd6c8f70b3d897f5f76612e890ad47a5b93.zip op-kernel-dev-a5461fd6c8f70b3d897f5f76612e890ad47a5b93.tar.gz |
ASoC: rt5514: Add the DMIC initial delay to wait it ready.
Due to the DMIC that needs time to initial after the MCLK is provided, the
field of delay time is implemented by the platform data.
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/rt5514.c')
-rw-r--r-- | sound/soc/codecs/rt5514.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c index f24b7cf..b281a46 100644 --- a/sound/soc/codecs/rt5514.c +++ b/sound/soc/codecs/rt5514.c @@ -452,6 +452,9 @@ static int rt5514_set_dmic_clk(struct snd_soc_dapm_widget *w, RT5514_CLK_DMIC_OUT_SEL_MASK, idx << RT5514_CLK_DMIC_OUT_SEL_SFT); + if (rt5514->pdata.dmic_init_delay) + msleep(rt5514->pdata.dmic_init_delay); + return idx; } @@ -1073,9 +1076,18 @@ static const struct of_device_id rt5514_of_match[] = { MODULE_DEVICE_TABLE(of, rt5514_of_match); #endif +static int rt5514_parse_dt(struct rt5514_priv *rt5514, struct device *dev) +{ + device_property_read_u32(dev, "realtek,dmic-init-delay-ms", + &rt5514->pdata.dmic_init_delay); + + return 0; +} + static int rt5514_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { + struct rt5514_platform_data *pdata = dev_get_platdata(&i2c->dev); struct rt5514_priv *rt5514; int ret; unsigned int val; @@ -1087,6 +1099,11 @@ static int rt5514_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, rt5514); + if (pdata) + rt5514->pdata = *pdata; + else if (i2c->dev.of_node) + rt5514_parse_dt(rt5514, &i2c->dev); + rt5514->i2c_regmap = devm_regmap_init_i2c(i2c, &rt5514_i2c_regmap); if (IS_ERR(rt5514->i2c_regmap)) { ret = PTR_ERR(rt5514->i2c_regmap); |