37
37
* Returns 0 for success.
38
38
*/
39
39
int snd_soc_info_enum_double (struct snd_kcontrol * kcontrol ,
40
- struct snd_ctl_elem_info * uinfo )
40
+ struct snd_ctl_elem_info * uinfo )
41
41
{
42
42
struct soc_enum * e = (struct soc_enum * )kcontrol -> private_value ;
43
43
@@ -56,7 +56,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_enum_double);
56
56
* Returns 0 for success.
57
57
*/
58
58
int snd_soc_get_enum_double (struct snd_kcontrol * kcontrol ,
59
- struct snd_ctl_elem_value * ucontrol )
59
+ struct snd_ctl_elem_value * ucontrol )
60
60
{
61
61
struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
62
62
struct soc_enum * e = (struct soc_enum * )kcontrol -> private_value ;
@@ -87,7 +87,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_enum_double);
87
87
* Returns 0 for success.
88
88
*/
89
89
int snd_soc_put_enum_double (struct snd_kcontrol * kcontrol ,
90
- struct snd_ctl_elem_value * ucontrol )
90
+ struct snd_ctl_elem_value * ucontrol )
91
91
{
92
92
struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
93
93
struct soc_enum * e = (struct soc_enum * )kcontrol -> private_value ;
@@ -124,8 +124,9 @@ EXPORT_SYMBOL_GPL(snd_soc_put_enum_double);
124
124
* the given registervalue into a signed integer if sign_bit is non-zero.
125
125
*/
126
126
static void snd_soc_read_signed (struct snd_soc_component * component ,
127
- unsigned int reg , unsigned int mask , unsigned int shift ,
128
- unsigned int sign_bit , int * signed_val )
127
+ unsigned int reg , unsigned int mask ,
128
+ unsigned int shift , unsigned int sign_bit ,
129
+ int * signed_val )
129
130
{
130
131
int ret ;
131
132
unsigned int val ;
@@ -168,7 +169,7 @@ static void snd_soc_read_signed(struct snd_soc_component *component,
168
169
* Returns 0 for success.
169
170
*/
170
171
int snd_soc_info_volsw (struct snd_kcontrol * kcontrol ,
171
- struct snd_ctl_elem_info * uinfo )
172
+ struct snd_ctl_elem_info * uinfo )
172
173
{
173
174
struct soc_mixer_control * mc =
174
175
(struct soc_mixer_control * )kcontrol -> private_value ;
@@ -247,7 +248,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_sx);
247
248
* Returns 0 for success.
248
249
*/
249
250
int snd_soc_get_volsw (struct snd_kcontrol * kcontrol ,
250
- struct snd_ctl_elem_value * ucontrol )
251
+ struct snd_ctl_elem_value * ucontrol )
251
252
{
252
253
struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
253
254
struct soc_mixer_control * mc =
@@ -300,7 +301,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw);
300
301
* Returns 0 for success.
301
302
*/
302
303
int snd_soc_put_volsw (struct snd_kcontrol * kcontrol ,
303
- struct snd_ctl_elem_value * ucontrol )
304
+ struct snd_ctl_elem_value * ucontrol )
304
305
{
305
306
struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
306
307
struct soc_mixer_control * mc =
@@ -362,9 +363,8 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
362
363
err = snd_soc_component_update_bits (component , reg2 , val_mask ,
363
364
val2 );
364
365
/* Don't discard any error code or drop change flag */
365
- if (ret == 0 || err < 0 ) {
366
+ if (ret == 0 || err < 0 )
366
367
ret = err ;
367
- }
368
368
}
369
369
370
370
return ret ;
@@ -382,11 +382,11 @@ EXPORT_SYMBOL_GPL(snd_soc_put_volsw);
382
382
* Returns 0 for success.
383
383
*/
384
384
int snd_soc_get_volsw_sx (struct snd_kcontrol * kcontrol ,
385
- struct snd_ctl_elem_value * ucontrol )
385
+ struct snd_ctl_elem_value * ucontrol )
386
386
{
387
387
struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
388
388
struct soc_mixer_control * mc =
389
- (struct soc_mixer_control * )kcontrol -> private_value ;
389
+ (struct soc_mixer_control * )kcontrol -> private_value ;
390
390
unsigned int reg = mc -> reg ;
391
391
unsigned int reg2 = mc -> rreg ;
392
392
unsigned int shift = mc -> shift ;
@@ -423,18 +423,17 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
423
423
{
424
424
struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
425
425
struct soc_mixer_control * mc =
426
- (struct soc_mixer_control * )kcontrol -> private_value ;
427
-
426
+ (struct soc_mixer_control * )kcontrol -> private_value ;
428
427
unsigned int reg = mc -> reg ;
429
428
unsigned int reg2 = mc -> rreg ;
430
429
unsigned int shift = mc -> shift ;
431
430
unsigned int rshift = mc -> rshift ;
431
+ unsigned int val , val_mask ;
432
432
int max = mc -> max ;
433
433
int min = mc -> min ;
434
434
unsigned int mask = (1U << (fls (min + max ) - 1 )) - 1 ;
435
435
int err = 0 ;
436
436
int ret ;
437
- unsigned int val , val_mask ;
438
437
439
438
if (ucontrol -> value .integer .value [0 ] < 0 )
440
439
return - EINVAL ;
@@ -465,13 +464,13 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
465
464
val2 = val2 << rshift ;
466
465
467
466
err = snd_soc_component_update_bits (component , reg2 , val_mask ,
468
- val2 );
467
+ val2 );
469
468
470
469
/* Don't discard any error code or drop change flag */
471
- if (ret == 0 || err < 0 ) {
470
+ if (ret == 0 || err < 0 )
472
471
ret = err ;
473
- }
474
472
}
473
+
475
474
return ret ;
476
475
}
477
476
EXPORT_SYMBOL_GPL (snd_soc_put_volsw_sx );
@@ -487,7 +486,7 @@ EXPORT_SYMBOL_GPL(snd_soc_put_volsw_sx);
487
486
* returns 0 for success.
488
487
*/
489
488
int snd_soc_info_volsw_range (struct snd_kcontrol * kcontrol ,
490
- struct snd_ctl_elem_info * uinfo )
489
+ struct snd_ctl_elem_info * uinfo )
491
490
{
492
491
struct soc_mixer_control * mc =
493
492
(struct soc_mixer_control * )kcontrol -> private_value ;
@@ -516,7 +515,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_range);
516
515
* Returns 0 for success.
517
516
*/
518
517
int snd_soc_put_volsw_range (struct snd_kcontrol * kcontrol ,
519
- struct snd_ctl_elem_value * ucontrol )
518
+ struct snd_ctl_elem_value * ucontrol )
520
519
{
521
520
struct soc_mixer_control * mc =
522
521
(struct soc_mixer_control * )kcontrol -> private_value ;
@@ -568,11 +567,10 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
568
567
val = val << shift ;
569
568
570
569
err = snd_soc_component_update_bits (component , rreg , val_mask ,
571
- val );
570
+ val );
572
571
/* Don't discard any error code or drop change flag */
573
- if (ret == 0 || err < 0 ) {
572
+ if (ret == 0 || err < 0 )
574
573
ret = err ;
575
- }
576
574
}
577
575
578
576
return ret ;
@@ -589,7 +587,7 @@ EXPORT_SYMBOL_GPL(snd_soc_put_volsw_range);
589
587
* Returns 0 for success.
590
588
*/
591
589
int snd_soc_get_volsw_range (struct snd_kcontrol * kcontrol ,
592
- struct snd_ctl_elem_value * ucontrol )
590
+ struct snd_ctl_elem_value * ucontrol )
593
591
{
594
592
struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
595
593
struct soc_mixer_control * mc =
@@ -663,8 +661,7 @@ static int snd_soc_clip_to_platform_max(struct snd_kcontrol *kctl)
663
661
*
664
662
* Return 0 for success, else error.
665
663
*/
666
- int snd_soc_limit_volume (struct snd_soc_card * card ,
667
- const char * name , int max )
664
+ int snd_soc_limit_volume (struct snd_soc_card * card , const char * name , int max )
668
665
{
669
666
struct snd_kcontrol * kctl ;
670
667
int ret = - EINVAL ;
@@ -675,12 +672,15 @@ int snd_soc_limit_volume(struct snd_soc_card *card,
675
672
676
673
kctl = snd_soc_card_get_kcontrol (card , name );
677
674
if (kctl ) {
678
- struct soc_mixer_control * mc = (struct soc_mixer_control * )kctl -> private_value ;
675
+ struct soc_mixer_control * mc =
676
+ (struct soc_mixer_control * )kctl -> private_value ;
677
+
679
678
if (max <= mc -> max - mc -> min ) {
680
679
mc -> platform_max = max ;
681
680
ret = snd_soc_clip_to_platform_max (kctl );
682
681
}
683
682
}
683
+
684
684
return ret ;
685
685
}
686
686
EXPORT_SYMBOL_GPL (snd_soc_limit_volume );
@@ -740,8 +740,8 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
740
740
{
741
741
struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
742
742
struct soc_bytes * params = (void * )kcontrol -> private_value ;
743
- int ret , len ;
744
743
unsigned int val , mask ;
744
+ int ret , len ;
745
745
746
746
if (!component -> regmap || !params -> num_regs )
747
747
return - EINVAL ;
@@ -772,31 +772,27 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
772
772
break ;
773
773
case 2 :
774
774
mask = ~params -> mask ;
775
- ret = regmap_parse_val (component -> regmap ,
776
- & mask , & mask );
775
+ ret = regmap_parse_val (component -> regmap , & mask , & mask );
777
776
if (ret != 0 )
778
777
return ret ;
779
778
780
779
((u16 * )data )[0 ] &= mask ;
781
780
782
- ret = regmap_parse_val (component -> regmap ,
783
- & val , & val );
781
+ ret = regmap_parse_val (component -> regmap , & val , & val );
784
782
if (ret != 0 )
785
783
return ret ;
786
784
787
785
((u16 * )data )[0 ] |= val ;
788
786
break ;
789
787
case 4 :
790
788
mask = ~params -> mask ;
791
- ret = regmap_parse_val (component -> regmap ,
792
- & mask , & mask );
789
+ ret = regmap_parse_val (component -> regmap , & mask , & mask );
793
790
if (ret != 0 )
794
791
return ret ;
795
792
796
793
((u32 * )data )[0 ] &= mask ;
797
794
798
- ret = regmap_parse_val (component -> regmap ,
799
- & val , & val );
795
+ ret = regmap_parse_val (component -> regmap , & val , & val );
800
796
if (ret != 0 )
801
797
return ret ;
802
798
@@ -812,7 +808,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
812
808
EXPORT_SYMBOL_GPL (snd_soc_bytes_put );
813
809
814
810
int snd_soc_bytes_info_ext (struct snd_kcontrol * kcontrol ,
815
- struct snd_ctl_elem_info * ucontrol )
811
+ struct snd_ctl_elem_info * ucontrol )
816
812
{
817
813
struct soc_bytes_ext * params = (void * )kcontrol -> private_value ;
818
814
@@ -824,7 +820,7 @@ int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol,
824
820
EXPORT_SYMBOL_GPL (snd_soc_bytes_info_ext );
825
821
826
822
int snd_soc_bytes_tlv_callback (struct snd_kcontrol * kcontrol , int op_flag ,
827
- unsigned int size , unsigned int __user * tlv )
823
+ unsigned int size , unsigned int __user * tlv )
828
824
{
829
825
struct soc_bytes_ext * params = (void * )kcontrol -> private_value ;
830
826
unsigned int count = size < params -> max ? size : params -> max ;
@@ -840,6 +836,7 @@ int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag,
840
836
ret = params -> put (kcontrol , tlv , count );
841
837
break ;
842
838
}
839
+
843
840
return ret ;
844
841
}
845
842
EXPORT_SYMBOL_GPL (snd_soc_bytes_tlv_callback );
@@ -856,10 +853,11 @@ EXPORT_SYMBOL_GPL(snd_soc_bytes_tlv_callback);
856
853
* Returns 0 for success.
857
854
*/
858
855
int snd_soc_info_xr_sx (struct snd_kcontrol * kcontrol ,
859
- struct snd_ctl_elem_info * uinfo )
856
+ struct snd_ctl_elem_info * uinfo )
860
857
{
861
858
struct soc_mreg_control * mc =
862
859
(struct soc_mreg_control * )kcontrol -> private_value ;
860
+
863
861
uinfo -> type = SNDRV_CTL_ELEM_TYPE_INTEGER ;
864
862
uinfo -> count = 1 ;
865
863
uinfo -> value .integer .min = mc -> min ;
@@ -883,25 +881,26 @@ EXPORT_SYMBOL_GPL(snd_soc_info_xr_sx);
883
881
* Returns 0 for success.
884
882
*/
885
883
int snd_soc_get_xr_sx (struct snd_kcontrol * kcontrol ,
886
- struct snd_ctl_elem_value * ucontrol )
884
+ struct snd_ctl_elem_value * ucontrol )
887
885
{
888
886
struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
889
887
struct soc_mreg_control * mc =
890
888
(struct soc_mreg_control * )kcontrol -> private_value ;
891
889
unsigned int regbase = mc -> regbase ;
892
890
unsigned int regcount = mc -> regcount ;
893
891
unsigned int regwshift = component -> val_bytes * BITS_PER_BYTE ;
894
- unsigned int regwmask = (1UL << regwshift )- 1 ;
892
+ unsigned int regwmask = (1UL << regwshift ) - 1 ;
895
893
unsigned int invert = mc -> invert ;
896
- unsigned long mask = (1UL << mc -> nbits )- 1 ;
894
+ unsigned long mask = (1UL << mc -> nbits ) - 1 ;
897
895
long min = mc -> min ;
898
896
long max = mc -> max ;
899
897
long val = 0 ;
900
898
unsigned int i ;
901
899
902
900
for (i = 0 ; i < regcount ; i ++ ) {
903
- unsigned int regval = snd_soc_component_read (component , regbase + i );
904
- val |= (regval & regwmask ) << (regwshift * (regcount - i - 1 ));
901
+ unsigned int regval = snd_soc_component_read (component , regbase + i );
902
+
903
+ val |= (regval & regwmask ) << (regwshift * (regcount - i - 1 ));
905
904
}
906
905
val &= mask ;
907
906
if (min < 0 && val > max )
@@ -928,17 +927,17 @@ EXPORT_SYMBOL_GPL(snd_soc_get_xr_sx);
928
927
* Returns 0 for success.
929
928
*/
930
929
int snd_soc_put_xr_sx (struct snd_kcontrol * kcontrol ,
931
- struct snd_ctl_elem_value * ucontrol )
930
+ struct snd_ctl_elem_value * ucontrol )
932
931
{
933
932
struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
934
933
struct soc_mreg_control * mc =
935
934
(struct soc_mreg_control * )kcontrol -> private_value ;
936
935
unsigned int regbase = mc -> regbase ;
937
936
unsigned int regcount = mc -> regcount ;
938
937
unsigned int regwshift = component -> val_bytes * BITS_PER_BYTE ;
939
- unsigned int regwmask = (1UL << regwshift )- 1 ;
938
+ unsigned int regwmask = (1UL << regwshift ) - 1 ;
940
939
unsigned int invert = mc -> invert ;
941
- unsigned long mask = (1UL << mc -> nbits )- 1 ;
940
+ unsigned long mask = (1UL << mc -> nbits ) - 1 ;
942
941
long max = mc -> max ;
943
942
long val = ucontrol -> value .integer .value [0 ];
944
943
int ret = 0 ;
@@ -950,10 +949,13 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
950
949
val = max - val ;
951
950
val &= mask ;
952
951
for (i = 0 ; i < regcount ; i ++ ) {
953
- unsigned int regval = (val >> (regwshift * (regcount - i - 1 ))) & regwmask ;
954
- unsigned int regmask = (mask >> (regwshift * (regcount - i - 1 ))) & regwmask ;
955
- int err = snd_soc_component_update_bits (component , regbase + i ,
952
+ unsigned int regval = (val >> (regwshift * (regcount - i - 1 ))) &
953
+ regwmask ;
954
+ unsigned int regmask = (mask >> (regwshift * (regcount - i - 1 ))) &
955
+ regwmask ;
956
+ int err = snd_soc_component_update_bits (component , regbase + i ,
956
957
regmask , regval );
958
+
957
959
if (err < 0 )
958
960
return err ;
959
961
if (err > 0 )
@@ -974,7 +976,7 @@ EXPORT_SYMBOL_GPL(snd_soc_put_xr_sx);
974
976
* Returns 0 for success.
975
977
*/
976
978
int snd_soc_get_strobe (struct snd_kcontrol * kcontrol ,
977
- struct snd_ctl_elem_value * ucontrol )
979
+ struct snd_ctl_elem_value * ucontrol )
978
980
{
979
981
struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
980
982
struct soc_mixer_control * mc =
@@ -1007,7 +1009,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_strobe);
1007
1009
* Returns 1 for success.
1008
1010
*/
1009
1011
int snd_soc_put_strobe (struct snd_kcontrol * kcontrol ,
1010
- struct snd_ctl_elem_value * ucontrol )
1012
+ struct snd_ctl_elem_value * ucontrol )
1011
1013
{
1012
1014
struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
1013
1015
struct soc_mixer_control * mc =
0 commit comments