Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 283938
b: refs/heads/master
c: d9a7666
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Dec 12, 2011
1 parent d5f39e9 commit bc0b3f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 52 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: 68556ca1e03d6a35be3b315eba58df2f8176e3a0
refs/heads/master: d9a7666ff3a9e109844bf5aca5f50e3743f65840
63 changes: 12 additions & 51 deletions trunk/sound/soc/codecs/wm8994.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,44 +184,6 @@ static int wm8994_volatile(struct snd_soc_codec *codec, unsigned int reg)
}
}

static int wm8994_write(struct snd_soc_codec *codec, unsigned int reg,
unsigned int value)
{
int ret;

BUG_ON(reg > WM8994_MAX_REGISTER);

if (!wm8994_volatile(codec, reg)) {
ret = snd_soc_cache_write(codec, reg, value);
if (ret != 0)
dev_err(codec->dev, "Cache write to %x failed: %d\n",
reg, ret);
}

return wm8994_reg_write(codec->control_data, reg, value);
}

static unsigned int wm8994_read(struct snd_soc_codec *codec,
unsigned int reg)
{
unsigned int val;
int ret;

BUG_ON(reg > WM8994_MAX_REGISTER);

if (!wm8994_volatile(codec, reg) && wm8994_readable(codec, reg) &&
reg < codec->driver->reg_cache_size) {
ret = snd_soc_cache_read(codec, reg, &val);
if (ret >= 0)
return val;
else
dev_err(codec->dev, "Cache read from %x failed: %d\n",
reg, ret);
}

return wm8994_reg_read(codec->control_data, reg);
}

static int configure_aif_clock(struct snd_soc_codec *codec, int aif)
{
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
Expand Down Expand Up @@ -2839,8 +2801,8 @@ static int wm8994_resume(struct snd_soc_codec *codec)

if (wm8994->revision < 4) {
/* force a HW read */
val = wm8994_reg_read(codec->control_data,
WM8994_POWER_MANAGEMENT_5);
ret = regmap_read(control->regmap,
WM8994_POWER_MANAGEMENT_5, &val);

/* modify the cache only */
codec->cache_only = 1;
Expand Down Expand Up @@ -3455,20 +3417,21 @@ static irqreturn_t wm8994_temp_shut(int irq, void *data)

static int wm8994_codec_probe(struct snd_soc_codec *codec)
{
struct wm8994 *control;
struct wm8994 *control = dev_get_drvdata(codec->dev->parent);
struct wm8994_priv *wm8994;
struct snd_soc_dapm_context *dapm = &codec->dapm;
unsigned int reg;
int ret, i;

codec->control_data = dev_get_drvdata(codec->dev->parent);
control = codec->control_data;
codec->control_data = control->regmap;

wm8994 = devm_kzalloc(codec->dev, sizeof(struct wm8994_priv),
GFP_KERNEL);
if (wm8994 == NULL)
return -ENOMEM;
snd_soc_codec_set_drvdata(codec, wm8994);

snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);

wm8994->wm8994 = dev_get_drvdata(codec->dev->parent);
wm8994->pdata = dev_get_platdata(codec->dev->parent);
Expand All @@ -3494,11 +3457,11 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
if (!wm8994_readable(codec, i) || wm8994_volatile(codec, i))
continue;

ret = wm8994_reg_read(codec->control_data, i);
ret = regmap_read(control->regmap, i, &reg);
if (ret <= 0)
continue;

ret = snd_soc_cache_write(codec, i, ret);
ret = snd_soc_cache_write(codec, i, reg);
if (ret != 0) {
dev_err(codec->dev,
"Failed to initialise cache for 0x%x: %d\n",
Expand Down Expand Up @@ -3653,24 +3616,24 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
* configured on init - if a system wants to do this dynamically
* at runtime we can deal with that then.
*/
ret = wm8994_reg_read(codec->control_data, WM8994_GPIO_1);
ret = regmap_read(control->regmap, WM8994_GPIO_1, &reg);
if (ret < 0) {
dev_err(codec->dev, "Failed to read GPIO1 state: %d\n", ret);
goto err_irq;
}
if ((ret & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) {
if ((reg & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) {
wm8994->lrclk_shared[0] = 1;
wm8994_dai[0].symmetric_rates = 1;
} else {
wm8994->lrclk_shared[0] = 0;
}

ret = wm8994_reg_read(codec->control_data, WM8994_GPIO_6);
ret = regmap_read(control->regmap, WM8994_GPIO_6, &reg);
if (ret < 0) {
dev_err(codec->dev, "Failed to read GPIO6 state: %d\n", ret);
goto err_irq;
}
if ((ret & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) {
if ((reg & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) {
wm8994->lrclk_shared[1] = 1;
wm8994_dai[1].symmetric_rates = 1;
} else {
Expand Down Expand Up @@ -3937,8 +3900,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 = {
.remove = wm8994_codec_remove,
.suspend = wm8994_suspend,
.resume = wm8994_resume,
.read = wm8994_read,
.write = wm8994_write,
.readable_register = wm8994_readable,
.volatile_register = wm8994_volatile,
.set_bias_level = wm8994_set_bias_level,
Expand Down

0 comments on commit bc0b3f7

Please sign in to comment.