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: 94837 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp239993qgd; Fri, 3 Mar 2017 05:40:31 -0800 (PST) X-Received: by 10.99.110.138 with SMTP id j132mr3403076pgc.217.1488548431375; Fri, 03 Mar 2017 05:40:31 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id g5si10658368pgp.49.2017.03.03.05.40.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Mar 2017 05:40:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 941466ED1F; Fri, 3 Mar 2017 13:40:30 +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 3238C6ED30; Fri, 3 Mar 2017 13:40:28 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id z63so992257wmg.2; 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=mWehkjIw+r6UbQovFIEQmKLHIKAlgreLnViLloupwIUXBZip7ck9KYoCS5QVEKH839 MCHYnKr/F7A72xSWdhDvigqkaAWLuolBBtCuqjCG4nYZ2261M+5Hx0y9RT5WJHdU9XNv R6urk+yeTEfKXxfJB6+Jjz4uyQWaMK85pLWLaCfM6TmE9Ceoj8MJjGCMU7hVp1JynT1J yfhCDSAfm06stFriQu2gDrMZDd/dDZFApsYB7lVQhokVvt5K19n6JVYv0KcWp63YHdTy elQHJ20rVBSNlJjpIaXcrkuZfwa5IffnuBehgOyzdqj3EALh19yGSTo1wCTCbvW6dgZn MUiw== X-Gm-Message-State: AMke39nna6Kn55oC+29ac/SUJbW41kBesGYDCOOJmgBBGvYNdjJleuSyf5ePkmP41KSbKg== 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> 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" 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)