aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-11-25 10:03:55 +0100
committerTakashi Iwai <tiwai@suse.de>2013-11-25 10:03:55 +0100
commit458d299264ea398cfd5ac216e3b0ef218a68937e (patch)
treea67a1d39d798d3c51e685d8d0623b28307019d29
parentd1c9a38291a3b77627b6c4bfb980142c9fba3521 (diff)
downloadhda-emu-458d299264ea398cfd5ac216e3b0ef218a68937e.tar.gz
Allow the direct pin config via -P option
Like -H option, now hda-emu accepts the pin config value directly specified via -P option like 0x0a=0x12345678.
-rw-r--r--README3
-rw-r--r--hda-emu.c11
2 files changed, 13 insertions, 1 deletions
diff --git a/README b/README
index 914e67d..1624bd1 100644
--- a/README
+++ b/README
@@ -420,7 +420,8 @@ the pin-default contents found in hwC0D0/init_pin_configs sysfs file.
You can also pass an external file name to -P option instead of the
sysfs files in the input file. The file must contain a pair of
register and pin-config value in each line just like in *_pin_configs
-sysfs files.
+sysfs files. Also, you can pass a pin config directly via -P optoin,
+e.g. -P 0x0a=0x12345678.
Similarly, you can give the initial hints strings either from sysfs
file in alsa-info.sh output or an external file via -H option. Also,
diff --git a/hda-emu.c b/hda-emu.c
index 6d74f2e..1d04910 100644
--- a/hda-emu.c
+++ b/hda-emu.c
@@ -1092,6 +1092,17 @@ static int override_pincfg(struct xhda_codec *codec, char *pincfg)
struct xhda_sysfs_list *sys;
int is_fw_file, is_in_pincfg;
+ if (strchr(pincfg, '=')) {
+ /* direct pincfg string */
+ int reg, val;
+ if (sscanf(pincfg, "%i %i", &reg, &val) != 2) {
+ hda_log(HDA_LOG_ERR, "Invalid pincfg %s\n", pincfg);
+ return -EINVAL;
+ }
+ set_pincfg(codec, reg, val);
+ return 0;
+ }
+
for (sys = codec->sysfs_list; sys; sys = sys->next) {
if (sys->type == XHDA_SYS_PINCFG &&
!strcmp(sys->id, pincfg)) {