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

Commit 56a960bf authored by Ezequiel Garcia's avatar Ezequiel Garcia Committed by Mauro Carvalho Chehab
Browse files

[media] stk1160: Add support for S-Video input



In order to fully replace easycap driver with stk1160,
it's also necessary to add S-Video support.
A similar patch backported for v3.2 kernel has been
tested by three different users.

Signed-off-by: default avatarEzequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent d6d022e7
Loading
Loading
Loading
Loading
+11 −4
Original line number Original line Diff line number Diff line
@@ -100,13 +100,22 @@ int stk1160_write_reg(struct stk1160 *dev, u16 reg, u16 value)


void stk1160_select_input(struct stk1160 *dev)
void stk1160_select_input(struct stk1160 *dev)
{
{
	int route;
	static const u8 gctrl[] = {
	static const u8 gctrl[] = {
		0x98, 0x90, 0x88, 0x80
		0x98, 0x90, 0x88, 0x80, 0x98
	};
	};


	if (dev->ctl_input < ARRAY_SIZE(gctrl))
	if (dev->ctl_input == STK1160_SVIDEO_INPUT)
		route = SAA7115_SVIDEO3;
	else
		route = SAA7115_COMPOSITE0;

	if (dev->ctl_input < ARRAY_SIZE(gctrl)) {
		v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing,
				route, 0, 0);
		stk1160_write_reg(dev, STK1160_GCTRL, gctrl[dev->ctl_input]);
		stk1160_write_reg(dev, STK1160_GCTRL, gctrl[dev->ctl_input]);
	}
	}
}


/* TODO: We should break this into pieces */
/* TODO: We should break this into pieces */
static void stk1160_reg_reset(struct stk1160 *dev)
static void stk1160_reg_reset(struct stk1160 *dev)
@@ -351,8 +360,6 @@ static int stk1160_probe(struct usb_interface *interface,


	/* i2c reset saa711x */
	/* i2c reset saa711x */
	v4l2_device_call_all(&dev->v4l2_dev, 0, core, reset, 0);
	v4l2_device_call_all(&dev->v4l2_dev, 0, core, reset, 0);
	v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing,
				0, 0, 0);
	v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0);
	v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0);


	/* reset stk1160 to default values */
	/* reset stk1160 to default values */
+6 −1
Original line number Original line Diff line number Diff line
@@ -419,7 +419,12 @@ static int vidioc_enum_input(struct file *file, void *priv,
	if (i->index > STK1160_MAX_INPUT)
	if (i->index > STK1160_MAX_INPUT)
		return -EINVAL;
		return -EINVAL;


	/* S-Video special handling */
	if (i->index == STK1160_SVIDEO_INPUT)
		sprintf(i->name, "S-Video");
	else
		sprintf(i->name, "Composite%d", i->index);
		sprintf(i->name, "Composite%d", i->index);

	i->type = V4L2_INPUT_TYPE_CAMERA;
	i->type = V4L2_INPUT_TYPE_CAMERA;
	i->std = dev->vdev.tvnorms;
	i->std = dev->vdev.tvnorms;
	return 0;
	return 0;
+2 −1
Original line number Original line Diff line number Diff line
@@ -46,7 +46,8 @@


#define STK1160_MIN_PKT_SIZE 3072
#define STK1160_MIN_PKT_SIZE 3072


#define STK1160_MAX_INPUT 3
#define STK1160_MAX_INPUT 4
#define STK1160_SVIDEO_INPUT 4


#define STK1160_I2C_TIMEOUT 100
#define STK1160_I2C_TIMEOUT 100