From patchwork Fri Mar 3 13:39:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 9602843 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 CF2BE60453 for ; Fri, 3 Mar 2017 13:41:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C134D28047 for ; Fri, 3 Mar 2017 13:41:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5E09285D5; Fri, 3 Mar 2017 13:41: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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 776C928047 for ; Fri, 3 Mar 2017 13:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=UsMY95U11khBFVtTxqzbTduzT/CJk54MCMu9MIm7VqM=; b=O/3COjNEE4nZWyPkqp5bJAbOkU bVX2sBz9+fDfpAlS+W9ih30qCkYkyiwznZHbNWQCS0Aro0xRTcIzuGmpcZEgGXRlMFcbOpgyRP2ZS 85uzzTatDtO9hBchGgUaj3QIYZCVEe5mc7D3+3rarqswJvMIK7hdlLgoYCDJIxm/CXbifPEbQz9Gs lpk0Tqe9xMGKNqv9V1KI4NCg3M3qLLOh2vyrUT7C1xX1sdlnMGmqFrBEKOmnpxfhHcaVm0/QRZjlq tw7BPNNv6M9fLO7to+DAE2/kxE20ETYAUvuG0LTG2CHzG+C1vZ/Z3bvLaP4smJxuEF3DkluBIUTsE fUZlI7nw==; 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 1cjnSZ-0005w0-HZ; Fri, 03 Mar 2017 13:41:27 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cjnRw-0005gx-Gg; Fri, 03 Mar 2017 13:40:50 +0000 Received: by mail-wm0-x244.google.com with SMTP id v190so3190186wme.3; Fri, 03 Mar 2017 05:40:28 -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=xLWAAxoQcFz2XmdPFpe/LGyrqsEiyQHSxuOv8CpmPAE=; b=L2axRrYWw/5N6rprBYwAznRSY+LgC4JW8bDlkB4RkFeyBwfBVeDpbYRzOjltuLFWjO zbRbZ4SDrqTKkSX4kYIWanofkgbKrjfkwQj9Y/0PiB5Eqynn0vQjIdhSfL/JEIYsB6aS ylaEEKTzPLsj5xGGxrRF9g18f0ydckg1Rppfe/LV48YviswqTqrfjER9IpvkUpemYfAa ssF7WIMfDD0pznh/oGsP4fuDxsSx1Gobhjv3ZB26Vfk73ycZSlsFi9E9PEUoJEjOuEWD 057PHfGQ55eFWSBRFElwI0VMazNGqs2ZfWrL8QVkvqsO6cxb9oiEYI4IOOj8HcSz4mRG dbxA== 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=xLWAAxoQcFz2XmdPFpe/LGyrqsEiyQHSxuOv8CpmPAE=; b=JFhfPTkO6rjJdiS/CJY2eNtrWKvzvE07wr28efJ5bhBst1T88au1Tz5vYT6Hr4RW9/ bPcp53Z6i7ACl0bUnNNIJAsqZBy8KLorzPojfnfD40XWAU0yeF8WfuWnv89clX38wXx/ peughmoFAwBfWjmaw9iG64z8u/sNykUfMfFJe38NVNWeTbfdcLhHTYhdhWsqPV5ATxdc T4qCiu8eFtAck6pdT0qFG+WO1lsq32/x3mJ9n/a5GFhkApKT1YFsseKk9Hjfm0XrQwcS U3MG64vl0v+xjovayrxT+yUw4ex2R+fj1uruCiJdYD8WAsDfXZ5MWU9Sx66I/EeRIHFE t1sg== X-Gm-Message-State: AMke39mbWwQxfgxa6yh0917JaVzJ07Qng/hJEUX0E6bwyb795u8gleh/Rzvmt5Dfrz0nOw== X-Received: by 10.28.111.78 with SMTP id k75mr3225833wmc.71.1488548426883; Fri, 03 Mar 2017 05:40:26 -0800 (PST) Received: from cizrna.lan ([109.72.12.6]) by smtp.gmail.com with ESMTPSA id d42sm15247482wrd.7.2017.03.03.05.40.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Mar 2017 05:40:25 -0800 (PST) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Subject: [PATCH v6 4/4] drm/rockchip: Implement CRC debugfs API Date: Fri, 3 Mar 2017 14:39:36 +0100 Message-Id: <20170303133936.14964-5-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170303133936.14964-1-tomeu.vizoso@collabora.com> References: <20170303133936.14964-1-tomeu.vizoso@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170303_054048_709585_5F49D10B X-CRM114-Status: GOOD ( 11.34 ) 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 , Sean Paul , 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. v3: Remove superfluous check on rockchip_crtc_state->output_type v6: Remove superfluous variable Signed-off-by: Tomeu Vizoso Acked-by: Mark Yao --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 94d7b7327ff7..17ab16c4b922 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 @@ -1111,6 +1112,45 @@ 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 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) + 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, @@ -1120,6 +1160,7 @@ static const struct drm_crtc_funcs vop_crtc_funcs = { .atomic_destroy_state = vop_crtc_destroy_state, .enable_vblank = vop_crtc_enable_vblank, .disable_vblank = vop_crtc_disable_vblank, + .set_crc_source = vop_crtc_set_crc_source, }; static void vop_fb_unref_worker(struct drm_flip_work *work, void *val)