static int wm8737_probe(struct snd_soc_codec *codec) { struct wm8737_priv *wm8737 = snd_soc_codec_get_drvdata(codec); int ret; ret = regulator_bulk_enable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); if (ret != 0) { dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); goto err_get; } ret = wm8737_reset(codec); if (ret < 0) { dev_err(codec->dev, "Failed to issue reset\n"); goto err_enable; } snd_soc_update_bits(codec, WM8737_LEFT_PGA_VOLUME, WM8737_LVU, WM8737_LVU); snd_soc_update_bits(codec, WM8737_RIGHT_PGA_VOLUME, WM8737_RVU, WM8737_RVU); wm8737_set_bias_level(codec, SND_SOC_BIAS_STANDBY); /* Bias level configuration will have done an extra enable */ regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); return 0; err_enable: regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); err_get: return ret; }
static int wm8737_remove(struct snd_soc_codec *codec) { struct wm8737_priv *wm8737 = snd_soc_codec_get_drvdata(codec); wm8737_set_bias_level(codec, SND_SOC_BIAS_OFF); regulator_bulk_free(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); return 0; }
static int wm8737_probe(struct snd_soc_codec *codec) { struct wm8737_priv *wm8737 = snd_soc_codec_get_drvdata(codec); int ret, i; ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8737->control_type); if (ret != 0) { dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); return ret; } for (i = 0; i < ARRAY_SIZE(wm8737->supplies); i++) wm8737->supplies[i].supply = wm8737_supply_names[i]; ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8737->supplies), wm8737->supplies); if (ret != 0) { dev_err(codec->dev, "Failed to request supplies: %d\n", ret); return ret; } ret = regulator_bulk_enable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); if (ret != 0) { dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); goto err_get; } ret = wm8737_reset(codec); if (ret < 0) { dev_err(codec->dev, "Failed to issue reset\n"); goto err_enable; } snd_soc_update_bits(codec, WM8737_LEFT_PGA_VOLUME, WM8737_LVU, WM8737_LVU); snd_soc_update_bits(codec, WM8737_RIGHT_PGA_VOLUME, WM8737_RVU, WM8737_RVU); wm8737_set_bias_level(codec, SND_SOC_BIAS_STANDBY); /* Bias level configuration will have done an extra enable */ regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); snd_soc_add_controls(codec, wm8737_snd_controls, ARRAY_SIZE(wm8737_snd_controls)); wm8737_add_widgets(codec); return 0; err_enable: regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); err_get: regulator_bulk_free(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); return ret; }
static int wm8737_resume(struct snd_soc_codec *codec) { wm8737_set_bias_level(codec, SND_SOC_BIAS_STANDBY); return 0; }
static int wm8737_suspend(struct snd_soc_codec *codec) { wm8737_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; }