Skip to contentSkip to conversation

ASoC: rt1015p: delay 300ms after SDB pulling high for calibration

PATCH In review Tzung-Bi Shih 3 participants 3 messages Dec 9, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 sound/soc/codecs/rt1015p.c | 7 +++++++
 1 file changed, 7 insertions(+)
sound/soc/codecs/rt1015p.c +7 -0
index 59bb60682270..515357474eba 100644
@@ -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:
Signature · 1 line
2.29.2.576.ga3fc446d84-goog
maintainer
#1 lore raw

Dne 09. 12. 20 v 4:37 Tzung-Bi Shih napsal(a):

Quoted 4 lines

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

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
maintainer
#2 lore raw
Quoted 10 lines · Jaroslav Kysela

Dne 09. 12. 20 v 4:37 Tzung-Bi Shih napsal(a):

Quoted 4 lines

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.