From: jon-hunter@ti.com (Jon Hunter)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: PMU: fix runtime PM enable
Date: Wed, 24 Oct 2012 09:16:43 -0500 [thread overview]
Message-ID: <5087F84B.9070705@ti.com> (raw)
In-Reply-To: <20121024093150.GA23775@mudshark.cambridge.arm.com>
Hi Will,
On 10/24/2012 04:31 AM, Will Deacon wrote:
> Hi Jon,
>
> On Tue, Oct 23, 2012 at 09:31:08PM +0100, Jon Hunter wrote:
>> Commit 7be2958 (ARM: PMU: Add runtime PM Support) updated the ARM PMU code to
>> use runtime PM which was prototyped and validated on the OMAP devices. In this
>> commit, there is no call pm_runtime_enable() and for OMAP devices
>> pm_runtime_enable() is currently being called from the OMAP PMU code when the
>> PMU device is created. However, there are two problems with this:
>>
>> 1. For any other ARM device wishing to use runtime PM for PMU they will need
>> to call pm_runtime_enable() for runtime PM to work.
>> 2. When booting with device-tree and using device-tree to create the PMU
>> device, pm_runtime_enable() needs to be called from within the ARM PERF
>> driver as we are no longer calling any device specific code to create the
>> device. Hence, PMU does not work on OMAP devices that use the runtime PM
>> callbacks when using device-tree to create the PMU device.
>>
>> Therefore, add a new platform data variable to indicate whether runtime PM is
>> used and if so call pm_runtime_enable() when the PMU device is registered. Note
>> that devices using runtime PM may not use the runtime_resume/suspend callbacks
>> and so we cannot use the presence of these handlers in the platform data to
>> determine whether we should call pm_runtime_enable().
>
> [...]
>
>> diff --git a/arch/arm/include/asm/pmu.h b/arch/arm/include/asm/pmu.h
>> index a26170d..50a6c3b 100644
>> --- a/arch/arm/include/asm/pmu.h
>> +++ b/arch/arm/include/asm/pmu.h
>> @@ -36,6 +36,7 @@
>> struct arm_pmu_platdata {
>> irqreturn_t (*handle_irq)(int irq, void *dev,
>> irq_handler_t pmu_handler);
>> + bool use_runtime_pm;
>> int (*runtime_resume)(struct device *dev);
>> int (*runtime_suspend)(struct device *dev);
>
> Can we not just use the presence of the resume/suspend function pointers to
> indicate whether we should enable runtime pm or not? i.e. if they're not
> NULL, then enable the thing?
I wondered if you would ask that :-)
Unfortunately, we can't. For example, OMAP3430 and OMAP4460 both require
runtime_pm to be enabled to turn on the debug sub-system in OMAP for PMU
to work. However, neither of these devices are using the suspend/resume
callbacks because the HWMOD framework is doing this for us behind the
scenes.
So then you ask, why do we need the resume/suspend callbacks, well we
will need them for OMAP4430 where in addition to turning on the debug
sub-system we need to configure the CTI module. Therefore, I had to add
another plat data variable.
By the way, I did add a comment in the above changelog about this. See
the last paragraph, not sure if this is 100% clear.
One alternative I had thought about was always calling
pm_runtime_enable() on registering the PMU device and avoid having a
use_runtime_pm variable. For ARM platforms that don't use runtime PM the
pm_runtime_enable() function does nothing. However, I was more concerned
about adding unnecessary overhead for ARM platforms that are using
runtime PM but don't need runtime PM for PMU. I don't see any side
affects on our OMAP2 platform that does not need runtime PM for PMU.
However, was not sure what is best here.
Cheers
Jon
next prev parent reply other threads:[~2012-10-24 14:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-23 20:31 [PATCH] ARM: PMU: fix runtime PM enable Jon Hunter
2012-10-24 9:31 ` Will Deacon
2012-10-24 14:16 ` Jon Hunter [this message]
2012-10-24 14:32 ` Will Deacon
2012-10-24 15:06 ` Jon Hunter
2012-10-24 17:23 ` Will Deacon
2012-10-24 17:41 ` Jon Hunter
2012-10-25 16:42 ` Kevin Hilman
2012-10-25 16:47 ` Will Deacon
2012-10-25 16:50 ` Jon Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5087F84B.9070705@ti.com \
--to=jon-hunter@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).