From patchwork Fri Dec 15 12:10:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 122079 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp386057qgn; Fri, 15 Dec 2017 04:12:07 -0800 (PST) X-Google-Smtp-Source: ACJfBouL+YKETs8+7GzCsApY/HpfI34JMOs0c+wHPLPHf1PJ/ft3boHD8dOftVMDrtI1NQPmfzjm X-Received: by 10.98.156.81 with SMTP id f78mr13107017pfe.211.1513339927292; Fri, 15 Dec 2017 04:12:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513339927; cv=none; d=google.com; s=arc-20160816; b=SZWMXF5XnQEh7QEeAIp9BP/NLWRQR0oWEcFLxSin+uQ+xcSpYTau1NzmGEXYrhJe3n Lf216ULk4iAal5SFvCMU27H4BWsE0SIB8pVJCCnaAdy6G5tor3ZH5MlLlxADu8OimLIF yg//D9ynpchkIWngPwQrNJb7ZU5GSQqHWy1qpc9euX7dMY7aZhPxWiJoXwx0wSg8LLUW WR7i6CXote5MxschpAc6tvHOzIs0yx7BBWbeFh++vW2xW7BhXlJBE91TvdiiVsSrai+p hDhEnSu4CEShJb4O79vdNGBwi8pzzFNLihI82yp6UTmK+1qSS7h18nXvp7gxYUMTK/rF 3nXQ== 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=iIX+lLU3kgLz0RAPiHSuMqgaE24PEow+adxn7RNRNsk=; b=zv1RxgttPRoA8vpu2SO/R6zQf66k5yCsHenqbFyNto1jrq4IhLNQ/6+FI/SgOTbmVw VHebTuYFZAUy1Xyr8KzGaj5AlN2MPnkGN/pp4JJ5b8hGl6smsZDzgfO3Fs/ytrTCXBWo eezOi0wWVmTCL41Vqf6syyxPnpwswwxKTCQtJWVwkgGMBL2rpOKgTOvcKMPGE+f5vK0F Fw2y6xebtoJiVlN72pDmkfjxm3AoNSkLZBhoHa4lEydaUaB3LHTaTuaroMtakne9jUGo TKDSO3oCsKgSvjvbI6NfFB2gQ0WVaXKnubP0rhSUXmEUZayG4iLMDivwD8jT0rDzfgP9 3rWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Cn6vY2GD; 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 66si4247672pld.784.2017.12.15.04.12.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Dec 2017 04:12:07 -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=Cn6vY2GD; 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 17EDD6E7E2; Fri, 15 Dec 2017 12:11:36 +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 E04E26E7E2 for ; Fri, 15 Dec 2017 12:11:34 +0000 (UTC) Received: by mail-lf0-x241.google.com with SMTP id f18so10206906lfg.8 for ; Fri, 15 Dec 2017 04:11:34 -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=TGSG2xCzauO3XJhdlnx4VWOWiTUnorIrXPxF2OS6jQk=; b=Cn6vY2GDzDwKir1c0xOvYdqnem7kR6YJz0b0/K4VPQjuhyRCDZrhYyyL4dJG991wax QnpYEqE/7lseUkLS+dJVgF4pnTunYjYDjLvJOVm9l1f/U9+N5lUaNWtqVsI8z/3smtCk KG/3G7JjRKCZ82kZe2YE84QHpwyUqkEXYGrGY= 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=TGSG2xCzauO3XJhdlnx4VWOWiTUnorIrXPxF2OS6jQk=; b=j9lZFYzKpFokROOFYP5MRSdnYed/U5Y9MrY2WMvp3xcZyjino8jYteYk0s5X1KZsZG Uv4N44z1g/aHa+OujG3wqQKjTWaJIN7nmWSF26MfHnS7SzyN5g26pdWj/EL/gHnAXp5d U9Yu9mXa5F4ilakbRb2LKp9GbPkkHIRu2eIw3tOe8956x3Vam7BLggvCLmWlT2uBmbPm 9/AMDmjQlUnV6z8msGj7f3KhbxV4RTLUsHqo8jDv1OszqaDeefnAfJLSdk+HyHdF+fkr j3+7TvYupyyZkGElvUINwt8Nm5fr15QZB++rQKS1zJV4haGQcJP2+2fP08KEYwsXrLcZ Yz0g== X-Gm-Message-State: AKGB3mLLR1GrJU+k8LRw+Q6vWfVfz+nLZ5hpKzqOryGvy4Zj6O13YZL5 G3TukTp3OE1JWy96Qmhbzx4f0A== X-Received: by 10.46.29.11 with SMTP id d11mr6056635ljd.24.1513339893366; Fri, 15 Dec 2017 04:11:33 -0800 (PST) Received: from localhost.localdomain ([90.229.2.39]) by smtp.gmail.com with ESMTPSA id z81sm1289345lff.80.2017.12.15.04.11.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Dec 2017 04:11:32 -0800 (PST) From: Linus Walleij To: Archit Taneja , Andrzej Hajda , Laurent Pinchart Subject: [PATCH 2/4 v5] drm/bridge: Provide a way to embed timing info in bridges Date: Fri, 15 Dec 2017 13:10:45 +0100 Message-Id: <20171215121047.3650-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171215121047.3650-1-linus.walleij@linaro.org> References: <20171215121047.3650-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: - New patch --- include/drm/drm_bridge.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 682d01ba920c..3bf34f7c90d4 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -30,6 +30,7 @@ struct drm_bridge; struct drm_panel; +struct drm_bridge_timings; /** * struct drm_bridge_funcs - drm_bridge control functions @@ -222,6 +223,22 @@ 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 - false means + * negative edge, true means positive edge. + * @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 rising or falling edge + */ +struct drm_bridge_timings { + bool 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 +246,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 +259,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 Fri Dec 15 12:10:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 122077 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp385563qgn; Fri, 15 Dec 2017 04:11:41 -0800 (PST) X-Google-Smtp-Source: ACJfBotvOA1bpqnaaF6E4YIe2poMiCM6Q7M/6OuYbpa2s2Xi2arVVqMSCCauvIP9gcs1s5+KrOlS X-Received: by 10.99.117.13 with SMTP id q13mr11707589pgc.231.1513339901626; Fri, 15 Dec 2017 04:11:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513339901; cv=none; d=google.com; s=arc-20160816; b=OUJCtLoQGn+2PD/D+u743H/ZnNhPnwumm4jNCoe2lhQdIjoi1MN81FkmBLSirbe0pP WWOb5DHbfRLhkDyk4jbdFeRPJ9eNyg06V/gyc/JBPlptf/bFCegt5iieEv70ovxlc1Uk L0lf8k3GKG7cy7ckXSm7qG+Rsb1hk/Lx3Lqmfrw/MFb6b7eCjLte1Bl2/z0lvhHDPRWf zar/w8EWZPKVUEfDc3kV9i0fPTPffOiX25FcyHLSvDwnO6nsxDQVkli8wW8GfcJe9poN Fu9S8Z3A2r597pdfUqHsUmMRsRhPhMeuJDznFTu/39XN0B2D2hjoOuI9uhhin+EF/hbL oQkQ== 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=oLMKuXgjlUleKHH6irv0eTrRnIW6pmK+DVv4CxT7mfA=; b=HZpWCZshCrdkTklDLkYWgzKpfF2xlblOyECTW5yRxGguMrjGFxSZgnxlFACoMA/9iy IhfXG0GvZ7AGvGJpGji2//MhtXjOmRZYS5vY4/M4Jr4YQ7eMyRhhTmgPpLJEH1PAemop +dzYBrdmVGkppBo1+yIRv7UF7fJ4UCGq+OwNpObbvBxb4yn2f6+9AqmnGmNsvl2yJIfh cxvy7aVJpmG/76w9jx7VQl1MqhjfBCvUvmh7drfc0Y7Iq9+iAj0fmUhBjBGQvu1qWIHe EoLu9in1KcPCVYNrKfBbDcDWEYDs0XTF5T9cEc2ZEcsKcMzHXUY9yRTNnXtGTBFUJx8k oneA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=M6YOESfX; 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 t23si4447810pgu.361.2017.12.15.04.11.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Dec 2017 04:11: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=M6YOESfX; 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 CACE86E7E5; Fri, 15 Dec 2017 12:11:40 +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 D00306E7E5 for ; Fri, 15 Dec 2017 12:11:39 +0000 (UTC) Received: by mail-lf0-x244.google.com with SMTP id g74so294176lfk.7 for ; Fri, 15 Dec 2017 04:11:39 -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=91qdHsnGQ4Aaul+oAvpWP+q40Yws8+84WpE9Z14WiOg=; b=M6YOESfX54IvUZko7nbCIrNrrM2gIJ/MDWQXas9Bd1Jg+NTYFhzxND4G9daq8nWtQC naQ2JjJnT7NHL959q/E87IECCU0FQA3Z+w+Qqrjph0Htg8b7Ar69eUDR4TE0/HFzRIwP lQu8VRuuyhvN9oQIyGKP8tyhHCRs/etdBRubw= 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=91qdHsnGQ4Aaul+oAvpWP+q40Yws8+84WpE9Z14WiOg=; b=hcNgw3fzKFko6IzIflJIQuTM6nNH5kKFh3Lw29FfEAqQ/I496f2mD1CnAh4sSv3StV jF2Gy+oznABR3zP7GmO0l1a6RkOeUDoasOKj/T/H0m2Ex7G/pDtLEyjZcC1F//CGkJuY QLZoh+gerqhXbGKkV28vB02yIgAaPGYNGk9Slwk0dlmc3fI+wbgbT4Yu988ZPkUIqwoO 58aAfAlLc9eGui5ruzdFmjHf8EnfUj0S4brB8UVI5IS/mYa3uV3cQeVhL1FzvgfqoVw7 2Em35QG9CCPNI3EHA1IBUfs/SvpE909D/vGF+qah2EaFE4Wv9ygpAyx0TAlXQPaG5z4y pNqg== X-Gm-Message-State: AKGB3mJhshD/GxkP+ZzaZij2LaZ2im/wMiI1oAk+0SZLbVN7K3wSC8s+ bi4bUZkZIbmUGGvb73NfqCPVGA== X-Received: by 10.25.121.10 with SMTP id u10mr5918392lfc.50.1513339898084; Fri, 15 Dec 2017 04:11:38 -0800 (PST) Received: from localhost.localdomain ([90.229.2.39]) by smtp.gmail.com with ESMTPSA id z81sm1289345lff.80.2017.12.15.04.11.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Dec 2017 04:11:37 -0800 (PST) From: Linus Walleij To: Archit Taneja , Andrzej Hajda , Laurent Pinchart Subject: [PATCH 3/4 v5] drm/bridge: Add timing support to dumb VGA DAC Date: Fri, 15 Dec 2017 13:10:46 +0100 Message-Id: <20171215121047.3650-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171215121047.3650-1-linus.walleij@linaro.org> References: <20171215121047.3650-1-linus.walleij@linaro.org> Cc: Laurent Pinchart , 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: Laurent Pinchart Cc: Bartosz Golaszewski Cc: Maxime Ripard Signed-off-by: Linus Walleij Reviewed-by: Laurent Pinchart --- 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 | 61 +++++++++++++++++++++++++++++++++-- 1 file changed, 58 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..34788783a90f 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 @@ -176,11 +177,13 @@ static struct i2c_adapter *dumb_vga_retrieve_ddc(struct device *dev) static int dumb_vga_probe(struct platform_device *pdev) { struct dumb_vga *vga; + const struct drm_bridge_timings *timings; vga = devm_kzalloc(&pdev->dev, sizeof(*vga), GFP_KERNEL); if (!vga) return -ENOMEM; platform_set_drvdata(pdev, vga); + timings = of_device_get_match_data(&pdev->dev); vga->vdd = devm_regulator_get_optional(&pdev->dev, "vdd"); if (IS_ERR(vga->vdd)) { @@ -204,6 +207,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 = timings; drm_bridge_add(&vga->bridge); @@ -222,10 +226,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 = true, + .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 = true, + /* 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 = true, + /* 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 = &default_dac_timings, + }, + { + .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 Fri Dec 15 12:10:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 122080 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp386230qgn; Fri, 15 Dec 2017 04:12:16 -0800 (PST) X-Google-Smtp-Source: ACJfBosXfn2p2jczeiL/ySlM5rOB080Wheva/egxdXUHPs5lEH3eghtFOWQFndzO6MZOuYnOfC7S X-Received: by 10.159.205.139 with SMTP id v11mr13402472plo.233.1513339936510; Fri, 15 Dec 2017 04:12:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513339936; cv=none; d=google.com; s=arc-20160816; b=jcyYTLnOWObefOH2ML4YHH289mOqv/On4vMUGx7ydpPi+r0UoRE19LaycUaLLmE57P xAA4Wsz+gt3HmQ4m0drFxjVHTt1whM8+GwEkQ/Iik1Zvx24EeGGFDALuRToGgDuvcxXT OY9p5Kn4Y00J8A8Z5NrbGe+zewv9dejp+oKuVEMj/uAUWerb4tnwz9irSWD/I58HhJMR 7wZ0nCZ5YCHcsn1jBosQrg+D82Ijar2XAWdZpPI2FvH4CuPzpjqJ+KLu12ufx/9VLcQW yHI3aj1/zrg2NWB/zkhnfdrDbyC+OQJiOuHacZTyAV7GALzQ8eCoCmWrFCYLfSHz5Cld FHTw== 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=Fz7VKvZf2T2de4/Jh8AfsGDsTzPS6lzMZKiXqpBdA94=; b=SAsd56BCtJvTTGsrFWKhM8J2X10zGh5WouQciuYy4NLeQn2gNG0ohcg7IyTPbJZX2r ICeKr+F0JIBnz2hEphRBDMokiVCmcxRcArsmoEfgbeVpmtxyk3QZwxvOegSnQBxnrfgb kRKiuAkVLpOEM0BWJcz0WEwjAuBakPvympgWvZFKJUluE/V46/N/GAxdegrPDkOnvSLN B2/FnLMY9zE4HorpAJXC0AoL2e1O8sf8HCDeQKeJRLiqbEEw+zI8j0iF4unrXP7ZBvTn yXJn2jSk7+FK6fyBZQzx2PN7Sj7Zqo9gy4OFgAcBsf+xAww+VkiFYGD7hHGTsbbqQxBN ykgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=LmcF7Ycc; 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 k185si4495060pge.131.2017.12.15.04.12.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Dec 2017 04:12:16 -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=LmcF7Ycc; 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 85A536E7E7; Fri, 15 Dec 2017 12:11:45 +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 DE9CB6E7E7 for ; Fri, 15 Dec 2017 12:11:43 +0000 (UTC) Received: by mail-lf0-x244.google.com with SMTP id j124so10238726lfg.2 for ; Fri, 15 Dec 2017 04:11:43 -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=E3LbcZrWs1F/3W5h91Nx2QsW58Glj1jmJ6padzI36Do=; b=LmcF7YccXKdfklMt71XDrPgv5a5ObWygUpELKdAGyZLIZ/0SeuUqnDt4T/sb1Hm5OK 64OF6Tr6YCj3mch4p/hODSns9Yxd4HWl1dfucuQYRDIUA4Ivdp/GfX4JLHyjn5Ufwo8L liXreVxw1TMeboBPluZZJiAZs8fg4NsuDTYho= 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=E3LbcZrWs1F/3W5h91Nx2QsW58Glj1jmJ6padzI36Do=; b=hyYTTUVCL1jmLC7izevCsdcEh7Nr5eHo97tN2WvVdVMwUuU2dqBlxDcTn0+y9e5KUJ 8EPKh+U69z1bf0fUpvgPTf4oknNrRjdaRq0RcD0GHkhPRgUDyCUdBb6OOkS9isbhI+Fm aB6o2eAZUjg+A/TXevcMlQWIJy9MRos8HQHxQhVpAQU8g/jZoVLMvuyeAuxaAjjFW5Fs nLbk18emArT3A1boUrGi3q4dwqacpxLy+5juwVR/+a5pOFal3sL8dnKTaw7r96RmZZHQ SWSqYkULNuKzDV+cOO2kuZaYnvJzFtGSctyxa6UhKFa5TSxWTT+gBV08J5oq/d1f1hKw wx7w== X-Gm-Message-State: AKGB3mLjtr0k38sSaSzrM+9g/uQphzLaU6B9OMp7bIo9kl2TTQWGYdhc P01ubJ9jgNeZ7awmJrzMQnJBnA== X-Received: by 10.25.233.142 with SMTP id j14mr5534265lfk.101.1513339902270; Fri, 15 Dec 2017 04:11:42 -0800 (PST) Received: from localhost.localdomain ([90.229.2.39]) by smtp.gmail.com with ESMTPSA id z81sm1289345lff.80.2017.12.15.04.11.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Dec 2017 04:11:41 -0800 (PST) From: Linus Walleij To: Archit Taneja , Andrzej Hajda , Laurent Pinchart Subject: [PATCH 4/4 v5] drm/pl111: Support handling bridge timings Date: Fri, 15 Dec 2017 13:10:47 +0100 Message-Id: <20171215121047.3650-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171215121047.3650-1-linus.walleij@linaro.org> References: <20171215121047.3650-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. Signed-off-by: Linus Walleij Acked-by: Laurent Pinchart --- 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");