From patchwork Wed Feb 26 11:25:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 11406219 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 92A0C1395 for ; Wed, 26 Feb 2020 11:27:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 70A1920637 for ; Wed, 26 Feb 2020 11:27:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="E/FblqD6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 70A1920637 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9076C6E8A8; Wed, 26 Feb 2020 11:26:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3DC056E830 for ; Wed, 26 Feb 2020 11:26:14 +0000 (UTC) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 62E6937F4; Wed, 26 Feb 2020 12:26:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1582716364; bh=b6cQsDJG31eHtBPWXZTBR1KSIQlM6tvIbrAV1c2pCuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E/FblqD6nNUklFnKZRnSQEiF50sUXXJy9LjmbHeemYCI5I3koechn7bxaETBo+neD 31TOC7ApxdK2EdS7yhh+DuBd+fcZvn3AK2lGiA8KIw+yHWRWPO3hBNpLCrlkP8c9xv u9yocmT9LJr+hRm+CoHEO7/DJYXD5SbrAZSsAkvI= From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH v8 44/54] drm/omap: hdmi5: Simplify EDID read Date: Wed, 26 Feb 2020 13:25:04 +0200 Message-Id: <20200226112514.12455-45-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200226112514.12455-1-laurent.pinchart@ideasonboard.com> References: <20200226112514.12455-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now that the omap_dss_device EDID read operation has been removed, simplify the bridge-based EDID access by merging multiple functions together. Signed-off-by: Laurent Pinchart Reviewed-by: Tomi Valkeinen Tested-by: Sebastian Reichel Reviewed-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 86 ++++++++++++----------------- 1 file changed, 35 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c index 6cb709c775d6..4d4c1fabd0a1 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c @@ -307,50 +307,6 @@ static void hdmi_core_disable(struct omap_hdmi *hdmi) mutex_unlock(&hdmi->lock); } -static struct edid * -hdmi_do_read_edid(struct omap_hdmi *hdmi, - struct edid *(*read)(struct omap_hdmi *hdmi, - struct drm_connector *connector), - struct drm_connector *connector) -{ - struct edid *edid; - bool need_enable; - int idlemode; - int r; - - need_enable = hdmi->core_enabled == false; - - if (need_enable) { - r = hdmi_core_enable(hdmi); - if (r) - return NULL; - } - - mutex_lock(&hdmi->lock); - r = hdmi_runtime_get(hdmi); - BUG_ON(r); - - idlemode = REG_GET(hdmi->wp.base, HDMI_WP_SYSCONFIG, 3, 2); - /* No-idle mode */ - REG_FLD_MOD(hdmi->wp.base, HDMI_WP_SYSCONFIG, 1, 3, 2); - - hdmi5_core_ddc_init(&hdmi->core); - - edid = read(hdmi, connector); - - hdmi5_core_ddc_uninit(&hdmi->core); - - REG_FLD_MOD(hdmi->wp.base, HDMI_WP_SYSCONFIG, idlemode, 3, 2); - - hdmi_runtime_put(hdmi); - mutex_unlock(&hdmi->lock); - - if (need_enable) - hdmi_core_disable(hdmi); - - return (struct edid *)edid; -} - /* ----------------------------------------------------------------------------- * DRM Bridge Operations */ @@ -469,18 +425,46 @@ static void hdmi5_bridge_disable(struct drm_bridge *bridge, mutex_unlock(&hdmi->lock); } -static struct edid *hdmi5_bridge_read_edid(struct omap_hdmi *hdmi, - struct drm_connector *connector) -{ - return drm_do_get_edid(connector, hdmi5_core_ddc_read, &hdmi->core); -} - static struct edid *hdmi5_bridge_get_edid(struct drm_bridge *bridge, struct drm_connector *connector) { struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge); + struct edid *edid; + bool need_enable; + int idlemode; + int r; + + need_enable = hdmi->core_enabled == false; + + if (need_enable) { + r = hdmi_core_enable(hdmi); + if (r) + return NULL; + } + + mutex_lock(&hdmi->lock); + r = hdmi_runtime_get(hdmi); + BUG_ON(r); - return hdmi_do_read_edid(hdmi, hdmi5_bridge_read_edid, connector); + idlemode = REG_GET(hdmi->wp.base, HDMI_WP_SYSCONFIG, 3, 2); + /* No-idle mode */ + REG_FLD_MOD(hdmi->wp.base, HDMI_WP_SYSCONFIG, 1, 3, 2); + + hdmi5_core_ddc_init(&hdmi->core); + + edid = drm_do_get_edid(connector, hdmi5_core_ddc_read, &hdmi->core); + + hdmi5_core_ddc_uninit(&hdmi->core); + + REG_FLD_MOD(hdmi->wp.base, HDMI_WP_SYSCONFIG, idlemode, 3, 2); + + hdmi_runtime_put(hdmi); + mutex_unlock(&hdmi->lock); + + if (need_enable) + hdmi_core_disable(hdmi); + + return (struct edid *)edid; } static const struct drm_bridge_funcs hdmi5_bridge_funcs = {