]> git.alsa-project.org Git - alsa-lib.git/commitdiff
topology: Parse link flags of physical DAI links
authorMengdong Lin <mengdong.lin@linux.intel.com>
Sun, 6 Nov 2016 05:14:15 +0000 (13:14 +0800)
committerTakashi Iwai <tiwai@suse.de>
Tue, 8 Nov 2016 15:33:21 +0000 (16:33 +0100)
Parse physical DAI link flags defined by text conf file or C API.
The flag mask and flags are added to C API template for physical DAI
links.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/topology.h
src/topology/pcm.c

index 85818aca83cd95da24b7783a3299f97fcd85772e..3692da4b56032aa8cebad94f49e9e2344191e920 100644 (file)
@@ -639,6 +639,11 @@ extern "C" {
  *
  *     default_hw_conf_id "1"          #default HW config ID for init
  *
+ *     # Optional boolean flags
+ *     symmetric_rates                 "true"
+ *     symmetric_channels              "false"
+ *     symmetric_sample_bits           "true"
+ *
  *     data "name"                     # optional private data
  * }
  * </pre>
@@ -988,6 +993,9 @@ struct snd_tplg_link_template {
        struct snd_tplg_hw_config_template *hw_config; /*!< supported HW configs */
        int num_hw_configs;             /* number of hw configs */
        int default_hw_config_id;       /* default hw config ID for init */
+
+       unsigned int flag_mask;         /* bitmask of flags to configure */
+       unsigned int flags;             /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
 };
 
 /** \struct snd_tplg_obj_template
index e92d2b96ff91284dcbf70188ce414f08527ff36b..a751851d28e3d24d5ce64da22d60f144eec7d6aa 100644 (file)
@@ -664,6 +664,35 @@ int tplg_parse_link(snd_tplg_t *tplg,
                        continue;
                }
 
+               /* flags */
+               if (strcmp(id, "symmetric_rates") == 0) {
+                       err = parse_flag(n,
+                               SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES,
+                               &link->flag_mask, &link->flags);
+                       if (err < 0)
+                               return err;
+                       continue;
+               }
+
+               if (strcmp(id, "symmetric_channels") == 0) {
+                       err = parse_flag(n,
+                               SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS,
+                               &link->flag_mask, &link->flags);
+                       if (err < 0)
+                               return err;
+                       continue;
+               }
+
+               if (strcmp(id, "symmetric_sample_bits") == 0) {
+                       err = parse_flag(n,
+                               SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS,
+                               &link->flag_mask, &link->flags);
+                       if (err < 0)
+                               return err;
+                       continue;
+               }
+
+               /* private data */
                if (strcmp(id, "data") == 0) {
                        err = tplg_parse_data_refs(n, elem);
                        if (err < 0)
@@ -1010,5 +1039,9 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
        link->default_hw_config_id = link_tpl->default_hw_config_id;
        for (i = 0; i < link->num_hw_configs; i++)
                set_link_hw_config(&link->hw_config[i], &link_tpl->hw_config[i]);
+
+       /* flags */
+       link->flag_mask = link_tpl->flag_mask;
+       link->flags = link_tpl->flags;
        return 0;
 }