From patchwork Thu Feb 11 10:37:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 12082771 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=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 46F28C433E0 for ; Thu, 11 Feb 2021 10:45:26 +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 DD2E064E30 for ; Thu, 11 Feb 2021 10:45:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD2E064E30 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xs4all.nl 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 DEEFC6EDF8; Thu, 11 Feb 2021 10:45:19 +0000 (UTC) Received: from lb2-smtp-cloud9.xs4all.net (lb2-smtp-cloud9.xs4all.net [194.109.24.26]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1868C6E5B2 for ; Thu, 11 Feb 2021 10:37:10 +0000 (UTC) Received: from cust-b5b5937f ([IPv6:fc0c:c16d:66b8:757f:c639:739b:9d66:799d]) by smtp-cloud9.xs4all.net with ESMTPA id A9LMlXsw2Zvk6A9LRlud2N; Thu, 11 Feb 2021 11:37:09 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=s2; t=1613039829; bh=/RluaKkbRNT2NovseHLdwP2LHjAtvTSvmGfevXfdf8k=; h=From:To:Subject:Date:Message-Id:MIME-Version:From:Subject; b=Xx9Zy8qj/2qvTXI7KeJTjqbBhpFirb/Sp0fB83aUZOItnUhfMGLHLZvIzuEYLcVkW Gom/KgD/3rwKj8/oDn+crYN8mXoYJKGA2Y2j8NuJfPsVYNtrDE5rf+0NgDERoogKuR 45801SRsnybeCZMFCP3m1oBppW3YmjijcZhvFGxrCSkkkQNZ9dkjTAWFsMRMFhs4If lwNSR547gnX/51IhTEeByC7hmMDKHW0uJ4gwrKsImIHOQdAaaDLop3sgTJueYN4TPc ccJOinboQ+MIazam0ArKWAiQqBkgCd/dr51ZuGrGuDPyYIcys2oxaZLfodPalcaayz Vhrn9KhpgJfjA== From: Hans Verkuil To: linux-media@vger.kernel.org Subject: [PATCH 3/5] drm/omap: hdmi4: simplify CEC Phys Addr handling Date: Thu, 11 Feb 2021 11:37:01 +0100 Message-Id: <20210211103703.444625-4-hverkuil-cisco@xs4all.nl> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210211103703.444625-1-hverkuil-cisco@xs4all.nl> References: <20210211103703.444625-1-hverkuil-cisco@xs4all.nl> MIME-Version: 1.0 X-CMAE-Envelope: MS4xfMVufYRA30s44XrBb7euBEAQNI5/5ADL4UTGWENhEPzj1BFYGkaXvMAzCILkhgdqiEvezzzaB7alvVEsKWc9B88x5HTsVXcOAqHNIwxL+GgEGzmJzkmr jSfaU8y7Slnxk+eS9d0F2rEiadkHCYpBSaTxoZvsB9/szwrcx7r94iII37kpcbbj6e9W+fxiIke4l2k6la8Ajvhpyporg2A8oVTgSVc3AJ7JRJ1QJqhDK37Y F9h6T3vxvs8fGvB5rH3uKMVAsxNtXAALIfHFVXyM/gBKqrGH9jay1+EqicrPDRZlwJVmvJMRG80yzJtiXXK5OcHEMAGJ5SzNOUMgH468olz2F3m2EuiiCW4k x8fuVR2WFaZLPKWzWsdPh8eMgi3IYG8TDagsSyj0fOnzlCCjqy2990y+o88+yplSD3owzSTF2eJFhlwNWes/PI9IHmb7oIJ/9etlHTv5dNlIc28IGyo= X-Mailman-Approved-At: Thu, 11 Feb 2021 10:45:19 +0000 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: Tony Lindgren , Sekhar Nori , dri-devel@lists.freedesktop.org, Tomi Valkeinen , Laurent Pinchart , Hans Verkuil , linux-omap@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Switch to using cec_s_phys_addr_from_edid() instead of a two-step process of calling cec_get_edid_phys_addr() followed by cec_s_phys_addr(). Signed-off-by: Hans Verkuil Reviewed-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 13 ++----------- drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c | 4 ++-- drivers/gpu/drm/omapdrm/dss/hdmi4_cec.h | 5 +++-- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c index 765379380d4b..ac142f870109 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c @@ -432,7 +432,7 @@ static void hdmi4_bridge_hpd_notify(struct drm_bridge *bridge, struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge); if (status == connector_status_disconnected) - hdmi4_cec_set_phys_addr(&hdmi->core, CEC_PHYS_ADDR_INVALID); + hdmi4_cec_set_phys_addr(&hdmi->core, NULL); } static struct edid *hdmi4_bridge_get_edid(struct drm_bridge *bridge, @@ -440,7 +440,6 @@ static struct edid *hdmi4_bridge_get_edid(struct drm_bridge *bridge, { struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge); struct edid *edid = NULL; - unsigned int cec_addr; bool need_enable; int r; @@ -466,15 +465,7 @@ static struct edid *hdmi4_bridge_get_edid(struct drm_bridge *bridge, hdmi_runtime_put(hdmi); mutex_unlock(&hdmi->lock); - if (edid && edid->extensions) { - unsigned int len = (edid->extensions + 1) * EDID_LENGTH; - - cec_addr = cec_get_edid_phys_addr((u8 *)edid, len, NULL); - } else { - cec_addr = CEC_PHYS_ADDR_INVALID; - } - - hdmi4_cec_set_phys_addr(&hdmi->core, cec_addr); + hdmi4_cec_set_phys_addr(&hdmi->core, edid); if (need_enable) hdmi4_core_disable(&hdmi->core); diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c b/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c index 64f5ccd0f11b..68b4c84e1864 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c @@ -329,9 +329,9 @@ static const struct cec_adap_ops hdmi_cec_adap_ops = { .adap_transmit = hdmi_cec_adap_transmit, }; -void hdmi4_cec_set_phys_addr(struct hdmi_core_data *core, u16 pa) +void hdmi4_cec_set_phys_addr(struct hdmi_core_data *core, struct edid *edid) { - cec_s_phys_addr(core->adap, pa, false); + cec_s_phys_addr_from_edid(core->adap, edid); } int hdmi4_cec_init(struct platform_device *pdev, struct hdmi_core_data *core, diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.h b/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.h index b59a54c3040e..16bf259643b7 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.h +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.h @@ -26,13 +26,14 @@ struct platform_device; /* HDMI CEC funcs */ #ifdef CONFIG_OMAP4_DSS_HDMI_CEC -void hdmi4_cec_set_phys_addr(struct hdmi_core_data *core, u16 pa); +void hdmi4_cec_set_phys_addr(struct hdmi_core_data *core, struct edid *edid); void hdmi4_cec_irq(struct hdmi_core_data *core); int hdmi4_cec_init(struct platform_device *pdev, struct hdmi_core_data *core, struct hdmi_wp_data *wp, struct drm_connector *conn); void hdmi4_cec_uninit(struct hdmi_core_data *core); #else -static inline void hdmi4_cec_set_phys_addr(struct hdmi_core_data *core, u16 pa) +static inline void hdmi4_cec_set_phys_addr(struct hdmi_core_data *core, + struct edid *edid) { }