From: Todor Tomov <todor.tomov@linaro.org>
To: mchehab@kernel.org, hans.verkuil@cisco.com,
javier@osg.samsung.com, s.nawrocki@samsung.com,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org
Cc: Todor Tomov <todor.tomov@linaro.org>
Subject: [PATCH v2 17/19] camss: vfe: Configure crop module in VFE
Date: Mon, 19 Jun 2017 17:48:37 +0300 [thread overview]
Message-ID: <1497883719-12410-18-git-send-email-todor.tomov@linaro.org> (raw)
In-Reply-To: <1497883719-12410-1-git-send-email-todor.tomov@linaro.org>
Add crop module configuration support to be able to apply cropping.
Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
---
drivers/media/platform/qcom/camss-8x16/vfe.c | 41 +++++++++++++++++++++++++++-
1 file changed, 40 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/camss-8x16/vfe.c b/drivers/media/platform/qcom/camss-8x16/vfe.c
index b97aefa..0241faa 100644
--- a/drivers/media/platform/qcom/camss-8x16/vfe.c
+++ b/drivers/media/platform/qcom/camss-8x16/vfe.c
@@ -57,6 +57,7 @@
#define VFE_0_MODULE_CFG_DEMUX (1 << 2)
#define VFE_0_MODULE_CFG_CHROMA_UPSAMPLE (1 << 3)
#define VFE_0_MODULE_CFG_SCALE_ENC (1 << 23)
+#define VFE_0_MODULE_CFG_CROP_ENC (1 << 27)
#define VFE_0_CORE_CFG 0x01c
#define VFE_0_CORE_CFG_PIXEL_PATTERN_YCBYCR 0x4
@@ -194,6 +195,11 @@
#define VFE_0_SCALE_ENC_CBCR_V_IMAGE_SIZE 0x790
#define VFE_0_SCALE_ENC_CBCR_V_PHASE 0x794
+#define VFE_0_CROP_ENC_Y_WIDTH 0x854
+#define VFE_0_CROP_ENC_Y_HEIGHT 0x858
+#define VFE_0_CROP_ENC_CBCR_WIDTH 0x85c
+#define VFE_0_CROP_ENC_CBCR_HEIGHT 0x860
+
#define VFE_0_CLAMP_ENC_MAX_CFG 0x874
#define VFE_0_CLAMP_ENC_MIN_CFG 0x878
@@ -716,6 +722,37 @@ static void vfe_set_scale_cfg(struct vfe_device *vfe, struct vfe_line *line)
writel_relaxed(reg, vfe->base + VFE_0_SCALE_ENC_CBCR_V_PHASE);
}
+static void vfe_set_crop_cfg(struct vfe_device *vfe, struct vfe_line *line)
+{
+ u32 p = line->video_out.active_fmt.fmt.pix_mp.pixelformat;
+ u32 reg;
+ u16 first, last;
+
+ first = line->crop.left;
+ last = line->crop.left + line->crop.width - 1;
+ reg = (first << 16) | last;
+ writel_relaxed(reg, vfe->base + VFE_0_CROP_ENC_Y_WIDTH);
+
+ first = line->crop.top;
+ last = line->crop.top + line->crop.height - 1;
+ reg = (first << 16) | last;
+ writel_relaxed(reg, vfe->base + VFE_0_CROP_ENC_Y_HEIGHT);
+
+ first = line->crop.left / 2;
+ last = line->crop.left / 2 + line->crop.width / 2 - 1;
+ reg = (first << 16) | last;
+ writel_relaxed(reg, vfe->base + VFE_0_CROP_ENC_CBCR_WIDTH);
+
+ first = line->crop.top;
+ last = line->crop.top + line->crop.height - 1;
+ if (p == V4L2_PIX_FMT_NV12 || p == V4L2_PIX_FMT_NV21) {
+ first = line->crop.top / 2;
+ last = line->crop.top / 2 + line->crop.height / 2 - 1;
+ }
+ reg = (first << 16) | last;
+ writel_relaxed(reg, vfe->base + VFE_0_CROP_ENC_CBCR_HEIGHT);
+}
+
static void vfe_set_clamp_cfg(struct vfe_device *vfe)
{
writel_relaxed(0x00ffffff, vfe->base + VFE_0_CLAMP_ENC_MAX_CFG);
@@ -828,7 +865,8 @@ static void vfe_set_module_cfg(struct vfe_device *vfe, u8 enable)
{
u32 val = VFE_0_MODULE_CFG_DEMUX |
VFE_0_MODULE_CFG_CHROMA_UPSAMPLE |
- VFE_0_MODULE_CFG_SCALE_ENC;
+ VFE_0_MODULE_CFG_SCALE_ENC |
+ VFE_0_MODULE_CFG_CROP_ENC;
if (enable)
writel_relaxed(val, vfe->base + VFE_0_MODULE_CFG);
@@ -1303,6 +1341,7 @@ static int vfe_enable_output(struct vfe_line *line)
vfe_set_xbar_cfg(vfe, output, 1);
vfe_set_demux_cfg(vfe, line);
vfe_set_scale_cfg(vfe, line);
+ vfe_set_crop_cfg(vfe, line);
vfe_set_clamp_cfg(vfe);
vfe_set_camif_cmd(vfe, VFE_0_CAMIF_CMD_ENABLE_FRAME_BOUNDARY);
}
--
1.9.1
next prev parent reply other threads:[~2017-06-19 14:56 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-19 14:48 [PATCH v2 00/19] Qualcomm 8x16 Camera Subsystem driver Todor Tomov
2017-06-19 14:48 ` [PATCH v2 01/19] doc: DT: camss: Binding document for Qualcomm Camera subsystem driver Todor Tomov
2017-06-23 20:41 ` Rob Herring
2017-06-29 12:11 ` Todor Tomov
2017-06-19 14:48 ` [PATCH v2 02/19] MAINTAINERS: Add " Todor Tomov
2017-06-19 14:48 ` [PATCH v2 03/19] doc: media/v4l-drivers: Add Qualcomm Camera Subsystem driver document Todor Tomov
2017-06-19 14:48 ` [PATCH v2 04/19] media: camss: Add CSIPHY files Todor Tomov
2017-06-28 21:34 ` Sakari Ailus
2017-06-29 16:36 ` Todor Tomov
2017-06-29 23:53 ` Sakari Ailus
2017-06-30 7:00 ` Todor Tomov
2017-06-30 8:05 ` Sakari Ailus
2017-06-19 14:48 ` [PATCH v2 05/19] media: camss: Add CSID files Todor Tomov
2017-07-03 10:49 ` Hans Verkuil
2017-07-03 14:10 ` Todor Tomov
2017-06-19 14:48 ` [PATCH v2 06/19] media: camss: Add ISPIF files Todor Tomov
2017-06-19 14:48 ` [PATCH v2 07/19] media: camss: Add VFE files Todor Tomov
2017-06-19 14:48 ` [PATCH v2 08/19] media: camss: Add files which handle the video device nodes Todor Tomov
2017-07-03 11:32 ` Hans Verkuil
2017-07-06 13:44 ` Todor Tomov
2017-07-06 14:43 ` Hans Verkuil
2017-06-19 14:48 ` [PATCH v2 09/19] media: camms: Add core files Todor Tomov
2017-06-29 6:33 ` Sakari Ailus
2017-07-03 14:03 ` Todor Tomov
2017-07-04 5:43 ` Sakari Ailus
2017-07-03 11:24 ` Hans Verkuil
2017-07-03 14:12 ` Todor Tomov
2017-06-19 14:48 ` [PATCH v2 10/19] media: camss: Enable building Todor Tomov
2017-06-20 10:30 ` kbuild test robot
2017-06-20 11:20 ` Todor Tomov
2017-06-19 14:48 ` [PATCH v2 11/19] camss: vfe: Format conversion support using PIX interface Todor Tomov
2017-06-19 14:48 ` [PATCH v2 12/19] doc: media/v4l-drivers: Qualcomm Camera Subsystem - PIX Interface Todor Tomov
2017-06-19 14:48 ` [PATCH v2 13/19] camss: vfe: Support for frame padding Todor Tomov
2017-06-19 14:48 ` [PATCH v2 14/19] camss: vfe: Add interface for scaling Todor Tomov
2017-06-19 14:48 ` [PATCH v2 15/19] camss: vfe: Configure scaler module in VFE Todor Tomov
2017-06-19 14:48 ` [PATCH v2 16/19] camss: vfe: Add interface for cropping Todor Tomov
2017-06-19 14:48 ` Todor Tomov [this message]
2017-06-19 14:48 ` [PATCH v2 18/19] doc: media/v4l-drivers: Qualcomm Camera Subsystem - Scale and crop Todor Tomov
2017-06-19 14:48 ` [PATCH v2 19/19] camss: Use optimal clock frequency rates Todor Tomov
2017-07-03 11:36 ` [PATCH v2 00/19] Qualcomm 8x16 Camera Subsystem driver Hans Verkuil
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=1497883719-12410-18-git-send-email-todor.tomov@linaro.org \
--to=todor.tomov@linaro.org \
--cc=hans.verkuil@cisco.com \
--cc=javier@osg.samsung.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=s.nawrocki@samsung.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