From patchwork Fri May 10 13:26:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13661598 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 DB67BC25B5F for ; Fri, 10 May 2024 13:26:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7B80410EB2B; Fri, 10 May 2024 13:26:21 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Bwx4jAm6"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id E8B9510EA28 for ; Fri, 10 May 2024 13:26:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715347579; x=1746883579; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=M6ZKM8u7DtskOFzSDAOgeL6kei6j/SZiuBbFDJIzcUc=; b=Bwx4jAm6NuxjmlpLy2HOptNisJwDGGVVPef0xwJAj+hRr1+0Y1IhMCq5 PbhjAk+24wQYUt6tqp/Bs8/VdPCDiJ9uCNSThB7nxuayYkQODthIfrrbB DIfS3+H0aeVoWBAizdMLrad5ajQ8yEhX1zcTcwtOI98z27rM3AkzF46ef jnGEm8UlRGFvLJP7oZat50+ZhIU/L6/ynfQnRhlPqAz357Tld6QheMqZf FoPFd5P6nJ6B1buakFPomHngDkzoSwnJ7CxVP9gTbdjV5T5LKqlcDFxrZ OTG8dqvukr1yWMLHqdJ6rx0ssdWkaMtCgKedIs8KuU3A8QHDFiAt1PlRs Q==; X-CSE-ConnectionGUID: Y5z8QdQySVSInQU/SI0w5A== X-CSE-MsgGUID: dHo7m5IdRTSzUZ/G7+++Uw== X-IronPort-AV: E=McAfee;i="6600,9927,11068"; a="11489927" X-IronPort-AV: E=Sophos;i="6.08,151,1712646000"; d="scan'208";a="11489927" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 06:26:19 -0700 X-CSE-ConnectionGUID: 6TdG9BNzQTqTEy/Ojc8tJw== X-CSE-MsgGUID: pXcx1/ZXQbyD3lIW8YXGFA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,151,1712646000"; d="scan'208";a="30168769" Received: from ettammin-desk.ger.corp.intel.com (HELO localhost) ([10.245.246.180]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 06:26:17 -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 Subject: [RESEND 1/6] drm/bridge/analogix/anx6345: switch to struct drm_edid Date: Fri, 10 May 2024 16:26:04 +0300 Message-Id: <74b2f00e17b2614b44955cf0cbae270f3c31d91a.1715347488.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 struct drm_edid based functions over struct edid. Signed-off-by: Jani Nikula Reviewed-by: Robert Foss --- Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec --- .../gpu/drm/bridge/analogix/analogix-anx6345.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c index c9e35731e6a1..42ab6014fe12 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c @@ -47,7 +47,7 @@ struct anx6345 { struct drm_dp_aux aux; struct drm_bridge bridge; struct i2c_client *client; - struct edid *edid; + const struct drm_edid *drm_edid; struct drm_connector connector; struct drm_panel *panel; struct regulator *dvdd12; @@ -458,7 +458,7 @@ static int anx6345_get_modes(struct drm_connector *connector) mutex_lock(&anx6345->lock); - if (!anx6345->edid) { + if (!anx6345->drm_edid) { if (!anx6345->powered) { anx6345_poweron(anx6345); power_off = true; @@ -470,19 +470,18 @@ static int anx6345_get_modes(struct drm_connector *connector) goto unlock; } - anx6345->edid = drm_get_edid(connector, &anx6345->aux.ddc); - if (!anx6345->edid) + anx6345->drm_edid = drm_edid_read_ddc(connector, &anx6345->aux.ddc); + if (!anx6345->drm_edid) DRM_ERROR("Failed to read EDID from panel\n"); - err = drm_connector_update_edid_property(connector, - anx6345->edid); + err = drm_edid_connector_update(connector, anx6345->drm_edid); if (err) { DRM_ERROR("Failed to update EDID property: %d\n", err); goto unlock; } } - num_modes += drm_add_edid_modes(connector, anx6345->edid); + num_modes += drm_edid_connector_add_modes(connector); /* Driver currently supports only 6bpc */ connector->display_info.bpc = 6; @@ -793,7 +792,7 @@ static void anx6345_i2c_remove(struct i2c_client *client) unregister_i2c_dummy_clients(anx6345); - kfree(anx6345->edid); + drm_edid_free(anx6345->drm_edid); mutex_destroy(&anx6345->lock); } From patchwork Fri May 10 13:26:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13661599 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 D321BC25B10 for ; Fri, 10 May 2024 13:26:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1C12A10EA2A; Fri, 10 May 2024 13:26:29 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="mR7ACGZT"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 976F210E9B3 for ; Fri, 10 May 2024 13:26:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715347586; x=1746883586; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=h3mr/JBZVXgf3FJm/3U0By1+74lqOPO/O5jKmd/b9Ec=; b=mR7ACGZTtPXVHqVZZpr1530sbWeVdTG1E0sh/uSZdpOPZyaApdbmizBe 2RiKJfnHDOQH8yVad44WlJ2vwA1BP7JZo+DPMEyB5u40EmR888b/uttdW mSmEi+56c+IkeNGcyWXqlyyC65Iq+dJJhC0Eey1oYdT9PLG1t4RFEIxxg nMZNm8xMkrmhxc2tvFReAkTyisNpLnWiG3BPFucJTP7btfzwZK8jkW+Xi BPFQWo1lQWraQ9XLKI8Hf32WLASOQFsht2YY6LcBbDXtXgtYW1MAojblE +M/7SqVbsyigDUEr0O3VFZRug0dY4L5W213goBDw7jORdSpEiAqGejFHc w==; X-CSE-ConnectionGUID: ZdWbpawYTSelupXTfujeKA== X-CSE-MsgGUID: qlM2SChtT2qDX+ILqBqteg== X-IronPort-AV: E=McAfee;i="6600,9927,11068"; a="11489948" X-IronPort-AV: E=Sophos;i="6.08,151,1712646000"; d="scan'208";a="11489948" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 06:26:26 -0700 X-CSE-ConnectionGUID: Okm+TK4aQTmpd+Lz+MS/Vw== X-CSE-MsgGUID: zAsNVpXtT+S4pjsfdRqb0w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,151,1712646000"; d="scan'208";a="30168783" Received: from ettammin-desk.ger.corp.intel.com (HELO localhost) ([10.245.246.180]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 06:26:24 -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 Subject: [RESEND 2/6] drm/bridge/analogix/anx78xx: switch to struct drm_edid Date: Fri, 10 May 2024 16:26:05 +0300 Message-Id: <035c7c31a3e096625a69eb4657c1727da4021a62.1715347488.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 struct drm_edid based functions over struct edid. Signed-off-by: Jani Nikula Reviewed-by: Robert Foss --- Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec --- .../drm/bridge/analogix/analogix-anx78xx.c | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c index 5748a8581af4..ae79bcd8fa55 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c @@ -67,7 +67,7 @@ struct anx78xx { struct drm_dp_aux aux; struct drm_bridge bridge; struct i2c_client *client; - struct edid *edid; + const struct drm_edid *drm_edid; struct drm_connector connector; struct anx78xx_platform_data pdata; struct mutex lock; @@ -830,8 +830,8 @@ static int anx78xx_get_modes(struct drm_connector *connector) if (WARN_ON(!anx78xx->powered)) return 0; - if (anx78xx->edid) - return drm_add_edid_modes(connector, anx78xx->edid); + if (anx78xx->drm_edid) + return drm_edid_connector_add_modes(connector); mutex_lock(&anx78xx->lock); @@ -841,20 +841,21 @@ static int anx78xx_get_modes(struct drm_connector *connector) goto unlock; } - anx78xx->edid = drm_get_edid(connector, &anx78xx->aux.ddc); - if (!anx78xx->edid) { + anx78xx->drm_edid = drm_edid_read_ddc(connector, &anx78xx->aux.ddc); + + err = drm_edid_connector_update(connector, anx78xx->drm_edid); + + if (!anx78xx->drm_edid) { DRM_ERROR("Failed to read EDID\n"); goto unlock; } - err = drm_connector_update_edid_property(connector, - anx78xx->edid); if (err) { DRM_ERROR("Failed to update EDID property: %d\n", err); goto unlock; } - num_modes = drm_add_edid_modes(connector, anx78xx->edid); + num_modes = drm_edid_connector_add_modes(connector); unlock: mutex_unlock(&anx78xx->lock); @@ -1091,8 +1092,8 @@ static bool anx78xx_handle_common_int_4(struct anx78xx *anx78xx, u8 irq) event = true; anx78xx_poweroff(anx78xx); /* Free cached EDID */ - kfree(anx78xx->edid); - anx78xx->edid = NULL; + drm_edid_free(anx78xx->drm_edid); + anx78xx->drm_edid = NULL; } else if (irq & SP_HPD_PLUG) { DRM_DEBUG_KMS("IRQ: Hot plug detect - cable plug\n"); event = true; @@ -1363,7 +1364,7 @@ static void anx78xx_i2c_remove(struct i2c_client *client) unregister_i2c_dummy_clients(anx78xx); - kfree(anx78xx->edid); + drm_edid_free(anx78xx->drm_edid); } static const struct of_device_id anx78xx_match_table[] = { From patchwork Fri May 10 13:26:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13661600 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 8CA79C25B5F for ; Fri, 10 May 2024 13:26:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A655B10E9B3; Fri, 10 May 2024 13:26:37 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Wn/Z+alN"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id B45E510E9B3 for ; Fri, 10 May 2024 13:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715347596; x=1746883596; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DQq7oTtacscxCfEwlG6Xz3Xc8iu0+qWlTJMtW1gqb+8=; b=Wn/Z+alNgNy6+OiKDChqdzmH7CNwwYtSUMaS1CcQPan+ikT3lzFlax5p Ep4xsxfeWYe7dCrVHn+XWMcbO+eiwXdKQMZak1vGF7IOd9na0DwNPPM7G 7p86C6aLKSV/1KNqcyneEFz0Qp5rYpk6AMkxm6hklu7l3sqKDz92gT0lm 7dzcRi6jhwzYB/BSIwbJBL49HIQAjTIUIW7OA0Wd27nx16dxEDhLNK7r4 MQlI/yqrmPbBqBagKwdymxKB743JunCYuMmx0btputRu4Gju7aFIlRzVa q0CEtEpXrLR1CGEL7izRKT3XQ8/c8UFHnAiBPt02jTMUlDjjNWSmDpM3F A==; X-CSE-ConnectionGUID: P5x/7kKoSMyli56111OUSw== X-CSE-MsgGUID: I2VP5kFgQei8bkHl/FAVog== X-IronPort-AV: E=McAfee;i="6600,9927,11068"; a="11489572" X-IronPort-AV: E=Sophos;i="6.08,151,1712646000"; d="scan'208";a="11489572" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 06:26:34 -0700 X-CSE-ConnectionGUID: khdSc6kjSQCfBXrBPuouMA== X-CSE-MsgGUID: gb166+FxThK+i+XXD34Gug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,151,1712646000"; d="scan'208";a="67089404" Received: from ettammin-desk.ger.corp.intel.com (HELO localhost) ([10.245.246.180]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 06:26:31 -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 Subject: [RESEND 3/6] drm/bridge: anx7625: use struct drm_edid more Date: Fri, 10 May 2024 16:26:06 +0300 Message-Id: <1d1290829fa463237b560c43e77170a986186031.1715347488.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 struct drm_edid based functions over struct edid. Signed-off-by: Jani Nikula Reviewed-by: Robert Foss --- Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec --- drivers/gpu/drm/bridge/analogix/anx7625.c | 26 +++++++++++++++-------- drivers/gpu/drm/bridge/analogix/anx7625.h | 10 ++------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 59e9ad349969..d19975c5e5e5 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -464,9 +464,11 @@ static int anx7625_odfc_config(struct anx7625_data *ctx, */ static int anx7625_set_k_value(struct anx7625_data *ctx) { - struct edid *edid = (struct edid *)ctx->slimport_edid_p.edid_raw_data; + struct drm_edid_product_id id; - if (edid->mfg_id[0] == IVO_MID0 && edid->mfg_id[1] == IVO_MID1) + drm_edid_get_product_id(ctx->cached_drm_edid, &id); + + if (be16_to_cpu(id.manufacturer_name) == IVO_MID) return anx7625_reg_write(ctx, ctx->i2c.rx_p1_client, MIPI_DIGITAL_ADJ_1, 0x3B); @@ -1526,7 +1528,8 @@ static int anx7625_wait_hpd_asserted(struct drm_dp_aux *aux, static void anx7625_remove_edid(struct anx7625_data *ctx) { - ctx->slimport_edid_p.edid_block_num = -1; + drm_edid_free(ctx->cached_drm_edid); + ctx->cached_drm_edid = NULL; } static void anx7625_dp_adjust_swing(struct anx7625_data *ctx) @@ -1787,27 +1790,32 @@ static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux, static const struct drm_edid *anx7625_edid_read(struct anx7625_data *ctx) { struct device *dev = ctx->dev; - struct s_edid_data *p_edid = &ctx->slimport_edid_p; + u8 *edid_buf; int edid_num; - if (ctx->slimport_edid_p.edid_block_num > 0) + if (ctx->cached_drm_edid) goto out; + edid_buf = kmalloc(FOUR_BLOCK_SIZE, GFP_KERNEL); + if (!edid_buf) + return NULL; + pm_runtime_get_sync(dev); _anx7625_hpd_polling(ctx, 5000 * 100); - edid_num = sp_tx_edid_read(ctx, p_edid->edid_raw_data); + edid_num = sp_tx_edid_read(ctx, edid_buf); pm_runtime_put_sync(dev); if (edid_num < 1) { DRM_DEV_ERROR(dev, "Fail to read EDID: %d\n", edid_num); + kfree(edid_buf); return NULL; } - p_edid->edid_block_num = edid_num; + ctx->cached_drm_edid = drm_edid_alloc(edid_buf, FOUR_BLOCK_SIZE); + kfree(edid_buf); out: - return drm_edid_alloc(ctx->slimport_edid_p.edid_raw_data, - FOUR_BLOCK_SIZE); + return drm_edid_dup(ctx->cached_drm_edid); } static enum drm_connector_status anx7625_sink_detect(struct anx7625_data *ctx) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.h b/drivers/gpu/drm/bridge/analogix/anx7625.h index 39ed35d33836..eb5580f1ab2f 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.h +++ b/drivers/gpu/drm/bridge/analogix/anx7625.h @@ -286,8 +286,7 @@ #define MIPI_LANE_CTRL_10 0x0F #define MIPI_DIGITAL_ADJ_1 0x1B -#define IVO_MID0 0x26 -#define IVO_MID1 0xCF +#define IVO_MID 0x26CF #define MIPI_PLL_M_NUM_23_16 0x1E #define MIPI_PLL_M_NUM_15_8 0x1F @@ -417,11 +416,6 @@ enum audio_wd_len { #define EDID_TRY_CNT 3 #define SUPPORT_PIXEL_CLOCK 300000 -struct s_edid_data { - int edid_block_num; - u8 edid_raw_data[FOUR_BLOCK_SIZE]; -}; - /***************** Display End *****************/ #define MAX_LANES_SUPPORT 4 @@ -466,7 +460,7 @@ struct anx7625_data { struct anx7625_i2c_client i2c; struct i2c_client *last_client; struct timer_list hdcp_timer; - struct s_edid_data slimport_edid_p; + const struct drm_edid *cached_drm_edid; struct device *codec_dev; hdmi_codec_plugged_cb plugged_cb; struct work_struct work; From patchwork Fri May 10 13:26:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13661601 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 04372C25B10 for ; Fri, 10 May 2024 13:26:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2C5F510EA0B; Fri, 10 May 2024 13:26:40 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="bVBhwD5A"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 546BF10EA0B for ; Fri, 10 May 2024 13:26:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715347599; x=1746883599; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=b4rFXO4I5gNMTvpzxi2svMqDHQ3KZ32z6a0swYTaFRk=; b=bVBhwD5APwTgTYUo1X/VykKSb5WIAoRXm0gCB77dQb4dGrjAAv0lKSAl BOScia6EnmjHjLdoAfCX4gld01qXzWXDyCjVcpGqp2l/5YQ9fputW3Pht DQO/BPRfDX+BkDPOb+ChA3ZiphWhwtfPaimkYUNjVyFiEKOrq/91cv8ed Cw4/4v0ad8w34vHOccubQv0Df37waWH/Pb+BE+PrlPM/QLmwvCQSO0Y9o Cz5rc51KUV6INc8/1jZtW6wT1o59CqD9jk0R3bdG44/xpKLHdBAey0yTv 0XiIJGJd1Cu67VvHTJvKcvjXDg8dsRE2E4KgD4goGSnwwJdWuWhdIy20Z w==; X-CSE-ConnectionGUID: Oaq5cAm4RlezYmrNlkbHaw== X-CSE-MsgGUID: wqOHiGcBTQK6FxxULFmDWg== X-IronPort-AV: E=McAfee;i="6600,9927,11068"; a="11489583" X-IronPort-AV: E=Sophos;i="6.08,151,1712646000"; d="scan'208";a="11489583" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 06:26:39 -0700 X-CSE-ConnectionGUID: qvcomucnSz6VM7i3736bTA== X-CSE-MsgGUID: KBsTt6RlRee3s6Ig45n38A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,151,1712646000"; d="scan'208";a="67089414" Received: from ettammin-desk.ger.corp.intel.com (HELO localhost) ([10.245.246.180]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 06:26:37 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, Russell King Subject: [RESEND 4/6] drm/i2c: tda998x: switch to struct drm_edid Date: Fri, 10 May 2024 16:26:07 +0300 Message-Id: <485a33bc4eba9daae109d3f4795bc695e026ba0c.1715347488.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 struct drm_edid based functions over struct edid. Signed-off-by: Jani Nikula Reviewed-by: Robert Foss --- Cc: Russell King --- drivers/gpu/drm/i2c/tda998x_drv.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index d8d7de18dd65..2160f05bbd16 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -1283,7 +1283,7 @@ static int read_edid_block(void *data, u8 *buf, unsigned int blk, size_t length) static int tda998x_connector_get_modes(struct drm_connector *connector) { struct tda998x_priv *priv = conn_to_tda998x_priv(connector); - struct edid *edid; + const struct drm_edid *drm_edid; int n; /* @@ -1297,25 +1297,26 @@ static int tda998x_connector_get_modes(struct drm_connector *connector) if (priv->rev == TDA19988) reg_clear(priv, REG_TX4, TX4_PD_RAM); - edid = drm_do_get_edid(connector, read_edid_block, priv); + drm_edid = drm_edid_read_custom(connector, read_edid_block, priv); if (priv->rev == TDA19988) reg_set(priv, REG_TX4, TX4_PD_RAM); - if (!edid) { + drm_edid_connector_update(connector, drm_edid); + cec_notifier_set_phys_addr(priv->cec_notify, + connector->display_info.source_physical_address); + + if (!drm_edid) { dev_warn(&priv->hdmi->dev, "failed to read EDID\n"); return 0; } - drm_connector_update_edid_property(connector, edid); - cec_notifier_set_phys_addr_from_edid(priv->cec_notify, edid); - mutex_lock(&priv->audio_mutex); - n = drm_add_edid_modes(connector, edid); - priv->sink_has_audio = drm_detect_monitor_audio(edid); + n = drm_edid_connector_add_modes(connector); + priv->sink_has_audio = connector->display_info.has_audio; mutex_unlock(&priv->audio_mutex); - kfree(edid); + drm_edid_free(drm_edid); return n; } From patchwork Fri May 10 13:26: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: 13661602 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 BE493C25B10 for ; Fri, 10 May 2024 13:26:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0586B10EA1D; Fri, 10 May 2024 13:26:48 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="g34kFjzw"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id CDF9210EA1D for ; Fri, 10 May 2024 13:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715347605; x=1746883605; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qbGksS+c77n27GaUMP1vp6e/Bg5X8SWyvezjtiDsHHg=; b=g34kFjzweFKDM9GMx5Kr9HfvOp9p3HjFyxgvfD03ntVfakgPmAjyvPrY OlIcQXknH/SuxX9uPyOfO5UcgIu5AEw8v6/7wqNpbI5JCGrKxHWngwnV9 SBELge+7LCYmKzlp5DttaudwUwuLqbfFv5We0tqomom1tcWuxNQL8b8I3 TWMUwai7CKyHW0qYOJ0N1Bp8e3CMC4fnvztTsbTNyVGHgrjU8HN91FpkZ oNVCakl13VsHWkHUICMt7yY7E926UhWrQwdmV+cuvybZ7jUjkgfdRc5TW dChfUfdoYvLkMLohUm1tA14709lV4dsOSWERJgImdXQ1ypfURv5fZq//D Q==; X-CSE-ConnectionGUID: 4qszeNo3SxS+TBFg0/DCpw== X-CSE-MsgGUID: F8MwV4glRnibBMr7NydjNg== X-IronPort-AV: E=McAfee;i="6600,9927,11068"; a="11489977" X-IronPort-AV: E=Sophos;i="6.08,151,1712646000"; d="scan'208";a="11489977" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 06:26:44 -0700 X-CSE-ConnectionGUID: ewdiqt6QT9yM8csIhcPWzQ== X-CSE-MsgGUID: yPxnscI1SpCkr7huABmVjQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,151,1712646000"; d="scan'208";a="30168809" Received: from ettammin-desk.ger.corp.intel.com (HELO localhost) ([10.245.246.180]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 06:26:43 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, Gerd Hoffmann , virtualization@lists.linux.dev Subject: [RESEND 5/6] drm/bochs: switch to struct drm_edid Date: Fri, 10 May 2024 16:26:08 +0300 Message-Id: <24536f4a1a12af7b43ba86e9761dfeef179b72df.1715347488.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 struct drm_edid based functions over struct edid. Signed-off-by: Jani Nikula Reviewed-by: Robert Foss --- Cc: Gerd Hoffmann Cc: virtualization@lists.linux.dev --- drivers/gpu/drm/tiny/bochs.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c index 2d7ad808cc0e..d12d6e0bf3df 100644 --- a/drivers/gpu/drm/tiny/bochs.c +++ b/drivers/gpu/drm/tiny/bochs.c @@ -85,7 +85,7 @@ struct bochs_device { u16 yres_virtual; u32 stride; u32 bpp; - struct edid *edid; + const struct drm_edid *drm_edid; /* drm */ struct drm_device *dev; @@ -199,10 +199,10 @@ static int bochs_hw_load_edid(struct bochs_device *bochs) if (drm_edid_header_is_valid(header) != 8) return -1; - kfree(bochs->edid); - bochs->edid = drm_do_get_edid(&bochs->connector, - bochs_get_edid_block, bochs); - if (bochs->edid == NULL) + drm_edid_free(bochs->drm_edid); + bochs->drm_edid = drm_edid_read_custom(&bochs->connector, + bochs_get_edid_block, bochs); + if (bochs->drm_edid == NULL) return -1; return 0; @@ -303,7 +303,7 @@ static void bochs_hw_fini(struct drm_device *dev) if (bochs->fb_map) iounmap(bochs->fb_map); pci_release_regions(to_pci_dev(dev->dev)); - kfree(bochs->edid); + drm_edid_free(bochs->drm_edid); } static void bochs_hw_blank(struct bochs_device *bochs, bool blank) @@ -471,12 +471,9 @@ static const struct drm_simple_display_pipe_funcs bochs_pipe_funcs = { static int bochs_connector_get_modes(struct drm_connector *connector) { - struct bochs_device *bochs = - container_of(connector, struct bochs_device, connector); - int count = 0; + int count; - if (bochs->edid) - count = drm_add_edid_modes(connector, bochs->edid); + count = drm_edid_connector_add_modes(connector); if (!count) { count = drm_add_modes_noedid(connector, 8192, 8192); @@ -507,10 +504,10 @@ static void bochs_connector_init(struct drm_device *dev) drm_connector_helper_add(connector, &bochs_connector_connector_helper_funcs); bochs_hw_load_edid(bochs); - if (bochs->edid) { + if (bochs->drm_edid) { DRM_INFO("Found EDID data blob.\n"); drm_connector_attach_edid_property(connector); - drm_connector_update_edid_property(connector, bochs->edid); + drm_edid_connector_update(&bochs->connector, bochs->drm_edid); } } From patchwork Fri May 10 13:26: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: 13661603 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 7635CC25B10 for ; Fri, 10 May 2024 13:26:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E24310EA28; Fri, 10 May 2024 13:26:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="TUHyJHGI"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 991BA10EA28 for ; Fri, 10 May 2024 13:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715347613; x=1746883613; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DQTcuRJ6jV+KHtqCB34fEC2WDqRthotEQh0eyz/EF8M=; b=TUHyJHGIwaniR3nxAIbzEs5GzQ3UggRRrcNeHGFXoNx6/iPRUfc7kD2E Ui8UbhUEyG8EqtSkmWjXR8GfOXx++A27B+iPjuS09xn2VftYCQZKYgX1X e6s0KjBeBWuvaAEGq0cV/FkRH1al0Nn4gvWpeMoNF/Udda1bDVYvVdxn8 YUD6fY08530PrA6bAV/cT1wj4Blsh5SAZToOGI3YHJuUQeAyUhFAHky1x 787kDnmvPpqKsIds+SH08HFC6vM9/pO0M6UbTnWzQJrqby2b7kF/hObLX qWQzDH28/EO4ALoASfRhb97M0ZgMbSe80MfMLfRcrrJ4E6ZE3oF7ChOh+ g==; X-CSE-ConnectionGUID: HSRKH5PTS4uEGCmC49tpzA== X-CSE-MsgGUID: xTR9qUXUQwijefIhsbE1PA== X-IronPort-AV: E=McAfee;i="6600,9927,11068"; a="11489602" X-IronPort-AV: E=Sophos;i="6.08,151,1712646000"; d="scan'208";a="11489602" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 06:26:52 -0700 X-CSE-ConnectionGUID: G6i9VGmWQdWNsv+qrGnAxg== X-CSE-MsgGUID: H/U/M+ufSq6ZU5gbYQ8jUA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,151,1712646000"; d="scan'208";a="67089443" Received: from ettammin-desk.ger.corp.intel.com (HELO localhost) ([10.245.246.180]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 06:26:49 -0700 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , virtualization@lists.linux.dev Subject: [RESEND 6/6] drm/virtio: switch to struct drm_edid Date: Fri, 10 May 2024 16:26:09 +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 struct drm_edid based functions over struct edid. Signed-off-by: Jani Nikula Reviewed-by: Robert Foss --- Cc: David Airlie Cc: Gerd Hoffmann Cc: Gurchetan Singh Cc: Chia-I Wu Cc: virtualization@lists.linux.dev --- drivers/gpu/drm/virtio/virtgpu_display.c | 10 ++++------ drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- drivers/gpu/drm/virtio/virtgpu_vq.c | 12 ++++++------ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index ad924a8502e9..64baf2f22d9f 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -164,11 +164,9 @@ static int virtio_gpu_conn_get_modes(struct drm_connector *connector) struct drm_display_mode *mode = NULL; int count, width, height; - if (output->edid) { - count = drm_add_edid_modes(connector, output->edid); - if (count) - return count; - } + count = drm_edid_connector_add_modes(connector); + if (count) + return count; width = le32_to_cpu(output->info.r.width); height = le32_to_cpu(output->info.r.height); @@ -369,5 +367,5 @@ void virtio_gpu_modeset_fini(struct virtio_gpu_device *vgdev) return; for (i = 0 ; i < vgdev->num_scanouts; ++i) - kfree(vgdev->outputs[i].edid); + drm_edid_free(vgdev->outputs[i].drm_edid); } diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index bb7d86a0c6a1..64c236169db8 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -179,7 +179,7 @@ struct virtio_gpu_output { struct drm_encoder enc; struct virtio_gpu_display_one info; struct virtio_gpu_update_cursor cursor; - struct edid *edid; + const struct drm_edid *drm_edid; int cur_x; int cur_y; bool needs_modeset; diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index b1a00c0c25a7..0d3d0d09f39b 100644 --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -741,21 +741,21 @@ static void virtio_gpu_cmd_get_edid_cb(struct virtio_gpu_device *vgdev, (struct virtio_gpu_resp_edid *)vbuf->resp_buf; uint32_t scanout = le32_to_cpu(cmd->scanout); struct virtio_gpu_output *output; - struct edid *new_edid, *old_edid; + const struct drm_edid *new_edid, *old_edid; if (scanout >= vgdev->num_scanouts) return; output = vgdev->outputs + scanout; - new_edid = drm_do_get_edid(&output->conn, virtio_get_edid_block, resp); - drm_connector_update_edid_property(&output->conn, new_edid); + new_edid = drm_edid_read_custom(&output->conn, virtio_get_edid_block, resp); + drm_edid_connector_update(&output->conn, new_edid); spin_lock(&vgdev->display_info_lock); - old_edid = output->edid; - output->edid = new_edid; + old_edid = output->drm_edid; + output->drm_edid = new_edid; spin_unlock(&vgdev->display_info_lock); - kfree(old_edid); + drm_edid_free(old_edid); wake_up(&vgdev->resp_wq); }