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: 9270861 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 E46FF6082E for ; Tue, 9 Aug 2016 10:52:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D410D2711E for ; Tue, 9 Aug 2016 10:52:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C824E27F8D; Tue, 9 Aug 2016 10:52:58 +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=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 884872711E for ; Tue, 9 Aug 2016 10:52:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bX4eY-0003Hj-4r; Tue, 09 Aug 2016 10:52:58 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bX4eP-0003A8-6G; Tue, 09 Aug 2016 10:52:52 +0000 Received: by mail-wm0-x241.google.com with SMTP id i5so2315801wmg.2; 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=SB7PFhRzdX3EG2fiUy3MolDbFuC9B+Q1GY4EGuO4GRPHY6QkhitkPiHAGnCvX6oDg4 iH9Hp3vnU+sYg/HoODvZcfKd8oWHiipvDF5rAuFKL6/rpSjvbT/ORfeAjTLkzAvMqxFU je66TiTnrpl6sTqa4sE+XGw+ovcxFMDUmaB+ssxiK0t0+rUWg+eDeGApF/Zz3jPowoat aSDhEDbgYfNaRAqEHfFOMxckgUWz2iorz9kY56DrcekAgRctuwiJwSfBUaTKSU69Wrqq dImGpeRcNp2W/ndkIeFhyAd4OayauWHifgVTsDC9JQ5lNZeChiaf7y10avfL1/8WfDPt lB9w== X-Gm-Message-State: AEkoouvdrI0enEzhIzvfK39M7Myde++cPTbjigdw02I4mnm/FCsTJiMAqr+fJ4m7c30oww== 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160809_035249_959131_3A9C2CC3 X-CRM114-Status: GOOD ( 12.89 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , Tomeu Vizoso , David Airlie , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, Thierry Reding , linux-arm-kernel@lists.infradead.org, Daniel Vetter , Emil Velikov , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Mark Yao MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org 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)