@@ -3626,52 +3626,108 @@ int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol,
3626
3626
}
3627
3627
EXPORT_SYMBOL_GPL (snd_soc_dapm_info_pin_switch );
3628
3628
3629
+ static int __snd_soc_dapm_get_pin_switch (struct snd_soc_dapm_context * dapm ,
3630
+ const char * pin ,
3631
+ struct snd_ctl_elem_value * ucontrol )
3632
+ {
3633
+ snd_soc_dapm_mutex_lock (dapm );
3634
+ ucontrol -> value .integer .value [0 ] = snd_soc_dapm_get_pin_status (dapm , pin );
3635
+ snd_soc_dapm_mutex_unlock (dapm );
3636
+
3637
+ return 0 ;
3638
+ }
3639
+
3629
3640
/**
3630
3641
* snd_soc_dapm_get_pin_switch - Get information for a pin switch
3631
3642
*
3632
3643
* @kcontrol: mixer control
3633
3644
* @ucontrol: Value
3645
+ *
3646
+ * Callback to provide information for a pin switch added at the card
3647
+ * level.
3634
3648
*/
3635
3649
int snd_soc_dapm_get_pin_switch (struct snd_kcontrol * kcontrol ,
3636
3650
struct snd_ctl_elem_value * ucontrol )
3637
3651
{
3638
3652
struct snd_soc_card * card = snd_kcontrol_chip (kcontrol );
3639
3653
const char * pin = (const char * )kcontrol -> private_value ;
3640
3654
3641
- snd_soc_dapm_mutex_lock (card );
3655
+ return __snd_soc_dapm_get_pin_switch (& card -> dapm , pin , ucontrol );
3656
+ }
3657
+ EXPORT_SYMBOL_GPL (snd_soc_dapm_get_pin_switch );
3642
3658
3643
- ucontrol -> value .integer .value [0 ] =
3644
- snd_soc_dapm_get_pin_status (& card -> dapm , pin );
3659
+ /**
3660
+ * snd_soc_dapm_get_component_pin_switch - Get information for a pin switch
3661
+ *
3662
+ * @kcontrol: mixer control
3663
+ * @ucontrol: Value
3664
+ *
3665
+ * Callback to provide information for a pin switch added at the component
3666
+ * level.
3667
+ */
3668
+ int snd_soc_dapm_get_component_pin_switch (struct snd_kcontrol * kcontrol ,
3669
+ struct snd_ctl_elem_value * ucontrol )
3670
+ {
3671
+ struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
3672
+ const char * pin = (const char * )kcontrol -> private_value ;
3645
3673
3646
- snd_soc_dapm_mutex_unlock (card );
3674
+ return __snd_soc_dapm_get_pin_switch (& component -> dapm , pin , ucontrol );
3675
+ }
3676
+ EXPORT_SYMBOL_GPL (snd_soc_dapm_get_component_pin_switch );
3647
3677
3648
- return 0 ;
3678
+ static int __snd_soc_dapm_put_pin_switch (struct snd_soc_dapm_context * dapm ,
3679
+ const char * pin ,
3680
+ struct snd_ctl_elem_value * ucontrol )
3681
+ {
3682
+ int ret ;
3683
+
3684
+ snd_soc_dapm_mutex_lock (dapm );
3685
+ ret = __snd_soc_dapm_set_pin (dapm , pin , !!ucontrol -> value .integer .value [0 ]);
3686
+ snd_soc_dapm_mutex_unlock (dapm );
3687
+
3688
+ snd_soc_dapm_sync (dapm );
3689
+
3690
+ return ret ;
3649
3691
}
3650
- EXPORT_SYMBOL_GPL (snd_soc_dapm_get_pin_switch );
3651
3692
3652
3693
/**
3653
3694
* snd_soc_dapm_put_pin_switch - Set information for a pin switch
3654
3695
*
3655
3696
* @kcontrol: mixer control
3656
3697
* @ucontrol: Value
3698
+ *
3699
+ * Callback to provide information for a pin switch added at the card
3700
+ * level.
3657
3701
*/
3658
3702
int snd_soc_dapm_put_pin_switch (struct snd_kcontrol * kcontrol ,
3659
3703
struct snd_ctl_elem_value * ucontrol )
3660
3704
{
3661
3705
struct snd_soc_card * card = snd_kcontrol_chip (kcontrol );
3662
3706
const char * pin = (const char * )kcontrol -> private_value ;
3663
- int ret ;
3664
-
3665
- snd_soc_dapm_mutex_lock (card );
3666
- ret = __snd_soc_dapm_set_pin (& card -> dapm , pin ,
3667
- !!ucontrol -> value .integer .value [0 ]);
3668
- snd_soc_dapm_mutex_unlock (card );
3669
3707
3670
- snd_soc_dapm_sync (& card -> dapm );
3671
- return ret ;
3708
+ return __snd_soc_dapm_put_pin_switch (& card -> dapm , pin , ucontrol );
3672
3709
}
3673
3710
EXPORT_SYMBOL_GPL (snd_soc_dapm_put_pin_switch );
3674
3711
3712
+ /**
3713
+ * snd_soc_dapm_put_component_pin_switch - Set information for a pin switch
3714
+ *
3715
+ * @kcontrol: mixer control
3716
+ * @ucontrol: Value
3717
+ *
3718
+ * Callback to provide information for a pin switch added at the component
3719
+ * level.
3720
+ */
3721
+ int snd_soc_dapm_put_component_pin_switch (struct snd_kcontrol * kcontrol ,
3722
+ struct snd_ctl_elem_value * ucontrol )
3723
+ {
3724
+ struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
3725
+ const char * pin = (const char * )kcontrol -> private_value ;
3726
+
3727
+ return __snd_soc_dapm_put_pin_switch (& component -> dapm , pin , ucontrol );
3728
+ }
3729
+ EXPORT_SYMBOL_GPL (snd_soc_dapm_put_component_pin_switch );
3730
+
3675
3731
struct snd_soc_dapm_widget *
3676
3732
snd_soc_dapm_new_control_unlocked (struct snd_soc_dapm_context * dapm ,
3677
3733
const struct snd_soc_dapm_widget * widget )
0 commit comments