Skip to contentSkip to conversation

ASoC: Intel: Reset hw_ptr on resume trigger

PATCH In review Cheng-Yi Chiang 4 participants 7 messages Jul 31, 2017 – Aug 7, 2017

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

PATCH v2 1/1 ASoC: Intel: Reset hw_ptr on resume trigger

From: "U. Artie Eoff" <[email protected]>

Reset the hw_ptr before queuing the restore_stream_context work to eradicate a nasty white audio noise on resume.

---
 sound/soc/intel/baytrail/sst-baytrail-pcm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/intel/baytrail/sst-baytrail-pcm.c +3 -1
index 4765ad474544..e0db7070cd42 100644
@@ -187,8 +187,10 @@ static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 		sst_byt_stream_start(byt, pcm_data->stream, 0);
 		break;
 	case SNDRV_PCM_TRIGGER_RESUME:
-		if (pdata->restore_stream == true)
+		if (pdata->restore_stream == true) {
+			pcm_data->hw_ptr = 0;
 			schedule_work(&pcm_data->work);
+		}
 		else
 			sst_byt_stream_resume(byt, pcm_data->stream);
 		break;
Signature · 1 line
2.12.2
#1 lore raw
Quoted 4 lines · Cheng-Yi Chiang

From: "U. Artie Eoff" <[email protected]>

Reset the hw_ptr before queuing the restore_stream_context work to eradicate a nasty white audio noise on resume.

Liam, Jie? This on legacy BYT driver..

Quoted 27 lines
---
 sound/soc/intel/baytrail/sst-baytrail-pcm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/intel/baytrail/sst-baytrail-pcm.c +3 -1
index 4765ad474544..e0db7070cd42 100644
@@ -187,8 +187,10 @@ static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 		sst_byt_stream_start(byt, pcm_data->stream, 0);
 		break;
 	case SNDRV_PCM_TRIGGER_RESUME:
-		if (pdata->restore_stream == true)
+		if (pdata->restore_stream == true) {
+			pcm_data->hw_ptr = 0;
 			schedule_work(&pcm_data->work);
+		}
 		else
 			sst_byt_stream_resume(byt, pcm_data->stream);
 		break;
Signature · 1 line
2.12.2
Signature · 1 line
~Vinod
#2 lore raw

This patch was originally submitted in the context of the ChromiumOS kernel 3.10 for BYT (https://groups.google.com/a/chromium.org/forum/#!topic/chromium-os-reviews/AsoBhfHzQg8).

Quoted 46 lines

-----Original Message-----
From: Koul, Vinod
Sent: Monday, July 31, 2017 8:30 PM
To: Cheng-Yi Chiang <[email protected]>; Jie, Yang <[email protected]>
Cc: [email protected]; Liam Girdwood <[email protected]>; Mark Brown <[email protected]>; Jaroslav Kysela <[email protected]>; Takashi Iwai <[email protected]>; Eoff, Ullysses A <[email protected]>; [email protected]
Subject: Re: [PATCH v2] ASoC: Intel: Reset hw_ptr on resume trigger

Quoted 4 lines · Cheng-Yi Chiang

From: "U. Artie Eoff" <[email protected]>

Reset the hw_ptr before queuing the restore_stream_context work to eradicate a nasty white audio noise on resume.

Liam, Jie? This on legacy BYT driver..

Quoted 25 lines
---
 sound/soc/intel/baytrail/sst-baytrail-pcm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/intel/baytrail/sst-baytrail-pcm.c +3 -2
index 4765ad474544..e0db7070cd42 100644
@@ -187,8 +187,10 @@ static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 		sst_byt_stream_start(byt, pcm_data->stream, 0);
 		break;
 	case SNDRV_PCM_TRIGGER_RESUME:
-		if (pdata->restore_stream == true)
+		if (pdata->restore_stream == true) {
+			pcm_data->hw_ptr = 0;
 			schedule_work(&pcm_data->work);
+		}
 		else
 			sst_byt_stream_resume(byt, pcm_data->stream);
 		break;
--
Quoted 2 lines

2.12.2

--
~Vinod

#3 lore raw

Hi Eoff, thank you for the patch and providing the context. ChromiumOS now uses kernel 4.4 for BYT and I found that kernel 4.4 does not have this patch.
We thought this should be useful in upstream.
Thanks!

On Tue, Aug 1, 2017 at 12:32 PM, Eoff, Ullysses A <[email protected]

Quoted 59 lines

wrote:

This patch was originally submitted in the context of the ChromiumOS kernel 3.10 for BYT (https://groups.google.com/a/
chromium.org/forum/#!topic/chromium-os-reviews/AsoBhfHzQg8).

Quoted 4 lines

-----Original Message-----
From: Koul, Vinod
Sent: Monday, July 31, 2017 8:30 PM
To: Cheng-Yi Chiang <[email protected]>; Jie, Yang <

[email protected]>

Quoted 1 line

Mark Brown <[email protected]>; Jaroslav Kysela

Quoted 1 line

<[email protected]>; Takashi Iwai <[email protected]>; Eoff, Ullysses A <

[email protected]>; [email protected]

Quoted 11 lines

Subject: Re: [PATCH v2] ASoC: Intel: Reset hw_ptr on resume trigger

Quoted 4 lines · Cheng-Yi Chiang

From: "U. Artie Eoff" <[email protected]>

Reset the hw_ptr before queuing the restore_stream_context work to eradicate a nasty white audio noise on resume.

Liam, Jie? This on legacy BYT driver..

Quoted 1 line
Quoted 8 lines

Review

Quoted 8 lines
---
 sound/soc/intel/baytrail/sst-baytrail-pcm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/sound/soc/intel/baytrail/sst-baytrail-pcm.c

Quoted 4 lines

sound/soc/intel/baytrail/sst-baytrail-pcm.c static int sst_byt_pcm_trigger(struct

Quoted 4 lines

index 4765ad474544..e0db7070cd42 100644

sound/soc/intel/baytrail/sst-baytrail-pcm.c +0 -0
@@ -187,8 +187,10 @@ static int sst_byt_pcm_trigger(struct

snd_pcm_substream *substream, int cmd)

Quoted 17 lines
Quoted 12 lines
sound/soc/intel/baytrail/sst-baytrail-pcm.c +3 -2
            sst_byt_stream_start(byt, pcm_data->stream, 0);
            break;
    case SNDRV_PCM_TRIGGER_RESUME:
-           if (pdata->restore_stream == true)
+           if (pdata->restore_stream == true) {
+                   pcm_data->hw_ptr = 0;
                    schedule_work(&pcm_data->work);
+           }
            else
                    sst_byt_stream_resume(byt, pcm_data->stream);
            break;
--
Quoted 2 lines

2.12.2

--
~Vinod

#4 lore raw
In reply to Vinod Koul
Quoted 16 lines · Vinod Koul
Quoted 4 lines · Cheng-Yi Chiang

From: "U. Artie Eoff" <[email protected]>

Reset the hw_ptr before queuing the restore_stream_context work to eradicate a nasty white audio noise on resume.

Liam, Jie? This on legacy BYT driver..

Quoted 8 lines
---
  sound/soc/intel/baytrail/sst-baytrail-pcm.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 11 lines

sound/soc/intel/baytrail/sst-baytrail-pcm.c static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd) · line 191

Quoted 11 lines
sound/soc/intel/baytrail/sst-baytrail-pcm.c +2 -1
index 4765ad474544..e0db7070cd42 100644
@@ -187,8 +187,10 @@ static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
  		sst_byt_stream_start(byt, pcm_data->stream, 0);
  		break;
  	case SNDRV_PCM_TRIGGER_RESUME:
-		if (pdata->restore_stream == true)
+		if (pdata->restore_stream == true) {
+			pcm_data->hw_ptr = 0;

Won't this break the hw_ptr and make the resuming won't play from the pausing point of the last suspending?

Thanks,
~Keyon

Quoted 9 lines
Quoted 8 lines
sound/soc/intel/baytrail/sst-baytrail-pcm.c +1 -0
  			schedule_work(&pcm_data->work);
+		}
  		else
  			sst_byt_stream_resume(byt, pcm_data->stream);
  		break;
Signature · 1 line
2.12.2

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#5 lore raw

+Jarkko Nikula

Hi Keyon,
Sorry for the late reply. I spent some time trying to figure out
previous suspend resume patch in BYT.

From the patch for restore_stream flag:
https://patchwork.kernel.org/patch/4706611/, the restore_stream flag means that ADSP was in power off state during system suspend/resume cycle. You are right that the resuming won't play from the pausing point of the last suspending. I am not sure whether it is intended in ADSP coming back from power off case. Jarkko and Ullysses might have better idea on this.

In my testing I have found that this patch sometimes causes playback failure upon resume. I have put the logs in
https://bugs.chromium.org/p/chromium/issues/detail?id=752107. I think we should not merge this until it is resolved. I have cc'ed Intel folks on the issue.

Thanks!

Quoted 39 lines · Keyon Jie
Quoted 19 lines · Vinod Koul
Quoted 5 lines · Cheng-Yi Chiang

From: "U. Artie Eoff" <[email protected]>

Reset the hw_ptr before queuing the restore_stream_context work to eradicate a nasty white audio noise on resume.

Liam, Jie? This on legacy BYT driver..

Quoted 8 lines
---
  sound/soc/intel/baytrail/sst-baytrail-pcm.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 13 lines

sound/soc/intel/baytrail/sst-baytrail-pcm.c static int sst_byt_pcm_trigger(struct · line 192

Quoted 13 lines
sound/soc/intel/baytrail/sst-baytrail-pcm.c +2 -1
index 4765ad474544..e0db7070cd42 100644
@@ -187,8 +187,10 @@ static int sst_byt_pcm_trigger(struct
 snd_pcm_substream *substream, int cmd)
                sst_byt_stream_start(byt, pcm_data->stream, 0);
                break;
        case SNDRV_PCM_TRIGGER_RESUME:
-               if (pdata->restore_stream == true)
+               if (pdata->restore_stream == true) {
+                       pcm_data->hw_ptr = 0;

Won't this break the hw_ptr and make the resuming won't play from the pausing point of the last suspending?

Quoted 14 lines

Thanks,
~Keyon

Quoted 9 lines
Quoted 8 lines
sound/soc/intel/baytrail/sst-baytrail-pcm.c +1 -0
                        schedule_work(&pcm_data->work);
+               }
                else
                        sst_byt_stream_resume(byt, pcm_data->stream);
                break;

--
2.12.2

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#6 lore raw
Quoted 14 lines · Cheng-yi Chiang

+Jarkko Nikula

Hi Keyon,
Sorry for the late reply. I spent some time trying to figure out
previous suspend resume patch in BYT.

From the patch for restore_stream flag:
https://patchwork.kernel.org/patch/4706611/, the restore_stream flag means that ADSP was in power off state during system suspend/resume cycle. You are right that the resuming won't play from the pausing point of the last suspending. I am not sure whether it is intended in ADSP coming back from power off case. Jarkko and Ullysses might have better idea on this.

Quoted 5 lines

In my testing I have found that this patch sometimes causes playback failure upon resume. I have put the logs in
https://bugs.chromium.org/p/chromium/issues/detail?id=752107. I think we should not merge this until it is resolved. I have cc'ed Intel folks on the issue.

Thanks for investigation on it, so looks it's better to root cause and fix this noise issue, other than workaround to reset pcm_data->hw_ptr which may introduce new issues.

Thanks,
~Keyon

Quoted 62 lines

Thanks!

Quoted 39 lines · Keyon Jie
Quoted 19 lines · Vinod Koul
Quoted 5 lines · Cheng-Yi Chiang

From: "U. Artie Eoff" <[email protected]>

Reset the hw_ptr before queuing the restore_stream_context work to eradicate a nasty white audio noise on resume.

Liam, Jie? This on legacy BYT driver..

Quoted 8 lines
---
   sound/soc/intel/baytrail/sst-baytrail-pcm.c | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 13 lines

sound/soc/intel/baytrail/sst-baytrail-pcm.c static int sst_byt_pcm_trigger(struct · line 192

Quoted 13 lines
sound/soc/intel/baytrail/sst-baytrail-pcm.c +2 -1
index 4765ad474544..e0db7070cd42 100644
@@ -187,8 +187,10 @@ static int sst_byt_pcm_trigger(struct
 snd_pcm_substream *substream, int cmd)
                 sst_byt_stream_start(byt, pcm_data->stream, 0);
                 break;
         case SNDRV_PCM_TRIGGER_RESUME:
-               if (pdata->restore_stream == true)
+               if (pdata->restore_stream == true) {
+                       pcm_data->hw_ptr = 0;

Won't this break the hw_ptr and make the resuming won't play from the pausing point of the last suspending?

Quoted 14 lines

Thanks,
~Keyon

Quoted 9 lines
Quoted 8 lines
sound/soc/intel/baytrail/sst-baytrail-pcm.c +1 -0
                         schedule_work(&pcm_data->work);
+               }
                 else
                         sst_byt_stream_resume(byt, pcm_data->stream);
                 break;

--
2.12.2

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel