From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDE1DC2D0C4 for ; Tue, 10 Dec 2019 22:59:04 +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 C2A912073B for ; Tue, 10 Dec 2019 22:59:04 +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="mSmp5bjB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C2A912073B 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 05D136EA03; Tue, 10 Dec 2019 22:58:47 +0000 (UTC) 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 2788A6E9FC for ; Tue, 10 Dec 2019 22:58:44 +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 C98CD1315; Tue, 10 Dec 2019 23:58:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1576018720; bh=QxUh1voXKGuzjkN4B7XVAosQ6WAtGdmR/aONKWE1GpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mSmp5bjBnB/FV5t4kn/dt+j7rBCEpxb96m/ryXgaWdCPsViTs5C7bqwiRHrNXCYFN 3OKA/Jx/lq7PCAH53p1IPTSSaM0a0MKHu/hJa5SfOLhX6J91kkDJ390mYI1+541THh OC2NxTgT+grVWAnT2r2A5rg8UCgQ6OpsoN6+ev0c= From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 41/50] drm/omap: hdmi5: Simplify EDID read Date: Wed, 11 Dec 2019 00:57:41 +0200 Message-Id: <20191210225750.15709-42-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191210225750.15709-1-laurent.pinchart@ideasonboard.com> References: <20191210225750.15709-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: Boris Brezillon , Sean Paul , Sebastian Reichel , Tomi Valkeinen , Sam Ravnborg Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- 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 69b0d0cc7593..6f284581d35c 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c @@ -306,50 +306,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 */ @@ -467,18 +423,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 = { -- Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel