aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c58
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c18
-rw-r--r--drivers/media/video/saa7115.c28
-rw-r--r--drivers/media/video/tvp5150.c45
4 files changed, 70 insertions, 79 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 3ba3439db580..eb8132bff313 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -29,6 +29,8 @@
29#include <linux/usb.h> 29#include <linux/usb.h>
30#include <media/tuner.h> 30#include <media/tuner.h>
31#include <media/msp3400.h> 31#include <media/msp3400.h>
32#include <media/saa7115.h>
33#include <media/tvp5150.h>
32#include <media/tveeprom.h> 34#include <media/tveeprom.h>
33#include <media/audiochip.h> 35#include <media/audiochip.h>
34#include <media/v4l2-common.h> 36#include <media/v4l2-common.h>
@@ -46,11 +48,11 @@ struct em28xx_board em28xx_boards[] = {
46 .decoder = EM28XX_SAA7113, 48 .decoder = EM28XX_SAA7113,
47 .input = {{ 49 .input = {{
48 .type = EM28XX_VMUX_COMPOSITE1, 50 .type = EM28XX_VMUX_COMPOSITE1,
49 .vmux = 0, 51 .vmux = SAA7115_COMPOSITE0,
50 .amux = 1, 52 .amux = 1,
51 },{ 53 },{
52 .type = EM28XX_VMUX_SVIDEO, 54 .type = EM28XX_VMUX_SVIDEO,
53 .vmux = 9, 55 .vmux = SAA7115_SVIDEO3,
54 .amux = 1, 56 .amux = 1,
55 }}, 57 }},
56 }, 58 },
@@ -64,11 +66,11 @@ struct em28xx_board em28xx_boards[] = {
64 .decoder = EM28XX_SAA7113, 66 .decoder = EM28XX_SAA7113,
65 .input = {{ 67 .input = {{
66 .type = EM28XX_VMUX_COMPOSITE1, 68 .type = EM28XX_VMUX_COMPOSITE1,
67 .vmux = 0, 69 .vmux = SAA7115_COMPOSITE0,
68 .amux = 1, 70 .amux = 1,
69 },{ 71 },{
70 .type = EM28XX_VMUX_SVIDEO, 72 .type = EM28XX_VMUX_SVIDEO,
71 .vmux = 9, 73 .vmux = SAA7115_SVIDEO3,
72 .amux = 1, 74 .amux = 1,
73 }}, 75 }},
74 }, 76 },
@@ -82,11 +84,11 @@ struct em28xx_board em28xx_boards[] = {
82 .decoder = EM28XX_SAA7113, 84 .decoder = EM28XX_SAA7113,
83 .input = {{ 85 .input = {{
84 .type = EM28XX_VMUX_COMPOSITE1, 86 .type = EM28XX_VMUX_COMPOSITE1,
85 .vmux = 0, 87 .vmux = SAA7115_COMPOSITE0,
86 .amux = 1, 88 .amux = 1,
87 },{ 89 },{
88 .type = EM28XX_VMUX_SVIDEO, 90 .type = EM28XX_VMUX_SVIDEO,
89 .vmux = 9, 91 .vmux = SAA7115_SVIDEO3,
90 .amux = 1, 92 .amux = 1,
91 }}, 93 }},
92 }, 94 },
@@ -100,15 +102,15 @@ struct em28xx_board em28xx_boards[] = {
100 .decoder = EM28XX_SAA7113, 102 .decoder = EM28XX_SAA7113,
101 .input = {{ 103 .input = {{
102 .type = EM28XX_VMUX_TELEVISION, 104 .type = EM28XX_VMUX_TELEVISION,
103 .vmux = 2, 105 .vmux = SAA7115_COMPOSITE2,
104 .amux = 1, 106 .amux = 1,
105 },{ 107 },{
106 .type = EM28XX_VMUX_COMPOSITE1, 108 .type = EM28XX_VMUX_COMPOSITE1,
107 .vmux = 0, 109 .vmux = SAA7115_COMPOSITE0,
108 .amux = 1, 110 .amux = 1,
109 },{ 111 },{
110 .type = EM28XX_VMUX_SVIDEO, 112 .type = EM28XX_VMUX_SVIDEO,
111 .vmux = 9, 113 .vmux = SAA7115_SVIDEO3,
112 .amux = 1, 114 .amux = 1,
113 }}, 115 }},
114 }, 116 },
@@ -122,15 +124,15 @@ struct em28xx_board em28xx_boards[] = {
122 .decoder = EM28XX_SAA7113, 124 .decoder = EM28XX_SAA7113,
123 .input = {{ 125 .input = {{
124 .type = EM28XX_VMUX_TELEVISION, 126 .type = EM28XX_VMUX_TELEVISION,
125 .vmux = 2, 127 .vmux = SAA7115_COMPOSITE2,
126 .amux = 0, 128 .amux = 0,
127 },{ 129 },{
128 .type = EM28XX_VMUX_COMPOSITE1, 130 .type = EM28XX_VMUX_COMPOSITE1,
129 .vmux = 0, 131 .vmux = SAA7115_COMPOSITE0,
130 .amux = 1, 132 .amux = 1,
131 },{ 133 },{
132 .type = EM28XX_VMUX_SVIDEO, 134 .type = EM28XX_VMUX_SVIDEO,
133 .vmux = 9, 135 .vmux = SAA7115_SVIDEO3,
134 .amux = 1, 136 .amux = 1,
135 }}, 137 }},
136 }, 138 },
@@ -146,11 +148,11 @@ struct em28xx_board em28xx_boards[] = {
146 /*FIXME: S-Video not tested */ 148 /*FIXME: S-Video not tested */
147 .input = {{ 149 .input = {{
148 .type = EM28XX_VMUX_TELEVISION, 150 .type = EM28XX_VMUX_TELEVISION,
149 .vmux = 0, 151 .vmux = TVP5150_COMPOSITE0,
150 .amux = MSP_INPUT_DEFAULT, 152 .amux = MSP_INPUT_DEFAULT,
151 },{ 153 },{
152 .type = EM28XX_VMUX_SVIDEO, 154 .type = EM28XX_VMUX_SVIDEO,
153 .vmux = 2, 155 .vmux = TVP5150_SVIDEO,
154 .amux = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1, 156 .amux = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
155 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART), 157 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
156 }}, 158 }},
@@ -165,15 +167,15 @@ struct em28xx_board em28xx_boards[] = {
165 .decoder = EM28XX_SAA7114, 167 .decoder = EM28XX_SAA7114,
166 .input = {{ 168 .input = {{
167 .type = EM28XX_VMUX_TELEVISION, 169 .type = EM28XX_VMUX_TELEVISION,
168 .vmux = 4, 170 .vmux = SAA7115_COMPOSITE4,
169 .amux = 0, 171 .amux = 0,
170 },{ 172 },{
171 .type = EM28XX_VMUX_COMPOSITE1, 173 .type = EM28XX_VMUX_COMPOSITE1,
172 .vmux = 0, 174 .vmux = SAA7115_COMPOSITE0,
173 .amux = 1, 175 .amux = 1,
174 },{ 176 },{
175 .type = EM28XX_VMUX_SVIDEO, 177 .type = EM28XX_VMUX_SVIDEO,
176 .vmux = 9, 178 .vmux = SAA7115_SVIDEO3,
177 .amux = 1, 179 .amux = 1,
178 }}, 180 }},
179 }, 181 },
@@ -188,15 +190,15 @@ struct em28xx_board em28xx_boards[] = {
188 .decoder = EM28XX_SAA7113, 190 .decoder = EM28XX_SAA7113,
189 .input = {{ 191 .input = {{
190 .type = EM28XX_VMUX_TELEVISION, 192 .type = EM28XX_VMUX_TELEVISION,
191 .vmux = 2, 193 .vmux = SAA7115_COMPOSITE2,
192 .amux = 0, 194 .amux = 0,
193 },{ 195 },{
194 .type = EM28XX_VMUX_COMPOSITE1, 196 .type = EM28XX_VMUX_COMPOSITE1,
195 .vmux = 0, 197 .vmux = SAA7115_COMPOSITE0,
196 .amux = 1, 198 .amux = 1,
197 },{ 199 },{
198 .type = EM28XX_VMUX_SVIDEO, 200 .type = EM28XX_VMUX_SVIDEO,
199 .vmux = 9, 201 .vmux = SAA7115_SVIDEO3,
200 .amux = 1, 202 .amux = 1,
201 }}, 203 }},
202 }, 204 },
@@ -211,15 +213,15 @@ struct em28xx_board em28xx_boards[] = {
211 .decoder = EM28XX_SAA7113, 213 .decoder = EM28XX_SAA7113,
212 .input = {{ 214 .input = {{
213 .type = EM28XX_VMUX_TELEVISION, 215 .type = EM28XX_VMUX_TELEVISION,
214 .vmux = 2, 216 .vmux = SAA7115_COMPOSITE2,
215 .amux = 0, 217 .amux = 0,
216 },{ 218 },{
217 .type = EM28XX_VMUX_COMPOSITE1, 219 .type = EM28XX_VMUX_COMPOSITE1,
218 .vmux = 0, 220 .vmux = SAA7115_COMPOSITE0,
219 .amux = 1, 221 .amux = 1,
220 },{ 222 },{
221 .type = EM28XX_VMUX_SVIDEO, 223 .type = EM28XX_VMUX_SVIDEO,
222 .vmux = 9, 224 .vmux = SAA7115_SVIDEO3,
223 .amux = 1, 225 .amux = 1,
224 }}, 226 }},
225 }, 227 },
@@ -234,15 +236,15 @@ struct em28xx_board em28xx_boards[] = {
234 .decoder = EM28XX_SAA7113, 236 .decoder = EM28XX_SAA7113,
235 .input = {{ 237 .input = {{
236 .type = EM28XX_VMUX_TELEVISION, 238 .type = EM28XX_VMUX_TELEVISION,
237 .vmux = 2, 239 .vmux = SAA7115_COMPOSITE2,
238 .amux = 0, 240 .amux = 0,
239 },{ 241 },{
240 .type = EM28XX_VMUX_COMPOSITE1, 242 .type = EM28XX_VMUX_COMPOSITE1,
241 .vmux = 0, 243 .vmux = SAA7115_COMPOSITE0,
242 .amux = 1, 244 .amux = 1,
243 },{ 245 },{
244 .type = EM28XX_VMUX_SVIDEO, 246 .type = EM28XX_VMUX_SVIDEO,
245 .vmux = 9, 247 .vmux = SAA7115_SVIDEO3,
246 .amux = 1, 248 .amux = 1,
247 }}, 249 }},
248 }, 250 },
@@ -254,11 +256,11 @@ struct em28xx_board em28xx_boards[] = {
254 .decoder = EM28XX_SAA7113, 256 .decoder = EM28XX_SAA7113,
255 .input = {{ 257 .input = {{
256 .type = EM28XX_VMUX_COMPOSITE1, 258 .type = EM28XX_VMUX_COMPOSITE1,
257 .vmux = 0, 259 .vmux = SAA7115_COMPOSITE0,
258 .amux = 1, 260 .amux = 1,
259 },{ 261 },{
260 .type = EM28XX_VMUX_SVIDEO, 262 .type = EM28XX_VMUX_SVIDEO,
261 .vmux = 9, 263 .vmux = SAA7115_SVIDEO3,
262 .amux = 1, 264 .amux = 1,
263 }}, 265 }},
264 }, 266 },
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index cf7cdf9ef617..1a0062b649a8 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -170,8 +170,12 @@ static int em28xx_config(struct em28xx *dev)
170static void em28xx_config_i2c(struct em28xx *dev) 170static void em28xx_config_i2c(struct em28xx *dev)
171{ 171{
172 struct v4l2_frequency f; 172 struct v4l2_frequency f;
173 struct v4l2_routing route;
174
175 route.input = INPUT(dev->ctl_input)->vmux;
176 route.output = 0;
173 em28xx_i2c_call_clients(dev, VIDIOC_INT_RESET, NULL); 177 em28xx_i2c_call_clients(dev, VIDIOC_INT_RESET, NULL);
174 em28xx_i2c_call_clients(dev, VIDIOC_S_INPUT, &dev->ctl_input); 178 em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route);
175 em28xx_i2c_call_clients(dev, VIDIOC_STREAMON, NULL); 179 em28xx_i2c_call_clients(dev, VIDIOC_STREAMON, NULL);
176 180
177 /* configure tuner */ 181 /* configure tuner */
@@ -206,19 +210,19 @@ static void em28xx_empty_framequeues(struct em28xx *dev)
206 210
207static void video_mux(struct em28xx *dev, int index) 211static void video_mux(struct em28xx *dev, int index)
208{ 212{
209 int input, ainput; 213 int ainput;
214 struct v4l2_routing route;
210 215
211 input = INPUT(index)->vmux; 216 route.input = INPUT(index)->vmux;
217 route.output = 0;
212 dev->ctl_input = index; 218 dev->ctl_input = index;
213 dev->ctl_ainput = INPUT(index)->amux; 219 dev->ctl_ainput = INPUT(index)->amux;
214 220
215 em28xx_i2c_call_clients(dev, VIDIOC_S_INPUT, &input); 221 em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route);
216 222
217 em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,input,dev->ctl_ainput); 223 em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,route.input,dev->ctl_ainput);
218 224
219 if (dev->has_msp34xx) { 225 if (dev->has_msp34xx) {
220 struct v4l2_routing route;
221
222 if (dev->i2s_speed) 226 if (dev->i2s_speed)
223 em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ, &dev->i2s_speed); 227 em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ, &dev->i2s_speed);
224 route.input = dev->ctl_ainput; 228 route.input = dev->ctl_ainput;
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index edea9e3d2dca..f4843bb45347 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1238,34 +1238,6 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1238 break; 1238 break;
1239 } 1239 }
1240 1240
1241 case VIDIOC_G_INPUT:
1242 *(int *)arg = state->input;
1243 break;
1244
1245 case VIDIOC_S_INPUT:
1246 v4l_dbg(1, debug, client, "decoder set input %d\n", *iarg);
1247 /* inputs from 0-9 are available */
1248 if (*iarg < 0 || *iarg > 9) {
1249 return -EINVAL;
1250 }
1251
1252 if (state->input == *iarg)
1253 break;
1254 v4l_dbg(1, debug, client, "now setting %s input\n",
1255 *iarg >= 6 ? "S-Video" : "Composite");
1256 state->input = *iarg;
1257
1258 /* select mode */
1259 saa7115_write(client, 0x02,
1260 (saa7115_read(client, 0x02) & 0xf0) |
1261 state->input);
1262
1263 /* bypass chrominance trap for modes 6..9 */
1264 saa7115_write(client, 0x09,
1265 (saa7115_read(client, 0x09) & 0x7f) |
1266 (state->input < 6 ? 0x0 : 0x80));
1267 break;
1268
1269 case VIDIOC_STREAMON: 1241 case VIDIOC_STREAMON:
1270 case VIDIOC_STREAMOFF: 1242 case VIDIOC_STREAMOFF:
1271 v4l_dbg(1, debug, client, "%s output\n", 1243 v4l_dbg(1, debug, client, "%s output\n",
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index dab4973bcf82..b167ffab2520 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -10,6 +10,7 @@
10#include <linux/delay.h> 10#include <linux/delay.h>
11#include <linux/video_decoder.h> 11#include <linux/video_decoder.h>
12#include <media/v4l2-common.h> 12#include <media/v4l2-common.h>
13#include <media/tvp5150.h>
13 14
14#include "tvp5150_reg.h" 15#include "tvp5150_reg.h"
15 16
@@ -89,7 +90,7 @@ struct tvp5150 {
89 struct i2c_client *client; 90 struct i2c_client *client;
90 91
91 v4l2_std_id norm; /* Current set standard */ 92 v4l2_std_id norm; /* Current set standard */
92 int input; 93 struct v4l2_routing route;
93 int enable; 94 int enable;
94 int bright; 95 int bright;
95 int contrast; 96 int contrast;
@@ -283,29 +284,26 @@ static void dump_reg(struct i2c_client *c)
283/**************************************************************************** 284/****************************************************************************
284 Basic functions 285 Basic functions
285 ****************************************************************************/ 286 ****************************************************************************/
286enum tvp5150_input {
287 TVP5150_ANALOG_CH0 = 0,
288 TVP5150_SVIDEO = 1,
289 TVP5150_ANALOG_CH1 = 2,
290 TVP5150_BLACK_SCREEN = 8
291};
292 287
293static inline void tvp5150_selmux(struct i2c_client *c, 288static inline void tvp5150_selmux(struct i2c_client *c)
294 enum tvp5150_input input)
295{ 289{
296 int opmode=0; 290 int opmode=0;
297
298 struct tvp5150 *decoder = i2c_get_clientdata(c); 291 struct tvp5150 *decoder = i2c_get_clientdata(c);
292 int input = 0;
299 293
300 if (!decoder->enable) 294 if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable)
301 input |= TVP5150_BLACK_SCREEN; 295 input = 8;
302 296
303 switch (input) { 297 switch (input) {
304 case TVP5150_ANALOG_CH0: 298 case TVP5150_COMPOSITE1:
305 case TVP5150_ANALOG_CH1: 299 input |= 2;
300 /* fall through */
301 case TVP5150_COMPOSITE0:
306 opmode=0x30; /* TV Mode */ 302 opmode=0x30; /* TV Mode */
307 break; 303 break;
304 case TVP5150_SVIDEO:
308 default: 305 default:
306 input |= 1;
309 opmode=0; /* Auto Mode */ 307 opmode=0; /* Auto Mode */
310 break; 308 break;
311 } 309 }
@@ -790,7 +788,7 @@ static inline void tvp5150_reset(struct i2c_client *c)
790 tvp5150_vdp_init(c, vbi_ram_default); 788 tvp5150_vdp_init(c, vbi_ram_default);
791 789
792 /* Selects decoder input */ 790 /* Selects decoder input */
793 tvp5150_selmux(c, decoder->input); 791 tvp5150_selmux(c);
794 792
795 /* Initializes TVP5150 to stream enabled values */ 793 /* Initializes TVP5150 to stream enabled values */
796 tvp5150_write_inittab(c, tvp5150_init_enable); 794 tvp5150_write_inittab(c, tvp5150_init_enable);
@@ -860,6 +858,21 @@ static int tvp5150_command(struct i2c_client *c,
860 case VIDIOC_INT_RESET: 858 case VIDIOC_INT_RESET:
861 tvp5150_reset(c); 859 tvp5150_reset(c);
862 break; 860 break;
861 case VIDIOC_INT_G_VIDEO_ROUTING:
862 {
863 struct v4l2_routing *route = arg;
864
865 *route = decoder->route;
866 break;
867 }
868 case VIDIOC_INT_S_VIDEO_ROUTING:
869 {
870 struct v4l2_routing *route = arg;
871
872 decoder->route = *route;
873 tvp5150_selmux(c);
874 break;
875 }
863 case VIDIOC_S_STD: 876 case VIDIOC_S_STD:
864 if (decoder->norm == *(v4l2_std_id *)arg) 877 if (decoder->norm == *(v4l2_std_id *)arg)
865 break; 878 break;
@@ -1063,7 +1076,7 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter,
1063 rv = i2c_attach_client(c); 1076 rv = i2c_attach_client(c);
1064 1077
1065 core->norm = V4L2_STD_ALL; /* Default is autodetect */ 1078 core->norm = V4L2_STD_ALL; /* Default is autodetect */
1066 core->input = 2; 1079 core->route.input = TVP5150_COMPOSITE1;
1067 core->enable = 1; 1080 core->enable = 1;
1068 core->bright = 32768; 1081 core->bright = 32768;
1069 core->contrast = 32768; 1082 core->contrast = 32768;