···5454#include <linux/i2c.h>5555#include <linux/videodev2.h>5656#include <media/v4l2-common.h>5757+#include <media/saa7127.h>57585859static int debug = 0;5960static int test_image = 0;···221220 { SAA7127_REG_MULTI, 0xa0 },222221 { SAA7127_REG_CLOSED_CAPTION, 0x00 },223222 { 0, 0 }224224-};225225-226226-/* Enumeration for the Supported input types */227227-enum saa7127_input_type {228228- SAA7127_INPUT_TYPE_NORMAL,229229- SAA7127_INPUT_TYPE_TEST_IMAGE230230-};231231-232232-/* Enumeration for the Supported Output signal types */233233-enum saa7127_output_type {234234- SAA7127_OUTPUT_TYPE_BOTH,235235- SAA7127_OUTPUT_TYPE_COMPOSITE,236236- SAA7127_OUTPUT_TYPE_SVIDEO,237237- SAA7127_OUTPUT_TYPE_RGB,238238- SAA7127_OUTPUT_TYPE_YUV_C,239239- SAA7127_OUTPUT_TYPE_YUV_V240223};241224242225/*···546561{547562 struct saa7127_state *state = i2c_get_clientdata(client);548563 struct v4l2_format *fmt = arg;549549- int *iarg = arg;564564+ struct v4l2_routing *route = arg;550565551566 switch (cmd) {552567 case VIDIOC_S_STD:···558573 *(v4l2_std_id *)arg = state->std;559574 break;560575561561- case VIDIOC_S_INPUT:562562- if (state->input_type == *iarg)563563- break;564564- return saa7127_set_input_type(client, *iarg);576576+ case VIDIOC_INT_G_VIDEO_ROUTING:577577+ route->input = state->input_type;578578+ route->output = state->output_type;579579+ break;565580566566- case VIDIOC_S_OUTPUT:567567- if (state->output_type == *iarg)568568- break;569569- return saa7127_set_output_type(client, *iarg);581581+ case VIDIOC_INT_S_VIDEO_ROUTING:582582+ {583583+ int rc = 0;584584+585585+ if (state->input_type != route->input) {586586+ rc = saa7127_set_input_type(client, route->input);587587+ }588588+ if (rc == 0 && state->output_type != route->output) {589589+ rc = saa7127_set_output_type(client, route->output);590590+ }591591+ return rc;592592+ }570593571594 case VIDIOC_STREAMON:572595 case VIDIOC_STREAMOFF:
+41
include/media/saa7127.h
···11+/*22+ saa7127.h - definition for saa7126/7/8/9 inputs/outputs33+44+ Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)55+66+ This program is free software; you can redistribute it and/or modify77+ it under the terms of the GNU General Public License as published by88+ the Free Software Foundation; either version 2 of the License, or99+ (at your option) any later version.1010+1111+ This program is distributed in the hope that it will be useful,1212+ but WITHOUT ANY WARRANTY; without even the implied warranty of1313+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414+ GNU General Public License for more details.1515+1616+ You should have received a copy of the GNU General Public License1717+ along with this program; if not, write to the Free Software1818+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.1919+*/2020+2121+#ifndef _SAA7127_H_2222+#define _SAA7127_H_2323+2424+/* Enumeration for the supported input types */2525+enum saa7127_input_type {2626+ SAA7127_INPUT_TYPE_NORMAL,2727+ SAA7127_INPUT_TYPE_TEST_IMAGE2828+};2929+3030+/* Enumeration for the supported output signal types */3131+enum saa7127_output_type {3232+ SAA7127_OUTPUT_TYPE_BOTH,3333+ SAA7127_OUTPUT_TYPE_COMPOSITE,3434+ SAA7127_OUTPUT_TYPE_SVIDEO,3535+ SAA7127_OUTPUT_TYPE_RGB,3636+ SAA7127_OUTPUT_TYPE_YUV_C,3737+ SAA7127_OUTPUT_TYPE_YUV_V3838+};3939+4040+#endif4141+