26
26
#include <sound/soc-dapm.h>
27
27
#include <sound/tlv.h>
28
28
29
- static struct sdca_control * selector_find_control (struct device * dev ,
30
- struct sdca_entity * entity ,
31
- const int sel )
32
- {
33
- int i ;
34
-
35
- for (i = 0 ; i < entity -> num_controls ; i ++ ) {
36
- struct sdca_control * control = & entity -> controls [i ];
37
-
38
- if (control -> sel == sel )
39
- return control ;
40
- }
41
-
42
- dev_err (dev , "%s: control %#x: missing\n" , entity -> label , sel );
43
- return NULL ;
44
- }
45
-
46
- static struct sdca_control_range * control_find_range (struct device * dev ,
47
- struct sdca_entity * entity ,
48
- struct sdca_control * control ,
49
- int cols , int rows )
50
- {
51
- struct sdca_control_range * range = & control -> range ;
52
-
53
- if ((cols && range -> cols != cols ) || (rows && range -> rows != rows ) ||
54
- !range -> data ) {
55
- dev_err (dev , "%s: control %#x: ranges invalid (%d,%d)\n" ,
56
- entity -> label , control -> sel , range -> cols , range -> rows );
57
- return NULL ;
58
- }
59
-
60
- return range ;
61
- }
62
-
63
- static struct sdca_control_range * selector_find_range (struct device * dev ,
64
- struct sdca_entity * entity ,
65
- int sel , int cols , int rows )
66
- {
67
- struct sdca_control * control ;
68
-
69
- control = selector_find_control (dev , entity , sel );
70
- if (!control )
71
- return NULL ;
72
-
73
- return control_find_range (dev , entity , control , cols , rows );
74
- }
75
-
76
29
static bool exported_control (struct sdca_entity * entity , struct sdca_control * control )
77
30
{
78
31
switch (SDCA_CTL_TYPE (entity -> type , control -> sel )) {
@@ -213,15 +166,15 @@ static int entity_early_parse_ge(struct device *dev,
213
166
const char * * texts ;
214
167
int i ;
215
168
216
- control = selector_find_control (dev , entity , SDCA_CTL_GE_SELECTED_MODE );
169
+ control = sdca_selector_find_control (dev , entity , SDCA_CTL_GE_SELECTED_MODE );
217
170
if (!control )
218
171
return - EINVAL ;
219
172
220
173
if (control -> layers != SDCA_ACCESS_LAYER_CLASS )
221
174
dev_warn (dev , "%s: unexpected access layer: %x\n" ,
222
175
entity -> label , control -> layers );
223
176
224
- range = control_find_range (dev , entity , control , SDCA_SELECTED_MODE_NCOLS , 0 );
177
+ range = sdca_control_find_range (dev , entity , control , SDCA_SELECTED_MODE_NCOLS , 0 );
225
178
if (!range )
226
179
return - EINVAL ;
227
180
@@ -443,7 +396,7 @@ static int entity_parse_pde(struct device *dev,
443
396
unsigned int mask = 0 ;
444
397
int i ;
445
398
446
- control = selector_find_control (dev , entity , SDCA_CTL_PDE_REQUESTED_PS );
399
+ control = sdca_selector_find_control (dev , entity , SDCA_CTL_PDE_REQUESTED_PS );
447
400
if (!control )
448
401
return - EINVAL ;
449
402
@@ -452,7 +405,7 @@ static int entity_parse_pde(struct device *dev,
452
405
dev_warn (dev , "%s: unexpected access layer: %x\n" ,
453
406
entity -> label , control -> layers );
454
407
455
- range = control_find_range (dev , entity , control , SDCA_REQUESTED_PS_NCOLS , 0 );
408
+ range = sdca_control_find_range (dev , entity , control , SDCA_REQUESTED_PS_NCOLS , 0 );
456
409
if (!range )
457
410
return - EINVAL ;
458
411
@@ -499,8 +452,8 @@ static int entity_parse_su_device(struct device *dev,
499
452
return - EINVAL ;
500
453
}
501
454
502
- range = selector_find_range (dev , entity -> group , SDCA_CTL_GE_SELECTED_MODE ,
503
- SDCA_SELECTED_MODE_NCOLS , 0 );
455
+ range = sdca_selector_find_range (dev , entity -> group , SDCA_CTL_GE_SELECTED_MODE ,
456
+ SDCA_SELECTED_MODE_NCOLS , 0 );
504
457
if (!range )
505
458
return - EINVAL ;
506
459
@@ -613,7 +566,7 @@ static int entity_parse_su(struct device *dev,
613
566
return - EINVAL ;
614
567
}
615
568
616
- control = selector_find_control (dev , entity , SDCA_CTL_SU_SELECTOR );
569
+ control = sdca_selector_find_control (dev , entity , SDCA_CTL_SU_SELECTOR );
617
570
if (!control )
618
571
return - EINVAL ;
619
572
@@ -643,7 +596,7 @@ static int entity_parse_mu(struct device *dev,
643
596
return - EINVAL ;
644
597
}
645
598
646
- control = selector_find_control (dev , entity , SDCA_CTL_MU_MIXER );
599
+ control = sdca_selector_find_control (dev , entity , SDCA_CTL_MU_MIXER );
647
600
if (!control )
648
601
return - EINVAL ;
649
602
@@ -853,7 +806,7 @@ static int control_limit_kctl(struct device *dev,
853
806
/*
854
807
* FIXME: For now only handle the simple case of a single linear range
855
808
*/
856
- range = control_find_range (dev , entity , control , SDCA_VOLUME_LINEAR_NCOLS , 1 );
809
+ range = sdca_control_find_range (dev , entity , control , SDCA_VOLUME_LINEAR_NCOLS , 1 );
857
810
if (!range )
858
811
return - EINVAL ;
859
812
@@ -1140,9 +1093,9 @@ static int populate_rate_format(struct device *dev,
1140
1093
}
1141
1094
1142
1095
if (entity -> iot .clock ) {
1143
- range = selector_find_range (dev , entity -> iot .clock ,
1144
- SDCA_CTL_CS_SAMPLERATEINDEX ,
1145
- SDCA_SAMPLERATEINDEX_NCOLS , 0 );
1096
+ range = sdca_selector_find_range (dev , entity -> iot .clock ,
1097
+ SDCA_CTL_CS_SAMPLERATEINDEX ,
1098
+ SDCA_SAMPLERATEINDEX_NCOLS , 0 );
1146
1099
if (!range )
1147
1100
return - EINVAL ;
1148
1101
@@ -1154,7 +1107,7 @@ static int populate_rate_format(struct device *dev,
1154
1107
clock_rates = UINT_MAX ;
1155
1108
}
1156
1109
1157
- range = selector_find_range (dev , entity , sel , SDCA_USAGE_NCOLS , 0 );
1110
+ range = sdca_selector_find_range (dev , entity , sel , SDCA_USAGE_NCOLS , 0 );
1158
1111
if (!range )
1159
1112
return - EINVAL ;
1160
1113
0 commit comments