aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2009-01-30 20:21:45 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:38 -0400
commite474200d3502d4cb3cc240930640c7d857bf777b (patch)
treebbca341c15a59e973901ab323f0339b3a2b21598
parent49796e4059b40032f3dba0fa5ad559ef4b977e89 (diff)
V4L/DVB (10433): cx18: Defer A/V core initialization until a valid cx18_av_cmd arrives
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/cx18/cx18-av-core.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c
index 780125002cbc..db887a008626 100644
--- a/drivers/media/video/cx18/cx18-av-core.c
+++ b/drivers/media/video/cx18/cx18-av-core.c
@@ -680,19 +680,45 @@ static int set_v4lfmt(struct cx18 *cx, struct v4l2_format *fmt)
680 680
681/* ----------------------------------------------------------------------- */ 681/* ----------------------------------------------------------------------- */
682 682
683static int valid_av_cmd(unsigned int cmd)
684{
685 switch (cmd) {
686 /* All commands supported by cx18_av_cmd() */
687 case VIDIOC_INT_DECODE_VBI_LINE:
688 case VIDIOC_INT_AUDIO_CLOCK_FREQ:
689 case VIDIOC_STREAMON:
690 case VIDIOC_STREAMOFF:
691 case VIDIOC_LOG_STATUS:
692 case VIDIOC_G_CTRL:
693 case VIDIOC_S_CTRL:
694 case VIDIOC_QUERYCTRL:
695 case VIDIOC_G_STD:
696 case VIDIOC_S_STD:
697 case AUDC_SET_RADIO:
698 case VIDIOC_INT_G_VIDEO_ROUTING:
699 case VIDIOC_INT_S_VIDEO_ROUTING:
700 case VIDIOC_INT_G_AUDIO_ROUTING:
701 case VIDIOC_INT_S_AUDIO_ROUTING:
702 case VIDIOC_S_FREQUENCY:
703 case VIDIOC_G_TUNER:
704 case VIDIOC_S_TUNER:
705 case VIDIOC_G_FMT:
706 case VIDIOC_S_FMT:
707 case VIDIOC_INT_RESET:
708 return 1;
709 default:
710 return 0;
711 }
712 return 0;
713}
714
683int cx18_av_cmd(struct cx18 *cx, unsigned int cmd, void *arg) 715int cx18_av_cmd(struct cx18 *cx, unsigned int cmd, void *arg)
684{ 716{
685 struct cx18_av_state *state = &cx->av_state; 717 struct cx18_av_state *state = &cx->av_state;
686 struct v4l2_tuner *vt = arg; 718 struct v4l2_tuner *vt = arg;
687 struct v4l2_routing *route = arg; 719 struct v4l2_routing *route = arg;
688 720
689 /* ignore these commands */ 721 if (!state->is_initialized && valid_av_cmd(cmd)) {
690 switch (cmd) {
691 case TUNER_SET_TYPE_ADDR:
692 return 0;
693 }
694
695 if (!state->is_initialized) {
696 CX18_DEBUG_INFO("cmd %08x triggered fw load\n", cmd); 722 CX18_DEBUG_INFO("cmd %08x triggered fw load\n", cmd);
697 /* initialize on first use */ 723 /* initialize on first use */
698 state->is_initialized = 1; 724 state->is_initialized = 1;