From patchwork Wed Sep 5 05:21:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 10588255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 607B0112B for ; Wed, 5 Sep 2018 05:22:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 449D12871F for ; Wed, 5 Sep 2018 05:22:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3873929545; Wed, 5 Sep 2018 05:22:40 +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,RCVD_IN_DNSWL_NONE autolearn=ham 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 BC0B02871F for ; Wed, 5 Sep 2018 05:22:39 +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=FYDjn5Ku+buAD2KSN6LzUpP5LTktF6kSFf338F3V5N4=; b=CulPPgR0lDkFZqZiuUE4cq5v5p BEaJKikYQZ/nWyy4d/Q9cLzA+/fFQjctrjik/e6DGYjmCLt0V91bJNLCpF1njkdVYoBH6pMzwlrBK JDEgxjMxYPbUhFgW3w6sfpBHdhHwkklUV4zzd1ErVrpbAlWAXt+8fJs53cmhwfOmENr7f2nKqG9rr R71GrFZ0uRDulBnCPo7nlQyQJZuPVFMpKBlQK6Y85vEIYlTKWNI9f4m60kDsuCBDtVBcIbNCeX0Zt 5itqQmQehbOIm2+Ik/lLcy5skRJZx6h6QgV85VRJvB8LA3b3g7sD1um1MaCjbj1EhDBO0mx4Vf2JJ xx7TSTGA==; 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 1fxQGk-0005R6-Is; Wed, 05 Sep 2018 05:22:22 +0000 Received: from mail.kmu-office.ch ([2a02:418:6a02::a2]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fxQG7-0003yh-VN for linux-arm-kernel@lists.infradead.org; Wed, 05 Sep 2018 05:21:46 +0000 Received: from trochilidae.hsd1.wa.comcast.net (unknown [IPv6:2601:602:8700:fb00:81ae:bc59:4e6c:42ca]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 055AB5C0817; Wed, 5 Sep 2018 07:21:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1536124895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uK/GQdVH7PkUQsL+YoVMx2UuUPh+rzLHDJjMZD7LfN4=; b=huj3Z1Wddp7tH6U/gLlO4BEjJ4PtwA0TFp8Iro7ax/dgrGbF+Z7Xr5u683u08/yNQL+C1m gyROqwL0BLWn2e9WNiPUN1+qzFfCQAVckcD+h1nXZmTRdOAH14VG13FK2kM59MOP82P9hw krypeJ3GTPaGSDkjxaTOeHM9zuW24fs= From: Stefan Agner To: linus.walleij@linaro.org, airlied@linux.ie, robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, s.hauer@pengutronix.de, p.zabel@pengutronix.de Subject: [PATCH 2/6] drm/bridge: allow to specify data-enable polarity Date: Tue, 4 Sep 2018 22:21:09 -0700 Message-Id: <20180905052113.21262-2-stefan@agner.ch> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180905052113.21262-1-stefan@agner.ch> References: <20180905052113.21262-1-stefan@agner.ch> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180904_222144_196086_E22ADE9F X-CRM114-Status: GOOD ( 12.95 ) 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, architt@codeaurora.org, max.krummenacher@toradex.com, marcel.ziswiler@toradex.com, gustavo@padovan.org, maarten.lankhorst@linux.intel.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, a.hajda@samsung.com, linux-imx@nxp.com, kernel@pengutronix.de, fabio.estevam@nxp.com, sean@poorly.run, Stefan Agner , linux-arm-kernel@lists.infradead.org, Laurent.pinchart@ideasonboard.com 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 Support boards with a passive RGB to VGA bridge which require a low active data-enable polarity. Signed-off-by: Stefan Agner --- Alternatively a new dt binding could be introduced for dumb VGA bridges requiring low active data enable... However, also other polarities might need a specific polarity, hence this generic approach might be better. drivers/gpu/drm/bridge/dumb-vga-dac.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c index 7a5c24967115..2b8c3d629f2f 100644 --- a/drivers/gpu/drm/bridge/dumb-vga-dac.c +++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c @@ -179,6 +179,7 @@ static struct i2c_adapter *dumb_vga_retrieve_ddc(struct device *dev) static int dumb_vga_probe(struct platform_device *pdev) { struct dumb_vga *vga; + u32 de; vga = devm_kzalloc(&pdev->dev, sizeof(*vga), GFP_KERNEL); if (!vga) @@ -194,6 +195,23 @@ static int dumb_vga_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "No vdd regulator found: %d\n", ret); } + vga->bridge.funcs = &dumb_vga_bridge_funcs; + vga->bridge.of_node = pdev->dev.of_node; + vga->bridge.timings = of_device_get_match_data(&pdev->dev); + + if (!vga->bridge.timings && + !of_property_read_u32(pdev->dev.of_node, "de-active", &de)) { + struct drm_bridge_timings *timings; + + timings = devm_kzalloc(&pdev->dev, sizeof(*timings), GFP_KERNEL); + if (!timings) + return -ENOMEM; + + timings->bus_flags = de ? DRM_BUS_FLAG_DE_HIGH : + DRM_BUS_FLAG_DE_LOW; + vga->bridge.timings = timings; + } + vga->ddc = dumb_vga_retrieve_ddc(&pdev->dev); if (IS_ERR(vga->ddc)) { if (PTR_ERR(vga->ddc) == -ENODEV) { @@ -205,10 +223,6 @@ static int dumb_vga_probe(struct platform_device *pdev) } } - vga->bridge.funcs = &dumb_vga_bridge_funcs; - vga->bridge.of_node = pdev->dev.of_node; - vga->bridge.timings = of_device_get_match_data(&pdev->dev); - drm_bridge_add(&vga->bridge); return 0;