From patchwork Tue May 14 12:55:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13664082 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 704E1C25B75 for ; Tue, 14 May 2024 12:55:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5857F10E4E8; Tue, 14 May 2024 12:55:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="SZY+3Gdy"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5197110E4E8 for ; Tue, 14 May 2024 12:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715691338; x=1747227338; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/ahx7M+4VUMPs/kFYvhryNMXSLkP8io89Li24iuXTng=; b=SZY+3GdyS6VBPoZp6ch3wtuZcX7b8/WjTlklPBvWZ5cBGDDf1LYfK7+V g8m0/kbq+QiIctBLJ34d5oVpLKE6dBXLIpGapeDt+q6MYOY687svM+V7b 9xZ7u/l9ELXxcN45+AWqDPL0MEEDmxzzO1RhM/241aJFDJw9Qdroof64W /X/5cqwu51e2IMbvWMMDHHaWqs1qlxRG1G0a+d3f20DHVwOoX2Wjx+vxv K0runi9lOweJyjqPS5numLf2FTATcU5iot9rSTCwMif1IVclpkOEZIq49 paJSq22mpDC5QO3vHGMQCMwBgP9d4odwBxu542lPz3THqC45HBa/ssxo+ A==; X-CSE-ConnectionGUID: 6J25RTQmS0ey42Na96LFUg== X-CSE-MsgGUID: NzK/822MSlCwgtxUg1TEnA== X-IronPort-AV: E=McAfee;i="6600,9927,11073"; a="15458698" X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="15458698" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:55:38 -0700 X-CSE-ConnectionGUID: AIoGnxrgQaqBynRAa1DWHA== X-CSE-MsgGUID: fcT6ZPIQQeubsGVmqzS+Hg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="30507458" Received: from mjarzebo-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.246.91]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:55:35 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, Alain Volmat , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Subject: [PATCH 02/11] drm/sti/sti_hdmi: convert to struct drm_edid Date: Tue, 14 May 2024 15:55:08 +0300 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Prefer the struct drm_edid based functions for reading the EDID and updating the connector. The functional change is that the CEC physical address gets invalidated when the EDID could not be read. Signed-off-by: Jani Nikula Reviewed-by: Daniel Vetter Reviewed-by: Daniel Vetter --- Cc: Alain Volmat Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann --- drivers/gpu/drm/sti/sti_hdmi.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index 500936d5743c..3b62ec2d742f 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -974,28 +974,32 @@ static const struct drm_bridge_funcs sti_hdmi_bridge_funcs = { static int sti_hdmi_connector_get_modes(struct drm_connector *connector) { + const struct drm_display_info *info = &connector->display_info; struct sti_hdmi_connector *hdmi_connector = to_sti_hdmi_connector(connector); struct sti_hdmi *hdmi = hdmi_connector->hdmi; - struct edid *edid; + const struct drm_edid *drm_edid; int count; DRM_DEBUG_DRIVER("\n"); - edid = drm_get_edid(connector, hdmi->ddc_adapt); - if (!edid) - goto fail; + drm_edid = drm_edid_read_ddc(connector, hdmi->ddc_adapt); + + drm_edid_connector_update(connector, drm_edid); - cec_notifier_set_phys_addr_from_edid(hdmi->notifier, edid); + cec_notifier_set_phys_addr(hdmi->notifier, + connector->display_info.source_physical_address); + + if (!drm_edid) + goto fail; - count = drm_add_edid_modes(connector, edid); - drm_connector_update_edid_property(connector, edid); + count = drm_edid_connector_add_modes(connector); DRM_DEBUG_KMS("%s : %dx%d cm\n", - (connector->display_info.is_hdmi ? "hdmi monitor" : "dvi monitor"), - edid->width_cm, edid->height_cm); + info->is_hdmi ? "hdmi monitor" : "dvi monitor", + info->width_mm / 10, info->height_mm / 10); - kfree(edid); + drm_edid_free(drm_edid); return count; fail: