Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 293248
b: refs/heads/master
c: 1cf7335
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Jan 26, 2012
1 parent d140855 commit 809a76a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 122 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 62ea874abc11f02dbeb05314eb82f7d38e82e894
refs/heads/master: 1cf733569e6f484a09cb7e4b8602a48c32864594
131 changes: 10 additions & 121 deletions trunk/sound/soc/codecs/wm5100.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ struct wm5100_priv {
struct snd_soc_codec *codec;

struct regulator_bulk_data core_supplies[WM5100_NUM_CORE_SUPPLIES];
struct regulator *cpvdd;
struct regulator *dbvdd2;
struct regulator *dbvdd3;

int rev;

Expand Down Expand Up @@ -777,85 +774,6 @@ static int wm5100_out_ev(struct snd_soc_dapm_widget *w,
return 0;
}

static int wm5100_cp_ev(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{
struct snd_soc_codec *codec = w->codec;
struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec);
int ret;

switch (event) {
case SND_SOC_DAPM_PRE_PMU:
ret = regulator_enable(wm5100->cpvdd);
if (ret != 0) {
dev_err(codec->dev, "Failed to enable CPVDD: %d\n",
ret);
return ret;
}
return ret;

case SND_SOC_DAPM_POST_PMD:
ret = regulator_disable_deferred(wm5100->cpvdd, 20);
if (ret != 0) {
dev_err(codec->dev, "Failed to disable CPVDD: %d\n",
ret);
return ret;
}
return ret;

default:
BUG();
return 0;
}
}

static int wm5100_dbvdd_ev(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{
struct snd_soc_codec *codec = w->codec;
struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec);
struct regulator *regulator;
int ret;

switch (w->shift) {
case 2:
regulator = wm5100->dbvdd2;
break;
case 3:
regulator = wm5100->dbvdd3;
break;
default:
BUG();
return 0;
}

switch (event) {
case SND_SOC_DAPM_PRE_PMU:
ret = regulator_enable(regulator);
if (ret != 0) {
dev_err(codec->dev, "Failed to enable DBVDD%d: %d\n",
w->shift, ret);
return ret;
}
return ret;

case SND_SOC_DAPM_POST_PMD:
ret = regulator_disable(regulator);
if (ret != 0) {
dev_err(codec->dev, "Failed to enable DBVDD%d: %d\n",
w->shift, ret);
return ret;
}
return ret;

default:
BUG();
return 0;
}
}

static void wm5100_log_status3(struct wm5100_priv *wm5100, int val)
{
if (val & WM5100_SPK_SHUTDOWN_WARN_EINT)
Expand Down Expand Up @@ -926,18 +844,16 @@ SND_SOC_DAPM_SUPPLY("SYSCLK", WM5100_CLOCKING_3, WM5100_SYSCLK_ENA_SHIFT, 0,
SND_SOC_DAPM_SUPPLY("ASYNCCLK", WM5100_CLOCKING_6, WM5100_ASYNC_CLK_ENA_SHIFT,
0, NULL, 0),

SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20),
SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0),
SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD3", 0),

SND_SOC_DAPM_SUPPLY("CP1", WM5100_HP_CHARGE_PUMP_1, WM5100_CP1_ENA_SHIFT, 0,
wm5100_cp_ev,
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
NULL, 0),
SND_SOC_DAPM_SUPPLY("CP2", WM5100_MIC_CHARGE_PUMP_1, WM5100_CP2_ENA_SHIFT, 0,
NULL, 0),
SND_SOC_DAPM_SUPPLY("CP2 Active", WM5100_MIC_CHARGE_PUMP_1,
WM5100_CP2_BYPASS_SHIFT, 1, wm5100_cp_ev,
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_SUPPLY("DBVDD2", SND_SOC_NOPM, 2, 0, wm5100_dbvdd_ev,
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_SUPPLY("DBVDD3", SND_SOC_NOPM, 3, 0, wm5100_dbvdd_ev,
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
WM5100_CP2_BYPASS_SHIFT, 1, NULL, 0),

SND_SOC_DAPM_SUPPLY("MICBIAS1", WM5100_MIC_BIAS_CTRL_1, WM5100_MICB1_ENA_SHIFT,
0, NULL, 0),
Expand Down Expand Up @@ -1148,6 +1064,9 @@ SND_SOC_DAPM_POST("Post", wm5100_post_ev),
};

static const struct snd_soc_dapm_route wm5100_dapm_routes[] = {
{ "CP1", NULL, "CPVDD" },
{ "CP2 Active", NULL, "CPVDD" },

{ "IN1L", NULL, "SYSCLK" },
{ "IN1R", NULL, "SYSCLK" },
{ "IN2L", NULL, "SYSCLK" },
Expand Down Expand Up @@ -2593,33 +2512,12 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c,
goto err_regmap;
}

wm5100->cpvdd = regulator_get(&i2c->dev, "CPVDD");
if (IS_ERR(wm5100->cpvdd)) {
ret = PTR_ERR(wm5100->cpvdd);
dev_err(&i2c->dev, "Failed to get CPVDD: %d\n", ret);
goto err_core;
}

wm5100->dbvdd2 = regulator_get(&i2c->dev, "DBVDD2");
if (IS_ERR(wm5100->dbvdd2)) {
ret = PTR_ERR(wm5100->dbvdd2);
dev_err(&i2c->dev, "Failed to get DBVDD2: %d\n", ret);
goto err_cpvdd;
}

wm5100->dbvdd3 = regulator_get(&i2c->dev, "DBVDD3");
if (IS_ERR(wm5100->dbvdd3)) {
ret = PTR_ERR(wm5100->dbvdd3);
dev_err(&i2c->dev, "Failed to get DBVDD2: %d\n", ret);
goto err_dbvdd2;
}

ret = regulator_bulk_enable(ARRAY_SIZE(wm5100->core_supplies),
wm5100->core_supplies);
if (ret != 0) {
dev_err(&i2c->dev, "Failed to enable core supplies: %d\n",
ret);
goto err_dbvdd3;
goto err_core;
}

if (wm5100->pdata.ldo_ena) {
Expand Down Expand Up @@ -2788,12 +2686,6 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c,
err_enable:
regulator_bulk_disable(ARRAY_SIZE(wm5100->core_supplies),
wm5100->core_supplies);
err_dbvdd3:
regulator_put(wm5100->dbvdd3);
err_dbvdd2:
regulator_put(wm5100->dbvdd2);
err_cpvdd:
regulator_put(wm5100->cpvdd);
err_core:
regulator_bulk_free(ARRAY_SIZE(wm5100->core_supplies),
wm5100->core_supplies);
Expand All @@ -2819,9 +2711,6 @@ static __devexit int wm5100_i2c_remove(struct i2c_client *i2c)
gpio_set_value_cansleep(wm5100->pdata.ldo_ena, 0);
gpio_free(wm5100->pdata.ldo_ena);
}
regulator_put(wm5100->dbvdd3);
regulator_put(wm5100->dbvdd2);
regulator_put(wm5100->cpvdd);
regulator_bulk_free(ARRAY_SIZE(wm5100->core_supplies),
wm5100->core_supplies);
regmap_exit(wm5100->regmap);
Expand Down

0 comments on commit 809a76a

Please sign in to comment.