diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-01-03 10:44:40 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-02-13 18:10:14 -0500 |
commit | 00a5a4bf7bb40fe8cd5de042948b925c54b016de (patch) | |
tree | cd004da0eaae24785652ed581c06917c7e0cd744 | |
parent | 172e9d3c8840b6dd8141e491ee70392c42bbc635 (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>
-rw-r--r-- | drivers/media/v4l2-core/tuner-core.c | 20 |
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 { | |||
134 | unsigned int type; /* chip type id */ | 134 | unsigned int type; /* chip type id */ |
135 | void *config; | 135 | void *config; |
136 | const char *name; | 136 | const char *name; |
137 | #if defined(CONFIG_MEDIA_CONTROLLER) | ||
138 | struct media_pad pad; | ||
139 | #endif | ||
137 | }; | 140 | }; |
138 | 141 | ||
139 | /* | 142 | /* |
@@ -434,6 +437,8 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
434 | t->name = analog_ops->info.name; | 437 | t->name = analog_ops->info.name; |
435 | } | 438 | } |
436 | 439 | ||
440 | t->sd.entity.name = t->name; | ||
441 | |||
437 | tuner_dbg("type set to %s\n", t->name); | 442 | tuner_dbg("type set to %s\n", t->name); |
438 | 443 | ||
439 | t->mode_mask = new_mode_mask; | 444 | t->mode_mask = new_mode_mask; |
@@ -592,6 +597,9 @@ static int tuner_probe(struct i2c_client *client, | |||
592 | struct tuner *t; | 597 | struct tuner *t; |
593 | struct tuner *radio; | 598 | struct tuner *radio; |
594 | struct tuner *tv; | 599 | struct tuner *tv; |
600 | #ifdef CONFIG_MEDIA_CONTROLLER | ||
601 | int ret; | ||
602 | #endif | ||
595 | 603 | ||
596 | t = kzalloc(sizeof(struct tuner), GFP_KERNEL); | 604 | t = kzalloc(sizeof(struct tuner), GFP_KERNEL); |
597 | if (NULL == t) | 605 | if (NULL == t) |
@@ -684,6 +692,18 @@ static int tuner_probe(struct i2c_client *client, | |||
684 | 692 | ||
685 | /* Should be just before return */ | 693 | /* Should be just before return */ |
686 | register_client: | 694 | register_client: |
695 | #if defined(CONFIG_MEDIA_CONTROLLER) | ||
696 | t->pad.flags = MEDIA_PAD_FL_SOURCE; | ||
697 | t->sd.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_TUNER; | ||
698 | t->sd.entity.name = t->name; | ||
699 | |||
700 | ret = media_entity_init(&t->sd.entity, 1, &t->pad, 0); | ||
701 | if (ret < 0) { | ||
702 | tuner_err("failed to initialize media entity!\n"); | ||
703 | kfree(t); | ||
704 | return -ENODEV; | ||
705 | } | ||
706 | #endif | ||
687 | /* Sets a default mode */ | 707 | /* Sets a default mode */ |
688 | if (t->mode_mask & T_ANALOG_TV) | 708 | if (t->mode_mask & T_ANALOG_TV) |
689 | t->mode = V4L2_TUNER_ANALOG_TV; | 709 | t->mode = V4L2_TUNER_ANALOG_TV; |