From patchwork Wed Jan 10 14:12:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 124098 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5325267qgn; Wed, 10 Jan 2018 06:12:39 -0800 (PST) X-Google-Smtp-Source: ACJfBov87HcTskl6xrPoxC1Mf3iVQ/ChV3ZKHxUwAC2pk82XqYo3g6nqHQn/Jd5FWcTiruJ98olP X-Received: by 10.99.125.9 with SMTP id y9mr15459278pgc.417.1515593559205; Wed, 10 Jan 2018 06:12:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515593559; cv=none; d=google.com; s=arc-20160816; b=FQC4VCKivwRYA5E0eVoabw7a7XypRE4D2U9IFiSa9sEoHw1rlgs1TrKq+hLz4Mm5ME 2fM0X1DcNRrOtJifYgTrj0n41TAAgT9UndN8z8e79g/GC9qIHBR29qphFCHE5ihuLx4w CJkrBniwjHqOtqQkExNeMgY6wmPxCw7JhUBogVc4K+lXtV/KQQqv2/41gBEaOTvbX0KW UiQMQcwa+iZSfI3iTbFZu1XaWdWpyjW2FrtwNGHtVRk7/KqgxDrqxRFx0AkPgPpVqMZx TZCZ+QB6UjYssuBBnX8qqXFlTZYzh2fUFCb/ipXxdxmO8w5oewqirhJjTkw5u6+wB5gf V7rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=MEcRAxl4rCqRIqvsAs+MYu1/NRVP/TIihoXUFu8ey0A=; b=J/yerEqy14jkstBElqY+sUk7aCqcnwug6eU6g8z9zby0UjogGvD2ObhDavb3HyURdN DPbTZCBexyAK+ezx/+YJ4g2d2hvsJIdhAFz5zwFsJs4h943hYB1c47uFBjHphqVrPV1e xR49fLlJ8N2mTdhQj+6DlnAx/YcypYn105YtPEXq5TbGsO2bxcG9IcVvpm4iAxfhfDqa SyWoQujCWjPa9xLtF0l0Ko//mN24B8Zx36DFHeNIo57qeS9JN/TZXhxqSj6IlcqEOyGp kXsMjRW39Glgq2g6QdSWuApHquUkP7h0F0j2LiWOfnmfdZuDBQOVWpxKFduCoY7z/yWK OyWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=LgVB60nA; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id a15si12102772pll.818.2018.01.10.06.12.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2018 06:12:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=LgVB60nA; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B71F66E2D1; Wed, 10 Jan 2018 14:12:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5A85B6E2CF for ; Wed, 10 Jan 2018 14:12:36 +0000 (UTC) Received: by mail-lf0-x241.google.com with SMTP id j143so20009559lfg.0 for ; Wed, 10 Jan 2018 06:12:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0NKER+TkXQ8r9fIntYWGr2MJV1xi7N1nXTdWuUUf5Cc=; b=LgVB60nAXUATUA3gokh2EdcIx8T2l1oH7LUG2bBczp3LK2lAtRwMXe9l/i/j589bfT VE3mnXvzbXReR8rT/JMVvtSno1WpMU+Rl2Mm3yhVZsssaeiR9MlkvILHOYWJZ685h03e ntGkLfDD9MVzRFgU+PirBiAWnJrlU1RBFBBSo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0NKER+TkXQ8r9fIntYWGr2MJV1xi7N1nXTdWuUUf5Cc=; b=hSAATeKn0uIsqjg6IKHjHt3lNCbJOHGik34wrzkbejHRm8S8++fEO5CcrKwikqHoyE oZIt/xWtcJJGSBQxJqSi15/hw+s8ZuyHBYbqtncAKdY4hHkHgyGuFGG+WSBdALXxxXgK JqtzNkBTnSIPFT9pgAdiCHIzMbVd16+ioU4XVOLoFc1G7+cLHYsqgwfBPL8LQHWhsrCz LvrqdwhO/thnjFpqwhxy6yr1mxzn1qrUxfI4hDO0PtreQmJJqWEmxyrom8WmiscEaZ88 0gtUZIs2vE3z2yOKBjLuufi805RDtG3tdhiP+4podCzXbaa0gzakKYc6N3RZYyLJkkZZ +zpA== X-Gm-Message-State: AKGB3mKsgQdKA+BGK1IX9rb7P6T93dqPQhrJPW306CX7uI8dbw92OEO4 o6VSAAOyTaUm5bzYbBbvQgrK1g== X-Received: by 10.46.33.163 with SMTP id h35mr12087777lji.0.1515593554843; Wed, 10 Jan 2018 06:12:34 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id u72sm1019258lfi.64.2018.01.10.06.12.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jan 2018 06:12:34 -0800 (PST) From: Linus Walleij To: Archit Taneja , Andrzej Hajda , Laurent Pinchart Subject: [PATCH 2/4 v6] drm/bridge: Provide a way to embed timing info in bridges Date: Wed, 10 Jan 2018 15:12:24 +0100 Message-Id: <20180110141226.27826-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180110141226.27826-1-linus.walleij@linaro.org> References: <20180110141226.27826-1-linus.walleij@linaro.org> Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" After some discussion and failed patch sets trying to convey the right timing information between the display engine and a bridge using the connector, I try instead to use an optional timing information container in the bridge itself, so that display engines can retrieve it from any bridge and use it to determine how to drive outputs. Signed-off-by: Linus Walleij --- ChangeLog v5->v6: - Sort forward struct declarations alphabetically - Switch to using DRM_BUS_FLAG_PIXDATA_[POS|NEG]EDGE to indicate positive or negatice clock samling edge ChangeLog ->v5: - New patch --- include/drm/drm_bridge.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 682d01ba920c..28c9ac6d9036 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -29,6 +29,7 @@ #include struct drm_bridge; +struct drm_bridge_timings; struct drm_panel; /** @@ -222,6 +223,23 @@ struct drm_bridge_funcs { void (*enable)(struct drm_bridge *bridge); }; +/** + * struct drm_bridge_timings - timing information for the bridge + * @sampling_edge: whether the bridge samples the digital input signal from the + * display engine on the positive or negative edge of the clock, this should + * reuse the DRM_BUS_FLAG_PIXDATA_[POS|NEG]EDGE bitwise flags from the DRM + * connector (bit 2 and 3 valid) + * @setup_time_ps: the time in picoseconds the input data lines must be stable + * before the clock edge + * @hold_time_ps: the time in picoseconds taken for the bridge to sample the + * input signal after the clock edge + */ +struct drm_bridge_timings { + u32 sampling_edge; + u32 setup_time_ps; + u32 hold_time_ps; +}; + /** * struct drm_bridge - central DRM bridge control structure * @dev: DRM device this bridge belongs to @@ -229,6 +247,8 @@ struct drm_bridge_funcs { * @next: the next bridge in the encoder chain * @of_node: device node pointer to the bridge * @list: to keep track of all added bridges + * @timings: the timing specification for the bridge, if any (may + * be NULL) * @funcs: control functions * @driver_private: pointer to the bridge driver's internal context */ @@ -240,6 +260,7 @@ struct drm_bridge { struct device_node *of_node; #endif struct list_head list; + const struct drm_bridge_timings *timings; const struct drm_bridge_funcs *funcs; void *driver_private; From patchwork Wed Jan 10 14:12:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 124099 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5325313qgn; Wed, 10 Jan 2018 06:12:41 -0800 (PST) X-Google-Smtp-Source: ACJfBoudIrzpcasp0Qy1YH60PUpYlkVQ/bic5nXuVpuV+tJyb/7HMhtsXdgCrBnMuIF52MFfC7y0 X-Received: by 10.99.120.203 with SMTP id t194mr14307130pgc.53.1515593561173; Wed, 10 Jan 2018 06:12:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515593561; cv=none; d=google.com; s=arc-20160816; b=DlDIejAyigNpNppiQzVS+jAtJHd1ZGUhY5nYhrflRTftkK6u8KdLLDyLm/4T4hOort bXrh0PxhsFkFeb6p0KzY2x1t1gNDNVgMisN3oBQKMYuML760O2utTf1AptdjEAY83bGJ +nN8yQ+0AKeB8ubvBkbP47S1OqHE8QUcm6rTVMenTYe4h6mIzXmIgq6HscBdkTu1FiGg 3WQj82ounYMKyoHgTOio5hMonOeGzx9SkmcVyKB12bDRnFFIuiUAw7qvlpE5xjmYJwCr sFJa6+Lo/hHc9EkuL9VsbG+nFxecO+FtYn5UFDjdEKN8rc+1QR20Exyag08PtH/ZVyG0 KguA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=VxN3C+koALL1AxJmbGZcuwLfROrqoDVyV9QvZEyhC4o=; b=a3GxRSLsi92lr9MRWmcSjlgI0kR6yT7vAMfgYN3NRgCuQzkyW6+75A1u96W5skOCOb 3QeuAkP8gf35t5TVVKvZ5zNPbY3NfzcRmqwlEnwfLfFYHigZm+wX83fcNk0NlbrUKm21 7rAcJjlmhCSQ0D30aNFfg27M0hqVmvs4ax98FHLrB6gGaqw0VGzgZeh57JkiK7I6RhOY 7x4Xxc02e57ASx+Y1ro2m1K5c3hoo7tIoCIGQGPpKpFm7OMsa1vDXr9rD7bBIL3gX3cW 4uXz1Ku23yUR7Yurq8Py4WnzczhcRAC9tK1gYec+cvsFVS6iqgtPxIF824Oluhmy42qL VXbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OoQGAgQ7; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id z3si1363420pgr.12.2018.01.10.06.12.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2018 06:12:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OoQGAgQ7; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B5666E2D4; Wed, 10 Jan 2018 14:12:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 924536E2D4 for ; Wed, 10 Jan 2018 14:12:38 +0000 (UTC) Received: by mail-lf0-x241.google.com with SMTP id u2so5546833lff.7 for ; Wed, 10 Jan 2018 06:12:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=z2JcY7odEzBpM5y/UJZlDlPtURq803oKvAZHv3wupm4=; b=OoQGAgQ7YVdktIkrYSflqviBrncZfB6MWiFW6DNZtBonu/GWLsRZ8tzdqzsCTyE7cl ac6SXImsIm2G8QIKCy+LJ3qxWcjtSDx0ApYKL1XVTVLVXp7yFDWyrSMHn9zWkCm2yGH2 qMIplGddyb2rGzAv2UCNYgspzFu8CaQMJ8/XM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=z2JcY7odEzBpM5y/UJZlDlPtURq803oKvAZHv3wupm4=; b=RBAuHXCFaQ21gnajPzIhUW1zwM7GzXTcxh+Lcy6lUmyLAEsd3/iMNap8AcnJ/LDUTK 0A9MoRxFCsUmxyvdn0LDE8DPPOvDKZ0YYsArOBNgSDKpnJAmQFBgoExQhgpLWNK1+G5U yx0Z0cvJeoskWbSXKcCcB2V8M2Ij2uXKqpcnRi8scls1w0RdTJOIe743u7t8SsiTA+zD 8uOXtCqWCA/sHPEMXKfGLziZyl+QP0BFaFXKdYwQ+lRVSUiyIeO1OuSH0E2C36I1vShz C7EjHW1zAHG4cw/1ypqJTcwnY487ZN/OGzpac0UpM8BDHNomxrsFjP78KoRx0psnvtDc vNWQ== X-Gm-Message-State: AKwxytem+6FELinIRTx7JlGSwNTG0unebNKU2u+itt01qo6AtLunoaAo R7Mg+UO59y30PcH8a4tOj/B77A== X-Received: by 10.25.161.19 with SMTP id k19mr9964169lfe.127.1515593556952; Wed, 10 Jan 2018 06:12:36 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id u72sm1019258lfi.64.2018.01.10.06.12.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jan 2018 06:12:36 -0800 (PST) From: Linus Walleij To: Archit Taneja , Andrzej Hajda , Laurent Pinchart Subject: [PATCH 3/4 v6] drm/bridge: Add timing support to dumb VGA DAC Date: Wed, 10 Jan 2018 15:12:25 +0100 Message-Id: <20180110141226.27826-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180110141226.27826-1-linus.walleij@linaro.org> References: <20180110141226.27826-1-linus.walleij@linaro.org> Cc: Bartosz Golaszewski , dri-devel@lists.freedesktop.org, Maxime Ripard , linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This extends the dumb VGA DAC bridge to handle the THS8134A and THS8134B VGA DACs in addition to those already handled. We assign the proper timing data to the pointer inside the bridge struct so display controllers that need to align their timings to the bridge can pick it up and work from there. Cc: Bartosz Golaszewski Cc: Maxime Ripard Reviewed-by: Laurent Pinchart Signed-off-by: Linus Walleij --- ChangeLog v5->v6: - Use DRM_BUS_FLAG_PIXDATA_[POS|NEG]EDGE to indicate the sampling edge of the clock signal. - Skip intermediate variable for timings. - Leave timings as NULL for really dumb VGA DACs. - Collect Laurent's Review tag. ChangeLog v4->v5: - Rewrite the support using the new concept of defining fine-granular sampling (setup+hold) timing definitions stored in the bridge timings struct. ChangeLog v3->v4: - Actually have the code syntactically correct and compiling :( (Kconfig mistake.) (...) AS usr/initramfs_data.o AR usr/built-in.o CC drivers/gpu/drm/bridge/dumb-vga-dac.o AR drivers/gpu/drm/bridge/built-in.o AR drivers/gpu/drm/built-in.o AR drivers/gpu/built-in.o AR drivers/built-in.o (...) ChangeLog v2->v3: - Move const specifier. - Cut one line of code assigning bus flags. - Preserve the "ti,ths8135" compatible for elder device trees. ChangeLog v1->v2: - Alphabetize includes - Use a u32 with the bus polarity flags and just encode the polarity using the DRM define directly. - Rename vendor_data to vendor_info. - Simplify assignment of the flag as it is just a simple u32 now. - Probe all TI variants on the "ti,ths813x" wildcard for now, we only need to know that the device is in this family to set the clock edge flag right. --- drivers/gpu/drm/bridge/dumb-vga-dac.c | 59 +++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c index de5e7dee7ad6..498d5948d1a8 100644 --- a/drivers/gpu/drm/bridge/dumb-vga-dac.c +++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c @@ -11,6 +11,7 @@ */ #include +#include #include #include @@ -204,6 +205,7 @@ 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); @@ -222,10 +224,61 @@ static int dumb_vga_remove(struct platform_device *pdev) return 0; } +/* + * We assume the ADV7123 DAC is the "default" for historical reasons + * Information taken from the ADV7123 datasheet, revision D. + * NOTE: the ADV7123EP seems to have other timings and need a new timings + * set if used. + */ +static const struct drm_bridge_timings default_dac_timings = { + /* Timing specifications, datasheet page 7 */ + .sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE, + .setup_time_ps = 500, + .hold_time_ps = 1500, +}; + +/* + * Information taken from the THS8134, THS8134A, THS8134B datasheet named + * "SLVS205D", dated May 1990, revised March 2000. + */ +static const struct drm_bridge_timings ti_ths8134_dac_timings = { + /* From timing diagram, datasheet page 9 */ + .sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE, + /* From datasheet, page 12 */ + .setup_time_ps = 3000, + /* I guess this means latched input */ + .hold_time_ps = 0, +}; + +/* + * Information taken from the THS8135 datasheet named "SLAS343B", dated + * May 2001, revised April 2013. + */ +static const struct drm_bridge_timings ti_ths8135_dac_timings = { + /* From timing diagram, datasheet page 14 */ + .sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE, + /* From datasheet, page 16 */ + .setup_time_ps = 2000, + .hold_time_ps = 500, +}; + static const struct of_device_id dumb_vga_match[] = { - { .compatible = "dumb-vga-dac" }, - { .compatible = "adi,adv7123" }, - { .compatible = "ti,ths8135" }, + { + .compatible = "dumb-vga-dac", + .data = NULL, + }, + { + .compatible = "adi,adv7123", + .data = &default_dac_timings, + }, + { + .compatible = "ti,ths8135", + .data = &ti_ths8135_dac_timings, + }, + { + .compatible = "ti,ths8134", + .data = &ti_ths8134_dac_timings, + }, {}, }; MODULE_DEVICE_TABLE(of, dumb_vga_match); From patchwork Wed Jan 10 14:12:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 124100 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5325346qgn; Wed, 10 Jan 2018 06:12:42 -0800 (PST) X-Google-Smtp-Source: ACJfBovac302PnfX0g7/tAd0Ep+nNIksvLnSAyWoOMBQoOG9Ekf743W7nZFooo9pK9Yn6D9hCnXo X-Received: by 10.84.238.197 with SMTP id l5mr12364544pln.443.1515593562892; Wed, 10 Jan 2018 06:12:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515593562; cv=none; d=google.com; s=arc-20160816; b=Hg5xUIVvTaJVPivmMEszwytTnIDrLbEDDRZQqwpkpSLFGw57KGobyvuL0z3/Tsc898 WVzDBlB5BexKOQsg6BHg99SrE1LZ5whpJoxfATgD4Zsc8/DT3huih+KZqiXGU2cPeqpb v8XQrEt74ztUjr4bNz2/rGCtXCgCPVflEeeAtc6oFirSR5+FnA/uwh7aYAUFcOzPqSEJ s5SFFp4BibRPsITEFRlkbAuFhngn69voBAPhfflMFnGpT4OzTipZh87DC5iNVDYdPzmr I42JrzdQpOzkwhPsL6KH1CzUInWnJJMyntO3gg6J2LQ1YVySD4cMBQzxoV6hIWW04JPv ZQww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=RifRwkw/Mf2nlTAqFvlyLve5jzfgcNnM8FsSCxo+rT4=; b=hW7SK9dY+Qjw0GbhW46Psx9olG0qFcjmESrY4d8zUNOba5G1ek1h2oKXCp7W+EZRJB j3Wu/ZUL+GFz6qSPAwTbEfgXE0P+1T3yM/1Sd/joLi+DDFYYKyosUe2VoZjbsKE0mlfj vHSLaGqQwqjsixibXJqRt4irGBkiTKDgytedSWtbDgUmIpoXe+z1kvQt0FZKK2+1ifIH uKkyGVPB4pTqR1e14CTBIiWd7a5ATTpMg2MY11iQMGF8JN2iMcqT7c6ricmJ/X0oL+fS xFoqqhvL04u7BpSFMfZ/T/TNJkcZNHLNzHHHAfonMsEFvfLAl2V78gN8HvzHynwjB5Qc A0Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=d50GunxG; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id v11si4947735plz.285.2018.01.10.06.12.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2018 06:12:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=d50GunxG; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B34C56E2D8; Wed, 10 Jan 2018 14:12:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x244.google.com (mail-lf0-x244.google.com [IPv6:2a00:1450:4010:c07::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9DB2D6E2D8 for ; Wed, 10 Jan 2018 14:12:40 +0000 (UTC) Received: by mail-lf0-x244.google.com with SMTP id m8so13930057lfc.6 for ; Wed, 10 Jan 2018 06:12:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/gBFTrI0KIXSs8pCWtsRDDOFrm0TSyo4lpBgEk5HEB8=; b=d50GunxG0Uc7yi4AAOOzReTtyfF6EM2H7w3PRri/y2Fyr2L/pt3oMjEvCVc2hQ7yaI i/F2fItEPt19fYjGan/jmz056bY89N4QPEmKtEZm/MPu5Luxb1H/WIUeFjA2chlfWPOj GovQxm12+iYzmXNiCISpnhgLJlclD8FCyjAyY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/gBFTrI0KIXSs8pCWtsRDDOFrm0TSyo4lpBgEk5HEB8=; b=P8cNN2ZMT3hVD2eKNt9OY4LSMbTmO5PN1l8JLuuUeNduhoxkvmN3KQESTyQ5pkxyEA y+gN/e3seeCp30MB+sPt6gQCGxX/TTxJOrx4aAeP9qphdcpVzpDTQdsHvRYZ7IzEpC1s +BLlOWp3nNeWoxRFZWgACqi8v8vTM62Z/XL1obdYJkMB5zvZnMbiazHNK9ZhRnDhl6CE cEDCD8quL80R+IkzfbxccMsyAaOaXSKqz9FlIZzg7/KRuid8xtAlHW1KBkrDJ351RUHx vVPQFChxvyMzl5Z7vrYjKNNNdY+LFzEr8C/cfVYOMvLNwD8MhSIWYviWcJIq8tBwC1EJ fzRg== X-Gm-Message-State: AKwxytcjp7RuQpWHuDUWNRs8gGBxF5chjCYmnIGyGU+GqFaXJ3Jgni2g 1xLODDQL2hiBfc16jKngzY6lXA== X-Received: by 10.25.212.83 with SMTP id l80mr8683204lfg.83.1515593558862; Wed, 10 Jan 2018 06:12:38 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id u72sm1019258lfi.64.2018.01.10.06.12.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jan 2018 06:12:38 -0800 (PST) From: Linus Walleij To: Archit Taneja , Andrzej Hajda , Laurent Pinchart Subject: [PATCH 4/4 v6] drm/pl111: Support handling bridge timings Date: Wed, 10 Jan 2018 15:12:26 +0100 Message-Id: <20180110141226.27826-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180110141226.27826-1-linus.walleij@linaro.org> References: <20180110141226.27826-1-linus.walleij@linaro.org> Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If the bridge has a too strict setup time for the incoming signals, we may not be fast enough and then we need to compensate by outputting the signal on the inverse clock edge so it is for sure stable when the bridge samples it. Since bridges in difference to panels does not expose their connectors, make the connector optional in the display setup code. Acked-by: Laurent Pinchart Signed-off-by: Linus Walleij Reviewed-by: Eric Anholt --- ChangeLog v5->v6: - Collect Laurent's ACK. ChangeLog v4->v5: - Use the new bridge timings setup method. --- drivers/gpu/drm/pl111/Kconfig | 1 + drivers/gpu/drm/pl111/pl111_display.c | 35 +++++++++++++++++++++++++++++++---- drivers/gpu/drm/pl111/pl111_drv.c | 20 +++++++++++--------- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig index e5e2abd66491..82cb3e60ddc8 100644 --- a/drivers/gpu/drm/pl111/Kconfig +++ b/drivers/gpu/drm/pl111/Kconfig @@ -8,6 +8,7 @@ config DRM_PL111 select DRM_GEM_CMA_HELPER select DRM_BRIDGE select DRM_PANEL_BRIDGE + select DRM_DUMB_VGA_DAC select VT_HW_CONSOLE_BINDING if FRAMEBUFFER_CONSOLE help Choose this option for DRM support for the PL111 CLCD controller. diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index 06c4bf756b69..7fe4040aea46 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -94,6 +94,7 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, const struct drm_display_mode *mode = &cstate->mode; struct drm_framebuffer *fb = plane->state->fb; struct drm_connector *connector = priv->connector; + struct drm_bridge *bridge = priv->bridge; u32 cntl; u32 ppl, hsw, hfp, hbp; u32 lpp, vsw, vfp, vbp; @@ -143,11 +144,37 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, if (mode->flags & DRM_MODE_FLAG_NVSYNC) tim2 |= TIM2_IVS; - if (connector->display_info.bus_flags & DRM_BUS_FLAG_DE_LOW) - tim2 |= TIM2_IOE; + if (connector) { + if (connector->display_info.bus_flags & DRM_BUS_FLAG_DE_LOW) + tim2 |= TIM2_IOE; - if (connector->display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE) - tim2 |= TIM2_IPC; + if (connector->display_info.bus_flags & + DRM_BUS_FLAG_PIXDATA_NEGEDGE) + tim2 |= TIM2_IPC; + } + + if (bridge) { + const struct drm_bridge_timings *btimings = bridge->timings; + + /* + * Here is when things get really fun. Sometimes the bridge + * timings are such that the signal out from PL11x is not + * stable before the receiving bridge (such as a dumb VGA DAC + * or similar) samples it. If that happens, we compensate by + * the only method we have: output the data on the opposite + * edge of the clock so it is for sure stable when it gets + * sampled. + * + * The PL111 manual does not contain proper timining diagrams + * or data for these details, but we know from experiments + * that the setup time is more than 3000 picoseconds (3 ns). + * If we have a bridge that requires the signal to be stable + * earlier than 3000 ps before the clock pulse, we have to + * output the data on the opposite edge to avoid flicker. + */ + if (btimings && btimings->setup_time_ps >= 3000) + tim2 ^= TIM2_IPC; + } tim2 |= cpl << 16; writel(tim2, priv->regs + CLCD_TIM2); diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index 201d57d5cb54..101a9c7db6ff 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -107,11 +107,17 @@ static int pl111_modeset_init(struct drm_device *dev) ret = PTR_ERR(bridge); goto out_config; } - /* - * TODO: when we are using a different bridge than a panel - * (such as a dumb VGA connector) we need to devise a different - * method to get the connector out of the bridge. - */ + } else if (bridge) { + dev_info(dev->dev, "Using non-panel bridge\n"); + } else { + dev_err(dev->dev, "No bridge, exiting\n"); + return -ENODEV; + } + + priv->bridge = bridge; + if (panel) { + priv->panel = panel; + priv->connector = panel->connector; } ret = pl111_display_init(dev); @@ -125,10 +131,6 @@ static int pl111_modeset_init(struct drm_device *dev) if (ret) return ret; - priv->bridge = bridge; - priv->panel = panel; - priv->connector = panel->connector; - ret = drm_vblank_init(dev, 1); if (ret != 0) { dev_err(dev->dev, "Failed to init vblank\n");