Commit 96920630 authored by Mark Brown's avatar Mark Brown Committed by Samuel Ortiz

mfd: Add WM8352 support

The WM8352 is a variant of the WM8350. Aside from the register defaults
there are no software visible differences to the WM8350.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@openedhand.com>
parent 94964f96
...@@ -143,6 +143,22 @@ config MFD_WM8350_CONFIG_MODE_3 ...@@ -143,6 +143,22 @@ config MFD_WM8350_CONFIG_MODE_3
bool bool
depends on MFD_WM8350 depends on MFD_WM8350
config MFD_WM8352_CONFIG_MODE_0
bool
depends on MFD_WM8350
config MFD_WM8352_CONFIG_MODE_1
bool
depends on MFD_WM8350
config MFD_WM8352_CONFIG_MODE_2
bool
depends on MFD_WM8350
config MFD_WM8352_CONFIG_MODE_3
bool
depends on MFD_WM8350
config MFD_WM8350_I2C config MFD_WM8350_I2C
tristate "Support Wolfson Microelectronics WM8350 with I2C" tristate "Support Wolfson Microelectronics WM8350 with I2C"
select MFD_WM8350 select MFD_WM8350
......
...@@ -1133,35 +1133,75 @@ EXPORT_SYMBOL_GPL(wm8350_read_auxadc); ...@@ -1133,35 +1133,75 @@ EXPORT_SYMBOL_GPL(wm8350_read_auxadc);
/* /*
* Cache is always host endian. * Cache is always host endian.
*/ */
static int wm8350_create_cache(struct wm8350 *wm8350, int mode) static int wm8350_create_cache(struct wm8350 *wm8350, int type, int mode)
{ {
int i, ret = 0; int i, ret = 0;
u16 value; u16 value;
const u16 *reg_map; const u16 *reg_map;
switch (mode) { switch (type) {
#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_0
case 0: case 0:
reg_map = wm8350_mode0_defaults; switch (mode) {
break; #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_0
case 0:
reg_map = wm8350_mode0_defaults;
break;
#endif #endif
#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_1 #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_1
case 1: case 1:
reg_map = wm8350_mode1_defaults; reg_map = wm8350_mode1_defaults;
break; break;
#endif #endif
#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_2 #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_2
case 2: case 2:
reg_map = wm8350_mode2_defaults; reg_map = wm8350_mode2_defaults;
break; break;
#endif #endif
#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_3 #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_3
case 3: case 3:
reg_map = wm8350_mode3_defaults; reg_map = wm8350_mode3_defaults;
break; break;
#endif #endif
default:
dev_err(wm8350->dev,
"WM8350 configuration mode %d not supported\n",
mode);
return -EINVAL;
}
case 2:
switch (mode) {
#ifdef CONFIG_MFD_WM8352_CONFIG_MODE_0
case 0:
reg_map = wm8352_mode0_defaults;
break;
#endif
#ifdef CONFIG_MFD_WM8352_CONFIG_MODE_1
case 1:
reg_map = wm8352_mode1_defaults;
break;
#endif
#ifdef CONFIG_MFD_WM8352_CONFIG_MODE_2
case 2:
reg_map = wm8352_mode2_defaults;
break;
#endif
#ifdef CONFIG_MFD_WM8352_CONFIG_MODE_3
case 3:
reg_map = wm8352_mode3_defaults;
break;
#endif
default:
dev_err(wm8350->dev,
"WM8352 configuration mode %d not supported\n",
mode);
return -EINVAL;
}
break;
default: default:
dev_err(wm8350->dev, "Configuration mode %d not supported\n", dev_err(wm8350->dev,
"WM835x configuration mode %d not supported\n",
mode); mode);
return -EINVAL; return -EINVAL;
} }
...@@ -1284,13 +1324,27 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, ...@@ -1284,13 +1324,27 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
} }
break; break;
case 2:
switch (chip_rev) {
case 0:
dev_info(wm8350->dev, "WM8352 Rev A\n");
wm8350->power.rev_g_coeff = 1;
break;
default:
dev_err(wm8350->dev, "Unknown WM8352 CHIP_REV\n");
ret = -ENODEV;
goto err;
}
break;
default: default:
dev_err(wm8350->dev, "Unknown MASK_REV\n"); dev_err(wm8350->dev, "Unknown MASK_REV\n");
ret = -ENODEV; ret = -ENODEV;
goto err; goto err;
} }
ret = wm8350_create_cache(wm8350, mode); ret = wm8350_create_cache(wm8350, mask_rev, mode);
if (ret < 0) { if (ret < 0) {
dev_err(wm8350->dev, "Failed to create register cache\n"); dev_err(wm8350->dev, "Failed to create register cache\n");
return ret; return ret;
......
...@@ -97,6 +97,7 @@ static int wm8350_i2c_remove(struct i2c_client *i2c) ...@@ -97,6 +97,7 @@ static int wm8350_i2c_remove(struct i2c_client *i2c)
static const struct i2c_device_id wm8350_i2c_id[] = { static const struct i2c_device_id wm8350_i2c_id[] = {
{ "wm8350", 0 }, { "wm8350", 0 },
{ "wm8352", 0 },
{ } { }
}; };
MODULE_DEVICE_TABLE(i2c, wm8350_i2c_id); MODULE_DEVICE_TABLE(i2c, wm8350_i2c_id);
......
This diff is collapsed.
...@@ -589,6 +589,10 @@ extern const u16 wm8350_mode0_defaults[]; ...@@ -589,6 +589,10 @@ extern const u16 wm8350_mode0_defaults[];
extern const u16 wm8350_mode1_defaults[]; extern const u16 wm8350_mode1_defaults[];
extern const u16 wm8350_mode2_defaults[]; extern const u16 wm8350_mode2_defaults[];
extern const u16 wm8350_mode3_defaults[]; extern const u16 wm8350_mode3_defaults[];
extern const u16 wm8352_mode0_defaults[];
extern const u16 wm8352_mode1_defaults[];
extern const u16 wm8352_mode2_defaults[];
extern const u16 wm8352_mode3_defaults[];
struct wm8350; struct wm8350;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment