mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-02 09:51:21 -04:00
media: atomisp: Move pad linking to atomisp_register_device_nodes()
atomisp_register_device_nodes() already iterates over the ports/sensors in a loop and that loop already does not include the TPG input. So we can simply setup the CSI2-port <-> ISP and sensor <-> CSI2-port mediactl-pad links there instead of repeating the loop in atomisp_create_pads_links(), which atomisp_register_device_nodes() used to call later on. Link: https://lore.kernel.org/r/20230518153733.195306-8-hdegoede@redhat.com Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
96f18f25c1
commit
d374e45591
@@ -933,41 +933,6 @@ static int isp_subdev_init_entities(struct atomisp_sub_device *asd)
|
||||
return asd->ctrl_handler.error;
|
||||
}
|
||||
|
||||
int atomisp_create_pads_links(struct atomisp_device *isp)
|
||||
{
|
||||
int i, ret;
|
||||
|
||||
for (i = 0; i < ATOMISP_CAMERA_NR_PORTS; i++) {
|
||||
ret = media_create_pad_link(&isp->csi2_port[i].subdev.entity,
|
||||
CSI2_PAD_SOURCE, &isp->asd.subdev.entity,
|
||||
ATOMISP_SUBDEV_PAD_SINK, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < isp->input_cnt; i++) {
|
||||
/* Don't create links for the test-pattern-generator */
|
||||
if (isp->inputs[i].type == TEST_PATTERN)
|
||||
continue;
|
||||
|
||||
ret = media_create_pad_link(&isp->inputs[i].camera->entity, 0,
|
||||
&isp->csi2_port[isp->inputs[i].
|
||||
port].subdev.entity,
|
||||
CSI2_PAD_SINK,
|
||||
MEDIA_LNK_FL_ENABLED |
|
||||
MEDIA_LNK_FL_IMMUTABLE);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = media_create_pad_link(&isp->asd.subdev.entity, ATOMISP_SUBDEV_PAD_SOURCE,
|
||||
&isp->asd.video_out.vdev.entity, 0, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void atomisp_subdev_cleanup_entities(struct atomisp_sub_device *asd)
|
||||
{
|
||||
v4l2_ctrl_handler_free(&asd->ctrl_handler);
|
||||
|
||||
@@ -366,6 +366,5 @@ int atomisp_subdev_register_subdev(struct atomisp_sub_device *asd,
|
||||
struct v4l2_device *vdev);
|
||||
int atomisp_subdev_init(struct atomisp_device *isp);
|
||||
void atomisp_subdev_cleanup(struct atomisp_device *isp);
|
||||
int atomisp_create_pads_links(struct atomisp_device *isp);
|
||||
|
||||
#endif /* __ATOMISP_SUBDEV_H__ */
|
||||
|
||||
@@ -943,6 +943,12 @@ static int atomisp_register_device_nodes(struct atomisp_device *isp)
|
||||
int i, err;
|
||||
|
||||
for (i = 0; i < ATOMISP_CAMERA_NR_PORTS; i++) {
|
||||
err = media_create_pad_link(&isp->csi2_port[i].subdev.entity,
|
||||
CSI2_PAD_SOURCE, &isp->asd.subdev.entity,
|
||||
ATOMISP_SUBDEV_PAD_SINK, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (!isp->sensor_subdevs[i])
|
||||
continue;
|
||||
|
||||
@@ -960,6 +966,13 @@ static int atomisp_register_device_nodes(struct atomisp_device *isp)
|
||||
if (i == ATOMISP_CAMERA_PORT_PRIMARY)
|
||||
input->motor = isp->motor;
|
||||
|
||||
err = media_create_pad_link(&input->camera->entity, 0,
|
||||
&isp->csi2_port[i].subdev.entity,
|
||||
CSI2_PAD_SINK,
|
||||
MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
isp->input_cnt++;
|
||||
}
|
||||
|
||||
@@ -983,7 +996,8 @@ static int atomisp_register_device_nodes(struct atomisp_device *isp)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = atomisp_create_pads_links(isp);
|
||||
err = media_create_pad_link(&isp->asd.subdev.entity, ATOMISP_SUBDEV_PAD_SOURCE,
|
||||
&isp->asd.video_out.vdev.entity, 0, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user