From: Jassi Brar <jaswinder.singh@linaro.org>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: mythripk@ti.com, linux-omap@vger.kernel.org,
linux-fbdev@vger.kernel.org, andy.green@linaro.org,
n-dechesne@ti.com
Subject: Re: [PATCH] OMAPDSS: Check if RPM enabled before trying to change state
Date: Mon, 25 Jun 2012 17:18:23 +0000 [thread overview]
Message-ID: <CAJe_ZheHoCikVzy6zJoKHuL8_oQ0ZnPASUUWimvbPRr+AZ4zWg@mail.gmail.com> (raw)
In-Reply-To: <1340632161.3395.100.camel@deskari>
On 25 June 2012 19:19, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
> On Mon, 2012-06-25 at 19:01 +0530, Jassi Brar wrote:
>> > /* this accesses a register, but the HW is disabled? */
>> > dispc_read_reg(FOO);
>> >
>> .... the H/W is already always enabled if CONFIG_PM_RUNTIME is not defined.
>>
>> If CONFIG_PM_RUNTIME is indeed defined, pm_runtime_enabled() will
>> always return true after pm_runtime_enable() unless someone disables
>> it explicitly - omapdss or the RPM stack(during suspend/resume).
>> OMAPDSS never does so in the lifetime of a driver. So the only period
>> in which pm_runtime_enabled() returns false, is when the platform is
>> suspending, suspended or resuming.
>
> Right. So what happens in my example above?
>
> Normally if the driver does dispc_runtime_get() and dispc_read_reg(),
> the first call will enable the HW so the reg read works.
>
> But if the pm_runtime is disabled, say, during system suspend, with your
> patch dispc_runtime_get() will just return 0 without doing anything, and
> the dispc_read_reg() will crash because the HW is disabled (because
> nobody enabled it).
>
Hmm, I am not sure if new calls would/should be made to dispc.c after
the system has suspended and before resumed. That is, anything other
than from runtime_resume/suspend callbacks of DSS, DISPC, HDMI, VENC
and RFBI, which rightly don't touch any dss reg but only
enable/disable a clock.
As we know, a subsystem should make sure any active work is cleared
out before suspending and set some flag so that nothing runs until it
has resumed. I don't say we can't crash the system with this patch,
but then we would be violating rules of suspend-resume.
>>
>> As I said, for omapdss, PM is disabled (not device deactivated) only
>> during rpm suspend/resume.
>> And it should be no different than any lock protected section
>> preempted by suspend-resume before reaching its end.
>
> I'm not sure if I understand... If the driver does dispc_runtime_get()
> while the PM is disabled, say, during system resume, dispc_runtime_get()
> will do nothing and return 0. The driver thinks it succeeded, and will
> call dispc_runtime_put() later.
>
> Calling the dispc_runtime_put() could happen very soon, while runtime PM
> is still disabled, in which case everything works fine. But there's no
> rule to say dispc_runtime_put() has to be called very soon after
> dispc_runtime_get(). The driver might as well call put later, when
> runtime PM is enabled.
>
> This would end up with a pm_runtime_put call without a matching
> pm_runtime_get call.
>
Again, we need to see if there is really some situation where
something new is attempted before the subsystem has resumed. If there
is indeed, maybe omapdss need to flag it's suspended and prevent such
thing until it has resumed.
Btw, even without this patch, when dispc_runtime_get() does return
error under rpm disabled, we disturb the dev.power.usage_count balance
by not calling dispc_runtime_put()
This patch doesn't make everything perfect, but only improve upon the
current situation.
thnx
next prev parent reply other threads:[~2012-06-25 17:18 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-23 8:18 [PATCH] OMAPDSS: Check if RPM enabled before trying to change state jaswinder.singh
2012-06-25 6:20 ` Tomi Valkeinen
2012-06-25 8:53 ` Jassi Brar
2012-06-25 9:30 ` Tomi Valkeinen
2012-06-25 12:39 ` Jassi Brar
2012-06-25 12:41 ` Tomi Valkeinen
2012-06-25 13:43 ` Jassi Brar
2012-06-25 13:49 ` Tomi Valkeinen
2012-06-25 17:18 ` Jassi Brar [this message]
2012-06-26 7:19 ` Tomi Valkeinen
2012-06-26 8:44 ` Jassi Brar
2012-06-26 8:40 ` Andy Green
2012-06-26 9:07 ` Tomi Valkeinen
2012-06-26 10:09 ` Jassi Brar
2012-06-26 12:03 ` Tomi Valkeinen
2012-06-26 14:52 ` Jassi Brar
2012-06-26 15:08 ` Tomi Valkeinen
2012-06-26 15:21 ` Jassi Brar
2012-06-26 15:11 ` Tomi Valkeinen
2012-06-26 17:13 ` Jassi Brar
2012-06-26 18:44 ` Tomi Valkeinen
2012-06-27 4:54 ` Jassi Brar
2012-06-27 5:58 ` Tomi Valkeinen
2012-06-27 7:53 ` Jassi Brar
2012-06-27 8:13 ` Tomi Valkeinen
2012-06-27 14:56 ` Jassi Brar
2012-06-28 6:41 ` Tomi Valkeinen
2012-06-28 7:58 ` Jassi Brar
2012-06-28 7:58 ` Tomi Valkeinen
2012-06-25 12:05 ` Grazvydas Ignotas
2012-06-25 12:30 ` Tomi Valkeinen
2012-06-25 12:54 ` Rajendra Nayak
2012-06-25 12:50 ` Tomi Valkeinen
2012-06-26 4:55 ` Rajendra Nayak
2012-06-26 13:02 ` Grazvydas Ignotas
2012-06-26 14:34 ` Alan Stern
2012-06-26 15:01 ` Tomi Valkeinen
2012-06-26 15:11 ` Alan Stern
2012-06-25 12:45 ` Jassi Brar
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=CAJe_ZheHoCikVzy6zJoKHuL8_oQ0ZnPASUUWimvbPRr+AZ4zWg@mail.gmail.com \
--to=jaswinder.singh@linaro.org \
--cc=andy.green@linaro.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=mythripk@ti.com \
--cc=n-dechesne@ti.com \
--cc=tomi.valkeinen@ti.com \
/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).