From: Changhuang Liang <changhuang.liang@starfivetech.com>
To: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Maxime Ripard <mripard@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>,
Jack Zhu <jack.zhu@starfivetech.com>,
Keith Zhao <keith.zhao@starfivetech.com>,
Jayshri Pawar <jpawar@cadence.com>, Jai Luthra <j-luthra@ti.com>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-staging@lists.linux.dev" <linux-staging@lists.linux.dev>
Subject: 回复: [PATCH v2 5/5] staging: media: starfive: Add system PM support
Date: Fri, 19 Jul 2024 02:08:20 +0000 [thread overview]
Message-ID: <ZQ0PR01MB13020F080F8D1B024D211971F2AD2@ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn> (raw)
In-Reply-To: <ecqbazcjtzat7yxwh7uuerjrrh3umpwutiwha2zo5njmwnj25g@ocpntbuecb3z>
Hi Jacopo,
Thanks for your comments.
>
> Hi Changhuang
>
> On Wed, Jul 17, 2024 at 08:28:34PM GMT, Changhuang Liang wrote:
> > This patch implements system suspend and system resume operation for
> > StarFive Camera Subsystem. It supports hibernation during streaming
> > and restarts streaming at system resume time.
> >
> > Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
> > ---
> > .../staging/media/starfive/camss/stf-camss.c | 49
> > +++++++++++++++++++
> > 1 file changed, 49 insertions(+)
> >
> > diff --git a/drivers/staging/media/starfive/camss/stf-camss.c
> > b/drivers/staging/media/starfive/camss/stf-camss.c
> > index fecd3e67c7a1..8dcd35aef69d 100644
> > --- a/drivers/staging/media/starfive/camss/stf-camss.c
> > +++ b/drivers/staging/media/starfive/camss/stf-camss.c
> > @@ -416,10 +416,59 @@ static int __maybe_unused
> stfcamss_runtime_resume(struct device *dev)
> > return 0;
> > }
> >
> > +static int __maybe_unused stfcamss_suspend(struct device *dev) {
> > + struct stfcamss *stfcamss = dev_get_drvdata(dev);
> > + struct stfcamss_video *video;
>
> Can be declared inside the for loop
>
> > + unsigned int i;
> > +
> > + for (i = 0; i < STF_CAPTURE_NUM; ++i) {
>
> Likewise, if you like it, you can
>
> for (unsigned int i...
>
> > + video = &stfcamss->captures[i].video;
> > + if (video->vb2_q.streaming) {
> > + video->ops->stop_streaming(video);
> > + video->ops->flush_buffers(video, VB2_BUF_STATE_ERROR);
> > + }
> > + }
> > +
> > + return pm_runtime_force_suspend(dev); }
> > +
> > +static int __maybe_unused stfcamss_resume(struct device *dev) {
> > + struct stfcamss *stfcamss = dev_get_drvdata(dev);
> > + struct stf_isp_dev *isp_dev = &stfcamss->isp_dev;
> > + struct v4l2_subdev_state *sd_state;
> > + struct stfcamss_video *video;
> > + unsigned int i;
>
> same here
>
> > + int ret;
> > +
> > + ret = pm_runtime_force_resume(dev);
> > + if (ret < 0) {
> > + dev_err(dev, "Failed to resume\n");
> > + return ret;
> > + }
> > +
> > + sd_state = v4l2_subdev_lock_and_get_active_state(&isp_dev->subdev);
> > +
> > + if (isp_dev->streaming)
> > + stf_isp_stream_on(isp_dev, sd_state);
>
> I was wondering if you shouldn't propagate start_streaming along the whole
> pipline, but I presume the connected subdevs have to handle resuming
> streaming after a system resume themselves ?
>
Currently our Camera subsystem contains ISP subdev , capture_raw video device, and capture_yuv
video device. So you can see only one system PM hook can be used by them.
>
> > +
> > + v4l2_subdev_unlock_state(sd_state);
> > +
> > + for (i = 0; i < STF_CAPTURE_NUM; ++i) {
> > + video = &stfcamss->captures[i].video;
> > + if (video->vb2_q.streaming)
> > + video->ops->start_streaming(video);
>
> You can use vb2_is_streaming() maybe.
> If the queue is streaming, do you need to keep a 'streaming' flag for the isp ?
> Probably yes, as the ISP subdev is used by several video nodes ?
>
I set the "streaming" flag in PATCH 4, so it does not affect that even if several video
nodes use it.
Regards,
Changhuang
next prev parent reply other threads:[~2024-07-19 2:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 3:28 [PATCH v2 0/5] Add StarFive Camera Subsystem hibernation support Changhuang Liang
2024-07-18 3:28 ` [PATCH v2 1/5] media: cadence: csi2rx: Support runtime PM Changhuang Liang
2024-07-18 14:24 ` Jacopo Mondi
2024-07-18 14:53 ` kernel test robot
2024-07-18 3:28 ` [PATCH v2 2/5] media: cadence: csi2rx: Add system PM support Changhuang Liang
2024-07-18 14:31 ` Jacopo Mondi
2024-07-19 10:28 ` Tomi Valkeinen
2024-07-22 2:17 ` 回复: " Changhuang Liang
2024-07-22 8:53 ` Tomi Valkeinen
2024-07-22 11:25 ` Laurent Pinchart
2024-07-18 3:28 ` [PATCH v2 3/5] staging: media: starfive: Extract the ISP stream on as a helper function Changhuang Liang
2024-07-18 3:28 ` [PATCH v2 4/5] staging: media: starfive: Introduce streaming for ISP subdev Changhuang Liang
2024-07-18 3:28 ` [PATCH v2 5/5] staging: media: starfive: Add system PM support Changhuang Liang
2024-07-18 14:55 ` Jacopo Mondi
2024-07-19 2:08 ` Changhuang Liang [this message]
2024-07-22 8:57 ` 回复: " Jacopo Mondi
2024-07-22 9:25 ` 回复: " Changhuang Liang
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=ZQ0PR01MB13020F080F8D1B024D211971F2AD2@ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn \
--to=changhuang.liang@starfivetech.com \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=j-luthra@ti.com \
--cc=jack.zhu@starfivetech.com \
--cc=jacopo.mondi@ideasonboard.com \
--cc=jpawar@cadence.com \
--cc=keith.zhao@starfivetech.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=mripard@kernel.org \
--cc=tomi.valkeinen+renesas@ideasonboard.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
all inboxes | Powered by JetHome®