[media] v4l2: replace enum_mbus_fmt by enum_mbus_code
authorHans Verkuil <hans.verkuil@cisco.com>
Thu, 9 Apr 2015 07:01:33 +0000 (04:01 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 1 May 2015 11:33:45 +0000 (08:33 -0300)
Replace all calls to the enum_mbus_fmt video op by the pad
enum_mbus_code op and remove the duplicate video op.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Scott Jiang <scott.jiang.linux@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Kamil Debski <k.debski@samsung.com>
Acked-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
38 files changed:
drivers/media/i2c/adv7170.c
drivers/media/i2c/adv7175.c
drivers/media/i2c/adv7183.c
drivers/media/i2c/adv7842.c
drivers/media/i2c/ak881x.c
drivers/media/i2c/ml86v7667.c
drivers/media/i2c/mt9v011.c
drivers/media/i2c/ov7670.c
drivers/media/i2c/soc_camera/imx074.c
drivers/media/i2c/soc_camera/mt9m001.c
drivers/media/i2c/soc_camera/mt9m111.c
drivers/media/i2c/soc_camera/mt9t031.c
drivers/media/i2c/soc_camera/mt9t112.c
drivers/media/i2c/soc_camera/mt9v022.c
drivers/media/i2c/soc_camera/ov2640.c
drivers/media/i2c/soc_camera/ov5642.c
drivers/media/i2c/soc_camera/ov6650.c
drivers/media/i2c/soc_camera/ov772x.c
drivers/media/i2c/soc_camera/ov9640.c
drivers/media/i2c/soc_camera/ov9740.c
drivers/media/i2c/soc_camera/rj54n1cb0c.c
drivers/media/i2c/soc_camera/tw9910.c
drivers/media/i2c/sr030pc30.c
drivers/media/i2c/tvp514x.c
drivers/media/i2c/tvp5150.c
drivers/media/i2c/tvp7002.c
drivers/media/i2c/vs6624.c
drivers/media/platform/blackfin/bfin_capture.c
drivers/media/platform/soc_camera/atmel-isi.c
drivers/media/platform/soc_camera/mx2_camera.c
drivers/media/platform/soc_camera/mx3_camera.c
drivers/media/platform/soc_camera/omap1_camera.c
drivers/media/platform/soc_camera/pxa_camera.c
drivers/media/platform/soc_camera/rcar_vin.c
drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
drivers/media/platform/soc_camera/soc_camera.c
drivers/media/platform/soc_camera/soc_camera_platform.c
include/media/v4l2-subdev.h

index 40a1a95c7ce977b1cd42292b6f739df7a5313879..cfe963b2fe1c7de59621267c504568accb6b0267 100644 (file)
@@ -262,13 +262,14 @@ static int adv7170_s_routing(struct v4l2_subdev *sd,
        return 0;
 }
 
-static int adv7170_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                               u32 *code)
+static int adv7170_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index >= ARRAY_SIZE(adv7170_codes))
+       if (code->pad || code->index >= ARRAY_SIZE(adv7170_codes))
                return -EINVAL;
 
-       *code = adv7170_codes[index];
+       code->code = adv7170_codes[code->index];
        return 0;
 }
 
@@ -323,11 +324,15 @@ static const struct v4l2_subdev_video_ops adv7170_video_ops = {
        .s_routing = adv7170_s_routing,
        .s_mbus_fmt = adv7170_s_fmt,
        .g_mbus_fmt = adv7170_g_fmt,
-       .enum_mbus_fmt  = adv7170_enum_fmt,
+};
+
+static const struct v4l2_subdev_pad_ops adv7170_pad_ops = {
+       .enum_mbus_code = adv7170_enum_mbus_code,
 };
 
 static const struct v4l2_subdev_ops adv7170_ops = {
        .video = &adv7170_video_ops,
+       .pad = &adv7170_pad_ops,
 };
 
 /* ----------------------------------------------------------------------- */
index d220af579a640ea4fdc511dcc43cd954fc209dd4..3f40304e856cbd0c302f5e60368be01a0f42a7bf 100644 (file)
@@ -300,13 +300,14 @@ static int adv7175_s_routing(struct v4l2_subdev *sd,
        return 0;
 }
 
-static int adv7175_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                               u32 *code)
+static int adv7175_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index >= ARRAY_SIZE(adv7175_codes))
+       if (code->pad || code->index >= ARRAY_SIZE(adv7175_codes))
                return -EINVAL;
 
-       *code = adv7175_codes[index];
+       code->code = adv7175_codes[code->index];
        return 0;
 }
 
@@ -376,12 +377,16 @@ static const struct v4l2_subdev_video_ops adv7175_video_ops = {
        .s_routing = adv7175_s_routing,
        .s_mbus_fmt = adv7175_s_fmt,
        .g_mbus_fmt = adv7175_g_fmt,
-       .enum_mbus_fmt  = adv7175_enum_fmt,
+};
+
+static const struct v4l2_subdev_pad_ops adv7175_pad_ops = {
+       .enum_mbus_code = adv7175_enum_mbus_code,
 };
 
 static const struct v4l2_subdev_ops adv7175_ops = {
        .core = &adv7175_core_ops,
        .video = &adv7175_video_ops,
+       .pad = &adv7175_pad_ops,
 };
 
 /* ----------------------------------------------------------------------- */
index 28940cc3a76652bb464ca07d16028ce142fe9bb3..a0bcfefc28fcdb058002db73013d16c232c27402 100644 (file)
@@ -420,13 +420,14 @@ static int adv7183_g_input_status(struct v4l2_subdev *sd, u32 *status)
        return 0;
 }
 
-static int adv7183_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index,
-                               u32 *code)
+static int adv7183_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index > 0)
+       if (code->pad || code->index > 0)
                return -EINVAL;
 
-       *code = MEDIA_BUS_FMT_UYVY8_2X8;
+       code->code = MEDIA_BUS_FMT_UYVY8_2X8;
        return 0;
 }
 
@@ -514,16 +515,20 @@ static const struct v4l2_subdev_video_ops adv7183_video_ops = {
        .s_routing = adv7183_s_routing,
        .querystd = adv7183_querystd,
        .g_input_status = adv7183_g_input_status,
-       .enum_mbus_fmt = adv7183_enum_mbus_fmt,
        .try_mbus_fmt = adv7183_try_mbus_fmt,
        .s_mbus_fmt = adv7183_s_mbus_fmt,
        .g_mbus_fmt = adv7183_g_mbus_fmt,
        .s_stream = adv7183_s_stream,
 };
 
+static const struct v4l2_subdev_pad_ops adv7183_pad_ops = {
+       .enum_mbus_code = adv7183_enum_mbus_code,
+};
+
 static const struct v4l2_subdev_ops adv7183_ops = {
        .core = &adv7183_core_ops,
        .video = &adv7183_video_ops,
+       .pad = &adv7183_pad_ops,
 };
 
 static int adv7183_probe(struct i2c_client *client,
index b5a37fe10a6a5d423ff63af635894e028e6abcf3..644e910f9d8a9146fd277f678583e77c12c8302c 100644 (file)
@@ -1867,13 +1867,14 @@ static int adv7842_s_routing(struct v4l2_subdev *sd,
        return 0;
 }
 
-static int adv7842_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned int index,
-                                u32 *code)
+static int adv7842_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index)
+       if (code->pad || code->index)
                return -EINVAL;
        /* Good enough for now */
-       *code = MEDIA_BUS_FMT_FIXED;
+       code->code = MEDIA_BUS_FMT_FIXED;
        return 0;
 }
 
@@ -2809,7 +2810,6 @@ static const struct v4l2_subdev_video_ops adv7842_video_ops = {
        .s_dv_timings = adv7842_s_dv_timings,
        .g_dv_timings = adv7842_g_dv_timings,
        .query_dv_timings = adv7842_query_dv_timings,
-       .enum_mbus_fmt = adv7842_enum_mbus_fmt,
        .g_mbus_fmt = adv7842_g_mbus_fmt,
        .try_mbus_fmt = adv7842_g_mbus_fmt,
        .s_mbus_fmt = adv7842_g_mbus_fmt,
@@ -2820,6 +2820,7 @@ static const struct v4l2_subdev_pad_ops adv7842_pad_ops = {
        .set_edid = adv7842_set_edid,
        .enum_dv_timings = adv7842_enum_dv_timings,
        .dv_timings_cap = adv7842_dv_timings_cap,
+       .enum_mbus_code = adv7842_enum_mbus_code,
 };
 
 static const struct v4l2_subdev_ops adv7842_ops = {
index 69aeaf3976248ad60b3fba8a43f56496dd337de6..4428fb95d0333e3028734d83df32ef3bffd48a58 100644 (file)
@@ -118,13 +118,14 @@ static int ak881x_s_mbus_fmt(struct v4l2_subdev *sd,
        return ak881x_try_g_mbus_fmt(sd, mf);
 }
 
-static int ak881x_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned int index,
-                               u32 *code)
+static int ak881x_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index)
+       if (code->pad || code->index)
                return -EINVAL;
 
-       *code = MEDIA_BUS_FMT_YUYV8_2X8;
+       code->code = MEDIA_BUS_FMT_YUYV8_2X8;
        return 0;
 }
 
@@ -215,14 +216,18 @@ static struct v4l2_subdev_video_ops ak881x_subdev_video_ops = {
        .g_mbus_fmt     = ak881x_try_g_mbus_fmt,
        .try_mbus_fmt   = ak881x_try_g_mbus_fmt,
        .cropcap        = ak881x_cropcap,
-       .enum_mbus_fmt  = ak881x_enum_mbus_fmt,
        .s_std_output   = ak881x_s_std_output,
        .s_stream       = ak881x_s_stream,
 };
 
+static const struct v4l2_subdev_pad_ops ak881x_subdev_pad_ops = {
+       .enum_mbus_code = ak881x_enum_mbus_code,
+};
+
 static struct v4l2_subdev_ops ak881x_subdev_ops = {
        .core   = &ak881x_subdev_core_ops,
        .video  = &ak881x_subdev_video_ops,
+       .pad    = &ak881x_subdev_pad_ops,
 };
 
 static int ak881x_probe(struct i2c_client *client,
index d7307862c2c5e7b93d99d5f9bb8f1bf651b8fe65..e7b220239d3094db6e4c276007f4906b76ba06ac 100644 (file)
@@ -191,13 +191,14 @@ static int ml86v7667_g_input_status(struct v4l2_subdev *sd, u32 *status)
        return 0;
 }
 
-static int ml86v7667_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned int index,
-                                  u32 *code)
+static int ml86v7667_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index > 0)
+       if (code->pad || code->index > 0)
                return -EINVAL;
 
-       *code = MEDIA_BUS_FMT_YUYV8_2X8;
+       code->code = MEDIA_BUS_FMT_YUYV8_2X8;
 
        return 0;
 }
@@ -279,13 +280,16 @@ static struct v4l2_subdev_video_ops ml86v7667_subdev_video_ops = {
        .s_std = ml86v7667_s_std,
        .querystd = ml86v7667_querystd,
        .g_input_status = ml86v7667_g_input_status,
-       .enum_mbus_fmt = ml86v7667_enum_mbus_fmt,
        .try_mbus_fmt = ml86v7667_mbus_fmt,
        .g_mbus_fmt = ml86v7667_mbus_fmt,
        .s_mbus_fmt = ml86v7667_mbus_fmt,
        .g_mbus_config = ml86v7667_g_mbus_config,
 };
 
+static const struct v4l2_subdev_pad_ops ml86v7667_subdev_pad_ops = {
+       .enum_mbus_code = ml86v7667_enum_mbus_code,
+};
+
 static struct v4l2_subdev_core_ops ml86v7667_subdev_core_ops = {
 #ifdef CONFIG_VIDEO_ADV_DEBUG
        .g_register = ml86v7667_g_register,
@@ -296,6 +300,7 @@ static struct v4l2_subdev_core_ops ml86v7667_subdev_core_ops = {
 static struct v4l2_subdev_ops ml86v7667_subdev_ops = {
        .core = &ml86v7667_subdev_core_ops,
        .video = &ml86v7667_subdev_video_ops,
+       .pad = &ml86v7667_subdev_pad_ops,
 };
 
 static int ml86v7667_init(struct ml86v7667_priv *priv)
index a10f7f8f05587f5efc21cb30808bc8b9e2ce501c..6fae8fce4617838b343cce785318bcee5ddbb7c3 100644 (file)
@@ -324,13 +324,14 @@ static int mt9v011_reset(struct v4l2_subdev *sd, u32 val)
        return 0;
 }
 
-static int mt9v011_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index,
-                                       u32 *code)
+static int mt9v011_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index > 0)
+       if (code->pad || code->index > 0)
                return -EINVAL;
 
-       *code = MEDIA_BUS_FMT_SGRBG8_1X8;
+       code->code = MEDIA_BUS_FMT_SGRBG8_1X8;
        return 0;
 }
 
@@ -469,16 +470,20 @@ static const struct v4l2_subdev_core_ops mt9v011_core_ops = {
 };
 
 static const struct v4l2_subdev_video_ops mt9v011_video_ops = {
-       .enum_mbus_fmt = mt9v011_enum_mbus_fmt,
        .try_mbus_fmt = mt9v011_try_mbus_fmt,
        .s_mbus_fmt = mt9v011_s_mbus_fmt,
        .g_parm = mt9v011_g_parm,
        .s_parm = mt9v011_s_parm,
 };
 
+static const struct v4l2_subdev_pad_ops mt9v011_pad_ops = {
+       .enum_mbus_code = mt9v011_enum_mbus_code,
+};
+
 static const struct v4l2_subdev_ops mt9v011_ops = {
        .core  = &mt9v011_core_ops,
        .video = &mt9v011_video_ops,
+       .pad   = &mt9v011_pad_ops,
 };
 
 
index 394f416b35434eb2d538bcb0bca9b9cef033b9fa..5511208c83082381836d7864658a90f18f6a95fc 100644 (file)
@@ -899,13 +899,14 @@ static int ov7670_set_hw(struct v4l2_subdev *sd, int hstart, int hstop,
 }
 
 
-static int ov7670_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index,
-                                       u32 *code)
+static int ov7670_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index >= N_OV7670_FMTS)
+       if (code->pad || code->index >= N_OV7670_FMTS)
                return -EINVAL;
 
-       *code = ov7670_formats[index].mbus_code;
+       code->code = ov7670_formats[code->index].mbus_code;
        return 0;
 }
 
@@ -1508,7 +1509,6 @@ static const struct v4l2_subdev_core_ops ov7670_core_ops = {
 };
 
 static const struct v4l2_subdev_video_ops ov7670_video_ops = {
-       .enum_mbus_fmt = ov7670_enum_mbus_fmt,
        .try_mbus_fmt = ov7670_try_mbus_fmt,
        .s_mbus_fmt = ov7670_s_mbus_fmt,
        .s_parm = ov7670_s_parm,
@@ -1518,6 +1518,7 @@ static const struct v4l2_subdev_video_ops ov7670_video_ops = {
 static const struct v4l2_subdev_pad_ops ov7670_pad_ops = {
        .enum_frame_interval = ov7670_enum_frame_interval,
        .enum_frame_size = ov7670_enum_frame_size,
+       .enum_mbus_code = ov7670_enum_mbus_code,
 };
 
 static const struct v4l2_subdev_ops ov7670_ops = {
index ec89cfa927a2e83047fab6390d2524a1ba2817b9..7a2d90654fee28d5486f18d645ecd2e1a2def3f9 100644 (file)
@@ -235,13 +235,15 @@ static int imx074_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
        return 0;
 }
 
-static int imx074_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                          u32 *code)
+static int imx074_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if ((unsigned int)index >= ARRAY_SIZE(imx074_colour_fmts))
+       if (code->pad ||
+           (unsigned int)code->index >= ARRAY_SIZE(imx074_colour_fmts))
                return -EINVAL;
 
-       *code = imx074_colour_fmts[index].code;
+       code->code = imx074_colour_fmts[code->index].code;
        return 0;
 }
 
@@ -278,7 +280,6 @@ static struct v4l2_subdev_video_ops imx074_subdev_video_ops = {
        .s_mbus_fmt     = imx074_s_fmt,
        .g_mbus_fmt     = imx074_g_fmt,
        .try_mbus_fmt   = imx074_try_fmt,
-       .enum_mbus_fmt  = imx074_enum_fmt,
        .g_crop         = imx074_g_crop,
        .cropcap        = imx074_cropcap,
        .g_mbus_config  = imx074_g_mbus_config,
@@ -288,9 +289,14 @@ static struct v4l2_subdev_core_ops imx074_subdev_core_ops = {
        .s_power        = imx074_s_power,
 };
 
+static const struct v4l2_subdev_pad_ops imx074_subdev_pad_ops = {
+       .enum_mbus_code = imx074_enum_mbus_code,
+};
+
 static struct v4l2_subdev_ops imx074_subdev_ops = {
        .core   = &imx074_subdev_core_ops,
        .video  = &imx074_subdev_video_ops,
+       .pad    = &imx074_subdev_pad_ops,
 };
 
 static int imx074_video_probe(struct i2c_client *client)
index 2e9a53502551b1be88c4fec650ed5283adb6db7c..ba18e010b9da8736750179b6e15f01c508f609bc 100644 (file)
@@ -562,16 +562,17 @@ static struct v4l2_subdev_core_ops mt9m001_subdev_core_ops = {
        .s_power        = mt9m001_s_power,
 };
 
-static int mt9m001_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                           u32 *code)
+static int mt9m001_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
        struct i2c_client *client = v4l2_get_subdevdata(sd);
        struct mt9m001 *mt9m001 = to_mt9m001(client);
 
-       if (index >= mt9m001->num_fmts)
+       if (code->pad || code->index >= mt9m001->num_fmts)
                return -EINVAL;
 
-       *code = mt9m001->fmts[index].code;
+       code->code = mt9m001->fmts[code->index].code;
        return 0;
 }
 
@@ -617,7 +618,6 @@ static struct v4l2_subdev_video_ops mt9m001_subdev_video_ops = {
        .s_crop         = mt9m001_s_crop,
        .g_crop         = mt9m001_g_crop,
        .cropcap        = mt9m001_cropcap,
-       .enum_mbus_fmt  = mt9m001_enum_fmt,
        .g_mbus_config  = mt9m001_g_mbus_config,
        .s_mbus_config  = mt9m001_s_mbus_config,
 };
@@ -626,10 +626,15 @@ static struct v4l2_subdev_sensor_ops mt9m001_subdev_sensor_ops = {
        .g_skip_top_lines       = mt9m001_g_skip_top_lines,
 };
 
+static const struct v4l2_subdev_pad_ops mt9m001_subdev_pad_ops = {
+       .enum_mbus_code = mt9m001_enum_mbus_code,
+};
+
 static struct v4l2_subdev_ops mt9m001_subdev_ops = {
        .core   = &mt9m001_subdev_core_ops,
        .video  = &mt9m001_subdev_video_ops,
        .sensor = &mt9m001_subdev_sensor_ops,
+       .pad    = &mt9m001_subdev_pad_ops,
 };
 
 static int mt9m001_probe(struct i2c_client *client,
index 441e0fda24fea3c2867300805a6366548d4b053b..b7731401dc39c2b919d80b950fb928c6a6052b8b 100644 (file)
@@ -839,13 +839,14 @@ static struct v4l2_subdev_core_ops mt9m111_subdev_core_ops = {
 #endif
 };
 
-static int mt9m111_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                           u32 *code)
+static int mt9m111_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index >= ARRAY_SIZE(mt9m111_colour_fmts))
+       if (code->pad || code->index >= ARRAY_SIZE(mt9m111_colour_fmts))
                return -EINVAL;
 
-       *code = mt9m111_colour_fmts[index].code;
+       code->code = mt9m111_colour_fmts[code->index].code;
        return 0;
 }
 
@@ -871,13 +872,17 @@ static struct v4l2_subdev_video_ops mt9m111_subdev_video_ops = {
        .s_crop         = mt9m111_s_crop,
        .g_crop         = mt9m111_g_crop,
        .cropcap        = mt9m111_cropcap,
-       .enum_mbus_fmt  = mt9m111_enum_fmt,
        .g_mbus_config  = mt9m111_g_mbus_config,
 };
 
+static const struct v4l2_subdev_pad_ops mt9m111_subdev_pad_ops = {
+       .enum_mbus_code = mt9m111_enum_mbus_code,
+};
+
 static struct v4l2_subdev_ops mt9m111_subdev_ops = {
        .core   = &mt9m111_subdev_core_ops,
        .video  = &mt9m111_subdev_video_ops,
+       .pad    = &mt9m111_subdev_pad_ops,
 };
 
 /*
index 35d9c8d255898dbefbe661640e59d549e0f3d48e..15ac4dc29967468c1356f080b8d708ce240646ff 100644 (file)
@@ -672,13 +672,14 @@ static struct v4l2_subdev_core_ops mt9t031_subdev_core_ops = {
 #endif
 };
 
-static int mt9t031_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                           u32 *code)
+static int mt9t031_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index)
+       if (code->pad || code->index)
                return -EINVAL;
 
-       *code = MEDIA_BUS_FMT_SBGGR10_1X10;
+       code->code = MEDIA_BUS_FMT_SBGGR10_1X10;
        return 0;
 }
 
@@ -718,7 +719,6 @@ static struct v4l2_subdev_video_ops mt9t031_subdev_video_ops = {
        .s_crop         = mt9t031_s_crop,
        .g_crop         = mt9t031_g_crop,
        .cropcap        = mt9t031_cropcap,
-       .enum_mbus_fmt  = mt9t031_enum_fmt,
        .g_mbus_config  = mt9t031_g_mbus_config,
        .s_mbus_config  = mt9t031_s_mbus_config,
 };
@@ -727,10 +727,15 @@ static struct v4l2_subdev_sensor_ops mt9t031_subdev_sensor_ops = {
        .g_skip_top_lines       = mt9t031_g_skip_top_lines,
 };
 
+static const struct v4l2_subdev_pad_ops mt9t031_subdev_pad_ops = {
+       .enum_mbus_code = mt9t031_enum_mbus_code,
+};
+
 static struct v4l2_subdev_ops mt9t031_subdev_ops = {
        .core   = &mt9t031_subdev_core_ops,
        .video  = &mt9t031_subdev_video_ops,
        .sensor = &mt9t031_subdev_sensor_ops,
+       .pad    = &mt9t031_subdev_pad_ops,
 };
 
 static int mt9t031_probe(struct i2c_client *client,
index 64f08365e6b2f83bf7c9736db04a891b3af4d8cf..8b0cfb7f80b1823cbb86fbc66045df08648ffdf9 100644 (file)
@@ -966,16 +966,17 @@ static int mt9t112_try_fmt(struct v4l2_subdev *sd,
        return 0;
 }
 
-static int mt9t112_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                          u32 *code)
+static int mt9t112_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
        struct i2c_client *client = v4l2_get_subdevdata(sd);
        struct mt9t112_priv *priv = to_mt9t112(client);
 
-       if (index >= priv->num_formats)
+       if (code->pad || code->index >= priv->num_formats)
                return -EINVAL;
 
-       *code = mt9t112_cfmts[index].code;
+       code->code = mt9t112_cfmts[code->index].code;
 
        return 0;
 }
@@ -1016,17 +1017,21 @@ static struct v4l2_subdev_video_ops mt9t112_subdev_video_ops = {
        .cropcap        = mt9t112_cropcap,
        .g_crop         = mt9t112_g_crop,
        .s_crop         = mt9t112_s_crop,
-       .enum_mbus_fmt  = mt9t112_enum_fmt,
        .g_mbus_config  = mt9t112_g_mbus_config,
        .s_mbus_config  = mt9t112_s_mbus_config,
 };
 
+static const struct v4l2_subdev_pad_ops mt9t112_subdev_pad_ops = {
+       .enum_mbus_code = mt9t112_enum_mbus_code,
+};
+
 /************************************************************************
                        i2c driver
 ************************************************************************/
 static struct v4l2_subdev_ops mt9t112_subdev_ops = {
        .core   = &mt9t112_subdev_core_ops,
        .video  = &mt9t112_subdev_video_ops,
+       .pad    = &mt9t112_subdev_pad_ops,
 };
 
 static int mt9t112_camera_probe(struct i2c_client *client)
index a246d4d64b8b0c2f58c06b5fbe0b67c50314c015..780c7ae74d698e5f7bf1ad999fbba03b827529d0 100644 (file)
@@ -758,16 +758,17 @@ static struct v4l2_subdev_core_ops mt9v022_subdev_core_ops = {
        .s_power        = mt9v022_s_power,
 };
 
-static int mt9v022_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                           u32 *code)
+static int mt9v022_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
        struct i2c_client *client = v4l2_get_subdevdata(sd);
        struct mt9v022 *mt9v022 = to_mt9v022(client);
 
-       if (index >= mt9v022->num_fmts)
+       if (code->pad || code->index >= mt9v022->num_fmts)
                return -EINVAL;
 
-       *code = mt9v022->fmts[index].code;
+       code->code = mt9v022->fmts[code->index].code;
        return 0;
 }
 
@@ -845,7 +846,6 @@ static struct v4l2_subdev_video_ops mt9v022_subdev_video_ops = {
        .s_crop         = mt9v022_s_crop,
        .g_crop         = mt9v022_g_crop,
        .cropcap        = mt9v022_cropcap,
-       .enum_mbus_fmt  = mt9v022_enum_fmt,
        .g_mbus_config  = mt9v022_g_mbus_config,
        .s_mbus_config  = mt9v022_s_mbus_config,
 };
@@ -854,10 +854,15 @@ static struct v4l2_subdev_sensor_ops mt9v022_subdev_sensor_ops = {
        .g_skip_top_lines       = mt9v022_g_skip_top_lines,
 };
 
+static const struct v4l2_subdev_pad_ops mt9v022_subdev_pad_ops = {
+       .enum_mbus_code = mt9v022_enum_mbus_code,
+};
+
 static struct v4l2_subdev_ops mt9v022_subdev_ops = {
        .core   = &mt9v022_subdev_core_ops,
        .video  = &mt9v022_subdev_video_ops,
        .sensor = &mt9v022_subdev_sensor_ops,
+       .pad    = &mt9v022_subdev_pad_ops,
 };
 
 static int mt9v022_probe(struct i2c_client *client,
index e3c907a977651a1f852db87e44f661f2dc502493..4327871c8f9f4aa580a25b7ff2a564be4d3881c7 100644 (file)
@@ -925,13 +925,14 @@ static int ov2640_try_fmt(struct v4l2_subdev *sd,
        return 0;
 }
 
-static int ov2640_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                          u32 *code)
+static int ov2640_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index >= ARRAY_SIZE(ov2640_codes))
+       if (code->pad || code->index >= ARRAY_SIZE(ov2640_codes))
                return -EINVAL;
 
-       *code = ov2640_codes[index];
+       code->code = ov2640_codes[code->index];
        return 0;
 }
 
@@ -1036,13 +1037,17 @@ static struct v4l2_subdev_video_ops ov2640_subdev_video_ops = {
        .try_mbus_fmt   = ov2640_try_fmt,
        .cropcap        = ov2640_cropcap,
        .g_crop         = ov2640_g_crop,
-       .enum_mbus_fmt  = ov2640_enum_fmt,
        .g_mbus_config  = ov2640_g_mbus_config,
 };
 
+static const struct v4l2_subdev_pad_ops ov2640_subdev_pad_ops = {
+       .enum_mbus_code = ov2640_enum_mbus_code,
+};
+
 static struct v4l2_subdev_ops ov2640_subdev_ops = {
        .core   = &ov2640_subdev_core_ops,
        .video  = &ov2640_subdev_video_ops,
+       .pad    = &ov2640_subdev_pad_ops,
 };
 
 /* OF probe functions */
index 93ae031bdafb19f7d8d5467d68dd02e5b4948299..fcddd0ded2e3db4488d83f1516af404d47a95bed 100644 (file)
@@ -839,13 +839,14 @@ static int ov5642_g_fmt(struct v4l2_subdev *sd,
        return 0;
 }
 
-static int ov5642_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                          u32 *code)
+static int ov5642_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index >= ARRAY_SIZE(ov5642_colour_fmts))
+       if (code->pad || code->index >= ARRAY_SIZE(ov5642_colour_fmts))
                return -EINVAL;
 
-       *code = ov5642_colour_fmts[index].code;
+       code->code = ov5642_colour_fmts[code->index].code;
        return 0;
 }
 
@@ -942,13 +943,16 @@ static struct v4l2_subdev_video_ops ov5642_subdev_video_ops = {
        .s_mbus_fmt     = ov5642_s_fmt,
        .g_mbus_fmt     = ov5642_g_fmt,
        .try_mbus_fmt   = ov5642_try_fmt,
-       .enum_mbus_fmt  = ov5642_enum_fmt,
        .s_crop         = ov5642_s_crop,
        .g_crop         = ov5642_g_crop,
        .cropcap        = ov5642_cropcap,
        .g_mbus_config  = ov5642_g_mbus_config,
 };
 
+static const struct v4l2_subdev_pad_ops ov5642_subdev_pad_ops = {
+       .enum_mbus_code = ov5642_enum_mbus_code,
+};
+
 static struct v4l2_subdev_core_ops ov5642_subdev_core_ops = {
        .s_power        = ov5642_s_power,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
@@ -960,6 +964,7 @@ static struct v4l2_subdev_core_ops ov5642_subdev_core_ops = {
 static struct v4l2_subdev_ops ov5642_subdev_ops = {
        .core   = &ov5642_subdev_core_ops,
        .video  = &ov5642_subdev_video_ops,
+       .pad    = &ov5642_subdev_pad_ops,
 };
 
 static int ov5642_video_probe(struct i2c_client *client)
index f4eef2fa6f6f55b42bf446c67fff249d5a9f798d..99e0738fdb38c1908d479e5b84b4999ff2f08fc5 100644 (file)
@@ -716,13 +716,14 @@ static int ov6650_try_fmt(struct v4l2_subdev *sd,
        return 0;
 }
 
-static int ov6650_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                          u32 *code)
+static int ov6650_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index >= ARRAY_SIZE(ov6650_codes))
+       if (code->pad || code->index >= ARRAY_SIZE(ov6650_codes))
                return -EINVAL;
 
-       *code = ov6650_codes[index];
+       code->code = ov6650_codes[code->index];
        return 0;
 }
 
@@ -932,7 +933,6 @@ static struct v4l2_subdev_video_ops ov6650_video_ops = {
        .g_mbus_fmt     = ov6650_g_fmt,
        .s_mbus_fmt     = ov6650_s_fmt,
        .try_mbus_fmt   = ov6650_try_fmt,
-       .enum_mbus_fmt  = ov6650_enum_fmt,
        .cropcap        = ov6650_cropcap,
        .g_crop         = ov6650_g_crop,
        .s_crop         = ov6650_s_crop,
@@ -942,9 +942,14 @@ static struct v4l2_subdev_video_ops ov6650_video_ops = {
        .s_mbus_config  = ov6650_s_mbus_config,
 };
 
+static const struct v4l2_subdev_pad_ops ov6650_pad_ops = {
+       .enum_mbus_code = ov6650_enum_mbus_code,
+};
+
 static struct v4l2_subdev_ops ov6650_subdev_ops = {
        .core   = &ov6650_core_ops,
        .video  = &ov6650_video_ops,
+       .pad    = &ov6650_pad_ops,
 };
 
 /*
index 8daac88b33fef2ee18e647063dcd7d2bf64bae08..e3a31f8066362960d4541b1163783ffc917987a3 100644 (file)
@@ -989,13 +989,14 @@ static struct v4l2_subdev_core_ops ov772x_subdev_core_ops = {
        .s_power        = ov772x_s_power,
 };
 
-static int ov772x_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                          u32 *code)
+static int ov772x_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index >= ARRAY_SIZE(ov772x_cfmts))
+       if (code->pad || code->index >= ARRAY_SIZE(ov772x_cfmts))
                return -EINVAL;
 
-       *code = ov772x_cfmts[index].code;
+       code->code = ov772x_cfmts[code->index].code;
        return 0;
 }
 
@@ -1021,13 +1022,17 @@ static struct v4l2_subdev_video_ops ov772x_subdev_video_ops = {
        .try_mbus_fmt   = ov772x_try_fmt,
        .cropcap        = ov772x_cropcap,
        .g_crop         = ov772x_g_crop,
-       .enum_mbus_fmt  = ov772x_enum_fmt,
        .g_mbus_config  = ov772x_g_mbus_config,
 };
 
+static const struct v4l2_subdev_pad_ops ov772x_subdev_pad_ops = {
+       .enum_mbus_code = ov772x_enum_mbus_code,
+};
+
 static struct v4l2_subdev_ops ov772x_subdev_ops = {
        .core   = &ov772x_subdev_core_ops,
        .video  = &ov772x_subdev_video_ops,
+       .pad    = &ov772x_subdev_pad_ops,
 };
 
 /*
index aa93d2e88572c7a019a464845784bfe549086ce3..899b4d9352fe47c16453bd22485c249d8e7c683a 100644 (file)
@@ -540,13 +540,14 @@ static int ov9640_try_fmt(struct v4l2_subdev *sd,
        return 0;
 }
 
-static int ov9640_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                          u32 *code)
+static int ov9640_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index >= ARRAY_SIZE(ov9640_codes))
+       if (code->pad || code->index >= ARRAY_SIZE(ov9640_codes))
                return -EINVAL;
 
-       *code = ov9640_codes[index];
+       code->code = ov9640_codes[code->index];
        return 0;
 }
 
@@ -658,15 +659,19 @@ static struct v4l2_subdev_video_ops ov9640_video_ops = {
        .s_stream       = ov9640_s_stream,
        .s_mbus_fmt     = ov9640_s_fmt,
        .try_mbus_fmt   = ov9640_try_fmt,
-       .enum_mbus_fmt  = ov9640_enum_fmt,
        .cropcap        = ov9640_cropcap,
        .g_crop         = ov9640_g_crop,
        .g_mbus_config  = ov9640_g_mbus_config,
 };
 
+static const struct v4l2_subdev_pad_ops ov9640_pad_ops = {
+       .enum_mbus_code = ov9640_enum_mbus_code,
+};
+
 static struct v4l2_subdev_ops ov9640_subdev_ops = {
        .core   = &ov9640_core_ops,
        .video  = &ov9640_video_ops,
+       .pad    = &ov9640_pad_ops,
 };
 
 /*
index 841dc55457cf540176ea635466792c78e681b6c5..5d9b2492b7d2464d4fc16d755ee6278f86bea4dd 100644 (file)
@@ -716,13 +716,14 @@ static int ov9740_try_fmt(struct v4l2_subdev *sd,
        return 0;
 }
 
-static int ov9740_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                          u32 *code)
+static int ov9740_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index >= ARRAY_SIZE(ov9740_codes))
+       if (code->pad || code->index >= ARRAY_SIZE(ov9740_codes))
                return -EINVAL;
 
-       *code = ov9740_codes[index];
+       code->code = ov9740_codes[code->index];
 
        return 0;
 }
@@ -906,7 +907,6 @@ static struct v4l2_subdev_video_ops ov9740_video_ops = {
        .s_stream       = ov9740_s_stream,
        .s_mbus_fmt     = ov9740_s_fmt,
        .try_mbus_fmt   = ov9740_try_fmt,
-       .enum_mbus_fmt  = ov9740_enum_fmt,
        .cropcap        = ov9740_cropcap,
        .g_crop         = ov9740_g_crop,
        .g_mbus_config  = ov9740_g_mbus_config,
@@ -920,9 +920,14 @@ static struct v4l2_subdev_core_ops ov9740_core_ops = {
 #endif
 };
 
+static const struct v4l2_subdev_pad_ops ov9740_pad_ops = {
+       .enum_mbus_code = ov9740_enum_mbus_code,
+};
+
 static struct v4l2_subdev_ops ov9740_subdev_ops = {
-       .core                   = &ov9740_core_ops,
-       .video                  = &ov9740_video_ops,
+       .core   = &ov9740_core_ops,
+       .video  = &ov9740_video_ops,
+       .pad    = &ov9740_pad_ops,
 };
 
 static const struct v4l2_ctrl_ops ov9740_ctrl_ops = {
index 1752428c43c54c0bde741c01c881affd707190f7..4927a76d2240ec7514f00197383ab0d8d5658580 100644 (file)
@@ -485,13 +485,14 @@ static int reg_write_multiple(struct i2c_client *client,
        return 0;
 }
 
-static int rj54n1_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                          u32 *code)
+static int rj54n1_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index >= ARRAY_SIZE(rj54n1_colour_fmts))
+       if (code->pad || code->index >= ARRAY_SIZE(rj54n1_colour_fmts))
                return -EINVAL;
 
-       *code = rj54n1_colour_fmts[index].code;
+       code->code = rj54n1_colour_fmts[code->index].code;
        return 0;
 }
 
@@ -1252,7 +1253,6 @@ static struct v4l2_subdev_video_ops rj54n1_subdev_video_ops = {
        .s_mbus_fmt     = rj54n1_s_fmt,
        .g_mbus_fmt     = rj54n1_g_fmt,
        .try_mbus_fmt   = rj54n1_try_fmt,
-       .enum_mbus_fmt  = rj54n1_enum_fmt,
        .g_crop         = rj54n1_g_crop,
        .s_crop         = rj54n1_s_crop,
        .cropcap        = rj54n1_cropcap,
@@ -1260,9 +1260,14 @@ static struct v4l2_subdev_video_ops rj54n1_subdev_video_ops = {
        .s_mbus_config  = rj54n1_s_mbus_config,
 };
 
+static const struct v4l2_subdev_pad_ops rj54n1_subdev_pad_ops = {
+       .enum_mbus_code = rj54n1_enum_mbus_code,
+};
+
 static struct v4l2_subdev_ops rj54n1_subdev_ops = {
        .core   = &rj54n1_subdev_core_ops,
        .video  = &rj54n1_subdev_video_ops,
+       .pad    = &rj54n1_subdev_pad_ops,
 };
 
 /*
index 9b853215d1469b20a367d96731a547eef5e4b962..f8c0c713d06c6cc2f82b30c5ee4b5873bd0915d2 100644 (file)
@@ -821,13 +821,14 @@ static struct v4l2_subdev_core_ops tw9910_subdev_core_ops = {
        .s_power        = tw9910_s_power,
 };
 
-static int tw9910_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                          u32 *code)
+static int tw9910_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index)
+       if (code->pad || code->index)
                return -EINVAL;
 
-       *code = MEDIA_BUS_FMT_UYVY8_2X8;
+       code->code = MEDIA_BUS_FMT_UYVY8_2X8;
        return 0;
 }
 
@@ -885,15 +886,19 @@ static struct v4l2_subdev_video_ops tw9910_subdev_video_ops = {
        .try_mbus_fmt   = tw9910_try_fmt,
        .cropcap        = tw9910_cropcap,
        .g_crop         = tw9910_g_crop,
-       .enum_mbus_fmt  = tw9910_enum_fmt,
        .g_mbus_config  = tw9910_g_mbus_config,
        .s_mbus_config  = tw9910_s_mbus_config,
        .g_tvnorms      = tw9910_g_tvnorms,
 };
 
+static const struct v4l2_subdev_pad_ops tw9910_subdev_pad_ops = {
+       .enum_mbus_code = tw9910_enum_mbus_code,
+};
+
 static struct v4l2_subdev_ops tw9910_subdev_ops = {
        .core   = &tw9910_subdev_core_ops,
        .video  = &tw9910_subdev_video_ops,
+       .pad    = &tw9910_subdev_pad_ops,
 };
 
 /*
index 10c735c3a082cb455f6fdaabe2da3ba678590c0b..0a0a1886ee4ca9b39243fac0bddbfbd8649f2481 100644 (file)
@@ -471,13 +471,15 @@ static int sr030pc30_s_ctrl(struct v4l2_ctrl *ctrl)
        return 0;
 }
 
-static int sr030pc30_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                             u32 *code)
+static int sr030pc30_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (!code || index >= ARRAY_SIZE(sr030pc30_formats))
+       if (!code || code->pad ||
+           code->index >= ARRAY_SIZE(sr030pc30_formats))
                return -EINVAL;
 
-       *code = sr030pc30_formats[index].code;
+       code->code = sr030pc30_formats[code->index].code;
        return 0;
 }
 
@@ -640,12 +642,16 @@ static const struct v4l2_subdev_video_ops sr030pc30_video_ops = {
        .g_mbus_fmt     = sr030pc30_g_fmt,
        .s_mbus_fmt     = sr030pc30_s_fmt,
        .try_mbus_fmt   = sr030pc30_try_fmt,
-       .enum_mbus_fmt  = sr030pc30_enum_fmt,
+};
+
+static const struct v4l2_subdev_pad_ops sr030pc30_pad_ops = {
+       .enum_mbus_code = sr030pc30_enum_mbus_code,
 };
 
 static const struct v4l2_subdev_ops sr030pc30_ops = {
        .core   = &sr030pc30_core_ops,
        .video  = &sr030pc30_video_ops,
+       .pad    = &sr030pc30_pad_ops,
 };
 
 /*
index 1c6bc306ecdcbf93489dd00d5cde6c5b410d7a72..a822d1541614b22c5e677d5170f2b819423649d7 100644 (file)
@@ -746,25 +746,6 @@ static int tvp514x_s_ctrl(struct v4l2_ctrl *ctrl)
        return err;
 }
 
-/**
- * tvp514x_enum_mbus_fmt() - V4L2 decoder interface handler for enum_mbus_fmt
- * @sd: pointer to standard V4L2 sub-device structure
- * @index: index of pixelcode to retrieve
- * @code: receives the pixelcode
- *
- * Enumerates supported mediabus formats
- */
-static int
-tvp514x_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index,
-                                       u32 *code)
-{
-       if (index)
-               return -EINVAL;
-
-       *code = MEDIA_BUS_FMT_YUYV10_2X10;
-       return 0;
-}
-
 /**
  * tvp514x_mbus_fmt() - V4L2 decoder interface handler for try/s/g_mbus_fmt
  * @sd: pointer to standard V4L2 sub-device structure
@@ -1016,7 +997,6 @@ static const struct v4l2_subdev_video_ops tvp514x_video_ops = {
        .s_std = tvp514x_s_std,
        .s_routing = tvp514x_s_routing,
        .querystd = tvp514x_querystd,
-       .enum_mbus_fmt = tvp514x_enum_mbus_fmt,
        .g_mbus_fmt = tvp514x_mbus_fmt,
        .try_mbus_fmt = tvp514x_mbus_fmt,
        .s_mbus_fmt = tvp514x_mbus_fmt,
index 68cdab9c0903fb8efaa0c6d6cfefccaf1e5a0bb3..f2f87b73184c4f3dad117c2542e4f5f0fa4cb82f 100644 (file)
@@ -817,13 +817,14 @@ static v4l2_std_id tvp5150_read_std(struct v4l2_subdev *sd)
        }
 }
 
-static int tvp5150_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index,
-                                               u32 *code)
+static int tvp5150_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index)
+       if (code->pad || code->index)
                return -EINVAL;
 
-       *code = MEDIA_BUS_FMT_UYVY8_2X8;
+       code->code = MEDIA_BUS_FMT_UYVY8_2X8;
        return 0;
 }
 
@@ -1068,7 +1069,6 @@ static const struct v4l2_subdev_tuner_ops tvp5150_tuner_ops = {
 static const struct v4l2_subdev_video_ops tvp5150_video_ops = {
        .s_std = tvp5150_s_std,
        .s_routing = tvp5150_s_routing,
-       .enum_mbus_fmt = tvp5150_enum_mbus_fmt,
        .s_mbus_fmt = tvp5150_mbus_fmt,
        .try_mbus_fmt = tvp5150_mbus_fmt,
        .g_mbus_fmt = tvp5150_mbus_fmt,
@@ -1084,11 +1084,16 @@ static const struct v4l2_subdev_vbi_ops tvp5150_vbi_ops = {
        .s_raw_fmt = tvp5150_s_raw_fmt,
 };
 
+static const struct v4l2_subdev_pad_ops tvp5150_pad_ops = {
+       .enum_mbus_code = tvp5150_enum_mbus_code,
+};
+
 static const struct v4l2_subdev_ops tvp5150_ops = {
        .core = &tvp5150_core_ops,
        .tuner = &tvp5150_tuner_ops,
        .video = &tvp5150_video_ops,
        .vbi = &tvp5150_vbi_ops,
+       .pad = &tvp5150_pad_ops,
 };
 
 
index 787cdfb0874959c99ad9f662395964fb6c404e4c..d21fa1a62e41c604b93807ea820cd15bde46f10b 100644 (file)
@@ -746,25 +746,6 @@ static int tvp7002_s_register(struct v4l2_subdev *sd,
 }
 #endif
 
-/*
- * tvp7002_enum_mbus_fmt() - Enum supported mediabus formats
- * @sd: pointer to standard V4L2 sub-device structure
- * @index: format index
- * @code: pointer to mediabus format
- *
- * Enumerate supported mediabus formats.
- */
-
-static int tvp7002_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index,
-                                       u32 *code)
-{
-       /* Check requested format index is within range */
-       if (index)
-               return -EINVAL;
-       *code = MEDIA_BUS_FMT_YUYV10_1X20;
-       return 0;
-}
-
 /*
  * tvp7002_s_stream() - V4L2 decoder i/f handler for s_stream
  * @sd: pointer to standard V4L2 sub-device structure
@@ -927,7 +908,6 @@ static const struct v4l2_subdev_video_ops tvp7002_video_ops = {
        .g_mbus_fmt = tvp7002_mbus_fmt,
        .try_mbus_fmt = tvp7002_mbus_fmt,
        .s_mbus_fmt = tvp7002_mbus_fmt,
-       .enum_mbus_fmt = tvp7002_enum_mbus_fmt,
 };
 
 /* media pad related operation handlers */
index 00e7f043977ed933fb7524db85260590d7df8842..b1d0a1b28ca86ddbc56e3a2a644c7ca104925ba4 100644 (file)
@@ -557,13 +557,14 @@ static int vs6624_s_ctrl(struct v4l2_ctrl *ctrl)
        return 0;
 }
 
-static int vs6624_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index,
-                               u32 *code)
+static int vs6624_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (index >= ARRAY_SIZE(vs6624_formats))
+       if (code->pad || code->index >= ARRAY_SIZE(vs6624_formats))
                return -EINVAL;
 
-       *code = vs6624_formats[index].mbus_code;
+       code->code = vs6624_formats[code->index].mbus_code;
        return 0;
 }
 
@@ -738,7 +739,6 @@ static const struct v4l2_subdev_core_ops vs6624_core_ops = {
 };
 
 static const struct v4l2_subdev_video_ops vs6624_video_ops = {
-       .enum_mbus_fmt = vs6624_enum_mbus_fmt,
        .try_mbus_fmt = vs6624_try_mbus_fmt,
        .s_mbus_fmt = vs6624_s_mbus_fmt,
        .g_mbus_fmt = vs6624_g_mbus_fmt,
@@ -747,9 +747,14 @@ static const struct v4l2_subdev_video_ops vs6624_video_ops = {
        .s_stream = vs6624_s_stream,
 };
 
+static const struct v4l2_subdev_pad_ops vs6624_pad_ops = {
+       .enum_mbus_code = vs6624_enum_mbus_code,
+};
+
 static const struct v4l2_subdev_ops vs6624_ops = {
        .core = &vs6624_core_ops,
        .video = &vs6624_video_ops,
+       .pad = &vs6624_pad_ops,
 };
 
 static int vs6624_probe(struct i2c_client *client,
index 6a437f86dcdc61b55fd2cb0d59187ca381ae4d08..6ea11b1e755e60905d4214cb99e48a4f962df5b1 100644 (file)
@@ -156,14 +156,18 @@ static struct bcap_buffer *to_bcap_vb(struct vb2_buffer *vb)
 
 static int bcap_init_sensor_formats(struct bcap_device *bcap_dev)
 {
-       u32 code;
+       struct v4l2_subdev_mbus_code_enum code = {
+               .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+       };
        struct bcap_format *sf;
        unsigned int num_formats = 0;
        int i, j;
 
-       while (!v4l2_subdev_call(bcap_dev->sd, video,
-                               enum_mbus_fmt, num_formats, &code))
+       while (!v4l2_subdev_call(bcap_dev->sd, pad,
+                               enum_mbus_code, NULL, &code)) {
                num_formats++;
+               code.index++;
+       }
        if (!num_formats)
                return -ENXIO;
 
@@ -172,10 +176,11 @@ static int bcap_init_sensor_formats(struct bcap_device *bcap_dev)
                return -ENOMEM;
 
        for (i = 0; i < num_formats; i++) {
-               v4l2_subdev_call(bcap_dev->sd, video,
-                               enum_mbus_fmt, i, &code);
+               code.index = i;
+               v4l2_subdev_call(bcap_dev->sd, pad,
+                               enum_mbus_code, NULL, &code);
                for (j = 0; j < BCAP_MAX_FMTS; j++)
-                       if (code == bcap_formats[j].mbus_code)
+                       if (code.code == bcap_formats[j].mbus_code)
                                break;
                if (j == BCAP_MAX_FMTS) {
                        /* we don't allow this sensor working with our bridge */
index c835beb2a1a8f30e14f48a34566b842dbdce96cf..cbb7e22cab40c7176bb06dea4c62b13aaf008577 100644 (file)
@@ -648,19 +648,22 @@ static int isi_camera_get_formats(struct soc_camera_device *icd,
        struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
        int formats = 0, ret;
        /* sensor format */
-       u32 code;
+       struct v4l2_subdev_mbus_code_enum code = {
+               .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+               .index = idx,
+       };
        /* soc camera host format */
        const struct soc_mbus_pixelfmt *fmt;
 
-       ret = v4l2_subdev_call(sd, video, enum_mbus_fmt, idx, &code);
+       ret = v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code);
        if (ret < 0)
                /* No more formats */
                return 0;
 
-       fmt = soc_mbus_get_fmtdesc(code);
+       fmt = soc_mbus_get_fmtdesc(code.code);
        if (!fmt) {
                dev_err(icd->parent,
-                       "Invalid format code #%u: %d\n", idx, code);
+                       "Invalid format code #%u: %d\n", idx, code.code);
                return 0;
        }
 
@@ -672,7 +675,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd,
                return 0;
        }
 
-       switch (code) {
+       switch (code.code) {
        case MEDIA_BUS_FMT_UYVY8_2X8:
        case MEDIA_BUS_FMT_VYUY8_2X8:
        case MEDIA_BUS_FMT_YUYV8_2X8:
@@ -680,10 +683,10 @@ static int isi_camera_get_formats(struct soc_camera_device *icd,
                formats++;
                if (xlate) {
                        xlate->host_fmt = &isi_camera_formats[0];
-                       xlate->code     = code;
+                       xlate->code     = code.code;
                        xlate++;
                        dev_dbg(icd->parent, "Providing format %s using code %d\n",
-                               isi_camera_formats[0].name, code);
+                               isi_camera_formats[0].name, code.code);
                }
                break;
        default:
@@ -699,7 +702,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd,
        formats++;
        if (xlate) {
                xlate->host_fmt = fmt;
-               xlate->code     = code;
+               xlate->code     = code.code;
                xlate++;
        }
 
index 192377f55840b540e82ab26658830457b858f98f..b891b7f2b7e9d52e11a11c7a7eadec7dc8c269a7 100644 (file)
@@ -943,22 +943,25 @@ static int mx2_camera_get_formats(struct soc_camera_device *icd,
        struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
        const struct soc_mbus_pixelfmt *fmt;
        struct device *dev = icd->parent;
-       u32 code;
+       struct v4l2_subdev_mbus_code_enum code = {
+               .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+               .index = idx,
+       };
        int ret, formats = 0;
 
-       ret = v4l2_subdev_call(sd, video, enum_mbus_fmt, idx, &code);
+       ret = v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code);
        if (ret < 0)
                /* no more formats */
                return 0;
 
-       fmt = soc_mbus_get_fmtdesc(code);
+       fmt = soc_mbus_get_fmtdesc(code.code);
        if (!fmt) {
-               dev_err(dev, "Invalid format code #%u: %d\n", idx, code);
+               dev_err(dev, "Invalid format code #%u: %d\n", idx, code.code);
                return 0;
        }
 
-       if (code == MEDIA_BUS_FMT_YUYV8_2X8 ||
-           code == MEDIA_BUS_FMT_UYVY8_2X8) {
+       if (code.code == MEDIA_BUS_FMT_YUYV8_2X8 ||
+           code.code == MEDIA_BUS_FMT_UYVY8_2X8) {
                formats++;
                if (xlate) {
                        /*
@@ -967,21 +970,21 @@ static int mx2_camera_get_formats(struct soc_camera_device *icd,
                         */
                        xlate->host_fmt =
                                soc_mbus_get_fmtdesc(MEDIA_BUS_FMT_YUYV8_1_5X8);
-                       xlate->code     = code;
+                       xlate->code     = code.code;
                        dev_dbg(dev, "Providing host format %s for sensor code %d\n",
-                              xlate->host_fmt->name, code);
+                              xlate->host_fmt->name, code.code);
                        xlate++;
                }
        }
 
-       if (code == MEDIA_BUS_FMT_UYVY8_2X8) {
+       if (code.code == MEDIA_BUS_FMT_UYVY8_2X8) {
                formats++;
                if (xlate) {
                        xlate->host_fmt =
                                soc_mbus_get_fmtdesc(MEDIA_BUS_FMT_YUYV8_2X8);
-                       xlate->code     = code;
+                       xlate->code     = code.code;
                        dev_dbg(dev, "Providing host format %s for sensor code %d\n",
-                               xlate->host_fmt->name, code);
+                               xlate->host_fmt->name, code.code);
                        xlate++;
                }
        }
@@ -990,7 +993,7 @@ static int mx2_camera_get_formats(struct soc_camera_device *icd,
        formats++;
        if (xlate) {
                xlate->host_fmt = fmt;
-               xlate->code     = code;
+               xlate->code     = code.code;
                xlate++;
        }
        return formats;
index 3435fd2ca8ecd2d56f06386375556efb0e2d0c3b..a29848976f92a7e9c4e35d35ee4954852ece3043 100644 (file)
@@ -659,18 +659,21 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, unsigned int id
        struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
        struct device *dev = icd->parent;
        int formats = 0, ret;
-       u32 code;
+       struct v4l2_subdev_mbus_code_enum code = {
+               .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+               .index = idx,
+       };
        const struct soc_mbus_pixelfmt *fmt;
 
-       ret = v4l2_subdev_call(sd, video, enum_mbus_fmt, idx, &code);
+       ret = v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code);
        if (ret < 0)
                /* No more formats */
                return 0;
 
-       fmt = soc_mbus_get_fmtdesc(code);
+       fmt = soc_mbus_get_fmtdesc(code.code);
        if (!fmt) {
                dev_warn(icd->parent,
-                        "Unsupported format code #%u: 0x%x\n", idx, code);
+                        "Unsupported format code #%u: 0x%x\n", idx, code.code);
                return 0;
        }
 
@@ -679,25 +682,25 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, unsigned int id
        if (ret < 0)
                return 0;
 
-       switch (code) {
+       switch (code.code) {
        case MEDIA_BUS_FMT_SBGGR10_1X10:
                formats++;
                if (xlate) {
                        xlate->host_fmt = &mx3_camera_formats[0];
-                       xlate->code     = code;
+                       xlate->code     = code.code;
                        xlate++;
                        dev_dbg(dev, "Providing format %s using code 0x%x\n",
-                               mx3_camera_formats[0].name, code);
+                               mx3_camera_formats[0].name, code.code);
                }
                break;
        case MEDIA_BUS_FMT_Y10_1X10:
                formats++;
                if (xlate) {
                        xlate->host_fmt = &mx3_camera_formats[1];
-                       xlate->code     = code;
+                       xlate->code     = code.code;
                        xlate++;
                        dev_dbg(dev, "Providing format %s using code 0x%x\n",
-                               mx3_camera_formats[1].name, code);
+                               mx3_camera_formats[1].name, code.code);
                }
                break;
        default:
@@ -709,7 +712,7 @@ static int mx3_camera_get_formats(struct soc_camera_device *icd, unsigned int id
        formats++;
        if (xlate) {
                xlate->host_fmt = fmt;
-               xlate->code     = code;
+               xlate->code     = code.code;
                dev_dbg(dev, "Providing format %c%c%c%c in pass-through mode\n",
                        (fmt->fourcc >> (0*8)) & 0xFF,
                        (fmt->fourcc >> (1*8)) & 0xFF,
index 16f65ecb70a3e1fdf13d49cf002d2801559b83d5..3f250767d162fe5755c9345e963611b7e5fdf847 100644 (file)
@@ -1068,18 +1068,21 @@ static int omap1_cam_get_formats(struct soc_camera_device *icd,
        struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
        struct device *dev = icd->parent;
        int formats = 0, ret;
-       u32 code;
+       struct v4l2_subdev_mbus_code_enum code = {
+               .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+               .index = idx,
+       };
        const struct soc_mbus_pixelfmt *fmt;
 
-       ret = v4l2_subdev_call(sd, video, enum_mbus_fmt, idx, &code);
+       ret = v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code);
        if (ret < 0)
                /* No more formats */
                return 0;
 
-       fmt = soc_mbus_get_fmtdesc(code);
+       fmt = soc_mbus_get_fmtdesc(code.code);
        if (!fmt) {
                dev_warn(dev, "%s: unsupported format code #%d: %d\n", __func__,
-                               idx, code);
+                               idx, code.code);
                return 0;
        }
 
@@ -1087,7 +1090,7 @@ static int omap1_cam_get_formats(struct soc_camera_device *icd,
        if (fmt->bits_per_sample != 8)
                return 0;
 
-       switch (code) {
+       switch (code.code) {
        case MEDIA_BUS_FMT_YUYV8_2X8:
        case MEDIA_BUS_FMT_YVYU8_2X8:
        case MEDIA_BUS_FMT_UYVY8_2X8:
@@ -1098,14 +1101,14 @@ static int omap1_cam_get_formats(struct soc_camera_device *icd,
        case MEDIA_BUS_FMT_RGB565_2X8_LE:
                formats++;
                if (xlate) {
-                       xlate->host_fmt = soc_mbus_find_fmtdesc(code,
+                       xlate->host_fmt = soc_mbus_find_fmtdesc(code.code,
                                                omap1_cam_formats,
                                                ARRAY_SIZE(omap1_cam_formats));
-                       xlate->code     = code;
+                       xlate->code     = code.code;
                        xlate++;
                        dev_dbg(dev,
                                "%s: providing format %s as byte swapped code #%d\n",
-                               __func__, xlate->host_fmt->name, code);
+                               __func__, xlate->host_fmt->name, code.code);
                }
        default:
                if (xlate)
@@ -1116,7 +1119,7 @@ static int omap1_cam_get_formats(struct soc_camera_device *icd,
        formats++;
        if (xlate) {
                xlate->host_fmt = fmt;
-               xlate->code     = code;
+               xlate->code     = code.code;
                xlate++;
        }
 
index 8d6e343fec0f28bf1dcc67d0ce96ff48dc6f7250..f6fa0acc525107335b45895019e30c6748cbe474 100644 (file)
@@ -1253,17 +1253,20 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, unsigned int id
        struct device *dev = icd->parent;
        int formats = 0, ret;
        struct pxa_cam *cam;
-       u32 code;
+       struct v4l2_subdev_mbus_code_enum code = {
+               .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+               .index = idx,
+       };
        const struct soc_mbus_pixelfmt *fmt;
 
-       ret = v4l2_subdev_call(sd, video, enum_mbus_fmt, idx, &code);
+       ret = v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code);
        if (ret < 0)
                /* No more formats */
                return 0;
 
-       fmt = soc_mbus_get_fmtdesc(code);
+       fmt = soc_mbus_get_fmtdesc(code.code);
        if (!fmt) {
-               dev_err(dev, "Invalid format code #%u: %d\n", idx, code);
+               dev_err(dev, "Invalid format code #%u: %d\n", idx, code.code);
                return 0;
        }
 
@@ -1282,15 +1285,15 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, unsigned int id
                cam = icd->host_priv;
        }
 
-       switch (code) {
+       switch (code.code) {
        case MEDIA_BUS_FMT_UYVY8_2X8:
                formats++;
                if (xlate) {
                        xlate->host_fmt = &pxa_camera_formats[0];
-                       xlate->code     = code;
+                       xlate->code     = code.code;
                        xlate++;
                        dev_dbg(dev, "Providing format %s using code %d\n",
-                               pxa_camera_formats[0].name, code);
+                               pxa_camera_formats[0].name, code.code);
                }
        case MEDIA_BUS_FMT_VYUY8_2X8:
        case MEDIA_BUS_FMT_YUYV8_2X8:
@@ -1314,7 +1317,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, unsigned int id
        formats++;
        if (xlate) {
                xlate->host_fmt = fmt;
-               xlate->code     = code;
+               xlate->code     = code.code;
                xlate++;
        }
 
index 9351f64dee7b4fcfb3e03368022eade6dea8f73e..8796bdce671f3f07f4926db8cd510b872d5b83b8 100644 (file)
@@ -1318,16 +1318,19 @@ static int rcar_vin_get_formats(struct soc_camera_device *icd, unsigned int idx,
        int ret, k, n;
        int formats = 0;
        struct rcar_vin_cam *cam;
-       u32 code;
+       struct v4l2_subdev_mbus_code_enum code = {
+               .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+               .index = idx,
+       };
        const struct soc_mbus_pixelfmt *fmt;
 
-       ret = v4l2_subdev_call(sd, video, enum_mbus_fmt, idx, &code);
+       ret = v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code);
        if (ret < 0)
                return 0;
 
-       fmt = soc_mbus_get_fmtdesc(code);
+       fmt = soc_mbus_get_fmtdesc(code.code);
        if (!fmt) {
-               dev_warn(dev, "unsupported format code #%u: %d\n", idx, code);
+               dev_warn(dev, "unsupported format code #%u: %d\n", idx, code.code);
                return 0;
        }
 
@@ -1408,7 +1411,7 @@ static int rcar_vin_get_formats(struct soc_camera_device *icd, unsigned int idx,
        if (!idx)
                cam->extra_fmt = NULL;
 
-       switch (code) {
+       switch (code.code) {
        case MEDIA_BUS_FMT_YUYV8_1X16:
        case MEDIA_BUS_FMT_YUYV8_2X8:
        case MEDIA_BUS_FMT_YUYV10_2X10:
@@ -1422,9 +1425,9 @@ static int rcar_vin_get_formats(struct soc_camera_device *icd, unsigned int idx,
                formats += n;
                for (k = 0; xlate && k < n; k++, xlate++) {
                        xlate->host_fmt = &rcar_vin_formats[k];
-                       xlate->code = code;
+                       xlate->code = code.code;
                        dev_dbg(dev, "Providing format %s using code %d\n",
-                               rcar_vin_formats[k].name, code);
+                               rcar_vin_formats[k].name, code.code);
                }
                break;
        default:
@@ -1440,7 +1443,7 @@ static int rcar_vin_get_formats(struct soc_camera_device *icd, unsigned int idx,
        formats++;
        if (xlate) {
                xlate->host_fmt = fmt;
-               xlate->code = code;
+               xlate->code = code.code;
                xlate++;
        }
 
index 9ce202f539344a07378b168285a2ab55e413f844..b4faf8f1fd15e3237b805815e9b24c92244e3a77 100644 (file)
@@ -1048,17 +1048,20 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int
        int ret, k, n;
        int formats = 0;
        struct sh_mobile_ceu_cam *cam;
-       u32 code;
+       struct v4l2_subdev_mbus_code_enum code = {
+               .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+               .index = idx,
+       };
        const struct soc_mbus_pixelfmt *fmt;
 
-       ret = v4l2_subdev_call(sd, video, enum_mbus_fmt, idx, &code);
+       ret = v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code);
        if (ret < 0)
                /* No more formats */
                return 0;
 
-       fmt = soc_mbus_get_fmtdesc(code);
+       fmt = soc_mbus_get_fmtdesc(code.code);
        if (!fmt) {
-               dev_warn(dev, "unsupported format code #%u: %d\n", idx, code);
+               dev_warn(dev, "unsupported format code #%u: %d\n", idx, code.code);
                return 0;
        }
 
@@ -1140,7 +1143,7 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int
        if (!idx)
                cam->extra_fmt = NULL;
 
-       switch (code) {
+       switch (code.code) {
        case MEDIA_BUS_FMT_UYVY8_2X8:
        case MEDIA_BUS_FMT_VYUY8_2X8:
        case MEDIA_BUS_FMT_YUYV8_2X8:
@@ -1163,10 +1166,10 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int
                formats += n;
                for (k = 0; xlate && k < n; k++) {
                        xlate->host_fmt = &sh_mobile_ceu_formats[k];
-                       xlate->code     = code;
+                       xlate->code     = code.code;
                        xlate++;
                        dev_dbg(dev, "Providing format %s using code %d\n",
-                               sh_mobile_ceu_formats[k].name, code);
+                               sh_mobile_ceu_formats[k].name, code.code);
                }
                break;
        default:
@@ -1178,7 +1181,7 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int
        formats++;
        if (xlate) {
                xlate->host_fmt = fmt;
-               xlate->code     = code;
+               xlate->code     = code.code;
                xlate++;
                dev_dbg(dev, "Providing format %s in pass-through mode\n",
                        fmt->name);
index 7bfe7665687fadd6e33bc0e22903c365e6d95480..7fd49cb009d3295ebf605c22393ca4f8d2052eb7 100644 (file)
@@ -484,10 +484,14 @@ static int soc_camera_init_user_formats(struct soc_camera_device *icd)
        struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
        unsigned int i, fmts = 0, raw_fmts = 0;
        int ret;
-       u32 code;
+       struct v4l2_subdev_mbus_code_enum code = {
+               .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+       };
 
-       while (!v4l2_subdev_call(sd, video, enum_mbus_fmt, raw_fmts, &code))
+       while (!v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code)) {
                raw_fmts++;
+               code.index++;
+       }
 
        if (!ici->ops->get_formats)
                /*
@@ -521,11 +525,12 @@ static int soc_camera_init_user_formats(struct soc_camera_device *icd)
        fmts = 0;
        for (i = 0; i < raw_fmts; i++)
                if (!ici->ops->get_formats) {
-                       v4l2_subdev_call(sd, video, enum_mbus_fmt, i, &code);
+                       code.index = i;
+                       v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code);
                        icd->user_formats[fmts].host_fmt =
-                               soc_mbus_get_fmtdesc(code);
+                               soc_mbus_get_fmtdesc(code.code);
                        if (icd->user_formats[fmts].host_fmt)
-                               icd->user_formats[fmts++].code = code;
+                               icd->user_formats[fmts++].code = code.code;
                } else {
                        ret = ici->ops->get_formats(icd, i,
                                                    &icd->user_formats[fmts]);
index f535910b4187dbc006e104399b2c1dee30aa97a0..934b9183cea8d8078450a0652de6c1e9911839be 100644 (file)
@@ -61,15 +61,16 @@ static struct v4l2_subdev_core_ops platform_subdev_core_ops = {
        .s_power = soc_camera_platform_s_power,
 };
 
-static int soc_camera_platform_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-                                       u32 *code)
+static int soc_camera_platform_enum_mbus_code(struct v4l2_subdev *sd,
+               struct v4l2_subdev_pad_config *cfg,
+               struct v4l2_subdev_mbus_code_enum *code)
 {
        struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
 
-       if (index)
+       if (code->pad || code->index)
                return -EINVAL;
 
-       *code = p->format.code;
+       code->code = p->format.code;
        return 0;
 }
 
@@ -117,7 +118,6 @@ static int soc_camera_platform_g_mbus_config(struct v4l2_subdev *sd,
 
 static struct v4l2_subdev_video_ops platform_subdev_video_ops = {
        .s_stream       = soc_camera_platform_s_stream,
-       .enum_mbus_fmt  = soc_camera_platform_enum_fmt,
        .cropcap        = soc_camera_platform_cropcap,
        .g_crop         = soc_camera_platform_g_crop,
        .try_mbus_fmt   = soc_camera_platform_fill_fmt,
@@ -126,9 +126,14 @@ static struct v4l2_subdev_video_ops platform_subdev_video_ops = {
        .g_mbus_config  = soc_camera_platform_g_mbus_config,
 };
 
+static const struct v4l2_subdev_pad_ops platform_subdev_pad_ops = {
+       .enum_mbus_code = soc_camera_platform_enum_mbus_code,
+};
+
 static struct v4l2_subdev_ops platform_subdev_ops = {
        .core   = &platform_subdev_core_ops,
        .video  = &platform_subdev_video_ops,
+       .pad    = &platform_subdev_pad_ops,
 };
 
 static int soc_camera_platform_probe(struct platform_device *pdev)
index 2f0a345a7fed1b897117603dcc598d5de5b94194..c2eed99ebc7889de113a8b1ef56a23bfbb9f336b 100644 (file)
@@ -293,8 +293,6 @@ struct v4l2_mbus_frame_desc {
 
    g_dv_timings(): Get custom dv timings in the sub device.
 
-   enum_mbus_fmt: enumerate pixel formats, provided by a video data source
-
    g_mbus_fmt: get the current pixel format, provided by a video data source
 
    try_mbus_fmt: try to set a pixel format on a video data source
@@ -338,8 +336,6 @@ struct v4l2_subdev_video_ops {
                        struct v4l2_dv_timings *timings);
        int (*query_dv_timings)(struct v4l2_subdev *sd,
                        struct v4l2_dv_timings *timings);
-       int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index,
-                            u32 *code);
        int (*g_mbus_fmt)(struct v4l2_subdev *sd,
                          struct v4l2_mbus_framefmt *fmt);
        int (*try_mbus_fmt)(struct v4l2_subdev *sd,