ARM: amba: Remove AMBA level regulator support
Subsystems (5)
PATCH v2 1/1 ARM: amba: Remove AMBA level regulator support
The AMBA bus regulator support is being used to model on/off switches for power domains which isn't terribly idiomatic for modern kernels with the generic power domain code and creates integration problems on platforms which don't use regulators for their power domains as it's hard to tell the difference between a regulator that is needed but failed to be provided and one that isn't supposed to be there (though DT does make that easier).
Platforms that wish to use the regulator API to manage their power domains can indirect via the power domain interface.
This feature is only used with the vape supply of the db8500 PRCMU driver which supplies the UARTs and MMC controllers, none of which have support for managing vcore at runtime in mainline (only pl022 SPI controller does). Update that supply to have an always_on constraint until the power domain support for the system is updated so that it is enabled for these users, this is likely to have no impact on practical systems as probably at least one of these devices will be active and cause AMBA to hold the supply on anyway.
---
Updated to add the always_on constraint for db8500-prcmu as discussed in the changelog.
drivers/amba/bus.c | 42 +----------------------------------------- drivers/mfd/db8500-prcmu.c | 1 + drivers/spi/spi-pl022.c | 2 -- include/linux/amba/bus.h | 8 -------- 4 files changed, 2 insertions(+), 51 deletions(-)
drivers/amba/bus.c +1 -41
@@ -247,8 +247,7 @@ static int amba_pm_restore(struct device *dev)/* * Hooks to provide runtime PM of the pclk (bus clock). It is safe to * enable/disable the bus clock at runtime PM suspend/resume as this -* does not result in loss of context. However, disabling vcore power -* would do, so we leave that to the driver. +* does not result in loss of context. */ static int amba_pm_runtime_suspend (struct device *dev) {
@@ -354,39 +353,6 @@ static void amba_put_disable_pclk(struct amba_device *pcdev)clk_put (pclk); } -static int amba_get_enable_vcore (struct amba_device *pcdev) -{ -struct regulator *vcore =regulator_get (&pcdev->dev,"vcore" ); -int ret; - - pcdev->vcore = vcore; - -if (IS_ERR (vcore)) { -/* It is OK not to supply a vcore regulator */ -if (PTR_ERR (vcore) == -ENODEV ) -return 0 ; -return PTR_ERR (vcore); - } - - ret =regulator_enable (vcore); -if (ret) { -regulator_put (vcore); - pcdev->vcore =ERR_PTR (-ENODEV ); - } - -return ret; -} - -static void amba_put_disable_vcore (struct amba_device *pcdev) -{ -struct regulator *vcore = pcdev->vcore; - -if (!IS_ERR (vcore)) { -regulator_disable (vcore); -regulator_put (vcore); - } -} -/* * These are the device model conversion veneers; they convert the * device model structures to our more specific structures.
@@ -399,10 +365,6 @@ static int amba_probe(struct device *dev)int ret; do { - ret = amba_get_enable_vcore(pcdev); - if (ret) - break; - ret = amba_get_enable_pclk(pcdev); if (ret) break;
@@ -420,7 +382,6 @@ static int amba_probe(struct device *dev)pm_runtime_put_noidle (dev);amba_put_disable_pclk (pcdev); -amba_put_disable_vcore (pcdev); }while (0 );return ret;
@@ -442,7 +403,6 @@ static int amba_remove(struct device *dev)pm_runtime_put_noidle (dev);amba_put_disable_pclk (pcdev); -amba_put_disable_vcore (pcdev);return ret; }
drivers/mfd/db8500-prcmu.c +1 -0
@@ -2788,6 +2788,7 @@ static struct regulator_init_data db8500_regulators[DB8500_NUM_REGULATORS] = { .constraints = { .name = "db8500-vape", .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .always_on = true, }, .consumer_supplies = db8500_vape_consumers, .num_consumer_supplies = ARRAY_SIZE(db8500_vape_consumers),
drivers/spi/spi-pl022.c +0 -2
@@ -2195,7 +2195,6 @@ static int pl022_runtime_suspend(struct device *dev)struct pl022 *pl022 =dev_get_drvdata (dev);clk_disable (pl022->clk); -amba_vcore_disable (pl022->adev);return 0 ; }
@@ -2204,7 +2203,6 @@ static int pl022_runtime_resume(struct device *dev) {struct pl022 *pl022 =dev_get_drvdata (dev); -amba_vcore_enable (pl022->adev);clk_enable (pl022->clk);return 0 ;
include/linux/amba/bus.h +0 -8
@@ -19,7 +19,6 @@#include <linux/mod_devicetable.h> #include <linux/err.h> #include <linux/resource.h> -#include <linux/regulator/consumer.h> #define AMBA_NR_IRQS 2#define AMBA_CID 0xb105f00d
@@ -30,7 +29,6 @@ struct amba_device {struct device dev;struct resource res;struct clk *pclk; -struct regulator *vcore;u64 dma_mask;unsigned int periphid;unsigned int irq[AMBA_NR_IRQS ];
@@ -75,12 +73,6 @@ void amba_release_regions(struct amba_device *);#define amba_pclk_disable (d) \ do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0) -#define amba_vcore_enable (d) \ - (IS_ERR((d)->vcore) ? 0 : regulator_enable((d)->vcore)) - -#define amba_vcore_disable (d) \ - do { if (!IS_ERR((d)->vcore)) regulator_disable((d)->vcore); } while (0) -/* Some drivers don't use the struct amba_device */ #define AMBA_CONFIG_BITS (a) (((a) >> 24) & 0xff)#define AMBA_REV_BITS (a) (((a) >> 20) & 0x0f)
Signature · 1 line
1.7.9.1
drivers/mfd/db8500-prcmu.c static struct regulator_init_data db8500_regulators[DB8500_NUM_REGULATORS] = { · line 2794
Quoted 12 lines · Mark Brown
drivers/mfd/db8500-prcmu.c +1
-0@@ -2788,6 +2788,7 @@ static struct regulator_init_data db8500_regulators[DB8500_NUM_REGULATORS] = { ? ? ? ? ? ? ? ?.constraints = { ? ? ? ? ? ? ? ? ? ? ? ?.name = "db8500-vape", ? ? ? ? ? ? ? ? ? ? ? ?.valid_ops_mask = REGULATOR_CHANGE_STATUS, + ? ? ? ? ? ? ? ? ? ? ? .always_on = true, ? ? ? ? ? ? ? ?}, ? ? ? ? ? ? ? ?.consumer_supplies = db8500_vape_consumers, ? ? ? ? ? ? ? ?.num_consumer_supplies = ARRAY_SIZE(db8500_vape_consumers),
Combined with the PL022 patch this causes a power regression since the PL022 is hereafter always on.
But I guess if I fix a power domain patch to accomplish much the same things then nothing is really lost...
And I do like the change, if for nothing else so for the fact that it eventually pushes to power domains what belongs there, so:
But to the defence: power domain code was not in the kernel when the AMBA "vcore" regulator was introduced so how else could we do it... except for inventing power domains...
Yours,
Linus Walleij
Quoted 18 lines · Linus Walleij
drivers/mfd/db8500-prcmu.c static struct regulator_init_data db8500_regulators[DB8500_NUM_REGULATORS] = { · line 2794
Quoted 12 lines · Mark Brown
drivers/mfd/db8500-prcmu.c +1
-0@@ -2788,6 +2788,7 @@ static struct regulator_init_data db8500_regulators[DB8500_NUM_REGULATORS] = { ? ? ? ? ? ? ? ?.constraints = { ? ? ? ? ? ? ? ? ? ? ? ?.name = "db8500-vape", ? ? ? ? ? ? ? ? ? ? ? ?.valid_ops_mask = REGULATOR_CHANGE_STATUS, + ? ? ? ? ? ? ? ? ? ? ? .always_on = true, ? ? ? ? ? ? ? ?}, ? ? ? ? ? ? ? ?.consumer_supplies = db8500_vape_consumers, ? ? ? ? ? ? ? ?.num_consumer_supplies = ARRAY_SIZE(db8500_vape_consumers),Combined with the PL022 patch this causes a power regression since the PL022 is hereafter always on.
How can there be a "power regression" here? This is the only user of the vcore regulator, and, apart from the fact that its disable routine only decrements an essentialy write-only variable, it is shared which several devices which already never disable it.
Quoted 2 lines · Linus Walleij
Combined with the PL022 patch this causes a power regression since the PL022 is hereafter always on.
I guess this code isn't in mainline, though? In that case you can always add a revert of this commit to your out of tree patches if you need to.
Quoted 2 lines
But I guess if I fix a power domain patch to accomplish much the same things then nothing is really lost...
Let me know if you run into any trouble with that - I don't have any systems which could usefully use such support so I'm unlikely to work on it directly and from what you were saying you'll need to integrate with existing power domain code anyway.
Quoted 4 lines
And I do like the change, if for nothing else so for the fact that it eventually pushes to power domains what belongs there, so:
Acked-by Linus Walleij <[email protected]>
Thanks.
Quoted 3 lines
But to the defence: power domain code was not in the kernel when the AMBA "vcore" regulator was introduced so how else could we do it... except for inventing power domains...
Which might've happened sooner if we'd noticed :) There were some other
platforms doing similar things but they mostly used the clock API since
it was always entirely platform code until 3.4 so they're less intrusive
into the generic code.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120401/f1b48146/attachment.sig>
Quoted 8 lines · Mark Brown
Quoted 2 lines · Linus Walleij
Combined with the PL022 patch this causes a power regression since the PL022 is hereafter always on.
I guess this code isn't in mainline, though? ?In that case you can always add a revert of this commit to your out of tree patches if you need to.
No, we can sure live with it... Out-of-mainline we do use power domains so that's what we should do instead. It currently looks like this:
http://www.igloocommunity.org/gitweb/?p=kernel/igloo-kernel.git;a=blob;f=arch/arm/mach-ux500/pm/runtime.c;hb=HEAD
It's a really nice piece of code but uses some out-of-tree features, the most obvious one is "atomic regulators" (which are exactly that).
Quoted 8 lines
Quoted 3 lines
But to the defence: power domain code was not in the kernel when the AMBA "vcore" regulator was introduced so how else could we do it... except for inventing power domains...
Which might've happened sooner if we'd noticed :) ?There were some other platforms doing similar things but they mostly used the clock API since it was always entirely platform code until 3.4 so they're less intrusive into the generic code.
Yeah ... but this sounds familiar, (searching searching) Yes! We did ask on the lists if regulators were proper for modeling power domains in 2008:
http://marc.info/?l=linux-arm-kernel&m=121580531500758&w=2
But I should've pushed for a proper answer ...
Yours,
Linus Walleij
Quoted 8 lines · Rabin Vincent
Quoted 2 lines · Linus Walleij
Combined with the PL022 patch this causes a power regression since the PL022 is hereafter always on.
How can there be a "power regression" here? ?This is the only user of the vcore regulator, and, apart from the fact that its disable routine only decrements an essentialy write-only variable, it is shared which several devices which already never disable it.
Yes true... Hm I hope something else in mainline will increase refcount to vape so it's not disabled at regulator_has_full_constraints()? Better test it, then I'll see.
Mark: as Rabin says the v1 patch is probably fine, are you pushing this to ARM SoC or into Russell's patch tracker?
Yours,
Linus Walleij
Quoted 2 lines · Linus Walleij
Mark: as Rabin says the v1 patch is probably fine, are you pushing this to ARM SoC or into Russell's patch tracker?
I was waiting for some pronouncement from Russell - looking at the git
logs it seems the patch tracker is the normal way to merge things.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120402/285b8d24/attachment.sig>
Quoted 5 lines · Linus Walleij
Yeah ... but this sounds familiar, (searching searching) Yes! We did ask on the lists if regulators were proper for modeling power domains in 2008:
http://marc.info/?l=linux-arm-kernel&m=121580531500758&w=2But I should've pushed for a proper answer ...
It's not unreasonable to use regulators to model the domains (or as part
of modelling the domains, I'd imagine some systems will be able to do
things to regulators as a result of power domain actions). So long as
the hookup which might affect other systems is done from SoC specific
code and doesn't impact other systems) there shouldn't be an issue from
a framework point of view.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120402/1de9c0c8/attachment.sig>
Quoted 7 lines · Mark Brown
Quoted 2 lines · Linus Walleij
Mark: as Rabin says the v1 patch is probably fine, are you pushing this to ARM SoC or into Russell's patch tracker?
I was waiting for some pronouncement from Russell - looking at the git logs it seems the patch tracker is the normal way to merge things.
Well, this stuff was invented by Linus, so its Linus' decision about how to deal with the power control.
Quoted 7 lines · Russell King - ARM Linux
Quoted 2 lines · Mark Brown
I was waiting for some pronouncement from Russell - looking at the git logs it seems the patch tracker is the normal way to merge things.
Well, this stuff was invented by Linus, so its Linus' decision about how to deal with the power control.
Linus already acked the patch, the question was more about how to get it
merged. Since most of the AMBA changes seem to go via your tree I've
just submitted it to the patch system as 7366/1.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120402/ee9e0c46/attachment-0001.sig>
Quoted 11 lines · Russell King - ARM Linux
Quoted 7 lines · Mark Brown
Quoted 2 lines · Linus Walleij
Mark: as Rabin says the v1 patch is probably fine, are you pushing this to ARM SoC or into Russell's patch tracker?
I was waiting for some pronouncement from Russell - looking at the git logs it seems the patch tracker is the normal way to merge things.
Well, this stuff was invented by Linus, so its Linus' decision about how to deal with the power control.
This falls into the "seemed like a good idea at the time" category, I was wrong, we implemented power domains instead, so let's just kill it before someone else hurts him/herself on it...
Yours,
Linus Walleij
Quoted 6 lines · Mark Brown
Quoted 4 lines · Russell King - ARM Linux
Quoted 2 lines · Mark Brown
I was waiting for some pronouncement from Russell - looking at the git logs it seems the patch tracker is the normal way to merge things.
Quoted 6 lines
Quoted 2 lines
Well, this stuff was invented by Linus, so its Linus' decision about how to deal with the power control.
Linus already acked the patch, the question was more about how to get it merged. Since most of the AMBA changes seem to go via your tree I've just submitted it to the patch system as 7366/1.
Does:
ARM PRIMECELL BUS SUPPORT
M: Russell King <[email protected]> S: Maintained F: drivers/amba/ F: include/linux/amba/bus.h
not provide enough clues? Should I delete all my entries in that file because the only people who look in there are spammers when the file is published on the web?
Quoted 9 lines · Russell King - ARM Linux
ARM PRIMECELL BUS SUPPORT
M: Russell King <[email protected]> S: Maintained F: drivers/amba/ F: include/linux/amba/bus.hnot provide enough clues? Should I delete all my entries in that file because the only people who look in there are spammers when the file is published on the web?
I did look in there and also in the git history which shows the same
information, hence my CCing you. Linus introduced some doubt into my
mind that this might be something that went through arm-soc now rather
than via your tree even if you are still maintaining it as no specific
git tree or anything is mentioned there.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120402/0df36727/attachment.sig>
Quoted 19 lines · Mark Brown
The AMBA bus regulator support is being used to model on/off switches for power domains which isn't terribly idiomatic for modern kernels with the generic power domain code and creates integration problems on platforms which don't use regulators for their power domains as it's hard to tell the difference between a regulator that is needed but failed to be provided and one that isn't supposed to be there (though DT does make that easier).
Platforms that wish to use the regulator API to manage their power domains can indirect via the power domain interface.
This feature is only used with the vape supply of the db8500 PRCMU driver which supplies the UARTs and MMC controllers, none of which have support for managing vcore at runtime in mainline (only pl022 SPI controller does). Update that supply to have an
always_onconstraint until the power domain support for the system is updated so that it is enabled for these users, this is likely to have no impact on practical systems as probably at least one of these devices will be active and cause AMBA to hold the supply on anyway.
Quoted 1 line
Signed-off-by Mark Brown <[email protected]>
Russell,
I believe this patch fixes the amba probe failure that impacts any AMBA platform build with CONFIG_REGULATOR enabled. Could you consider to send the fix for -rc soon?
The patch "ARM: amba: adapt to regulator probe deferral change" from me could be ignored now.
Signature · 2 lines
Regards, Shawn
Quoted 19 lines · Mark Brown
The AMBA bus regulator support is being used to model on/off switches for power domains which isn't terribly idiomatic for modern kernels with the generic power domain code and creates integration problems on platforms which don't use regulators for their power domains as it's hard to tell the difference between a regulator that is needed but failed to be provided and one that isn't supposed to be there (though DT does make that easier).
Platforms that wish to use the regulator API to manage their power domains can indirect via the power domain interface.
This feature is only used with the vape supply of the db8500 PRCMU driver which supplies the UARTs and MMC controllers, none of which have support for managing vcore at runtime in mainline (only pl022 SPI controller does). Update that supply to have an
always_onconstraint until the power domain support for the system is updated so that it is enabled for these users, this is likely to have no impact on practical systems as probably at least one of these devices will be active and cause AMBA to hold the supply on anyway.
Quoted 2 lines
Signed-off-by Mark Brown <[email protected]>---
This and pl011 fixes are needed to get highbank working with 3.4, so:
Rob
Quoted 156 lines
Updated to add the
always_onconstraint for db8500-prcmu as discussed in the changelog.drivers/amba/bus.c | 42 +----------------------------------------- drivers/mfd/db8500-prcmu.c | 1 + drivers/spi/spi-pl022.c | 2 -- include/linux/amba/bus.h | 8 -------- 4 files changed, 2 insertions(+), 51 deletions(-)drivers/amba/bus.c +1
-41@@ -247,8 +247,7 @@ static int amba_pm_restore(struct device *dev)/* * Hooks to provide runtime PM of the pclk (bus clock). It is safe to * enable/disable the bus clock at runtime PM suspend/resume as this -* does not result in loss of context. However, disabling vcore power -* would do, so we leave that to the driver. +* does not result in loss of context. */ static int amba_pm_runtime_suspend (struct device *dev) {@@ -354,39 +353,6 @@ static void amba_put_disable_pclk(struct amba_device *pcdev)clk_put (pclk); } -static int amba_get_enable_vcore (struct amba_device *pcdev) -{ -struct regulator *vcore =regulator_get (&pcdev->dev,"vcore" ); -int ret; - - pcdev->vcore = vcore; - -if (IS_ERR (vcore)) { -/* It is OK not to supply a vcore regulator */ -if (PTR_ERR (vcore) == -ENODEV ) -return 0 ; -return PTR_ERR (vcore); - } - - ret =regulator_enable (vcore); -if (ret) { -regulator_put (vcore); - pcdev->vcore =ERR_PTR (-ENODEV ); - } - -return ret; -} - -static void amba_put_disable_vcore (struct amba_device *pcdev) -{ -struct regulator *vcore = pcdev->vcore; - -if (!IS_ERR (vcore)) { -regulator_disable (vcore); -regulator_put (vcore); - } -} -/* * These are the device model conversion veneers; they convert the * device model structures to our more specific structures. @@ -399,10 +365,6 @@ static int amba_probe(struct device *dev)int ret; do { - ret = amba_get_enable_vcore(pcdev); - if (ret) - break; - ret = amba_get_enable_pclk(pcdev); if (ret) break;@@ -420,7 +382,6 @@ static int amba_probe(struct device *dev)pm_runtime_put_noidle (dev);amba_put_disable_pclk (pcdev); -amba_put_disable_vcore (pcdev); }while (0 );return ret;@@ -442,7 +403,6 @@ static int amba_remove(struct device *dev)pm_runtime_put_noidle (dev);amba_put_disable_pclk (pcdev); -amba_put_disable_vcore (pcdev);return ret; }drivers/mfd/db8500-prcmu.c +1
-0@@ -2788,6 +2788,7 @@ static struct regulator_init_data db8500_regulators[DB8500_NUM_REGULATORS] = { .constraints = { .name = "db8500-vape", .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .always_on = true, }, .consumer_supplies = db8500_vape_consumers, .num_consumer_supplies = ARRAY_SIZE(db8500_vape_consumers),drivers/spi/spi-pl022.c +0
-2@@ -2195,7 +2195,6 @@ static int pl022_runtime_suspend(struct device *dev)struct pl022 *pl022 =dev_get_drvdata (dev);clk_disable (pl022->clk); -amba_vcore_disable (pl022->adev);return 0 ; }@@ -2204,7 +2203,6 @@ static int pl022_runtime_resume(struct device *dev) {struct pl022 *pl022 =dev_get_drvdata (dev); -amba_vcore_enable (pl022->adev);clk_enable (pl022->clk);return 0 ;include/linux/amba/bus.h +0
-8@@ -19,7 +19,6 @@#include <linux/mod_devicetable.h> #include <linux/err.h> #include <linux/resource.h> -#include <linux/regulator/consumer.h> #define AMBA_NR_IRQS 2#define AMBA_CID 0xb105f00d@@ -30,7 +29,6 @@ struct amba_device {struct device dev;struct resource res;struct clk *pclk; -struct regulator *vcore;u64 dma_mask;unsigned int periphid;unsigned int irq[AMBA_NR_IRQS ];@@ -75,12 +73,6 @@ void amba_release_regions(struct amba_device *);#define amba_pclk_disable (d) \ do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0) -#define amba_vcore_enable (d) \ - (IS_ERR((d)->vcore) ? 0 : regulator_enable((d)->vcore)) - -#define amba_vcore_disable (d) \ - do { if (!IS_ERR((d)->vcore)) regulator_disable((d)->vcore); } while (0) -/* Some drivers don't use the struct amba_device */ #define AMBA_CONFIG_BITS (a) (((a) >> 24) & 0xff)#define AMBA_REV_BITS (a) (((a) >> 20) & 0x0f)
Quoted 3 lines · Shawn Guo
I believe this patch fixes the amba probe failure that impacts any AMBA platform build with
CONFIG_REGULATORenabled. Could you consider to send the fix for -rc soon?
No idea. I don't have Mark's patch in the patch system.
Quoted 2 lines
The patch "ARM: amba: adapt to regulator probe deferral change" from me could be ignored now.
But I do have yours in there. And what do I do with your other patch in there touching this same area as well?
Please, sort it out between you and once the patch system is right, let me know.
Quoted 6 lines · Russell King - ARM Linux
Quoted 3 lines · Shawn Guo
I believe this patch fixes the amba probe failure that impacts any AMBA platform build with
CONFIG_REGULATORenabled. Could you consider to send the fix for -rc soon?No idea. I don't have Mark's patch in the patch system.
It's there as far as I can tell - it's 7366/1, which is visible in the web interface at:
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=7366/1
Is there something else I need to do?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120410/f8948335/attachment.sig>
Quoted 6 lines · Mark Brown
Quoted 4 lines · Russell King - ARM Linux
Quoted 3 lines · Shawn Guo
I believe this patch fixes the amba probe failure that impacts any AMBA platform build with
CONFIG_REGULATORenabled. Could you consider to send the fix for -rc soon?
Quoted 8 lines
Quoted 1 line
No idea. I don't have Mark's patch in the patch system.
It's there as far as I can tell - it's 7366/1, which is visible in the web interface at:
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=7366/1
Is there something else I need to do?
Ok, I thought 7366/1 and 7367/1 were part of the same looking at just the index.
In any case, what would really help is if people would discard patches they no longer want applying.
On Tue, Apr 10, 2012 at 09:47:02AM +0100, Russell King - ARM Linux wrote:
...
Quoted 2 lines
In any case, what would really help is if people would discard patches they no longer want applying.
Ok, I did not know it before. Just marked my patch "discarded".
Signature · 2 lines
Regards, Shawn
Hi Mark,
I realize what the intention is with this patch; but I am not sure we have thought about all consequence it might have.
OK, so the power domain which implement runtime PM support, shall be responsible for handling the vcore regualtor instead of the amba bus. That should be fine.
But, how should those amba drivers that implements runtime PM support be able to switch of the vcore regulator during normal suspend? In normal suspend case we can not use pm_runtime_put/pm_runtime_put_sync to trigger the power domain runtime functions to switch of vcore. This is kind of more generic problem when dealing with power domains, but as said this patch will have consequences.
As far as I can see, the power domain must then implement a suspend_noirq function to make sure same things is done as for the runtime_suspend function. Do you agree with this as well or is there another option?
Kind regards
Ulf Hansson
Quoted 177 lines · Mark Brown
The AMBA bus regulator support is being used to model on/off switches for power domains which isn't terribly idiomatic for modern kernels with the generic power domain code and creates integration problems on platforms which don't use regulators for their power domains as it's hard to tell the difference between a regulator that is needed but failed to be provided and one that isn't supposed to be there (though DT does make that easier).
Platforms that wish to use the regulator API to manage their power domains can indirect via the power domain interface.
This feature is only used with the vape supply of the db8500 PRCMU driver which supplies the UARTs and MMC controllers, none of which have support for managing vcore at runtime in mainline (only pl022 SPI controller does). Update that supply to have an
always_onconstraint until the power domain support for the system is updated so that it is enabled for these users, this is likely to have no impact on practical systems as probably at least one of these devices will be active and cause AMBA to hold the supply on anyway.Signed-off-by Mark Brown<[email protected]>---
Updated to add the
always_onconstraint for db8500-prcmu as discussed in the changelog.drivers/amba/bus.c | 42 +----------------------------------------- drivers/mfd/db8500-prcmu.c | 1 + drivers/spi/spi-pl022.c | 2 -- include/linux/amba/bus.h | 8 -------- 4 files changed, 2 insertions(+), 51 deletions(-)drivers/amba/bus.c +1
-41@@ -247,8 +247,7 @@ static int amba_pm_restore(struct device *dev)/* * Hooks to provide runtime PM of the pclk (bus clock). It is safe to * enable/disable the bus clock at runtime PM suspend/resume as this -* does not result in loss of context. However, disabling vcore power -* would do, so we leave that to the driver. +* does not result in loss of context. */ static int amba_pm_runtime_suspend (struct device *dev) {@@ -354,39 +353,6 @@ static void amba_put_disable_pclk(struct amba_device *pcdev)clk_put (pclk); } -static int amba_get_enable_vcore (struct amba_device *pcdev) -{ -struct regulator *vcore =regulator_get (&pcdev->dev,"vcore" ); -int ret; - - pcdev->vcore = vcore; - -if (IS_ERR (vcore)) { -/* It is OK not to supply a vcore regulator */ -if (PTR_ERR (vcore) == -ENODEV ) -return 0 ; -return PTR_ERR (vcore); - } - - ret =regulator_enable (vcore); -if (ret) { -regulator_put (vcore); - pcdev->vcore =ERR_PTR (-ENODEV ); - } - -return ret; -} - -static void amba_put_disable_vcore (struct amba_device *pcdev) -{ -struct regulator *vcore = pcdev->vcore; - -if (!IS_ERR (vcore)) { -regulator_disable (vcore); -regulator_put (vcore); - } -} -/* * These are the device model conversion veneers; they convert the * device model structures to our more specific structures. @@ -399,10 +365,6 @@ static int amba_probe(struct device *dev)int ret; do { - ret = amba_get_enable_vcore(pcdev); - if (ret) - break; - ret = amba_get_enable_pclk(pcdev); if (ret) break;@@ -420,7 +382,6 @@ static int amba_probe(struct device *dev)pm_runtime_put_noidle (dev);amba_put_disable_pclk (pcdev); -amba_put_disable_vcore (pcdev); }while (0 );return ret;@@ -442,7 +403,6 @@ static int amba_remove(struct device *dev)pm_runtime_put_noidle (dev);amba_put_disable_pclk (pcdev); -amba_put_disable_vcore (pcdev);return ret; }drivers/mfd/db8500-prcmu.c +1
-0@@ -2788,6 +2788,7 @@ static struct regulator_init_data db8500_regulators[DB8500_NUM_REGULATORS] = { .constraints = { .name = "db8500-vape", .valid_ops_mask = REGULATOR_CHANGE_STATUS, + .always_on = true, }, .consumer_supplies = db8500_vape_consumers, .num_consumer_supplies = ARRAY_SIZE(db8500_vape_consumers),drivers/spi/spi-pl022.c +0
-2@@ -2195,7 +2195,6 @@ static int pl022_runtime_suspend(struct device *dev)struct pl022 *pl022 =dev_get_drvdata (dev);clk_disable (pl022->clk); -amba_vcore_disable (pl022->adev);return 0 ; }@@ -2204,7 +2203,6 @@ static int pl022_runtime_resume(struct device *dev) {struct pl022 *pl022 =dev_get_drvdata (dev); -amba_vcore_enable (pl022->adev);clk_enable (pl022->clk);return 0 ;include/linux/amba/bus.h +0
-8@@ -19,7 +19,6 @@#include <linux/mod_devicetable.h> #include <linux/err.h> #include <linux/resource.h> -#include <linux/regulator/consumer.h> #define AMBA_NR_IRQS 2#define AMBA_CID 0xb105f00d@@ -30,7 +29,6 @@ struct amba_device {struct device dev;struct resource res;struct clk *pclk; -struct regulator *vcore;u64 dma_mask;unsigned int periphid;unsigned int irq[AMBA_NR_IRQS ];@@ -75,12 +73,6 @@ void amba_release_regions(struct amba_device *);#define amba_pclk_disable (d) \ do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0) -#define amba_vcore_enable (d) \ - (IS_ERR((d)->vcore) ? 0 : regulator_enable((d)->vcore)) - -#define amba_vcore_disable (d) \ - do { if (!IS_ERR((d)->vcore)) regulator_disable((d)->vcore); } while (0) -/* Some drivers don't use the struct amba_device */ #define AMBA_CONFIG_BITS (a) (((a)>> 24)& 0xff)#define AMBA_REV_BITS (a) (((a)>> 20)& 0x0f)
Quoted 3 lines · Ulf Hansson
But, how should those amba drivers that implements runtime PM support be able to switch of the vcore regulator during normal suspend? In normal suspend case we can not use
A generic AMBA driver should have no idea about the implementation of the particular SoC that it's integrated on to. This applies even more to system suspend (where drivers can generally just assume that they will loose all power normally) than it does to runtime suspend.
Quoted 4 lines
pm_runtime_put/pm_runtime_put_sync to trigger the power domain runtime functions to switch of vcore. This is kind of more generic problem when dealing with power domains, but as said this patch will have consequences.
The power domain gets callbacks on the system suspend path too and can do whatever is sensible there.
Quoted 4 lines
As far as I can see, the power domain must then implement a
suspend_noirqfunction to make sure same things is done as for theruntime_suspendfunction. Do you agree with this as well or is there another option?
Yes, the power domain should just be handling this transparently.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120413/f7c57571/attachment.sig>
Quoted 19 lines · Mark Brown
Quoted 3 lines · Ulf Hansson
But, how should those amba drivers that implements runtime PM support be able to switch of the vcore regulator during normal suspend? In normal suspend case we can not use
A generic AMBA driver should have no idea about the implementation of the particular SoC that it's integrated on to. This applies even more to system suspend (where drivers can generally just assume that they will loose all power normally) than it does to runtime suspend.
Quoted 4 lines
pm_runtime_put/pm_runtime_put_sync to trigger the power domain runtime functions to switch of vcore. This is kind of more generic problem when dealing with power domains, but as said this patch will have consequences.
The power domain gets callbacks on the system suspend path too and can do whatever is sensible there.
Quoted 6 lines
Quoted 4 lines
As far as I can see, the power domain must then implement a
suspend_noirqfunction to make sure same things is done as for theruntime_suspendfunction. Do you agree with this as well or is there another option?Yes, the power domain should just be handling this transparently.
Alright, thanks for your confirmation. Let's see how this works out then.
Kind regards
Ulf Hansson