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);