aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/arizona-core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-01 21:41:46 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2012-12-02 18:36:44 -0500
commit62d62b59bd100b8f146ea941dad273656371a386 (patch)
tree93dc217f0188b4a70449698c471c3aa022fee8be /drivers/mfd/arizona-core.c
parent0582c0fafc36e4a1f2067ea8377c9902cc7997bf (diff)
mfd: arizona: Defer patch initialistation until after first device boot
Make sure that we don't race with the initial device boot by only doing the initialisation after we've waited for the boot to complete. The runtime PM code already waits for the boot to complete before it syncs the register patches so in most systems if a race does occur we will power down very soon afterwards and recover anyway. Reported-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/arizona-core.c')
-rw-r--r--drivers/mfd/arizona-core.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index 75619711a9e7..f59773da8adf 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -292,6 +292,7 @@ int __devinit arizona_dev_init(struct arizona *arizona)
292 struct device *dev = arizona->dev; 292 struct device *dev = arizona->dev;
293 const char *type_name; 293 const char *type_name;
294 unsigned int reg, val; 294 unsigned int reg, val;
295 int (*apply_patch)(struct arizona *) = NULL;
295 int ret, i; 296 int ret, i;
296 297
297 dev_set_drvdata(arizona->dev, arizona); 298 dev_set_drvdata(arizona->dev, arizona);
@@ -391,7 +392,7 @@ int __devinit arizona_dev_init(struct arizona *arizona)
391 arizona->type); 392 arizona->type);
392 arizona->type = WM5102; 393 arizona->type = WM5102;
393 } 394 }
394 ret = wm5102_patch(arizona); 395 apply_patch = wm5102_patch;
395 break; 396 break;
396#endif 397#endif
397#ifdef CONFIG_MFD_WM5110 398#ifdef CONFIG_MFD_WM5110
@@ -402,7 +403,7 @@ int __devinit arizona_dev_init(struct arizona *arizona)
402 arizona->type); 403 arizona->type);
403 arizona->type = WM5110; 404 arizona->type = WM5110;
404 } 405 }
405 ret = wm5110_patch(arizona); 406 apply_patch = wm5110_patch;
406 break; 407 break;
407#endif 408#endif
408 default: 409 default:
@@ -412,9 +413,6 @@ int __devinit arizona_dev_init(struct arizona *arizona)
412 413
413 dev_info(dev, "%s revision %c\n", type_name, arizona->rev + 'A'); 414 dev_info(dev, "%s revision %c\n", type_name, arizona->rev + 'A');
414 415
415 if (ret != 0)
416 dev_err(arizona->dev, "Failed to apply patch: %d\n", ret);
417
418 /* If we have a /RESET GPIO we'll already be reset */ 416 /* If we have a /RESET GPIO we'll already be reset */
419 if (!arizona->pdata.reset) { 417 if (!arizona->pdata.reset) {
420 ret = regmap_write(arizona->regmap, ARIZONA_SOFTWARE_RESET, 0); 418 ret = regmap_write(arizona->regmap, ARIZONA_SOFTWARE_RESET, 0);
@@ -430,6 +428,15 @@ int __devinit arizona_dev_init(struct arizona *arizona)
430 goto err_reset; 428 goto err_reset;
431 } 429 }
432 430
431 if (apply_patch) {
432 ret = apply_patch(arizona);
433 if (ret != 0) {
434 dev_err(arizona->dev, "Failed to apply patch: %d\n",
435 ret);
436 goto err_reset;
437 }
438 }
439
433 for (i = 0; i < ARRAY_SIZE(arizona->pdata.gpio_defaults); i++) { 440 for (i = 0; i < ARRAY_SIZE(arizona->pdata.gpio_defaults); i++) {
434 if (!arizona->pdata.gpio_defaults[i]) 441 if (!arizona->pdata.gpio_defaults[i])
435 continue; 442 continue;