LKML Archive mirror
 help / color / mirror / Atom feed
From: Daniel Scally <djrscally@gmail.com>
To: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	mchehab@kernel.org, yong.zhi@intel.com,
	sakari.ailus@linux.intel.com, bingbu.cao@intel.com
Cc: tian.shu.qiu@intel.com, kieran.bingham+renesas@ideasonboard.com,
	laurent.pinchart@ideasonboard.com, jacopo+renesas@jmondi.org,
	dongchun.zhu@mediatek.com, niklas.soderlund+renesas@ragnatech.se,
	me@fabwu.ch, luzmaximilian@gmail.com,
	jeanmichel.hautbois@ideasonboard.com, kitakar@gmail.com
Subject: [PATCH v2 1/2] media: ipu3-cio2: Toggle sensor streaming in pm runtime ops
Date: Mon,  5 Apr 2021 23:56:53 +0100	[thread overview]
Message-ID: <20210405225654.126916-2-djrscally@gmail.com> (raw)
In-Reply-To: <20210405225654.126916-1-djrscally@gmail.com>

The .suspend() and .resume() runtime_pm operations for the ipu3-cio2
driver currently do not handle the sensor's stream. Setting .s_stream() on
or off for the sensor subdev means that sensors will pause and resume the
stream at the appropriate time even if their drivers don't implement those
operations.

Signed-off-by: Daniel Scally <djrscally@gmail.com>
---
Changes in v2:

	Patch introduced

 drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
index db59b19a6236..0a970ddeb281 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
@@ -1981,12 +1981,19 @@ static int __maybe_unused cio2_suspend(struct device *dev)
 	struct pci_dev *pci_dev = to_pci_dev(dev);
 	struct cio2_device *cio2 = pci_get_drvdata(pci_dev);
 	struct cio2_queue *q = cio2->cur_queue;
+	int r;
 
 	dev_dbg(dev, "cio2 suspend\n");
 	if (!cio2->streaming)
 		return 0;
 
 	/* Stop stream */
+	r = v4l2_subdev_call(q->sensor, video, s_stream, 0);
+	if (r) {
+		dev_err(dev, "failed to stop sensor streaming\n");
+		return r;
+	}
+
 	cio2_hw_exit(cio2, q);
 	synchronize_irq(pci_dev->irq);
 
@@ -2021,8 +2028,14 @@ static int __maybe_unused cio2_resume(struct device *dev)
 	}
 
 	r = cio2_hw_init(cio2, q);
-	if (r)
+	if (r) {
 		dev_err(dev, "fail to init cio2 hw\n");
+		return r;
+	}
+
+	r = v4l2_subdev_call(q->sensor, video, s_stream, 1);
+	if (r)
+		dev_err(dev, "fail to start sensor streaming\n");
 
 	return r;
 }
-- 
2.25.1


  reply	other threads:[~2021-04-05 22:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-05 22:56 [PATCH v2 0/2] Add support for OV5693 Sensor Daniel Scally
2021-04-05 22:56 ` Daniel Scally [this message]
2021-04-05 22:56 ` [PATCH v2 2/2] media: i2c: Add support for ov5693 sensor Daniel Scally
2021-04-06 13:54   ` Jean-Michel Hautbois
2021-04-06 14:08     ` Daniel Scally

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=20210405225654.126916-2-djrscally@gmail.com \
    --to=djrscally@gmail.com \
    --cc=bingbu.cao@intel.com \
    --cc=dongchun.zhu@mediatek.com \
    --cc=jacopo+renesas@jmondi.org \
    --cc=jeanmichel.hautbois@ideasonboard.com \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=kitakar@gmail.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=luzmaximilian@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=me@fabwu.ch \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tian.shu.qiu@intel.com \
    --cc=yong.zhi@intel.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 read-only IMAP folder(s) and NNTP newsgroup(s).