From patchwork Tue Aug 9 10:51:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 9270851 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C96C86082E for ; Tue, 9 Aug 2016 10:52:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAA212711E for ; Tue, 9 Aug 2016 10:52:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF4A827F8D; Tue, 9 Aug 2016 10:52:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6531C2711E for ; Tue, 9 Aug 2016 10:52:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E45A66E4BF; Tue, 9 Aug 2016 10:52:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id C45E26E4BF for ; Tue, 9 Aug 2016 10:52:28 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id o80so2320367wme.0 for ; Tue, 09 Aug 2016 03:52:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=koZDaLFQS4EonGgs4cPKn7q+jj43whjMjwYnj4T63tI=; b=Gunuykm6yXbOhSrWzLiIhkhjUptr5jE/R4s6IsG2aILcPY8iHtl81PuC5A92LUSOpA NuokMEyHdhJq1krgUYTCEeHrTCilPUsX61Gr65Qao2noeHaOImMSzBGDIxipNAJMJgnK LhLdyIghCaNtUNc4zEhBfc8xu7B/X3dh8mfMHWg4NG+XSOLggZOvhmNhthf3W2wB3uHC PR5GwdQ3QH0Qw1S4/bLOiCCk2LGp6NVCJIEA0Ol7mJOPnSG8IvxGafTjqXpN6mQV9HlX 5953nLOVTOteXDBcOUhCSPTrCQVqEsGdt6HFWqw/8CXJXzm4oWyChbzMdEn8P6l4R4iB Hcrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=koZDaLFQS4EonGgs4cPKn7q+jj43whjMjwYnj4T63tI=; b=Um7IyB4lLjXpMRtaYaRuuAihJcLpsWnzVneFmlHEIO/4t1+NonKXlV2J4jlmNjS5mu 2aQUS6cwwL6n+wuWrVcoQzyNFUFfvdETC5ffLGshZXsGXzJcWVpW7EGOZDHnE+T4QbTn TrYSlXIasCJKoDnCuMvCyjOel+yxSVPBSUwqX5POLCKYLBPYTPiZ9uAVqpwzKQ0iEUi1 ivUatO4t6Fy3/xtikemDY5XwH5+uQFCoA2vdBlJ56rJWx8dy6DZ94KuiHwxlUrNYY8Lh LG+Uvaq+BryP+EPBDrCTgrxeqSAd0dpWU46fR6dDECVfGyIIumWJd+9uRGzLygfzgK8V G81g== X-Gm-Message-State: AEkoous4Mvz+qC7QGFMHy+HeL7RDD/lFwYJr+GQX2oAWGpLlZVQPze//xKFUzDmqKaBtmg== X-Received: by 10.194.35.42 with SMTP id e10mr88268835wjj.107.1470739947347; Tue, 09 Aug 2016 03:52:27 -0700 (PDT) Received: from cizrna.lan ([109.72.12.53]) by smtp.gmail.com with ESMTPSA id q4sm37404825wjk.24.2016.08.09.03.52.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Aug 2016 03:52:26 -0700 (PDT) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Subject: [PATCH v1 5/5] drm/rockchip: Implement CRC debugfs API Date: Tue, 9 Aug 2016 12:51:36 +0200 Message-Id: <1470739896-11088-6-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470739896-11088-1-git-send-email-tomeu.vizoso@collabora.com> References: <1470739896-11088-1-git-send-email-tomeu.vizoso@collabora.com> Cc: Tomeu Vizoso , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Daniel Vetter , Emil Velikov 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" X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Tomeu Vizoso --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 91305eb7d312..25f2e7b72982 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -1084,6 +1085,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, @@ -1091,6 +1138,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 bool vop_win_pending_is_complete(struct vop_win *vop_win)