diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-11-21 09:05:54 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-11-21 09:05:54 +0100 |
commit | 8b184c637acd2fc647a52e4198244cf85669eab4 (patch) | |
tree | ccd2f3a9568962d668ca5c68e1b9b877656dc104 | |
parent | e068fafb31be7bf0da0df6081b3f644e91903f7e (diff) | |
download | hda-emu-8b184c637acd2fc647a52e4198244cf85669eab4.tar.gz |
Allow firmware patch file to read via -P option
We often want to pass the pin configs used for snd-hda-intel patch
option. This patch allows user to pass such a file to -P option as
is.
-rw-r--r-- | hda-emu.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -1090,6 +1090,7 @@ static int override_pincfg(struct xhda_codec *codec, char *pincfg) FILE *fp; char buf[256]; struct xhda_sysfs_list *sys; + int is_fw_file, is_in_pincfg; for (sys = codec->sysfs_list; sys; sys = sys->next) { if (sys->type == XHDA_SYS_PINCFG && @@ -1108,9 +1109,28 @@ static int override_pincfg(struct xhda_codec *codec, char *pincfg) hda_log(HDA_LOG_ERR, "Cannot find init pincfg %s\n", pincfg); return -EINVAL; } + hda_log(HDA_LOG_INFO, "Overriding pin-configs from file %s\n", pincfg); + is_fw_file = 0; + is_in_pincfg = 0; while (fgets(buf, sizeof(buf), fp)) { int reg, val; + if (*buf == '#' || *buf == '\n') + continue; + if (is_fw_file) { + if (*buf == '[') { + if (is_in_pincfg) + break; + is_in_pincfg = !strncmp(buf, "[pincfg]", 8); + continue; + } else if (!is_in_pincfg) + continue; + } else { + if (!strncmp(buf, "[codec]", 7)) { + is_fw_file = 1; + continue; + } + } if (sscanf(buf, "%i %i", ®, &val) != 2) break; set_pincfg(codec, reg, val); |