[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240718032834.53876-4-changhuang.liang@starfivetech.com>
Date: Wed, 17 Jul 2024 20:28:32 -0700
From: Changhuang Liang <changhuang.liang@...rfivetech.com>
To: Mauro Carvalho Chehab <mchehab@...nel.org>,
Maxime Ripard <mripard@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Hans Verkuil <hverkuil-cisco@...all.nl>
Cc: Jacopo Mondi <jacopo.mondi@...asonboard.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Tomi Valkeinen <tomi.valkeinen+renesas@...asonboard.com>,
Jack Zhu <jack.zhu@...rfivetech.com>,
Keith Zhao <keith.zhao@...rfivetech.com>,
Changhuang Liang <changhuang.liang@...rfivetech.com>,
Jayshri Pawar <jpawar@...ence.com>,
Jai Luthra <j-luthra@...com>,
linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-staging@...ts.linux.dev
Subject: [PATCH v2 3/5] staging: media: starfive: Extract the ISP stream on as a helper function
Extract the ISP stream on as a helper function and open it, Let the
other files can use it.
Signed-off-by: Changhuang Liang <changhuang.liang@...rfivetech.com>
---
.../staging/media/starfive/camss/stf-isp.c | 27 ++++++++++++-------
.../staging/media/starfive/camss/stf-isp.h | 2 ++
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/media/starfive/camss/stf-isp.c b/drivers/staging/media/starfive/camss/stf-isp.c
index 4e6e26736852..8c6388edf049 100644
--- a/drivers/staging/media/starfive/camss/stf-isp.c
+++ b/drivers/staging/media/starfive/camss/stf-isp.c
@@ -55,23 +55,30 @@ int stf_isp_init(struct stfcamss *stfcamss)
return 0;
}
-static int isp_set_stream(struct v4l2_subdev *sd, int enable)
+void stf_isp_stream_on(struct stf_isp_dev *isp_dev,
+ struct v4l2_subdev_state *sd_state)
{
- struct stf_isp_dev *isp_dev = v4l2_get_subdevdata(sd);
- struct v4l2_subdev_state *sd_state;
struct v4l2_mbus_framefmt *fmt;
struct v4l2_rect *crop;
- sd_state = v4l2_subdev_lock_and_get_active_state(sd);
fmt = v4l2_subdev_state_get_format(sd_state, STF_ISP_PAD_SINK);
crop = v4l2_subdev_state_get_crop(sd_state, STF_ISP_PAD_SRC);
- if (enable) {
- stf_isp_reset(isp_dev);
- stf_isp_init_cfg(isp_dev);
- stf_isp_settings(isp_dev, crop, fmt->code);
- stf_isp_stream_set(isp_dev);
- }
+ stf_isp_reset(isp_dev);
+ stf_isp_init_cfg(isp_dev);
+ stf_isp_settings(isp_dev, crop, fmt->code);
+ stf_isp_stream_set(isp_dev);
+}
+
+static int isp_set_stream(struct v4l2_subdev *sd, int enable)
+{
+ struct stf_isp_dev *isp_dev = v4l2_get_subdevdata(sd);
+ struct v4l2_subdev_state *sd_state;
+
+ sd_state = v4l2_subdev_lock_and_get_active_state(sd);
+
+ if (enable)
+ stf_isp_stream_on(isp_dev, sd_state);
v4l2_subdev_call(isp_dev->source_subdev, video, s_stream, enable);
diff --git a/drivers/staging/media/starfive/camss/stf-isp.h b/drivers/staging/media/starfive/camss/stf-isp.h
index 955cbb048363..1a3e8cf7859c 100644
--- a/drivers/staging/media/starfive/camss/stf-isp.h
+++ b/drivers/staging/media/starfive/camss/stf-isp.h
@@ -421,6 +421,8 @@ void stf_isp_init_cfg(struct stf_isp_dev *isp_dev);
void stf_isp_settings(struct stf_isp_dev *isp_dev,
struct v4l2_rect *crop, u32 mcode);
void stf_isp_stream_set(struct stf_isp_dev *isp_dev);
+void stf_isp_stream_on(struct stf_isp_dev *isp_dev,
+ struct v4l2_subdev_state *sd_state);
int stf_isp_init(struct stfcamss *stfcamss);
int stf_isp_register(struct stf_isp_dev *isp_dev, struct v4l2_device *v4l2_dev);
int stf_isp_unregister(struct stf_isp_dev *isp_dev);
--
2.25.1
Powered by blists - more mailing lists