From: Changhuang Liang <changhuang.liang@starfivetech.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Jack Zhu <jack.zhu@starfivetech.com>,
Changhuang Liang <changhuang.liang@starfivetech.com>,
Dan Carpenter <dan.carpenter@linaro.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-staging@lists.linux.dev
Subject: [PATCH v2 2/8] staging: media: starfive: Add bayer pad for ISP
Date: Wed, 10 Apr 2024 02:10:20 -0700 [thread overview]
Message-ID: <20240410091026.50272-3-changhuang.liang@starfivetech.com> (raw)
In-Reply-To: <20240410091026.50272-1-changhuang.liang@starfivetech.com>
Add bayer pad for ISP, it supported the output of the 12 bit per
pixel bayer format. It actually convert the 10 bit per pixel input
bayer format to the 12 bit per pixel format.
Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
---
drivers/staging/media/starfive/camss/stf-isp.c | 18 +++++++++++++++---
drivers/staging/media/starfive/camss/stf-isp.h | 1 +
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/media/starfive/camss/stf-isp.c b/drivers/staging/media/starfive/camss/stf-isp.c
index d961e06d9f7a..53b9cd2b49bd 100644
--- a/drivers/staging/media/starfive/camss/stf-isp.c
+++ b/drivers/staging/media/starfive/camss/stf-isp.c
@@ -29,6 +29,13 @@ static const struct stf_isp_format isp_formats_source[] = {
{ MEDIA_BUS_FMT_YUYV8_1_5X8, 8 },
};
+static const struct stf_isp_format isp_formats_source_bayer[] = {
+ { MEDIA_BUS_FMT_SRGGB12_1X12, 12 },
+ { MEDIA_BUS_FMT_SGRBG12_1X12, 12 },
+ { MEDIA_BUS_FMT_SGBRG12_1X12, 12 },
+ { MEDIA_BUS_FMT_SBGGR12_1X12, 12 },
+};
+
static const struct stf_isp_format isp_formats_source_scd[] = {
{ MEDIA_BUS_FMT_METADATA_FIXED },
};
@@ -37,6 +44,7 @@ static const struct stf_isp_format_table isp_formats_st7110[] = {
{ isp_formats_sink, ARRAY_SIZE(isp_formats_sink) },
{ isp_formats_sink_params, ARRAY_SIZE(isp_formats_sink_params) },
{ isp_formats_source, ARRAY_SIZE(isp_formats_source) },
+ { isp_formats_source_bayer, ARRAY_SIZE(isp_formats_source_bayer) },
{ isp_formats_source_scd, ARRAY_SIZE(isp_formats_source_scd) },
};
@@ -311,8 +319,11 @@ static int isp_set_selection(struct v4l2_subdev *sd,
crop.target = V4L2_SEL_TGT_CROP;
crop.r = *rect;
isp_set_selection(sd, state, &crop);
+
+ crop.pad = STF_ISP_PAD_SRC_BAYER;
+ isp_set_selection(sd, state, &crop);
} else if (sel->target == V4L2_SEL_TGT_CROP &&
- sel->pad == STF_ISP_PAD_SRC) {
+ (sel->pad == STF_ISP_PAD_SRC || sel->pad == STF_ISP_PAD_SRC_BAYER)) {
struct v4l2_subdev_format fmt = { 0 };
rect = v4l2_subdev_state_get_crop(state, sel->pad);
@@ -324,7 +335,7 @@ static int isp_set_selection(struct v4l2_subdev *sd,
/* Reset source pad format width and height */
fmt.which = sel->which;
- fmt.pad = STF_ISP_PAD_SRC;
+ fmt.pad = sel->pad;
fmt.format.width = rect->width;
fmt.format.height = rect->height;
isp_set_format(sd, state, &fmt);
@@ -368,7 +379,7 @@ static int isp_init_formats(struct v4l2_subdev *sd,
};
int ret;
- /* Init for STF_ISP_PAD_SINK and STF_ISP_PAD_SRC pad */
+ /* Init for STF_ISP_PAD_SINK, STF_ISP_PAD_SRC and STF_ISP_PAD_SRC_BAYER pad */
ret = isp_set_format(sd, sd_state, &format);
if (ret < 0)
return ret;
@@ -422,6 +433,7 @@ int stf_isp_register(struct stf_isp_dev *isp_dev, struct v4l2_device *v4l2_dev)
pads[STF_ISP_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
pads[STF_ISP_PAD_SINK_PARAMS].flags = MEDIA_PAD_FL_SINK;
pads[STF_ISP_PAD_SRC].flags = MEDIA_PAD_FL_SOURCE;
+ pads[STF_ISP_PAD_SRC_BAYER].flags = MEDIA_PAD_FL_SOURCE;
pads[STF_ISP_PAD_SRC_SCD].flags = MEDIA_PAD_FL_SOURCE;
sd->entity.function = MEDIA_ENT_F_PROC_VIDEO_ISP;
diff --git a/drivers/staging/media/starfive/camss/stf-isp.h b/drivers/staging/media/starfive/camss/stf-isp.h
index 3eade22c669e..f63817b7a235 100644
--- a/drivers/staging/media/starfive/camss/stf-isp.h
+++ b/drivers/staging/media/starfive/camss/stf-isp.h
@@ -529,6 +529,7 @@ enum stf_isp_pad_id {
STF_ISP_PAD_SINK = 0,
STF_ISP_PAD_SINK_PARAMS,
STF_ISP_PAD_SRC,
+ STF_ISP_PAD_SRC_BAYER,
STF_ISP_PAD_SRC_SCD,
STF_ISP_PAD_MAX
};
--
2.25.1
next prev parent reply other threads:[~2024-04-10 9:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-10 9:10 [PATCH v2 0/8] Add ISP Bayer for StarFive Changhuang Liang
2024-04-10 9:10 ` [PATCH v2 1/8] staging: media: starfive: Get rid of current_fmt Changhuang Liang
2024-04-10 9:10 ` Changhuang Liang [this message]
2024-04-10 9:10 ` [PATCH v2 3/8] staging: media: starfive: Use PAD_SINK instead of PAD_SRC for crop Changhuang Liang
2024-04-10 9:10 ` [PATCH v2 4/8] staging: media: starfive: Introduce isp_stream Changhuang Liang
2024-04-10 9:10 ` [PATCH v2 5/8] staging: media: starfive: Add ISP bayer video device Changhuang Liang
2024-04-10 9:10 ` [PATCH v2 6/8] staging: media: starfive: Fix bayer output stride configuration Changhuang Liang
2024-04-10 9:10 ` [PATCH v2 7/8] staging: media: starfive: Move the struct media_pipeline position Changhuang Liang
2024-04-10 9:10 ` [PATCH v2 8/8] admin-guide: media: Update documents for StarFive Camera Subsystem 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=20240410091026.50272-3-changhuang.liang@starfivetech.com \
--to=changhuang.liang@starfivetech.com \
--cc=bryan.odonoghue@linaro.org \
--cc=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jack.zhu@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 \
/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®