[PATCH] ASoC: rt1015p: delay 300ms after SDB pulling high for calibration
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:
Dne 09. 12. 20 v 4:37 Tzung-Bi Shih napsal(a):
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.
I think that this codec driver should be redesigned to add this power-up delay the the correct sequence like in rt1015.c - rt1015_amp_drv_event().
Those huge delays in the trigger callbacks looks and are messy.
Jaroslav
On Wed, Dec 09, 2020 at 10:30:43AM +0100, Jaroslav Kysela wrote:
Dne 09. 12. 20 v 4:37 Tzung-Bi Shih napsal(a):
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.
I think that this codec driver should be redesigned to add this power-up delay the the correct sequence like in rt1015.c - rt1015_amp_drv_event().
Those huge delays in the trigger callbacks looks and are messy.
Right, trigger is supposed to be very fast and this sort of stuff would normally be part of the power up sequence and those are handled through DAPM. set_bias_level() is another option for placing this sort of thing depending on what exactly is being controlled here.
participants (3)
-
Jaroslav Kysela
-
Mark Brown
-
Tzung-Bi Shih