summaryrefslogtreecommitdiff
path: root/drivers/media/v4l2-core/tuner-core.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-01-03 12:44:40 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-02-13 21:10:14 -0200
commit00a5a4bf7bb40fe8cd5de042948b925c54b016de (patch)
treecd004da0eaae24785652ed581c06917c7e0cd744 /drivers/media/v4l2-core/tuner-core.c
parent172e9d3c8840b6dd8141e491ee70392c42bbc635 (diff)
[media] tuner-core: properly initialize media controller subdev
Properly initialize tuner core subdev at the media controller. That requires a new subtype at the media controller API. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/v4l2-core/tuner-core.c')
-rw-r--r--drivers/media/v4l2-core/tuner-core.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/tuner-core.c b/drivers/media/v4l2-core/tuner-core.c
index 559f8372e2eb..9a83b27a7e8f 100644
--- a/drivers/media/v4l2-core/tuner-core.c
+++ b/drivers/media/v4l2-core/tuner-core.c
@@ -134,6 +134,9 @@ struct tuner {
unsigned int type; /* chip type id */
void *config;
const char *name;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ struct media_pad pad;
+#endif
};
/*
@@ -434,6 +437,8 @@ static void set_type(struct i2c_client *c, unsigned int type,
t->name = analog_ops->info.name;
}
+ t->sd.entity.name = t->name;
+
tuner_dbg("type set to %s\n", t->name);
t->mode_mask = new_mode_mask;
@@ -592,6 +597,9 @@ static int tuner_probe(struct i2c_client *client,
struct tuner *t;
struct tuner *radio;
struct tuner *tv;
+#ifdef CONFIG_MEDIA_CONTROLLER
+ int ret;
+#endif
t = kzalloc(sizeof(struct tuner), GFP_KERNEL);
if (NULL == t)
@@ -684,6 +692,18 @@ static int tuner_probe(struct i2c_client *client,
/* Should be just before return */
register_client:
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ t->pad.flags = MEDIA_PAD_FL_SOURCE;
+ t->sd.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_TUNER;
+ t->sd.entity.name = t->name;
+
+ ret = media_entity_init(&t->sd.entity, 1, &t->pad, 0);
+ if (ret < 0) {
+ tuner_err("failed to initialize media entity!\n");
+ kfree(t);
+ return -ENODEV;
+ }
+#endif
/* Sets a default mode */
if (t->mode_mask & T_ANALOG_TV)
t->mode = V4L2_TUNER_ANALOG_TV;