Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
39b6f687 1f8f5fa9

+59 -25
+18 -25
drivers/media/video/saa7127.c
··· 54 54 #include <linux/i2c.h> 55 55 #include <linux/videodev2.h> 56 56 #include <media/v4l2-common.h> 57 + #include <media/saa7127.h> 57 58 58 59 static int debug = 0; 59 60 static int test_image = 0; ··· 221 220 { SAA7127_REG_MULTI, 0xa0 }, 222 221 { SAA7127_REG_CLOSED_CAPTION, 0x00 }, 223 222 { 0, 0 } 224 - }; 225 - 226 - /* Enumeration for the Supported input types */ 227 - enum saa7127_input_type { 228 - SAA7127_INPUT_TYPE_NORMAL, 229 - SAA7127_INPUT_TYPE_TEST_IMAGE 230 - }; 231 - 232 - /* Enumeration for the Supported Output signal types */ 233 - enum saa7127_output_type { 234 - SAA7127_OUTPUT_TYPE_BOTH, 235 - SAA7127_OUTPUT_TYPE_COMPOSITE, 236 - SAA7127_OUTPUT_TYPE_SVIDEO, 237 - SAA7127_OUTPUT_TYPE_RGB, 238 - SAA7127_OUTPUT_TYPE_YUV_C, 239 - SAA7127_OUTPUT_TYPE_YUV_V 240 223 }; 241 224 242 225 /* ··· 546 561 { 547 562 struct saa7127_state *state = i2c_get_clientdata(client); 548 563 struct v4l2_format *fmt = arg; 549 - int *iarg = arg; 564 + struct v4l2_routing *route = arg; 550 565 551 566 switch (cmd) { 552 567 case VIDIOC_S_STD: ··· 558 573 *(v4l2_std_id *)arg = state->std; 559 574 break; 560 575 561 - case VIDIOC_S_INPUT: 562 - if (state->input_type == *iarg) 563 - break; 564 - return saa7127_set_input_type(client, *iarg); 576 + case VIDIOC_INT_G_VIDEO_ROUTING: 577 + route->input = state->input_type; 578 + route->output = state->output_type; 579 + break; 565 580 566 - case VIDIOC_S_OUTPUT: 567 - if (state->output_type == *iarg) 568 - break; 569 - return saa7127_set_output_type(client, *iarg); 581 + case VIDIOC_INT_S_VIDEO_ROUTING: 582 + { 583 + int rc = 0; 584 + 585 + if (state->input_type != route->input) { 586 + rc = saa7127_set_input_type(client, route->input); 587 + } 588 + if (rc == 0 && state->output_type != route->output) { 589 + rc = saa7127_set_output_type(client, route->output); 590 + } 591 + return rc; 592 + } 570 593 571 594 case VIDIOC_STREAMON: 572 595 case VIDIOC_STREAMOFF:
+41
include/media/saa7127.h
··· 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 */ 25 + enum saa7127_input_type { 26 + SAA7127_INPUT_TYPE_NORMAL, 27 + SAA7127_INPUT_TYPE_TEST_IMAGE 28 + }; 29 + 30 + /* Enumeration for the supported output signal types */ 31 + enum 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 +