Skip to content

Commit a784d60

Browse files
committed
ASoC: codecs: wcd93xx: Few regulator supplies fixes
Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>: Fix cleanup paths in wcd9335 and wcd937x codec drivers.
2 parents e3de798 + 63fe298 commit a784d60

File tree

2 files changed

+8
-24
lines changed

2 files changed

+8
-24
lines changed

sound/soc/codecs/wcd9335.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ struct wcd9335_codec {
332332

333333
int intr1;
334334
struct gpio_desc *reset_gpio;
335-
struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY];
336335

337336
unsigned int rx_port_value[WCD9335_RX_MAX];
338337
unsigned int tx_port_value[WCD9335_TX_MAX];
@@ -355,6 +354,10 @@ struct wcd9335_irq {
355354
char *name;
356355
};
357356

357+
static const char * const wcd9335_supplies[] = {
358+
"vdd-buck", "vdd-buck-sido", "vdd-tx", "vdd-rx", "vdd-io",
359+
};
360+
358361
static const struct wcd9335_slim_ch wcd9335_tx_chs[WCD9335_TX_MAX] = {
359362
WCD9335_SLIM_TX_CH(0),
360363
WCD9335_SLIM_TX_CH(1),
@@ -4989,30 +4992,16 @@ static int wcd9335_parse_dt(struct wcd9335_codec *wcd)
49894992
if (IS_ERR(wcd->native_clk))
49904993
return dev_err_probe(dev, PTR_ERR(wcd->native_clk), "slimbus clock not found\n");
49914994

4992-
wcd->supplies[0].supply = "vdd-buck";
4993-
wcd->supplies[1].supply = "vdd-buck-sido";
4994-
wcd->supplies[2].supply = "vdd-tx";
4995-
wcd->supplies[3].supply = "vdd-rx";
4996-
wcd->supplies[4].supply = "vdd-io";
4997-
4998-
ret = regulator_bulk_get(dev, WCD9335_MAX_SUPPLY, wcd->supplies);
4995+
ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(wcd9335_supplies),
4996+
wcd9335_supplies);
49994997
if (ret)
5000-
return dev_err_probe(dev, ret, "Failed to get supplies\n");
4998+
return dev_err_probe(dev, ret, "Failed to get and enable supplies\n");
50014999

50025000
return 0;
50035001
}
50045002

50055003
static int wcd9335_power_on_reset(struct wcd9335_codec *wcd)
50065004
{
5007-
struct device *dev = wcd->dev;
5008-
int ret;
5009-
5010-
ret = regulator_bulk_enable(WCD9335_MAX_SUPPLY, wcd->supplies);
5011-
if (ret) {
5012-
dev_err(dev, "Failed to get supplies: err = %d\n", ret);
5013-
return ret;
5014-
}
5015-
50165005
/*
50175006
* For WCD9335, it takes about 600us for the Vout_A and
50185007
* Vout_D to be ready after BUCK_SIDO is powered up.

sound/soc/codecs/wcd937x.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ struct wcd937x_priv {
9191
struct regmap_irq_chip *wcd_regmap_irq_chip;
9292
struct regmap_irq_chip_data *irq_chip;
9393
struct regulator_bulk_data supplies[WCD937X_MAX_BULK_SUPPLY];
94-
struct regulator *buck_supply;
9594
struct snd_soc_jack *jack;
9695
unsigned long status_mask;
9796
s32 micb_ref[WCD937X_MAX_MICBIAS];
@@ -2945,10 +2944,8 @@ static int wcd937x_probe(struct platform_device *pdev)
29452944
return dev_err_probe(dev, ret, "Failed to get supplies\n");
29462945

29472946
ret = regulator_bulk_enable(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies);
2948-
if (ret) {
2949-
regulator_bulk_free(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies);
2947+
if (ret)
29502948
return dev_err_probe(dev, ret, "Failed to enable supplies\n");
2951-
}
29522949

29532950
wcd937x_dt_parse_micbias_info(dev, wcd937x);
29542951

@@ -2984,7 +2981,6 @@ static int wcd937x_probe(struct platform_device *pdev)
29842981

29852982
err_disable_regulators:
29862983
regulator_bulk_disable(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies);
2987-
regulator_bulk_free(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies);
29882984

29892985
return ret;
29902986
}
@@ -3001,7 +2997,6 @@ static void wcd937x_remove(struct platform_device *pdev)
30012997
pm_runtime_dont_use_autosuspend(dev);
30022998

30032999
regulator_bulk_disable(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies);
3004-
regulator_bulk_free(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies);
30053000
}
30063001

30073002
#if defined(CONFIG_OF)

0 commit comments

Comments
 (0)