From patchwork Tue May 14 12:55:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13664081 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 68C17C04FFE for ; Tue, 14 May 2024 12:55:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 617C810E3BC; Tue, 14 May 2024 12:55:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="VxZtJinS"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0178310E3BC for ; Tue, 14 May 2024 12:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715691332; x=1747227332; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TtS1WG3/Q3LLAhInBIdougKJH0z4JUz7Ux33SsRa9yE=; b=VxZtJinSEJodO9kLIlU5wmIBtMQsbA5L1kNrqYHPuCAGmaaX++UYpOfU YOprIiRoi0g4P71gY5L6l5uh+IIWJ1A13Kk2Xcn2noPjmnb+Wm+XAC4Xp vq13AXWqb6K9Gb3dMgYGFRFSwT3zH9aXqImVgKP4+E+SBazR5+nipOBAe KJ19TrDJtXJB3T74Mce+frk7CCkvw82rnBbM18vgUls7m8UGBP3bQ4c/l T7HslSm3LNAvrvErPwSVTFfVCctXEf6PbTC2/9LRFUXr8Dj2w0y9Ph9P9 0x3M/16yMnGFj5AYXzkuJ9KCJJXzl7vkp5vO6SuvmcFw2dY5vK5Lj5KAT Q==; X-CSE-ConnectionGUID: x70feeWAR4GIBP57wvY12A== X-CSE-MsgGUID: 5bSxtLhtTfWQIK645FrnIQ== X-IronPort-AV: E=McAfee;i="6600,9927,11073"; a="15458668" X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="15458668" 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:31 -0700 X-CSE-ConnectionGUID: qFVOKpiETzCyVbCt/BdRrw== X-CSE-MsgGUID: v/KMMABXTRSKxjdorKCPnw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="30507442" 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:27 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, Sandy Huang , =?utf-8?q?Heiko?= =?utf-8?q?_St=C3=BCbner?= , Andy Yan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH 01/11] drm/rockchip: cdn-dp: get rid of drm_edid_raw() Date: Tue, 14 May 2024 15:55:07 +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" The dimensions are available in display info, so there's no need for raw EDID access. While at it, move the debug logging to where the EDID is actually read. Signed-off-by: Jani Nikula Reviewed-by: Daniel Vetter --- Cc: Sandy Huang Cc: "Heiko Stübner" Cc: Andy Yan Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org --- drivers/gpu/drm/rockchip/cdn-dp-core.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index bd7aa891b839..90913fa26aad 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -266,15 +266,6 @@ static int cdn_dp_connector_get_modes(struct drm_connector *connector) mutex_lock(&dp->lock); - if (dp->drm_edid) { - /* FIXME: get rid of drm_edid_raw() */ - const struct edid *edid = drm_edid_raw(dp->drm_edid); - - DRM_DEV_DEBUG_KMS(dp->dev, "got edid: width[%d] x height[%d]\n", - edid->width_cm, edid->height_cm); - - } - ret = drm_edid_connector_add_modes(connector); mutex_unlock(&dp->lock); @@ -369,6 +360,7 @@ static int cdn_dp_firmware_init(struct cdn_dp_device *dp) static int cdn_dp_get_sink_capability(struct cdn_dp_device *dp) { + const struct drm_display_info *info = &dp->connector.display_info; int ret; if (!cdn_dp_check_sink_connection(dp)) @@ -386,7 +378,11 @@ static int cdn_dp_get_sink_capability(struct cdn_dp_device *dp) cdn_dp_get_edid_block, dp); drm_edid_connector_update(&dp->connector, dp->drm_edid); - dp->sink_has_audio = dp->connector.display_info.has_audio; + dp->sink_has_audio = info->has_audio; + + if (dp->drm_edid) + DRM_DEV_DEBUG_KMS(dp->dev, "got edid: width[%d] x height[%d]\n", + info->width_mm / 10, info->height_mm / 10); return 0; } 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: From patchwork Tue May 14 12:55:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13664083 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 E6CC5C04FFE for ; Tue, 14 May 2024 12:55:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DAC6110E5CC; Tue, 14 May 2024 12:55:45 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="MAt8yKQ1"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id E385810E5CC for ; Tue, 14 May 2024 12:55:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715691345; x=1747227345; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fqmhO3wAvGOr+Ed4Ge08sneB6jFgcpp+F7cJwrcjgA8=; b=MAt8yKQ1TOqcJQ+JUhCbF3XbnS02Wgu0QLC21RyXGN3h74rqtIAAUxhN URAlOf0pKcaovLfGKCjEZdn6fNfHwZufulUQDURt/kUfHhemokzqLN4wq KTg9BYiutvPG0OafbQp+0oz1EClXHVl4+rjA3dJt73ZyVbpZxDAo/TVZJ yo0a+DgVa78FQsSGuZUa31oqBZKgN30iBUUNqijQHvrpo08HnkIB/ndzF EANz3Cp3cZbv0t/iOY6yTjifTOOkxF/swvZbwYzMINEtApUWJ2skB9HQL Suwh78kfBtaySZpCUDGdPEg/m+mvVrk6yj3XTEmSBSvshzCnqHUQydfvx w==; X-CSE-ConnectionGUID: wmwrDHttRE67zqqoNFrNLQ== X-CSE-MsgGUID: Dn9eRyRFSOSSL/rwRdgijg== X-IronPort-AV: E=McAfee;i="6600,9927,11073"; a="15458715" X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="15458715" 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:45 -0700 X-CSE-ConnectionGUID: 2GTEnCgRRKaO1AjjKzarkw== X-CSE-MsgGUID: E4EvIwMvSc2tg1wP9PwESw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="30507466" 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:41 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Subject: [PATCH 03/11] drm/bridge: analogix_dp: convert to struct drm_edid Date: Tue, 14 May 2024 15:55:09 +0300 Message-Id: <6f3bd1233a0922551761666f0c96c3766e3c5f96.1715691257.git.jani.nikula@intel.com> 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. Signed-off-by: Jani Nikula Reviewed-by: Dmitry Baryshkov --- Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann --- .../gpu/drm/bridge/analogix/analogix_dp_core.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 7b841232321f..9360b63ad37c 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1108,7 +1108,7 @@ static int analogix_dp_prepare_panel(struct analogix_dp_device *dp, static int analogix_dp_get_modes(struct drm_connector *connector) { struct analogix_dp_device *dp = to_dp(connector); - struct edid *edid; + const struct drm_edid *drm_edid; int ret, num_modes = 0; if (dp->plat_data->panel) { @@ -1120,12 +1120,13 @@ static int analogix_dp_get_modes(struct drm_connector *connector) return 0; } - edid = drm_get_edid(connector, &dp->aux.ddc); - if (edid) { - drm_connector_update_edid_property(&dp->connector, - edid); - num_modes += drm_add_edid_modes(&dp->connector, edid); - kfree(edid); + drm_edid = drm_edid_read_ddc(connector, &dp->aux.ddc); + + drm_edid_connector_update(&dp->connector, drm_edid); + + if (drm_edid) { + num_modes += drm_edid_connector_add_modes(&dp->connector); + drm_edid_free(drm_edid); } ret = analogix_dp_prepare_panel(dp, false, false); From patchwork Tue May 14 12:55:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13664084 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 2AB85C25B75 for ; Tue, 14 May 2024 12:55:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5CD3910E661; Tue, 14 May 2024 12:55:54 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="f3Crfp+4"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 18F9810E661 for ; Tue, 14 May 2024 12:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715691354; x=1747227354; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rufPGwYsfmgJJZF8O5nQY4lb0oTkh06RDRE/RlmnRhI=; b=f3Crfp+4sAUKcnVGdffebF6er8O7CGv7iWosVJa09KhI1PljzwaUNJ9X 0WUOvgfVOFgOb3QDlwIJ0WBNz2J8nERofQnDo88SFf81ipM/+zjYzXDQU GQIyncyzIhZS105LWAV1YTYwOTMmp7+4/8NwvxkLshFOpsHRKiYlLun8v vp/zzseSBevmWBbizwSdwRPvJCXZtfapNsoYv/NKycHGkFgdO63jKqXXh g7FPeyIEw1Ors3zj4egl3bCdrnlZ388ES0yyvtG3dd9SK/pAxbtsN/G9t rigv18cz4YnLBI69Tioy78FLsQuN0oK2j8Vuk2XKIC2L9tNhbc1F04yL0 A==; X-CSE-ConnectionGUID: 1zbSPo5ORHCPbxnVi1QTMw== X-CSE-MsgGUID: TfJitcb9ThOjMT4eRaLWZQ== X-IronPort-AV: E=McAfee;i="6600,9927,11073"; a="15458726" X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="15458726" 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:53 -0700 X-CSE-ConnectionGUID: v/dEKlCiRICdmy1xrzI0Jg== X-CSE-MsgGUID: AU+6hwDjRImNasTMPzmKGg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="30507475" 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:49 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 04/11] drm/exynos: hdmi: convert to struct drm_edid Date: Tue, 14 May 2024 15:55:10 +0300 Message-Id: <2fe0b4deb4f2ab255735cd6e1a657a17e0d45784.1715691257.git.jani.nikula@intel.com> 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 --- Cc: Inki Dae Cc: Seung-Woo Kim Cc: Kyungmin Park Cc: Krzysztof Kozlowski Cc: Alim Akhtar Cc: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org --- drivers/gpu/drm/exynos/exynos_hdmi.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index e968824a4c72..9033e8b66816 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -883,27 +883,30 @@ static const struct drm_connector_funcs hdmi_connector_funcs = { static int hdmi_get_modes(struct drm_connector *connector) { struct hdmi_context *hdata = connector_to_hdmi(connector); - struct edid *edid; + const struct drm_display_info *info = &connector->display_info; + const struct drm_edid *drm_edid; int ret; if (!hdata->ddc_adpt) return 0; - edid = drm_get_edid(connector, hdata->ddc_adpt); - if (!edid) + drm_edid = drm_edid_read_ddc(connector, hdata->ddc_adpt); + + drm_edid_connector_update(connector, drm_edid); + + cec_notifier_set_phys_addr(hdata->notifier, info->source_physical_address); + + if (!drm_edid) return 0; - hdata->dvi_mode = !connector->display_info.is_hdmi; + hdata->dvi_mode = !info->is_hdmi; DRM_DEV_DEBUG_KMS(hdata->dev, "%s : width[%d] x height[%d]\n", (hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"), - edid->width_cm, edid->height_cm); - - drm_connector_update_edid_property(connector, edid); - cec_notifier_set_phys_addr_from_edid(hdata->notifier, edid); + info->width_mm / 10, info->height_mm / 10); - ret = drm_add_edid_modes(connector, edid); + ret = drm_edid_connector_add_modes(connector); - kfree(edid); + drm_edid_free(drm_edid); return ret; } From patchwork Tue May 14 12:55:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13664085 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 644B9C04FFE for ; Tue, 14 May 2024 12:56:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B096410E678; Tue, 14 May 2024 12:56:02 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="BaWw/RM+"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id C49A510E74A for ; Tue, 14 May 2024 12:56:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715691362; x=1747227362; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jU/aDHYotreKrBqHFXuvyXSfHVJrI4IOkgonyVhSqpo=; b=BaWw/RM+ddXQrflstcyN25l/nZ5m1ZcfKIDf+zBQNmURP0vDdOxrcJ2d 3KYm7vfxzD9kQpRs/BZBdmXb7d22cxp45mDenBC0XOIeeX8Sdc/S1sgfR qC5CM2VeSAHRRcYes+/FCaOZgI7Nd9mcHkU82xH8Iee/RGRKCnHhn2hHt Kc0GVL1YzpuxubjwyRdbsz4RD44ozxgznyztm3H8fAPAIibNF2YUh+wKx S4/kGzYgpudXg5PS/w9NMENZ1vHX7+18L8kKjbbXKWdc213Os39Sn9ZUH NSWHTxxjtg/OZCFayfDRwaiUDkZashztooadFpk+kFTrBp7JTTlT0H/gP g==; X-CSE-ConnectionGUID: AE/HPgW6QfWTYZ5rvcEFRg== X-CSE-MsgGUID: KyDYwudtQROTCIvMkw+fuw== X-IronPort-AV: E=McAfee;i="6600,9927,11073"; a="22270671" X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="22270671" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:56:01 -0700 X-CSE-ConnectionGUID: 13onZANCRyaGCJNLDVgHpQ== X-CSE-MsgGUID: fLI/SKUBR2K5RFdLPiSPAw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="35140621" Received: from mjarzebo-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.246.91]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:55:57 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, Xinliang Liu , Tian Tao , Xinwei Kong , Sumit Semwal , Yongqin Liu , John Stultz , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Subject: [PATCH 05/11] drm/hisilicon/hibmc: convert to struct drm_edid Date: Tue, 14 May 2024 15:55:11 +0300 Message-Id: <386e3a64efbdd61c3eaed3f49ea9c3ebd4fcd41d.1715691257.git.jani.nikula@intel.com> 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. Signed-off-by: Jani Nikula Reviewed-by: Thomas Zimmermann --- Cc: Xinliang Liu Cc: Tian Tao Cc: Xinwei Kong Cc: Sumit Semwal Cc: Yongqin Liu Cc: John Stultz Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann --- .../gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c index 94e2c573a7af..409c551c92af 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c @@ -24,14 +24,16 @@ static int hibmc_connector_get_modes(struct drm_connector *connector) { - int count; - void *edid; struct hibmc_connector *hibmc_connector = to_hibmc_connector(connector); + const struct drm_edid *drm_edid; + int count; + + drm_edid = drm_edid_read_ddc(connector, &hibmc_connector->adapter); - edid = drm_get_edid(connector, &hibmc_connector->adapter); - if (edid) { - drm_connector_update_edid_property(connector, edid); - count = drm_add_edid_modes(connector, edid); + drm_edid_connector_update(connector, drm_edid); + + if (drm_edid) { + count = drm_edid_connector_add_modes(connector); if (count) goto out; } @@ -42,7 +44,8 @@ static int hibmc_connector_get_modes(struct drm_connector *connector) drm_set_preferred_mode(connector, 1024, 768); out: - kfree(edid); + drm_edid_free(drm_edid); + return count; } From patchwork Tue May 14 12:55:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13664086 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 D409CC04FFE for ; Tue, 14 May 2024 12:56:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E173110E74A; Tue, 14 May 2024 12:56:07 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="d9fOrq2O"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id E28D110E74A for ; Tue, 14 May 2024 12:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715691367; x=1747227367; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QFCTAcbDHAxYsVMOhCeqPSF60ddgC78h9uhTjFsgXRI=; b=d9fOrq2ORxMWLL3D85/L9EDuFHjOxrxtGwCC+62VoAbQbY62T2J7BRri vrkU0IslpjnwQDKzkGwfvS73Fqxe805VVbpdbZ0whMpp+C49TxY8a8P9s tLqBFho7fPk/gsjGHNqUMxjZRg1Yp56GB7ZTB4P3ocOCs2QfgkGjlkKbT 4nLXXxB78fgkxUFtKoXd9PFry63fRRC5KEXhCcRvE39aisSzn/zuLc5VU ToSv7X3Q2wbw9bYoFTxP4QJKMthFwJhtshw9NSeGOdYzJqkeobSlJnixU hL+40jYM0kTvnpU/TqkgEya3a5vJP7ijEBiMot+TCZS3ydYptl6e/enIf Q==; X-CSE-ConnectionGUID: r5SqcJSDQ46ySBrDU1gd4Q== X-CSE-MsgGUID: vA+A1aIWRHelQqPzG33wkA== X-IronPort-AV: E=McAfee;i="6600,9927,11073"; a="22270681" X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="22270681" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:56:07 -0700 X-CSE-ConnectionGUID: b0On+TQdQVeTq3h7VcKffQ== X-CSE-MsgGUID: Uy/OSIU8RxeX2yCJrxadXg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="35140694" Received: from mjarzebo-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.246.91]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:56:04 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, Sui Jingfeng , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Subject: [PATCH 06/11] drm/loongson/7a1000: convert to struct drm_edid Date: Tue, 14 May 2024 15:55:12 +0300 Message-Id: <22c66af62cd5ae1998bbaf6801cda3cc689f9e3f.1715691257.git.jani.nikula@intel.com> 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. Signed-off-by: Jani Nikula Reviewed-by: Sui Jingfeng --- Cc: Sui Jingfeng Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann --- drivers/gpu/drm/loongson/lsdc_output_7a1000.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/loongson/lsdc_output_7a1000.c b/drivers/gpu/drm/loongson/lsdc_output_7a1000.c index 6fc8dd1c7d9a..600ed4fb0884 100644 --- a/drivers/gpu/drm/loongson/lsdc_output_7a1000.c +++ b/drivers/gpu/drm/loongson/lsdc_output_7a1000.c @@ -40,16 +40,15 @@ static int ls7a1000_dpi_connector_get_modes(struct drm_connector *conn) { - unsigned int num = 0; - struct edid *edid; + int num; if (conn->ddc) { - edid = drm_get_edid(conn, conn->ddc); - if (edid) { - drm_connector_update_edid_property(conn, edid); - num = drm_add_edid_modes(conn, edid); - kfree(edid); - } + const struct drm_edid *drm_edid; + + drm_edid = drm_edid_read(conn); + drm_edid_connector_update(conn, drm_edid); + num = drm_edid_connector_add_modes(conn); + drm_edid_free(drm_edid); return num; } From patchwork Tue May 14 12:55:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13664087 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 E31EFC04FFE for ; Tue, 14 May 2024 12:56:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F387110E796; Tue, 14 May 2024 12:56:14 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Oq3iXrrR"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 504B610E796 for ; Tue, 14 May 2024 12:56:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715691373; x=1747227373; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gWeytuoLYW81OahLs34l8TGDbRCcql8Z+kOldXRVO4k=; b=Oq3iXrrRPM50toCYw6ikmGOCJ31Uwuo614quZoRlq5KKS8jUAObHF76e hsCxPkQVn37UaSt36n38587bW8qxSmtwXYtolwy7rCNiOIkS85JiBmMK+ eDISVQsWjq0q/OD3s30e4OlvHJ8qxgJNTr+Lb6sCn4I9Cc8j/dLrB2Pl7 6c5MnlvOLppTV3W8OLodkILiHsanRsve88+hgHHyUz4OGCpuGQcd6jjUc EY1kUO7KCphvizar6Oklih2tRIZqRS64ZLPtwVGM3wO1eG1/bGzA1L6Uc Uo9UFXIN/+9yD/BOQ5kb4WJ4YfSkQYsAE51Xex+x//B+F4dIZhe+mEy0m A==; X-CSE-ConnectionGUID: vXfFNzy5TfmNbk09xyoTrg== X-CSE-MsgGUID: /UZLa0g8SQKGrM0AHjBdFg== X-IronPort-AV: E=McAfee;i="6600,9927,11073"; a="22270702" X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="22270702" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:56:13 -0700 X-CSE-ConnectionGUID: rnZTcBGkTQGo5jLGNW/QAg== X-CSE-MsgGUID: 9Dx/GTy4T/uOoYcWhS8b5Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="35140774" Received: from mjarzebo-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.246.91]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:56:10 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, Sui Jingfeng , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Subject: [PATCH 07/11] drm/loongson/7a2000: convert to struct drm_edid Date: Tue, 14 May 2024 15:55:13 +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. Signed-off-by: Jani Nikula Reviewed-by: Sui Jingfeng --- Cc: Sui Jingfeng Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann --- drivers/gpu/drm/loongson/lsdc_output_7a2000.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/loongson/lsdc_output_7a2000.c b/drivers/gpu/drm/loongson/lsdc_output_7a2000.c index ce3dabec887e..2bd797a9b9ff 100644 --- a/drivers/gpu/drm/loongson/lsdc_output_7a2000.c +++ b/drivers/gpu/drm/loongson/lsdc_output_7a2000.c @@ -44,16 +44,15 @@ static int ls7a2000_connector_get_modes(struct drm_connector *connector) { - unsigned int num = 0; - struct edid *edid; + int num; if (connector->ddc) { - edid = drm_get_edid(connector, connector->ddc); - if (edid) { - drm_connector_update_edid_property(connector, edid); - num = drm_add_edid_modes(connector, edid); - kfree(edid); - } + const struct drm_edid *drm_edid; + + drm_edid = drm_edid_read(connector); + drm_edid_connector_update(connector, drm_edid); + num = drm_edid_connector_add_modes(connector); + drm_edid_free(drm_edid); return num; } From patchwork Tue May 14 12:55:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13664088 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 E9775C25B75 for ; Tue, 14 May 2024 12:56:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D66BF10E7AA; Tue, 14 May 2024 12:56:20 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="CW1qUJkm"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id DD42010E7AA; Tue, 14 May 2024 12:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715691380; x=1747227380; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MN7SlPdpAe5QBcnVhCSzhjMMbkyk5IJ2S33wWdWmnSs=; b=CW1qUJkmRvoCFVtCbfdU8Zs0SnUqKEG4kiPxOouQM4uZHHxVSstmfIQv gsv5Sdfr4zAnLr7rjVynN1fOTXUfQ3dgaxtIKNCzaCSSk4o2+1jbzzDIN ajAIVhFp+VovcM8SPJ4SSBZQbegsSg4KpZBPzfnlgnaSNVwsmLvw1zRGa XxGZumvU80Nd/BxxLY6hmYg+mL5kql5dsfBIjM0mOQwqKuQ/IYWoOET4p kX5B5CSywqFh3x9ci7K+l7jXgw31L03v0aNQN3yZ7MtEM6iW/1qTYnCaj uOx1LVPHcgCHvNiubtZB5qK1HJRiX1RpXRi8+LoS55DtcRuimrlo5ZDPM w==; X-CSE-ConnectionGUID: ZzwfMwXzTwahsJDWTNvctw== X-CSE-MsgGUID: 5q99dHepQNSOtgZToZcHiQ== X-IronPort-AV: E=McAfee;i="6600,9927,11073"; a="22270719" X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="22270719" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:56:19 -0700 X-CSE-ConnectionGUID: XZh4ZFrCR4CI5YnAWetkiQ== X-CSE-MsgGUID: 9kdD4cv8SAaa0C+pjqHywg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="35140834" Received: from mjarzebo-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.246.91]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:56:16 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [PATCH 08/11] drm/msm/dp: switch to struct drm_edid Date: Tue, 14 May 2024 15:55:14 +0300 Message-Id: <93d6c446ed4831dadfb4a77635a67cf5f27e19ff.1715691257.git.jani.nikula@intel.com> 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. Simplify the flow by updating the EDID property when the EDID is read instead of at .get_modes. Signed-off-by: Jani Nikula Reviewed-by: Dmitry Baryshkov Reviewed-by: Douglas Anderson --- Cc: Rob Clark Cc: Abhinav Kumar Cc: Dmitry Baryshkov Cc: Sean Paul Cc: Marijn Suijten Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org --- drivers/gpu/drm/msm/dp/dp_display.c | 11 +++---- drivers/gpu/drm/msm/dp/dp_panel.c | 47 +++++++++-------------------- drivers/gpu/drm/msm/dp/dp_panel.h | 2 +- 3 files changed, 20 insertions(+), 40 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 672a7ba52eda..9622e58dce3e 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -360,26 +360,25 @@ static int dp_display_send_hpd_notification(struct dp_display_private *dp, static int dp_display_process_hpd_high(struct dp_display_private *dp) { + struct drm_connector *connector = dp->dp_display.connector; + const struct drm_display_info *info = &connector->display_info; int rc = 0; - struct edid *edid; - rc = dp_panel_read_sink_caps(dp->panel, dp->dp_display.connector); + rc = dp_panel_read_sink_caps(dp->panel, connector); if (rc) goto end; dp_link_process_request(dp->link); if (!dp->dp_display.is_edp) - drm_dp_set_subconnector_property(dp->dp_display.connector, + drm_dp_set_subconnector_property(connector, connector_status_connected, dp->panel->dpcd, dp->panel->downstream_ports); - edid = dp->panel->edid; - dp->dp_display.psr_supported = dp->panel->psr_cap.version && psr_enabled; - dp->audio_supported = drm_detect_monitor_audio(edid); + dp->audio_supported = info->has_audio; dp_panel_handle_sink_request(dp->panel); /* diff --git a/drivers/gpu/drm/msm/dp/dp_panel.c b/drivers/gpu/drm/msm/dp/dp_panel.c index 07db8f37cd06..a916b5f3b317 100644 --- a/drivers/gpu/drm/msm/dp/dp_panel.c +++ b/drivers/gpu/drm/msm/dp/dp_panel.c @@ -108,28 +108,6 @@ static u32 dp_panel_get_supported_bpp(struct dp_panel *dp_panel, return bpp; } -static int dp_panel_update_modes(struct drm_connector *connector, - struct edid *edid) -{ - int rc = 0; - - if (edid) { - rc = drm_connector_update_edid_property(connector, edid); - if (rc) { - DRM_ERROR("failed to update edid property %d\n", rc); - return rc; - } - rc = drm_add_edid_modes(connector, edid); - return rc; - } - - rc = drm_connector_update_edid_property(connector, NULL); - if (rc) - DRM_ERROR("failed to update edid property %d\n", rc); - - return rc; -} - int dp_panel_read_sink_caps(struct dp_panel *dp_panel, struct drm_connector *connector) { @@ -175,12 +153,13 @@ int dp_panel_read_sink_caps(struct dp_panel *dp_panel, if (rc) return rc; - kfree(dp_panel->edid); - dp_panel->edid = NULL; + drm_edid_free(dp_panel->drm_edid); + + dp_panel->drm_edid = drm_edid_read_ddc(connector, &panel->aux->ddc); + + drm_edid_connector_update(connector, dp_panel->drm_edid); - dp_panel->edid = drm_get_edid(connector, - &panel->aux->ddc); - if (!dp_panel->edid) { + if (!dp_panel->drm_edid) { DRM_ERROR("panel edid read failed\n"); /* check edid read fail is due to unplug */ if (!dp_catalog_link_is_connected(panel->catalog)) { @@ -224,13 +203,13 @@ int dp_panel_get_modes(struct dp_panel *dp_panel, return -EINVAL; } - if (dp_panel->edid) - return dp_panel_update_modes(connector, dp_panel->edid); + if (dp_panel->drm_edid) + return drm_edid_connector_add_modes(connector); return 0; } -static u8 dp_panel_get_edid_checksum(struct edid *edid) +static u8 dp_panel_get_edid_checksum(const struct edid *edid) { edid += edid->extensions; @@ -249,10 +228,12 @@ void dp_panel_handle_sink_request(struct dp_panel *dp_panel) panel = container_of(dp_panel, struct dp_panel_private, dp_panel); if (panel->link->sink_request & DP_TEST_LINK_EDID_READ) { + /* FIXME: get rid of drm_edid_raw() */ + const struct edid *edid = drm_edid_raw(dp_panel->drm_edid); u8 checksum; - if (dp_panel->edid) - checksum = dp_panel_get_edid_checksum(dp_panel->edid); + if (edid) + checksum = dp_panel_get_edid_checksum(edid); else checksum = dp_panel->connector->real_edid_checksum; @@ -539,5 +520,5 @@ void dp_panel_put(struct dp_panel *dp_panel) if (!dp_panel) return; - kfree(dp_panel->edid); + drm_edid_free(dp_panel->drm_edid); } diff --git a/drivers/gpu/drm/msm/dp/dp_panel.h b/drivers/gpu/drm/msm/dp/dp_panel.h index 4ea42fa936ae..6722e3923fa5 100644 --- a/drivers/gpu/drm/msm/dp/dp_panel.h +++ b/drivers/gpu/drm/msm/dp/dp_panel.h @@ -39,7 +39,7 @@ struct dp_panel { u8 downstream_ports[DP_MAX_DOWNSTREAM_PORTS]; struct dp_link_info link_info; - struct edid *edid; + const struct drm_edid *drm_edid; struct drm_connector *connector; struct dp_display_mode dp_mode; struct dp_panel_psr psr_cap; From patchwork Tue May 14 12:55:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13664089 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 B7380C25B75 for ; Tue, 14 May 2024 12:56:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EA1BD10E7EA; Tue, 14 May 2024 12:56:26 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="dek77Fgp"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 694AC10E7EA for ; Tue, 14 May 2024 12:56:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715691385; x=1747227385; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O3WR6uh8GZmy2rdXUJXqCpt0BQUtQN00jH3P5Gn5m4E=; b=dek77FgpaSoCOCszmS8TV7zHFbikvaqISjpeSCZj0XmJkFbk98G3xwo3 Dyx7jYGf/cghngnsZpc/u35SaVr4w27cORhvvCvCwIiXr22coRqPJVOVP 2CML+SkqxcJfbfpr8CtPoeEIXYC3j2DyoO1ja9L4KcCvJMUQ2S4hUq8GA Gjggnqw5JElF2Q1nlGl8uJpPJxeNRV/fBifX1xfd3uMT7jadp+Tnct0gK UMMWf/T2d8Qv2xMd7MFgA9oSU398++gxzd7mwL7fZbDfcY2IIhovM8AKL tAsV0ay+KLQ/l3kuHN2hqMRJmbi6vRR5sBei5ndd3F052LRKfe7srSETU g==; X-CSE-ConnectionGUID: SbmAOIzlSlqp8VE+9ooxGQ== X-CSE-MsgGUID: FNWxwsJPQXGCfdq6ngl8Pw== X-IronPort-AV: E=McAfee;i="6600,9927,11073"; a="22270730" X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="22270730" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:56:25 -0700 X-CSE-ConnectionGUID: hhZRhLesSbiCjuDXCXvH7Q== X-CSE-MsgGUID: EcLCTva4To+gJY8/rwZ1dQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="35140874" Received: from mjarzebo-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.246.91]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:56:22 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, Thierry Reding , Mikko Perttunen , Jonathan Hunter , linux-tegra@vger.kernel.org Subject: [PATCH 09/11] drm/tegra: convert to struct drm_edid Date: Tue, 14 May 2024 15:55:15 +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. Signed-off-by: Jani Nikula Reviewed-by: Daniel Vetter --- Cc: Thierry Reding Cc: Mikko Perttunen Cc: Jonathan Hunter Cc: linux-tegra@vger.kernel.org --- drivers/gpu/drm/tegra/drm.h | 2 +- drivers/gpu/drm/tegra/output.c | 29 +++++++++++++++++------------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 682011166a8f..2f3781e04b0a 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -133,7 +133,7 @@ struct tegra_output { struct drm_bridge *bridge; struct drm_panel *panel; struct i2c_adapter *ddc; - const struct edid *edid; + const struct drm_edid *drm_edid; struct cec_notifier *cec; unsigned int hpd_irq; struct gpio_desc *hpd_gpio; diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index 4da3c3d1abbc..e6b5863fec71 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c @@ -21,7 +21,7 @@ int tegra_output_connector_get_modes(struct drm_connector *connector) { struct tegra_output *output = connector_to_output(connector); - struct edid *edid = NULL; + const struct drm_edid *drm_edid; int err = 0; /* @@ -34,18 +34,17 @@ int tegra_output_connector_get_modes(struct drm_connector *connector) return err; } - if (output->edid) - edid = kmemdup(output->edid, sizeof(*edid), GFP_KERNEL); + if (output->drm_edid) + drm_edid = drm_edid_dup(output->drm_edid); else if (output->ddc) - edid = drm_get_edid(connector, output->ddc); + drm_edid = drm_edid_read_ddc(connector, output->ddc); - cec_notifier_set_phys_addr_from_edid(output->cec, edid); - drm_connector_update_edid_property(connector, edid); + drm_edid_connector_update(connector, drm_edid); + cec_notifier_set_phys_addr(output->cec, + connector->display_info.source_physical_address); - if (edid) { - err = drm_add_edid_modes(connector, edid); - kfree(edid); - } + err = drm_edid_connector_add_modes(connector); + drm_edid_free(drm_edid); return err; } @@ -98,6 +97,7 @@ static irqreturn_t hpd_irq(int irq, void *data) int tegra_output_probe(struct tegra_output *output) { struct device_node *ddc, *panel; + const void *edid; unsigned long flags; int err, size; @@ -124,8 +124,6 @@ int tegra_output_probe(struct tegra_output *output) return PTR_ERR(output->panel); } - output->edid = of_get_property(output->of_node, "nvidia,edid", &size); - ddc = of_parse_phandle(output->of_node, "nvidia,ddc-i2c-bus", 0); if (ddc) { output->ddc = of_get_i2c_adapter_by_node(ddc); @@ -137,6 +135,9 @@ int tegra_output_probe(struct tegra_output *output) } } + edid = of_get_property(output->of_node, "nvidia,edid", &size); + output->drm_edid = drm_edid_alloc(edid, size); + output->hpd_gpio = devm_fwnode_gpiod_get(output->dev, of_fwnode_handle(output->of_node), "nvidia,hpd", @@ -187,6 +188,8 @@ int tegra_output_probe(struct tegra_output *output) if (output->ddc) i2c_put_adapter(output->ddc); + drm_edid_free(output->drm_edid); + return err; } @@ -197,6 +200,8 @@ void tegra_output_remove(struct tegra_output *output) if (output->ddc) i2c_put_adapter(output->ddc); + + drm_edid_free(output->drm_edid); } int tegra_output_init(struct drm_device *drm, struct tegra_output *output) From patchwork Tue May 14 12:55:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13664090 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 B88CCC25B75 for ; Tue, 14 May 2024 12:56:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 028EF10E7BE; Tue, 14 May 2024 12:56:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Lii6+N3Z"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by gabe.freedesktop.org (Postfix) with ESMTPS id 108C910E7BE for ; Tue, 14 May 2024 12:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715691401; x=1747227401; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sncs7CxlVP7FlPsWW7vAI9GxSz7YTTUFsPvqj+KbprM=; b=Lii6+N3Z1ruyXUJlVUFXA37GSzMwDzH2bRX8PcDnbbfu7rOB4sIINlOq xtIw8D/kuSGcmkRHYXVu9fATygvnjCMpM5GJbGsZlGMiQBkPtZZdusdFO trqzEfOtWBDk+oXb7MW+1iBsumXW2T9PdfVEh1CwrQXJ9YL65NHPvXAKU uwKLO6rhwikBzDvrQ/zgskm/xCkV3qCTjLl/iq/7Amboe2favFxjV362M IoVfubuQhWgtog9HsZ3TkekSx1+GwRBXzHFRICXrKaCirHnqoLYFdiG0Z qbVEThxpXxFCK9O/xQnQsCRfsItR/zo3nXL9ykjQuz1a9C6uRsOoMpv7R A==; X-CSE-ConnectionGUID: 4LBiaXLMREKHlxTdqoIKIw== X-CSE-MsgGUID: orG+NmJWR1ykdHVzMJg7XA== X-IronPort-AV: E=McAfee;i="6600,9927,11073"; a="11613870" X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="11613870" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:56:33 -0700 X-CSE-ConnectionGUID: gjyKdEViQC633PClo/RP0w== X-CSE-MsgGUID: f4LA4gsvSUWO93oy333Ywg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="31232409" Received: from mjarzebo-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.246.91]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:56:29 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, Philipp Zabel , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [PATCH 10/11] drm/imx/tve: convert to struct drm_edid Date: Tue, 14 May 2024 15:55:16 +0300 Message-Id: <2f59a7ad10c29c21f08223ef19221cef48623cc8.1715691257.git.jani.nikula@intel.com> 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. Signed-off-by: Jani Nikula Reviewed-by: Dmitry Baryshkov --- Cc: Philipp Zabel Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: Shawn Guo Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: imx@lists.linux.dev Cc: linux-arm-kernel@lists.infradead.org --- drivers/gpu/drm/imx/ipuv3/imx-tve.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/imx/ipuv3/imx-tve.c b/drivers/gpu/drm/imx/ipuv3/imx-tve.c index b49bddb85535..29f494bfff67 100644 --- a/drivers/gpu/drm/imx/ipuv3/imx-tve.c +++ b/drivers/gpu/drm/imx/ipuv3/imx-tve.c @@ -201,18 +201,16 @@ static int tve_setup_vga(struct imx_tve *tve) static int imx_tve_connector_get_modes(struct drm_connector *connector) { struct imx_tve *tve = con_to_tve(connector); - struct edid *edid; - int ret = 0; + const struct drm_edid *drm_edid; + int ret; if (!tve->ddc) return 0; - edid = drm_get_edid(connector, tve->ddc); - if (edid) { - drm_connector_update_edid_property(connector, edid); - ret = drm_add_edid_modes(connector, edid); - kfree(edid); - } + drm_edid = drm_edid_read_ddc(connector, tve->ddc); + drm_edid_connector_update(connector, drm_edid); + ret = drm_edid_connector_add_modes(connector); + drm_edid_free(drm_edid); return ret; } From patchwork Tue May 14 12:55:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13664099 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 C5223C04FFE for ; Tue, 14 May 2024 12:56:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2080810E8CE; Tue, 14 May 2024 12:56:45 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="JFOpTx1k"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1DC8810E901 for ; Tue, 14 May 2024 12:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715691402; x=1747227402; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=F9SFvvSld3mxRCFNrEt/Vz5BBJ02a8jJaj9L4IM0rfY=; b=JFOpTx1kU6LPs+8OkLFX55B8QnTv8DHs/rg6yncA05Tb95IkP6DbeffU 00jkXmGpoF+AKDfv8/SBcA3AnRcrnVOEDzS7tjdKPn+aJM9Od0OtaYhNZ mnu4V3by21QJYJIv0cYHonZRl3LqVAQuwWh1H/8E/4dGqFx9FbRZzo6+x fVqDJyHGRvCRmxVu3u3C6CXY9Rg9Hl2xts1UyfPf6kvIy54f0QtwjUcXz y2wYxz1UjNjDtt0igKkrJPmaJIUb7JMLboQVKv1YJ7t2CsU6M9ivGsjCg esBKM+dx4dKOoDU3mauwGDHqYrXTwaSBTl/T7SKJUJFszm8S+x4dy1DZP A==; X-CSE-ConnectionGUID: c1+sk96SRkKASDq1xbuJDA== X-CSE-MsgGUID: W/TWGW+JTUe9Dd2de0tZUA== X-IronPort-AV: E=McAfee;i="6600,9927,11073"; a="11613910" X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="11613910" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:56:40 -0700 X-CSE-ConnectionGUID: AOLUXNa0RqmSdoaS4ELN6g== X-CSE-MsgGUID: eAlX2rlWSwiWZjNrhNobrA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,159,1712646000"; d="scan'208";a="31232444" Received: from mjarzebo-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.246.91]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 05:56:36 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, Philipp Zabel , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [PATCH 11/11] drm/imx/ldb: convert to struct drm_edid Date: Tue, 14 May 2024 15:55:17 +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. Signed-off-by: Jani Nikula Reviewed-by: Dmitry Baryshkov --- Cc: Philipp Zabel Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: Shawn Guo Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: imx@lists.linux.dev Cc: linux-arm-kernel@lists.infradead.org --- drivers/gpu/drm/imx/ipuv3/imx-ldb.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/imx/ipuv3/imx-ldb.c b/drivers/gpu/drm/imx/ipuv3/imx-ldb.c index 71d70194fcbd..793dfb1a3ed0 100644 --- a/drivers/gpu/drm/imx/ipuv3/imx-ldb.c +++ b/drivers/gpu/drm/imx/ipuv3/imx-ldb.c @@ -72,7 +72,7 @@ struct imx_ldb_channel { struct device_node *child; struct i2c_adapter *ddc; int chno; - void *edid; + const struct drm_edid *drm_edid; struct drm_display_mode mode; int mode_valid; u32 bus_format; @@ -142,15 +142,15 @@ static int imx_ldb_connector_get_modes(struct drm_connector *connector) if (num_modes > 0) return num_modes; - if (!imx_ldb_ch->edid && imx_ldb_ch->ddc) - imx_ldb_ch->edid = drm_get_edid(connector, imx_ldb_ch->ddc); - - if (imx_ldb_ch->edid) { - drm_connector_update_edid_property(connector, - imx_ldb_ch->edid); - num_modes = drm_add_edid_modes(connector, imx_ldb_ch->edid); + if (!imx_ldb_ch->drm_edid && imx_ldb_ch->ddc) { + imx_ldb_ch->drm_edid = drm_edid_read_ddc(connector, + imx_ldb_ch->ddc); + drm_edid_connector_update(connector, imx_ldb_ch->drm_edid); } + if (imx_ldb_ch->drm_edid) + num_modes = drm_edid_connector_add_modes(connector); + if (imx_ldb_ch->mode_valid) { struct drm_display_mode *mode; @@ -553,7 +553,6 @@ static int imx_ldb_panel_ddc(struct device *dev, struct imx_ldb_channel *channel, struct device_node *child) { struct device_node *ddc_node; - const u8 *edidp; int ret; ddc_node = of_parse_phandle(child, "ddc-i2c-bus", 0); @@ -567,6 +566,7 @@ static int imx_ldb_panel_ddc(struct device *dev, } if (!channel->ddc) { + const void *edidp; int edid_len; /* if no DDC available, fallback to hardcoded EDID */ @@ -574,8 +574,8 @@ static int imx_ldb_panel_ddc(struct device *dev, edidp = of_get_property(child, "edid", &edid_len); if (edidp) { - channel->edid = kmemdup(edidp, edid_len, GFP_KERNEL); - if (!channel->edid) + channel->drm_edid = drm_edid_alloc(edidp, edid_len); + if (!channel->drm_edid) return -ENOMEM; } else if (!channel->panel) { /* fallback to display-timings node */ @@ -744,7 +744,7 @@ static void imx_ldb_remove(struct platform_device *pdev) for (i = 0; i < 2; i++) { struct imx_ldb_channel *channel = &imx_ldb->channel[i]; - kfree(channel->edid); + drm_edid_free(channel->drm_edid); i2c_put_adapter(channel->ddc); }