[git:media_stage/master] media: qcom: venus: fix incorrect return value

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: qcom: venus: fix incorrect return value
Author:  Hans Verkuil 
Date:Fri Oct 6 12:08:47 2023 +0200

'pd' can be NULL, and in that case it shouldn't be passed to
PTR_ERR. Fixes a smatch warning:

drivers/media/platform/qcom/venus/pm_helpers.c:873 vcodec_domains_get() warn: 
passing zero to 'PTR_ERR'

Signed-off-by: Hans Verkuil 
Reviewed-by: Bryan O'Donoghue 

 drivers/media/platform/qcom/venus/pm_helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

---

diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c 
b/drivers/media/platform/qcom/venus/pm_helpers.c
index 48c9084bb4db..a1b127caa90a 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -870,7 +870,7 @@ static int vcodec_domains_get(struct venus_core *core)
pd = dev_pm_domain_attach_by_name(dev,
  res->vcodec_pmdomains[i]);
if (IS_ERR_OR_NULL(pd))
-   return PTR_ERR(pd) ? : -ENODATA;
+   return pd ? PTR_ERR(pd) : -ENODATA;
core->pmdomains[i] = pd;
}
 

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: i2c: adp1653: don't reuse the same node pointer

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: i2c: adp1653: don't reuse the same node pointer
Author:  Hans Verkuil 
Date:Fri Oct 6 12:08:43 2023 +0200

The child device_node pointer was used for two different children.
This confused smatch, causing this warning:

drivers/media/i2c/adp1653.c:444 adp1653_of_init() warn: missing unwind goto?

Use two different pointers, one for each child node, and add separate
goto labels for each node as well. This also improves error logging
since it will now state for which node the property was missing.

Signed-off-by: Hans Verkuil 
Acked-by: Sakari Ailus 
[hverkuil: fix typo: childs -> children]

 drivers/media/i2c/adp1653.c | 28 +++-
 1 file changed, 15 insertions(+), 13 deletions(-)

---

diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c
index 98ca417b8004..5ace7b5804d4 100644
--- a/drivers/media/i2c/adp1653.c
+++ b/drivers/media/i2c/adp1653.c
@@ -411,43 +411,44 @@ static int adp1653_of_init(struct i2c_client *client,
   struct device_node *node)
 {
struct adp1653_platform_data *pd;
-   struct device_node *child;
+   struct device_node *node_indicator = NULL;
+   struct device_node *node_flash;
 
pd = devm_kzalloc(>dev, sizeof(*pd), GFP_KERNEL);
if (!pd)
return -ENOMEM;
flash->platform_data = pd;
 
-   child = of_get_child_by_name(node, "flash");
-   if (!child)
+   node_flash = of_get_child_by_name(node, "flash");
+   if (!node_flash)
return -EINVAL;
 
-   if (of_property_read_u32(child, "flash-timeout-us",
+   if (of_property_read_u32(node_flash, "flash-timeout-us",
 >max_flash_timeout))
goto err;
 
-   if (of_property_read_u32(child, "flash-max-microamp",
+   if (of_property_read_u32(node_flash, "flash-max-microamp",
 >max_flash_intensity))
goto err;
 
pd->max_flash_intensity /= 1000;
 
-   if (of_property_read_u32(child, "led-max-microamp",
+   if (of_property_read_u32(node_flash, "led-max-microamp",
 >max_torch_intensity))
goto err;
 
pd->max_torch_intensity /= 1000;
-   of_node_put(child);
 
-   child = of_get_child_by_name(node, "indicator");
-   if (!child)
-   return -EINVAL;
+   node_indicator = of_get_child_by_name(node, "indicator");
+   if (!node_indicator)
+   goto err;
 
-   if (of_property_read_u32(child, "led-max-microamp",
+   if (of_property_read_u32(node_indicator, "led-max-microamp",
 >max_indicator_intensity))
goto err;
 
-   of_node_put(child);
+   of_node_put(node_flash);
+   of_node_put(node_indicator);
 
pd->enable_gpio = devm_gpiod_get(>dev, "enable", GPIOD_OUT_LOW);
if (IS_ERR(pd->enable_gpio)) {
@@ -458,7 +459,8 @@ static int adp1653_of_init(struct i2c_client *client,
return 0;
 err:
dev_err(>dev, "Required property not found\n");
-   of_node_put(child);
+   of_node_put(node_flash);
+   of_node_put(node_indicator);
return -EINVAL;
 }
 

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: rkisp1: resizer: Use V4L2 subdev active state

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: rkisp1: resizer: Use V4L2 subdev active state
Author:  Laurent Pinchart 
Date:Thu Jan 26 03:10:01 2023 +0200

Use the V4L2 subdev active state API to store the active format and crop
rectangle. This simplifies the driver not only by dropping the state
stored in the rkisp1_resizer structure, but also by replacing the
ops_lock with the state lock.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Paul Elder 
Reviewed-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 .../media/platform/rockchip/rkisp1/rkisp1-common.h |   6 -
 .../platform/rockchip/rkisp1/rkisp1-resizer.c  | 184 -
 2 files changed, 66 insertions(+), 124 deletions(-)

---

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
index d30f0ecb1bfd..5a03e460e08d 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
@@ -390,10 +390,7 @@ struct rkisp1_params {
  * @id:   id of the resizer, one of RKISP1_SELFPATH, 
RKISP1_MAINPATH
  * @rkisp1:pointer to the rkisp1 device
  * @pads:  media pads
- * @pad_cfg:   configurations for the pads
  * @config:the set of registers to configure the resizer
- * @pixel_enc: pixel encoding of the resizer
- * @ops_lock:  a lock for the subdev ops
  */
 struct rkisp1_resizer {
struct v4l2_subdev sd;
@@ -401,10 +398,7 @@ struct rkisp1_resizer {
enum rkisp1_stream_id id;
struct rkisp1_device *rkisp1;
struct media_pad pads[RKISP1_RSZ_PAD_MAX];
-   struct v4l2_subdev_pad_config pad_cfg[RKISP1_RSZ_PAD_MAX];
const struct rkisp1_rsz_config *config;
-   enum v4l2_pixel_encoding pixel_enc;
-   struct mutex ops_lock; /* serialize the subdevice ops */
 };
 
 /*
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
index c15ae0218118..6845df38ef5f 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
@@ -117,34 +117,6 @@ static inline void rkisp1_rsz_write(struct rkisp1_resizer 
*rsz, u32 offset,
rkisp1_write(rsz->rkisp1, rsz->regs_base + offset, value);
 }
 
-static struct v4l2_mbus_framefmt *
-rkisp1_rsz_get_pad_fmt(struct rkisp1_resizer *rsz,
-  struct v4l2_subdev_state *sd_state,
-  unsigned int pad, u32 which)
-{
-   struct v4l2_subdev_state state = {
-   .pads = rsz->pad_cfg,
-   };
-   if (which == V4L2_SUBDEV_FORMAT_TRY)
-   return v4l2_subdev_get_try_format(>sd, sd_state, pad);
-   else
-   return v4l2_subdev_get_try_format(>sd, , pad);
-}
-
-static struct v4l2_rect *
-rkisp1_rsz_get_pad_crop(struct rkisp1_resizer *rsz,
-   struct v4l2_subdev_state *sd_state,
-   unsigned int pad, u32 which)
-{
-   struct v4l2_subdev_state state = {
-   .pads = rsz->pad_cfg,
-   };
-   if (which == V4L2_SUBDEV_FORMAT_TRY)
-   return v4l2_subdev_get_try_crop(>sd, sd_state, pad);
-   else
-   return v4l2_subdev_get_try_crop(>sd, , pad);
-}
-
 /* 
  * Dual crop hw configs
  */
@@ -165,17 +137,18 @@ static void rkisp1_dcrop_disable(struct rkisp1_resizer 
*rsz,
 }
 
 /* configure dual-crop unit */
-static void rkisp1_dcrop_config(struct rkisp1_resizer *rsz)
+static void rkisp1_dcrop_config(struct rkisp1_resizer *rsz,
+   struct v4l2_subdev_state *sd_state)
 {
struct rkisp1_device *rkisp1 = rsz->rkisp1;
struct v4l2_mbus_framefmt *sink_fmt;
struct v4l2_rect *sink_crop;
u32 dc_ctrl;
 
-   sink_crop = rkisp1_rsz_get_pad_crop(rsz, NULL, RKISP1_RSZ_PAD_SINK,
-   V4L2_SUBDEV_FORMAT_ACTIVE);
-   sink_fmt = rkisp1_rsz_get_pad_fmt(rsz, NULL, RKISP1_RSZ_PAD_SINK,
- V4L2_SUBDEV_FORMAT_ACTIVE);
+   sink_crop = v4l2_subdev_get_pad_crop(>sd, sd_state,
+RKISP1_RSZ_PAD_SINK);
+   sink_fmt = v4l2_subdev_get_pad_format(>sd, sd_state,
+ RKISP1_RSZ_PAD_SINK);
 
if (sink_crop->width == sink_fmt->width &&
sink_crop->height == sink_fmt->height &&
@@ -296,6 +269,7 @@ static void rkisp1_rsz_config_regs(struct rkisp1_resizer 
*rsz,
 }
 
 static void rkisp1_rsz_config(struct rkisp1_resizer *rsz,
+ struct v4l2_subdev_state *sd_state,
  enum rkisp1_shadow_regs_when when)
 {
const struct rkisp1_rsz_yuv_mbus_info *sink_yuv_info, *src_yuv_info;
@@ -303,20 +277,21 @@ static void 

[git:media_stage/master] media: rkisp1: Convert hex constants to lowercase

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: rkisp1: Convert hex constants to lowercase
Author:  Laurent Pinchart 
Date:Sat Sep 23 23:36:03 2023 +0300

Hex constants in the media subsystem are typically in lowercase. The
rkisp1 driver mostly follows that convention already, except in the
register definitions. Convert all hex constants to lowercase for
consistency.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 .../media/platform/rockchip/rkisp1/rkisp1-params.c |   2 +-
 .../media/platform/rockchip/rkisp1/rkisp1-regs.h   | 620 ++---
 2 files changed, 311 insertions(+), 311 deletions(-)

---

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
index 3482f7d707b7..8e3dc4966b94 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
@@ -812,7 +812,7 @@ static void rkisp1_hst_config_v10(struct rkisp1_params 
*params,
weight[2], 
weight[3]));
 
rkisp1_write(params->rkisp1, RKISP1_CIF_ISP_HIST_WEIGHT_44_V10,
-weight[0] & 0x1F);
+weight[0] & 0x1f);
 }
 
 static void rkisp1_hst_config_v12(struct rkisp1_params *params,
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
index 421cc73355db..350f452e676f 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
@@ -273,13 +273,13 @@
 #define RKISP1_CIF_C_PROC_YOUT_FULLBIT(1)
 #define RKISP1_CIF_C_PROC_YIN_FULL BIT(2)
 #define RKISP1_CIF_C_PROC_COUT_FULLBIT(3)
-#define RKISP1_CIF_C_PROC_CTRL_RESERVED0xFFFE
-#define RKISP1_CIF_C_PROC_CONTRAST_RESERVED0xFF00
-#define RKISP1_CIF_C_PROC_BRIGHTNESS_RESERVED  0xFF00
-#define RKISP1_CIF_C_PROC_HUE_RESERVED 0xFF00
-#define RKISP1_CIF_C_PROC_SATURATION_RESERVED  0xFF00
-#define RKISP1_CIF_C_PROC_MACC_RESERVED0xE000E000
-#define RKISP1_CIF_C_PROC_TONE_RESERVED0xF000
+#define RKISP1_CIF_C_PROC_CTRL_RESERVED0xfffe
+#define RKISP1_CIF_C_PROC_CONTRAST_RESERVED0xff00
+#define RKISP1_CIF_C_PROC_BRIGHTNESS_RESERVED  0xff00
+#define RKISP1_CIF_C_PROC_HUE_RESERVED 0xff00
+#define RKISP1_CIF_C_PROC_SATURATION_RESERVED  0xff00
+#define RKISP1_CIF_C_PROC_MACC_RESERVED0xe000e000
+#define RKISP1_CIF_C_PROC_TONE_RESERVED0xf000
 /* DUAL_CROP_CTRL */
 #define RKISP1_CIF_DUAL_CROP_MP_MODE_BYPASS(0 << 0)
 #define RKISP1_CIF_DUAL_CROP_MP_MODE_YUV   (1 << 0)
@@ -310,7 +310,7 @@
 #define RKISP1_CIF_IMG_EFF_CTRL_MODE_EMBOSS_SHIFT  4
 #define RKISP1_CIF_IMG_EFF_CTRL_MODE_SKETCH_SHIFT  5
 #define RKISP1_CIF_IMG_EFF_CTRL_MODE_SHARPEN_SHIFT 6
-#define RKISP1_CIF_IMG_EFF_CTRL_MODE_MASK  0xE
+#define RKISP1_CIF_IMG_EFF_CTRL_MODE_MASK  0xe
 
 /* IMG_EFF_COLOR_SEL */
 #define RKISP1_CIF_IMG_EFF_COLOR_RGB   0
@@ -324,7 +324,7 @@
 
 /* MIPI_CTRL */
 #define RKISP1_CIF_MIPI_CTRL_OUTPUT_ENABIT(0)
-#define RKISP1_CIF_MIPI_CTRL_SHUTDOWNLANES(a)  (((a) & 0xF) << 8)
+#define RKISP1_CIF_MIPI_CTRL_SHUTDOWNLANES(a)  (((a) & 0xf) << 8)
 #define RKISP1_CIF_MIPI_CTRL_NUM_LANES(a)  (((a) & 0x3) << 12)
 #define RKISP1_CIF_MIPI_CTRL_ERR_SOT_HS_SKIP   BIT(16)
 #define RKISP1_CIF_MIPI_CTRL_ERR_SOT_SYNC_HS_SKIP  BIT(17)
@@ -332,14 +332,14 @@
 
 /* MIPI_DATA_SEL */
 #define RKISP1_CIF_MIPI_DATA_SEL_VC(a) (((a) & 0x3) << 6)
-#define RKISP1_CIF_MIPI_DATA_SEL_DT(a) (((a) & 0x3F) << 0)
+#define RKISP1_CIF_MIPI_DATA_SEL_DT(a) (((a) & 0x3f) << 0)
 
 /* MIPI_IMSC, MIPI_RIS, MIPI_MIS, MIPI_ICR, MIPI_ISR */
-#define RKISP1_CIF_MIPI_SYNC_FIFO_OVFLW(a) (((a) & 0xF) << 0)
-#define RKISP1_CIF_MIPI_ERR_SOT(a) (((a) & 0xF) << 4)
-#define RKISP1_CIF_MIPI_ERR_SOT_SYNC(a)(((a) & 0xF) << 
8)
-#define RKISP1_CIF_MIPI_ERR_EOT_SYNC(a)(((a) & 0xF) << 
12)
-#define RKISP1_CIF_MIPI_ERR_CTRL(a)(((a) & 0xF) << 16)
+#define RKISP1_CIF_MIPI_SYNC_FIFO_OVFLW(a) (((a) & 0xf) << 0)
+#define RKISP1_CIF_MIPI_ERR_SOT(a) (((a) & 0xf) << 4)
+#define RKISP1_CIF_MIPI_ERR_SOT_SYNC(a)(((a) & 0xf) << 
8)
+#define RKISP1_CIF_MIPI_ERR_EOT_SYNC(a)(((a) & 0xf) << 
12)
+#define RKISP1_CIF_MIPI_ERR_CTRL(a)

[git:media_stage/master] media: MAINTAINERS: Add co-maintainer for the rkisp1 driver

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: MAINTAINERS: Add co-maintainer for the rkisp1 driver
Author:  Laurent Pinchart 
Date:Wed Feb 8 12:00:02 2023 +0200

As I'm actively working on the rkisp1 driver, I would like to volunteer
as a co-maintainer, mostly to make sure I get CC on patches.

Signed-off-by: Laurent Pinchart 
Acked-by: Hans Verkuil 
Reviewed-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

---

diff --git a/MAINTAINERS b/MAINTAINERS
index 65cc6a982de9..3b47e0b56859 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -18539,6 +18539,7 @@ F:  sound/soc/rockchip/rockchip_i2s_tdm.*
 
 ROCKCHIP ISP V1 DRIVER
 M: Dafna Hirschfeld 
+M: Laurent Pinchart 
 L: linux-me...@vger.kernel.org
 L: linux-rockc...@lists.infradead.org
 S: Maintained

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: rkisp1: resizer: Fix resizer disable check when starting stream

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: rkisp1: resizer: Fix resizer disable check when starting stream
Author:  Laurent Pinchart 
Date:Sat Sep 23 22:49:06 2023 +0300

The resizer is used to scale the image, but also to change the
subsampling of YUV formats. Both the luma and chroma dimensions need to
be taken into account to decide whether or not to enable the resizer.
The current implementation disables the resizer if the chroma vertical
size isn't changed, which would be the case when scaling up by a factor
of 2 vertically while at the same time converting from YUV 4:2:2 to
4:2:0. Fix it by checking the luma sizes too.

While at it, reflow and clarify comments in the function.

Signed-off-by: Laurent Pinchart 
Signed-off-by: Hans Verkuil 

 .../media/platform/rockchip/rkisp1/rkisp1-resizer.c   | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

---

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
index 92ae2d2e0f12..28ecc7347d54 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
@@ -284,8 +284,8 @@ static void rkisp1_rsz_config(struct rkisp1_resizer *rsz,
src_yuv_info = rkisp1_rsz_get_yuv_mbus_info(src_fmt->code);
 
/*
-* The resizer only works on yuv formats,
-* so return if it is bayer format.
+* The resizer only works on yuv formats, so return if it is bayer
+* format.
 */
if (!sink_yuv_info) {
rkisp1_rsz_disable(rsz, when);
@@ -299,15 +299,15 @@ static void rkisp1_rsz_config(struct rkisp1_resizer *rsz,
 
src_y.width = src_fmt->width;
src_y.height = src_fmt->height;
+   src_c.width = src_y.width / src_yuv_info->hdiv;
+   src_c.height = src_y.height / src_yuv_info->vdiv;
 
/*
 * The resizer is used not only to change the dimensions of the frame
-* but also to change the scale for YUV formats,
-* (4:2:2 -> 4:2:0 for example). So the width/height of the CbCr
-* streams should be set according to the media bus format in the src 
pad.
+* but also to change the subsampling for YUV formats (for instance
+* converting from 4:2:2 to 4:2:0). Check both the luma and chroma
+* dimensions to decide whether or not to enable the resizer.
 */
-   src_c.width = src_y.width / src_yuv_info->hdiv;
-   src_c.height = src_y.height / src_yuv_info->vdiv;
 
dev_dbg(rsz->rkisp1->dev,
"stream %u rsz/scale: Y %ux%u -> %ux%u, CbCr %ux%u -> %ux%u\n",
@@ -315,12 +315,13 @@ static void rkisp1_rsz_config(struct rkisp1_resizer *rsz,
src_fmt->width, src_fmt->height,
sink_c.width, sink_c.height, src_c.width, src_c.height);
 
-   if (sink_c.width == src_c.width && sink_c.height == src_c.height) {
+   if (sink_y->width == src_y.width && sink_y->height == src_y.height &&
+   sink_c.width == src_c.width && sink_c.height == src_c.height) {
rkisp1_rsz_disable(rsz, when);
return;
}
 
-   /* set values in the hw */
+   /* Set values in the hardware. */
rkisp1_rsz_config_regs(rsz, sink_y, _c, _y, _c, when);
 }
 

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: rkisp1: resizer: Constify argument and local variables

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: rkisp1: resizer: Constify argument and local variables
Author:  Laurent Pinchart 
Date:Sat Sep 23 22:49:06 2023 +0300

Pointers to v4l2_mbus_framefmt and v4l2_rect instances don't need to be
modified when configuring the resizer. Make them const.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

---

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
index bca111711cee..26f9c16ccc3e 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
@@ -206,10 +206,10 @@ static void rkisp1_rsz_disable(struct rkisp1_resizer *rsz,
 }
 
 static void rkisp1_rsz_config_regs(struct rkisp1_resizer *rsz,
-  struct v4l2_rect *sink_y,
-  struct v4l2_rect *sink_c,
-  struct v4l2_rect *src_y,
-  struct v4l2_rect *src_c,
+  const struct v4l2_rect *sink_y,
+  const struct v4l2_rect *sink_c,
+  const struct v4l2_rect *src_y,
+  const struct v4l2_rect *src_c,
   enum rkisp1_shadow_regs_when when)
 {
u32 ratio, rsz_ctrl = 0;
@@ -270,9 +270,9 @@ static void rkisp1_rsz_config(struct rkisp1_resizer *rsz,
  enum rkisp1_shadow_regs_when when)
 {
const struct rkisp1_rsz_yuv_mbus_info *sink_yuv_info, *src_yuv_info;
+   const struct v4l2_mbus_framefmt *src_fmt, *sink_fmt;
+   const struct v4l2_rect *sink_crop;
struct v4l2_rect sink_y, sink_c, src_y, src_c;
-   struct v4l2_mbus_framefmt *src_fmt, *sink_fmt;
-   struct v4l2_rect *sink_crop;
 
sink_fmt = v4l2_subdev_get_pad_format(>sd, sd_state,
  RKISP1_RSZ_PAD_SINK);

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: rkisp1: Program RKISP1_CIF_MI_SP_Y_PIC_SIZE register

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: rkisp1: Program RKISP1_CIF_MI_SP_Y_PIC_SIZE register
Author:  Laurent Pinchart 
Date:Thu Apr 27 11:43:17 2023 +0300

The self path has a Y_PIC_SIZE register that needs to be programmed to
the total number of pixels, including the stride. This isn't done by the
driver, fix it.

While at it, reorder the register write order to sort them by address.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

---

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
index 3c1e2c1a8bbe..c6d7e01c8949 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
@@ -479,9 +479,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_PIC_WIDTH, pixm->width);
rkisp1_write(rkisp1, RKISP1_CIF_MI_SP_Y_PIC_HEIGHT, pixm->height);
-   rkisp1_write(rkisp1, RKISP1_CIF_MI_SP_Y_LLENGTH, cap->sp_y_stride);
+   rkisp1_write(rkisp1, RKISP1_CIF_MI_SP_Y_PIC_SIZE,
+cap->sp_y_stride * pixm->height);
 
rkisp1_irq_frame_end_enable(cap);
 

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: rkisp1: Remove dual crop control register from config structure

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: rkisp1: Remove dual crop control register from config structure
Author:  Laurent Pinchart 
Date:Sat Sep 23 20:23:43 2023 +0300

The dual crop register is the same for both the MP and SP channels. Drop
it from the rkisp1_rsz_config structure and use the
RKISP1_CIF_DUAL_CROP_CTRL macro directly in the code.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

---

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
index 6845df38ef5f..bca111711cee 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
@@ -60,7 +60,6 @@ struct rkisp1_rsz_config {
const int min_rsz_height;
/* registers */
struct {
-   u32 ctrl;
u32 yuvmode_mask;
u32 rawmode_mask;
u32 h_offset;
@@ -78,7 +77,6 @@ static const struct rkisp1_rsz_config rkisp1_rsz_config_mp = {
.min_rsz_height = RKISP1_RSZ_SRC_MIN_HEIGHT,
/* registers */
.dual_crop = {
-   .ctrl = RKISP1_CIF_DUAL_CROP_CTRL,
.yuvmode_mask = RKISP1_CIF_DUAL_CROP_MP_MODE_YUV,
.rawmode_mask = RKISP1_CIF_DUAL_CROP_MP_MODE_RAW,
.h_offset = RKISP1_CIF_DUAL_CROP_M_H_OFFS,
@@ -96,7 +94,6 @@ static const struct rkisp1_rsz_config rkisp1_rsz_config_sp = {
.min_rsz_height = RKISP1_RSZ_SRC_MIN_HEIGHT,
/* registers */
.dual_crop = {
-   .ctrl = RKISP1_CIF_DUAL_CROP_CTRL,
.yuvmode_mask = RKISP1_CIF_DUAL_CROP_SP_MODE_YUV,
.rawmode_mask = RKISP1_CIF_DUAL_CROP_SP_MODE_RAW,
.h_offset = RKISP1_CIF_DUAL_CROP_S_H_OFFS,
@@ -124,7 +121,7 @@ static inline void rkisp1_rsz_write(struct rkisp1_resizer 
*rsz, u32 offset,
 static void rkisp1_dcrop_disable(struct rkisp1_resizer *rsz,
 enum rkisp1_shadow_regs_when when)
 {
-   u32 dc_ctrl = rkisp1_read(rsz->rkisp1, rsz->config->dual_crop.ctrl);
+   u32 dc_ctrl = rkisp1_read(rsz->rkisp1, RKISP1_CIF_DUAL_CROP_CTRL);
u32 mask = ~(rsz->config->dual_crop.yuvmode_mask |
 rsz->config->dual_crop.rawmode_mask);
 
@@ -133,7 +130,7 @@ static void rkisp1_dcrop_disable(struct rkisp1_resizer *rsz,
dc_ctrl |= RKISP1_CIF_DUAL_CROP_GEN_CFG_UPD;
else
dc_ctrl |= RKISP1_CIF_DUAL_CROP_CFG_UPD;
-   rkisp1_write(rsz->rkisp1, rsz->config->dual_crop.ctrl, dc_ctrl);
+   rkisp1_write(rsz->rkisp1, RKISP1_CIF_DUAL_CROP_CTRL, dc_ctrl);
 }
 
 /* configure dual-crop unit */
@@ -158,14 +155,14 @@ static void rkisp1_dcrop_config(struct rkisp1_resizer 
*rsz,
return;
}
 
-   dc_ctrl = rkisp1_read(rkisp1, rsz->config->dual_crop.ctrl);
+   dc_ctrl = rkisp1_read(rkisp1, RKISP1_CIF_DUAL_CROP_CTRL);
rkisp1_write(rkisp1, rsz->config->dual_crop.h_offset, sink_crop->left);
rkisp1_write(rkisp1, rsz->config->dual_crop.v_offset, sink_crop->top);
rkisp1_write(rkisp1, rsz->config->dual_crop.h_size, sink_crop->width);
rkisp1_write(rkisp1, rsz->config->dual_crop.v_size, sink_crop->height);
dc_ctrl |= rsz->config->dual_crop.yuvmode_mask;
dc_ctrl |= RKISP1_CIF_DUAL_CROP_CFG_UPD;
-   rkisp1_write(rkisp1, rsz->config->dual_crop.ctrl, dc_ctrl);
+   rkisp1_write(rkisp1, RKISP1_CIF_DUAL_CROP_CTRL, dc_ctrl);
 
dev_dbg(rkisp1->dev, "stream %d crop: %dx%d -> %dx%d\n", rsz->id,
sink_fmt->width, sink_fmt->height,

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: rkisp1: isp: Use V4L2 subdev active state

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: rkisp1: isp: Use V4L2 subdev active state
Author:  Laurent Pinchart 
Date:Thu Jan 26 03:10:01 2023 +0200

Use the V4L2 subdev active state API to store the active format and crop
rectangle. This simplifies the driver not only by dropping the state
stored in the rkisp1_isp structure, but also by replacing the ops_lock
with the state lock.

The rkisp1_isp.sink_fmt field needs to be kept, as it is accessed from
the stats interrupt handler. To simplify the rkisp1_isp_set_sink_fmt()
implementation, the field is now set when starting the ISP, instead of
when setting the format.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Paul Elder 
Reviewed-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 .../media/platform/rockchip/rkisp1/rkisp1-common.h |   6 -
 .../media/platform/rockchip/rkisp1/rkisp1-isp.c| 261 -
 2 files changed, 102 insertions(+), 165 deletions(-)

---

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
index 5a03e460e08d..053ce04066b6 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
@@ -190,20 +190,14 @@ struct rkisp1_csi {
  * @sd:v4l2_subdev variable
  * @rkisp1:pointer to rkisp1_device
  * @pads:  media pads
- * @pad_cfg:   pads configurations
  * @sink_fmt:  input format
- * @src_fmt:   output format
- * @ops_lock:  ops serialization
  * @frame_sequence:used to synchronize frame_id between video 
devices.
  */
 struct rkisp1_isp {
struct v4l2_subdev sd;
struct rkisp1_device *rkisp1;
struct media_pad pads[RKISP1_ISP_PAD_MAX];
-   struct v4l2_subdev_pad_config pad_cfg[RKISP1_ISP_PAD_MAX];
const struct rkisp1_mbus_info *sink_fmt;
-   const struct rkisp1_mbus_info *src_fmt;
-   struct mutex ops_lock; /* serialize the subdevice ops */
__u32 frame_sequence;
 };
 
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
index 07fbb77ce234..88ca8b2283b7 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
@@ -53,40 +53,6 @@
  * +-+
  */
 
-/* 
- * Helpers
- */
-
-static struct v4l2_mbus_framefmt *
-rkisp1_isp_get_pad_fmt(struct rkisp1_isp *isp,
-  struct v4l2_subdev_state *sd_state,
-  unsigned int pad, u32 which)
-{
-   struct v4l2_subdev_state state = {
-   .pads = isp->pad_cfg
-   };
-
-   if (which == V4L2_SUBDEV_FORMAT_TRY)
-   return v4l2_subdev_get_try_format(>sd, sd_state, pad);
-   else
-   return v4l2_subdev_get_try_format(>sd, , pad);
-}
-
-static struct v4l2_rect *
-rkisp1_isp_get_pad_crop(struct rkisp1_isp *isp,
-   struct v4l2_subdev_state *sd_state,
-   unsigned int pad, u32 which)
-{
-   struct v4l2_subdev_state state = {
-   .pads = isp->pad_cfg
-   };
-
-   if (which == V4L2_SUBDEV_FORMAT_TRY)
-   return v4l2_subdev_get_try_crop(>sd, sd_state, pad);
-   else
-   return v4l2_subdev_get_try_crop(>sd, , pad);
-}
-
 /* 
  * Camera Interface registers configurations
  */
@@ -96,12 +62,12 @@ rkisp1_isp_get_pad_crop(struct rkisp1_isp *isp,
  * This should only be called when configuring CIF
  * or at the frame end interrupt
  */
-static void rkisp1_config_ism(struct rkisp1_isp *isp)
+static void rkisp1_config_ism(struct rkisp1_isp *isp,
+ struct v4l2_subdev_state *sd_state)
 {
const struct v4l2_rect *src_crop =
-   rkisp1_isp_get_pad_crop(isp, NULL,
-   RKISP1_ISP_PAD_SOURCE_VIDEO,
-   V4L2_SUBDEV_FORMAT_ACTIVE);
+   v4l2_subdev_get_pad_crop(>sd, sd_state,
+RKISP1_ISP_PAD_SOURCE_VIDEO);
struct rkisp1_device *rkisp1 = isp->rkisp1;
u32 val;
 
@@ -125,21 +91,26 @@ static void rkisp1_config_ism(struct rkisp1_isp *isp)
  * configure ISP blocks with input format, size..
  */
 static int rkisp1_config_isp(struct rkisp1_isp *isp,
+struct v4l2_subdev_state *sd_state,
 enum v4l2_mbus_type mbus_type, u32 mbus_flags)
 {
struct rkisp1_device *rkisp1 = isp->rkisp1;
u32 isp_ctrl = 0, irq_mask = 0, acq_mult = 0, acq_prop = 0;
-   const struct 

[git:media_stage/master] media: rkisp1: Fix line stride calculation

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: rkisp1: Fix line stride calculation
Author:  Laurent Pinchart 
Date:Thu Apr 27 11:43:17 2023 +0300

The line stride is expressed in the hardware as a number of pixels for
the first plane. The bytesperline must thus be a multiple of the first
plane's bpp value. Enforce this constraint.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 .../media/platform/rockchip/rkisp1/rkisp1-capture.c  | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

---

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
index 8f3cba319762..3c1e2c1a8bbe 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
@@ -1101,14 +1101,20 @@ rkisp1_fill_pixfmt(struct v4l2_pix_format_mplane *pixm,
memset(pixm->plane_fmt, 0, sizeof(pixm->plane_fmt));
info = v4l2_format_info(pixm->pixelformat);
pixm->num_planes = info->mem_planes;
-   stride = info->bpp[0] * pixm->width;
-   /* Self path supports custom stride but Main path doesn't */
-   if (id == RKISP1_MAINPATH || plane_y->bytesperline < stride)
-   plane_y->bytesperline = stride;
-   plane_y->sizeimage = plane_y->bytesperline * pixm->height;
 
-   /* normalize stride to pixels per line */
-   stride = DIV_ROUND_UP(plane_y->bytesperline, info->bpp[0]);
+   /*
+* 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.
+*/
+   if (id == RKISP1_SELFPATH)
+   stride = clamp(DIV_ROUND_UP(plane_y->bytesperline, 
info->bpp[0]),
+  pixm->width, 65536U);
+   else
+   stride = pixm->width;
+
+   plane_y->bytesperline = stride * info->bpp[0];
+   plane_y->sizeimage = plane_y->bytesperline * pixm->height;
 
for (i = 1; i < info->comp_planes; i++) {
struct v4l2_plane_pix_format *plane = >plane_fmt[i];

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: rkisp1: Constify rkisp1_v12_params_ops

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: rkisp1: Constify rkisp1_v12_params_ops
Author:  Laurent Pinchart 
Date:Mon Mar 13 20:51:51 2023 +0200

The rkisp1_v12_params_ops global variable doesn't need to be modified.
Make it const.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/platform/rockchip/rkisp1/rkisp1-params.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

---

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
index 8e3dc4966b94..173d1ea41874 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
@@ -1726,7 +1726,7 @@ static const struct rkisp1_params_ops 
rkisp1_v10_params_ops = {
.afm_config = rkisp1_afm_config_v10,
 };
 
-static struct rkisp1_params_ops rkisp1_v12_params_ops = {
+static const struct rkisp1_params_ops rkisp1_v12_params_ops = {
.lsc_matrix_config = rkisp1_lsc_matrix_config_v12,
.goc_config = rkisp1_goc_config_v12,
.awb_meas_config = rkisp1_awb_meas_config_v12,

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: rkisp1: csi: Use V4L2 subdev active state

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: rkisp1: csi: Use V4L2 subdev active state
Author:  Laurent Pinchart 
Date:Thu Jan 26 03:10:01 2023 +0200

Use the V4L2 subdev active state API to store the active format and crop
rectangle. This simplifies the driver not only by dropping the state
stored in the rkisp1_csi structure, but also by replacing the ops_lock
with the state lock.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Paul Elder 
Reviewed-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 .../media/platform/rockchip/rkisp1/rkisp1-common.h |   6 --
 .../media/platform/rockchip/rkisp1/rkisp1-csi.c| 107 +++--
 2 files changed, 33 insertions(+), 80 deletions(-)

---

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
index 053ce04066b6..1e7cea1bea5e 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
@@ -167,9 +167,6 @@ struct rkisp1_sensor_async {
  * @is_dphy_errctrl_disabled: if dphy errctrl is disabled (avoid endless 
interrupt)
  * @sd: v4l2_subdev variable
  * @pads: media pads
- * @pad_cfg: configurations for the pads
- * @sink_fmt: input format
- * @lock: protects pad_cfg and sink_fmt
  * @source: source in-use, set when starting streaming
  */
 struct rkisp1_csi {
@@ -178,9 +175,6 @@ struct rkisp1_csi {
bool is_dphy_errctrl_disabled;
struct v4l2_subdev sd;
struct media_pad pads[RKISP1_CSI_PAD_NUM];
-   struct v4l2_subdev_pad_config pad_cfg[RKISP1_CSI_PAD_NUM];
-   const struct rkisp1_mbus_info *sink_fmt;
-   struct mutex lock;
struct v4l2_subdev *source;
 };
 
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-csi.c 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-csi.c
index fdff3d0da4e5..6e17b2817e61 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-csi.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-csi.c
@@ -30,23 +30,6 @@ static inline struct rkisp1_csi *to_rkisp1_csi(struct 
v4l2_subdev *sd)
return container_of(sd, struct rkisp1_csi, sd);
 }
 
-static struct v4l2_mbus_framefmt *
-rkisp1_csi_get_pad_fmt(struct rkisp1_csi *csi,
-  struct v4l2_subdev_state *sd_state,
-  unsigned int pad, u32 which)
-{
-   struct v4l2_subdev_state state = {
-   .pads = csi->pad_cfg
-   };
-
-   lockdep_assert_held(>lock);
-
-   if (which == V4L2_SUBDEV_FORMAT_TRY)
-   return v4l2_subdev_get_try_format(>sd, sd_state, pad);
-   else
-   return v4l2_subdev_get_try_format(>sd, , pad);
-}
-
 int rkisp1_csi_link_sensor(struct rkisp1_device *rkisp1, struct v4l2_subdev 
*sd,
   struct rkisp1_sensor_async *s_asd,
   unsigned int source_pad)
@@ -76,7 +59,8 @@ int rkisp1_csi_link_sensor(struct rkisp1_device *rkisp1, 
struct v4l2_subdev *sd,
 }
 
 static int rkisp1_csi_config(struct rkisp1_csi *csi,
-const struct rkisp1_sensor_async *sensor)
+const struct rkisp1_sensor_async *sensor,
+const struct rkisp1_mbus_info *format)
 {
struct rkisp1_device *rkisp1 = csi->rkisp1;
unsigned int lanes = sensor->lanes;
@@ -98,7 +82,7 @@ static int rkisp1_csi_config(struct rkisp1_csi *csi,
 
/* Configure Data Type and Virtual Channel */
rkisp1_write(rkisp1, RKISP1_CIF_MIPI_IMG_DATA_SEL,
-RKISP1_CIF_MIPI_DATA_SEL_DT(csi->sink_fmt->mipi_dt) |
+RKISP1_CIF_MIPI_DATA_SEL_DT(format->mipi_dt) |
 RKISP1_CIF_MIPI_DATA_SEL_VC(0));
 
/* Clear MIPI interrupts */
@@ -151,7 +135,8 @@ static void rkisp1_csi_disable(struct rkisp1_csi *csi)
 }
 
 static int rkisp1_csi_start(struct rkisp1_csi *csi,
-   const struct rkisp1_sensor_async *sensor)
+   const struct rkisp1_sensor_async *sensor,
+   const struct rkisp1_mbus_info *format)
 {
struct rkisp1_device *rkisp1 = csi->rkisp1;
union phy_configure_opts opts;
@@ -159,7 +144,7 @@ static int rkisp1_csi_start(struct rkisp1_csi *csi,
s64 pixel_clock;
int ret;
 
-   ret = rkisp1_csi_config(csi, sensor);
+   ret = rkisp1_csi_config(csi, sensor, format);
if (ret)
return ret;
 
@@ -169,7 +154,7 @@ static int rkisp1_csi_start(struct rkisp1_csi *csi,
return -EINVAL;
}
 
-   phy_mipi_dphy_get_default_config(pixel_clock, csi->sink_fmt->bus_width,
+   phy_mipi_dphy_get_default_config(pixel_clock, format->bus_width,
 sensor->lanes, cfg);
phy_set_mode(csi->dphy, PHY_MODE_MIPI_DPHY);
phy_configure(csi->dphy, );
@@ -248,7 +233,6 @@ static int 

[git:media_stage/master] media: rkisp1: resizer: Drop unneeded local variable

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: rkisp1: resizer: Drop unneeded local variable
Author:  Laurent Pinchart 
Date:Sat Sep 23 22:49:06 2023 +0300

The sink_y local variable in rkisp1_rsz_config() stores a copy of the
sink_crop crop rectangle. Drop it, and rename sink_crop to sink_y.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 .../media/platform/rockchip/rkisp1/rkisp1-resizer.c  | 20 +---
 1 file changed, 9 insertions(+), 11 deletions(-)

---

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
index 8700be7d19aa..1741ada7032b 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
@@ -271,14 +271,12 @@ static void rkisp1_rsz_config(struct rkisp1_resizer *rsz,
 {
const struct rkisp1_rsz_yuv_mbus_info *sink_yuv_info, *src_yuv_info;
const struct v4l2_mbus_framefmt *src_fmt, *sink_fmt;
-   const struct v4l2_rect *sink_crop;
-   struct v4l2_rect sink_y, sink_c;
+   const struct v4l2_rect *sink_y;
struct v4l2_area src_y, src_c;
+   struct v4l2_rect sink_c;
 
sink_fmt = v4l2_subdev_get_pad_format(>sd, sd_state,
  RKISP1_RSZ_PAD_SINK);
-   sink_crop = v4l2_subdev_get_pad_crop(>sd, sd_state,
-RKISP1_RSZ_PAD_SINK);
src_fmt = v4l2_subdev_get_pad_format(>sd, sd_state,
 RKISP1_RSZ_PAD_SRC);
 
@@ -294,14 +292,14 @@ static void rkisp1_rsz_config(struct rkisp1_resizer *rsz,
return;
}
 
-   sink_y.width = sink_crop->width;
-   sink_y.height = sink_crop->height;
+   sink_y = v4l2_subdev_get_pad_crop(>sd, sd_state,
+ RKISP1_RSZ_PAD_SINK);
+   sink_c.width = sink_y->width / sink_yuv_info->hdiv;
+   sink_c.height = sink_y->height / sink_yuv_info->vdiv;
+
src_y.width = src_fmt->width;
src_y.height = src_fmt->height;
 
-   sink_c.width = sink_y.width / sink_yuv_info->hdiv;
-   sink_c.height = sink_y.height / sink_yuv_info->vdiv;
-
/*
 * The resizer is used not only to change the dimensions of the frame
 * but also to change the scale for YUV formats,
@@ -317,13 +315,13 @@ static void rkisp1_rsz_config(struct rkisp1_resizer *rsz,
}
 
dev_dbg(rsz->rkisp1->dev, "stream %d rsz/scale: %dx%d -> %dx%d\n",
-   rsz->id, sink_crop->width, sink_crop->height,
+   rsz->id, sink_y->width, sink_y->height,
src_fmt->width, src_fmt->height);
dev_dbg(rsz->rkisp1->dev, "chroma scaling %dx%d -> %dx%d\n",
sink_c.width, sink_c.height, src_c.width, src_c.height);
 
/* set values in the hw */
-   rkisp1_rsz_config_regs(rsz, _y, _c, _y, _c, when);
+   rkisp1_rsz_config_regs(rsz, sink_y, _c, _y, _c, when);
 }
 
 /* 

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: rkisp1: resizer: Use v4l2_area instead of v4l2_rect to store size

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: rkisp1: resizer: Use v4l2_area instead of v4l2_rect to store 
size
Author:  Laurent Pinchart 
Date:Sat Sep 23 22:49:06 2023 +0300

The rkisp1_rsz_config() and rkisp1_rsz_config_regs() functions use a
v4l2_rect to pass frame sizes, leaving the top and left members unused
and uninitialized. Use v4l2_area instead.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

---

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
index 26f9c16ccc3e..8700be7d19aa 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
@@ -208,8 +208,8 @@ static void rkisp1_rsz_disable(struct rkisp1_resizer *rsz,
 static void rkisp1_rsz_config_regs(struct rkisp1_resizer *rsz,
   const struct v4l2_rect *sink_y,
   const struct v4l2_rect *sink_c,
-  const struct v4l2_rect *src_y,
-  const struct v4l2_rect *src_c,
+  const struct v4l2_area *src_y,
+  const struct v4l2_area *src_c,
   enum rkisp1_shadow_regs_when when)
 {
u32 ratio, rsz_ctrl = 0;
@@ -272,7 +272,8 @@ static void rkisp1_rsz_config(struct rkisp1_resizer *rsz,
const struct rkisp1_rsz_yuv_mbus_info *sink_yuv_info, *src_yuv_info;
const struct v4l2_mbus_framefmt *src_fmt, *sink_fmt;
const struct v4l2_rect *sink_crop;
-   struct v4l2_rect sink_y, sink_c, src_y, src_c;
+   struct v4l2_rect sink_y, sink_c;
+   struct v4l2_area src_y, src_c;
 
sink_fmt = v4l2_subdev_get_pad_format(>sd, sd_state,
  RKISP1_RSZ_PAD_SINK);

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: rkisp1: resizer: Improve debug message when configuring resizer

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: rkisp1: resizer: Improve debug message when configuring resizer
Author:  Laurent Pinchart 
Date:Mon Sep 25 03:20:08 2023 +0300

The debug messages that show the resizer configuration are only printed
if the driver enables the resizer. This prevents checking the resizer
configuration when the driver believes it should be disabled. Fix it by
moving the dev_dbg() statements earlier.

Also, combine the two debug prints into a single one to gather all the
information in one place, which makes reading the log easier.

While at it, use %u instead of %d to print unsigned values.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

---

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c 
b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
index 1741ada7032b..92ae2d2e0f12 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
@@ -309,17 +309,17 @@ static void rkisp1_rsz_config(struct rkisp1_resizer *rsz,
src_c.width = src_y.width / src_yuv_info->hdiv;
src_c.height = src_y.height / src_yuv_info->vdiv;
 
+   dev_dbg(rsz->rkisp1->dev,
+   "stream %u rsz/scale: Y %ux%u -> %ux%u, CbCr %ux%u -> %ux%u\n",
+   rsz->id, sink_y->width, sink_y->height,
+   src_fmt->width, src_fmt->height,
+   sink_c.width, sink_c.height, src_c.width, src_c.height);
+
if (sink_c.width == src_c.width && sink_c.height == src_c.height) {
rkisp1_rsz_disable(rsz, when);
return;
}
 
-   dev_dbg(rsz->rkisp1->dev, "stream %d rsz/scale: %dx%d -> %dx%d\n",
-   rsz->id, sink_y->width, sink_y->height,
-   src_fmt->width, src_fmt->height);
-   dev_dbg(rsz->rkisp1->dev, "chroma scaling %dx%d -> %dx%d\n",
-   sink_c.width, sink_c.height, src_c.width, src_c.height);
-
/* set values in the hw */
rkisp1_rsz_config_regs(rsz, sink_y, _c, _y, _c, when);
 }

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: Documentation: ccs: Fix spelling mistake

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: Documentation: ccs: Fix spelling mistake
Author:  Umang Jain 
Date:Mon Oct 9 19:56:48 2023 +0530

Correct the wrong spelling of 'exposes' in the binner section.

Signed-off-by: Umang Jain 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 Documentation/driver-api/media/drivers/ccs/ccs.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

---

diff --git a/Documentation/driver-api/media/drivers/ccs/ccs.rst 
b/Documentation/driver-api/media/drivers/ccs/ccs.rst
index 0468b9413a31..776eec72bc80 100644
--- a/Documentation/driver-api/media/drivers/ccs/ccs.rst
+++ b/Documentation/driver-api/media/drivers/ccs/ccs.rst
@@ -30,7 +30,7 @@ that purpose, selection target ``V4L2_SEL_TGT_COMPOSE`` is 
supported on the
 sink pad (0).
 
 Additionally, if a device has no scaler or digital crop functionality, the
-source pad (1) expses another digital crop selection rectangle that can only
+source pad (1) exposes another digital crop selection rectangle that can only
 crop at the end of the lines and frames.
 
 Scaler

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: dt-bindings: Make sure items in data-lanes are unique

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: dt-bindings: Make sure items in data-lanes are unique
Author:  Pratyush Yadav 
Date:Mon Oct 9 18:39:27 2023 +0530

The data-lanes property maps the logical lane numbers to the physical
lane numbers. The position of an entry is the logical lane number and
its value is the physical lane number. Since one physical lane can only
map to one logical lane, no number in the list should repeat. Add the
uniqueItems constraint on the property to enforce this.

Signed-off-by: Pratyush Yadav 
Tested-by: Julien Massot 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Reviewed-by: Maxime Ripard 
Acked-by: Rob Herring 
Signed-off-by: Jai Luthra 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 Documentation/devicetree/bindings/media/video-interfaces.yaml | 1 +
 1 file changed, 1 insertion(+)

---

diff --git a/Documentation/devicetree/bindings/media/video-interfaces.yaml 
b/Documentation/devicetree/bindings/media/video-interfaces.yaml
index a211d49dc2ac..26e3e7d7c67b 100644
--- a/Documentation/devicetree/bindings/media/video-interfaces.yaml
+++ b/Documentation/devicetree/bindings/media/video-interfaces.yaml
@@ -160,6 +160,7 @@ properties:
 $ref: /schemas/types.yaml#/definitions/uint32-array
 minItems: 1
 maxItems: 8
+uniqueItems: true
 items:
   # Assume up to 9 physical lane indices
   maximum: 8

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: cadence: csi2rx: Configure DPHY using link freq

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: cadence: csi2rx: Configure DPHY using link freq
Author:  Pratyush Yadav 
Date:Mon Oct 9 18:39:32 2023 +0530

Some platforms like TI's J721E can have the CSI2RX paired with an
external DPHY. Use the generic PHY framework to configure the DPHY with
the correct link frequency.

Signed-off-by: Pratyush Yadav 
Tested-by: Julien Massot 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Reviewed-by: Maxime Ripard 
Co-developed-by: Jai Luthra 
Signed-off-by: Jai Luthra 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/platform/cadence/cdns-csi2rx.c | 24 
 1 file changed, 24 insertions(+)

---

diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c 
b/drivers/media/platform/cadence/cdns-csi2rx.c
index f9b41451f4a4..77e2413c345a 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -145,8 +145,32 @@ static void csi2rx_reset(struct csi2rx_priv *csi2rx)
 static int csi2rx_configure_ext_dphy(struct csi2rx_priv *csi2rx)
 {
union phy_configure_opts opts = { };
+   struct phy_configure_opts_mipi_dphy *cfg = _dphy;
+   struct v4l2_subdev_format sd_fmt = {
+   .which  = V4L2_SUBDEV_FORMAT_ACTIVE,
+   .pad= CSI2RX_PAD_SINK,
+   };
+   const struct csi2rx_fmt *fmt;
+   s64 link_freq;
int ret;
 
+   ret = v4l2_subdev_call_state_active(>subdev, pad, get_fmt,
+   _fmt);
+   if (ret < 0)
+   return ret;
+
+   fmt = csi2rx_get_fmt_by_code(sd_fmt.format.code);
+
+   link_freq = v4l2_get_link_freq(csi2rx->source_subdev->ctrl_handler,
+  fmt->bpp, 2 * csi2rx->num_lanes);
+   if (link_freq < 0)
+   return link_freq;
+
+   ret = phy_mipi_dphy_get_default_config_for_hsclk(link_freq,
+csi2rx->num_lanes, 
cfg);
+   if (ret)
+   return ret;
+
ret = phy_power_on(csi2rx->dphy);
if (ret)
return ret;

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] staging: media: ipu3: remove ftrace-like logging

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: staging: media: ipu3: remove ftrace-like logging
Author:  Ricardo B. Marliere 
Date:Sat Oct 7 17:05:42 2023 -0300

This patch fixes the following checkpatch.pl warnings in ipu3.c:

WARNING: Unnecessary ftrace-like logging - prefer using ftrace
+   dev_dbg(dev, "enter %s\n", __func__);

WARNING: Unnecessary ftrace-like logging - prefer using ftrace
+   dev_dbg(dev, "leave %s\n", __func__);

WARNING: Unnecessary ftrace-like logging - prefer using ftrace
+   dev_dbg(dev, "enter %s\n", __func__);

WARNING: Unnecessary ftrace-like logging - prefer using ftrace
+   dev_dbg(dev, "leave %s\n", __func__);

Fixes: 7fc7af649ca7 ("media: staging/intel-ipu3: Add imgu top level pci device 
driver")
Signed-off-by: Ricardo B. Marliere 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/staging/media/ipu3/ipu3.c | 6 --
 1 file changed, 6 deletions(-)

---

diff --git a/drivers/staging/media/ipu3/ipu3.c 
b/drivers/staging/media/ipu3/ipu3.c
index 0c453b37f8c4..18ca22c3018a 100644
--- a/drivers/staging/media/ipu3/ipu3.c
+++ b/drivers/staging/media/ipu3/ipu3.c
@@ -762,7 +762,6 @@ static int __maybe_unused imgu_suspend(struct device *dev)
struct pci_dev *pci_dev = to_pci_dev(dev);
struct imgu_device *imgu = pci_get_drvdata(pci_dev);
 
-   dev_dbg(dev, "enter %s\n", __func__);
imgu->suspend_in_stream = imgu_css_is_streaming(>css);
if (!imgu->suspend_in_stream)
goto out;
@@ -783,7 +782,6 @@ static int __maybe_unused imgu_suspend(struct device *dev)
imgu_powerdown(imgu);
pm_runtime_force_suspend(dev);
 out:
-   dev_dbg(dev, "leave %s\n", __func__);
return 0;
 }
 
@@ -793,8 +791,6 @@ static int __maybe_unused imgu_resume(struct device *dev)
int r = 0;
unsigned int pipe;
 
-   dev_dbg(dev, "enter %s\n", __func__);
-
if (!imgu->suspend_in_stream)
goto out;
 
@@ -821,8 +817,6 @@ static int __maybe_unused imgu_resume(struct device *dev)
}
 
 out:
-   dev_dbg(dev, "leave %s\n", __func__);
-
return r;
 }
 

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: cadence: csi2rx: Add get_fmt and set_fmt pad ops

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: cadence: csi2rx: Add get_fmt and set_fmt pad ops
Author:  Pratyush Yadav 
Date:Mon Oct 9 18:39:31 2023 +0530

The format is needed to calculate the link speed for the external DPHY
configuration. It is not right to query the format from the source
subdev. Add get_fmt and set_fmt pad operations so that the format can be
configured and correct bpp be selected.

Initialize and use the v4l2 subdev active state to keep track of the
active formats. Also propagate the new format from the sink pad to all
the source pads.

Signed-off-by: Pratyush Yadav 
Tested-by: Julien Massot 
Reviewed-by: Maxime Ripard 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Co-developed-by: Jai Luthra 
Signed-off-by: Jai Luthra 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/platform/cadence/cdns-csi2rx.c | 96 +++-
 1 file changed, 95 insertions(+), 1 deletion(-)

---

diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c 
b/drivers/media/platform/cadence/cdns-csi2rx.c
index 399b2f800dc4..f9b41451f4a4 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -61,6 +61,11 @@ enum csi2rx_pads {
CSI2RX_PAD_MAX,
 };
 
+struct csi2rx_fmt {
+   u32 code;
+   u8  bpp;
+};
+
 struct csi2rx_priv {
struct device   *dev;
unsigned intcount;
@@ -95,6 +100,32 @@ struct csi2rx_priv {
int source_pad;
 };
 
+static const struct csi2rx_fmt formats[] = {
+   { .code = MEDIA_BUS_FMT_YUYV8_1X16, .bpp = 16, },
+   { .code = MEDIA_BUS_FMT_UYVY8_1X16, .bpp = 16, },
+   { .code = MEDIA_BUS_FMT_YVYU8_1X16, .bpp = 16, },
+   { .code = MEDIA_BUS_FMT_VYUY8_1X16, .bpp = 16, },
+   { .code = MEDIA_BUS_FMT_SBGGR8_1X8, .bpp = 8, },
+   { .code = MEDIA_BUS_FMT_SGBRG8_1X8, .bpp = 8, },
+   { .code = MEDIA_BUS_FMT_SGRBG8_1X8, .bpp = 8, },
+   { .code = MEDIA_BUS_FMT_SRGGB8_1X8, .bpp = 8, },
+   { .code = MEDIA_BUS_FMT_SBGGR10_1X10, .bpp = 10, },
+   { .code = MEDIA_BUS_FMT_SGBRG10_1X10, .bpp = 10, },
+   { .code = MEDIA_BUS_FMT_SGRBG10_1X10, .bpp = 10, },
+   { .code = MEDIA_BUS_FMT_SRGGB10_1X10, .bpp = 10, },
+};
+
+static const struct csi2rx_fmt *csi2rx_get_fmt_by_code(u32 code)
+{
+   unsigned int i;
+
+   for (i = 0; i < ARRAY_SIZE(formats); i++)
+   if (formats[i].code == code)
+   return [i];
+
+   return NULL;
+}
+
 static inline
 struct csi2rx_priv *v4l2_subdev_to_csi2rx(struct v4l2_subdev *subdev)
 {
@@ -303,12 +334,68 @@ out:
return ret;
 }
 
+static int csi2rx_set_fmt(struct v4l2_subdev *subdev,
+ struct v4l2_subdev_state *state,
+ struct v4l2_subdev_format *format)
+{
+   struct v4l2_mbus_framefmt *fmt;
+   unsigned int i;
+
+   /* No transcoding, source and sink formats must match. */
+   if (format->pad != CSI2RX_PAD_SINK)
+   return v4l2_subdev_get_fmt(subdev, state, format);
+
+   if (!csi2rx_get_fmt_by_code(format->format.code))
+   format->format.code = formats[0].code;
+
+   format->format.field = V4L2_FIELD_NONE;
+
+   /* Set sink format */
+   fmt = v4l2_subdev_get_pad_format(subdev, state, format->pad);
+   *fmt = format->format;
+
+   /* Propagate to source formats */
+   for (i = CSI2RX_PAD_SOURCE_STREAM0; i < CSI2RX_PAD_MAX; i++) {
+   fmt = v4l2_subdev_get_pad_format(subdev, state, i);
+   *fmt = format->format;
+   }
+
+   return 0;
+}
+
+static int csi2rx_init_cfg(struct v4l2_subdev *subdev,
+  struct v4l2_subdev_state *state)
+{
+   struct v4l2_subdev_format format = {
+   .pad = CSI2RX_PAD_SINK,
+   .format = {
+   .width = 640,
+   .height = 480,
+   .code = MEDIA_BUS_FMT_UYVY8_1X16,
+   .field = V4L2_FIELD_NONE,
+   .colorspace = V4L2_COLORSPACE_SRGB,
+   .ycbcr_enc = V4L2_YCBCR_ENC_601,
+   .quantization = V4L2_QUANTIZATION_LIM_RANGE,
+   .xfer_func = V4L2_XFER_FUNC_SRGB,
+   },
+   };
+
+   return csi2rx_set_fmt(subdev, state, );
+}
+
+static const struct v4l2_subdev_pad_ops csi2rx_pad_ops = {
+   .get_fmt= v4l2_subdev_get_fmt,
+   .set_fmt= csi2rx_set_fmt,
+   .init_cfg   = csi2rx_init_cfg,
+};
+
 static const struct v4l2_subdev_video_ops csi2rx_video_ops = {
.s_stream   = csi2rx_s_stream,
 };
 
 static const struct v4l2_subdev_ops csi2rx_subdev_ops = {
.video  = _video_ops,
+   .pad= _pad_ops,
 };
 
 

[git:media_stage/master] media: dt-bindings: ovti, ov4689: Allow props from video-interface-devices

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: dt-bindings: ovti,ov4689: Allow props from 
video-interface-devices
Author:  Jacopo Mondi 
Date:Fri Oct 6 14:40:58 2023 +0200

All the properties described by video-interface-devices.yaml are
allowed for the image sensor, make them accepted by changing
"additionalProperties: false" to "unevaluatedProperties: false" at the
schema top-level.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Rob Herring 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 Documentation/devicetree/bindings/media/i2c/ovti,ov4689.yaml | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

---

diff --git a/Documentation/devicetree/bindings/media/i2c/ovti,ov4689.yaml 
b/Documentation/devicetree/bindings/media/i2c/ovti,ov4689.yaml
index 50579c947f3c..d96199031b66 100644
--- a/Documentation/devicetree/bindings/media/i2c/ovti,ov4689.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov4689.yaml
@@ -52,10 +52,6 @@ properties:
 description:
   GPIO connected to the reset pin (active low)
 
-  orientation: true
-
-  rotation: true
-
   port:
 $ref: /schemas/graph.yaml#/$defs/port-base
 additionalProperties: false
@@ -95,7 +91,7 @@ required:
   - dvdd-supply
   - port
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: cadence: csi2rx: Cleanup media entity properly

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: cadence: csi2rx: Cleanup media entity properly
Author:  Pratyush Yadav 
Date:Mon Oct 9 18:39:30 2023 +0530

Call media_entity_cleanup() in probe error path and remove to make sure
the media entity is cleaned up properly.

Suggested-by: Laurent Pinchart 
Signed-off-by: Pratyush Yadav 
Tested-by: Julien Massot 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Reviewed-by: Maxime Ripard 
Signed-off-by: Jai Luthra 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/platform/cadence/cdns-csi2rx.c | 2 ++
 1 file changed, 2 insertions(+)

---

diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c 
b/drivers/media/platform/cadence/cdns-csi2rx.c
index 64e472ca3594..399b2f800dc4 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -547,6 +547,7 @@ static int csi2rx_probe(struct platform_device *pdev)
 err_cleanup:
v4l2_async_nf_unregister(>notifier);
v4l2_async_nf_cleanup(>notifier);
+   media_entity_cleanup(>subdev.entity);
 err_free_priv:
kfree(csi2rx);
return ret;
@@ -559,6 +560,7 @@ static void csi2rx_remove(struct platform_device *pdev)
v4l2_async_nf_unregister(>notifier);
v4l2_async_nf_cleanup(>notifier);
v4l2_async_unregister_subdev(>subdev);
+   media_entity_cleanup(>subdev.entity);
kfree(csi2rx);
 }
 

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: dt-bindings: cadence-csi2rx: Add TI compatible string

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: dt-bindings: cadence-csi2rx: Add TI compatible string
Author:  Jai Luthra 
Date:Mon Oct 9 18:39:28 2023 +0530

Add a SoC-specific compatible string for TI's integration of this IP in
J7 and AM62 line of SoCs.

Tested-by: Julien Massot 
Reviewed-by: Maxime Ripard 
Reviewed-by: Laurent Pinchart 
Acked-by: Krzysztof Kozlowski 
Signed-off-by: Jai Luthra 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 Documentation/devicetree/bindings/media/cdns,csi2rx.yaml | 1 +
 1 file changed, 1 insertion(+)

---

diff --git a/Documentation/devicetree/bindings/media/cdns,csi2rx.yaml 
b/Documentation/devicetree/bindings/media/cdns,csi2rx.yaml
index 30a335b10762..2008a47c0580 100644
--- a/Documentation/devicetree/bindings/media/cdns,csi2rx.yaml
+++ b/Documentation/devicetree/bindings/media/cdns,csi2rx.yaml
@@ -18,6 +18,7 @@ properties:
 items:
   - enum:
   - starfive,jh7110-csi2rx
+  - ti,j721e-csi2rx
   - const: cdns,csi2rx
 
   reg:

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: cadence: csi2rx: Unregister v4l2 async notifier

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: cadence: csi2rx: Unregister v4l2 async notifier
Author:  Pratyush Yadav 
Date:Mon Oct 9 18:39:29 2023 +0530

The notifier is added to the global notifier list when registered. When
the module is removed, the struct csi2rx_priv in which the notifier is
embedded, is destroyed. As a result the notifier list has a reference to
a notifier that no longer exists. This causes invalid memory accesses
when the list is iterated over. Similar for when the probe fails.
Unregister and clean up the notifier to avoid this.

Fixes: 1fc3b37f34f6 ("media: v4l: cadence: Add Cadence MIPI-CSI2 RX driver")

Signed-off-by: Pratyush Yadav 
Tested-by: Julien Massot 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Reviewed-by: Maxime Ripard 
Signed-off-by: Jai Luthra 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/platform/cadence/cdns-csi2rx.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

---

diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c 
b/drivers/media/platform/cadence/cdns-csi2rx.c
index b9d9058e2ce3..64e472ca3594 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -479,8 +479,10 @@ static int csi2rx_parse_dt(struct csi2rx_priv *csi2rx)
asd = v4l2_async_nf_add_fwnode_remote(>notifier, fwh,
  struct v4l2_async_connection);
of_node_put(ep);
-   if (IS_ERR(asd))
+   if (IS_ERR(asd)) {
+   v4l2_async_nf_cleanup(>notifier);
return PTR_ERR(asd);
+   }
 
csi2rx->notifier.ops = _notifier_ops;
 
@@ -543,6 +545,7 @@ static int csi2rx_probe(struct platform_device *pdev)
return 0;
 
 err_cleanup:
+   v4l2_async_nf_unregister(>notifier);
v4l2_async_nf_cleanup(>notifier);
 err_free_priv:
kfree(csi2rx);
@@ -553,6 +556,8 @@ static void csi2rx_remove(struct platform_device *pdev)
 {
struct csi2rx_priv *csi2rx = platform_get_drvdata(pdev);
 
+   v4l2_async_nf_unregister(>notifier);
+   v4l2_async_nf_cleanup(>notifier);
v4l2_async_unregister_subdev(>subdev);
kfree(csi2rx);
 }

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: ti: Add CSI2RX support for J721E

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: ti: Add CSI2RX support for J721E
Author:  Jai Luthra 
Date:Mon Oct 9 18:39:39 2023 +0530

TI's J721E uses the Cadence CSI2RX and DPHY peripherals to facilitate
capture over a CSI-2 bus.

The Cadence CSI2RX IP acts as a bridge between the TI specific parts and
the CSI-2 protocol parts. TI then has a wrapper on top of this bridge
called the SHIM layer. It takes in data from stream 0, repacks it, and
sends it to memory over PSI-L DMA.

This driver acts as the "front end" to V4L2 client applications. It
implements the required ioctls and buffer operations, passes the
necessary calls on to the bridge, programs the SHIM layer, and performs
DMA via the dmaengine API to finally return the data to a buffer
supplied by the application.

Co-developed-by: Pratyush Yadav 
Signed-off-by: Pratyush Yadav 
Co-developed-by: Vaishnav Achath 
Signed-off-by: Vaishnav Achath 
Tested-by: Vaishnav Achath 
Tested-by: Julien Massot 
Reviewed-by: Tomi Valkeinen 
Signed-off-by: Jai Luthra 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 MAINTAINERS|7 +
 drivers/media/platform/ti/Kconfig  |   12 +
 drivers/media/platform/ti/Makefile |1 +
 drivers/media/platform/ti/j721e-csi2rx/Makefile|2 +
 .../media/platform/ti/j721e-csi2rx/j721e-csi2rx.c  | 1159 
 5 files changed, 1181 insertions(+)

---

diff --git a/MAINTAINERS b/MAINTAINERS
index 83a0c7f3826b..65cc6a982de9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21594,6 +21594,13 @@ F: 
Documentation/devicetree/bindings/media/i2c/ti,ds90*
 F: drivers/media/i2c/ds90*
 F: include/media/i2c/ds90*
 
+TI J721E CSI2RX DRIVER
+M: Jai Luthra 
+L: linux-me...@vger.kernel.org
+S: Maintained
+F: Documentation/devicetree/bindings/media/ti,j721e-csi2rx.yaml
+F: drivers/media/platform/ti/j721e-csi2rx/
+
 TI KEYSTONE MULTICORE NAVIGATOR DRIVERS
 M: Nishanth Menon 
 M: Santosh Shilimkar 
diff --git a/drivers/media/platform/ti/Kconfig 
b/drivers/media/platform/ti/Kconfig
index e1ab56c3be1f..bab998c4179a 100644
--- a/drivers/media/platform/ti/Kconfig
+++ b/drivers/media/platform/ti/Kconfig
@@ -63,6 +63,18 @@ config VIDEO_TI_VPE_DEBUG
help
  Enable debug messages on VPE driver.
 
+config VIDEO_TI_J721E_CSI2RX
+   tristate "TI J721E CSI2RX wrapper layer driver"
+   depends on VIDEO_DEV && VIDEO_V4L2_SUBDEV_API
+   depends on MEDIA_SUPPORT && MEDIA_CONTROLLER
+   depends on (PHY_CADENCE_DPHY_RX && VIDEO_CADENCE_CSI2RX) || COMPILE_TEST
+   depends on ARCH_K3 || COMPILE_TEST
+   select VIDEOBUF2_DMA_CONTIG
+   select V4L2_FWNODE
+   help
+ Support for TI CSI2RX wrapper layer. This just enables the wrapper 
driver.
+ The Cadence CSI2RX bridge driver needs to be enabled separately.
+
 source "drivers/media/platform/ti/am437x/Kconfig"
 source "drivers/media/platform/ti/davinci/Kconfig"
 source "drivers/media/platform/ti/omap/Kconfig"
diff --git a/drivers/media/platform/ti/Makefile 
b/drivers/media/platform/ti/Makefile
index 98c5fe5c40d6..8a2f74c9380e 100644
--- a/drivers/media/platform/ti/Makefile
+++ b/drivers/media/platform/ti/Makefile
@@ -3,5 +3,6 @@ obj-y += am437x/
 obj-y += cal/
 obj-y += vpe/
 obj-y += davinci/
+obj-y += j721e-csi2rx/
 obj-y += omap/
 obj-y += omap3isp/
diff --git a/drivers/media/platform/ti/j721e-csi2rx/Makefile 
b/drivers/media/platform/ti/j721e-csi2rx/Makefile
new file mode 100644
index ..377afc1d6280
--- /dev/null
+++ b/drivers/media/platform/ti/j721e-csi2rx/Makefile
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_VIDEO_TI_J721E_CSI2RX) += j721e-csi2rx.o
diff --git a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c 
b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
new file mode 100644
index ..ada61391c8d2
--- /dev/null
+++ b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
@@ -0,0 +1,1159 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * TI CSI2RX Shim Wrapper Driver
+ *
+ * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+ *
+ * Author: Pratyush Yadav 
+ * Author: Jai Luthra 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define TI_CSI2RX_MODULE_NAME  "j721e-csi2rx"
+
+#define SHIM_CNTL  0x10
+#define SHIM_CNTL_PIX_RST  BIT(0)
+
+#define SHIM_DMACNTX   0x20
+#define SHIM_DMACNTX_ENBIT(31)
+#define SHIM_DMACNTX_YUV422GENMASK(27, 26)
+#define SHIM_DMACNTX_SIZE  GENMASK(21, 20)
+#define SHIM_DMACNTX_FMT   GENMASK(5, 0)
+#define SHIM_DMACNTX_YUV422_MODE_113
+#define SHIM_DMACNTX_SIZE_80
+#define SHIM_DMACNTX_SIZE_16   1
+#define SHIM_DMACNTX_SIZE_32   2
+

[git:media_stage/master] media: ccs: Fix a (harmless) lockdep warning

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: ccs: Fix a (harmless) lockdep warning
Author:  Sakari Ailus 
Date:Mon Oct 9 14:54:57 2023 +0300

The v4l2_subdev_init_finalize() is a macro that creates an unique lockdep
key and name. As the CCS driver initialises all three of its sub-devices
using the same call site, this creates a lockdep warning. Address it.

Fixes: d8bca3ed1d70 ("media: ccs: Use sub-device active state")
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/i2c/ccs/ccs-core.c | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

---

diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
index 14e89ae98294..12e6f0a26fc8 100644
--- a/drivers/media/i2c/ccs/ccs-core.c
+++ b/drivers/media/i2c/ccs/ccs-core.c
@@ -2955,7 +2955,9 @@ static void ccs_cleanup(struct ccs_sensor *sensor)
 
 static int ccs_init_subdev(struct ccs_sensor *sensor,
   struct ccs_subdev *ssd, const char *name,
-  unsigned short num_pads, u32 function)
+  unsigned short num_pads, u32 function,
+  const char *lock_name,
+  struct lock_class_key *lock_key)
 {
struct i2c_client *client = v4l2_get_subdevdata(>src->sd);
int rval;
@@ -2993,7 +2995,7 @@ static int ccs_init_subdev(struct ccs_sensor *sensor,
return rval;
}
 
-   rval = v4l2_subdev_init_finalize(>sd);
+   rval = __v4l2_subdev_init_finalize(>sd, lock_name, lock_key);
if (rval) {
media_entity_cleanup(>sd.entity);
return rval;
@@ -3206,6 +3208,8 @@ static int ccs_firmware_name(struct i2c_client *client,
 
 static int ccs_probe(struct i2c_client *client)
 {
+   static struct lock_class_key pixel_array_lock_key, binner_lock_key,
+   scaler_lock_key;
const struct ccs_device *ccsdev = device_get_match_data(>dev);
struct ccs_sensor *sensor;
const struct firmware *fw;
@@ -3489,15 +3493,18 @@ static int ccs_probe(struct i2c_client *client)
}
 
rval = ccs_init_subdev(sensor, sensor->scaler, " scaler", 2,
-  MEDIA_ENT_F_PROC_VIDEO_SCALER);
+  MEDIA_ENT_F_PROC_VIDEO_SCALER,
+  "ccs scaler mutex", _lock_key);
if (rval)
goto out_cleanup;
rval = ccs_init_subdev(sensor, sensor->binner, " binner", 2,
-  MEDIA_ENT_F_PROC_VIDEO_SCALER);
+  MEDIA_ENT_F_PROC_VIDEO_SCALER,
+  "ccs binner mutex", _lock_key);
if (rval)
goto out_cleanup;
rval = ccs_init_subdev(sensor, sensor->pixel_array, " pixel_array", 1,
-  MEDIA_ENT_F_CAM_SENSOR);
+  MEDIA_ENT_F_CAM_SENSOR, "ccs pixel array mutex",
+  _array_lock_key);
if (rval)
goto out_cleanup;
 

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: cadence: csi2rx: Set the STOP bit when stopping a stream

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: cadence: csi2rx: Set the STOP bit when stopping a stream
Author:  Pratyush Yadav 
Date:Mon Oct 9 18:39:34 2023 +0530

The stream stop procedure says that the STOP bit should be set when the
stream is to be stopped, and then the ready bit in stream status
register polled to make sure the STOP operation is finished.

Signed-off-by: Pratyush Yadav 
Tested-by: Julien Massot 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Reviewed-by: Maxime Ripard 
Signed-off-by: Jai Luthra 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/platform/cadence/cdns-csi2rx.c | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

---

diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c 
b/drivers/media/platform/cadence/cdns-csi2rx.c
index 913f84c341f4..230c627ef1f4 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -41,8 +42,12 @@
 
 #define CSI2RX_STREAM_CTRL_REG(n)  (CSI2RX_STREAM_BASE(n) + 0x000)
 #define CSI2RX_STREAM_CTRL_SOFT_RSTBIT(4)
+#define CSI2RX_STREAM_CTRL_STOPBIT(1)
 #define CSI2RX_STREAM_CTRL_START   BIT(0)
 
+#define CSI2RX_STREAM_STATUS_REG(n)(CSI2RX_STREAM_BASE(n) + 0x004)
+#define CSI2RX_STREAM_STATUS_RDY   BIT(31)
+
 #define CSI2RX_STREAM_DATA_CFG_REG(n)  (CSI2RX_STREAM_BASE(n) + 0x008)
 #define CSI2RX_STREAM_DATA_CFG_EN_VC_SELECTBIT(31)
 #define CSI2RX_STREAM_DATA_CFG_VC_SELECT(n)BIT((n) + 16)
@@ -310,13 +315,25 @@ err_disable_pclk:
 static void csi2rx_stop(struct csi2rx_priv *csi2rx)
 {
unsigned int i;
+   u32 val;
+   int ret;
 
clk_prepare_enable(csi2rx->p_clk);
reset_control_assert(csi2rx->sys_rst);
clk_disable_unprepare(csi2rx->sys_clk);
 
for (i = 0; i < csi2rx->max_streams; i++) {
-   writel(0, csi2rx->base + CSI2RX_STREAM_CTRL_REG(i));
+   writel(CSI2RX_STREAM_CTRL_STOP,
+  csi2rx->base + CSI2RX_STREAM_CTRL_REG(i));
+
+   ret = readl_relaxed_poll_timeout(csi2rx->base +
+CSI2RX_STREAM_STATUS_REG(i),
+val,
+!(val & 
CSI2RX_STREAM_STATUS_RDY),
+10, 1);
+   if (ret)
+   dev_warn(csi2rx->dev,
+"Failed to stop streaming on pad%u\n", i);
 
reset_control_assert(csi2rx->pixel_rst[i]);
clk_disable_unprepare(csi2rx->pixel_clk[i]);

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: cadence: csi2rx: Soft reset the streams before starting capture

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: cadence: csi2rx: Soft reset the streams before starting capture
Author:  Pratyush Yadav 
Date:Mon Oct 9 18:39:33 2023 +0530

This resets the stream state machines and FIFOs, giving them a clean
slate. On J721E if the streams are not reset before starting the
capture, the captured frame gets wrapped around vertically on every run
after the first.

Signed-off-by: Pratyush Yadav 
Tested-by: Julien Massot 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Maxime Ripard 
Reviewed-by: Tomi Valkeinen 
Signed-off-by: Jai Luthra 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/platform/cadence/cdns-csi2rx.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

---

diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c 
b/drivers/media/platform/cadence/cdns-csi2rx.c
index 77e2413c345a..913f84c341f4 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -40,6 +40,7 @@
 #define CSI2RX_STREAM_BASE(n)  (((n) + 1) * 0x100)
 
 #define CSI2RX_STREAM_CTRL_REG(n)  (CSI2RX_STREAM_BASE(n) + 0x000)
+#define CSI2RX_STREAM_CTRL_SOFT_RSTBIT(4)
 #define CSI2RX_STREAM_CTRL_START   BIT(0)
 
 #define CSI2RX_STREAM_DATA_CFG_REG(n)  (CSI2RX_STREAM_BASE(n) + 0x008)
@@ -134,12 +135,23 @@ struct csi2rx_priv *v4l2_subdev_to_csi2rx(struct 
v4l2_subdev *subdev)
 
 static void csi2rx_reset(struct csi2rx_priv *csi2rx)
 {
+   unsigned int i;
+
+   /* Reset module */
writel(CSI2RX_SOFT_RESET_PROTOCOL | CSI2RX_SOFT_RESET_FRONT,
   csi2rx->base + CSI2RX_SOFT_RESET_REG);
+   /* Reset individual streams. */
+   for (i = 0; i < csi2rx->max_streams; i++) {
+   writel(CSI2RX_STREAM_CTRL_SOFT_RST,
+  csi2rx->base + CSI2RX_STREAM_CTRL_REG(i));
+   }
 
-   udelay(10);
+   usleep_range(10, 20);
 
+   /* Clear resets */
writel(0, csi2rx->base + CSI2RX_SOFT_RESET_REG);
+   for (i = 0; i < csi2rx->max_streams; i++)
+   writel(0, csi2rx->base + CSI2RX_STREAM_CTRL_REG(i));
 }
 
 static int csi2rx_configure_ext_dphy(struct csi2rx_priv *csi2rx)

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: cadence: csi2rx: Fix stream data configuration

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: cadence: csi2rx: Fix stream data configuration
Author:  Pratyush Yadav 
Date:Mon Oct 9 18:39:35 2023 +0530

Firstly, there is no VC_EN bit present in the STREAM_DATA_CFG register.
Bit 31 is part of the VL_SELECT field. Remove it completely.

Secondly, it makes little sense to enable ith virtual channel for ith
stream. Sure, there might be a use-case that demands it. But there might
also be a use case that demands all streams to use the 0th virtual
channel. Prefer this case over the former because it is less arbitrary
and also makes it very clear what the limitations of the current driver
is instead of giving a false impression that multiple virtual channels
are supported.

Signed-off-by: Pratyush Yadav 
Tested-by: Julien Massot 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Reviewed-by: Maxime Ripard 
Signed-off-by: Jai Luthra 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/platform/cadence/cdns-csi2rx.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

---

diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c 
b/drivers/media/platform/cadence/cdns-csi2rx.c
index 230c627ef1f4..812f31dfaab1 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -49,7 +49,6 @@
 #define CSI2RX_STREAM_STATUS_RDY   BIT(31)
 
 #define CSI2RX_STREAM_DATA_CFG_REG(n)  (CSI2RX_STREAM_BASE(n) + 0x008)
-#define CSI2RX_STREAM_DATA_CFG_EN_VC_SELECTBIT(31)
 #define CSI2RX_STREAM_DATA_CFG_VC_SELECT(n)BIT((n) + 16)
 
 #define CSI2RX_STREAM_CFG_REG(n)   (CSI2RX_STREAM_BASE(n) + 0x00c)
@@ -271,8 +270,11 @@ static int csi2rx_start(struct csi2rx_priv *csi2rx)
writel(CSI2RX_STREAM_CFG_FIFO_MODE_LARGE_BUF,
   csi2rx->base + CSI2RX_STREAM_CFG_REG(i));
 
-   writel(CSI2RX_STREAM_DATA_CFG_EN_VC_SELECT |
-  CSI2RX_STREAM_DATA_CFG_VC_SELECT(i),
+   /*
+* Enable one virtual channel. When multiple virtual channels
+* are supported this will have to be changed.
+*/
+   writel(CSI2RX_STREAM_DATA_CFG_VC_SELECT(0),
   csi2rx->base + CSI2RX_STREAM_DATA_CFG_REG(i));
 
writel(CSI2RX_STREAM_CTRL_START,

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: cadence: csi2rx: Add link validation

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: cadence: csi2rx: Add link validation
Author:  Pratyush Yadav 
Date:Mon Oct 9 18:39:37 2023 +0530

Add media link validation to make sure incorrectly configured pipelines
are caught.

Signed-off-by: Pratyush Yadav 
Tested-by: Julien Massot 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Reviewed-by: Maxime Ripard 
Signed-off-by: Jai Luthra 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/platform/cadence/cdns-csi2rx.c | 5 +
 1 file changed, 5 insertions(+)

---

diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c 
b/drivers/media/platform/cadence/cdns-csi2rx.c
index d0c2a5b3d0d5..889f4fbbafb3 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -453,6 +453,10 @@ static const struct v4l2_subdev_ops csi2rx_subdev_ops = {
.pad= _pad_ops,
 };
 
+static const struct media_entity_operations csi2rx_media_ops = {
+   .link_validate = v4l2_subdev_link_validate,
+};
+
 static int csi2rx_async_bound(struct v4l2_async_notifier *notifier,
  struct v4l2_subdev *s_subdev,
  struct v4l2_async_connection *asd)
@@ -669,6 +673,7 @@ static int csi2rx_probe(struct platform_device *pdev)
for (i = CSI2RX_PAD_SOURCE_STREAM0; i < CSI2RX_PAD_MAX; i++)
csi2rx->pads[i].flags = MEDIA_PAD_FL_SOURCE;
csi2rx->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+   csi2rx->subdev.entity.ops = _media_ops;
 
ret = media_entity_pads_init(>subdev.entity, CSI2RX_PAD_MAX,
 csi2rx->pads);

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: cadence: csi2rx: Populate subdev devnode

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: cadence: csi2rx: Populate subdev devnode
Author:  Pratyush Yadav 
Date:Mon Oct 9 18:39:36 2023 +0530

The devnode can be used by media-ctl and other userspace tools to
perform configurations on the subdev. Without it, media-ctl returns
ENOENT when setting format on the sensor subdev.

Signed-off-by: Pratyush Yadav 
Tested-by: Julien Massot 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Reviewed-by: Maxime Ripard 
Signed-off-by: Jai Luthra 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/platform/cadence/cdns-csi2rx.c | 1 +
 1 file changed, 1 insertion(+)

---

diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c 
b/drivers/media/platform/cadence/cdns-csi2rx.c
index 812f31dfaab1..d0c2a5b3d0d5 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -668,6 +668,7 @@ static int csi2rx_probe(struct platform_device *pdev)
csi2rx->pads[CSI2RX_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
for (i = CSI2RX_PAD_SOURCE_STREAM0; i < CSI2RX_PAD_MAX; i++)
csi2rx->pads[i].flags = MEDIA_PAD_FL_SOURCE;
+   csi2rx->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
ret = media_entity_pads_init(>subdev.entity, CSI2RX_PAD_MAX,
 csi2rx->pads);

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: dt-bindings: hynix, hi846: Add video-interface-devices properties

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: dt-bindings: hynix,hi846: Add video-interface-devices properties
Author:  Jacopo Mondi 
Date:Fri Oct 6 14:40:56 2023 +0200

Allow properties from video-interface-devices.yaml for the SK Hynix Hi-846
sensor.

All properties specified in video-interface-devices.yaml schema are
valid, so make them accepted by changing "additionalProperties: false"
to "unevaluatedProperties: false" at the schema top-level.

Add two properties from video-interface-devices.yaml to the example
to validate the new schema.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Rob Herring 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 Documentation/devicetree/bindings/media/i2c/hynix,hi846.yaml | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

---

diff --git a/Documentation/devicetree/bindings/media/i2c/hynix,hi846.yaml 
b/Documentation/devicetree/bindings/media/i2c/hynix,hi846.yaml
index 1e2df8cf2937..60f19e1152b3 100644
--- a/Documentation/devicetree/bindings/media/i2c/hynix,hi846.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/hynix,hi846.yaml
@@ -14,6 +14,9 @@ description: |-
   interface and CCI (I2C compatible) control bus. The output format
   is raw Bayer.
 
+allOf:
+  - $ref: /schemas/media/video-interface-devices.yaml#
+
 properties:
   compatible:
 const: hynix,hi846
@@ -86,7 +89,7 @@ required:
   - vddd-supply
   - port
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |
@@ -109,6 +112,8 @@ examples:
 vddio-supply = <_camera_vddio>;
 reset-gpios = < 25 GPIO_ACTIVE_LOW>;
 shutdown-gpios = < 4 GPIO_ACTIVE_LOW>;
+orientation = <0>;
+rotation = <0>;
 
 port {
 camera_out: endpoint {

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: i2c: mt9m114: Fix missing error unwind in probe()

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: i2c: mt9m114: Fix missing error unwind in probe()
Author:  Laurent Pinchart 
Date:Tue Oct 3 22:20:43 2023 +0300

Two paths in the probe function return directly instead of jumping to
error handling. Fix them.

Fixes: 24d756e914fc ("media: i2c: Add driver for onsemi MT9M114 camera sensor")
Signed-off-by: Laurent Pinchart 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/i2c/mt9m114.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

---

diff --git a/drivers/media/i2c/mt9m114.c b/drivers/media/i2c/mt9m114.c
index dae675e52390..ac19078ceda3 100644
--- a/drivers/media/i2c/mt9m114.c
+++ b/drivers/media/i2c/mt9m114.c
@@ -2367,7 +2367,7 @@ static int mt9m114_probe(struct i2c_client *client)
 
ret = mt9m114_clk_init(sensor);
if (ret)
-   return ret;
+   goto error_ep_free;
 
/*
 * Identify the sensor. The driver supports runtime PM, but needs to
@@ -2378,7 +2378,7 @@ static int mt9m114_probe(struct i2c_client *client)
ret = mt9m114_power_on(sensor);
if (ret < 0) {
dev_err_probe(dev, ret, "Could not power on the device\n");
-   return ret;
+   goto error_ep_free;
}
 
ret = mt9m114_identify(sensor);

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: dt-bindings: sony, imx415: Allow props from video-interface-devices

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: dt-bindings: sony,imx415: Allow props from 
video-interface-devices
Author:  Jacopo Mondi 
Date:Fri Oct 6 14:41:01 2023 +0200

All the properties described by video-interface-devices.yaml are
allowed for the image sensor, make them accepted by changing
"additionalProperties: false" to "unevaluatedProperties: false" at the
schema top-level.

Because all properties are now accepted, there is no need to explicitly
allow them in the schema.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Rob Herring 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 Documentation/devicetree/bindings/media/i2c/sony,imx415.yaml | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

---

diff --git a/Documentation/devicetree/bindings/media/i2c/sony,imx415.yaml 
b/Documentation/devicetree/bindings/media/i2c/sony,imx415.yaml
index ffccf5f3c9e3..8ea3ddd251f6 100644
--- a/Documentation/devicetree/bindings/media/i2c/sony,imx415.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/sony,imx415.yaml
@@ -44,14 +44,6 @@ properties:
 description: Sensor reset (XCLR) GPIO
 maxItems: 1
 
-  flash-leds: true
-
-  lens-focus: true
-
-  orientation: true
-
-  rotation: true
-
   port:
 $ref: /schemas/graph.yaml#/$defs/port-base
 
@@ -88,7 +80,7 @@ required:
   - ovdd-supply
   - port
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: dt-bindings: sony, imx214: Allow props from video-interface-devices

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: dt-bindings: sony,imx214: Allow props from 
video-interface-devices
Author:  Jacopo Mondi 
Date:Fri Oct 6 14:41:00 2023 +0200

All the properties described by video-interface-devices.yaml are
allowed for the image sensor, make them accepted by changing
"additionalProperties: false" to "unevaluatedProperties: false" at the
schema top-level.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Rob Herring 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 Documentation/devicetree/bindings/media/i2c/sony,imx214.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

---

diff --git a/Documentation/devicetree/bindings/media/i2c/sony,imx214.yaml 
b/Documentation/devicetree/bindings/media/i2c/sony,imx214.yaml
index e2470dd5920c..60903da84e1f 100644
--- a/Documentation/devicetree/bindings/media/i2c/sony,imx214.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/sony,imx214.yaml
@@ -91,7 +91,7 @@ required:
   - vddd-supply
   - port
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: ccs: Rework initialising sub-device state

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: ccs: Rework initialising sub-device state
Author:  Sakari Ailus 
Date:Mon Oct 9 09:40:11 2023 +0300

Initialise sub-device state in init_cfg callback using ccs_propagate() to
the extent it covers of the initialisation. This fixes a bug where the
driver configuration was incorrectly initialised.

Fixes: d8bca3ed1d70 ("media: ccs: Use sub-device active state")
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 drivers/media/i2c/ccs/ccs-core.c | 45 +---
 1 file changed, 28 insertions(+), 17 deletions(-)

---

diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
index 2abfd5932e02..14e89ae98294 100644
--- a/drivers/media/i2c/ccs/ccs-core.c
+++ b/drivers/media/i2c/ccs/ccs-core.c
@@ -2075,6 +2075,7 @@ static void ccs_propagate(struct v4l2_subdev *subdev,
struct ccs_sensor *sensor = to_ccs_sensor(subdev);
struct ccs_subdev *ssd = to_ccs_subdev(subdev);
struct v4l2_rect *comp, *crops[CCS_PADS];
+   struct v4l2_mbus_framefmt *fmt;
 
ccs_get_crop_compose(subdev, sd_state, crops, );
 
@@ -2096,6 +2097,9 @@ static void ccs_propagate(struct v4l2_subdev *subdev,
fallthrough;
case V4L2_SEL_TGT_COMPOSE:
*crops[CCS_PAD_SRC] = *comp;
+   fmt = v4l2_subdev_get_pad_format(subdev, sd_state, CCS_PAD_SRC);
+   fmt->width = comp->width;
+   fmt->height = comp->height;
if (which == V4L2_SUBDEV_FORMAT_ACTIVE && ssd == sensor->src)
sensor->src_src = *crops[CCS_PAD_SRC];
break;
@@ -3003,31 +3007,38 @@ static int ccs_init_cfg(struct v4l2_subdev *sd,
 {
struct ccs_subdev *ssd = to_ccs_subdev(sd);
struct ccs_sensor *sensor = ssd->sensor;
-   unsigned int i;
+   unsigned int pad = ssd == sensor->pixel_array ?
+   CCS_PA_PAD_SRC : CCS_PAD_SINK;
+   struct v4l2_mbus_framefmt *fmt =
+   v4l2_subdev_get_pad_format(sd, sd_state, pad);
+   struct v4l2_rect *crop =
+   v4l2_subdev_get_pad_crop(sd, sd_state, pad);
+   bool is_active = !sd->active_state || sd->active_state == sd_state;
 
mutex_lock(>mutex);
 
-   for (i = 0; i < ssd->npads; i++) {
-   struct v4l2_mbus_framefmt *fmt =
-   v4l2_subdev_get_pad_format(sd, sd_state, i);
-   struct v4l2_rect *crop =
-   v4l2_subdev_get_pad_crop(sd, sd_state, i);
-   struct v4l2_rect *comp;
-
-   ccs_get_native_size(ssd, crop);
+   ccs_get_native_size(ssd, crop);
 
-   fmt->width = crop->width;
-   fmt->height = crop->height;
-   fmt->code = sensor->internal_csi_format->code;
-   fmt->field = V4L2_FIELD_NONE;
+   fmt->width = crop->width;
+   fmt->height = crop->height;
+   fmt->code = sensor->internal_csi_format->code;
+   fmt->field = V4L2_FIELD_NONE;
 
-   if (ssd == sensor->pixel_array)
-   continue;
+   if (ssd == sensor->pixel_array) {
+   if (is_active)
+   sensor->pa_src = *crop;
 
-   comp = v4l2_subdev_get_pad_compose(sd, sd_state, i);
-   *comp = *crop;
+   mutex_unlock(>mutex);
+   return 0;
}
 
+   fmt = v4l2_subdev_get_pad_format(sd, sd_state, CCS_PAD_SRC);
+   fmt->code = ssd == sensor->src ?
+   sensor->csi_format->code : sensor->internal_csi_format->code;
+   fmt->field = V4L2_FIELD_NONE;
+
+   ccs_propagate(sd, sd_state, is_active, V4L2_SEL_TGT_CROP);
+
mutex_unlock(>mutex);
 
return 0;

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: dt-bindings: Add TI J721E CSI2RX

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: dt-bindings: Add TI J721E CSI2RX
Author:  Pratyush Yadav 
Date:Mon Oct 9 18:39:38 2023 +0530

TI's J721E uses the Cadence CSI2RX and DPHY peripherals to facilitate
capture over a CSI-2 bus. The TI CSI2RX platform driver glues all the
parts together.

Signed-off-by: Pratyush Yadav 
Tested-by: Julien Massot 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Rob Herring 
Signed-off-by: Jai Luthra 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 .../bindings/media/ti,j721e-csi2rx-shim.yaml   | 100 +
 1 file changed, 100 insertions(+)

---

diff --git a/Documentation/devicetree/bindings/media/ti,j721e-csi2rx-shim.yaml 
b/Documentation/devicetree/bindings/media/ti,j721e-csi2rx-shim.yaml
new file mode 100644
index ..f762fdc05e4d
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/ti,j721e-csi2rx-shim.yaml
@@ -0,0 +1,100 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/ti,j721e-csi2rx-shim.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI J721E CSI2RX Shim
+
+description: |
+  The TI J721E CSI2RX Shim is a wrapper around Cadence CSI2RX bridge that
+  enables sending captured frames to memory over PSI-L DMA. In the J721E
+  Technical Reference Manual (SPRUIL1B) it is referred to as "SHIM" under the
+  CSI_RX_IF section.
+
+maintainers:
+  - Jai Luthra 
+
+properties:
+  compatible:
+const: ti,j721e-csi2rx-shim
+
+  dmas:
+maxItems: 1
+
+  dma-names:
+items:
+  - const: rx0
+
+  reg:
+maxItems: 1
+
+  power-domains:
+maxItems: 1
+
+  ranges: true
+
+  "#address-cells": true
+
+  "#size-cells": true
+
+patternProperties:
+  "^csi-bridge@":
+type: object
+description: CSI2 bridge node.
+$ref: cdns,csi2rx.yaml#
+
+required:
+  - compatible
+  - reg
+  - dmas
+  - dma-names
+  - power-domains
+  - ranges
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+
+ti_csi2rx0: ticsi2rx@450 {
+compatible = "ti,j721e-csi2rx-shim";
+dmas = <_udmap 0x4940>;
+dma-names = "rx0";
+reg = <0x450 0x1000>;
+power-domains = <_pds 26 TI_SCI_PD_EXCLUSIVE>;
+#address-cells = <1>;
+#size-cells = <1>;
+ranges;
+
+cdns_csi2rx: csi-bridge@4504000 {
+compatible = "ti,j721e-csi2rx", "cdns,csi2rx";
+reg = <0x4504000 0x1000>;
+clocks = <_clks 26 2>, <_clks 26 0>, <_clks 26 2>,
+  <_clks 26 2>, <_clks 26 3>, <_clks 26 3>;
+clock-names = "sys_clk", "p_clk", "pixel_if0_clk",
+  "pixel_if1_clk", "pixel_if2_clk", "pixel_if3_clk";
+phys = <>;
+phy-names = "dphy";
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+csi2_0: port@0 {
+
+reg = <0>;
+
+csi2rx0_in_sensor: endpoint {
+remote-endpoint = <_cam0>;
+bus-type = <4>; /* CSI2 DPHY. */
+clock-lanes = <0>;
+data-lanes = <1 2>;
+};
+};
+};
+};
+};

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: dt-bindings: ovti, ov5640: Allow props from video-interface-devices

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: dt-bindings: ovti,ov5640: Allow props from 
video-interface-devices
Author:  Jacopo Mondi 
Date:Fri Oct 6 14:40:59 2023 +0200

There is no reason to restrict the allowed rotation degrees to 0 and 180,
as the sensor can be mounted with any rotation.

Also, as all the properties described by video-interface-devices.yaml are
allowed for the image sensor, make them accepted by changing
"additionalProperties: false" to "unevaluatedProperties: false" at the
schema top-level.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Rob Herring 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 Documentation/devicetree/bindings/media/i2c/ovti,ov5640.yaml | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

---

diff --git a/Documentation/devicetree/bindings/media/i2c/ovti,ov5640.yaml 
b/Documentation/devicetree/bindings/media/i2c/ovti,ov5640.yaml
index a621032f9bd0..2c5e69356658 100644
--- a/Documentation/devicetree/bindings/media/i2c/ovti,ov5640.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov5640.yaml
@@ -44,11 +44,6 @@ properties:
 description: >
   Reference to the GPIO connected to the reset pin, if any.
 
-  rotation:
-enum:
-  - 0
-  - 180
-
   port:
 description: Digital Output Port
 $ref: /schemas/graph.yaml#/$defs/port-base
@@ -85,7 +80,7 @@ required:
   - DOVDD-supply
   - port
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_stage/master] media: dt-bindings: ovti, ov02a10: Allow props from video-interface-devices

2023-10-12 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: dt-bindings: ovti,ov02a10: Allow props from 
video-interface-devices
Author:  Jacopo Mondi 
Date:Fri Oct 6 14:40:57 2023 +0200

There is no reason to restrict the allowed rotation degrees to 0 and 180,
as the sensor can be mounted with any rotation.

Also, as all the properties described by video-interface-devices.yaml are
allowed for the image sensor, make them accepted by changing
"additionalProperties: false" to "unevaluatedProperties: false" at the
schema top-level.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Rob Herring 
Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 

 Documentation/devicetree/bindings/media/i2c/ovti,ov02a10.yaml | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

---

diff --git a/Documentation/devicetree/bindings/media/i2c/ovti,ov02a10.yaml 
b/Documentation/devicetree/bindings/media/i2c/ovti,ov02a10.yaml
index 763cebe03dc2..67c1c291327b 100644
--- a/Documentation/devicetree/bindings/media/i2c/ovti,ov02a10.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov02a10.yaml
@@ -68,12 +68,6 @@ properties:
   marked GPIO_ACTIVE_LOW.
 maxItems: 1
 
-  rotation:
-enum:
-  - 0# Sensor Mounted Upright
-  - 180  # Sensor Mounted Upside Down
-default: 0
-
   port:
 $ref: /schemas/graph.yaml#/$defs/port-base
 additionalProperties: false
@@ -114,7 +108,7 @@ required:
   - reset-gpios
   - port
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits