ucm: add cset-tlv

This patch enables UCM to set a file in TLV format to kcontrol by:
cset-tlv "name='<kcontrol-name>' <path-to-file>"
This new 'cset-tlv' command will be used to write audio DSP to
specific alsa control, where the driver expectes a file in TLV
format.
The TLV file to set to kcontrol will be checked first by file size
not larger than 16 MB, and then examine if the length field reports
correct number of bytes in the TLV file.

Signed-off-by: Hsin-Yu Chao <hychao@chromium.org>
Reviewed-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Hsin-Yu Chao 2016-04-13 18:53:09 +08:00 committed by Takashi Iwai
parent 0c5e5c1801
commit e57b521c61
3 changed files with 92 additions and 13 deletions

View file

@ -316,6 +316,16 @@ static int parse_sequence(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED,
continue;
}
if (strcmp(cmd, "cset-tlv") == 0) {
curr->type = SEQUENCE_ELEMENT_TYPE_CSET_TLV;
err = parse_string(n, &curr->data.cset);
if (err < 0) {
uc_error("error: cset-tlv requires a string!");
return err;
}
continue;
}
if (strcmp(cmd, "usleep") == 0) {
curr->type = SEQUENCE_ELEMENT_TYPE_SLEEP;
err = snd_config_get_integer(n, &curr->data.sleep);