Skip to content

Commit 2b46d02

Browse files
yongzhi1lrgirdwo
authored andcommitted
topology: set default values for C_CONTROLBYTES string members
When the string fields left empty, the alsa topology parser treats SND_CONFIG_TYPE_STRING type config as -EINVAL, so set defauls values. Signed-off-by: Yong Zhi <yong.zhi@intel.com>
1 parent 5521bea commit 2b46d02

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

tools/topology/topology1/m4/bytecontrol.m4

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
divert(-1)
22

3+
# don't care value
4+
define(`XX', 0x00)
5+
36
dnl Define macro for byte control
47

58
dnl CONTROLBYTES_MAX(comment, value)
@@ -60,9 +63,10 @@ define(`C_CONTROLBYTES',
6063
` # control uses bespoke driver get/put/info ID for ext ops'
6164
` $4'
6265
`'
63-
` base STR($5)'
64-
` num_regs STR($6)'
65-
` mask STR($7)'
66+
` # default base/num_regs/mask to avoid NULL STR'
67+
` ifelse($5, `', base STR(XX), base STR($5))'
68+
` ifelse($6, `', num_regs STR(XX), num_regs STR($6)`')'
69+
` ifelse($7, `', mask STR(XX), mask STR($7)`')'
6670
` $8'
6771
` $9'
6872
` access ['
@@ -88,9 +92,9 @@ define(`C_CONTROLBYTES_VOLATILE_READONLY',
8892
` # control uses bespoke driver get/put/info ID for ext ops'
8993
` $4'
9094
`'
91-
` base STR($5)'
92-
` num_regs STR($6)'
93-
` mask STR($7)'
95+
` ifelse($5, `', base STR(XX), base STR($5))'
96+
` ifelse($6, `', num_regs STR(XX), num_regs STR($6)`')'
97+
` ifelse($7, `', mask STR(XX), mask STR($7)`')'
9498
` $8'
9599
` $9'
96100
` access ['
@@ -116,9 +120,9 @@ define(`C_CONTROLBYTES_WRITEONLY',
116120
` # control uses bespoke driver get/put/info ID for ext ops'
117121
` $4'
118122
`'
119-
` base STR($5)'
120-
` num_regs STR($6)'
121-
` mask STR($7)'
123+
` ifelse($5, `', base STR(XX), base STR($5))'
124+
` ifelse($6, `', num_regs STR(XX), num_regs STR($6)`')'
125+
` ifelse($7, `', mask STR(XX), mask STR($7)`')'
122126
` $8'
123127
` $9'
124128
` access ['
@@ -143,9 +147,9 @@ define(`C_CONTROLBYTES_VOLATILE_RW',
143147
` # control uses bespoke driver get/put/info ID for ext ops'
144148
` $4'
145149
`'
146-
` base STR($5)'
147-
` num_regs STR($6)'
148-
` mask STR($7)'
150+
` ifelse($5, `', base STR(XX), base STR($5))'
151+
` ifelse($6, `', num_regs STR(XX), num_regs STR($6)`')'
152+
` ifelse($7, `', mask STR(XX), mask STR($7)`')'
149153
` $8'
150154
` $9'
151155
` access ['

0 commit comments

Comments
 (0)