@@ -922,15 +922,13 @@ static void rt5682_enable_push_button_irq(struct snd_soc_component *component,
922
922
*
923
923
* Returns detect status.
924
924
*/
925
- int rt5682_headset_detect (struct snd_soc_component * component , int jack_insert )
925
+ static int rt5682_headset_detect (struct snd_soc_component * component , int jack_insert )
926
926
{
927
927
struct rt5682_priv * rt5682 = snd_soc_component_get_drvdata (component );
928
928
struct snd_soc_dapm_context * dapm = & component -> dapm ;
929
929
unsigned int val , count ;
930
930
931
931
if (jack_insert ) {
932
- snd_soc_dapm_mutex_lock (dapm );
933
-
934
932
snd_soc_component_update_bits (component , RT5682_PWR_ANLG_1 ,
935
933
RT5682_PWR_VREF2 | RT5682_PWR_MB ,
936
934
RT5682_PWR_VREF2 | RT5682_PWR_MB );
@@ -981,8 +979,6 @@ int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert)
981
979
snd_soc_component_update_bits (component , RT5682_MICBIAS_2 ,
982
980
RT5682_PWR_CLK25M_MASK | RT5682_PWR_CLK1M_MASK ,
983
981
RT5682_PWR_CLK25M_PU | RT5682_PWR_CLK1M_PU );
984
-
985
- snd_soc_dapm_mutex_unlock (dapm );
986
982
} else {
987
983
rt5682_enable_push_button_irq (component , false);
988
984
snd_soc_component_update_bits (component , RT5682_CBJ_CTRL_1 ,
@@ -1011,7 +1007,6 @@ int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert)
1011
1007
dev_dbg (component -> dev , "jack_type = %d\n" , rt5682 -> jack_type );
1012
1008
return rt5682 -> jack_type ;
1013
1009
}
1014
- EXPORT_SYMBOL_GPL (rt5682_headset_detect );
1015
1010
1016
1011
static int rt5682_set_jack_detect (struct snd_soc_component * component ,
1017
1012
struct snd_soc_jack * hs_jack , void * data )
@@ -1094,6 +1089,7 @@ void rt5682_jack_detect_handler(struct work_struct *work)
1094
1089
{
1095
1090
struct rt5682_priv * rt5682 =
1096
1091
container_of (work , struct rt5682_priv , jack_detect_work .work );
1092
+ struct snd_soc_dapm_context * dapm ;
1097
1093
int val , btn_type ;
1098
1094
1099
1095
while (!rt5682 -> component )
@@ -1102,7 +1098,9 @@ void rt5682_jack_detect_handler(struct work_struct *work)
1102
1098
while (!rt5682 -> component -> card -> instantiated )
1103
1099
usleep_range (10000 , 15000 );
1104
1100
1105
- mutex_lock (& rt5682 -> jdet_mutex );
1101
+ dapm = snd_soc_component_get_dapm (rt5682 -> component );
1102
+
1103
+ snd_soc_dapm_mutex_lock (dapm );
1106
1104
mutex_lock (& rt5682 -> calibrate_mutex );
1107
1105
1108
1106
val = snd_soc_component_read (rt5682 -> component , RT5682_AJD1_CTRL )
@@ -1162,6 +1160,9 @@ void rt5682_jack_detect_handler(struct work_struct *work)
1162
1160
rt5682 -> irq_work_delay_time = 50 ;
1163
1161
}
1164
1162
1163
+ mutex_unlock (& rt5682 -> calibrate_mutex );
1164
+ snd_soc_dapm_mutex_unlock (dapm );
1165
+
1165
1166
snd_soc_jack_report (rt5682 -> hs_jack , rt5682 -> jack_type ,
1166
1167
SND_JACK_HEADSET |
1167
1168
SND_JACK_BTN_0 | SND_JACK_BTN_1 |
@@ -1174,9 +1175,6 @@ void rt5682_jack_detect_handler(struct work_struct *work)
1174
1175
else
1175
1176
cancel_delayed_work_sync (& rt5682 -> jd_check_work );
1176
1177
}
1177
-
1178
- mutex_unlock (& rt5682 -> calibrate_mutex );
1179
- mutex_unlock (& rt5682 -> jdet_mutex );
1180
1178
}
1181
1179
EXPORT_SYMBOL_GPL (rt5682_jack_detect_handler );
1182
1180
@@ -1526,7 +1524,6 @@ static int rt5682_hp_event(struct snd_soc_dapm_widget *w,
1526
1524
{
1527
1525
struct snd_soc_component * component =
1528
1526
snd_soc_dapm_to_component (w -> dapm );
1529
- struct rt5682_priv * rt5682 = snd_soc_component_get_drvdata (component );
1530
1527
1531
1528
switch (event ) {
1532
1529
case SND_SOC_DAPM_PRE_PMU :
@@ -1538,17 +1535,12 @@ static int rt5682_hp_event(struct snd_soc_dapm_widget *w,
1538
1535
RT5682_DEPOP_1 , 0x60 , 0x60 );
1539
1536
snd_soc_component_update_bits (component ,
1540
1537
RT5682_DAC_ADC_DIG_VOL1 , 0x00c0 , 0x0080 );
1541
-
1542
- mutex_lock (& rt5682 -> jdet_mutex );
1543
-
1544
1538
snd_soc_component_update_bits (component , RT5682_HP_CTRL_2 ,
1545
1539
RT5682_HP_C2_DAC_L_EN | RT5682_HP_C2_DAC_R_EN ,
1546
1540
RT5682_HP_C2_DAC_L_EN | RT5682_HP_C2_DAC_R_EN );
1547
1541
usleep_range (5000 , 10000 );
1548
1542
snd_soc_component_update_bits (component , RT5682_CHARGE_PUMP_1 ,
1549
1543
RT5682_CP_SW_SIZE_MASK , RT5682_CP_SW_SIZE_L );
1550
-
1551
- mutex_unlock (& rt5682 -> jdet_mutex );
1552
1544
break ;
1553
1545
1554
1546
case SND_SOC_DAPM_POST_PMD :
0 commit comments