aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-04-02 10:26:22 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-04-06 20:44:27 -0400
commit5325b4272a53b43f55b82cc369c310c2fcacdca1 (patch)
treef2a1491de3d05901152e0e271c0cb5ce381884c2 /drivers/media/video/ivtv
parentc0ff29150d37615ac703802ab3edc775fd402491 (diff)
V4L/DVB (11380): v4l2-subdev: change s_routing prototype
It is no longer needed to use a struct pointer as argument, since v4l2_subdev doesn't require that ioctl-like approach anymore. Instead just pass the input, output and config (new!) arguments directly. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r--drivers/media/video/ivtv/ivtv-gpio.c16
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c10
-rw-r--r--drivers/media/video/ivtv/ivtv-routing.c66
3 files changed, 49 insertions, 43 deletions
diff --git a/drivers/media/video/ivtv/ivtv-gpio.c b/drivers/media/video/ivtv/ivtv-gpio.c
index 0dd5f53b731..ceb05bdcaf6 100644
--- a/drivers/media/video/ivtv/ivtv-gpio.c
+++ b/drivers/media/video/ivtv/ivtv-gpio.c
@@ -248,15 +248,16 @@ static int subdev_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
248 return 0; 248 return 0;
249} 249}
250 250
251static int subdev_s_audio_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) 251static int subdev_s_audio_routing(struct v4l2_subdev *sd,
252 u32 input, u32 output, u32 config)
252{ 253{
253 struct ivtv *itv = sd_to_ivtv(sd); 254 struct ivtv *itv = sd_to_ivtv(sd);
254 u16 mask, data; 255 u16 mask, data;
255 256
256 if (route->input > 2) 257 if (input > 2)
257 return -EINVAL; 258 return -EINVAL;
258 mask = itv->card->gpio_audio_input.mask; 259 mask = itv->card->gpio_audio_input.mask;
259 switch (route->input) { 260 switch (input) {
260 case 0: 261 case 0:
261 data = itv->card->gpio_audio_input.tuner; 262 data = itv->card->gpio_audio_input.tuner;
262 break; 263 break;
@@ -318,17 +319,18 @@ static int subdev_log_status(struct v4l2_subdev *sd)
318 return 0; 319 return 0;
319} 320}
320 321
321static int subdev_s_video_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) 322static int subdev_s_video_routing(struct v4l2_subdev *sd,
323 u32 input, u32 output, u32 config)
322{ 324{
323 struct ivtv *itv = sd_to_ivtv(sd); 325 struct ivtv *itv = sd_to_ivtv(sd);
324 u16 mask, data; 326 u16 mask, data;
325 327
326 if (route->input > 2) /* 0:Tuner 1:Composite 2:S-Video */ 328 if (input > 2) /* 0:Tuner 1:Composite 2:S-Video */
327 return -EINVAL; 329 return -EINVAL;
328 mask = itv->card->gpio_video_input.mask; 330 mask = itv->card->gpio_video_input.mask;
329 if (route->input == 0) 331 if (input == 0)
330 data = itv->card->gpio_video_input.tuner; 332 data = itv->card->gpio_video_input.tuner;
331 else if (route->input == 1) 333 else if (input == 1)
332 data = itv->card->gpio_video_input.composite; 334 data = itv->card->gpio_video_input.composite;
333 else 335 else
334 data = itv->card->gpio_video_input.svideo; 336 data = itv->card->gpio_video_input.svideo;
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index 052fbe9cde8..cf48b6ab97c 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -1033,7 +1033,6 @@ static int ivtv_g_output(struct file *file, void *fh, unsigned int *i)
1033static int ivtv_s_output(struct file *file, void *fh, unsigned int outp) 1033static int ivtv_s_output(struct file *file, void *fh, unsigned int outp)
1034{ 1034{
1035 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 1035 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
1036 struct v4l2_routing route;
1037 1036
1038 if (outp >= itv->card->nof_outputs) 1037 if (outp >= itv->card->nof_outputs)
1039 return -EINVAL; 1038 return -EINVAL;
@@ -1046,9 +1045,9 @@ static int ivtv_s_output(struct file *file, void *fh, unsigned int outp)
1046 itv->active_output, outp); 1045 itv->active_output, outp);
1047 1046
1048 itv->active_output = outp; 1047 itv->active_output = outp;
1049 route.input = SAA7127_INPUT_TYPE_NORMAL; 1048 ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_routing,
1050 route.output = itv->card->video_outputs[outp].video_output; 1049 SAA7127_INPUT_TYPE_NORMAL,
1051 ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_routing, &route); 1050 itv->card->video_outputs[outp].video_output, 0);
1052 1051
1053 return 0; 1052 return 0;
1054} 1053}
@@ -1738,7 +1737,8 @@ static long ivtv_default(struct file *file, void *fh, int cmd, void *arg)
1738 case VIDIOC_INT_S_AUDIO_ROUTING: { 1737 case VIDIOC_INT_S_AUDIO_ROUTING: {
1739 struct v4l2_routing *route = arg; 1738 struct v4l2_routing *route = arg;
1740 1739
1741 ivtv_call_hw(itv, itv->card->hw_audio, audio, s_routing, route); 1740 ivtv_call_hw(itv, itv->card->hw_audio, audio, s_routing,
1741 route->input, route->output, 0);
1742 break; 1742 break;
1743 } 1743 }
1744 1744
diff --git a/drivers/media/video/ivtv/ivtv-routing.c b/drivers/media/video/ivtv/ivtv-routing.c
index 3fd30229449..8898c569a1c 100644
--- a/drivers/media/video/ivtv/ivtv-routing.c
+++ b/drivers/media/video/ivtv/ivtv-routing.c
@@ -34,7 +34,7 @@
34void ivtv_audio_set_io(struct ivtv *itv) 34void ivtv_audio_set_io(struct ivtv *itv)
35{ 35{
36 const struct ivtv_card_audio_input *in; 36 const struct ivtv_card_audio_input *in;
37 struct v4l2_routing route; 37 u32 input, output = 0;
38 38
39 /* Determine which input to use */ 39 /* Determine which input to use */
40 if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) 40 if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags))
@@ -43,73 +43,77 @@ void ivtv_audio_set_io(struct ivtv *itv)
43 in = &itv->card->audio_inputs[itv->audio_input]; 43 in = &itv->card->audio_inputs[itv->audio_input];
44 44
45 /* handle muxer chips */ 45 /* handle muxer chips */
46 route.input = in->muxer_input; 46 input = in->muxer_input;
47 route.output = 0;
48 if (itv->card->hw_muxer & IVTV_HW_M52790) 47 if (itv->card->hw_muxer & IVTV_HW_M52790)
49 route.output = M52790_OUT_STEREO; 48 output = M52790_OUT_STEREO;
50 v4l2_subdev_call(itv->sd_muxer, audio, s_routing, &route); 49 v4l2_subdev_call(itv->sd_muxer, audio, s_routing,
50 input, output, 0);
51 51
52 route.input = in->audio_input; 52 input = in->audio_input;
53 route.output = 0; 53 output = 0;
54 if (itv->card->hw_audio & IVTV_HW_MSP34XX) 54 if (itv->card->hw_audio & IVTV_HW_MSP34XX)
55 route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1); 55 output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1);
56 ivtv_call_hw(itv, itv->card->hw_audio, audio, s_routing, &route); 56 ivtv_call_hw(itv, itv->card->hw_audio, audio, s_routing,
57 input, output, 0);
57} 58}
58 59
59/* Selects the video input and output according to the current 60/* Selects the video input and output according to the current
60 settings. */ 61 settings. */
61void ivtv_video_set_io(struct ivtv *itv) 62void ivtv_video_set_io(struct ivtv *itv)
62{ 63{
63 struct v4l2_routing route;
64 int inp = itv->active_input; 64 int inp = itv->active_input;
65 u32 input;
65 u32 type; 66 u32 type;
66 67
67 route.input = itv->card->video_inputs[inp].video_input; 68 v4l2_subdev_call(itv->sd_video, video, s_routing,
68 route.output = 0; 69 itv->card->video_inputs[inp].video_input, 0, 0);
69 v4l2_subdev_call(itv->sd_video, video, s_routing, &route);
70 70
71 type = itv->card->video_inputs[inp].video_type; 71 type = itv->card->video_inputs[inp].video_type;
72 72
73 if (type == IVTV_CARD_INPUT_VID_TUNER) { 73 if (type == IVTV_CARD_INPUT_VID_TUNER) {
74 route.input = 0; /* Tuner */ 74 input = 0; /* Tuner */
75 } else if (type < IVTV_CARD_INPUT_COMPOSITE1) { 75 } else if (type < IVTV_CARD_INPUT_COMPOSITE1) {
76 route.input = 2; /* S-Video */ 76 input = 2; /* S-Video */
77 } else { 77 } else {
78 route.input = 1; /* Composite */ 78 input = 1; /* Composite */
79 } 79 }
80 80
81 if (itv->card->hw_video & IVTV_HW_GPIO) 81 if (itv->card->hw_video & IVTV_HW_GPIO)
82 ivtv_call_hw(itv, IVTV_HW_GPIO, video, s_routing, &route); 82 ivtv_call_hw(itv, IVTV_HW_GPIO, video, s_routing,
83 input, 0, 0);
83 84
84 if (itv->card->hw_video & IVTV_HW_UPD64031A) { 85 if (itv->card->hw_video & IVTV_HW_UPD64031A) {
85 if (type == IVTV_CARD_INPUT_VID_TUNER || 86 if (type == IVTV_CARD_INPUT_VID_TUNER ||
86 type >= IVTV_CARD_INPUT_COMPOSITE1) { 87 type >= IVTV_CARD_INPUT_COMPOSITE1) {
87 /* Composite: GR on, connect to 3DYCS */ 88 /* Composite: GR on, connect to 3DYCS */
88 route.input = UPD64031A_GR_ON | UPD64031A_3DYCS_COMPOSITE; 89 input = UPD64031A_GR_ON | UPD64031A_3DYCS_COMPOSITE;
89 } else { 90 } else {
90 /* S-Video: GR bypassed, turn it off */ 91 /* S-Video: GR bypassed, turn it off */
91 route.input = UPD64031A_GR_OFF | UPD64031A_3DYCS_DISABLE; 92 input = UPD64031A_GR_OFF | UPD64031A_3DYCS_DISABLE;
92 } 93 }
93 route.input |= itv->card->gr_config; 94 input |= itv->card->gr_config;
94 95
95 ivtv_call_hw(itv, IVTV_HW_UPD64031A, video, s_routing, &route); 96 ivtv_call_hw(itv, IVTV_HW_UPD64031A, video, s_routing,
97 input, 0, 0);
96 } 98 }
97 99
98 if (itv->card->hw_video & IVTV_HW_UPD6408X) { 100 if (itv->card->hw_video & IVTV_HW_UPD6408X) {
99 route.input = UPD64083_YCS_MODE; 101 input = UPD64083_YCS_MODE;
100 if (type > IVTV_CARD_INPUT_VID_TUNER && 102 if (type > IVTV_CARD_INPUT_VID_TUNER &&
101 type < IVTV_CARD_INPUT_COMPOSITE1) { 103 type < IVTV_CARD_INPUT_COMPOSITE1) {
102 /* S-Video uses YCNR mode and internal Y-ADC, the upd64031a 104 /* S-Video uses YCNR mode and internal Y-ADC, the
103 is not used. */ 105 upd64031a is not used. */
104 route.input |= UPD64083_YCNR_MODE; 106 input |= UPD64083_YCNR_MODE;
105 } 107 }
106 else if (itv->card->hw_video & IVTV_HW_UPD64031A) { 108 else if (itv->card->hw_video & IVTV_HW_UPD64031A) {
107 /* Use upd64031a output for tuner and composite(CX23416GYC only) inputs */ 109 /* Use upd64031a output for tuner and
108 if ((type == IVTV_CARD_INPUT_VID_TUNER)|| 110 composite(CX23416GYC only) inputs */
109 (itv->card->type == IVTV_CARD_CX23416GYC)) { 111 if (type == IVTV_CARD_INPUT_VID_TUNER ||
110 route.input |= UPD64083_EXT_Y_ADC; 112 itv->card->type == IVTV_CARD_CX23416GYC) {
111 } 113 input |= UPD64083_EXT_Y_ADC;
114 }
112 } 115 }
113 ivtv_call_hw(itv, IVTV_HW_UPD6408X, video, s_routing, &route); 116 ivtv_call_hw(itv, IVTV_HW_UPD6408X, video, s_routing,
117 input, 0, 0);
114 } 118 }
115} 119}