From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: linux-pm@vger.kernel.org,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Alan Stern <stern@rowland.harvard.edu>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] PM / sleep: Let devices force direct_complete
Date: Fri, 17 Apr 2015 18:35:05 +0300 [thread overview]
Message-ID: <1471135.f2mh84nZFq@avalon> (raw)
In-Reply-To: <1429284290-25153-2-git-send-email-tomeu.vizoso@collabora.com>
Hi Tomeu,
Thank you for the patch.
On Friday 17 April 2015 17:24:49 Tomeu Vizoso wrote:
> Introduce a new per-device flag power.force_direct_complete that will
> instruct the PM core to ignore the runtime PM status of its descendants
> when deciding whether to let this device remain in runtime suspend when
> the system goes into a sleep power state.
>
> This is needed because otherwise it would be needed to get dozens of
> drivers to implement the prepare() callback and be runtime PM active
> even if they don't have a 1-to-1 relationship with a piece of HW.
I'll let PM experts comment on the approach, but I believe the new flag would
benefit from being documented (likely in Documentation/power/devices.txt) :-)
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> ---
> drivers/base/power/main.c | 13 +++++++++----
> include/linux/pm.h | 1 +
> 2 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index 3d874ec..728c2dc 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -1438,7 +1438,9 @@ static int __device_suspend(struct device *dev,
> pm_message_t state, bool async) if (parent) {
> spin_lock_irq(&parent->power.lock);
>
> - dev->parent->power.direct_complete = false;
> + if (!dev->parent->power.force_direct_complete)
> + dev->parent->power.direct_complete = false;
> +
> if (dev->power.wakeup_path
> && !dev->parent->power.ignore_children)
> dev->parent->power.wakeup_path = true;
> @@ -1605,9 +1607,12 @@ static int device_prepare(struct device *dev,
> pm_message_t state) * will do the same thing with all of its descendants".
> This only * applies to suspend transitions, however.
> */
> - spin_lock_irq(&dev->power.lock);
> - dev->power.direct_complete = ret > 0 && state.event == PM_EVENT_SUSPEND;
> - spin_unlock_irq(&dev->power.lock);
> + if (state.event == PM_EVENT_SUSPEND) {
> + spin_lock_irq(&dev->power.lock);
> + dev->power.direct_complete = ret > 0 ||
> + dev->power.force_direct_complete;
> + spin_unlock_irq(&dev->power.lock);
> + }
> return 0;
> }
>
> diff --git a/include/linux/pm.h b/include/linux/pm.h
> index 2d29c64..2e41cfd 100644
> --- a/include/linux/pm.h
> +++ b/include/linux/pm.h
> @@ -553,6 +553,7 @@ struct dev_pm_info {
> bool ignore_children:1;
> bool early_init:1; /* Owned by the PM core */
> bool direct_complete:1; /* Owned by the PM core */
> + bool force_direct_complete:1;
> spinlock_t lock;
> #ifdef CONFIG_PM_SLEEP
> struct list_head entry;
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2015-04-17 15:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 15:24 [PATCH v3 0/2] Allow UVC devices to remain runtime-suspended when sleeping Tomeu Vizoso
2015-04-17 15:24 ` [PATCH v3 1/2] PM / sleep: Let devices force direct_complete Tomeu Vizoso
2015-04-17 15:33 ` Greg Kroah-Hartman
2015-04-17 15:35 ` Laurent Pinchart [this message]
2015-04-17 17:30 ` Alan Stern
2015-04-20 7:10 ` Tomeu Vizoso
2015-04-20 14:12 ` Alan Stern
2015-04-28 14:26 ` Tomeu Vizoso
2015-04-28 14:54 ` Rafael J. Wysocki
2015-04-30 7:11 ` Ulf Hansson
2015-04-30 14:53 ` Alan Stern
2015-05-06 8:30 ` Ulf Hansson
2015-05-06 14:43 ` Alan Stern
2015-05-06 16:05 ` Ulf Hansson
2015-04-17 15:24 ` [PATCH v3 2/2] [media] uvcvideo: Remain runtime-suspended at sleeps Tomeu Vizoso
2015-04-17 17:32 ` Alan Stern
2015-04-20 7:11 ` Tomeu Vizoso
2015-11-09 21:23 ` Laurent Pinchart
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=1471135.f2mh84nZFq@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=stern@rowland.harvard.edu \
--cc=tomeu.vizoso@collabora.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