@@ -869,37 +869,6 @@ static int wcd937x_enable_rx3(struct snd_soc_dapm_widget *w,
869
869
return 0 ;
870
870
}
871
871
872
- static int wcd937x_codec_enable_vdd_buck (struct snd_soc_dapm_widget * w ,
873
- struct snd_kcontrol * kcontrol ,
874
- int event )
875
- {
876
- struct snd_soc_component * component = snd_soc_dapm_to_component (w -> dapm );
877
- struct wcd937x_priv * wcd937x = snd_soc_component_get_drvdata (component );
878
- int ret = 0 ;
879
-
880
- switch (event ) {
881
- case SND_SOC_DAPM_PRE_PMU :
882
- if (test_bit (ALLOW_BUCK_DISABLE , & wcd937x -> status_mask )) {
883
- dev_err (component -> dev , "buck already in enabled state\n" );
884
- clear_bit (ALLOW_BUCK_DISABLE , & wcd937x -> status_mask );
885
- return 0 ;
886
- }
887
- ret = regulator_enable (wcd937x -> buck_supply );
888
- if (ret ) {
889
- dev_err (component -> dev , "VDD_BUCK is not enabled\n" );
890
- return ret ;
891
- }
892
- clear_bit (ALLOW_BUCK_DISABLE , & wcd937x -> status_mask );
893
- usleep_range (200 , 250 );
894
- break ;
895
- case SND_SOC_DAPM_POST_PMD :
896
- set_bit (ALLOW_BUCK_DISABLE , & wcd937x -> status_mask );
897
- break ;
898
- }
899
-
900
- return 0 ;
901
- }
902
-
903
872
static int wcd937x_get_micb_vout_ctl_val (u32 micb_mv )
904
873
{
905
874
if (micb_mv < 1000 || micb_mv > 2850 ) {
@@ -2226,10 +2195,7 @@ static const struct snd_soc_dapm_widget wcd937x_dapm_widgets[] = {
2226
2195
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
2227
2196
SND_SOC_DAPM_POST_PMD ),
2228
2197
2229
- SND_SOC_DAPM_SUPPLY ("VDD_BUCK" , SND_SOC_NOPM , 0 , 0 ,
2230
- wcd937x_codec_enable_vdd_buck ,
2231
- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD ),
2232
-
2198
+ SND_SOC_DAPM_SUPPLY ("VDD_BUCK" , SND_SOC_NOPM , 0 , 0 , NULL , 0 ),
2233
2199
SND_SOC_DAPM_SUPPLY_S ("CLS_H_PORT" , 1 , SND_SOC_NOPM , 0 , 0 , NULL , 0 ),
2234
2200
2235
2201
/* RX widgets */
@@ -2915,24 +2881,17 @@ static int wcd937x_probe(struct platform_device *pdev)
2915
2881
wcd937x -> supplies [0 ].supply = "vdd-rxtx" ;
2916
2882
wcd937x -> supplies [1 ].supply = "vdd-px" ;
2917
2883
wcd937x -> supplies [2 ].supply = "vdd-mic-bias" ;
2884
+ wcd937x -> supplies [3 ].supply = "vdd-buck" ;
2918
2885
2919
2886
ret = devm_regulator_bulk_get (dev , WCD937X_MAX_BULK_SUPPLY , wcd937x -> supplies );
2920
2887
if (ret )
2921
2888
return dev_err_probe (dev , ret , "Failed to get supplies\n" );
2922
2889
2923
2890
ret = regulator_bulk_enable (WCD937X_MAX_BULK_SUPPLY , wcd937x -> supplies );
2924
- if (ret )
2891
+ if (ret ) {
2892
+ regulator_bulk_free (WCD937X_MAX_BULK_SUPPLY , wcd937x -> supplies );
2925
2893
return dev_err_probe (dev , ret , "Failed to enable supplies\n" );
2926
-
2927
- /* Get the buck separately, as it needs special handling */
2928
- wcd937x -> buck_supply = devm_regulator_get (dev , "vdd-buck" );
2929
- if (IS_ERR (wcd937x -> buck_supply ))
2930
- return dev_err_probe (dev , PTR_ERR (wcd937x -> buck_supply ),
2931
- "Failed to get buck supply\n" );
2932
-
2933
- ret = regulator_enable (wcd937x -> buck_supply );
2934
- if (ret )
2935
- return dev_err_probe (dev , ret , "Failed to enable buck supply\n" );
2894
+ }
2936
2895
2937
2896
wcd937x_dt_parse_micbias_info (dev , wcd937x );
2938
2897
@@ -2949,13 +2908,13 @@ static int wcd937x_probe(struct platform_device *pdev)
2949
2908
2950
2909
ret = wcd937x_add_slave_components (wcd937x , dev , & match );
2951
2910
if (ret )
2952
- return ret ;
2911
+ goto err_disable_regulators ;
2953
2912
2954
2913
wcd937x_reset (wcd937x );
2955
2914
2956
2915
ret = component_master_add_with_match (dev , & wcd937x_comp_ops , match );
2957
2916
if (ret )
2958
- return ret ;
2917
+ goto err_disable_regulators ;
2959
2918
2960
2919
pm_runtime_set_autosuspend_delay (dev , 1000 );
2961
2920
pm_runtime_use_autosuspend (dev );
@@ -2964,6 +2923,12 @@ static int wcd937x_probe(struct platform_device *pdev)
2964
2923
pm_runtime_enable (dev );
2965
2924
pm_runtime_idle (dev );
2966
2925
2926
+ return 0 ;
2927
+
2928
+ err_disable_regulators :
2929
+ regulator_bulk_disable (WCD937X_MAX_BULK_SUPPLY , wcd937x -> supplies );
2930
+ regulator_bulk_free (WCD937X_MAX_BULK_SUPPLY , wcd937x -> supplies );
2931
+
2967
2932
return ret ;
2968
2933
}
2969
2934
0 commit comments