From patchwork Fri Sep 1 09:46:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111477 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp793563qge; Fri, 1 Sep 2017 02:46:30 -0700 (PDT) X-Received: by 10.84.133.36 with SMTP id 33mr1719256plf.19.1504259190082; Fri, 01 Sep 2017 02:46:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504259190; cv=none; d=google.com; s=arc-20160816; b=tic/7X6zUWZq/K9uOneWNl8+HC9+7Q7fpVKG/nXm8CKNkVP6508bhiYeCEVTZ1N3tk onlF/VK4UPQMtFwEuF+55K2ruCHHuMPHyjRkriDJXGUDQUEmLzUxiC4H0HtBUt0jXAPI /DiBMetXGfn8utWf599d/s+ju+S7RD2BXFkjSKoKNVxh/Q8bYtgF0vSZiehNmatqh3+9 zUzBE+IGwZhOFacvGqFiOD6eLFGo8rA8j0glcK9yI6clZGiCXIVILYHRZ/55Y6CDqqTP kvfvOuzAcIICQwDtaXBsTKpojXM+qOhGlq+4Y7MJgeR1DLFZrksYbKOMxrfbUpkxYsxn Vbvg== 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:message-id:date:subject:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=yAeSUoSnO/oIuFeT+u3L2goPQ9jji20+6BOUOXv5K/Y=; b=ZQmERSHRCeDggLl9409mfnSN0c1flqdPPTygznMXtuTukG60Tf3wObyp4cf3EJbsyf IX9/JbCvl+uGxyvt2fwHVb2SgxG+IFc9Lvjxs6BH9zpV6VtCMABRG6J9gKp6WI5rHl36 syL2IqCybC9C1e4ijxE1/c8Ck7p5SrOGz3RQDS78VqEPNZrD9fUWg02LCxbnr9KkQl0u 4WUxjvfbEz+iSw4WVcvFP8jhFTf5L+9+7S3QXURWi6qgrGdLMIKzaxJz+ukf+1GGnz9K dwNuX6uxIUYtSO91UtY3Z9qdOEL+Psx6dVj4t3Ba8+uANQVrq4n68dJhKw3j1ICoGv9i oftw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=JNo/FTbh; 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 x1si1628913pgo.164.2017.09.01.02.46.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 02:46:30 -0700 (PDT) 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=JNo/FTbh; 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 A08AD6E062; Fri, 1 Sep 2017 09:46:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x235.google.com (mail-lf0-x235.google.com [IPv6:2a00:1450:4010:c07::235]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4DE7B6E062 for ; Fri, 1 Sep 2017 09:46:27 +0000 (UTC) Received: by mail-lf0-x235.google.com with SMTP id z12so7345210lfd.3 for ; Fri, 01 Sep 2017 02:46:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=1if6UqJAlYSL6UX7S+chW+EyvRmIZM3yqs9cD0rxrRA=; b=JNo/FTbh7BGwVL3XBCuCbwaWzoif/RVyY04laODe/4v2Q+A2UGjk4wOYaARJSPUJIj 38azOrjH2DmneiZEe/Z/aAF3EONSUFeNFiHhuoktSb2qLkeOPzJ5qLIsT5ILNn3YTTjC +ZTeIQNuJj2hPzX4nsqJS5hDtX0szGkSiS9yA= 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; bh=1if6UqJAlYSL6UX7S+chW+EyvRmIZM3yqs9cD0rxrRA=; b=J+DtMbMAN7Oneod6gRq8+3qBEJn317GeOSPKUUcHRI0dilXcAtXgSDXVlm712Ar1Z4 wg50FqBopOkV546AM553SM1wPlSOIo5Bq081rRXwrzSHHU55NGV4yKH+0ewi1wdEI3rP JcJK+ek2WIayf+DRCsc2LlsYiCPgEWRyW5YSi7YDE7XWx/Z3Mdf4NNYZ01rNp7GZnmiz HxyF4+2ZNpg5xgP140lRy+tLgcigcg02ZBLYN+Ngga+Ln0emaRJXONeKtsnIfzb3g5JK z0eWfVFndzjgtMWLyfm8IXpofWEaoKsB12Q7t34jA9RjgSxFnZrWwKbm8MB8x6Zqz7Xn oV7g== X-Gm-Message-State: AHPjjUjLQV/MzEpoRtifsYF2L0jM3clXYuntZ8X8yOH+qkB9NQPQgO7x VeGESFbXVdMQcpZh X-Google-Smtp-Source: ADKCNb6qTsR4xVxoXIeh45CVSUYbFXJfdjXEXSgjLvpv8nmD/xACt8GaYC6UQ7btbqCTNOdHfwJvEg== X-Received: by 10.46.84.92 with SMTP id y28mr357698ljd.147.1504259185577; Fri, 01 Sep 2017 02:46:25 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id e82sm345199lji.83.2017.09.01.02.46.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Sep 2017 02:46:25 -0700 (PDT) From: Linus Walleij To: Archit Taneja , Andrzej Hajda , Laurent Pinchart Subject: [PATCH 1/2] RFC: drm: bridge: Add API to fetch connector Date: Fri, 1 Sep 2017 11:46:22 +0200 Message-Id: <20170901094622.6519-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 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" We need to be able to get the connector out of a dumb VGA for the PL111 driver. This is because we are using the connector in the driver when initializing the display pipe. Signed-off-by: Linus Walleij --- This is a bit ugly but not uglier than how we are reaching into the connector of the panels in several drivers. I don't know any better idea, advice welcome. --- drivers/gpu/drm/bridge/dumb-vga-dac.c | 7 +++++++ include/drm/dumb_vga_dac.h | 9 +++++++++ 2 files changed, 16 insertions(+) create mode 100644 include/drm/dumb_vga_dac.h diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c index 6c2fdcb4fde1..c0d46ab7fde0 100644 --- a/drivers/gpu/drm/bridge/dumb-vga-dac.c +++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c @@ -19,6 +19,7 @@ #include #include #include +#include /** * struct vga_dac_variant - characteristics of the DAC @@ -51,6 +52,12 @@ drm_connector_to_dumb_vga(struct drm_connector *connector) return container_of(connector, struct dumb_vga, connector); } +struct drm_connector *drm_dumb_vga_get_connector(struct drm_bridge *bridge) +{ + return &drm_bridge_to_dumb_vga(bridge)->connector; +} +EXPORT_SYMBOL_GPL(drm_dumb_vga_get_connector); + static int dumb_vga_get_modes(struct drm_connector *connector) { struct dumb_vga *vga = drm_connector_to_dumb_vga(connector); diff --git a/include/drm/dumb_vga_dac.h b/include/drm/dumb_vga_dac.h new file mode 100644 index 000000000000..b7117222054d --- /dev/null +++ b/include/drm/dumb_vga_dac.h @@ -0,0 +1,9 @@ +#ifndef _DUMB_VGA_DAC_H_ +#define _DUMB_VGA_DAC_H_ + +struct drm_connector; +struct drm_bridge; + +struct drm_connector *drm_dumb_vga_get_connector(struct drm_bridge *bridge); + +#endif From patchwork Fri Sep 1 09:40:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111476 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp788848qge; Fri, 1 Sep 2017 02:41:05 -0700 (PDT) X-Received: by 10.84.137.106 with SMTP id 97mr1716319plm.304.1504258865697; Fri, 01 Sep 2017 02:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504258865; cv=none; d=google.com; s=arc-20160816; b=J2cFI/pXEfZE9T5kvBfEjkLSJtpRVs1+jGKQlsLHcXyJc/UIXXev13sYWRRB0RSVlK zIYckbdYnLeAOBmMBVX9/e4/JRk0bVQecSjJ0uLmwPnam8f13pVSC44qr65bI+dhs62O EPCxginI8COsjVtmS3GMRY0ztsT14kDMzR6LadSnXOVnt68here7rYVh8U7Ps50AhkCw HL0R51YcXMu/1cB/tjZgdAgj1VNvRXvyhisjhwCcrzuCl3bJQoJTJwGgbWrm00qSjO+H DBpbxxjRwFVn0ID6cUAF8BNH2eD16wCNS2bxPmgc05NFr2ApMM7BFQMWz8lSr1asz5lf 8COQ== 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:message-id:date:subject:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=IKndWs2xeQlhBMiRrLuF+4inu+As5ZDejAYU50C/tBs=; b=BGgjkaMP/EGIwZ5qPbc5Ckw8gMrmQolu7wq37FATC7stPtOvRe8UIMkeEb+Qe3ZpnS JKfo91oOiYQUUHqIoyWP3u8N73p3rYTAosVCQ5seGG2XLbUyXaDVzla7C9/LFqyukULb 5wGPsfxhWLAr5BrzMfsnO3Tj7xdqQRaV42zhlt+w4rOO9EjJxzEnp/Y3D/v96be8pKfc Yig8/Gp4lgAxE2ReZOKeRwKkrP3cLxR9T2S52mhtwBHAfBBg7+2xErAUBqsGairYwlDs QylY9qcnTxuc6HU3dMNGarUjrTax5qnn87NUbYCHhtqicPPgT2gdIIUUFeOhMlMrmkkC Adlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Tuz8T2FB; 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 x5si1519801plm.140.2017.09.01.02.41.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 02:41:05 -0700 (PDT) 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=Tuz8T2FB; 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 B93A86E804; Fri, 1 Sep 2017 09:41:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x22d.google.com (mail-lf0-x22d.google.com [IPv6:2a00:1450:4010:c07::22d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7E0726E804 for ; Fri, 1 Sep 2017 09:41:03 +0000 (UTC) Received: by mail-lf0-x22d.google.com with SMTP id g18so7349428lfl.2 for ; Fri, 01 Sep 2017 02:41:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=o/ej2FjQu2npDRBXrAGv29FkV2oWHLvp7UzxTwPe2eI=; b=Tuz8T2FBD30m1YpkxtclVU1yyMJoOW8NxygVRJj+NleBcjIsmeya6sWNDXWy6ImdDW OleCvGvBv8PPZ8Lrh9Un8BgcSRS8Iiuljunf/gRYNlLgjxZucPx5DaBy7Lr4HH8PaHMy jYuSRMB04McU+J7rBzeSf4+BqL7D7CYMX5IcQ= 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; bh=o/ej2FjQu2npDRBXrAGv29FkV2oWHLvp7UzxTwPe2eI=; b=T+8UThEuSdx5IaFbS+82W3qGQ8w/WPSsOyE2ZgRib96zwy+mOj15lyjhbguWuTBEX/ mJlE5VZU7MDdsyxQCWkMZEFM6AvS1I4N27dLQRb9QisDotL2PIh8uV/gxUxW+j0/n0OQ 6NW594WW0aINhokkd8n4E2K1KeX0n7U/BUTpqut/0LKXz4tdeaQxCLlJEvmnADFRA4e8 mCsXhx2VuRUiTH+tf0fYm/cMRRjY9qgtffaTn5SOYxpt0chmu7ld+FHZpY5f6LMwzmam Km7+Vujbme236BIinH5yS84SQntuSUYCT93Z29y/4eykUe/ZxTc32JphforXbewxnmeb bflw== X-Gm-Message-State: AHPjjUijVIcFtWQRZ/cgmV3EWx/kvfLeM4kYtpK3Vfb1MSZzFPH89gUB oVnqf5JIW/jdrVPy X-Google-Smtp-Source: ADKCNb7NGyAI7wOD7eTecG+SvF9icQM/mvrLnkcG6Lv24pbXkS+cTWVM9LtL+u/5fncMHQQa5zch1w== X-Received: by 10.25.228.199 with SMTP id x68mr541199lfi.24.1504258861722; Fri, 01 Sep 2017 02:41:01 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id h89sm341629lji.56.2017.09.01.02.41.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Sep 2017 02:41:01 -0700 (PDT) From: Linus Walleij To: Archit Taneja , Andrzej Hajda , Laurent Pinchart Subject: [PATCH 2/2] drm: bridge: Add THS8134A/B support to dumb VGA DAC Date: Fri, 1 Sep 2017 11:40:58 +0200 Message-Id: <20170901094058.4387-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 Cc: Laurent Pinchart , dri-devel@lists.freedesktop.org, Bartosz Golaszewski , 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. The THS8134A, THS8134B and as it turns out also THS8135 need to have data clocked out at the negative edge of the clock pulse, since they clock it into the DAC at the positive edge (so by then it needs to be stable) so we need some extra logic to flag this on the connector to the driver. The semantics of the flag DRM_BUS_FLAG_PIXDATA_NEGEDGE in clearly indicates that this flag tells when to *drive* the data, not when the receiver *reads* it, so the TI variants needs to be handled like this. Introduce a variant struct and contain the information there, and add a bit of helpful comments about how this works so people will get it right when adding new DACs or connectiong new display drivers to DACs. The fact that THS8135 might be working on some systems today is probably due to the fact that the display driver cannot configure when the data is clocked out and the electronics have simply been designed around it so it works anyways. The phenomenon is very real on the ARM reference designs using PL111 where the hardware can control which edge to push out the data. Cc: Laurent Pinchart Cc: Bartosz Golaszewski Cc: Maxime Ripard Signed-off-by: Linus Walleij --- drivers/gpu/drm/bridge/dumb-vga-dac.c | 62 +++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c index 831a606c4706..6c2fdcb4fde1 100644 --- a/drivers/gpu/drm/bridge/dumb-vga-dac.c +++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -19,9 +20,20 @@ #include #include +/** + * struct vga_dac_variant - characteristics of the DAC + * @posedge_clk: this DAC latches data into the DAC on the positive + * edge of the clock pulse, which means that display controllers + * need to clock it out on the negative edge + */ +struct vga_dac_variant { + bool posedge_clk; +}; + struct dumb_vga { struct drm_bridge bridge; struct drm_connector connector; + struct vga_dac_variant const *variant; struct i2c_adapter *ddc; struct regulator *vdd; @@ -67,6 +79,18 @@ static int dumb_vga_get_modes(struct drm_connector *connector) /* And prefer a mode pretty much anyone can handle */ drm_set_preferred_mode(connector, 1024, 768); + if (vga->variant->posedge_clk) + /* + * If the DAC latches the data into its registers on the + * positive edge of the clock, the display driver needs to + * drive the data out on the negative edge so it is + * stable at the positive edge, so as to avoid flicker. + * + * Tell the driver that we want data on the negative edge + */ + connector->display_info.bus_flags |= + DRM_BUS_FLAG_PIXDATA_NEGEDGE; + return ret; } @@ -183,6 +207,7 @@ static int dumb_vga_probe(struct platform_device *pdev) if (!vga) return -ENOMEM; platform_set_drvdata(pdev, vga); + vga->variant = of_device_get_match_data(&pdev->dev); vga->vdd = devm_regulator_get_optional(&pdev->dev, "vdd"); if (IS_ERR(vga->vdd)) { @@ -226,10 +251,41 @@ static int dumb_vga_remove(struct platform_device *pdev) return 0; } +static const struct vga_dac_variant default_dac_variant = { + /* + * These DACs read data on the negative edge. For example in the + * ADV7123 datasheet (revision D, page 8) there is a timing diagram + * making this clear. + */ + .posedge_clk = false, +}; + +static const struct vga_dac_variant ti_ths_dac_variant = { + /* The TI DACs read the data on the positive edge of the CLK */ + .posedge_clk = true, +}; + 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_variant, + }, + { + .compatible = "adi,adv7123", + .data = &default_dac_variant, + }, + { + .compatible = "ti,ths8134a", + .data = &ti_ths_dac_variant, + }, + { + .compatible = "ti,ths8134b", + .data = &ti_ths_dac_variant, + }, + { + .compatible = "ti,ths8135", + .data = &ti_ths_dac_variant, + }, {}, }; MODULE_DEVICE_TABLE(of, dumb_vga_match);