From patchwork Fri Jan 6 14:30:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 90179 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp9472172qgi; Fri, 6 Jan 2017 06:31:37 -0800 (PST) X-Received: by 10.98.34.68 with SMTP id i65mr71515666pfi.135.1483713097527; Fri, 06 Jan 2017 06:31:37 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id w13si5237832pgm.99.2017.01.06.06.31.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jan 2017 06:31:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=collabora.com Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cPVYM-0007kH-12; Fri, 06 Jan 2017 14:31:34 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cPVYC-00077D-8K; Fri, 06 Jan 2017 14:31:27 +0000 Received: by mail-wm0-x241.google.com with SMTP id l2so5417173wml.2; Fri, 06 Jan 2017 06:31:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Rt/M7u9DSpkLWVxDNwhCHAWvOdp+VlBkOPfpwcOVOok=; b=ruRUs2uLaoG9Lh3OTB572rTS2HkBGXuppbMKdA0tQFeu/RJLgeur6NfvE9fC5eHbwO Cg84QCibjdgJfK4uHylq9/frz+vt5V+Nq1DFfaVpjdOxacxbfUBb0rmzcDVtjh1vK9KC gdfEdHElus5whtAp3NzXOrPruuK/AXSaGTXZTQTachBPHUrUvfaVMkn6XAIb2uJkYdws 3y9vDGT2953ETq+rBrwcDztxavOZC3TM7w+PpdtYANNIJFLwn2OyfOJnO8idXDju75k+ lW2RraBMRaSbO7aJc9i7SN6iCv3o4ZRW68rNxdrBLzaCPmCmnGV8BecA8xdUfjOPw9Ov VdaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Rt/M7u9DSpkLWVxDNwhCHAWvOdp+VlBkOPfpwcOVOok=; b=NRr4w18mlwzbSV/moye5JmVsVJzwpoW36hxqKj6W/y6BX2CqsH5ze7axGKsXEn9fwb 498Cqqp0f4T0EBzPAx/TuZxIyaveQFbMhZUPRczEXrWfm3qA1/siSeJIXmmIz6OXH1U9 klqER/GUHwqdP7KW+yAVzz8bSqBaFynxblcKBPai3SnnHRU0icEjv7VePboaVDJASWtU TBkYOGkXptRWwhxOS3nLhvEM6L+1YEYdcA1jn0rSoaTDSkIVkzz99fPJpN0pUtJ2GiJs 5uMd5Yvh8VW/4CyCAAinwywk9uxGcHqXhVmWVdgTEOpCK757hB11FxVE1hp66M8FwPZ3 gJmA== X-Gm-Message-State: AIkVDXL7sWtGCKK0C5f3FODuDwyrijouCe0p6ZROV6vhMOL1UbEhPD06aVLE3C7P+2BWDw== X-Received: by 10.223.130.232 with SMTP id 95mr1342874wrc.34.1483713062095; Fri, 06 Jan 2017 06:31:02 -0800 (PST) Received: from cizrna.lan ([109.72.12.216]) by smtp.gmail.com with ESMTPSA id u78sm3644493wma.11.2017.01.06.06.31.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jan 2017 06:31:01 -0800 (PST) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Subject: [PATCH v3 5/5] drm/rockchip: Implement CRC debugfs API Date: Fri, 6 Jan 2017 15:30:29 +0100 Message-Id: <20170106143029.11553-6-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170106143029.11553-1-tomeu.vizoso@collabora.com> References: <20170106143029.11553-1-tomeu.vizoso@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170106_063124_746191_17CD905C X-CRM114-Status: GOOD ( 12.24 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:241 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tomeu.vizoso[at]gmail.com) 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 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: Heiko Stuebner , Tomeu Vizoso , David Airlie , Emil Velikov , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, Thierry Reding , linux-arm-kernel@lists.infradead.org, Benjamin Gaignard , intel-gfx-trybot@lists.freedesktop.org, Daniel Vetter , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Mark Yao MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Implement the .set_crc_source() callback and call the DP helpers accordingly to start and stop CRC capture. This is only done if this CRTC is currently using the eDP connector. v3: Remove superfluous check on rockchip_crtc_state->output_type Signed-off-by: Tomeu Vizoso --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) -- 2.9.3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index fb5f001f51c3..5e19bef6d5b4 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -1105,6 +1106,52 @@ static void vop_crtc_destroy_state(struct drm_crtc *crtc, kfree(s); } +static struct drm_connector *vop_get_edp_connector(struct vop *vop) +{ + struct drm_crtc *crtc = &vop->crtc; + struct drm_connector *connector; + + mutex_lock(&crtc->dev->mode_config.mutex); + drm_for_each_connector(connector, crtc->dev) + if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { + mutex_unlock(&crtc->dev->mode_config.mutex); + return connector; + } + mutex_unlock(&crtc->dev->mode_config.mutex); + + return NULL; +} + +static int vop_crtc_set_crc_source(struct drm_crtc *crtc, + const char *source_name, size_t *values_cnt) +{ + struct vop *vop = to_vop(crtc); + struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc->state); + struct drm_connector *connector; + int ret; + + connector = vop_get_edp_connector(vop); + if (!connector) + return -EINVAL; + + *values_cnt = 3; + + if (source_name && + strcmp(source_name, "auto") == 0) { + + if (s->output_type != DRM_MODE_CONNECTOR_eDP) + return -EINVAL; + + ret = analogix_dp_start_crc(connector); + } else if (!source_name) + + ret = analogix_dp_stop_crc(connector); + else + ret = -EINVAL; + + return ret; +} + static const struct drm_crtc_funcs vop_crtc_funcs = { .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip, @@ -1112,6 +1159,7 @@ static const struct drm_crtc_funcs vop_crtc_funcs = { .reset = vop_crtc_reset, .atomic_duplicate_state = vop_crtc_duplicate_state, .atomic_destroy_state = vop_crtc_destroy_state, + .set_crc_source = vop_crtc_set_crc_source, }; static void vop_fb_unref_worker(struct drm_flip_work *work, void *val)