2626#include <sound/soc-dapm.h>
2727#include <sound/tlv.h>
2828
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-
7629static bool exported_control (struct sdca_entity * entity , struct sdca_control * control )
7730{
7831 switch (SDCA_CTL_TYPE (entity -> type , control -> sel )) {
@@ -213,15 +166,15 @@ static int entity_early_parse_ge(struct device *dev,
213166 const char * * texts ;
214167 int i ;
215168
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 );
217170 if (!control )
218171 return - EINVAL ;
219172
220173 if (control -> layers != SDCA_ACCESS_LAYER_CLASS )
221174 dev_warn (dev , "%s: unexpected access layer: %x\n" ,
222175 entity -> label , control -> layers );
223176
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 );
225178 if (!range )
226179 return - EINVAL ;
227180
@@ -443,7 +396,7 @@ static int entity_parse_pde(struct device *dev,
443396 unsigned int mask = 0 ;
444397 int i ;
445398
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 );
447400 if (!control )
448401 return - EINVAL ;
449402
@@ -452,7 +405,7 @@ static int entity_parse_pde(struct device *dev,
452405 dev_warn (dev , "%s: unexpected access layer: %x\n" ,
453406 entity -> label , control -> layers );
454407
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 );
456409 if (!range )
457410 return - EINVAL ;
458411
@@ -499,8 +452,8 @@ static int entity_parse_su_device(struct device *dev,
499452 return - EINVAL ;
500453 }
501454
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 );
504457 if (!range )
505458 return - EINVAL ;
506459
@@ -613,7 +566,7 @@ static int entity_parse_su(struct device *dev,
613566 return - EINVAL ;
614567 }
615568
616- control = selector_find_control (dev , entity , SDCA_CTL_SU_SELECTOR );
569+ control = sdca_selector_find_control (dev , entity , SDCA_CTL_SU_SELECTOR );
617570 if (!control )
618571 return - EINVAL ;
619572
@@ -643,7 +596,7 @@ static int entity_parse_mu(struct device *dev,
643596 return - EINVAL ;
644597 }
645598
646- control = selector_find_control (dev , entity , SDCA_CTL_MU_MIXER );
599+ control = sdca_selector_find_control (dev , entity , SDCA_CTL_MU_MIXER );
647600 if (!control )
648601 return - EINVAL ;
649602
@@ -853,7 +806,7 @@ static int control_limit_kctl(struct device *dev,
853806 /*
854807 * FIXME: For now only handle the simple case of a single linear range
855808 */
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 );
857810 if (!range )
858811 return - EINVAL ;
859812
@@ -1140,9 +1093,9 @@ static int populate_rate_format(struct device *dev,
11401093 }
11411094
11421095 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 );
11461099 if (!range )
11471100 return - EINVAL ;
11481101
@@ -1154,7 +1107,7 @@ static int populate_rate_format(struct device *dev,
11541107 clock_rates = UINT_MAX ;
11551108 }
11561109
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 );
11581111 if (!range )
11591112 return - EINVAL ;
11601113
0 commit comments