All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: rt1015p: delay 300ms after SDB pulling high for calibration
@ 2020-12-09  3:37 Tzung-Bi Shih
  2020-12-09  9:30 ` Jaroslav Kysela
  0 siblings, 1 reply; 3+ messages in thread
From: Tzung-Bi Shih @ 2020-12-09  3:37 UTC (permalink / raw)
  To: broonie; +Cc: tzungbi, alsa-devel

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:
-- 
2.29.2.576.ga3fc446d84-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: rt1015p: delay 300ms after SDB pulling high for calibration
  2020-12-09  3:37 [PATCH] ASoC: rt1015p: delay 300ms after SDB pulling high for calibration Tzung-Bi Shih
@ 2020-12-09  9:30 ` Jaroslav Kysela
  2020-12-09 12:11   ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Jaroslav Kysela @ 2020-12-09  9:30 UTC (permalink / raw)
  To: Tzung-Bi Shih, broonie; +Cc: alsa-devel

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

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: rt1015p: delay 300ms after SDB pulling high for calibration
  2020-12-09  9:30 ` Jaroslav Kysela
@ 2020-12-09 12:11   ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2020-12-09 12:11 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Tzung-Bi Shih, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 786 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-09 12:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09  3:37 [PATCH] ASoC: rt1015p: delay 300ms after SDB pulling high for calibration Tzung-Bi Shih
2020-12-09  9:30 ` Jaroslav Kysela
2020-12-09 12:11   ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.