[media] v4l: vsp1: Implement and use the subdev pad::init_cfg configuration
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Sun, 15 Nov 2015 22:09:08 +0000 (20:09 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 13 Apr 2016 20:54:17 +0000 (17:54 -0300)
Turn the custom formats initialization function into a standard
pad::init_cfg handler and use it in subdevs instead of initializing
formats in the subdev open handler.

This makes the subdev open handler empty, so remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/vsp1/vsp1_bru.c
drivers/media/platform/vsp1/vsp1_entity.c
drivers/media/platform/vsp1/vsp1_entity.h
drivers/media/platform/vsp1/vsp1_hsit.c
drivers/media/platform/vsp1/vsp1_lif.c
drivers/media/platform/vsp1/vsp1_lut.c
drivers/media/platform/vsp1/vsp1_rpf.c
drivers/media/platform/vsp1/vsp1_sru.c
drivers/media/platform/vsp1/vsp1_uds.c
drivers/media/platform/vsp1/vsp1_wpf.c

index d8b7bdeb5af5c33459e02e6e4197a2ed9437b08b..879dc9c9d3f07e05ddda5f64cff87b628792f689 100644 (file)
@@ -387,6 +387,7 @@ static struct v4l2_subdev_video_ops bru_video_ops = {
 };
 
 static struct v4l2_subdev_pad_ops bru_pad_ops = {
+       .init_cfg = vsp1_entity_init_cfg,
        .enum_mbus_code = bru_enum_mbus_code,
        .enum_frame_size = bru_enum_frame_size,
        .get_fmt = bru_get_format,
index 2676f67239945843be62bcd60a7020e402844af8..5423e29e0d49b86782af64582059cc33e00f679e 100644 (file)
@@ -62,16 +62,15 @@ vsp1_entity_get_pad_format(struct vsp1_entity *entity,
 }
 
 /*
- * vsp1_entity_init_formats - Initialize formats on all pads
+ * vsp1_entity_init_cfg - Initialize formats on all pads
  * @subdev: V4L2 subdevice
  * @cfg: V4L2 subdev pad configuration
  *
- * Initialize all pad formats with default values. If cfg is not NULL, try
- * formats are initialized on the file handle. Otherwise active formats are
- * initialized on the device.
+ * Initialize all pad formats with default values in the given pad config. This
+ * function can be used as a handler for the subdev pad::init_cfg operation.
  */
-static void vsp1_entity_init_formats(struct v4l2_subdev *subdev,
-                                    struct v4l2_subdev_pad_config *cfg)
+int vsp1_entity_init_cfg(struct v4l2_subdev *subdev,
+                        struct v4l2_subdev_pad_config *cfg)
 {
        struct v4l2_subdev_format format;
        unsigned int pad;
@@ -85,20 +84,10 @@ static void vsp1_entity_init_formats(struct v4l2_subdev *subdev,
 
                v4l2_subdev_call(subdev, pad, set_fmt, cfg, &format);
        }
-}
-
-static int vsp1_entity_open(struct v4l2_subdev *subdev,
-                           struct v4l2_subdev_fh *fh)
-{
-       vsp1_entity_init_formats(subdev, fh->pad);
 
        return 0;
 }
 
-const struct v4l2_subdev_internal_ops vsp1_subdev_internal_ops = {
-       .open = vsp1_entity_open,
-};
-
 /* -----------------------------------------------------------------------------
  * Media Operations
  */
@@ -209,13 +198,12 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
        v4l2_subdev_init(subdev, ops);
 
        subdev->entity.ops = &vsp1->media_ops;
-       subdev->internal_ops = &vsp1_subdev_internal_ops;
        subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
        snprintf(subdev->name, sizeof(subdev->name), "%s %s",
                 dev_name(vsp1->dev), name);
 
-       vsp1_entity_init_formats(subdev, NULL);
+       vsp1_entity_init_cfg(subdev, NULL);
 
        return 0;
 }
index 0fdda82a8d9a3fa6666418cd88595d1bb3d8ff33..8e6cf776e990c35921b6700f65ea3a4b5822dea6 100644 (file)
@@ -107,6 +107,8 @@ struct v4l2_mbus_framefmt *
 vsp1_entity_get_pad_format(struct vsp1_entity *entity,
                           struct v4l2_subdev_pad_config *cfg,
                           unsigned int pad, u32 which);
+int vsp1_entity_init_cfg(struct v4l2_subdev *subdev,
+                        struct v4l2_subdev_pad_config *cfg);
 
 void vsp1_entity_route_setup(struct vsp1_entity *source);
 
index 49ff74b51e03fcb179e288d1a9012eae3cfe634a..3e36755c8c2a1f507364fd8ed92d10efa9e49e5d 100644 (file)
@@ -163,6 +163,7 @@ static struct v4l2_subdev_video_ops hsit_video_ops = {
 };
 
 static struct v4l2_subdev_pad_ops hsit_pad_ops = {
+       .init_cfg = vsp1_entity_init_cfg,
        .enum_mbus_code = hsit_enum_mbus_code,
        .enum_frame_size = hsit_enum_frame_size,
        .get_fmt = hsit_get_format,
index ead6cc3aa3faf82ce7e467e496daab461c870ee3..5edf6a742c5b372a339329fcf5c61f71ae986a5e 100644 (file)
@@ -190,6 +190,7 @@ static struct v4l2_subdev_video_ops lif_video_ops = {
 };
 
 static struct v4l2_subdev_pad_ops lif_pad_ops = {
+       .init_cfg = vsp1_entity_init_cfg,
        .enum_mbus_code = lif_enum_mbus_code,
        .enum_frame_size = lif_enum_frame_size,
        .get_fmt = lif_get_format,
index 6ba6a58fbac66977c1e2c46f33920a61732d2858..f0afc4291387943c41f5e9a0d52e0317b5d8b812 100644 (file)
@@ -203,6 +203,7 @@ static struct v4l2_subdev_video_ops lut_video_ops = {
 };
 
 static struct v4l2_subdev_pad_ops lut_pad_ops = {
+       .init_cfg = vsp1_entity_init_cfg,
        .enum_mbus_code = lut_enum_mbus_code,
        .enum_frame_size = lut_enum_frame_size,
        .get_fmt = lut_get_format,
index a68f26db9b3f3580e5509300e0fc82b74b24e69d..69fd76eed0bb83d394b4b95bf63e8c2ef9e920ee 100644 (file)
@@ -127,6 +127,7 @@ static struct v4l2_subdev_video_ops rpf_video_ops = {
 };
 
 static struct v4l2_subdev_pad_ops rpf_pad_ops = {
+       .init_cfg = vsp1_entity_init_cfg,
        .enum_mbus_code = vsp1_rwpf_enum_mbus_code,
        .enum_frame_size = vsp1_rwpf_enum_frame_size,
        .get_fmt = vsp1_rwpf_get_format,
index c8642bf8b1a1811a9af4791b81fac4b670c785dd..043dac6644c10fb78610141a0518d1c529d7de88 100644 (file)
@@ -307,6 +307,7 @@ static struct v4l2_subdev_video_ops sru_video_ops = {
 };
 
 static struct v4l2_subdev_pad_ops sru_pad_ops = {
+       .init_cfg = vsp1_entity_init_cfg,
        .enum_mbus_code = sru_enum_mbus_code,
        .enum_frame_size = sru_enum_frame_size,
        .get_fmt = sru_get_format,
index 34689adda8104c869c92ab7ca3b086ee58fc2168..666fabcd03820e788d288660734d944d632cd992 100644 (file)
@@ -305,6 +305,7 @@ static struct v4l2_subdev_video_ops uds_video_ops = {
 };
 
 static struct v4l2_subdev_pad_ops uds_pad_ops = {
+       .init_cfg = vsp1_entity_init_cfg,
        .enum_mbus_code = uds_enum_mbus_code,
        .enum_frame_size = uds_enum_frame_size,
        .get_fmt = uds_get_format,
index 84772fa258a50907a7722ec6fd17e4ba86df8b29..d46910db7e08bbf34bfc7d8defe03cc1c96477cd 100644 (file)
@@ -138,6 +138,7 @@ static struct v4l2_subdev_video_ops wpf_video_ops = {
 };
 
 static struct v4l2_subdev_pad_ops wpf_pad_ops = {
+       .init_cfg = vsp1_entity_init_cfg,
        .enum_mbus_code = vsp1_rwpf_enum_mbus_code,
        .enum_frame_size = vsp1_rwpf_enum_frame_size,
        .get_fmt = vsp1_rwpf_get_format,
This page took 0.048867 seconds and 5 git commands to generate.