From patchwork Thu Jan 5 13:06:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 9498999 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 29111606DE for ; Thu, 5 Jan 2017 13:08:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23A9F283AC for ; Thu, 5 Jan 2017 13:08:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18316283E5; Thu, 5 Jan 2017 13:08:23 +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 AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A6781283AC for ; Thu, 5 Jan 2017 13:08:22 +0000 (UTC) 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 1cP7mF-00063n-4N; Thu, 05 Jan 2017 13:08:19 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cP7m2-0005hN-7k; Thu, 05 Jan 2017 13:08:08 +0000 Received: by mail-wm0-x242.google.com with SMTP id m203so96350486wma.3; Thu, 05 Jan 2017 05:07:45 -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=KKl1YOwizbMplQkaYgf7WHmoZNunEPAhSiXY+W2jTw8=; b=uebeJJPxcXkOj5BaAGJT8nl5mUeE7SIXrhO+A4oa4FL0y2Do7XPmUOP+BStbima5B4 voV1720mtbdqf5DbMDxS4qhShJWOqxLoRXgSvAZEftrDu/0MfHQ3jXg+ohe0TuK0Vl20 bi9dgx3SxAZ+ppEKjxhW+bd1p6FcqjVBHKWjslsjtTkxYDKMkzCYFmCXVXq1k5J11+Gt 4ciaAVGnnd7jLYYXxN/0493wCC/kvO+/PrhMIkp9N2nVPIP0zuPVYOctsKd6PWIkuee9 8jsVJ1z1MwxDg82svsqSVVyxit1pNBlGcSW1QO3DrVKXlQU6T64VcJi8D6c5EE4b3hus W+TQ== 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=KKl1YOwizbMplQkaYgf7WHmoZNunEPAhSiXY+W2jTw8=; b=i/5THjX4Rfx9BRFdqzVPCMvchZCp8mDYQdSs634SjwXC0p+7lrjIw+kvSOQLzpeoYa gvzlE93ySjYZUVHim8+3lXHwbRnA7MFjNuz57zN05bV0y3Ptl+Ot4MbuX9wqBUVDBs55 iEf3emqNBcrQ3ndFHQ5bU6DM0kYLmmLmw9iZJ5/UvGrqRwOjHe42h/fqY2vqhkpS2hZu AtYqs98+LA64/D8Ibokzp5yhIfQkmOB20GllIju/0itWshvoeAlYibIN6yEFg5aFUg/G yae+vRmD+zY0nKeoDVmIbXU0EZNRYtOU9totl/rqpZz+Wd5S/pI8x2A+h/KI/D0fvjrG 0jdQ== X-Gm-Message-State: AIkVDXL6TpNSkUp4uwN72Hpws/KIXroXMglUHIKOpvnlxX59bv/eyrSRx3U45c7jTz6LZQ== X-Received: by 10.28.131.72 with SMTP id f69mr5780630wmd.126.1483621664157; Thu, 05 Jan 2017 05:07:44 -0800 (PST) Received: from cizrna.lan ([109.72.12.216]) by smtp.gmail.com with ESMTPSA id b3sm103716992wjy.40.2017.01.05.05.07.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jan 2017 05:07:43 -0800 (PST) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Subject: [PATCH v2 5/5] drm/rockchip: Implement CRC debugfs API Date: Thu, 5 Jan 2017 14:06:48 +0100 Message-Id: <20170105130648.3139-6-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170105130648.3139-1-tomeu.vizoso@collabora.com> References: <20170105130648.3139-1-tomeu.vizoso@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170105_050806_464080_1869F5BA X-CRM114-Status: GOOD ( 11.96 ) 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+patchwork-linux-arm=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 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)