diff options
Diffstat (limited to 'drivers/mfd/wm8350-core.c')
-rw-r--r-- | drivers/mfd/wm8350-core.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c index b457a05b28d9..f22b18b70796 100644 --- a/drivers/mfd/wm8350-core.c +++ b/drivers/mfd/wm8350-core.c | |||
@@ -1238,7 +1238,7 @@ static int wm8350_create_cache(struct wm8350 *wm8350, int type, int mode) | |||
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | wm8350->reg_cache = | 1240 | wm8350->reg_cache = |
1241 | kzalloc(sizeof(u16) * (WM8350_MAX_REGISTER + 1), GFP_KERNEL); | 1241 | kmalloc(sizeof(u16) * (WM8350_MAX_REGISTER + 1), GFP_KERNEL); |
1242 | if (wm8350->reg_cache == NULL) | 1242 | if (wm8350->reg_cache == NULL) |
1243 | return -ENOMEM; | 1243 | return -ENOMEM; |
1244 | 1244 | ||
@@ -1246,17 +1246,20 @@ static int wm8350_create_cache(struct wm8350 *wm8350, int type, int mode) | |||
1246 | * a PMIC so the device many not be in a virgin state and we | 1246 | * a PMIC so the device many not be in a virgin state and we |
1247 | * can't rely on the silicon values. | 1247 | * can't rely on the silicon values. |
1248 | */ | 1248 | */ |
1249 | ret = wm8350->read_dev(wm8350, 0, | ||
1250 | sizeof(u16) * (WM8350_MAX_REGISTER + 1), | ||
1251 | wm8350->reg_cache); | ||
1252 | if (ret < 0) { | ||
1253 | dev_err(wm8350->dev, | ||
1254 | "failed to read initial cache values\n"); | ||
1255 | goto out; | ||
1256 | } | ||
1257 | |||
1258 | /* Mask out uncacheable/unreadable bits and the audio. */ | ||
1249 | for (i = 0; i < WM8350_MAX_REGISTER; i++) { | 1259 | for (i = 0; i < WM8350_MAX_REGISTER; i++) { |
1250 | /* audio register range */ | ||
1251 | if (wm8350_reg_io_map[i].readable && | 1260 | if (wm8350_reg_io_map[i].readable && |
1252 | (i < WM8350_CLOCK_CONTROL_1 || i > WM8350_AIF_TEST)) { | 1261 | (i < WM8350_CLOCK_CONTROL_1 || i > WM8350_AIF_TEST)) { |
1253 | ret = wm8350->read_dev(wm8350, i, 2, (char *)&value); | 1262 | value = be16_to_cpu(wm8350->reg_cache[i]); |
1254 | if (ret < 0) { | ||
1255 | dev_err(wm8350->dev, | ||
1256 | "failed to read initial cache value\n"); | ||
1257 | goto out; | ||
1258 | } | ||
1259 | value = be16_to_cpu(value); | ||
1260 | value &= wm8350_reg_io_map[i].readable; | 1263 | value &= wm8350_reg_io_map[i].readable; |
1261 | value &= ~wm8350_reg_io_map[i].vol; | 1264 | value &= ~wm8350_reg_io_map[i].vol; |
1262 | wm8350->reg_cache[i] = value; | 1265 | wm8350->reg_cache[i] = value; |