alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2]  alsabat: add power management S3 test
@ 2016-08-26 15:37 keqiao.zhang
  2016-08-26 15:37 ` [PATCH 1/2] alsabat: fix alsabat -86 error keqiao.zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: keqiao.zhang @ 2016-08-26 15:37 UTC (permalink / raw)
  To: alsa-devel; +Cc: keqiao.zhang

From: "Keqiao, Zhang" <keqiao.zhang@intel.com>

The patch set provide a method for QA to quick test audio during system S3

The first patch fix -86 error when system suspend/resume

The second patch provide a test script

Keqiao, Zhang (2):
  alsabat: fix alsabat -86 error
  alsabat: add system power management S3 test

 bat/alsa.c          | 10 ++++++++++
 bat/alsabat-test.sh | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)

-- 
2.5.0

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

* [PATCH 1/2] alsabat: fix alsabat -86 error
  2016-08-26 15:37 [PATCH 0/2] alsabat: add power management S3 test keqiao.zhang
@ 2016-08-26 15:37 ` keqiao.zhang
  2016-08-26 15:37 ` [PATCH 2/2] alsabat: add system power management S3 test keqiao.zhang
  2016-08-30  5:50 ` [PATCH 0/2] alsabat: add " Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: keqiao.zhang @ 2016-08-26 15:37 UTC (permalink / raw)
  To: alsa-devel; +Cc: keqiao.zhang

From: "Keqiao, Zhang" <keqiao.zhang@intel.com>

alsabat reports -86 error when system suspend and resume. Check the
return value of read_to_pcm() and write_to_pcm(), when -x8 err is
detected, do resume and wait for read/write to pcm to complete.

Write PCM device error: Streams pipe error(-86)
Read PCM device error: Streams pipe error(-86)
*** Error in alsabat: double free or corruption (out): 0x00007fb438001810 ***

Signed-off-by: Keqiao, Zhang <keqiao.zhang@intel.com>
---
 bat/alsa.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/bat/alsa.c b/bat/alsa.c
index cef1734..7613f44 100644
--- a/bat/alsa.c
+++ b/bat/alsa.c
@@ -319,6 +319,11 @@ static int write_to_pcm(const struct pcm_container *sndpcm,
 			if (bat->roundtriplatency)
 				bat->latency.xrun_error = true;
 			snd_pcm_prepare(sndpcm->handle);
+		} else if (err == -ESTRPIPE) {
+			while ((err = snd_pcm_resume(sndpcm->handle)) == -EAGAIN)
+				sleep(1);  /* wait until resume flag is released */
+			if (err < 0)
+				snd_pcm_prepare(sndpcm->handle);
 		} else if (err < 0) {
 			fprintf(bat->err, _("Write PCM device error: %s(%d)\n"),
 					snd_strerror(err), err);
@@ -518,6 +523,11 @@ static int read_from_pcm(struct pcm_container *sndpcm,
 					snd_strerror(err), err);
 			if (bat->roundtriplatency)
 				bat->latency.xrun_error = true;
+		} else if (err == -ESTRPIPE) {
+			while ((err = snd_pcm_resume(sndpcm->handle)) == -EAGAIN)
+				sleep(1);  /* wait until resume flag is released */
+			if (err < 0)
+				snd_pcm_prepare(sndpcm->handle);
 		} else if (err < 0) {
 			fprintf(bat->err, _("Read PCM device error: %s(%d)\n"),
 					snd_strerror(err), err);
-- 
2.5.0

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

* [PATCH 2/2] alsabat: add system power management S3 test
  2016-08-26 15:37 [PATCH 0/2] alsabat: add power management S3 test keqiao.zhang
  2016-08-26 15:37 ` [PATCH 1/2] alsabat: fix alsabat -86 error keqiao.zhang
@ 2016-08-26 15:37 ` keqiao.zhang
  2016-08-30  5:50 ` [PATCH 0/2] alsabat: add " Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: keqiao.zhang @ 2016-08-26 15:37 UTC (permalink / raw)
  To: alsa-devel; +Cc: keqiao.zhang

From: "Keqiao, Zhang" <keqiao.zhang@intel.com>

Support audio pause/resume for playback and capture. The user can
pause alsabat playback/capture threads by sending a signal. The patch
provides a method for QA to quick test audio during system s3.

Signed-off-by: Keqiao, Zhang <keqiao.zhang@intel.com>
---
 bat/alsabat-test.sh | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/bat/alsabat-test.sh b/bat/alsabat-test.sh
index aa0281b..bc3d512 100755
--- a/bat/alsabat-test.sh
+++ b/bat/alsabat-test.sh
@@ -15,6 +15,10 @@ logdir="tmp"
 maxfreq=16547
 minfreq=17
 
+# sleep time and pause time
+sleep_time=5
+pause_time=2
+
 # features passes vs. features all
 feature_pass=0
 feature_cnt=0
@@ -48,6 +52,35 @@ feature_test () {
 	echo "$commands $1" >> $logdir/$((feature_cnt-1)).log
 }
 
+feature_test_power () {
+	echo "============================================"
+	echo "$feature_cnt: ALSA $2"
+	echo "-------------------------------------------"
+	echo "$commands $1 --log=$logdir/$feature_cnt.log"
+
+	# run alsabat in the background
+	nohup $commands $1 > $logdir/$feature_cnt.log 2>&1 &
+	sleep $pause_time
+	pid=`ps -aux |grep alsabat|head -1 |awk -F ' ' '{print $2}'`
+
+	# stop the alsabat thread
+	kill -STOP $pid > /dev/null
+	sleep 4
+
+	# do system S3
+	rtcwake -m mem -s $sleep_time
+	sleep $pause_time
+
+	# resume the alasbat thread to run
+	kill -CONT $pid > /dev/null
+
+	# wait for alsabat to complete the analysis
+	sleep $pause_time
+	cat $logdir/$feature_cnt.log |grep -i "Return value is 0" > /dev/null
+	evaluate_result $?
+	echo "$commands $1" >> $logdir/$((feature_cnt-1)).log
+}
+
 # test items
 feature_list_test () {
 	init_counter
@@ -87,6 +120,7 @@ feature_list_test () {
 			"noise detect threshold in SNR(dB)"
 	feature_test "--snr-pc 5" \
 			"noise detect threshold in noise percentage(%)"
+	feature_test_power "-n5s" "power management: S3 test"
 
 	print_result
 }
-- 
2.5.0

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

* Re: [PATCH 0/2] alsabat: add power management S3 test
  2016-08-26 15:37 [PATCH 0/2] alsabat: add power management S3 test keqiao.zhang
  2016-08-26 15:37 ` [PATCH 1/2] alsabat: fix alsabat -86 error keqiao.zhang
  2016-08-26 15:37 ` [PATCH 2/2] alsabat: add system power management S3 test keqiao.zhang
@ 2016-08-30  5:50 ` Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2016-08-30  5:50 UTC (permalink / raw)
  To: keqiao.zhang; +Cc: alsa-devel

On Fri, 26 Aug 2016 17:37:53 +0200,
keqiao.zhang@intel.com wrote:
> 
> From: "Keqiao, Zhang" <keqiao.zhang@intel.com>
> 
> The patch set provide a method for QA to quick test audio during system S3
> 
> The first patch fix -86 error when system suspend/resume
> 
> The second patch provide a test script
> 
> Keqiao, Zhang (2):
>   alsabat: fix alsabat -86 error
>   alsabat: add system power management S3 test

Applied both patches.  Thanks.


Takashi

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

end of thread, other threads:[~2016-08-30  5:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-26 15:37 [PATCH 0/2] alsabat: add power management S3 test keqiao.zhang
2016-08-26 15:37 ` [PATCH 1/2] alsabat: fix alsabat -86 error keqiao.zhang
2016-08-26 15:37 ` [PATCH 2/2] alsabat: add system power management S3 test keqiao.zhang
2016-08-30  5:50 ` [PATCH 0/2] alsabat: add " Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).