RT1015p needs 300ms delay after SDB pulling high for internal calibration during the power on sequence.
Delays 300ms right before data sends out to avoid data truncated.
Signed-off-by: Tzung-Bi Shih tzungbi@google.com --- sound/soc/codecs/rt1015p.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/sound/soc/codecs/rt1015p.c b/sound/soc/codecs/rt1015p.c index 59bb60682270..515357474eba 100644 --- a/sound/soc/codecs/rt1015p.c +++ b/sound/soc/codecs/rt1015p.c @@ -4,6 +4,7 @@ // // Copyright 2020 The Linux Foundation. All rights reserved.
+#include <linux/delay.h> #include <linux/device.h> #include <linux/err.h> #include <linux/gpio.h> @@ -20,6 +21,7 @@ struct rt1015p_priv { struct gpio_desc *sdb; int sdb_switch; + bool calib_done; };
static int rt1015p_daiops_trigger(struct snd_pcm_substream *substream, @@ -39,6 +41,11 @@ static int rt1015p_daiops_trigger(struct snd_pcm_substream *substream, if (rt1015p->sdb_switch) { gpiod_set_value(rt1015p->sdb, 1); dev_dbg(component->dev, "set sdb to 1"); + + if (!rt1015p->calib_done) { + mdelay(300); + rt1015p->calib_done = true; + } } break; case SNDRV_PCM_TRIGGER_STOP: