aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2006-03-25 07:50:20 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-04-02 03:54:56 -0400
commit39b6f687d31d662461e25dbfe70be990b4c4855b (patch)
tree47db951dc33f36eb4a96713ca9d7b97837744b1d
parent1f8f5fa9b78ce344a03aeb1e6e12fffeb6a4c0c4 (diff)
V4L/DVB (3608): Implement new routing commands in saa7127.c
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/saa7127.c43
-rw-r--r--include/media/saa7127.h41
2 files changed, 59 insertions, 25 deletions
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c
index 992c71774f30..133f9e5252fe 100644
--- a/drivers/media/video/saa7127.c
+++ b/drivers/media/video/saa7127.c
@@ -54,6 +54,7 @@
54#include <linux/i2c.h> 54#include <linux/i2c.h>
55#include <linux/videodev2.h> 55#include <linux/videodev2.h>
56#include <media/v4l2-common.h> 56#include <media/v4l2-common.h>
57#include <media/saa7127.h>
57 58
58static int debug = 0; 59static int debug = 0;
59static int test_image = 0; 60static int test_image = 0;
@@ -222,22 +223,6 @@ static struct i2c_reg_value saa7127_init_config_50hz[] = {
222 { 0, 0 } 223 { 0, 0 }
223}; 224};
224 225
225/* Enumeration for the Supported input types */
226enum saa7127_input_type {
227 SAA7127_INPUT_TYPE_NORMAL,
228 SAA7127_INPUT_TYPE_TEST_IMAGE
229};
230
231/* Enumeration for the Supported Output signal types */
232enum saa7127_output_type {
233 SAA7127_OUTPUT_TYPE_BOTH,
234 SAA7127_OUTPUT_TYPE_COMPOSITE,
235 SAA7127_OUTPUT_TYPE_SVIDEO,
236 SAA7127_OUTPUT_TYPE_RGB,
237 SAA7127_OUTPUT_TYPE_YUV_C,
238 SAA7127_OUTPUT_TYPE_YUV_V
239};
240
241/* 226/*
242 ********************************************************************** 227 **********************************************************************
243 * 228 *
@@ -561,7 +546,7 @@ static int saa7127_command(struct i2c_client *client,
561{ 546{
562 struct saa7127_state *state = i2c_get_clientdata(client); 547 struct saa7127_state *state = i2c_get_clientdata(client);
563 struct v4l2_format *fmt = arg; 548 struct v4l2_format *fmt = arg;
564 int *iarg = arg; 549 struct v4l2_routing *route = arg;
565 550
566 switch (cmd) { 551 switch (cmd) {
567 case VIDIOC_S_STD: 552 case VIDIOC_S_STD:
@@ -573,15 +558,23 @@ static int saa7127_command(struct i2c_client *client,
573 *(v4l2_std_id *)arg = state->std; 558 *(v4l2_std_id *)arg = state->std;
574 break; 559 break;
575 560
576 case VIDIOC_S_INPUT: 561 case VIDIOC_INT_G_VIDEO_ROUTING:
577 if (state->input_type == *iarg) 562 route->input = state->input_type;
578 break; 563 route->output = state->output_type;
579 return saa7127_set_input_type(client, *iarg); 564 break;
580 565
581 case VIDIOC_S_OUTPUT: 566 case VIDIOC_INT_S_VIDEO_ROUTING:
582 if (state->output_type == *iarg) 567 {
583 break; 568 int rc = 0;
584 return saa7127_set_output_type(client, *iarg); 569
570 if (state->input_type != route->input) {
571 rc = saa7127_set_input_type(client, route->input);
572 }
573 if (rc == 0 && state->output_type != route->output) {
574 rc = saa7127_set_output_type(client, route->output);
575 }
576 return rc;
577 }
585 578
586 case VIDIOC_STREAMON: 579 case VIDIOC_STREAMON:
587 case VIDIOC_STREAMOFF: 580 case VIDIOC_STREAMOFF:
diff --git a/include/media/saa7127.h b/include/media/saa7127.h
new file mode 100644
index 000000000000..bbcf862141af
--- /dev/null
+++ b/include/media/saa7127.h
@@ -0,0 +1,41 @@
1/*
2 saa7127.h - definition for saa7126/7/8/9 inputs/outputs
3
4 Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef _SAA7127_H_
22#define _SAA7127_H_
23
24/* Enumeration for the supported input types */
25enum saa7127_input_type {
26 SAA7127_INPUT_TYPE_NORMAL,
27 SAA7127_INPUT_TYPE_TEST_IMAGE
28};
29
30/* Enumeration for the supported output signal types */
31enum saa7127_output_type {
32 SAA7127_OUTPUT_TYPE_BOTH,
33 SAA7127_OUTPUT_TYPE_COMPOSITE,
34 SAA7127_OUTPUT_TYPE_SVIDEO,
35 SAA7127_OUTPUT_TYPE_RGB,
36 SAA7127_OUTPUT_TYPE_YUV_C,
37 SAA7127_OUTPUT_TYPE_YUV_V
38};
39
40#endif
41