From patchwork Tue Apr 16 13:22:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13631809 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 8DA24C4345F for ; Tue, 16 Apr 2024 13:23:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JPFPX3gvOsrXuqD4F/i0JhCRI/GZ2i321ZtgalVUKzU=; b=H1WwTxeyX5PsLt CAgb7yf55LGyshZ8303P7CHNJtG7Bf+gB9zjkIF/FvkR4NX6RJcyo8H/ct9FpSAds7NsGxGtvYqZP DPGAPH/uFvcjc4J1OuRMu+Pv+aJ/VOnu8+xDqdz1m2VHjjxyk1iNkPWM4Z3fMxstG60sjR4vperVn Wq9q3nzXseVu5QpnKySiNVV4cxm4CO+bduFlvmezpTB4Dj1IT3bU3TCfUMCIjbXBDysZXJmyxbEMv cMneBXQ2mWY5z7+ZlgocHcVSGGzkBeOcNUWawZ9Vs0PLeWZvHeIcMelX1+MKcpQlyH98T1igSWnkW rzWhjXtvADb06oA32iDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwims-0000000CIBg-3QF6; Tue, 16 Apr 2024 13:23:50 +0000 Received: from mgamail.intel.com ([198.175.65.12]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwimm-0000000CI9I-2kRv; Tue, 16 Apr 2024 13:23:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713273825; x=1744809825; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oG2GtV3nt+5QkO7h/AQtyjTIPvu8JRijgCsInOXsQmY=; b=bbk3X60RDIlFKh+jaBTx6pcSL+nj8u1MDFBWzcYZTIiW7TpbmA6k5LPJ u5VqqSrtGhOCsJQ8Min1CcfmuniIFtT90t2Kaf7Hlou6XkhHk03IB0AZR jvETlCybrHnY2MPPVgf3ofNSUPw2/Bmuvp42l7xb3XbMqJnVlO1Bh1BLJ AGDXiTvfli4DGym1dvJJK2H+xqFQQeCXSz1erxPW+6kfN/2D5MtaASJdq hKEeWNUvmZtunWGU9DP2W0Tx+IeXGIwSyXTKu0/+uwFfQJuRz/WgsrLf3 J/iv4ePlNk2HLbPSR0kVjd7shNwtPBSKvfc6rj8MWHdKxzA8StsId2EAF Q==; X-CSE-ConnectionGUID: gDlbl36qS5ip3FmnyqG3iQ== X-CSE-MsgGUID: gcRpOYMeTV2Hl0EXPggvxQ== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="20131400" X-IronPort-AV: E=Sophos;i="6.07,206,1708416000"; d="scan'208";a="20131400" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2024 06:23:43 -0700 X-CSE-ConnectionGUID: N7hGG/BORvyEuSp7FzE8Ig== X-CSE-MsgGUID: KQolT1WkSp6IgVi/HsO/bg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,206,1708416000"; d="scan'208";a="27055466" Received: from martakit-mobl.ger.corp.intel.com (HELO localhost) ([10.252.44.100]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2024 06:23:40 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: Jani Nikula , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH 13/15] drm/rockchip: cdn-dp: switch to struct drm_edid Date: Tue, 16 Apr 2024 16:22:27 +0300 Message-Id: <59d2feb9f8b28d1a1cf49077a35941aa9b3d36af.1713273659.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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240416_062344_761523_5B126EAE X-CRM114-Status: GOOD ( 15.48 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Prefer struct drm_edid based functions over struct edid. Signed-off-by: Jani Nikula Acked-by: Heiko Stuebner --- Cc: Sandy Huang Cc: "Heiko Stübner" Cc: Andy Yan Cc: linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org --- drivers/gpu/drm/rockchip/cdn-dp-core.c | 33 +++++++++++++++----------- drivers/gpu/drm/rockchip/cdn-dp-core.h | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index a855c45ae7f3..9e3d7cb84c5d 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -262,20 +262,21 @@ static const struct drm_connector_funcs cdn_dp_atomic_connector_funcs = { static int cdn_dp_connector_get_modes(struct drm_connector *connector) { struct cdn_dp_device *dp = connector_to_dp(connector); - struct edid *edid; int ret = 0; mutex_lock(&dp->lock); - edid = dp->edid; - if (edid) { + + 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); - dp->sink_has_audio = drm_detect_monitor_audio(edid); - - drm_connector_update_edid_property(connector, edid); - ret = drm_add_edid_modes(connector, edid); } + + ret = drm_edid_connector_add_modes(connector); + mutex_unlock(&dp->lock); return ret; @@ -380,9 +381,13 @@ static int cdn_dp_get_sink_capability(struct cdn_dp_device *dp) return ret; } - kfree(dp->edid); - dp->edid = drm_do_get_edid(&dp->connector, - cdn_dp_get_edid_block, dp); + drm_edid_free(dp->drm_edid); + dp->drm_edid = drm_edid_read_custom(&dp->connector, + 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; + return 0; } @@ -488,8 +493,8 @@ static int cdn_dp_disable(struct cdn_dp_device *dp) dp->max_lanes = 0; dp->max_rate = 0; if (!dp->connected) { - kfree(dp->edid); - dp->edid = NULL; + drm_edid_free(dp->drm_edid); + dp->drm_edid = NULL; } return 0; @@ -1131,8 +1136,8 @@ static void cdn_dp_unbind(struct device *dev, struct device *master, void *data) pm_runtime_disable(dev); if (dp->fw_loaded) release_firmware(dp->fw); - kfree(dp->edid); - dp->edid = NULL; + drm_edid_free(dp->drm_edid); + dp->drm_edid = NULL; } static const struct component_ops cdn_dp_component_ops = { diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.h b/drivers/gpu/drm/rockchip/cdn-dp-core.h index 5b2fed1f5f55..8e6e95d269da 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.h +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.h @@ -70,7 +70,7 @@ struct cdn_dp_device { struct drm_display_mode mode; struct platform_device *audio_pdev; struct work_struct event_work; - struct edid *edid; + const struct drm_edid *drm_edid; struct mutex lock; bool connected;