aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorGravatar Hans de Goede <hdegoede@redhat.com> 2024-04-12 14:51:15 +0100
committerGravatar Mauro Carvalho Chehab <mchehab@kernel.org> 2024-04-26 10:52:15 +0100
commit52cc673b8d085255eacaebbf78525e2f33a9f95c (patch)
treeac307931926637801d825fa7b5c0801eab33f310 /drivers/staging
parentmedia: atomisp: Ensure CSI-receiver[x] -> ISP links correctly reflect current... (diff)
downloadlinux-52cc673b8d085255eacaebbf78525e2f33a9f95c.tar.gz
linux-52cc673b8d085255eacaebbf78525e2f33a9f95c.tar.bz2
linux-52cc673b8d085255eacaebbf78525e2f33a9f95c.zip
media: atomisp: Propagate set_fmt on sensor results to CSI port
So far the CSI port sink and source pads have not had their fmt set at all, leaving things at the default of SBGGR8_1X8/0x0. This means that pipeline validation such as e.g. done when calling media_pipeline_start() will fail since the links to / from the CSI ports have different fmts on each end. Store a pointer to the CSI port v4l2-subdev in struct atomisp_input_subdev, and use this in atomisp_set_sensor_crop_and_fmt() to propagate the sensors new fmt after a successful set_fmt to the CSI port it is connected too. The input->csi_port pointer also allows simplifying atomisp_link_setup(). Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/media/atomisp/pci/atomisp_cmd.c7
-rw-r--r--drivers/staging/media/atomisp/pci/atomisp_internal.h1
-rw-r--r--drivers/staging/media/atomisp/pci/atomisp_subdev.c17
-rw-r--r--drivers/staging/media/atomisp/pci/atomisp_v4l2.c1
4 files changed, 12 insertions, 14 deletions
diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
index b273234dc439..ecd521043021 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
@@ -3858,6 +3858,13 @@ set_fmt:
if (sd_state)
v4l2_subdev_unlock_state(sd_state);
+ /* Propagate new fmt to CSI port */
+ if (which == V4L2_SUBDEV_FORMAT_ACTIVE) {
+ ret = v4l2_subdev_call(input->csi_port, pad, set_fmt, NULL, &format);
+ if (ret)
+ return ret;
+ }
+
*ffmt = format.format;
return ret;
}
diff --git a/drivers/staging/media/atomisp/pci/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp_internal.h
index 02fffa7f65e1..c81a1c5f2864 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_internal.h
+++ b/drivers/staging/media/atomisp/pci/atomisp_internal.h
@@ -129,6 +129,7 @@ struct atomisp_input_subdev {
bool crop_support;
bool camera_on;
struct v4l2_subdev *camera;
+ struct v4l2_subdev *csi_port;
/* Sensor rects for sensors which support crop */
struct v4l2_rect native_rect;
struct v4l2_rect active_rect;
diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c
index aabffd6a424d..53225958c23b 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c
@@ -644,7 +644,7 @@ static int atomisp_link_setup(struct media_entity *entity,
entity);
struct atomisp_sub_device *asd = v4l2_get_subdevdata(sd);
struct atomisp_device *isp = asd->isp;
- int i, csi_idx, ret;
+ int i, ret;
/* ISP's source is immutable */
if (local != &asd->pads[ATOMISP_SUBDEV_PAD_SINK]) {
@@ -653,24 +653,13 @@ static int atomisp_link_setup(struct media_entity *entity,
return -EINVAL;
}
- for (csi_idx = 0; csi_idx < ATOMISP_CAMERA_NR_PORTS; csi_idx++) {
- if (&isp->csi2_port[csi_idx].pads[CSI2_PAD_SOURCE] == remote)
- break;
- }
-
- if (csi_idx == ATOMISP_CAMERA_NR_PORTS) {
- v4l2_err(sd, "Error cannot find CSI receiver for remote pad\n");
- return -EINVAL;
- }
-
-
for (i = 0; i < isp->input_cnt; i++) {
- if (isp->inputs[i].camera == isp->sensor_subdevs[csi_idx])
+ if (&isp->inputs[i].csi_port->entity.pads[CSI2_PAD_SOURCE] == remote)
break;
}
if (i == isp->input_cnt) {
- v4l2_err(sd, "Error no sensor for CSI receiver %d\n", csi_idx);
+ v4l2_err(sd, "Error no sensor for selected CSI receiver\n");
return -EINVAL;
}
diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index 1008a709b589..809b9c4e7a92 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -1058,6 +1058,7 @@ int atomisp_register_device_nodes(struct atomisp_device *isp)
input->type = RAW_CAMERA;
input->port = i;
input->camera = isp->sensor_subdevs[i];
+ input->csi_port = &isp->csi2_port[i].subdev;
atomisp_init_sensor(input);