[alsa-devel] [PATCH 0/5] hda-emu: Add playback/capture test to test suite
When I added those tests, I did not discover anything that needed to be fixed in the driver code, but there were some additional things in hda-emu to fix up.
David Henningsson (5): hda-emu: Store pointers to pcm streams instead of their content hda-emu: Add support for get/set converter channel count hda-emu: Add CX20585 to modem whitelist hda-emu: Add playback/capture test to test suite hda-emu: improve test suite summary script
hda-emu.c | 24 ++++++++++++------------ hda-int.c | 15 +++++++++++++++ hda-parse.c | 1 + include/hda-types.h | 1 + tester/runall.sh | 3 --- tester/runner.py | 25 ++++++++++++++++++++++--- tester/summary.py | 9 +++++++++ 7 files changed, 60 insertions(+), 18 deletions(-) delete mode 100755 tester/runall.sh
The HDMI playback engine relies on the same pointer value being sent in hdmi_pcm_open, as being given in the attach_pcm callback.
Signed-off-by: David Henningsson david.henningsson@canonical.com --- hda-emu.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/hda-emu.c b/hda-emu.c index 77d5a7f..b4bd8a9 100644 --- a/hda-emu.c +++ b/hda-emu.c @@ -504,7 +504,7 @@ void hda_log_set_user_pin_configs(unsigned int nid, unsigned int cfg) #define MAX_PCM_STREAMS 16
static int num_pcm_streams; -static struct hda_pcm pcm_streams[MAX_PCM_STREAMS]; +static struct hda_pcm *pcm_streams[MAX_PCM_STREAMS];
#ifndef OLD_HDA_PCM /* get a string corresponding to the given HDA_PCM_TYPE_XXX */ @@ -529,7 +529,7 @@ void hda_list_pcms(void) int i;
for (i = 0; i < num_pcm_streams; i++) { - struct hda_pcm *p = &pcm_streams[i]; + struct hda_pcm *p = pcm_streams[i]; if (!p->stream[0].substreams && !p->stream[1].substreams) continue; #ifdef OLD_HDA_PCM @@ -588,26 +588,26 @@ void hda_test_pcm(int id, int op, int subid, unsigned int ctls = 0; int i, err;
- if (id < 0 || id >= num_pcm_streams) { + if (id < 0 || id >= num_pcm_streams || !pcm_streams[id]) { hda_log(HDA_LOG_ERR, "Invalid PCM id %d\n", id); return; } - if (!pcm_streams[id].stream[0].substreams && - !pcm_streams[id].stream[1].substreams) { + if (!pcm_streams[id]->stream[0].substreams && + !pcm_streams[id]->stream[1].substreams) { hda_log(HDA_LOG_ERR, "Empty PCM for id %d\n", id); return; }
- if (!pcm_streams[id].stream[dir].substreams) { + if (!pcm_streams[id]->stream[dir].substreams) { hda_log(HDA_LOG_INFO, "No substream in PCM %s for %s\n", - pcm_streams[id].name, + pcm_streams[id]->name, (dir ? "capt" : "play")); return; } - if (subid < 0 || subid >= pcm_streams[id].stream[dir].substreams) { + if (subid < 0 || subid >= pcm_streams[id]->stream[dir].substreams) { hda_log(HDA_LOG_INFO, "Invalid substream %d for PCM %s for %s\n", - subid, pcm_streams[id].name, + subid, pcm_streams[id]->name, (dir ? "capt" : "play")); return; } @@ -624,7 +624,7 @@ void hda_test_pcm(int id, int op, int subid, runtime->format = get_alsa_format(format); runtime->channels = channels;
- hinfo = &pcm_streams[id].stream[dir]; + hinfo = &pcm_streams[id]->stream[dir];
runtime->hw.channels_min = hinfo->channels_min; runtime->hw.channels_max = hinfo->channels_max; @@ -643,7 +643,7 @@ void hda_test_pcm(int id, int op, int subid,
if (op != PCM_TEST_END) { hda_log(HDA_LOG_INFO, "Open PCM %s for %s\n", - pcm_streams[id].name, + pcm_streams[id]->name, (dir ? "capt" : "play")); snd_hda_power_up(_codec); err = hinfo->ops.open(hinfo, _codec, substream); @@ -739,7 +739,7 @@ static int attach_pcm(struct hda_bus *bus, struct hda_codec *codec, hda_log(HDA_LOG_ERR, "Too many streams\n"); return 0; } - pcm_streams[num_pcm_streams] = *cpcm; + pcm_streams[num_pcm_streams] = cpcm; #ifdef HAVE_HDA_ATTACH_PCM cpcm->pcm = &dummy_pcm; /* just non-NULL */ #endif
This verb is used by the HDMI playback engine.
Signed-off-by: David Henningsson david.henningsson@canonical.com --- hda-int.c | 15 +++++++++++++++ include/hda-types.h | 1 + 2 files changed, 16 insertions(+)
diff --git a/hda-int.c b/hda-int.c index f4cbdcb..c25af56 100644 --- a/hda-int.c +++ b/hda-int.c @@ -786,6 +786,19 @@ static int get_gpio_sticky_mask(struct xhda_codec *codec, return node->gpio_sticky; }
+static int set_cvt_channel_count(struct xhda_codec *codec, + struct xhda_node *node, unsigned int cmd) +{ + node->cvt_channel_count = cmd & 0xff; + return 0; +} + +static int get_cvt_channel_count(struct xhda_codec *codec, + struct xhda_node *node, unsigned int cmd) +{ + return node->cvt_channel_count; +} +
/* * parameters @@ -1025,6 +1038,7 @@ static struct xhda_verb_table verb_tbl[] = { { 0x71d, set_config_def_1, "set_config_def_1" }, { 0x71e, set_config_def_2, "set_config_def_2" }, { 0x71f, set_config_def_3, "set_config_def_3" }, + { 0x72d, set_cvt_channel_count, "set_cvt_channel_count" }, { 0x7ff, set_codec_reset, "set_codec_reset" }, { 0xf00, get_parameters, "get_parameters" }, { 0xf01, get_connect_sel, "get_connect_sel" }, @@ -1048,6 +1062,7 @@ static struct xhda_verb_table verb_tbl[] = { { 0xf1a, get_gpio_sticky_mask, "get_gpio_sticky_mask" }, { 0xf1c, get_config_default, "get_config_default" }, { 0xf20, get_ssid, "get_ssid" }, + { 0xf2d, get_cvt_channel_count, "get_cvt_channel_count" }, {} };
diff --git a/include/hda-types.h b/include/hda-types.h index 2508726..3a06745 100644 --- a/include/hda-types.h +++ b/include/hda-types.h @@ -54,6 +54,7 @@ struct xhda_node { unsigned char gpio_data, gpio_dir, gpio_mask; unsigned char gpio_wake, gpio_unsol, gpio_sticky; unsigned int coef_idx; + unsigned char cvt_channel_count; struct xhda_coef_table *coef_tbl; struct xhda_node *next; };
Otherwise parsing of cx20585-dell-vostro-1015-ccert-201010-6649 won't work correctly.
Signed-off-by: David Henningsson david.henningsson@canonical.com --- hda-parse.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/hda-parse.c b/hda-parse.c index c57ba78..73658c5 100644 --- a/hda-parse.c +++ b/hda-parse.c @@ -396,6 +396,7 @@ static int in_modem_whitelist(struct xhda_codec *codec) case 0x14f15045: case 0x14f15047: case 0x14f15051: + case 0x14f15069: return 1; } return 0;
Signed-off-by: David Henningsson david.henningsson@canonical.com --- tester/runner.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/tester/runner.py b/tester/runner.py index dc9f6fd..b585ad3 100644 --- a/tester/runner.py +++ b/tester/runner.py @@ -18,6 +18,7 @@
import subprocess import os +import re
class ControlInfo(): def __init__(self, runner, list_info): @@ -27,7 +28,6 @@ class ControlInfo(): self.name = carr[2]
def add_info(self, get_info): - import re minmax_regex = re.compile("MIN/MAX: (\d+)/(\d+),\s+VAL:(( \[\d+\])+)") val_regex = re.compile(" \[(\d+)\]")
@@ -189,7 +189,6 @@ class HdaEmuRunner(): dump = self.run_command("dump") pins = []
- import re pinregex = re.compile("^Node (0x\w\w+) \[Pin Complex\].*") jackregex = re.compile("Pin Default.*\[Jack\]") for s in dump: @@ -217,7 +216,6 @@ class HdaEmuRunner(): self.add_error("Tried to set " + c.name + " to " + str([int(x) for x in values]) + ", but got " + str(c.values) + " instead", "Error")
def run_kcontrol_test(self): - import re minmax_regex = re.compile("MIN/MAX: (\d+)/(\d+),\s+VAL:(( \[\d+\])+)") val_regex = re.compile(" \[(\d+)\]")
@@ -234,11 +232,32 @@ class HdaEmuRunner(): self.run_set_kcontrol_test(c, [minval, minval]) self.run_set_kcontrol_test(c, [maxval, maxval])
+ def run_pcm_test(self): + pcm_regex = re.compile("Info: (\d+):.*play=(\d+), capt=(\d+)") + pcm_lines = self.run_command("PCM") + playback_test = False + for pcm_line in pcm_lines: + r = pcm_regex.match(pcm_line) + if r is None: + self.add_error("Invalid pcm response: " + pcm_line, "Error"); + continue + pcm_devid = r.group(1) + play_count = r.group(2) + rec_count = r.group(3) + if play_count > 0: + playback_test = True + self.run_command("PCM " + pcm_devid + " playback") + if rec_count > 0: + self.run_command("PCM " + pcm_devid + " capture") + if not playback_test: + self.add_error("No playback PCM devices", "Error") + def run_standard(self): self.start_process() self.run_command() # Initial parsing self.run_command("pm") # S3 test self.run_jack_plug_test() self.run_kcontrol_test() + self.run_pcm_test() self.stop_process()
Now you can call summary with -v or -vv to get the same functionality as you could with the runall.sh script.
Signed-off-by: David Henningsson david.henningsson@canonical.com --- tester/runall.sh | 3 --- tester/summary.py | 9 +++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) delete mode 100755 tester/runall.sh
diff --git a/tester/runall.sh b/tester/runall.sh deleted file mode 100755 index d078f35..0000000 --- a/tester/runall.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -find ../codecs/canonical/ -type f | sort | xargs -n1 ./hda-emu-tester.py --file - diff --git a/tester/summary.py b/tester/summary.py index cd66df7..6e94c9b 100755 --- a/tester/summary.py +++ b/tester/summary.py @@ -23,6 +23,12 @@ def main(): import os.path import runner
+ import argparse + parser = argparse.ArgumentParser(description='Hda-emu automated test wrapper.') + parser.add_argument('--verbose', '-v', action='count') + parser_dict = parser.parse_args() + verbose = parser_dict.verbose + os.chdir(os.path.dirname(os.path.realpath(__file__))) directory = "../codecs/canonical/" files = os.listdir(directory) @@ -35,11 +41,14 @@ def main(): try: r = runner.HdaEmuRunner() r.set_alsa_info_file(os.path.join(directory, f)) + r.set_print_errors(verbose > 1) r.run_standard() if r.errors > 0 or r.warnings > 0: fails += 1 errors += r.errors warnings += r.warnings + if verbose > 0: + print '{0} errors, {1} warnings. ({2})'.format(r.errors, r.warnings, f) else: successes += 1 except:
At Tue, 21 Aug 2012 10:53:58 +0200, David Henningsson wrote:
When I added those tests, I did not discover anything that needed to be fixed in the driver code, but there were some additional things in hda-emu to fix up.
Thanks, applied all patches and pushed out.
Takashi
David Henningsson (5): hda-emu: Store pointers to pcm streams instead of their content hda-emu: Add support for get/set converter channel count hda-emu: Add CX20585 to modem whitelist hda-emu: Add playback/capture test to test suite hda-emu: improve test suite summary script
hda-emu.c | 24 ++++++++++++------------ hda-int.c | 15 +++++++++++++++ hda-parse.c | 1 + include/hda-types.h | 1 + tester/runall.sh | 3 --- tester/runner.py | 25 ++++++++++++++++++++++--- tester/summary.py | 9 +++++++++ 7 files changed, 60 insertions(+), 18 deletions(-) delete mode 100755 tester/runall.sh
-- 1.7.9.5
participants (2)
-
David Henningsson
-
Takashi Iwai