Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 283855
b: refs/heads/master
c: 7d46a52
h: refs/heads/master
i:
  283853: b96b7dd
  283851: 82d0cff
  283847: 3754825
  283839: 3ea7930
v: v3
  • Loading branch information
Mark Brown committed Dec 3, 2011
1 parent 737db18 commit d4cb1e6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 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: ee244ce4ea5651989229d7f287f777f68104a59a
refs/heads/master: 7d46a528c609418e0a61121aac75edaf4992b622
41 changes: 23 additions & 18 deletions trunk/sound/soc/codecs/wm8903.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,6 @@ static bool wm8903_volatile_register(struct device *dev, unsigned int reg)
}
}

static void wm8903_reset(struct snd_soc_codec *codec)
{
snd_soc_write(codec, WM8903_SW_RESET_AND_ID, 0);
}

static int wm8903_cp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
Expand Down Expand Up @@ -1892,19 +1887,6 @@ static int wm8903_probe(struct snd_soc_codec *codec)
return ret;
}

val = snd_soc_read(codec, WM8903_SW_RESET_AND_ID);
if (val != 0x8903) {
dev_err(codec->dev,
"Device with ID register %x is not a WM8903\n", val);
return -ENODEV;
}

val = snd_soc_read(codec, WM8903_REVISION_NUMBER);
dev_info(codec->dev, "WM8903 revision %c\n",
(val & WM8903_CHIP_REV_MASK) + 'A');

wm8903_reset(codec);

/* Set up GPIOs and microphone detection */
if (pdata) {
bool mic_gpio = false;
Expand Down Expand Up @@ -2058,6 +2040,7 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct wm8903_priv *wm8903;
unsigned int val;
int ret;

wm8903 = devm_kzalloc(&i2c->dev, sizeof(struct wm8903_priv),
Expand All @@ -2076,6 +2059,28 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c,
i2c_set_clientdata(i2c, wm8903);
wm8903->irq = i2c->irq;

ret = regmap_read(wm8903->regmap, WM8903_SW_RESET_AND_ID, &val);
if (ret != 0) {
dev_err(&i2c->dev, "Failed to read chip ID: %d\n", ret);
goto err;
}
if (val != 0x8903) {
dev_err(&i2c->dev, "Device with ID %x is not a WM8903\n", val);
ret = -ENODEV;
goto err;
}

ret = regmap_read(wm8903->regmap, WM8903_REVISION_NUMBER, &val);
if (ret != 0) {
dev_err(&i2c->dev, "Failed to read chip revision: %d\n", ret);
goto err;
}
dev_info(&i2c->dev, "WM8903 revision %c\n",
(val & WM8903_CHIP_REV_MASK) + 'A');

/* Reset the device */
regmap_write(wm8903->regmap, WM8903_SW_RESET_AND_ID, 0x8903);

ret = snd_soc_register_codec(&i2c->dev,
&soc_codec_dev_wm8903, &wm8903_dai, 1);
if (ret != 0)
Expand Down

0 comments on commit d4cb1e6

Please sign in to comment.