* [PATCH v4 01/11] media: rkisp1: Add and use rkisp1_has_feature() macro
2023-11-29 9:27 [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Paul Elder
@ 2023-11-29 9:27 ` Paul Elder
2023-11-29 9:27 ` [PATCH v4 02/11] media: rkisp1: Support setting memory stride for main path Paul Elder
` (11 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Paul Elder @ 2023-11-29 9:27 UTC (permalink / raw)
To: linux-media, linux-rockchip, devicetree
Cc: kieran.bingham, tomi.valkeinen, umang.jain, aford173,
Laurent Pinchart, Paul Elder, Dafna Hirschfeld,
Mauro Carvalho Chehab, Heiko Stuebner,
moderated list:ARM/Rockchip SoC support, open list
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Simplify feature tests with a macro that shortens lines.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
.../media/platform/rockchip/rkisp1/rkisp1-common.h | 3 +++
.../media/platform/rockchip/rkisp1/rkisp1-dev.c | 14 +++++++-------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
index be69173958a4..24adcd2d99a3 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
@@ -111,6 +111,9 @@ enum rkisp1_feature {
RKISP1_FEATURE_MIPI_CSI2 = BIT(0),
};
+#define rkisp1_has_feature(rkisp1, feature) \
+ ((rkisp1)->info->features & RKISP1_FEATURE_##feature)
+
/*
* struct rkisp1_info - Model-specific ISP Information
*
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
index c41abd2833f1..c1985243b42e 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
@@ -206,7 +206,7 @@ static int rkisp1_subdev_notifier_register(struct rkisp1_device *rkisp1)
switch (reg) {
case 0:
/* MIPI CSI-2 port */
- if (!(rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2)) {
+ if (!rkisp1_has_feature(rkisp1, MIPI_CSI2)) {
dev_err(rkisp1->dev,
"internal CSI must be available for port 0\n");
ret = -EINVAL;
@@ -338,7 +338,7 @@ static int rkisp1_create_links(struct rkisp1_device *rkisp1)
unsigned int i;
int ret;
- if (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2) {
+ if (rkisp1_has_feature(rkisp1, MIPI_CSI2)) {
/* Link the CSI receiver to the ISP. */
ret = media_create_pad_link(&rkisp1->csi.sd.entity,
RKISP1_CSI_PAD_SRC,
@@ -390,7 +390,7 @@ static int rkisp1_create_links(struct rkisp1_device *rkisp1)
static void rkisp1_entities_unregister(struct rkisp1_device *rkisp1)
{
- if (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2)
+ if (rkisp1_has_feature(rkisp1, MIPI_CSI2))
rkisp1_csi_unregister(rkisp1);
rkisp1_params_unregister(rkisp1);
rkisp1_stats_unregister(rkisp1);
@@ -423,7 +423,7 @@ static int rkisp1_entities_register(struct rkisp1_device *rkisp1)
if (ret)
goto error;
- if (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2) {
+ if (rkisp1_has_feature(rkisp1, MIPI_CSI2)) {
ret = rkisp1_csi_register(rkisp1);
if (ret)
goto error;
@@ -590,7 +590,7 @@ static int rkisp1_probe(struct platform_device *pdev)
goto err_unreg_v4l2_dev;
}
- if (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2) {
+ if (rkisp1_has_feature(rkisp1, MIPI_CSI2)) {
ret = rkisp1_csi_init(rkisp1);
if (ret)
goto err_unreg_media_dev;
@@ -611,7 +611,7 @@ static int rkisp1_probe(struct platform_device *pdev)
err_unreg_entities:
rkisp1_entities_unregister(rkisp1);
err_cleanup_csi:
- if (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2)
+ if (rkisp1_has_feature(rkisp1, MIPI_CSI2))
rkisp1_csi_cleanup(rkisp1);
err_unreg_media_dev:
media_device_unregister(&rkisp1->media_dev);
@@ -630,7 +630,7 @@ static void rkisp1_remove(struct platform_device *pdev)
v4l2_async_nf_cleanup(&rkisp1->notifier);
rkisp1_entities_unregister(rkisp1);
- if (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2)
+ if (rkisp1_has_feature(rkisp1, MIPI_CSI2))
rkisp1_csi_cleanup(rkisp1);
rkisp1_debug_cleanup(rkisp1);
--
2.39.2
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v4 02/11] media: rkisp1: Support setting memory stride for main path
2023-11-29 9:27 [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Paul Elder
2023-11-29 9:27 ` [PATCH v4 01/11] media: rkisp1: Add and use rkisp1_has_feature() macro Paul Elder
@ 2023-11-29 9:27 ` Paul Elder
2023-11-29 9:27 ` [PATCH v4 03/11] media: rkisp1: Support devices lacking self path Paul Elder
` (10 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Paul Elder @ 2023-11-29 9:27 UTC (permalink / raw)
To: linux-media, linux-rockchip, devicetree
Cc: kieran.bingham, tomi.valkeinen, umang.jain, aford173, Paul Elder,
Laurent Pinchart, Dafna Hirschfeld, Mauro Carvalho Chehab,
Heiko Stuebner, moderated list:ARM/Rockchip SoC support,
open list
Some versions of the ISP supported by the rkisp1 driver, such as the ISP
in the i.MX8MP, implement configurable memory stride for the main path
the same way as already implemented by the driver for the self path.
Support this feature by adding a main stride feature flag and program
the corresponding registers accordingly.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes since v3:
- Implement memory stride support
- Squash patch that adds register bits definitions
- Reword the commit message
Changes since v2:
- Document the RKISP1_FEATURE_MAIN_STRIDE bit
- Use the rkisp1_has_feature() macro
.../platform/rockchip/rkisp1/rkisp1-capture.c | 34 ++++++++++++-------
.../platform/rockchip/rkisp1/rkisp1-common.h | 6 ++--
.../platform/rockchip/rkisp1/rkisp1-regs.h | 27 +++++++++++++++
3 files changed, 52 insertions(+), 15 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
index c6d7e01c8949..f8ce0322dde0 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
@@ -442,6 +442,14 @@ static void rkisp1_mp_config(struct rkisp1_capture *cap)
rkisp1_write(rkisp1, cap->config->mi.cr_size_init,
rkisp1_pixfmt_comp_size(pixm, RKISP1_PLANE_CR));
+ if (rkisp1_has_feature(rkisp1, MAIN_STRIDE)) {
+ rkisp1_write(rkisp1, RKISP1_CIF_MI_MP_Y_LLENGTH, cap->stride);
+ rkisp1_write(rkisp1, RKISP1_CIF_MI_MP_Y_PIC_WIDTH, pixm->width);
+ rkisp1_write(rkisp1, RKISP1_CIF_MI_MP_Y_PIC_HEIGHT, pixm->height);
+ rkisp1_write(rkisp1, RKISP1_CIF_MI_MP_Y_PIC_SIZE,
+ cap->stride * pixm->height);
+ }
+
rkisp1_irq_frame_end_enable(cap);
/* set uv swapping for semiplanar formats */
@@ -479,11 +487,11 @@ static void rkisp1_sp_config(struct rkisp1_capture *cap)
rkisp1_write(rkisp1, cap->config->mi.cr_size_init,
rkisp1_pixfmt_comp_size(pixm, RKISP1_PLANE_CR));
- rkisp1_write(rkisp1, RKISP1_CIF_MI_SP_Y_LLENGTH, cap->sp_y_stride);
+ rkisp1_write(rkisp1, RKISP1_CIF_MI_SP_Y_LLENGTH, cap->stride);
rkisp1_write(rkisp1, RKISP1_CIF_MI_SP_Y_PIC_WIDTH, pixm->width);
rkisp1_write(rkisp1, RKISP1_CIF_MI_SP_Y_PIC_HEIGHT, pixm->height);
rkisp1_write(rkisp1, RKISP1_CIF_MI_SP_Y_PIC_SIZE,
- cap->sp_y_stride * pixm->height);
+ cap->stride * pixm->height);
rkisp1_irq_frame_end_enable(cap);
@@ -1092,8 +1100,8 @@ static const struct vb2_ops rkisp1_vb2_ops = {
*/
static const struct v4l2_format_info *
-rkisp1_fill_pixfmt(struct v4l2_pix_format_mplane *pixm,
- enum rkisp1_stream_id id)
+rkisp1_fill_pixfmt(const struct rkisp1_capture *cap,
+ struct v4l2_pix_format_mplane *pixm)
{
struct v4l2_plane_pix_format *plane_y = &pixm->plane_fmt[0];
const struct v4l2_format_info *info;
@@ -1106,10 +1114,13 @@ rkisp1_fill_pixfmt(struct v4l2_pix_format_mplane *pixm,
/*
* The SP supports custom strides, expressed as a number of pixels for
- * the Y plane. Clamp the stride to a reasonable value to avoid integer
- * overflows when calculating the bytesperline and sizeimage values.
+ * the Y plane, and so does the MP in ISP versions that have the
+ * MAIN_STRIDE feature. Clamp the stride to a reasonable value to avoid
+ * integer overflows when calculating the bytesperline and sizeimage
+ * values.
*/
- if (id == RKISP1_SELFPATH)
+ if (cap->id == RKISP1_SELFPATH ||
+ rkisp1_has_feature(cap->rkisp1, MAIN_STRIDE))
stride = clamp(DIV_ROUND_UP(plane_y->bytesperline, info->bpp[0]),
pixm->width, 65536U);
else
@@ -1184,7 +1195,7 @@ static void rkisp1_try_fmt(const struct rkisp1_capture *cap,
pixm->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;
pixm->quantization = V4L2_QUANTIZATION_DEFAULT;
- info = rkisp1_fill_pixfmt(pixm, cap->id);
+ info = rkisp1_fill_pixfmt(cap, pixm);
if (fmt_cfg)
*fmt_cfg = fmt;
@@ -1196,12 +1207,9 @@ static void rkisp1_set_fmt(struct rkisp1_capture *cap,
struct v4l2_pix_format_mplane *pixm)
{
rkisp1_try_fmt(cap, pixm, &cap->pix.cfg, &cap->pix.info);
- cap->pix.fmt = *pixm;
- /* SP supports custom stride in number of pixels of the Y plane */
- if (cap->id == RKISP1_SELFPATH)
- cap->sp_y_stride = pixm->plane_fmt[0].bytesperline /
- cap->pix.info->bpp[0];
+ cap->pix.fmt = *pixm;
+ cap->stride = pixm->plane_fmt[0].bytesperline / cap->pix.info->bpp[0];
}
static int rkisp1_try_fmt_vid_cap_mplane(struct file *file, void *fh,
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
index 24adcd2d99a3..48e6e332f061 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
@@ -102,6 +102,7 @@ enum rkisp1_isp_pad {
* enum rkisp1_feature - ISP features
*
* @RKISP1_FEATURE_MIPI_CSI2: The ISP has an internal MIPI CSI-2 receiver
+ * @RKISP1_FEATURE_MAIN_STRIDE: The ISP supports configurable stride on the main path
*
* The ISP features are stored in a bitmask in &rkisp1_info.features and allow
* the driver to implement support for features present in some ISP versions
@@ -109,6 +110,7 @@ enum rkisp1_isp_pad {
*/
enum rkisp1_feature {
RKISP1_FEATURE_MIPI_CSI2 = BIT(0),
+ RKISP1_FEATURE_MAIN_STRIDE = BIT(1),
};
#define rkisp1_has_feature(rkisp1, feature) \
@@ -258,7 +260,7 @@ struct rkisp1_device;
* handler to stop the streaming by waiting on the 'done' wait queue.
* If the irq handler is not called, the stream is stopped by the callback
* after timeout.
- * @sp_y_stride: the selfpath allows to configure a y stride that is longer than the image width.
+ * @stride: the line stride for the first plane, in pixel units
* @buf.lock: lock to protect buf.queue
* @buf.queue: queued buffer list
* @buf.dummy: dummy space to store dropped data
@@ -279,7 +281,7 @@ struct rkisp1_capture {
bool is_streaming;
bool is_stopping;
wait_queue_head_t done;
- unsigned int sp_y_stride;
+ unsigned int stride;
struct {
/* protects queue, curr and next */
spinlock_t lock;
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
index bea69a0d766a..3b19c8411360 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
@@ -207,6 +207,24 @@
#define RKISP1_CIF_MI_XTD_FMT_CTRL_SP_CB_CR_SWAP BIT(1)
#define RKISP1_CIF_MI_XTD_FMT_CTRL_DMA_CB_CR_SWAP BIT(2)
+/* MI_OUTPUT_ALIGN_FORMAT */
+#define RKISP1_CIF_OUTPUT_ALIGN_FORMAT_MP_LSB_ALIGNMENT BIT(0)
+#define RKISP1_CIF_OUTPUT_ALIGN_FORMAT_MP_BYTE_SWAP_BYTES BIT(1)
+#define RKISP1_CIF_OUTPUT_ALIGN_FORMAT_MP_BYTE_SWAP_WORDS BIT(2)
+#define RKISP1_CIF_OUTPUT_ALIGN_FORMAT_MP_BYTE_SWAP_DWORDS BIT(3)
+#define RKISP1_CIF_OUTPUT_ALIGN_FORMAT_SP_BYTE_SWAP_BYTES BIT(4)
+#define RKISP1_CIF_OUTPUT_ALIGN_FORMAT_SP_BYTE_SWAP_WORDS BIT(5)
+#define RKISP1_CIF_OUTPUT_ALIGN_FORMAT_SP_BYTE_SWAP_DWORDS BIT(6)
+#define RKISP1_CIF_OUTPUT_ALIGN_FORMAT_DMA_BYTE_SWAP_BYTES BIT(7)
+#define RKISP1_CIF_OUTPUT_ALIGN_FORMAT_DMA_BYTE_SWAP_WORDS BIT(8)
+#define RKISP1_CIF_OUTPUT_ALIGN_FORMAT_DMA_BYTE_SWAP_DWORDS BIT(9)
+
+/* MI_MP_OUTPUT_FIFO_SIZE */
+#define RKISP1_CIF_MI_MP_OUTPUT_FIFO_SIZE_OUTPUT_FIFO_DEPTH_FULL (0 << 0)
+#define RKISP1_CIF_MI_MP_OUTPUT_FIFO_SIZE_OUTPUT_FIFO_DEPTH_HALF (1 << 0)
+#define RKISP1_CIF_MI_MP_OUTPUT_FIFO_SIZE_OUTPUT_FIFO_DEPTH_QUARTER (2 << 0)
+#define RKISP1_CIF_MI_MP_OUTPUT_FIFO_SIZE_OUTPUT_FIFO_DEPTH_EIGHT (3 << 0)
+
/* VI_CCL */
#define RKISP1_CIF_CCL_CIF_CLK_DIS BIT(2)
/* VI_ISP_CLK_CTRL */
@@ -1000,6 +1018,15 @@
#define RKISP1_CIF_MI_SP_CB_BASE_AD_INIT2 (RKISP1_CIF_MI_BASE + 0x00000140)
#define RKISP1_CIF_MI_SP_CR_BASE_AD_INIT2 (RKISP1_CIF_MI_BASE + 0x00000144)
#define RKISP1_CIF_MI_XTD_FORMAT_CTRL (RKISP1_CIF_MI_BASE + 0x00000148)
+#define RKISP1_CIF_MI_MP_HANDSHAKE_0 (RKISP1_CIF_MI_BASE + 0x0000014C)
+#define RKISP1_CIF_MI_MP_Y_LLENGTH (RKISP1_CIF_MI_BASE + 0x00000150)
+#define RKISP1_CIF_MI_MP_Y_SLICE_OFFSET (RKISP1_CIF_MI_BASE + 0x00000154)
+#define RKISP1_CIF_MI_MP_C_SLICE_OFFSET (RKISP1_CIF_MI_BASE + 0x00000158)
+#define RKISP1_CIF_MI_OUTPUT_ALIGN_FORMAT (RKISP1_CIF_MI_BASE + 0x0000015C)
+#define RKISP1_CIF_MI_MP_OUTPUT_FIFO_SIZE (RKISP1_CIF_MI_BASE + 0x00000160)
+#define RKISP1_CIF_MI_MP_Y_PIC_WIDTH (RKISP1_CIF_MI_BASE + 0x00000164)
+#define RKISP1_CIF_MI_MP_Y_PIC_HEIGHT (RKISP1_CIF_MI_BASE + 0x00000168)
+#define RKISP1_CIF_MI_MP_Y_PIC_SIZE (RKISP1_CIF_MI_BASE + 0x0000016C)
#define RKISP1_CIF_SMIA_BASE 0x00001a00
#define RKISP1_CIF_SMIA_CTRL (RKISP1_CIF_SMIA_BASE + 0x00000000)
--
2.39.2
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v4 03/11] media: rkisp1: Support devices lacking self path
2023-11-29 9:27 [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Paul Elder
2023-11-29 9:27 ` [PATCH v4 01/11] media: rkisp1: Add and use rkisp1_has_feature() macro Paul Elder
2023-11-29 9:27 ` [PATCH v4 02/11] media: rkisp1: Support setting memory stride for main path Paul Elder
@ 2023-11-29 9:27 ` Paul Elder
2023-11-29 9:27 ` [PATCH v4 04/11] media: rkisp1: Support devices lacking dual crop Paul Elder
` (9 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Paul Elder @ 2023-11-29 9:27 UTC (permalink / raw)
To: linux-media, linux-rockchip, devicetree
Cc: kieran.bingham, tomi.valkeinen, umang.jain, aford173, Paul Elder,
Laurent Pinchart, Dafna Hirschfeld, Mauro Carvalho Chehab,
Heiko Stuebner, moderated list:ARM/Rockchip SoC support,
open list
Some versions of the ISP supported by the rkisp1 driver, such as the ISP
in the i.MX8MP, lack the self path. Support those ISP versions by adding
a self path feature flag, and massage the rest of the driver to support
the lack of a self path.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes since v3:
- Document the feature bit
- Reorder commit
Changes since v2:
- Simplify rkisp1_path_count()
- Use the rkisp1_has_feature() macro
.../platform/rockchip/rkisp1/rkisp1-capture.c | 9 ++++++---
.../platform/rockchip/rkisp1/rkisp1-common.h | 15 +++++++++++++++
.../media/platform/rockchip/rkisp1/rkisp1-dev.c | 9 ++++++---
.../platform/rockchip/rkisp1/rkisp1-resizer.c | 6 ++++--
4 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
index f8ce0322dde0..ab369baf8d1b 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
@@ -730,6 +730,7 @@ irqreturn_t rkisp1_capture_isr(int irq, void *ctx)
{
struct device *dev = ctx;
struct rkisp1_device *rkisp1 = dev_get_drvdata(dev);
+ unsigned int dev_count = rkisp1_path_count(rkisp1);
unsigned int i;
u32 status;
@@ -739,7 +740,7 @@ irqreturn_t rkisp1_capture_isr(int irq, void *ctx)
rkisp1_write(rkisp1, RKISP1_CIF_MI_ICR, status);
- for (i = 0; i < ARRAY_SIZE(rkisp1->capture_devs); ++i) {
+ for (i = 0; i < dev_count; ++i) {
struct rkisp1_capture *cap = &rkisp1->capture_devs[i];
if (!(status & RKISP1_CIF_MI_FRAME(cap)))
@@ -896,6 +897,7 @@ static void rkisp1_cap_stream_enable(struct rkisp1_capture *cap)
{
struct rkisp1_device *rkisp1 = cap->rkisp1;
struct rkisp1_capture *other = &rkisp1->capture_devs[cap->id ^ 1];
+ bool has_self_path = rkisp1_has_feature(rkisp1, SELF_PATH);
cap->ops->set_data_path(cap);
cap->ops->config(cap);
@@ -913,7 +915,7 @@ static void rkisp1_cap_stream_enable(struct rkisp1_capture *cap)
* This's also required because the second FE maybe corrupt
* especially when run at 120fps.
*/
- if (!other->is_streaming) {
+ if (!has_self_path || !other->is_streaming) {
/* force cfg update */
rkisp1_write(rkisp1, RKISP1_CIF_MI_INIT,
RKISP1_CIF_MI_INIT_SOFT_UPD);
@@ -1506,10 +1508,11 @@ rkisp1_capture_init(struct rkisp1_device *rkisp1, enum rkisp1_stream_id id)
int rkisp1_capture_devs_register(struct rkisp1_device *rkisp1)
{
+ unsigned int dev_count = rkisp1_path_count(rkisp1);
unsigned int i;
int ret;
- for (i = 0; i < ARRAY_SIZE(rkisp1->capture_devs); i++) {
+ for (i = 0; i < dev_count; i++) {
struct rkisp1_capture *cap = &rkisp1->capture_devs[i];
rkisp1_capture_init(rkisp1, i);
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
index 48e6e332f061..e54cf14b72b1 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
@@ -103,6 +103,7 @@ enum rkisp1_isp_pad {
*
* @RKISP1_FEATURE_MIPI_CSI2: The ISP has an internal MIPI CSI-2 receiver
* @RKISP1_FEATURE_MAIN_STRIDE: The ISP supports configurable stride on the main path
+ * @RKISP1_FEATURE_SELF_PATH: The ISP has a self path
*
* The ISP features are stored in a bitmask in &rkisp1_info.features and allow
* the driver to implement support for features present in some ISP versions
@@ -111,6 +112,7 @@ enum rkisp1_isp_pad {
enum rkisp1_feature {
RKISP1_FEATURE_MIPI_CSI2 = BIT(0),
RKISP1_FEATURE_MAIN_STRIDE = BIT(1),
+ RKISP1_FEATURE_SELF_PATH = BIT(2),
};
#define rkisp1_has_feature(rkisp1, feature) \
@@ -520,6 +522,19 @@ int rkisp1_cap_enum_mbus_codes(struct rkisp1_capture *cap,
*/
const struct rkisp1_mbus_info *rkisp1_mbus_info_get_by_index(unsigned int index);
+/*
+ * rkisp1_path_count - Return the number of paths supported by the device
+ *
+ * Some devices only have a main path, while other device have both a main path
+ * and a self path. This function returns the number of paths that this device
+ * has, based on the feature flags. It should be used insted of checking
+ * ARRAY_SIZE of capture_devs/resizer_devs.
+ */
+static inline unsigned int rkisp1_path_count(struct rkisp1_device *rkisp1)
+{
+ return rkisp1_has_feature(rkisp1, SELF_PATH) ? 2 : 1;
+}
+
/*
* rkisp1_sd_adjust_crop_rect - adjust a rectangle to fit into another rectangle.
*
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
index c1985243b42e..7f5e2c6d1d73 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
@@ -335,6 +335,7 @@ static const struct dev_pm_ops rkisp1_pm_ops = {
static int rkisp1_create_links(struct rkisp1_device *rkisp1)
{
+ unsigned int dev_count = rkisp1_path_count(rkisp1);
unsigned int i;
int ret;
@@ -350,7 +351,7 @@ static int rkisp1_create_links(struct rkisp1_device *rkisp1)
}
/* create ISP->RSZ->CAP links */
- for (i = 0; i < 2; i++) {
+ for (i = 0; i < dev_count; i++) {
struct media_entity *resizer =
&rkisp1->resizer_devs[i].sd.entity;
struct media_entity *capture =
@@ -474,7 +475,8 @@ static const struct rkisp1_info px30_isp_info = {
.isrs = px30_isp_isrs,
.isr_size = ARRAY_SIZE(px30_isp_isrs),
.isp_ver = RKISP1_V12,
- .features = RKISP1_FEATURE_MIPI_CSI2,
+ .features = RKISP1_FEATURE_MIPI_CSI2
+ | RKISP1_FEATURE_SELF_PATH,
};
static const char * const rk3399_isp_clks[] = {
@@ -493,7 +495,8 @@ static const struct rkisp1_info rk3399_isp_info = {
.isrs = rk3399_isp_isrs,
.isr_size = ARRAY_SIZE(rk3399_isp_isrs),
.isp_ver = RKISP1_V10,
- .features = RKISP1_FEATURE_MIPI_CSI2,
+ .features = RKISP1_FEATURE_MIPI_CSI2
+ | RKISP1_FEATURE_SELF_PATH,
};
static const struct of_device_id rkisp1_of_match[] = {
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
index 28ecc7347d54..12e735a8970f 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
@@ -637,6 +637,7 @@ static int rkisp1_rsz_s_stream(struct v4l2_subdev *sd, int enable)
struct rkisp1_device *rkisp1 = rsz->rkisp1;
struct rkisp1_capture *other = &rkisp1->capture_devs[rsz->id ^ 1];
enum rkisp1_shadow_regs_when when = RKISP1_SHADOW_REGS_SYNC;
+ bool has_self_path = rkisp1_has_feature(rkisp1, SELF_PATH);
struct v4l2_subdev_state *sd_state;
if (!enable) {
@@ -645,7 +646,7 @@ static int rkisp1_rsz_s_stream(struct v4l2_subdev *sd, int enable)
return 0;
}
- if (other->is_streaming)
+ if (has_self_path && other->is_streaming)
when = RKISP1_SHADOW_REGS_ASYNC;
sd_state = v4l2_subdev_lock_and_get_active_state(sd);
@@ -732,10 +733,11 @@ static int rkisp1_rsz_register(struct rkisp1_resizer *rsz)
int rkisp1_resizer_devs_register(struct rkisp1_device *rkisp1)
{
+ unsigned int dev_count = rkisp1_path_count(rkisp1);
unsigned int i;
int ret;
- for (i = 0; i < ARRAY_SIZE(rkisp1->resizer_devs); i++) {
+ for (i = 0; i < dev_count; i++) {
struct rkisp1_resizer *rsz = &rkisp1->resizer_devs[i];
rsz->rkisp1 = rkisp1;
--
2.39.2
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v4 04/11] media: rkisp1: Support devices lacking dual crop
2023-11-29 9:27 [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Paul Elder
` (2 preceding siblings ...)
2023-11-29 9:27 ` [PATCH v4 03/11] media: rkisp1: Support devices lacking self path Paul Elder
@ 2023-11-29 9:27 ` Paul Elder
2023-11-29 9:27 ` [PATCH v4 05/11] media: rkisp1: Fix RSZ_CTRL bits for i.MX8MP Paul Elder
` (8 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Paul Elder @ 2023-11-29 9:27 UTC (permalink / raw)
To: linux-media, linux-rockchip, devicetree
Cc: kieran.bingham, tomi.valkeinen, umang.jain, aford173, Paul Elder,
Laurent Pinchart, Dafna Hirschfeld, Mauro Carvalho Chehab,
Heiko Stuebner, moderated list:ARM/Rockchip SoC support,
open list
Some versions of the ISP supported by the rkisp1 driver, such as the ISP
in the i.MX8MP, lack the dual crop registers and don't support cropping
at the resizer input. They instead rely on cropping in the Image
Stabilization module, at the output of the ISP, to modify the resizer
input size and implement digital zoom.
Support those ISP versions by addind a dual crop feature flag, and
mapping the resizer input crop rectangle to either the resizer dual crop
module or the image stabilization module.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
drivers/media/platform/rockchip/rkisp1/rkisp1-common.h | 2 ++
drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 6 ++++--
drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c | 6 ++++--
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
index e54cf14b72b1..20b6134f235a 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
@@ -104,6 +104,7 @@ enum rkisp1_isp_pad {
* @RKISP1_FEATURE_MIPI_CSI2: The ISP has an internal MIPI CSI-2 receiver
* @RKISP1_FEATURE_MAIN_STRIDE: The ISP supports configurable stride on the main path
* @RKISP1_FEATURE_SELF_PATH: The ISP has a self path
+ * @RKISP1_FEATURE_DUAL_CROP: The ISP has the dual crop block at the resizer input
*
* The ISP features are stored in a bitmask in &rkisp1_info.features and allow
* the driver to implement support for features present in some ISP versions
@@ -113,6 +114,7 @@ enum rkisp1_feature {
RKISP1_FEATURE_MIPI_CSI2 = BIT(0),
RKISP1_FEATURE_MAIN_STRIDE = BIT(1),
RKISP1_FEATURE_SELF_PATH = BIT(2),
+ RKISP1_FEATURE_DUAL_CROP = BIT(3),
};
#define rkisp1_has_feature(rkisp1, feature) \
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
index 7f5e2c6d1d73..a789a87ec644 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
@@ -476,7 +476,8 @@ static const struct rkisp1_info px30_isp_info = {
.isr_size = ARRAY_SIZE(px30_isp_isrs),
.isp_ver = RKISP1_V12,
.features = RKISP1_FEATURE_MIPI_CSI2
- | RKISP1_FEATURE_SELF_PATH,
+ | RKISP1_FEATURE_SELF_PATH
+ | RKISP1_FEATURE_DUAL_CROP,
};
static const char * const rk3399_isp_clks[] = {
@@ -496,7 +497,8 @@ static const struct rkisp1_info rk3399_isp_info = {
.isr_size = ARRAY_SIZE(rk3399_isp_isrs),
.isp_ver = RKISP1_V10,
.features = RKISP1_FEATURE_MIPI_CSI2
- | RKISP1_FEATURE_SELF_PATH,
+ | RKISP1_FEATURE_SELF_PATH
+ | RKISP1_FEATURE_DUAL_CROP,
};
static const struct of_device_id rkisp1_of_match[] = {
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
index 12e735a8970f..c1aaeed58acc 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
@@ -641,7 +641,8 @@ static int rkisp1_rsz_s_stream(struct v4l2_subdev *sd, int enable)
struct v4l2_subdev_state *sd_state;
if (!enable) {
- rkisp1_dcrop_disable(rsz, RKISP1_SHADOW_REGS_ASYNC);
+ if (rkisp1_has_feature(rkisp1, DUAL_CROP))
+ rkisp1_dcrop_disable(rsz, RKISP1_SHADOW_REGS_ASYNC);
rkisp1_rsz_disable(rsz, RKISP1_SHADOW_REGS_ASYNC);
return 0;
}
@@ -652,7 +653,8 @@ static int rkisp1_rsz_s_stream(struct v4l2_subdev *sd, int enable)
sd_state = v4l2_subdev_lock_and_get_active_state(sd);
rkisp1_rsz_config(rsz, sd_state, when);
- rkisp1_dcrop_config(rsz, sd_state);
+ if (rkisp1_has_feature(rkisp1, DUAL_CROP))
+ rkisp1_dcrop_config(rsz, sd_state);
v4l2_subdev_unlock_state(sd_state);
--
2.39.2
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v4 05/11] media: rkisp1: Fix RSZ_CTRL bits for i.MX8MP
2023-11-29 9:27 [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Paul Elder
` (3 preceding siblings ...)
2023-11-29 9:27 ` [PATCH v4 04/11] media: rkisp1: Support devices lacking dual crop Paul Elder
@ 2023-11-29 9:27 ` Paul Elder
2023-12-18 15:31 ` Tomi Valkeinen
2023-11-29 9:27 ` [PATCH v4 06/11] dt-bindings: media: rkisp1: Add i.MX8MP ISP to compatible Paul Elder
` (7 subsequent siblings)
12 siblings, 1 reply; 21+ messages in thread
From: Paul Elder @ 2023-11-29 9:27 UTC (permalink / raw)
To: linux-media, linux-rockchip, devicetree
Cc: kieran.bingham, tomi.valkeinen, umang.jain, aford173, Paul Elder,
Laurent Pinchart, Dafna Hirschfeld, Mauro Carvalho Chehab,
Heiko Stuebner, moderated list:ARM/Rockchip SoC support,
open list
The ISP8000Nano, found in the i.MX8MP, has a different architecture to
crop at the resizer input. Instead of the "dual crop" block between the
ISP and the resizers found in the RK3399, cropping has been moved to the
input of the resizer blocks. As a result, the resizer CFG_UPD and
CFG_UPD_AUTO bits have been moved to make space for a new CROP_ENABLE
bit.
Fix the resizer shadow update accordingly, using the DUAL_CROP feature
to infer whether or not the resizer implements cropping. Support for
resizer cropping itself will be added in a subsequent commit.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes since v3:
- Condition on RKISP1_FEATURE_DUAL_CROP feature
- Update commit message
Changes since v2:
- Condition on RKISP1_FEATURE_RSZ_CROP feature
- Rename bits
- Use the rkisp1_has_feature() macro
.../media/platform/rockchip/rkisp1/rkisp1-regs.h | 5 +++++
.../platform/rockchip/rkisp1/rkisp1-resizer.c | 15 +++++++++++----
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
index 3b19c8411360..95646b45f28b 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
@@ -168,6 +168,11 @@
#define RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO BIT(9)
#define RKISP1_CIF_RSZ_SCALER_FACTOR BIT(16)
+/* For resizer instances that support cropping */
+#define RKISP1_CIF_RSZ_CTRL_CROP_ENABLE BIT(8)
+#define RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD BIT(9)
+#define RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD_AUTO BIT(10)
+
/* MI_IMSC - MI_MIS - MI_RIS - MI_ICR - MI_ISR */
#define RKISP1_CIF_MI_FRAME(stream) BIT((stream)->id)
#define RKISP1_CIF_MI_MBLK_LINE BIT(2)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
index c1aaeed58acc..6d6ebc53c6e5 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
@@ -178,10 +178,17 @@ static void rkisp1_rsz_update_shadow(struct rkisp1_resizer *rsz,
{
u32 ctrl_cfg = rkisp1_rsz_read(rsz, RKISP1_CIF_RSZ_CTRL);
- if (when == RKISP1_SHADOW_REGS_ASYNC)
- ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO;
- else
- ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD;
+ if (when == RKISP1_SHADOW_REGS_ASYNC) {
+ if (rkisp1_has_feature(rsz->rkisp1, DUAL_CROP))
+ ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO;
+ else
+ ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD_AUTO;
+ } else {
+ if (rkisp1_has_feature(rsz->rkisp1, DUAL_CROP))
+ ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD;
+ else
+ ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD;
+ }
rkisp1_rsz_write(rsz, RKISP1_CIF_RSZ_CTRL, ctrl_cfg);
}
--
2.39.2
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v4 05/11] media: rkisp1: Fix RSZ_CTRL bits for i.MX8MP
2023-11-29 9:27 ` [PATCH v4 05/11] media: rkisp1: Fix RSZ_CTRL bits for i.MX8MP Paul Elder
@ 2023-12-18 15:31 ` Tomi Valkeinen
2023-12-18 15:48 ` Laurent Pinchart
0 siblings, 1 reply; 21+ messages in thread
From: Tomi Valkeinen @ 2023-12-18 15:31 UTC (permalink / raw)
To: Paul Elder, linux-media, linux-rockchip, devicetree
Cc: kieran.bingham, umang.jain, aford173, Laurent Pinchart,
Dafna Hirschfeld, Mauro Carvalho Chehab, Heiko Stuebner,
moderated list:ARM/Rockchip SoC support, open list
Hi Paul,
On 29/11/2023 11:27, Paul Elder wrote:
> The ISP8000Nano, found in the i.MX8MP, has a different architecture to
> crop at the resizer input. Instead of the "dual crop" block between the
> ISP and the resizers found in the RK3399, cropping has been moved to the
> input of the resizer blocks. As a result, the resizer CFG_UPD and
> CFG_UPD_AUTO bits have been moved to make space for a new CROP_ENABLE
> bit.
>
> Fix the resizer shadow update accordingly, using the DUAL_CROP feature
> to infer whether or not the resizer implements cropping. Support for
> resizer cropping itself will be added in a subsequent commit.
>
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
I don't think this one is correct.
The above is perhaps true for ISP8000, but ISP8000Nano does not have
CROP_ENABLE bit, and the CFG_UPD and CFG_UPD_AUTO are at the same
locations as on RK3399.
I don't have documentation to prove this, but experimentation shows that
this is the case.
Tomi
> ---
> Changes since v3:
>
> - Condition on RKISP1_FEATURE_DUAL_CROP feature
> - Update commit message
>
> Changes since v2:
>
> - Condition on RKISP1_FEATURE_RSZ_CROP feature
> - Rename bits
> - Use the rkisp1_has_feature() macro
>
> .../media/platform/rockchip/rkisp1/rkisp1-regs.h | 5 +++++
> .../platform/rockchip/rkisp1/rkisp1-resizer.c | 15 +++++++++++----
> 2 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
> index 3b19c8411360..95646b45f28b 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
> @@ -168,6 +168,11 @@
> #define RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO BIT(9)
> #define RKISP1_CIF_RSZ_SCALER_FACTOR BIT(16)
>
> +/* For resizer instances that support cropping */
> +#define RKISP1_CIF_RSZ_CTRL_CROP_ENABLE BIT(8)
> +#define RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD BIT(9)
> +#define RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD_AUTO BIT(10)
> +
> /* MI_IMSC - MI_MIS - MI_RIS - MI_ICR - MI_ISR */
> #define RKISP1_CIF_MI_FRAME(stream) BIT((stream)->id)
> #define RKISP1_CIF_MI_MBLK_LINE BIT(2)
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
> index c1aaeed58acc..6d6ebc53c6e5 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
> @@ -178,10 +178,17 @@ static void rkisp1_rsz_update_shadow(struct rkisp1_resizer *rsz,
> {
> u32 ctrl_cfg = rkisp1_rsz_read(rsz, RKISP1_CIF_RSZ_CTRL);
>
> - if (when == RKISP1_SHADOW_REGS_ASYNC)
> - ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO;
> - else
> - ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD;
> + if (when == RKISP1_SHADOW_REGS_ASYNC) {
> + if (rkisp1_has_feature(rsz->rkisp1, DUAL_CROP))
> + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO;
> + else
> + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD_AUTO;
> + } else {
> + if (rkisp1_has_feature(rsz->rkisp1, DUAL_CROP))
> + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD;
> + else
> + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD;
> + }
>
> rkisp1_rsz_write(rsz, RKISP1_CIF_RSZ_CTRL, ctrl_cfg);
> }
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH v4 05/11] media: rkisp1: Fix RSZ_CTRL bits for i.MX8MP
2023-12-18 15:31 ` Tomi Valkeinen
@ 2023-12-18 15:48 ` Laurent Pinchart
0 siblings, 0 replies; 21+ messages in thread
From: Laurent Pinchart @ 2023-12-18 15:48 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Paul Elder, linux-media, linux-rockchip, devicetree,
kieran.bingham, umang.jain, aford173, Dafna Hirschfeld,
Mauro Carvalho Chehab, Heiko Stuebner,
moderated list:ARM/Rockchip SoC support, open list
On Mon, Dec 18, 2023 at 05:31:18PM +0200, Tomi Valkeinen wrote:
> Hi Paul,
>
> On 29/11/2023 11:27, Paul Elder wrote:
> > The ISP8000Nano, found in the i.MX8MP, has a different architecture to
> > crop at the resizer input. Instead of the "dual crop" block between the
> > ISP and the resizers found in the RK3399, cropping has been moved to the
> > input of the resizer blocks. As a result, the resizer CFG_UPD and
> > CFG_UPD_AUTO bits have been moved to make space for a new CROP_ENABLE
> > bit.
> >
> > Fix the resizer shadow update accordingly, using the DUAL_CROP feature
> > to infer whether or not the resizer implements cropping. Support for
> > resizer cropping itself will be added in a subsequent commit.
> >
> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> I don't think this one is correct.
>
> The above is perhaps true for ISP8000, but ISP8000Nano does not have
> CROP_ENABLE bit, and the CFG_UPD and CFG_UPD_AUTO are at the same
> locations as on RK3399.
>
> I don't have documentation to prove this, but experimentation shows that
> this is the case.
I agree with you. The missing CROP_ENABLE bit matches the missing
resizer input crop capability in the i.MX8MP. I don't know if that's
specific to the i.MX8MP, specific to the ISP8000Nano, or common to all
ISP8000 versions when the instance is synthesized with a single path
(which may be what ISP8000Nano is).
> > ---
> > Changes since v3:
> >
> > - Condition on RKISP1_FEATURE_DUAL_CROP feature
> > - Update commit message
> >
> > Changes since v2:
> >
> > - Condition on RKISP1_FEATURE_RSZ_CROP feature
> > - Rename bits
> > - Use the rkisp1_has_feature() macro
> >
> > .../media/platform/rockchip/rkisp1/rkisp1-regs.h | 5 +++++
> > .../platform/rockchip/rkisp1/rkisp1-resizer.c | 15 +++++++++++----
> > 2 files changed, 16 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
> > index 3b19c8411360..95646b45f28b 100644
> > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
> > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
> > @@ -168,6 +168,11 @@
> > #define RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO BIT(9)
> > #define RKISP1_CIF_RSZ_SCALER_FACTOR BIT(16)
> >
> > +/* For resizer instances that support cropping */
> > +#define RKISP1_CIF_RSZ_CTRL_CROP_ENABLE BIT(8)
> > +#define RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD BIT(9)
> > +#define RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD_AUTO BIT(10)
> > +
> > /* MI_IMSC - MI_MIS - MI_RIS - MI_ICR - MI_ISR */
> > #define RKISP1_CIF_MI_FRAME(stream) BIT((stream)->id)
> > #define RKISP1_CIF_MI_MBLK_LINE BIT(2)
> > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
> > index c1aaeed58acc..6d6ebc53c6e5 100644
> > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
> > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
> > @@ -178,10 +178,17 @@ static void rkisp1_rsz_update_shadow(struct rkisp1_resizer *rsz,
> > {
> > u32 ctrl_cfg = rkisp1_rsz_read(rsz, RKISP1_CIF_RSZ_CTRL);
> >
> > - if (when == RKISP1_SHADOW_REGS_ASYNC)
> > - ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO;
> > - else
> > - ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD;
> > + if (when == RKISP1_SHADOW_REGS_ASYNC) {
> > + if (rkisp1_has_feature(rsz->rkisp1, DUAL_CROP))
> > + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD_AUTO;
> > + else
> > + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD_AUTO;
> > + } else {
> > + if (rkisp1_has_feature(rsz->rkisp1, DUAL_CROP))
> > + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CFG_UPD;
> > + else
> > + ctrl_cfg |= RKISP1_CIF_RSZ_CTRL_CROP_CFG_UPD;
> > + }
> >
> > rkisp1_rsz_write(rsz, RKISP1_CIF_RSZ_CTRL, ctrl_cfg);
> > }
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v4 06/11] dt-bindings: media: rkisp1: Add i.MX8MP ISP to compatible
2023-11-29 9:27 [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Paul Elder
` (4 preceding siblings ...)
2023-11-29 9:27 ` [PATCH v4 05/11] media: rkisp1: Fix RSZ_CTRL bits for i.MX8MP Paul Elder
@ 2023-11-29 9:27 ` Paul Elder
2023-11-29 9:27 ` [PATCH v4 07/11] media: rkisp1: Add match data for i.MX8MP ISP Paul Elder
` (6 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Paul Elder @ 2023-11-29 9:27 UTC (permalink / raw)
To: linux-media, linux-rockchip, devicetree
Cc: kieran.bingham, tomi.valkeinen, umang.jain, aford173, Paul Elder,
Laurent Pinchart, Rob Herring, Dafna Hirschfeld,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Heiko Stuebner, Helen Koike,
moderated list:ARM/Rockchip SoC support, open list
The i.MX8MP ISP is compatbile with the rkisp1 driver. Add it to the list
of compatible strings. While at it, expand on the description of the
clocks to make it clear which clock in the i.MX8MP ISP they map to,
based on the names from the datasheet (which are confusing).
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
Changes since v1:
- Add fsl,blk-ctrl property
- Make iommus, phys and phy-names conditional on compatible
.../bindings/media/rockchip-isp1.yaml | 37 ++++++++++++++++---
1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/media/rockchip-isp1.yaml b/Documentation/devicetree/bindings/media/rockchip-isp1.yaml
index e466dff8286d..b9c812b81389 100644
--- a/Documentation/devicetree/bindings/media/rockchip-isp1.yaml
+++ b/Documentation/devicetree/bindings/media/rockchip-isp1.yaml
@@ -16,6 +16,7 @@ description: |
properties:
compatible:
enum:
+ - fsl,imx8mp-isp
- rockchip,px30-cif-isp
- rockchip,rk3399-cif-isp
@@ -36,9 +37,9 @@ properties:
minItems: 3
items:
# isp0 and isp1
- - description: ISP clock
- - description: ISP AXI clock
- - description: ISP AHB clock
+ - description: ISP clock (for imx8mp, clk)
+ - description: ISP AXI clock (for imx8mp, m_hclk)
+ - description: ISP AHB clock (for imx8mp, hclk)
# only for isp1
- description: ISP Pixel clock
@@ -52,6 +53,13 @@ properties:
# only for isp1
- const: pclk
+ fsl,blk-ctrl:
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+ maxItems: 1
+ description:
+ A phandle to the media block control for the ISP, followed by a cell
+ containing the index of the gasket.
+
iommus:
maxItems: 1
@@ -112,9 +120,6 @@ required:
- interrupts
- clocks
- clock-names
- - iommus
- - phys
- - phy-names
- power-domains
- ports
@@ -142,6 +147,26 @@ allOf:
required:
- interrupt-names
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: fsl,imx8mp-isp
+ then:
+ properties:
+ iommus: false
+ phys: false
+ phy-names: false
+ required:
+ - fsl,blk-ctrl
+ else:
+ properties:
+ fsl,blk-ctrl: false
+ required:
+ - iommus
+ - phys
+ - phy-names
+
additionalProperties: false
examples:
--
2.39.2
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v4 07/11] media: rkisp1: Add match data for i.MX8MP ISP
2023-11-29 9:27 [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Paul Elder
` (5 preceding siblings ...)
2023-11-29 9:27 ` [PATCH v4 06/11] dt-bindings: media: rkisp1: Add i.MX8MP ISP to compatible Paul Elder
@ 2023-11-29 9:27 ` Paul Elder
2023-11-29 9:27 ` [PATCH v4 08/11] media: rkisp1: Configure gasket on i.MX8MP Paul Elder
` (5 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Paul Elder @ 2023-11-29 9:27 UTC (permalink / raw)
To: linux-media, linux-rockchip, devicetree
Cc: kieran.bingham, tomi.valkeinen, umang.jain, aford173, Paul Elder,
Rob Herring, Dafna Hirschfeld, Laurent Pinchart,
Mauro Carvalho Chehab, Heiko Stuebner,
moderated list:ARM/Rockchip SoC support, open list
Add match data to the rkisp1 driver to match the i.MX8MP ISP.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
.../platform/rockchip/rkisp1/rkisp1-dev.c | 23 +++++++++++++++++++
include/uapi/linux/rkisp1-config.h | 2 ++
2 files changed, 25 insertions(+)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
index a789a87ec644..621d5de2cbd8 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
@@ -501,6 +501,25 @@ static const struct rkisp1_info rk3399_isp_info = {
| RKISP1_FEATURE_DUAL_CROP,
};
+static const char * const imx8mp_isp_clks[] = {
+ "isp",
+ "hclk",
+ "aclk",
+};
+
+static const struct rkisp1_isr_data imx8mp_isp_isrs[] = {
+ { NULL, rkisp1_isr },
+};
+
+static const struct rkisp1_info imx8mp_isp_info = {
+ .clks = imx8mp_isp_clks,
+ .clk_size = ARRAY_SIZE(imx8mp_isp_clks),
+ .isrs = imx8mp_isp_isrs,
+ .isr_size = ARRAY_SIZE(imx8mp_isp_isrs),
+ .isp_ver = IMX8MP_V10,
+ .features = RKISP1_FEATURE_MAIN_STRIDE,
+};
+
static const struct of_device_id rkisp1_of_match[] = {
{
.compatible = "rockchip,px30-cif-isp",
@@ -510,6 +529,10 @@ static const struct of_device_id rkisp1_of_match[] = {
.compatible = "rockchip,rk3399-cif-isp",
.data = &rk3399_isp_info,
},
+ {
+ .compatible = "fsl,imx8mp-isp",
+ .data = &imx8mp_isp_info,
+ },
{},
};
MODULE_DEVICE_TABLE(of, rkisp1_of_match);
diff --git a/include/uapi/linux/rkisp1-config.h b/include/uapi/linux/rkisp1-config.h
index 730673ecc63d..f602442c2018 100644
--- a/include/uapi/linux/rkisp1-config.h
+++ b/include/uapi/linux/rkisp1-config.h
@@ -179,12 +179,14 @@
* @RKISP1_V11: declared in the original vendor code, but not used
* @RKISP1_V12: used at least in rk3326 and px30
* @RKISP1_V13: used at least in rk1808
+ * @IMX8MP_V10: used in at least imx8mp
*/
enum rkisp1_cif_isp_version {
RKISP1_V10 = 10,
RKISP1_V11,
RKISP1_V12,
RKISP1_V13,
+ IMX8MP_V10,
};
enum rkisp1_cif_isp_histogram_mode {
--
2.39.2
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v4 08/11] media: rkisp1: Configure gasket on i.MX8MP
2023-11-29 9:27 [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Paul Elder
` (6 preceding siblings ...)
2023-11-29 9:27 ` [PATCH v4 07/11] media: rkisp1: Add match data for i.MX8MP ISP Paul Elder
@ 2023-11-29 9:27 ` Paul Elder
2023-11-29 9:27 ` [PATCH v4 09/11] media: rkisp1: Shift DMA buffer addresses " Paul Elder
` (4 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Paul Elder @ 2023-11-29 9:27 UTC (permalink / raw)
To: linux-media, linux-rockchip, devicetree
Cc: kieran.bingham, tomi.valkeinen, umang.jain, aford173,
Laurent Pinchart, Paul Elder, Dafna Hirschfeld,
Mauro Carvalho Chehab, Heiko Stuebner,
moderated list:ARM/Rockchip SoC support, open list
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
The i.MX8MP has a gasket between the CSI-2 receiver and the ISP.
Configure and enable it when starting the ISP, and disable it when
stopping.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
.../platform/rockchip/rkisp1/rkisp1-common.h | 5 +
.../platform/rockchip/rkisp1/rkisp1-dev.c | 16 +++
.../platform/rockchip/rkisp1/rkisp1-isp.c | 131 +++++++++++++++++-
3 files changed, 149 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
index 20b6134f235a..859f194714b9 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
@@ -24,6 +24,7 @@
#include "rkisp1-regs.h"
struct dentry;
+struct regmap;
/*
* flags on the 'direction' field in struct rkisp1_mbus_info' that indicate
@@ -437,6 +438,8 @@ struct rkisp1_debug {
* @dev: a pointer to the struct device
* @clk_size: number of clocks
* @clks: array of clocks
+ * @gasket: the gasket - i.MX8MP only
+ * @gasket_id: the gasket ID (0 or 1) - i.MX8MP only
* @v4l2_dev: v4l2_device variable
* @media_dev: media_device variable
* @notifier: a notifier to register on the v4l2-async API to be notified on the sensor
@@ -457,6 +460,8 @@ struct rkisp1_device {
struct device *dev;
unsigned int clk_size;
struct clk_bulk_data clks[RKISP1_MAX_BUS_CLK];
+ struct regmap *gasket;
+ unsigned int gasket_id;
struct v4l2_device v4l2_dev;
struct media_device media_dev;
struct v4l2_async_notifier notifier;
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
index 621d5de2cbd8..cd539e4b03b5 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
@@ -10,6 +10,7 @@
#include <linux/clk.h>
#include <linux/interrupt.h>
+#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_graph.h>
@@ -585,6 +586,21 @@ static int rkisp1_probe(struct platform_device *pdev)
return ret;
rkisp1->clk_size = info->clk_size;
+ if (info->isp_ver == IMX8MP_V10) {
+ unsigned int id;
+
+ rkisp1->gasket = syscon_regmap_lookup_by_phandle_args(dev->of_node,
+ "fsl,blk-ctrl",
+ 1, &id);
+ if (IS_ERR(rkisp1->gasket)) {
+ ret = PTR_ERR(rkisp1->gasket);
+ dev_err(dev, "failed to get gasket: %d\n", ret);
+ return ret;
+ }
+
+ rkisp1->gasket_id = id;
+ }
+
pm_runtime_enable(&pdev->dev);
ret = pm_runtime_resume_and_get(&pdev->dev);
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
index 06cdb4edf19c..f70b6209c2de 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
@@ -10,6 +10,7 @@
#include <linux/iopoll.h>
#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
#include <linux/videodev2.h>
#include <linux/vmalloc.h>
@@ -53,6 +54,115 @@
* +---------------------------------------------------------+
*/
+/* -----------------------------------------------------------------------------
+ * Media block control (i.MX8MP only)
+ */
+
+#define ISP_DEWARP_CONTROL 0x0138
+
+#define ISP_DEWARP_CONTROL_MIPI_CSI2_HS_POLARITY BIT(22)
+#define ISP_DEWARP_CONTROL_MIPI_CSI2_VS_SEL_RISING (0 << 20)
+#define ISP_DEWARP_CONTROL_MIPI_CSI2_VS_SEL_NEGATIVE (1 << 20)
+#define ISP_DEWARP_CONTROL_MIPI_CSI2_VS_SEL_POSITIVE (2 << 20)
+#define ISP_DEWARP_CONTROL_MIPI_CSI2_VS_SEL_FALLING (3 << 20)
+#define ISP_DEWARP_CONTROL_MIPI_CSI2_VS_SEL_MASK GENMASK(21, 20)
+#define ISP_DEWARP_CONTROL_MIPI_ISP2_LEFT_JUST_MODE BIT(19)
+#define ISP_DEWARP_CONTROL_MIPI_ISP2_DATA_TYPE(dt) ((dt) << 13)
+#define ISP_DEWARP_CONTROL_MIPI_ISP2_DATA_TYPE_MASK GENMASK(18, 13)
+
+#define ISP_DEWARP_CONTROL_MIPI_CSI1_HS_POLARITY BIT(12)
+#define ISP_DEWARP_CONTROL_MIPI_CSI1_VS_SEL_RISING (0 << 10)
+#define ISP_DEWARP_CONTROL_MIPI_CSI1_VS_SEL_NEGATIVE (1 << 10)
+#define ISP_DEWARP_CONTROL_MIPI_CSI1_VS_SEL_POSITIVE (2 << 10)
+#define ISP_DEWARP_CONTROL_MIPI_CSI1_VS_SEL_FALLING (3 << 10)
+#define ISP_DEWARP_CONTROL_MIPI_CSI1_VS_SEL_MASK GENMASK(11, 10)
+#define ISP_DEWARP_CONTROL_MIPI_ISP1_LEFT_JUST_MODE BIT(9)
+#define ISP_DEWARP_CONTROL_MIPI_ISP1_DATA_TYPE(dt) ((dt) << 3)
+#define ISP_DEWARP_CONTROL_MIPI_ISP1_DATA_TYPE_MASK GENMASK(8, 3)
+
+#define ISP_DEWARP_CONTROL_GPR_ISP_1_DISABLE BIT(1)
+#define ISP_DEWARP_CONTROL_GPR_ISP_0_DISABLE BIT(0)
+
+static int rkisp1_gasket_enable(struct rkisp1_device *rkisp1,
+ struct media_pad *source)
+{
+ struct v4l2_subdev *source_sd;
+ struct v4l2_mbus_frame_desc fd;
+ unsigned int dt;
+ u32 mask;
+ u32 val;
+ int ret;
+
+ /*
+ * Configure and enable the gasket with the CSI-2 data type. Set the
+ * vsync polarity as active high, as that is what the ISP is configured
+ * to expect in ISP_ACQ_PROP. Enable left justification, as the i.MX8MP
+ * ISP has a 16-bit wide input and expects data to be left-aligned.
+ */
+
+ source_sd = media_entity_to_v4l2_subdev(source->entity);
+ ret = v4l2_subdev_call(source_sd, pad, get_frame_desc,
+ source->index, &fd);
+ if (ret) {
+ dev_err(rkisp1->dev,
+ "failed to get frame descriptor from '%s':%u: %d\n",
+ source_sd->name, 0, ret);
+ return ret;
+ }
+
+ if (fd.num_entries != 1) {
+ dev_err(rkisp1->dev, "invalid frame descriptor for '%s':%u\n",
+ source_sd->name, 0);
+ return -EINVAL;
+ }
+
+ dt = fd.entry[0].bus.csi2.dt;
+
+ if (rkisp1->gasket_id == 0) {
+ mask = ISP_DEWARP_CONTROL_MIPI_CSI1_HS_POLARITY
+ | ISP_DEWARP_CONTROL_MIPI_CSI1_VS_SEL_MASK
+ | ISP_DEWARP_CONTROL_MIPI_ISP1_LEFT_JUST_MODE
+ | ISP_DEWARP_CONTROL_MIPI_ISP1_DATA_TYPE_MASK
+ | ISP_DEWARP_CONTROL_GPR_ISP_0_DISABLE;
+ val = ISP_DEWARP_CONTROL_MIPI_CSI1_VS_SEL_POSITIVE
+ | ISP_DEWARP_CONTROL_MIPI_ISP1_LEFT_JUST_MODE
+ | ISP_DEWARP_CONTROL_MIPI_ISP1_DATA_TYPE(dt);
+ } else {
+ mask = ISP_DEWARP_CONTROL_MIPI_CSI2_HS_POLARITY
+ | ISP_DEWARP_CONTROL_MIPI_CSI2_VS_SEL_MASK
+ | ISP_DEWARP_CONTROL_MIPI_ISP2_LEFT_JUST_MODE
+ | ISP_DEWARP_CONTROL_MIPI_ISP2_DATA_TYPE_MASK
+ | ISP_DEWARP_CONTROL_GPR_ISP_1_DISABLE;
+ val = ISP_DEWARP_CONTROL_MIPI_CSI2_VS_SEL_POSITIVE
+ | ISP_DEWARP_CONTROL_MIPI_ISP2_LEFT_JUST_MODE
+ | ISP_DEWARP_CONTROL_MIPI_ISP2_DATA_TYPE(dt);
+ }
+
+ regmap_update_bits(rkisp1->gasket, ISP_DEWARP_CONTROL, mask, val);
+
+ return 0;
+}
+
+static void rkisp1_gasket_disable(struct rkisp1_device *rkisp1)
+{
+ u32 mask;
+ u32 val;
+
+ if (rkisp1->gasket_id == 1) {
+ mask = ISP_DEWARP_CONTROL_MIPI_ISP2_LEFT_JUST_MODE
+ | ISP_DEWARP_CONTROL_MIPI_ISP2_DATA_TYPE_MASK
+ | ISP_DEWARP_CONTROL_GPR_ISP_1_DISABLE;
+ val = ISP_DEWARP_CONTROL_GPR_ISP_1_DISABLE;
+ } else {
+ mask = ISP_DEWARP_CONTROL_MIPI_ISP1_LEFT_JUST_MODE
+ | ISP_DEWARP_CONTROL_MIPI_ISP1_DATA_TYPE_MASK
+ | ISP_DEWARP_CONTROL_GPR_ISP_0_DISABLE;
+ val = ISP_DEWARP_CONTROL_GPR_ISP_0_DISABLE;
+ }
+
+ regmap_update_bits(rkisp1->gasket, ISP_DEWARP_CONTROL, mask, val);
+}
+
/* ----------------------------------------------------------------------------
* Camera Interface registers configurations
*/
@@ -279,6 +389,9 @@ static void rkisp1_isp_stop(struct rkisp1_isp *isp)
RKISP1_CIF_VI_IRCL_MIPI_SW_RST |
RKISP1_CIF_VI_IRCL_ISP_SW_RST);
rkisp1_write(rkisp1, RKISP1_CIF_VI_IRCL, 0x0);
+
+ if (rkisp1->info->isp_ver == IMX8MP_V10)
+ rkisp1_gasket_disable(rkisp1);
}
static void rkisp1_config_clk(struct rkisp1_isp *isp)
@@ -303,16 +416,24 @@ static void rkisp1_config_clk(struct rkisp1_isp *isp)
}
}
-static void rkisp1_isp_start(struct rkisp1_isp *isp,
- struct v4l2_subdev_state *sd_state)
+static int rkisp1_isp_start(struct rkisp1_isp *isp,
+ struct v4l2_subdev_state *sd_state,
+ struct media_pad *source)
{
struct rkisp1_device *rkisp1 = isp->rkisp1;
const struct v4l2_mbus_framefmt *src_fmt;
const struct rkisp1_mbus_info *src_info;
u32 val;
+ int ret;
rkisp1_config_clk(isp);
+ if (rkisp1->info->isp_ver == IMX8MP_V10) {
+ ret = rkisp1_gasket_enable(rkisp1, source);
+ if (ret)
+ return ret;
+ }
+
/* Activate ISP */
val = rkisp1_read(rkisp1, RKISP1_CIF_ISP_CTRL);
val |= RKISP1_CIF_ISP_CTRL_ISP_CFG_UPD |
@@ -326,6 +447,8 @@ static void rkisp1_isp_start(struct rkisp1_isp *isp,
if (src_info->pixel_enc != V4L2_PIXEL_ENC_BAYER)
rkisp1_params_post_configure(&rkisp1->params);
+
+ return 0;
}
/* ----------------------------------------------------------------------------
@@ -836,7 +959,9 @@ static int rkisp1_isp_s_stream(struct v4l2_subdev *sd, int enable)
if (ret)
goto out_unlock;
- rkisp1_isp_start(isp, sd_state);
+ ret = rkisp1_isp_start(isp, sd_state, source_pad);
+ if (ret)
+ goto out_unlock;
ret = v4l2_subdev_call(rkisp1->source, video, s_stream, true);
if (ret) {
--
2.39.2
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v4 09/11] media: rkisp1: Shift DMA buffer addresses on i.MX8MP
2023-11-29 9:27 [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Paul Elder
` (7 preceding siblings ...)
2023-11-29 9:27 ` [PATCH v4 08/11] media: rkisp1: Configure gasket on i.MX8MP Paul Elder
@ 2023-11-29 9:27 ` Paul Elder
2023-11-29 9:27 ` [PATCH v4 10/11] media: rkisp1: Add YC swap capability Paul Elder
` (3 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Paul Elder @ 2023-11-29 9:27 UTC (permalink / raw)
To: linux-media, linux-rockchip, devicetree
Cc: kieran.bingham, tomi.valkeinen, umang.jain, aford173, Paul Elder,
Laurent Pinchart, Dafna Hirschfeld, Mauro Carvalho Chehab,
Heiko Stuebner, moderated list:ARM/Rockchip SoC support,
open list
On the ISP that is integrated in the i.MX8MP, DMA addresses have been
extended to 34 bits, with the 32 MSBs stored in the DMA address
registers and the 2 LSBs set to 0. Shift the buffer addresses right by 2
on that platform.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes since v2:
- Document the RKISP1_FEATURE_DMA_34BIT bit
- Use the rkisp1_has_feature() macro
.../platform/rockchip/rkisp1/rkisp1-capture.c | 18 ++++++++++--------
.../platform/rockchip/rkisp1/rkisp1-common.h | 2 ++
.../platform/rockchip/rkisp1/rkisp1-dev.c | 3 ++-
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
index ab369baf8d1b..c307e07d897a 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
@@ -648,6 +648,8 @@ static void rkisp1_dummy_buf_destroy(struct rkisp1_capture *cap)
static void rkisp1_set_next_buf(struct rkisp1_capture *cap)
{
+ u8 shift = rkisp1_has_feature(cap->rkisp1, DMA_34BIT) ? 2 : 0;
+
cap->buf.curr = cap->buf.next;
cap->buf.next = NULL;
@@ -660,7 +662,7 @@ static void rkisp1_set_next_buf(struct rkisp1_capture *cap)
buff_addr = cap->buf.next->buff_addr;
rkisp1_write(cap->rkisp1, cap->config->mi.y_base_ad_init,
- buff_addr[RKISP1_PLANE_Y]);
+ buff_addr[RKISP1_PLANE_Y] >> shift);
/*
* In order to support grey format we capture
* YUV422 planar format from the camera and
@@ -669,17 +671,17 @@ static void rkisp1_set_next_buf(struct rkisp1_capture *cap)
if (cap->pix.cfg->fourcc == V4L2_PIX_FMT_GREY) {
rkisp1_write(cap->rkisp1,
cap->config->mi.cb_base_ad_init,
- cap->buf.dummy.dma_addr);
+ cap->buf.dummy.dma_addr >> shift);
rkisp1_write(cap->rkisp1,
cap->config->mi.cr_base_ad_init,
- cap->buf.dummy.dma_addr);
+ cap->buf.dummy.dma_addr >> shift);
} else {
rkisp1_write(cap->rkisp1,
cap->config->mi.cb_base_ad_init,
- buff_addr[RKISP1_PLANE_CB]);
+ buff_addr[RKISP1_PLANE_CB] >> shift);
rkisp1_write(cap->rkisp1,
cap->config->mi.cr_base_ad_init,
- buff_addr[RKISP1_PLANE_CR]);
+ buff_addr[RKISP1_PLANE_CR] >> shift);
}
} else {
/*
@@ -687,11 +689,11 @@ static void rkisp1_set_next_buf(struct rkisp1_capture *cap)
* throw data if there is no available buffer.
*/
rkisp1_write(cap->rkisp1, cap->config->mi.y_base_ad_init,
- cap->buf.dummy.dma_addr);
+ cap->buf.dummy.dma_addr >> shift);
rkisp1_write(cap->rkisp1, cap->config->mi.cb_base_ad_init,
- cap->buf.dummy.dma_addr);
+ cap->buf.dummy.dma_addr >> shift);
rkisp1_write(cap->rkisp1, cap->config->mi.cr_base_ad_init,
- cap->buf.dummy.dma_addr);
+ cap->buf.dummy.dma_addr >> shift);
}
/* Set plane offsets */
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
index 859f194714b9..2c8fb28924e4 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
@@ -106,6 +106,7 @@ enum rkisp1_isp_pad {
* @RKISP1_FEATURE_MAIN_STRIDE: The ISP supports configurable stride on the main path
* @RKISP1_FEATURE_SELF_PATH: The ISP has a self path
* @RKISP1_FEATURE_DUAL_CROP: The ISP has the dual crop block at the resizer input
+ * @RKISP1_FEATURE_DMA_34BIT: The ISP uses 34-bit DMA addresses
*
* The ISP features are stored in a bitmask in &rkisp1_info.features and allow
* the driver to implement support for features present in some ISP versions
@@ -116,6 +117,7 @@ enum rkisp1_feature {
RKISP1_FEATURE_MAIN_STRIDE = BIT(1),
RKISP1_FEATURE_SELF_PATH = BIT(2),
RKISP1_FEATURE_DUAL_CROP = BIT(3),
+ RKISP1_FEATURE_DMA_34BIT = BIT(4),
};
#define rkisp1_has_feature(rkisp1, feature) \
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
index cd539e4b03b5..8d2e5fee753d 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
@@ -518,7 +518,8 @@ static const struct rkisp1_info imx8mp_isp_info = {
.isrs = imx8mp_isp_isrs,
.isr_size = ARRAY_SIZE(imx8mp_isp_isrs),
.isp_ver = IMX8MP_V10,
- .features = RKISP1_FEATURE_MAIN_STRIDE,
+ .features = RKISP1_FEATURE_MAIN_STRIDE
+ | RKISP1_FEATURE_DMA_34BIT,
};
static const struct of_device_id rkisp1_of_match[] = {
--
2.39.2
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v4 10/11] media: rkisp1: Add YC swap capability
2023-11-29 9:27 [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Paul Elder
` (8 preceding siblings ...)
2023-11-29 9:27 ` [PATCH v4 09/11] media: rkisp1: Shift DMA buffer addresses " Paul Elder
@ 2023-11-29 9:27 ` Paul Elder
2023-11-29 9:27 ` [PATCH v4 11/11] media: rkisp1: Add UYVY as an output format Paul Elder
` (2 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Paul Elder @ 2023-11-29 9:27 UTC (permalink / raw)
To: linux-media, linux-rockchip, devicetree
Cc: kieran.bingham, tomi.valkeinen, umang.jain, aford173, Paul Elder,
Laurent Pinchart, Dafna Hirschfeld, Mauro Carvalho Chehab,
Heiko Stuebner, moderated list:ARM/Rockchip SoC support,
open list
The ISP version in the i.MX8MP has an MI_OUTPUT_ALIGN_FORMAT register
that the rk3399 does not have. This register allows swapping bytes,
which can be used to implement UYVY from YUYV.
Add a feature flag to signify the presence of this feature, and add it
to the i.MX8MP match data. Also add it as a flag to the format info in
the list of supported formats by the capture v4l2 devices, and update
enum_fmt and s_fmt to take it into account.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
.../platform/rockchip/rkisp1/rkisp1-capture.c | 26 ++++++++++++++-----
.../platform/rockchip/rkisp1/rkisp1-common.h | 2 ++
.../platform/rockchip/rkisp1/rkisp1-dev.c | 3 ++-
3 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
index c307e07d897a..a352893308b6 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
@@ -47,13 +47,15 @@ enum rkisp1_plane {
* @fourcc: pixel format
* @fmt_type: helper filed for pixel format
* @uv_swap: if cb cr swapped, for yuv
+ * @yc_swap: if y and cb/cr swapped, for yuv
* @write_format: defines how YCbCr self picture data is written to memory
* @output_format: defines sp output format
* @mbus: the mbus code on the src resizer pad that matches the pixel format
*/
struct rkisp1_capture_fmt_cfg {
u32 fourcc;
- u8 uv_swap;
+ u32 uv_swap : 1;
+ u32 yc_swap : 1;
u32 write_format;
u32 output_format;
u32 mbus;
@@ -1159,10 +1161,14 @@ rkisp1_fill_pixfmt(const struct rkisp1_capture *cap,
static const struct rkisp1_capture_fmt_cfg *
rkisp1_find_fmt_cfg(const struct rkisp1_capture *cap, const u32 pixelfmt)
{
+ bool yc_swap_support = rkisp1_has_feature(cap->rkisp1, MI_OUTPUT_ALIGN);
unsigned int i;
for (i = 0; i < cap->config->fmt_size; i++) {
- if (cap->config->fmts[i].fourcc == pixelfmt)
+ const struct rkisp1_capture_fmt_cfg *fmt = &cap->config->fmts[i];
+
+ if (fmt->fourcc == pixelfmt &&
+ (!fmt->yc_swap || yc_swap_support))
return &cap->config->fmts[i];
}
return NULL;
@@ -1231,23 +1237,29 @@ static int rkisp1_enum_fmt_vid_cap_mplane(struct file *file, void *priv,
{
struct rkisp1_capture *cap = video_drvdata(file);
const struct rkisp1_capture_fmt_cfg *fmt = NULL;
+ bool yc_swap_support = rkisp1_has_feature(cap->rkisp1, MI_OUTPUT_ALIGN);
unsigned int i, n = 0;
- if (!f->mbus_code) {
- if (f->index >= cap->config->fmt_size)
- return -EINVAL;
+ if (f->index >= cap->config->fmt_size)
+ return -EINVAL;
+ if (!f->mbus_code && yc_swap_support) {
fmt = &cap->config->fmts[f->index];
f->pixelformat = fmt->fourcc;
return 0;
}
for (i = 0; i < cap->config->fmt_size; i++) {
- if (cap->config->fmts[i].mbus != f->mbus_code)
+ fmt = &cap->config->fmts[i];
+
+ if (f->mbus_code && fmt->mbus != f->mbus_code)
+ continue;
+
+ if (!yc_swap_support && fmt->yc_swap)
continue;
if (n++ == f->index) {
- f->pixelformat = cap->config->fmts[i].fourcc;
+ f->pixelformat = fmt->fourcc;
return 0;
}
}
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
index 2c8fb28924e4..fca3d55c50ad 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
@@ -107,6 +107,7 @@ enum rkisp1_isp_pad {
* @RKISP1_FEATURE_SELF_PATH: The ISP has a self path
* @RKISP1_FEATURE_DUAL_CROP: The ISP has the dual crop block at the resizer input
* @RKISP1_FEATURE_DMA_34BIT: The ISP uses 34-bit DMA addresses
+ * @RKISP1_FEATURE_MI_OUTPUT_ALIGN: The ISP has the MI_OUTPUT_ALIGN_FORMAT register
*
* The ISP features are stored in a bitmask in &rkisp1_info.features and allow
* the driver to implement support for features present in some ISP versions
@@ -118,6 +119,7 @@ enum rkisp1_feature {
RKISP1_FEATURE_SELF_PATH = BIT(2),
RKISP1_FEATURE_DUAL_CROP = BIT(3),
RKISP1_FEATURE_DMA_34BIT = BIT(4),
+ RKISP1_FEATURE_MI_OUTPUT_ALIGN = BIT(5),
};
#define rkisp1_has_feature(rkisp1, feature) \
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
index 8d2e5fee753d..2b9886fd0800 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
@@ -519,7 +519,8 @@ static const struct rkisp1_info imx8mp_isp_info = {
.isr_size = ARRAY_SIZE(imx8mp_isp_isrs),
.isp_ver = IMX8MP_V10,
.features = RKISP1_FEATURE_MAIN_STRIDE
- | RKISP1_FEATURE_DMA_34BIT,
+ | RKISP1_FEATURE_DMA_34BIT
+ | RKISP1_FEATURE_MI_OUTPUT_ALIGN,
};
static const struct of_device_id rkisp1_of_match[] = {
--
2.39.2
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v4 11/11] media: rkisp1: Add UYVY as an output format
2023-11-29 9:27 [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Paul Elder
` (9 preceding siblings ...)
2023-11-29 9:27 ` [PATCH v4 10/11] media: rkisp1: Add YC swap capability Paul Elder
@ 2023-11-29 9:27 ` Paul Elder
2023-12-03 21:32 ` Adam Ford
2023-11-29 10:58 ` [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Alexander Stein
2023-11-29 11:36 ` Adam Ford
12 siblings, 1 reply; 21+ messages in thread
From: Paul Elder @ 2023-11-29 9:27 UTC (permalink / raw)
To: linux-media, linux-rockchip, devicetree
Cc: kieran.bingham, tomi.valkeinen, umang.jain, aford173, Paul Elder,
Laurent Pinchart, Dafna Hirschfeld, Mauro Carvalho Chehab,
Heiko Stuebner, moderated list:ARM/Rockchip SoC support,
open list
Add support for UYVY as an output format. The uv_swap bit in the
MI_XTD_FORMAT_CTRL register that is used for the NV formats does not
work for packed YUV formats. Thus, UYVY support is implemented via
byte-swapping. This method clearly does not work for implementing
support for YVYU and VYUY.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
.../platform/rockchip/rkisp1/rkisp1-capture.c | 41 +++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
index a352893308b6..b50b044d22af 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
@@ -97,6 +97,12 @@ static const struct rkisp1_capture_fmt_cfg rkisp1_mp_fmts[] = {
.uv_swap = 0,
.write_format = RKISP1_MI_CTRL_MP_WRITE_YUVINT,
.mbus = MEDIA_BUS_FMT_YUYV8_2X8,
+ }, {
+ .fourcc = V4L2_PIX_FMT_UYVY,
+ .uv_swap = 0,
+ .yc_swap = 1,
+ .write_format = RKISP1_MI_CTRL_MP_WRITE_YUVINT,
+ .mbus = MEDIA_BUS_FMT_YUYV8_2X8,
}, {
.fourcc = V4L2_PIX_FMT_YUV422P,
.uv_swap = 0,
@@ -231,6 +237,13 @@ static const struct rkisp1_capture_fmt_cfg rkisp1_sp_fmts[] = {
.write_format = RKISP1_MI_CTRL_SP_WRITE_INT,
.output_format = RKISP1_MI_CTRL_SP_OUTPUT_YUV422,
.mbus = MEDIA_BUS_FMT_YUYV8_2X8,
+ }, {
+ .fourcc = V4L2_PIX_FMT_UYVY,
+ .uv_swap = 0,
+ .yc_swap = 1,
+ .write_format = RKISP1_MI_CTRL_SP_WRITE_INT,
+ .output_format = RKISP1_MI_CTRL_SP_OUTPUT_YUV422,
+ .mbus = MEDIA_BUS_FMT_YUYV8_2X8,
}, {
.fourcc = V4L2_PIX_FMT_YUV422P,
.uv_swap = 0,
@@ -464,6 +477,20 @@ static void rkisp1_mp_config(struct rkisp1_capture *cap)
rkisp1_write(rkisp1, RKISP1_CIF_MI_XTD_FORMAT_CTRL, reg);
}
+ /*
+ * U/V swapping with the MI_XTD_FORMAT_CTRL register only works for
+ * NV12/NV21 and NV16/NV61, so instead use byte swap to support UYVY.
+ * YVYU and VYUY cannot be supported with this method.
+ */
+ if (rkisp1->info->features & RKISP1_FEATURE_MI_OUTPUT_ALIGN) {
+ reg = rkisp1_read(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_FORMAT);
+ if (cap->pix.cfg->yc_swap)
+ reg |= RKISP1_CIF_OUTPUT_ALIGN_FORMAT_MP_BYTE_SWAP_BYTES;
+ else
+ reg &= ~RKISP1_CIF_OUTPUT_ALIGN_FORMAT_MP_BYTE_SWAP_BYTES;
+ rkisp1_write(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_FORMAT, reg);
+ }
+
rkisp1_mi_config_ctrl(cap);
reg = rkisp1_read(rkisp1, RKISP1_CIF_MI_CTRL);
@@ -507,6 +534,20 @@ static void rkisp1_sp_config(struct rkisp1_capture *cap)
rkisp1_write(rkisp1, RKISP1_CIF_MI_XTD_FORMAT_CTRL, reg);
}
+ /*
+ * U/V swapping with the MI_XTD_FORMAT_CTRL register only works for
+ * NV12/NV21 and NV16/NV61, so instead use byte swap to support UYVY.
+ * YVYU and VYUY cannot be supported with this method.
+ */
+ if (rkisp1->info->features & RKISP1_FEATURE_MI_OUTPUT_ALIGN) {
+ reg = rkisp1_read(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_FORMAT);
+ if (cap->pix.cfg->yc_swap)
+ reg |= RKISP1_CIF_OUTPUT_ALIGN_FORMAT_SP_BYTE_SWAP_BYTES;
+ else
+ reg &= ~RKISP1_CIF_OUTPUT_ALIGN_FORMAT_SP_BYTE_SWAP_BYTES;
+ rkisp1_write(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_FORMAT, reg);
+ }
+
rkisp1_mi_config_ctrl(cap);
mi_ctrl = rkisp1_read(rkisp1, RKISP1_CIF_MI_CTRL);
--
2.39.2
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v4 11/11] media: rkisp1: Add UYVY as an output format
2023-11-29 9:27 ` [PATCH v4 11/11] media: rkisp1: Add UYVY as an output format Paul Elder
@ 2023-12-03 21:32 ` Adam Ford
2023-12-03 22:15 ` Adam Ford
0 siblings, 1 reply; 21+ messages in thread
From: Adam Ford @ 2023-12-03 21:32 UTC (permalink / raw)
To: Paul Elder
Cc: linux-media, linux-rockchip, devicetree, kieran.bingham,
tomi.valkeinen, umang.jain, Laurent Pinchart, Dafna Hirschfeld,
Mauro Carvalho Chehab, Heiko Stuebner,
moderated list:ARM/Rockchip SoC support, open list, Fabio Estevam
On Wed, Nov 29, 2023 at 3:29 AM Paul Elder <paul.elder@ideasonboard.com> wrote:
>
> Add support for UYVY as an output format. The uv_swap bit in the
> MI_XTD_FORMAT_CTRL register that is used for the NV formats does not
> work for packed YUV formats. Thus, UYVY support is implemented via
> byte-swapping. This method clearly does not work for implementing
> support for YVYU and VYUY.
>
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> .../platform/rockchip/rkisp1/rkisp1-capture.c | 41 +++++++++++++++++++
> 1 file changed, 41 insertions(+)
Paul,
I tested this patch series from one of the older submissions and I was
able to get it working, but I could not get the video to capture to
work no matter what resolution or video format I tried. Each time, I
get the same error message: rkisp1 32e10000.isp: start pipeline
failed -32
Do you have an example of how you configured the pipeline and how you
invoked the video capture?
thanks
adam
>
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> index a352893308b6..b50b044d22af 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> @@ -97,6 +97,12 @@ static const struct rkisp1_capture_fmt_cfg rkisp1_mp_fmts[] = {
> .uv_swap = 0,
> .write_format = RKISP1_MI_CTRL_MP_WRITE_YUVINT,
> .mbus = MEDIA_BUS_FMT_YUYV8_2X8,
> + }, {
> + .fourcc = V4L2_PIX_FMT_UYVY,
> + .uv_swap = 0,
> + .yc_swap = 1,
> + .write_format = RKISP1_MI_CTRL_MP_WRITE_YUVINT,
> + .mbus = MEDIA_BUS_FMT_YUYV8_2X8,
> }, {
> .fourcc = V4L2_PIX_FMT_YUV422P,
> .uv_swap = 0,
> @@ -231,6 +237,13 @@ static const struct rkisp1_capture_fmt_cfg rkisp1_sp_fmts[] = {
> .write_format = RKISP1_MI_CTRL_SP_WRITE_INT,
> .output_format = RKISP1_MI_CTRL_SP_OUTPUT_YUV422,
> .mbus = MEDIA_BUS_FMT_YUYV8_2X8,
> + }, {
> + .fourcc = V4L2_PIX_FMT_UYVY,
> + .uv_swap = 0,
> + .yc_swap = 1,
> + .write_format = RKISP1_MI_CTRL_SP_WRITE_INT,
> + .output_format = RKISP1_MI_CTRL_SP_OUTPUT_YUV422,
> + .mbus = MEDIA_BUS_FMT_YUYV8_2X8,
> }, {
> .fourcc = V4L2_PIX_FMT_YUV422P,
> .uv_swap = 0,
> @@ -464,6 +477,20 @@ static void rkisp1_mp_config(struct rkisp1_capture *cap)
> rkisp1_write(rkisp1, RKISP1_CIF_MI_XTD_FORMAT_CTRL, reg);
> }
>
> + /*
> + * U/V swapping with the MI_XTD_FORMAT_CTRL register only works for
> + * NV12/NV21 and NV16/NV61, so instead use byte swap to support UYVY.
> + * YVYU and VYUY cannot be supported with this method.
> + */
> + if (rkisp1->info->features & RKISP1_FEATURE_MI_OUTPUT_ALIGN) {
> + reg = rkisp1_read(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_FORMAT);
> + if (cap->pix.cfg->yc_swap)
> + reg |= RKISP1_CIF_OUTPUT_ALIGN_FORMAT_MP_BYTE_SWAP_BYTES;
> + else
> + reg &= ~RKISP1_CIF_OUTPUT_ALIGN_FORMAT_MP_BYTE_SWAP_BYTES;
> + rkisp1_write(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_FORMAT, reg);
> + }
> +
> rkisp1_mi_config_ctrl(cap);
>
> reg = rkisp1_read(rkisp1, RKISP1_CIF_MI_CTRL);
> @@ -507,6 +534,20 @@ static void rkisp1_sp_config(struct rkisp1_capture *cap)
> rkisp1_write(rkisp1, RKISP1_CIF_MI_XTD_FORMAT_CTRL, reg);
> }
>
> + /*
> + * U/V swapping with the MI_XTD_FORMAT_CTRL register only works for
> + * NV12/NV21 and NV16/NV61, so instead use byte swap to support UYVY.
> + * YVYU and VYUY cannot be supported with this method.
> + */
> + if (rkisp1->info->features & RKISP1_FEATURE_MI_OUTPUT_ALIGN) {
> + reg = rkisp1_read(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_FORMAT);
> + if (cap->pix.cfg->yc_swap)
> + reg |= RKISP1_CIF_OUTPUT_ALIGN_FORMAT_SP_BYTE_SWAP_BYTES;
> + else
> + reg &= ~RKISP1_CIF_OUTPUT_ALIGN_FORMAT_SP_BYTE_SWAP_BYTES;
> + rkisp1_write(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_FORMAT, reg);
> + }
> +
> rkisp1_mi_config_ctrl(cap);
>
> mi_ctrl = rkisp1_read(rkisp1, RKISP1_CIF_MI_CTRL);
> --
> 2.39.2
>
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH v4 11/11] media: rkisp1: Add UYVY as an output format
2023-12-03 21:32 ` Adam Ford
@ 2023-12-03 22:15 ` Adam Ford
0 siblings, 0 replies; 21+ messages in thread
From: Adam Ford @ 2023-12-03 22:15 UTC (permalink / raw)
To: Paul Elder
Cc: linux-media, linux-rockchip, devicetree, kieran.bingham,
tomi.valkeinen, umang.jain, Laurent Pinchart, Dafna Hirschfeld,
Mauro Carvalho Chehab, Heiko Stuebner,
moderated list:ARM/Rockchip SoC support, open list, Fabio Estevam
On Sun, Dec 3, 2023 at 3:32 PM Adam Ford <aford173@gmail.com> wrote:
>
> On Wed, Nov 29, 2023 at 3:29 AM Paul Elder <paul.elder@ideasonboard.com> wrote:
> >
> > Add support for UYVY as an output format. The uv_swap bit in the
> > MI_XTD_FORMAT_CTRL register that is used for the NV formats does not
> > work for packed YUV formats. Thus, UYVY support is implemented via
> > byte-swapping. This method clearly does not work for implementing
> > support for YVYU and VYUY.
> >
> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> > .../platform/rockchip/rkisp1/rkisp1-capture.c | 41 +++++++++++++++++++
> > 1 file changed, 41 insertions(+)
>
>
> Paul,
>
> I tested this patch series from one of the older submissions and I was
> able to get it working, but I could not get the video to capture to
> work no matter what resolution or video format I tried. Each time, I
> get the same error message: rkisp1 32e10000.isp: start pipeline
> failed -32
>
> Do you have an example of how you configured the pipeline and how you
> invoked the video capture?
I have it working now but I had to apply the patch [1] provided by
Tomi in order for it to work properly
Can you send another revision with his patch included in the series?
With that, you can add
Tested-by: Adam Ford <aford173@gmail.com> #imx8mp-beacon-kit
Thank you.
adam
[1] - https://gitlab.com/ideasonboard/nxp/linux/-/commit/d6477fe673b1c0d05d12ae21d8db9a03b07e7fea
>
> thanks
>
> adam
>
> >
> > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> > index a352893308b6..b50b044d22af 100644
> > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> > @@ -97,6 +97,12 @@ static const struct rkisp1_capture_fmt_cfg rkisp1_mp_fmts[] = {
> > .uv_swap = 0,
> > .write_format = RKISP1_MI_CTRL_MP_WRITE_YUVINT,
> > .mbus = MEDIA_BUS_FMT_YUYV8_2X8,
> > + }, {
> > + .fourcc = V4L2_PIX_FMT_UYVY,
> > + .uv_swap = 0,
> > + .yc_swap = 1,
> > + .write_format = RKISP1_MI_CTRL_MP_WRITE_YUVINT,
> > + .mbus = MEDIA_BUS_FMT_YUYV8_2X8,
> > }, {
> > .fourcc = V4L2_PIX_FMT_YUV422P,
> > .uv_swap = 0,
> > @@ -231,6 +237,13 @@ static const struct rkisp1_capture_fmt_cfg rkisp1_sp_fmts[] = {
> > .write_format = RKISP1_MI_CTRL_SP_WRITE_INT,
> > .output_format = RKISP1_MI_CTRL_SP_OUTPUT_YUV422,
> > .mbus = MEDIA_BUS_FMT_YUYV8_2X8,
> > + }, {
> > + .fourcc = V4L2_PIX_FMT_UYVY,
> > + .uv_swap = 0,
> > + .yc_swap = 1,
> > + .write_format = RKISP1_MI_CTRL_SP_WRITE_INT,
> > + .output_format = RKISP1_MI_CTRL_SP_OUTPUT_YUV422,
> > + .mbus = MEDIA_BUS_FMT_YUYV8_2X8,
> > }, {
> > .fourcc = V4L2_PIX_FMT_YUV422P,
> > .uv_swap = 0,
> > @@ -464,6 +477,20 @@ static void rkisp1_mp_config(struct rkisp1_capture *cap)
> > rkisp1_write(rkisp1, RKISP1_CIF_MI_XTD_FORMAT_CTRL, reg);
> > }
> >
> > + /*
> > + * U/V swapping with the MI_XTD_FORMAT_CTRL register only works for
> > + * NV12/NV21 and NV16/NV61, so instead use byte swap to support UYVY.
> > + * YVYU and VYUY cannot be supported with this method.
> > + */
> > + if (rkisp1->info->features & RKISP1_FEATURE_MI_OUTPUT_ALIGN) {
> > + reg = rkisp1_read(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_FORMAT);
> > + if (cap->pix.cfg->yc_swap)
> > + reg |= RKISP1_CIF_OUTPUT_ALIGN_FORMAT_MP_BYTE_SWAP_BYTES;
> > + else
> > + reg &= ~RKISP1_CIF_OUTPUT_ALIGN_FORMAT_MP_BYTE_SWAP_BYTES;
> > + rkisp1_write(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_FORMAT, reg);
> > + }
> > +
> > rkisp1_mi_config_ctrl(cap);
> >
> > reg = rkisp1_read(rkisp1, RKISP1_CIF_MI_CTRL);
> > @@ -507,6 +534,20 @@ static void rkisp1_sp_config(struct rkisp1_capture *cap)
> > rkisp1_write(rkisp1, RKISP1_CIF_MI_XTD_FORMAT_CTRL, reg);
> > }
> >
> > + /*
> > + * U/V swapping with the MI_XTD_FORMAT_CTRL register only works for
> > + * NV12/NV21 and NV16/NV61, so instead use byte swap to support UYVY.
> > + * YVYU and VYUY cannot be supported with this method.
> > + */
> > + if (rkisp1->info->features & RKISP1_FEATURE_MI_OUTPUT_ALIGN) {
> > + reg = rkisp1_read(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_FORMAT);
> > + if (cap->pix.cfg->yc_swap)
> > + reg |= RKISP1_CIF_OUTPUT_ALIGN_FORMAT_SP_BYTE_SWAP_BYTES;
> > + else
> > + reg &= ~RKISP1_CIF_OUTPUT_ALIGN_FORMAT_SP_BYTE_SWAP_BYTES;
> > + rkisp1_write(rkisp1, RKISP1_CIF_MI_OUTPUT_ALIGN_FORMAT, reg);
> > + }
> > +
> > rkisp1_mi_config_ctrl(cap);
> >
> > mi_ctrl = rkisp1_read(rkisp1, RKISP1_CIF_MI_CTRL);
> > --
> > 2.39.2
> >
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP
2023-11-29 9:27 [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Paul Elder
` (10 preceding siblings ...)
2023-11-29 9:27 ` [PATCH v4 11/11] media: rkisp1: Add UYVY as an output format Paul Elder
@ 2023-11-29 10:58 ` Alexander Stein
2023-12-11 7:49 ` Alexander Stein
2023-11-29 11:36 ` Adam Ford
12 siblings, 1 reply; 21+ messages in thread
From: Alexander Stein @ 2023-11-29 10:58 UTC (permalink / raw)
To: linux-media, linux-rockchip, devicetree, Paul Elder
Cc: kieran.bingham, tomi.valkeinen, umang.jain, aford173, Paul Elder
Hi Paul,
thanks for the series.
Am Mittwoch, 29. November 2023, 10:27:48 CET schrieb Paul Elder:
> This series extends the rkisp1 driver to support the ISP found in the
> NXP i.MX8MP SoC.
>
> The ISP IP cores in the Rockchip RK3399 (known as the "Rockchip ISP1")
> and in the NXP i.MX8MP have the same origin, and have slightly diverged
> over time as they are now independently developed (afaik) by Rockchip
> and VeriSilicon. The latter is marketed under the name "ISP8000Nano",
> and is close enough to the RK3399 ISP that it can easily be supported by
> the same driver.
>
> The last two patches add support for UYVY output format, which can be
> implemented on the ISP version in the i.MX8MP but not in the one in the
> RK3399.
>
> This version of the series specifically has been tested on a Polyhex
> Debix model A with an imx219 (Raspberry Pi cam v2).
I've created a setup on TQMa8MPxL/MBa8MPxL and a Sony IMX327 sensor for a
while now. I can stream 1080p video at 45 FPS to HDMI output without any
special configuration.
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> Laurent Pinchart (2):
> media: rkisp1: Add and use rkisp1_has_feature() macro
> media: rkisp1: Configure gasket on i.MX8MP
>
> Paul Elder (9):
> media: rkisp1: Support setting memory stride for main path
> media: rkisp1: Support devices lacking self path
> media: rkisp1: Support devices lacking dual crop
> media: rkisp1: Fix RSZ_CTRL bits for i.MX8MP
> dt-bindings: media: rkisp1: Add i.MX8MP ISP to compatible
> media: rkisp1: Add match data for i.MX8MP ISP
> media: rkisp1: Shift DMA buffer addresses on i.MX8MP
> media: rkisp1: Add YC swap capability
> media: rkisp1: Add UYVY as an output format
>
> .../bindings/media/rockchip-isp1.yaml | 37 ++++-
> .../platform/rockchip/rkisp1/rkisp1-capture.c | 128 ++++++++++++-----
> .../platform/rockchip/rkisp1/rkisp1-common.h | 35 ++++-
> .../platform/rockchip/rkisp1/rkisp1-dev.c | 66 +++++++--
> .../platform/rockchip/rkisp1/rkisp1-isp.c | 131 +++++++++++++++++-
> .../platform/rockchip/rkisp1/rkisp1-regs.h | 32 +++++
> .../platform/rockchip/rkisp1/rkisp1-resizer.c | 27 ++--
> include/uapi/linux/rkisp1-config.h | 2 +
> 8 files changed, 398 insertions(+), 60 deletions(-)
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP
2023-11-29 10:58 ` [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Alexander Stein
@ 2023-12-11 7:49 ` Alexander Stein
0 siblings, 0 replies; 21+ messages in thread
From: Alexander Stein @ 2023-12-11 7:49 UTC (permalink / raw)
To: linux-media, linux-rockchip, devicetree, Paul Elder
Cc: kieran.bingham, tomi.valkeinen, umang.jain, aford173, Paul Elder
Hi,
Am Mittwoch, 29. November 2023, 11:58:39 CET schrieb Alexander Stein:
> Hi Paul,
>
> thanks for the series.
>
> Am Mittwoch, 29. November 2023, 10:27:48 CET schrieb Paul Elder:
> > This series extends the rkisp1 driver to support the ISP found in the
> > NXP i.MX8MP SoC.
> >
> > The ISP IP cores in the Rockchip RK3399 (known as the "Rockchip ISP1")
> > and in the NXP i.MX8MP have the same origin, and have slightly diverged
> > over time as they are now independently developed (afaik) by Rockchip
> > and VeriSilicon. The latter is marketed under the name "ISP8000Nano",
> > and is close enough to the RK3399 ISP that it can easily be supported by
> > the same driver.
> >
> > The last two patches add support for UYVY output format, which can be
> > implemented on the ISP version in the i.MX8MP but not in the one in the
> > RK3399.
> >
> > This version of the series specifically has been tested on a Polyhex
> > Debix model A with an imx219 (Raspberry Pi cam v2).
>
> I've created a setup on TQMa8MPxL/MBa8MPxL and a Sony IMX327 sensor for a
> while now. I can stream 1080p video at 45 FPS to HDMI output without any
> special configuration.
Just for the records. the 45 FPS limit is introduced by (HDMI) output. Using a
gstreamer testsink "outpu", I can run at 60 FPS.
Best regards,
Alexander
> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
>
> > Laurent Pinchart (2):
> > media: rkisp1: Add and use rkisp1_has_feature() macro
> > media: rkisp1: Configure gasket on i.MX8MP
> >
> > Paul Elder (9):
> > media: rkisp1: Support setting memory stride for main path
> > media: rkisp1: Support devices lacking self path
> > media: rkisp1: Support devices lacking dual crop
> > media: rkisp1: Fix RSZ_CTRL bits for i.MX8MP
> > dt-bindings: media: rkisp1: Add i.MX8MP ISP to compatible
> > media: rkisp1: Add match data for i.MX8MP ISP
> > media: rkisp1: Shift DMA buffer addresses on i.MX8MP
> > media: rkisp1: Add YC swap capability
> > media: rkisp1: Add UYVY as an output format
> >
> > .../bindings/media/rockchip-isp1.yaml | 37 ++++-
> > .../platform/rockchip/rkisp1/rkisp1-capture.c | 128 ++++++++++++-----
> > .../platform/rockchip/rkisp1/rkisp1-common.h | 35 ++++-
> > .../platform/rockchip/rkisp1/rkisp1-dev.c | 66 +++++++--
> > .../platform/rockchip/rkisp1/rkisp1-isp.c | 131 +++++++++++++++++-
> > .../platform/rockchip/rkisp1/rkisp1-regs.h | 32 +++++
> > .../platform/rockchip/rkisp1/rkisp1-resizer.c | 27 ++--
> > include/uapi/linux/rkisp1-config.h | 2 +
> > 8 files changed, 398 insertions(+), 60 deletions(-)
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP
2023-11-29 9:27 [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Paul Elder
` (11 preceding siblings ...)
2023-11-29 10:58 ` [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP Alexander Stein
@ 2023-11-29 11:36 ` Adam Ford
2023-11-30 9:45 ` Paul Elder
12 siblings, 1 reply; 21+ messages in thread
From: Adam Ford @ 2023-11-29 11:36 UTC (permalink / raw)
To: Paul Elder
Cc: linux-media, linux-rockchip, devicetree, kieran.bingham,
tomi.valkeinen, umang.jain
On Wed, Nov 29, 2023 at 3:28 AM Paul Elder <paul.elder@ideasonboard.com> wrote:
>
> This series extends the rkisp1 driver to support the ISP found in the
> NXP i.MX8MP SoC.
>
> The ISP IP cores in the Rockchip RK3399 (known as the "Rockchip ISP1")
> and in the NXP i.MX8MP have the same origin, and have slightly diverged
> over time as they are now independently developed (afaik) by Rockchip
> and VeriSilicon. The latter is marketed under the name "ISP8000Nano",
> and is close enough to the RK3399 ISP that it can easily be supported by
> the same driver.
>
> The last two patches add support for UYVY output format, which can be
> implemented on the ISP version in the i.MX8MP but not in the one in the
> RK3399.
>
> This version of the series specifically has been tested on a Polyhex
> Debix model A with an imx219 (Raspberry Pi cam v2).
I have tested previous versions with a imx219 camera running in 4-lane
mode with great success. Should I apply this series against
linux-next, or do I need to apply it against something in the media
tree to test? I hope to test it tonight or tomorrow.
adam
>
> Laurent Pinchart (2):
> media: rkisp1: Add and use rkisp1_has_feature() macro
> media: rkisp1: Configure gasket on i.MX8MP
>
> Paul Elder (9):
> media: rkisp1: Support setting memory stride for main path
> media: rkisp1: Support devices lacking self path
> media: rkisp1: Support devices lacking dual crop
> media: rkisp1: Fix RSZ_CTRL bits for i.MX8MP
> dt-bindings: media: rkisp1: Add i.MX8MP ISP to compatible
> media: rkisp1: Add match data for i.MX8MP ISP
> media: rkisp1: Shift DMA buffer addresses on i.MX8MP
> media: rkisp1: Add YC swap capability
> media: rkisp1: Add UYVY as an output format
>
> .../bindings/media/rockchip-isp1.yaml | 37 ++++-
> .../platform/rockchip/rkisp1/rkisp1-capture.c | 128 ++++++++++++-----
> .../platform/rockchip/rkisp1/rkisp1-common.h | 35 ++++-
> .../platform/rockchip/rkisp1/rkisp1-dev.c | 66 +++++++--
> .../platform/rockchip/rkisp1/rkisp1-isp.c | 131 +++++++++++++++++-
> .../platform/rockchip/rkisp1/rkisp1-regs.h | 32 +++++
> .../platform/rockchip/rkisp1/rkisp1-resizer.c | 27 ++--
> include/uapi/linux/rkisp1-config.h | 2 +
> 8 files changed, 398 insertions(+), 60 deletions(-)
>
> --
> 2.39.2
>
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP
2023-11-29 11:36 ` Adam Ford
@ 2023-11-30 9:45 ` Paul Elder
2023-12-09 23:59 ` Adam Ford
0 siblings, 1 reply; 21+ messages in thread
From: Paul Elder @ 2023-11-30 9:45 UTC (permalink / raw)
To: Adam Ford
Cc: linux-media, linux-rockchip, devicetree, kieran.bingham,
tomi.valkeinen, umang.jain
On Wed, Nov 29, 2023 at 05:36:25AM -0600, Adam Ford wrote:
> On Wed, Nov 29, 2023 at 3:28 AM Paul Elder <paul.elder@ideasonboard.com> wrote:
> >
> > This series extends the rkisp1 driver to support the ISP found in the
> > NXP i.MX8MP SoC.
> >
> > The ISP IP cores in the Rockchip RK3399 (known as the "Rockchip ISP1")
> > and in the NXP i.MX8MP have the same origin, and have slightly diverged
> > over time as they are now independently developed (afaik) by Rockchip
> > and VeriSilicon. The latter is marketed under the name "ISP8000Nano",
> > and is close enough to the RK3399 ISP that it can easily be supported by
> > the same driver.
> >
> > The last two patches add support for UYVY output format, which can be
> > implemented on the ISP version in the i.MX8MP but not in the one in the
> > RK3399.
> >
> > This version of the series specifically has been tested on a Polyhex
> > Debix model A with an imx219 (Raspberry Pi cam v2).
>
> I have tested previous versions with a imx219 camera running in 4-lane
> mode with great success. Should I apply this series against
> linux-next, or do I need to apply it against something in the media
> tree to test? I hope to test it tonight or tomorrow.
I have it applied on 6.7-rc1.
Thanks,
Paul
> >
> > Laurent Pinchart (2):
> > media: rkisp1: Add and use rkisp1_has_feature() macro
> > media: rkisp1: Configure gasket on i.MX8MP
> >
> > Paul Elder (9):
> > media: rkisp1: Support setting memory stride for main path
> > media: rkisp1: Support devices lacking self path
> > media: rkisp1: Support devices lacking dual crop
> > media: rkisp1: Fix RSZ_CTRL bits for i.MX8MP
> > dt-bindings: media: rkisp1: Add i.MX8MP ISP to compatible
> > media: rkisp1: Add match data for i.MX8MP ISP
> > media: rkisp1: Shift DMA buffer addresses on i.MX8MP
> > media: rkisp1: Add YC swap capability
> > media: rkisp1: Add UYVY as an output format
> >
> > .../bindings/media/rockchip-isp1.yaml | 37 ++++-
> > .../platform/rockchip/rkisp1/rkisp1-capture.c | 128 ++++++++++++-----
> > .../platform/rockchip/rkisp1/rkisp1-common.h | 35 ++++-
> > .../platform/rockchip/rkisp1/rkisp1-dev.c | 66 +++++++--
> > .../platform/rockchip/rkisp1/rkisp1-isp.c | 131 +++++++++++++++++-
> > .../platform/rockchip/rkisp1/rkisp1-regs.h | 32 +++++
> > .../platform/rockchip/rkisp1/rkisp1-resizer.c | 27 ++--
> > include/uapi/linux/rkisp1-config.h | 2 +
> > 8 files changed, 398 insertions(+), 60 deletions(-)
> >
> > --
> > 2.39.2
> >
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 00/11] media: rkisp1: Add support for i.MX8MP
2023-11-30 9:45 ` Paul Elder
@ 2023-12-09 23:59 ` Adam Ford
0 siblings, 0 replies; 21+ messages in thread
From: Adam Ford @ 2023-12-09 23:59 UTC (permalink / raw)
To: Paul Elder
Cc: linux-media, linux-rockchip, devicetree, kieran.bingham,
tomi.valkeinen, umang.jain
On Thu, Nov 30, 2023 at 3:45 AM Paul Elder <paul.elder@ideasonboard.com> wrote:
>
> On Wed, Nov 29, 2023 at 05:36:25AM -0600, Adam Ford wrote:
> > On Wed, Nov 29, 2023 at 3:28 AM Paul Elder <paul.elder@ideasonboard.com> wrote:
> > >
> > > This series extends the rkisp1 driver to support the ISP found in the
> > > NXP i.MX8MP SoC.
> > >
> > > The ISP IP cores in the Rockchip RK3399 (known as the "Rockchip ISP1")
> > > and in the NXP i.MX8MP have the same origin, and have slightly diverged
> > > over time as they are now independently developed (afaik) by Rockchip
> > > and VeriSilicon. The latter is marketed under the name "ISP8000Nano",
> > > and is close enough to the RK3399 ISP that it can easily be supported by
> > > the same driver.
> > >
> > > The last two patches add support for UYVY output format, which can be
> > > implemented on the ISP version in the i.MX8MP but not in the one in the
> > > RK3399.
> > >
> > > This version of the series specifically has been tested on a Polyhex
> > > Debix model A with an imx219 (Raspberry Pi cam v2).
> >
> > I have tested previous versions with a imx219 camera running in 4-lane
> > mode with great success. Should I apply this series against
> > linux-next, or do I need to apply it against something in the media
> > tree to test? I hope to test it tonight or tomorrow.
>
> I have it applied on 6.7-rc1.
>
For the series,
Tested-by: Adam Ford <aford173@gmail.com> #imx8mp-beacon
>
> Thanks,
>
> Paul
>
> > >
> > > Laurent Pinchart (2):
> > > media: rkisp1: Add and use rkisp1_has_feature() macro
> > > media: rkisp1: Configure gasket on i.MX8MP
> > >
> > > Paul Elder (9):
> > > media: rkisp1: Support setting memory stride for main path
> > > media: rkisp1: Support devices lacking self path
> > > media: rkisp1: Support devices lacking dual crop
> > > media: rkisp1: Fix RSZ_CTRL bits for i.MX8MP
> > > dt-bindings: media: rkisp1: Add i.MX8MP ISP to compatible
> > > media: rkisp1: Add match data for i.MX8MP ISP
> > > media: rkisp1: Shift DMA buffer addresses on i.MX8MP
> > > media: rkisp1: Add YC swap capability
> > > media: rkisp1: Add UYVY as an output format
> > >
> > > .../bindings/media/rockchip-isp1.yaml | 37 ++++-
> > > .../platform/rockchip/rkisp1/rkisp1-capture.c | 128 ++++++++++++-----
> > > .../platform/rockchip/rkisp1/rkisp1-common.h | 35 ++++-
> > > .../platform/rockchip/rkisp1/rkisp1-dev.c | 66 +++++++--
> > > .../platform/rockchip/rkisp1/rkisp1-isp.c | 131 +++++++++++++++++-
> > > .../platform/rockchip/rkisp1/rkisp1-regs.h | 32 +++++
> > > .../platform/rockchip/rkisp1/rkisp1-resizer.c | 27 ++--
> > > include/uapi/linux/rkisp1-config.h | 2 +
> > > 8 files changed, 398 insertions(+), 60 deletions(-)
> > >
> > > --
> > > 2.39.2
> > >
^ permalink raw reply [flat|nested] 21+ messages in thread