From patchwork Sat Jun 22 15:03:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 2765871 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 67F04C0AB1 for ; Sat, 22 Jun 2013 15:05:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0BA1320108 for ; Sat, 22 Jun 2013 15:05:09 +0000 (UTC) Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EF13820105 for ; Sat, 22 Jun 2013 15:05:03 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r5MF3UkW004600; Sat, 22 Jun 2013 10:03:30 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r5MF3TGQ017410; Sat, 22 Jun 2013 10:03:29 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Sat, 22 Jun 2013 10:03:29 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id r5MF3SoX015238; Sat, 22 Jun 2013 10:03:28 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 7337A80627; Sat, 22 Jun 2013 10:03:28 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id 6F90180626 for ; Sat, 22 Jun 2013 10:03:27 -0500 (CDT) Received: from red.ext.ti.com (red.ext.ti.com [192.94.93.37]) by dflp51.itg.ti.com (8.13.7/8.13.8) with ESMTP id r5MF3QxL020325 for ; Sat, 22 Jun 2013 10:03:26 -0500 (CDT) Received: from mail6.bemta12.messagelabs.com (mail6.bemta12.messagelabs.com [216.82.250.247]) by red.ext.ti.com (8.13.7/8.13.7) with ESMTP id r5MF3PJT015723 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 22 Jun 2013 10:03:26 -0500 Received: from [216.82.250.51:54370] by server-13.bemta-12.messagelabs.com id 06/74-24066-DBCB5C15; Sat, 22 Jun 2013 15:03:25 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-14.tower-108.messagelabs.com!1371913403!9374413!1 X-Originating-IP: [209.85.160.45] X-SpamReason: No, hits=0.7 required=7.0 tests=BODY_RANDOM_LONG, ML_RADAR_SPEW_LINKS_14, RCVD_ILLEGAL_IP, UPPERCASE_25_50, spamassassin: X-StarScan-Received: X-StarScan-Version: 6.9.6; banners=-,-,- X-VirusChecked: Checked Received: (qmail 6995 invoked from network); 22 Jun 2013 15:03:24 -0000 Received: from mail-pb0-f45.google.com (HELO mail-pb0-f45.google.com) (209.85.160.45) by server-14.tower-108.messagelabs.com with RC4-SHA encrypted SMTP; 22 Jun 2013 15:03:24 -0000 Received: by mail-pb0-f45.google.com with SMTP id mc8so9097484pbc.32 for ; Sat, 22 Jun 2013 08:03:23 -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=/atrOwHwmeJNWGw0arZz0dpiMDSOWJZdT6yZoU6W5oU=; b=q5P9Bre2+/i0O92Gb7HcpGROt6Zjb2lj1A0eGTLbkAGVWiNJ9t9EBMYwmuxZ5Ive5g hsaPw1Ff54p4ryODWkNTsRlIlhm674jsgjoX9DfDu30dMgkdLz4PIdfKcSrrVI4Assx1 rRMW9omKK00YsKSbFikNzAo+Nt2HrykP2s6jtLzRi9RXiKWlPHIjE0t21UqVt4ydB76w z1p0m5y/NaD7P/rOAvtFCe5LNRKwmWy6mbvtc7saNyWuHe0gN5W13D85WOZ6b42mRsl+ /j93ytWPa5x1jVqfb0pyl17KJgbde5o2Rbom48/zl0g9c4TYWwOvNU85ThpQ2eQ8l/Ca h5Nw== X-Received: by 10.68.1.34 with SMTP id 2mr16678136pbj.3.1371913403203; Sat, 22 Jun 2013 08:03:23 -0700 (PDT) Received: from localhost.localdomain ([1.23.214.121]) by mx.google.com with ESMTPSA id qp4sm9552333pbc.41.2013.06.22.08.03.16 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 22 Jun 2013 08:03:22 -0700 (PDT) From: Prabhakar Lad To: Mauro Carvalho Chehab , LMML , Hans Verkuil , Laurent Pinchart Subject: [PATCH RFC v3] media: OF: add video sync endpoint property Date: Sat, 22 Jun 2013 20:33:03 +0530 Message-ID: <1371913383-25088-1-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.9.5 CC: DLOS , Rob Landley , , , LKML , Rob Herring , Grant Likely , Sakari Ailus , Sylwester Nawrocki , Kyungmin Park , Guennadi Liakhovetski X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Lad, Prabhakar" This patch adds video sync properties as part of endpoint properties and also support to parse them in the parser. Signed-off-by: Lad, Prabhakar Cc: Hans Verkuil Cc: Laurent Pinchart Cc: Mauro Carvalho Chehab Cc: Guennadi Liakhovetski Cc: Sylwester Nawrocki Cc: Sakari Ailus Cc: Grant Likely Cc: Rob Herring Cc: Rob Landley Cc: devicetree-discuss@lists.ozlabs.org Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: davinci-linux-open-source@linux.davincidsp.com Cc: Kyungmin Park --- This patch has 10 warnings for line over 80 characters for which I think can be ignored. RFC v2 https://patchwork.kernel.org/patch/2578091/ RFC V1 https://patchwork.kernel.org/patch/2572341/ Changes for v3: 1: Fixed review comments pointed by Laurent and Sylwester. .../devicetree/bindings/media/video-interfaces.txt | 1 + drivers/media/v4l2-core/v4l2-of.c | 20 ++++++++++++++++++ include/dt-bindings/media/video-interfaces.h | 17 +++++++++++++++ include/media/v4l2-mediabus.h | 22 +++++++++++--------- 4 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 include/dt-bindings/media/video-interfaces.h diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt b/Documentation/devicetree/bindings/media/video-interfaces.txt index e022d2d..2081278 100644 --- a/Documentation/devicetree/bindings/media/video-interfaces.txt +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt @@ -101,6 +101,7 @@ Optional endpoint properties array contains only one entry. - clock-noncontinuous: a boolean property to allow MIPI CSI-2 non-continuous clock mode. +- video-sync: property indicating to sync the video on a signal in RGB. Example diff --git a/drivers/media/v4l2-core/v4l2-of.c b/drivers/media/v4l2-core/v4l2-of.c index aa59639..1a54530 100644 --- a/drivers/media/v4l2-core/v4l2-of.c +++ b/drivers/media/v4l2-core/v4l2-of.c @@ -100,6 +100,26 @@ static void v4l2_of_parse_parallel_bus(const struct device_node *node, if (!of_property_read_u32(node, "data-shift", &v)) bus->data_shift = v; + if (!of_property_read_u32(node, "video-sync", &v)) { + switch (v) { + case V4L2_MBUS_VIDEO_SEPARATE_SYNC: + flags |= V4L2_MBUS_VIDEO_SEPARATE_SYNC; + break; + case V4L2_MBUS_VIDEO_COMPOSITE_SYNC: + flags |= V4L2_MBUS_VIDEO_COMPOSITE_SYNC; + break; + case V4L2_MBUS_VIDEO_SYNC_ON_COMPOSITE: + flags |= V4L2_MBUS_VIDEO_SYNC_ON_COMPOSITE; + break; + case V4L2_MBUS_VIDEO_SYNC_ON_GREEN: + flags |= V4L2_MBUS_VIDEO_SYNC_ON_GREEN; + break; + case V4L2_MBUS_VIDEO_SYNC_ON_LUMINANCE: + flags |= V4L2_MBUS_VIDEO_SYNC_ON_LUMINANCE; + break; + } + } + bus->flags = flags; } diff --git a/include/dt-bindings/media/video-interfaces.h b/include/dt-bindings/media/video-interfaces.h new file mode 100644 index 0000000..1a083dd --- /dev/null +++ b/include/dt-bindings/media/video-interfaces.h @@ -0,0 +1,17 @@ +/* + * This header provides constants for video interface. + * + */ + +#ifndef _DT_BINDINGS_VIDEO_INTERFACES_H +#define _DT_BINDINGS_VIDEO_INTERFACES_H + +#define V4L2_MBUS_VIDEO_SEPARATE_SYNC (1 << 2) +#define V4L2_MBUS_VIDEO_COMPOSITE_SYNC (1 << 3) +#define V4L2_MBUS_VIDEO_SYNC_ON_COMPOSITE (1 << 4) +#define V4L2_MBUS_VIDEO_SYNC_ON_GREEN (1 << 5) +#define V4L2_MBUS_VIDEO_SYNC_ON_LUMINANCE (1 << 6) + +#define V4L2_MBUS_VIDEO_INTERFACES_END 6 + +#endif diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h index 83ae07e..a4676dd 100644 --- a/include/media/v4l2-mediabus.h +++ b/include/media/v4l2-mediabus.h @@ -11,6 +11,8 @@ #ifndef V4L2_MEDIABUS_H #define V4L2_MEDIABUS_H +#include + #include /* Parallel flags */ @@ -28,18 +30,18 @@ * V4L2_MBUS_[HV]SYNC* flags should be also used for specifying * configuration of hardware that uses [HV]REF signals */ -#define V4L2_MBUS_HSYNC_ACTIVE_HIGH (1 << 2) -#define V4L2_MBUS_HSYNC_ACTIVE_LOW (1 << 3) -#define V4L2_MBUS_VSYNC_ACTIVE_HIGH (1 << 4) -#define V4L2_MBUS_VSYNC_ACTIVE_LOW (1 << 5) -#define V4L2_MBUS_PCLK_SAMPLE_RISING (1 << 6) -#define V4L2_MBUS_PCLK_SAMPLE_FALLING (1 << 7) -#define V4L2_MBUS_DATA_ACTIVE_HIGH (1 << 8) -#define V4L2_MBUS_DATA_ACTIVE_LOW (1 << 9) +#define V4L2_MBUS_HSYNC_ACTIVE_HIGH (1 << (V4L2_MBUS_VIDEO_INTERFACES_END + 1)) +#define V4L2_MBUS_HSYNC_ACTIVE_LOW (1 << (V4L2_MBUS_VIDEO_INTERFACES_END + 2)) +#define V4L2_MBUS_VSYNC_ACTIVE_HIGH (1 << (V4L2_MBUS_VIDEO_INTERFACES_END + 3)) +#define V4L2_MBUS_VSYNC_ACTIVE_LOW (1 << (V4L2_MBUS_VIDEO_INTERFACES_END + 4)) +#define V4L2_MBUS_PCLK_SAMPLE_RISING (1 << (V4L2_MBUS_VIDEO_INTERFACES_END + 5)) +#define V4L2_MBUS_PCLK_SAMPLE_FALLING (1 << (V4L2_MBUS_VIDEO_INTERFACES_END + 6)) +#define V4L2_MBUS_DATA_ACTIVE_HIGH (1 << (V4L2_MBUS_VIDEO_INTERFACES_END + 7)) +#define V4L2_MBUS_DATA_ACTIVE_LOW (1 << (V4L2_MBUS_VIDEO_INTERFACES_END + 8)) /* FIELD = 0/1 - Field1 (odd)/Field2 (even) */ -#define V4L2_MBUS_FIELD_EVEN_HIGH (1 << 10) +#define V4L2_MBUS_FIELD_EVEN_HIGH (1 << (V4L2_MBUS_VIDEO_INTERFACES_END + 9)) /* FIELD = 1/0 - Field1 (odd)/Field2 (even) */ -#define V4L2_MBUS_FIELD_EVEN_LOW (1 << 11) +#define V4L2_MBUS_FIELD_EVEN_LOW (1 << (V4L2_MBUS_VIDEO_INTERFACES_END + 10)) /* Serial flags */ /* How many lanes the client can use */