}
if (strcmp(id, "invert") == 0) {
- if (snd_config_get_string(n, &val) < 0)
+ ival = snd_config_get_bool(n);
+ if (ival < 0)
return -EINVAL;
-
- if (strcmp(val, "true") == 0)
- mc->invert = 1;
- else if (strcmp(val, "false") == 0)
- mc->invert = 0;
+ mc->invert = ival;
tplg_dbg("\t%s: %d\n", id, mc->invert);
continue;
snd_config_iterator_t i, next;
snd_config_t *n;
const char *id, *val = NULL;
- int widget_type, err;
- int ival;
+ int widget_type, err, ival;
elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_DAPM_WIDGET);
if (!elem)
}
if (strcmp(id, "no_pm") == 0) {
- if (snd_config_get_string(n, &val) < 0)
+ ival = snd_config_get_bool(n);
+ if (ival < 0)
return -EINVAL;
- if (strcmp(val, "true") == 0)
- widget->reg = -1;
+ widget->reg = ival ? -1 : 0;
tplg_dbg("\t%s: %s\n", id, val);
continue;
unsigned int type, num_tuples = 0;
struct tplg_tuple *tuple;
unsigned long int tuple_val;
+ int ival;
snd_config_get_id(cfg, &id);
switch (type) {
case SND_SOC_TPLG_TUPLE_TYPE_UUID:
+ if (snd_config_get_string(n, &value) < 0)
+ continue;
if (get_uuid(value, tuple->uuid) < 0)
goto err;
break;
case SND_SOC_TPLG_TUPLE_TYPE_STRING:
+ if (snd_config_get_string(n, &value) < 0)
+ continue;
snd_strlcpy(tuple->string, value,
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
tplg_dbg("\t\t%s = %s\n", tuple->token, tuple->string);
break;
case SND_SOC_TPLG_TUPLE_TYPE_BOOL:
- if (strcmp(value, "true") == 0)
- tuple->value = 1;
+ ival = snd_config_get_bool(n);
+ if (ival < 0)
+ continue;
+ tuple->value = ival;
tplg_dbg("\t\t%s = %d\n", tuple->token, tuple->value);
break;
case SND_SOC_TPLG_TUPLE_TYPE_BYTE:
case SND_SOC_TPLG_TUPLE_TYPE_SHORT:
case SND_SOC_TPLG_TUPLE_TYPE_WORD:
+ if (snd_config_get_string(n, &value) < 0)
+ continue;
errno = 0;
/* no support for negative value */
tuple_val = strtoul(value, NULL, 0);
{
snd_config_iterator_t i, next;
snd_config_t *n;
- const char *id, *val = NULL;
+ const char *id;
int err = 0, ival;
struct tplg_elem *elem;
struct tplg_elem *elem;
snd_config_iterator_t i, next;
snd_config_t *n;
- const char *id, *val = NULL;
- int err;
+ const char *id;
+ int err, ival;
elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_PCM);
if (!elem)
}
if (strcmp(id, "compress") == 0) {
- if (snd_config_get_string(n, &val) < 0)
+ ival = snd_config_get_bool(n);
+ if (ival < 0)
return -EINVAL;
- if (strcmp(val, "true") == 0)
- pcm->compress = 1;
+ pcm->compress = ival;
tplg_dbg("\t%s: %s\n", id, val);
continue;
snd_config_iterator_t i, next;
snd_config_t *n;
const char *id, *val = NULL;
- int ret;
+ int ret, ival;
elem = tplg_elem_new_common(tplg, cfg, NULL, SND_TPLG_TYPE_HW_CONFIG);
if (!elem)
if (strcmp(id, "bclk_invert") == 0 ||
strcmp(id, "invert_bclk") == 0) {
- if (snd_config_get_string(n, &val) < 0)
+ ival = snd_config_get_bool(n);
+ if (ival < 0)
return -EINVAL;
- if (!strcmp(val, "true"))
- hw_cfg->invert_bclk = true;
+ hw_cfg->invert_bclk = ival;
continue;
}
if (strcmp(id, "fsync_invert") == 0 ||
strcmp(id, "invert_fsync") == 0) {
- if (snd_config_get_string(n, &val) < 0)
+ ival = snd_config_get_bool(n);
+ if (ival < 0)
return -EINVAL;
- if (!strcmp(val, "true"))
- hw_cfg->invert_fsync = true;
+ hw_cfg->invert_fsync = ival;
continue;
}
if (strcmp(id, "pm_gate_clocks") == 0 ||
strcmp(id, "clock_gated") == 0) {
- if (snd_config_get_string(n, &val) < 0)
+ ival = snd_config_get_bool(n);
+ if (ival < 0)
return -EINVAL;
- if (!strcmp(val, "true"))
+ if (ival)
hw_cfg->clock_gated =
SND_SOC_TPLG_DAI_CLK_GATE_GATED;
else