Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 283929
b: refs/heads/master
c: 3469789
h: refs/heads/master
i:
  283927: 8754fb2
v: v3
  • Loading branch information
Mark Brown committed Dec 12, 2011
1 parent 565036d commit 7aa4d9b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 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: c3f1386171a100d27d9fb978f474a6a330888af5
refs/heads/master: 346978980a781a5b434c48531cf29cadf5b83999
41 changes: 24 additions & 17 deletions trunk/drivers/mfd/wm8994-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ static int wm8994_ldo_in_use(struct wm8994_pdata *pdata, int ldo)
static int wm8994_device_init(struct wm8994 *wm8994, int irq)
{
struct wm8994_pdata *pdata = wm8994->dev->platform_data;
struct regmap_config *regmap_config;
const char *devname;
int ret, i;
int pulls = 0;
Expand Down Expand Up @@ -465,6 +466,28 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)

dev_info(wm8994->dev, "%s revision %c\n", devname, 'A' + ret);

switch (wm8994->type) {
case WM1811:
regmap_config = &wm1811_regmap_config;
break;
case WM8994:
regmap_config = &wm8994_regmap_config;
break;
case WM8958:
regmap_config = &wm8958_regmap_config;
break;
default:
dev_err(wm8994->dev, "Unknown device type %d\n", wm8994->type);
return -EINVAL;
}

ret = regmap_reinit_cache(wm8994->regmap, regmap_config);
if (ret != 0) {
dev_err(wm8994->dev, "Failed to reinit register cache: %d\n",
ret);
return ret;
}

if (pdata) {
wm8994->irq_base = pdata->irq_base;
wm8994->gpio_base = pdata->gpio_base;
Expand Down Expand Up @@ -556,7 +579,6 @@ static int wm8994_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct wm8994 *wm8994;
struct regmap_config *regmap_config;
int ret;

wm8994 = devm_kzalloc(&i2c->dev, sizeof(struct wm8994), GFP_KERNEL);
Expand All @@ -568,22 +590,7 @@ static int wm8994_i2c_probe(struct i2c_client *i2c,
wm8994->irq = i2c->irq;
wm8994->type = id->driver_data;

switch (wm8994->type) {
case WM1811:
regmap_config = &wm1811_regmap_config;
break;
case WM8994:
regmap_config = &wm8994_regmap_config;
break;
case WM8958:
regmap_config = &wm8958_regmap_config;
break;
default:
dev_err(wm8994->dev, "Unknown device type %d\n", wm8994->type);
return -EINVAL;
}

wm8994->regmap = regmap_init_i2c(i2c, regmap_config);
wm8994->regmap = regmap_init_i2c(i2c, &wm8994_base_regmap_config);
if (IS_ERR(wm8994->regmap)) {
ret = PTR_ERR(wm8994->regmap);
dev_err(wm8994->dev, "Failed to allocate register map: %d\n",
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/mfd/wm8994-regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1216,3 +1216,8 @@ struct regmap_config wm8958_regmap_config = {
.volatile_reg = wm8958_volatile_register,
.readable_reg = wm8958_readable_register,
};

struct regmap_config wm8994_base_regmap_config = {
.reg_bits = 16,
.val_bits = 16,
};
1 change: 1 addition & 0 deletions trunk/drivers/mfd/wm8994.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
extern struct regmap_config wm1811_regmap_config;
extern struct regmap_config wm8994_regmap_config;
extern struct regmap_config wm8958_regmap_config;
extern struct regmap_config wm8994_base_regmap_config;

#endif

0 comments on commit 7aa4d9b

Please sign in to comment.