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;
 }
 
        .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,
 };
 
 /* ----------------------------------------------------------------------- */
 
        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;
 }
 
        .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,
 };
 
 /* ----------------------------------------------------------------------- */
 
        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;
 }
 
        .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,
 
        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;
 }
 
        .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,
        .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 = {
 
        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;
 }
 
        .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,
 
        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;
 }
        .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,
 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)
 
        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;
 }
 
 };
 
 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,
 };
 
 
 
 }
 
 
-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;
 }
 
 };
 
 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,
 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 = {
 
        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;
 }
 
        .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,
        .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)
 
        .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;
 }
 
        .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,
 };
        .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,
 
 #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;
 }
 
        .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,
 };
 
 /*
 
 #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;
 }
 
        .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,
 };
        .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,
 
        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;
 }
        .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)
 
        .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;
 }
 
        .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,
 };
        .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,
 
        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;
 }
 
        .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 */
 
        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;
 }
 
        .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
 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)
 
        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;
 }
 
        .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,
        .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,
 };
 
 /*
 
        .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;
 }
 
        .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,
 };
 
 /*
 
        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;
 }
 
        .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,
 };
 
 /*
 
        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;
 }
        .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,
 #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 = {
 
        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;
 }
 
        .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,
        .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,
 };
 
 /*
 
        .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;
 }
 
        .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,
 };
 
 /*
 
        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;
 }
 
        .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,
 };
 
 /*
 
        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
        .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,
 
        }
 }
 
-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;
 }
 
 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,
        .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,
 };
 
 
 
 }
 #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
        .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 */
 
        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;
 }
 
 };
 
 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,
        .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,
 
 
 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;
 
                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 */
 
        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;
        }
 
                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:
                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:
        formats++;
        if (xlate) {
                xlate->host_fmt = fmt;
-               xlate->code     = code;
+               xlate->code     = code.code;
                xlate++;
        }
 
 
        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) {
                        /*
                         */
                        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++;
                }
        }
        formats++;
        if (xlate) {
                xlate->host_fmt = fmt;
-               xlate->code     = code;
+               xlate->code     = code.code;
                xlate++;
        }
        return formats;
 
        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;
        }
 
        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:
        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,
 
        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;
        }
 
        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:
        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)
        formats++;
        if (xlate) {
                xlate->host_fmt = fmt;
-               xlate->code     = code;
+               xlate->code     = code.code;
                xlate++;
        }
 
 
        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;
        }
 
                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:
        formats++;
        if (xlate) {
                xlate->host_fmt = fmt;
-               xlate->code     = code;
+               xlate->code     = code.code;
                xlate++;
        }
 
 
        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;
        }
 
        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:
                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:
        formats++;
        if (xlate) {
                xlate->host_fmt = fmt;
-               xlate->code = code;
+               xlate->code = code.code;
                xlate++;
        }
 
 
        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;
        }
 
        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:
                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:
        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);
 
        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)
                /*
        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]);
 
        .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;
 }
 
 
 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,
        .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)
 
 
    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
                        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,