* [PATCH 1/2] mfd: arizona: Defer patch initialistation until after first device boot
@ 2012-12-01 17:11 Mark Brown
2012-12-01 17:11 ` [PATCH 2/2] mfd: wm5102: Add tuning for revision B Mark Brown
2012-12-02 2:34 ` [PATCH 1/2] mfd: arizona: Defer patch initialistation until after first device boot Mark Brown
0 siblings, 2 replies; 5+ messages in thread
From: Mark Brown @ 2012-12-01 17:11 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: linux-kernel, patches, Mark Brown
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>
---
drivers/mfd/arizona-core.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index c784f46..f1ed9ae 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -292,6 +292,7 @@ int arizona_dev_init(struct arizona *arizona)
struct device *dev = arizona->dev;
const char *type_name;
unsigned int reg, val;
+ int (*apply_patch)(struct arizona *) = NULL;
int ret, i;
dev_set_drvdata(arizona->dev, arizona);
@@ -391,7 +392,7 @@ int arizona_dev_init(struct arizona *arizona)
arizona->type);
arizona->type = WM5102;
}
- ret = wm5102_patch(arizona);
+ apply_patch = wm5102_patch;
break;
#endif
#ifdef CONFIG_MFD_WM5110
@@ -402,7 +403,7 @@ int arizona_dev_init(struct arizona *arizona)
arizona->type);
arizona->type = WM5110;
}
- ret = wm5110_patch(arizona);
+ apply_patch = wm5110_patch;
break;
#endif
default:
@@ -412,9 +413,6 @@ int arizona_dev_init(struct arizona *arizona)
dev_info(dev, "%s revision %c\n", type_name, arizona->rev + 'A');
- if (ret != 0)
- dev_err(arizona->dev, "Failed to apply patch: %d\n", ret);
-
/* If we have a /RESET GPIO we'll already be reset */
if (!arizona->pdata.reset) {
regcache_mark_dirty(arizona->regmap);
@@ -438,6 +436,14 @@ int arizona_dev_init(struct arizona *arizona)
goto err_reset;
}
+ if (apply_patch) {
+ ret = apply_patch(arizona);
+ if (ret != 0)
+ dev_err(arizona->dev, "Failed to apply patch: %d\n",
+ ret);
+ goto err_reset;
+ }
+
for (i = 0; i < ARRAY_SIZE(arizona->pdata.gpio_defaults); i++) {
if (!arizona->pdata.gpio_defaults[i])
continue;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] mfd: wm5102: Add tuning for revision B
2012-12-01 17:11 [PATCH 1/2] mfd: arizona: Defer patch initialistation until after first device boot Mark Brown
@ 2012-12-01 17:11 ` Mark Brown
2012-12-02 2:34 ` [PATCH 1/2] mfd: arizona: Defer patch initialistation until after first device boot Mark Brown
1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2012-12-01 17:11 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: linux-kernel, patches, Mark Brown
Evaluation of revision B of WM5102 suggests updates to the register patch
for optimal performance, and make this the default behaviour for new
devices.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/mfd/wm5102-tables.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/wm5102-tables.c b/drivers/mfd/wm5102-tables.c
index 8bd0504..36708b0 100644
--- a/drivers/mfd/wm5102-tables.c
+++ b/drivers/mfd/wm5102-tables.c
@@ -56,6 +56,18 @@ static const struct reg_default wm5102_reva_patch[] = {
{ 0x80, 0x0000 },
};
+static const struct reg_default wm5102_revb_patch[] = {
+ { 0x80, 0x0003 },
+ { 0x081, 0xE022 },
+ { 0x410, 0x6080 },
+ { 0x418, 0x6080 },
+ { 0x420, 0x6080 },
+ { 0x428, 0xC000 },
+ { 0x441, 0x8014 },
+ { 0x458, 0x000b },
+ { 0x80, 0x0000 },
+};
+
/* We use a function so we can use ARRAY_SIZE() */
int wm5102_patch(struct arizona *arizona)
{
@@ -65,7 +77,9 @@ int wm5102_patch(struct arizona *arizona)
wm5102_reva_patch,
ARRAY_SIZE(wm5102_reva_patch));
default:
- return 0;
+ return regmap_register_patch(arizona->regmap,
+ wm5102_revb_patch,
+ ARRAY_SIZE(wm5102_revb_patch));
}
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] mfd: arizona: Defer patch initialistation until after first device boot
2012-12-01 17:11 [PATCH 1/2] mfd: arizona: Defer patch initialistation until after first device boot Mark Brown
2012-12-01 17:11 ` [PATCH 2/2] mfd: wm5102: Add tuning for revision B Mark Brown
@ 2012-12-02 2:34 ` Mark Brown
1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2012-12-02 2:34 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: linux-kernel, patches
[-- Attachment #1: Type: text/plain, Size: 249 bytes --]
On Sun, Dec 02, 2012 at 02:11:51AM +0900, Mark Brown wrote:
> 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.
This is broken, will send a fixed version soon.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] mfd: arizona: Defer patch initialistation until after first device boot
@ 2012-12-02 2:41 Mark Brown
2012-12-02 23:41 ` Samuel Ortiz
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2012-12-02 2:41 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: linux-kernel, patches, Mark Brown
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>
---
drivers/mfd/arizona-core.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index c784f46..bc8a3ed 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -292,6 +292,7 @@ int arizona_dev_init(struct arizona *arizona)
struct device *dev = arizona->dev;
const char *type_name;
unsigned int reg, val;
+ int (*apply_patch)(struct arizona *) = NULL;
int ret, i;
dev_set_drvdata(arizona->dev, arizona);
@@ -391,7 +392,7 @@ int arizona_dev_init(struct arizona *arizona)
arizona->type);
arizona->type = WM5102;
}
- ret = wm5102_patch(arizona);
+ apply_patch = wm5102_patch;
break;
#endif
#ifdef CONFIG_MFD_WM5110
@@ -402,7 +403,7 @@ int arizona_dev_init(struct arizona *arizona)
arizona->type);
arizona->type = WM5110;
}
- ret = wm5110_patch(arizona);
+ apply_patch = wm5110_patch;
break;
#endif
default:
@@ -412,9 +413,6 @@ int arizona_dev_init(struct arizona *arizona)
dev_info(dev, "%s revision %c\n", type_name, arizona->rev + 'A');
- if (ret != 0)
- dev_err(arizona->dev, "Failed to apply patch: %d\n", ret);
-
/* If we have a /RESET GPIO we'll already be reset */
if (!arizona->pdata.reset) {
regcache_mark_dirty(arizona->regmap);
@@ -438,6 +436,15 @@ int arizona_dev_init(struct arizona *arizona)
goto err_reset;
}
+ if (apply_patch) {
+ ret = apply_patch(arizona);
+ if (ret != 0) {
+ dev_err(arizona->dev, "Failed to apply patch: %d\n",
+ ret);
+ goto err_reset;
+ }
+ }
+
for (i = 0; i < ARRAY_SIZE(arizona->pdata.gpio_defaults); i++) {
if (!arizona->pdata.gpio_defaults[i])
continue;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] mfd: arizona: Defer patch initialistation until after first device boot
2012-12-02 2:41 Mark Brown
@ 2012-12-02 23:41 ` Samuel Ortiz
0 siblings, 0 replies; 5+ messages in thread
From: Samuel Ortiz @ 2012-12-02 23:41 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel, patches
Hi Mark,
On Sun, Dec 02, 2012 at 11:41:46AM +0900, Mark Brown wrote:
> 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>
> ---
> drivers/mfd/arizona-core.c | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
Applied, thanks.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-12-02 23:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-01 17:11 [PATCH 1/2] mfd: arizona: Defer patch initialistation until after first device boot Mark Brown
2012-12-01 17:11 ` [PATCH 2/2] mfd: wm5102: Add tuning for revision B Mark Brown
2012-12-02 2:34 ` [PATCH 1/2] mfd: arizona: Defer patch initialistation until after first device boot Mark Brown
-- strict thread matches above, loose matches on Subject: below --
2012-12-02 2:41 Mark Brown
2012-12-02 23:41 ` Samuel Ortiz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox