Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39b6f687 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (3608): Implement new routing commands in saa7127.c

parent 1f8f5fa9
Loading
Loading
Loading
Loading
+18 −25
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@
#include <linux/i2c.h>
#include <linux/videodev2.h>
#include <media/v4l2-common.h>
#include <media/saa7127.h>

static int debug = 0;
static int test_image = 0;
@@ -222,22 +223,6 @@ static struct i2c_reg_value saa7127_init_config_50hz[] = {
	{ 0, 0 }
};

/* Enumeration for the Supported input types */
enum saa7127_input_type {
	SAA7127_INPUT_TYPE_NORMAL,
	SAA7127_INPUT_TYPE_TEST_IMAGE
};

/* Enumeration for the Supported Output signal types */
enum saa7127_output_type {
	SAA7127_OUTPUT_TYPE_BOTH,
	SAA7127_OUTPUT_TYPE_COMPOSITE,
	SAA7127_OUTPUT_TYPE_SVIDEO,
	SAA7127_OUTPUT_TYPE_RGB,
	SAA7127_OUTPUT_TYPE_YUV_C,
	SAA7127_OUTPUT_TYPE_YUV_V
};

/*
 **********************************************************************
 *
@@ -561,7 +546,7 @@ static int saa7127_command(struct i2c_client *client,
{
	struct saa7127_state *state = i2c_get_clientdata(client);
	struct v4l2_format *fmt = arg;
	int *iarg = arg;
	struct v4l2_routing *route = arg;

	switch (cmd) {
	case VIDIOC_S_STD:
@@ -573,15 +558,23 @@ static int saa7127_command(struct i2c_client *client,
		*(v4l2_std_id *)arg = state->std;
		break;

	case VIDIOC_S_INPUT:
		if (state->input_type == *iarg)
	case VIDIOC_INT_G_VIDEO_ROUTING:
		route->input = state->input_type;
		route->output = state->output_type;
		break;
		return saa7127_set_input_type(client, *iarg);

	case VIDIOC_S_OUTPUT:
		if (state->output_type == *iarg)
			break;
		return saa7127_set_output_type(client, *iarg);
	case VIDIOC_INT_S_VIDEO_ROUTING:
	{
		int rc = 0;

		if (state->input_type != route->input) {
			rc = saa7127_set_input_type(client, route->input);
		}
		if (rc == 0 && state->output_type != route->output) {
			rc = saa7127_set_output_type(client, route->output);
		}
		return rc;
	}

	case VIDIOC_STREAMON:
	case VIDIOC_STREAMOFF:
+41 −0
Original line number Diff line number Diff line
/*
    saa7127.h - definition for saa7126/7/8/9 inputs/outputs

    Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef _SAA7127_H_
#define _SAA7127_H_

/* Enumeration for the supported input types */
enum saa7127_input_type {
	SAA7127_INPUT_TYPE_NORMAL,
	SAA7127_INPUT_TYPE_TEST_IMAGE
};

/* Enumeration for the supported output signal types */
enum saa7127_output_type {
	SAA7127_OUTPUT_TYPE_BOTH,
	SAA7127_OUTPUT_TYPE_COMPOSITE,
	SAA7127_OUTPUT_TYPE_SVIDEO,
	SAA7127_OUTPUT_TYPE_RGB,
	SAA7127_OUTPUT_TYPE_YUV_C,
	SAA7127_OUTPUT_TYPE_YUV_V
};

#endif