Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 286766
b: refs/heads/master
c: c83f1d7
h: refs/heads/master
v: v3
  • Loading branch information
Jesper Juhl authored and Mark Brown committed Jan 24, 2012
1 parent 8d72e8c commit 3b9be03
Show file tree
Hide file tree
Showing 2 changed files with 14 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: 7edf1a4f27f44588d69cbde955651990090eb25d
refs/heads/master: c83f1d7e71625801c72f4013291194e09b6f0a6e
31 changes: 13 additions & 18 deletions trunk/sound/soc/codecs/wm2000.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,8 +733,9 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
struct wm2000_priv *wm2000;
struct wm2000_platform_data *pdata;
const char *filename;
const struct firmware *fw;
int reg, ret;
const struct firmware *fw = NULL;
int ret;
int reg;
u16 id;

wm2000 = devm_kzalloc(&i2c->dev, sizeof(struct wm2000_priv),
Expand All @@ -751,7 +752,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
ret = PTR_ERR(wm2000->regmap);
dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
ret);
goto err;
goto out;
}

/* Verify that this is a WM2000 */
Expand All @@ -763,7 +764,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
if (id != 0x2000) {
dev_err(&i2c->dev, "Device is not a WM2000 - ID %x\n", id);
ret = -ENODEV;
goto err_regmap;
goto out_regmap_exit;
}

reg = wm2000_read(i2c, WM2000_REG_REVISON);
Expand All @@ -782,7 +783,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
ret = request_firmware(&fw, filename, &i2c->dev);
if (ret != 0) {
dev_err(&i2c->dev, "Failed to acquire ANC data: %d\n", ret);
goto err_regmap;
goto out_regmap_exit;
}

/* Pre-cook the concatenation of the register address onto the image */
Expand All @@ -793,34 +794,28 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
if (wm2000->anc_download == NULL) {
dev_err(&i2c->dev, "Out of memory\n");
ret = -ENOMEM;
goto err_fw;
goto out_regmap_exit;
}

wm2000->anc_download[0] = 0x80;
wm2000->anc_download[1] = 0x00;
memcpy(wm2000->anc_download + 2, fw->data, fw->size);

release_firmware(fw);

wm2000->anc_eng_ena = 1;
wm2000->anc_active = 1;
wm2000->spk_ena = 1;
wm2000->i2c = i2c;

wm2000_reset(wm2000);

ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000,
NULL, 0);
if (ret != 0)
goto err_fw;
ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000, NULL, 0);
if (!ret)
goto out;

return 0;

err_fw:
release_firmware(fw);
err_regmap:
out_regmap_exit:
regmap_exit(wm2000->regmap);
err:
out:
release_firmware(fw);
return ret;
}

Expand Down

0 comments on commit 3b9be03

Please sign in to comment.