[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>
This commit is contained in:
Mauro Carvalho Chehab 2015-01-03 12:44:40 -03:00
parent 172e9d3c88
commit 00a5a4bf7b
1 changed files with 20 additions and 0 deletions

View File

@ -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;