mirror of
https://github.com/torvalds/linux.git
synced 2026-07-29 02:31:27 +02:00
ASoC: codecs: wcd937x: Simplify with devm_regulator_bulk_get_enable()
Drop separate regulator get and enable in probe() path with devm_regulator_bulk_get_enable(), which simplifies cleanup paths and device remove(). Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20250526-b4-asoc-wcd9395-vdd-px-v1-1-64d3cb60313b@linaro.org Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
19272b37aa
commit
10cf8f6be6
|
|
@ -90,7 +90,6 @@ struct wcd937x_priv {
|
|||
struct irq_domain *virq;
|
||||
struct regmap_irq_chip *wcd_regmap_irq_chip;
|
||||
struct regmap_irq_chip_data *irq_chip;
|
||||
struct regulator_bulk_data supplies[WCD937X_MAX_BULK_SUPPLY];
|
||||
struct snd_soc_jack *jack;
|
||||
unsigned long status_mask;
|
||||
s32 micb_ref[WCD937X_MAX_MICBIAS];
|
||||
|
|
@ -113,6 +112,10 @@ struct wcd937x_priv {
|
|||
atomic_t ana_clk_count;
|
||||
};
|
||||
|
||||
static const char * const wcd937x_supplies[] = {
|
||||
"vdd-rxtx", "vdd-px", "vdd-mic-bias", "vdd-buck",
|
||||
};
|
||||
|
||||
static const SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(ear_pa_gain, 600, -1800);
|
||||
static const DECLARE_TLV_DB_SCALE(line_gain, 0, 7, 1);
|
||||
static const DECLARE_TLV_DB_SCALE(analog_gain, 0, 25, 1);
|
||||
|
|
@ -2934,18 +2937,10 @@ static int wcd937x_probe(struct platform_device *pdev)
|
|||
cfg = &wcd937x->mbhc_cfg;
|
||||
cfg->swap_gnd_mic = wcd937x_swap_gnd_mic;
|
||||
|
||||
wcd937x->supplies[0].supply = "vdd-rxtx";
|
||||
wcd937x->supplies[1].supply = "vdd-px";
|
||||
wcd937x->supplies[2].supply = "vdd-mic-bias";
|
||||
wcd937x->supplies[3].supply = "vdd-buck";
|
||||
|
||||
ret = devm_regulator_bulk_get(dev, WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies);
|
||||
ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(wcd937x_supplies),
|
||||
wcd937x_supplies);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "Failed to get supplies\n");
|
||||
|
||||
ret = regulator_bulk_enable(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "Failed to enable supplies\n");
|
||||
return dev_err_probe(dev, ret, "Failed to get and enable supplies\n");
|
||||
|
||||
wcd937x_dt_parse_micbias_info(dev, wcd937x);
|
||||
|
||||
|
|
@ -2962,13 +2957,13 @@ static int wcd937x_probe(struct platform_device *pdev)
|
|||
|
||||
ret = wcd937x_add_slave_components(wcd937x, dev, &match);
|
||||
if (ret)
|
||||
goto err_disable_regulators;
|
||||
return ret;
|
||||
|
||||
wcd937x_reset(wcd937x);
|
||||
|
||||
ret = component_master_add_with_match(dev, &wcd937x_comp_ops, match);
|
||||
if (ret)
|
||||
goto err_disable_regulators;
|
||||
return ret;
|
||||
|
||||
pm_runtime_set_autosuspend_delay(dev, 1000);
|
||||
pm_runtime_use_autosuspend(dev);
|
||||
|
|
@ -2978,25 +2973,17 @@ static int wcd937x_probe(struct platform_device *pdev)
|
|||
pm_runtime_idle(dev);
|
||||
|
||||
return 0;
|
||||
|
||||
err_disable_regulators:
|
||||
regulator_bulk_disable(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void wcd937x_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct wcd937x_priv *wcd937x = dev_get_drvdata(dev);
|
||||
|
||||
component_master_del(&pdev->dev, &wcd937x_comp_ops);
|
||||
|
||||
pm_runtime_disable(dev);
|
||||
pm_runtime_set_suspended(dev);
|
||||
pm_runtime_dont_use_autosuspend(dev);
|
||||
|
||||
regulator_bulk_disable(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_OF)
|
||||
|
|
|
|||
|
|
@ -487,7 +487,6 @@
|
|||
#define WCD937X_MAX_REGISTER (WCD937X_DIGITAL_EFUSE_REG_31)
|
||||
|
||||
#define WCD937X_MAX_MICBIAS 3
|
||||
#define WCD937X_MAX_BULK_SUPPLY 4
|
||||
#define WCD937X_MAX_SWR_CH_IDS 15
|
||||
#define WCD937X_SWRM_CH_MASK(ch_idx) BIT(ch_idx - 1)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user