From patchwork Tue May 29 15:05:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10436287 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EFFFC60327 for ; Tue, 29 May 2018 15:44:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF96F288CB for ; Tue, 29 May 2018 15:44:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D443B2894B; Tue, 29 May 2018 15:44:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1D3B8288CB for ; Tue, 29 May 2018 15:44:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=53c9OUxnaPLWXrX/EQk6OQaH4FbTj44NpM3YD5TMvCw=; b=YH4E8gGOFpw76BNKHqvRevPDmt fck9VTu/NA6iOLGeD1BonyWQNejor/ImqBjlmFQ6YxLwkmYqFoD5KNCSocRcf/U3QaoWU5dWDjV4+ 4RSekPUkpdVrExtjm6gwmM4V/i5jRJj957n7rzCv7bo3fZQY14bYfEy93uRa3yFsG0uPwuj4vCgol REk7dMbX0fdpMS0UEmtvLTqNz4WcQ7u/PSuctEjY4eI17Ft14TM+8b9SqKOLi1C9rSIrKEmK6uHMn uIeUkl8dK96he3Y/lvKGPztWktYEEhk1assKAUqQpmLGKl4xDlI3qRSzzuj0d0C67kIEZJGcvFSHl 7OmhClSw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fNgmz-0002da-Nb; Tue, 29 May 2018 15:43:57 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fNglC-0001gT-2h for linux-arm-kernel@bombadil.infradead.org; Tue, 29 May 2018 15:42:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TCLtVeyrUD0kluc4yd/I/RP7gg9JSK+ZK4OzGoAzvSo=; b=fpWoR2OVLadDzNLOsOQrM6D3F tQlq9oUfGm3JYdH/b0GkSLDXnbxkRQ0Qq1CVJ+NxU3M6PE1mKMMLa+7ZsSH5B98qDaStYF2vbu2yg yecOctqPhNbtRrjtsS3+eE/PyEuQYB9onycNWtKfCUUNfaBGX+vAikBiBrmqmyjPCjNxRlkOKztWK ADR52PlH7VEmX6xq+DSqdNcH/fqLz2VPlc4iMK+fLPUaTNCVcsEsT1wv3gluRgt0CT9c3l//Vtpve 66dL5mE3X+e7zWgom5BH1xdEBkOzxtO+qYKhb5SGuxtXWCBpCbbsbLqQd9ASiJYLtwPohTyiMafPw T2SF84dgA==; Received: from relay11.mail.gandi.net ([217.70.178.231]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fNgD3-0004EL-D7 for linux-arm-kernel@lists.infradead.org; Tue, 29 May 2018 15:06:50 +0000 Received: from w540.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id CE50D10000A; Tue, 29 May 2018 17:06:42 +0200 (CEST) From: Jacopo Mondi To: niklas.soderlund@ragnatech.se, laurent.pinchart@ideasonboard.com, horms@verge.net.au, geert@glider.be Subject: [PATCH v3 7/8] media: rcar-vin: Handle 'hsync-as-de' property Date: Tue, 29 May 2018 17:05:58 +0200 Message-Id: <1527606359-19261-8-git-send-email-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527606359-19261-1-git-send-email-jacopo+renesas@jmondi.org> References: <1527606359-19261-1-git-send-email-jacopo+renesas@jmondi.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180529_110649_572231_76A2D299 X-CRM114-Status: GOOD ( 13.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, robh+dt@kernel.org, hans.verkuil@cisco.com, sakari.ailus@linux.intel.com, Jacopo Mondi , mchehab@kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Parse and handle 'hsync-as-de' custom property and set the CHS flag during the VIN interface setup. Signed-off-by: Jacopo Mondi --- v3: - new patch - use the new custom property to set the CHS bit --- drivers/media/platform/rcar-vin/rcar-core.c | 6 ++++++ drivers/media/platform/rcar-vin/rcar-dma.c | 6 ++++++ drivers/media/platform/rcar-vin/rcar-vin.h | 2 ++ 3 files changed, 14 insertions(+) -- 2.7.4 diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index 3062171..71710b8 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -589,6 +589,7 @@ static int rvin_parallel_parse_v4l2(struct device *dev, struct rvin_dev *vin = dev_get_drvdata(dev); struct rvin_parallel_entity *rvpe = container_of(asd, struct rvin_parallel_entity, asd); + const struct fwnode_handle *fwnode = vep->base.local_fwnode; if (vep->base.port || vep->base.id) return -ENOTCONN; @@ -610,6 +611,11 @@ static int rvin_parallel_parse_v4l2(struct device *dev, return -EINVAL; } + if (fwnode_property_read_bool(fwnode, "renesas,hsync-as-de")) + vin->parallel->chs = true; + else + vin->parallel->chs = false; + return 0; } diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 9145b56..01d0737 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -124,6 +124,7 @@ #define VNDMR2_VPS (1 << 30) #define VNDMR2_HPS (1 << 29) #define VNDMR2_CES (1 << 28) +#define VNDMR2_CHS (1 << 23) #define VNDMR2_FTEV (1 << 17) #define VNDMR2_VLV(n) ((n & 0xf) << 12) @@ -703,6 +704,11 @@ static int rvin_setup(struct rvin_dev *vin) /* Data Enable Polarity Select */ if (vin->parallel->mbus_flags & V4L2_MBUS_DATA_ENABLE_LOW) dmr2 |= VNDMR2_CES; + + /* Use HSYNC as data-enable signal */ + if (vin->parallel->mbus_type == V4L2_MBUS_PARALLEL && + vin->parallel->chs) + dmr2 |= VNDMR2_CHS; } /* diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h index 8bc3704..846f978 100644 --- a/drivers/media/platform/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/rcar-vin/rcar-vin.h @@ -78,6 +78,7 @@ struct rvin_video_format { * @subdev: subdevice matched using async framework * @mbus_type: media bus type * @mbus_flags: media bus configuration flags + * @chs: use HSYNC as data-enable flag * @source_pad: source pad of remote subdevice * @sink_pad: sink pad of remote subdevice * @@ -88,6 +89,7 @@ struct rvin_parallel_entity { enum v4l2_mbus_type mbus_type; unsigned int mbus_flags; + bool chs; unsigned int source_pad; unsigned int sink_pad;