From c41e20d9cba3b133cd88e35cd86c02781b32f62a Mon Sep 17 00:00:00 2001 From: Hugo Grostabussiat Date: Sun, 8 Apr 2018 17:11:57 -0400 Subject: media: usbtv: Add SECAM support Add support for the SECAM norm, using the "AVSECAM" decoder configuration sequence found in Windows driver's .INF file. For reference, the "AVSECAM" sequence in the .INF file is: 0x04,0x73,0xDC,0x72,0xA2,0x90,0x35,0x01,0x30,0x04,0x08,0x2D,0x28,0x08, 0x02,0x69,0x16,0x35,0x21,0x16,0x36 Signed-off-by: Hugo Grostabussiat Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/usbtv/usbtv-video.c | 38 ++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'drivers/media/usb/usbtv/usbtv-video.c') diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c index 97f9790954f9..6b0a10173388 100644 --- a/drivers/media/usb/usbtv/usbtv-video.c +++ b/drivers/media/usb/usbtv/usbtv-video.c @@ -57,6 +57,11 @@ static struct usbtv_norm_params norm_params[] = { .norm = V4L2_STD_PAL, .cap_width = 720, .cap_height = 576, + }, + { + .norm = V4L2_STD_SECAM, + .cap_width = 720, + .cap_height = 576, } }; @@ -187,6 +192,34 @@ static int usbtv_select_norm(struct usbtv *usbtv, v4l2_std_id norm) { USBTV_BASE + 0x024f, 0x0002 }, }; + static const u16 secam[][2] = { + /* "AVSECAM" tuning sequence from .INF file */ + { USBTV_BASE + 0x0003, 0x0004 }, + { USBTV_BASE + 0x001a, 0x0073 }, + { USBTV_BASE + 0x0100, 0x00dc }, + { USBTV_BASE + 0x010e, 0x0072 }, + { USBTV_BASE + 0x010f, 0x00a2 }, + { USBTV_BASE + 0x0112, 0x0090 }, + { USBTV_BASE + 0x0115, 0x0035 }, + { USBTV_BASE + 0x0117, 0x0001 }, + { USBTV_BASE + 0x0118, 0x0030 }, + { USBTV_BASE + 0x012d, 0x0004 }, + { USBTV_BASE + 0x012f, 0x0008 }, + { USBTV_BASE + 0x0220, 0x002d }, + { USBTV_BASE + 0x0225, 0x0028 }, + { USBTV_BASE + 0x024e, 0x0008 }, + { USBTV_BASE + 0x024f, 0x0002 }, + { USBTV_BASE + 0x0254, 0x0069 }, + { USBTV_BASE + 0x025a, 0x0016 }, + { USBTV_BASE + 0x025b, 0x0035 }, + { USBTV_BASE + 0x0263, 0x0021 }, + { USBTV_BASE + 0x0266, 0x0016 }, + { USBTV_BASE + 0x0267, 0x0036 }, + /* Epilog */ + { USBTV_BASE + 0x024e, 0x0002 }, + { USBTV_BASE + 0x024f, 0x0002 }, + }; + ret = usbtv_configure_for_norm(usbtv, norm); if (!ret) { @@ -194,6 +227,8 @@ static int usbtv_select_norm(struct usbtv *usbtv, v4l2_std_id norm) ret = usbtv_set_regs(usbtv, ntsc, ARRAY_SIZE(ntsc)); else if (norm & V4L2_STD_PAL) ret = usbtv_set_regs(usbtv, pal, ARRAY_SIZE(pal)); + else if (norm & V4L2_STD_SECAM) + ret = usbtv_set_regs(usbtv, secam, ARRAY_SIZE(secam)); } return ret; @@ -605,7 +640,8 @@ static int usbtv_s_std(struct file *file, void *priv, v4l2_std_id norm) int ret = -EINVAL; struct usbtv *usbtv = video_drvdata(file); - if ((norm & V4L2_STD_525_60) || (norm & V4L2_STD_PAL)) + if ((norm & V4L2_STD_525_60) || (norm & V4L2_STD_PAL) || + (norm & V4L2_STD_SECAM)) ret = usbtv_select_norm(usbtv, norm); return ret; -- cgit v1.2.3