From patchwork Tue Oct 9 22:01:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 1571721 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 319D2DFFAD for ; Tue, 9 Oct 2012 22:01:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756987Ab2JIWBR (ORCPT ); Tue, 9 Oct 2012 18:01:17 -0400 Received: from mail-gh0-f174.google.com ([209.85.160.174]:59292 "EHLO mail-gh0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756980Ab2JIWBR (ORCPT ); Tue, 9 Oct 2012 18:01:17 -0400 Received: by mail-gh0-f174.google.com with SMTP id g15so1715114ghb.19 for ; Tue, 09 Oct 2012 15:01:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=QGIPxLnU8pn4rzT4/ALcF/wUCc1cUMrsuFD+BVynW78=; b=mZ3NeGZWpiYFi+EbgzrBhlJeu0Z8FuOqJMOQdv9Veh50CQpVkuVcEBGNZWRgnxT/Wn e0Slm2VFi0roKIBwlEljXUxhurJB6SuWgqvUOyZLT6QKt+8I5UrdhLQk3NU+hfoARlQI E8BM3BoBg0iRRxZrxdKt6ewkoME0fpzm0V2TjT7DZVFSMxz2ORQpWVtPw6kNYrND5iaM ddhaUomZNaQUbHKTQpKAElJUSQnkZoRvKVjy9itzTpkBvXRUUK9fdpnCL7vJ25s98Qwg 5you1MvQWk/RQIdXxZU/eXHhUDfZT2nb7XxezjTYWpIuJzKww2mw7kToycs3XQJ/78H/ DTkg== Received: by 10.236.176.8 with SMTP id a8mr20681623yhm.54.1349820076221; Tue, 09 Oct 2012 15:01:16 -0700 (PDT) Received: from localhost.localdomain ([186.153.120.250]) by mx.google.com with ESMTPS id c12sm5999357ang.14.2012.10.09.15.01.13 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 09 Oct 2012 15:01:15 -0700 (PDT) From: Ezequiel Garcia To: Cc: Mauro Carvalho Chehab , Ezequiel Garcia Subject: [PATCH] [for 3.7] stk1160: Add support for S-Video input Date: Tue, 9 Oct 2012 19:01:03 -0300 Message-Id: <1349820063-21955-1-git-send-email-elezegarcia@gmail.com> X-Mailer: git-send-email 1.7.4.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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: Ezequiel Garcia --- Hi Mauro, I'm sending this for inclusion in v3.7 second media pull request. I realize it's very late, so I understand if you don't want to pick it. drivers/media/usb/stk1160/stk1160-core.c | 15 +++++++++++---- drivers/media/usb/stk1160/stk1160-v4l.c | 7 ++++++- drivers/media/usb/stk1160/stk1160.h | 3 ++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/stk1160/stk1160-core.c b/drivers/media/usb/stk1160/stk1160-core.c index b627408..34a26e0 100644 --- a/drivers/media/usb/stk1160/stk1160-core.c +++ b/drivers/media/usb/stk1160/stk1160-core.c @@ -100,12 +100,21 @@ int stk1160_write_reg(struct stk1160 *dev, u16 reg, u16 value) void stk1160_select_input(struct stk1160 *dev) { + int route; 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]); + } } /* TODO: We should break this into pieces */ @@ -351,8 +360,6 @@ static int stk1160_probe(struct usb_interface *interface, /* i2c reset saa711x */ 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); /* reset stk1160 to default values */ diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c index fe6e857..6694f9e 100644 --- a/drivers/media/usb/stk1160/stk1160-v4l.c +++ b/drivers/media/usb/stk1160/stk1160-v4l.c @@ -419,7 +419,12 @@ static int vidioc_enum_input(struct file *file, void *priv, if (i->index > STK1160_MAX_INPUT) return -EINVAL; - sprintf(i->name, "Composite%d", i->index); + /* S-Video special handling */ + if (i->index == STK1160_SVIDEO_INPUT) + sprintf(i->name, "S-Video"); + else + sprintf(i->name, "Composite%d", i->index); + i->type = V4L2_INPUT_TYPE_CAMERA; i->std = dev->vdev.tvnorms; return 0; diff --git a/drivers/media/usb/stk1160/stk1160.h b/drivers/media/usb/stk1160/stk1160.h index 3feba00..68c8707 100644 --- a/drivers/media/usb/stk1160/stk1160.h +++ b/drivers/media/usb/stk1160/stk1160.h @@ -46,7 +46,8 @@ #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