Merge tag 'regulator-v4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
[cascardo/linux.git] / drivers / media / dvb-frontends / au8522_decoder.c
index c8f13d8..73612c5 100644 (file)
@@ -730,6 +730,9 @@ static int au8522_probe(struct i2c_client *client,
        struct v4l2_ctrl_handler *hdl;
        struct v4l2_subdev *sd;
        int instance;
+#ifdef CONFIG_MEDIA_CONTROLLER
+       int ret;
+#endif
 
        /* Check if the adapter supports the needed features */
        if (!i2c_check_functionality(client->adapter,
@@ -758,6 +761,20 @@ static int au8522_probe(struct i2c_client *client,
 
        sd = &state->sd;
        v4l2_i2c_subdev_init(sd, client, &au8522_ops);
+#if defined(CONFIG_MEDIA_CONTROLLER)
+
+       state->pads[AU8522_PAD_INPUT].flags = MEDIA_PAD_FL_SINK;
+       state->pads[AU8522_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
+       state->pads[AU8522_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;
+       sd->entity.function = MEDIA_ENT_F_ATV_DECODER;
+
+       ret = media_entity_pads_init(&sd->entity, ARRAY_SIZE(state->pads),
+                               state->pads);
+       if (ret < 0) {
+               v4l_info(client, "failed to initialize media entity!\n");
+               return ret;
+       }
+#endif
 
        hdl = &state->hdl;
        v4l2_ctrl_handler_init(hdl, 4);