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: 9501209 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 BB1F8606E0 for ; Fri, 6 Jan 2017 14:31:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9288B284C8 for ; Fri, 6 Jan 2017 14:31:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87689284D0; Fri, 6 Jan 2017 14:31:33 +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 425AE284C8 for ; Fri, 6 Jan 2017 14:31:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6745A6EA22; Fri, 6 Jan 2017 14:31:20 +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 0EF2B6EA14; Fri, 6 Jan 2017 14:31:04 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id l2so5417175wml.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=Jg5VvJCJs9mD+D97j0OeEtuYszH7yiFm6tI6IpHXZiB6qqjJ/CZTDC4uQxyGYebOTb jqzruGOgvSBTB9wR4Jv/RYRj73tiO3/8jDHk4LyT1AapyMlAct9L3bCjR034jIlGFRHL PjHWDlpuNQkJmrFyG1WM4aLbEC/h2lapdr88RHg9mS0YNzlV5CH2dZo6m6ziSe7w48cy ZIJEFbAaemgFkl1FmMUEwiINHU9hl9X1QXUZO1nRkR/XfCTjvRniNo+xbY2KQb8Hs3om 20oYY4emNx8rtnorxKmTRLnFLoc8qBWtzChuW+1oy1aqSpzPIBo9Y8K11Tu7VfrxQXUi OGIA== X-Gm-Message-State: AIkVDXLD4MQmgWfGh0+DiqXQ2zNso62ns8I4iz4c2hUAqpqwR1W0Jn6ZuiJ8fyALYR+I+Q== 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> Cc: Tomeu Vizoso , Emil Velikov , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, intel-gfx-trybot@lists.freedesktop.org, Daniel Vetter 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. 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(+) 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)