From patchwork Thu Feb 6 06:32:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13962290 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 B507AC02198 for ; Thu, 6 Feb 2025 06:33:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 55EE410E222; Thu, 6 Feb 2025 06:33:11 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="S3RwuT78"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 719B610E136; Thu, 6 Feb 2025 06:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738823589; x=1770359589; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xQilvHnCC8t8i5eZB4xXkLUctiqnZjWDPRwoYBdoJZs=; b=S3RwuT78vb916+oCdvOBZZSHNY+Jny3dHn7i+xfU1YYDvGuMSgcjA3Q8 qTv1NRQTPKGT205z4r9fajYl7UdTjr+lbEzFOEFsROilBdEe5Zn+svJxD Y+3puDTVut0wXZm6R/p+NFP+voOnQda+yT6gBkHQp1FLGz0w3Wxb9mg6b Z9i1f/TOKhKSQcXNV2uEzjZLLaGXcR6rksUv6APcDr3AltZWW1R9O3Z0K OiJkSL3i2/YfUcBuUZEAe0jHlhH6XkbXyaDjnKFO5fiiJeTlSPzg2La18 g2CEHirIAmv5ekRicnwH3WGtZOTX5dprNYSLrkCXAhmQYDFXpoJhfyfbN A==; X-CSE-ConnectionGUID: xq9NaTIDRoixoiHvIx6caQ== X-CSE-MsgGUID: OZqxnN2eSImTMs3uH5Ka1Q== X-IronPort-AV: E=McAfee;i="6700,10204,11336"; a="27014212" X-IronPort-AV: E=Sophos;i="6.13,263,1732608000"; d="scan'208";a="27014212" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2025 22:33:09 -0800 X-CSE-ConnectionGUID: Z154DoZCRvywCfhUJ0EATQ== X-CSE-MsgGUID: 1K2WnuD+Ttqi29XLm5prQQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="112013668" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.10]) by orviesa008.jf.intel.com with ESMTP; 05 Feb 2025 22:33:07 -0800 From: Suraj Kandpal To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: uma.shankar@intel.com, arun.r.murthy@intel.com, ben.kao@intel.com, Suraj Kandpal Subject: [PATCH 1/8] drm/dp: Add eDP 1.5 bit definition Date: Thu, 6 Feb 2025 12:02:46 +0530 Message-Id: <20250206063253.2827017-2-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250206063253.2827017-1-suraj.kandpal@intel.com> References: <20250206063253.2827017-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Add the eDP revision bit value for 1.5. Spec: eDPv1.5 Table 16-5 Signed-off-by: Suraj Kandpal Reviewed-by: Arun R Murthy Tested-by: Ben Kao --- include/drm/display/drm_dp.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/drm/display/drm_dp.h b/include/drm/display/drm_dp.h index 480370bba1de..05e16f0144ff 100644 --- a/include/drm/display/drm_dp.h +++ b/include/drm/display/drm_dp.h @@ -999,6 +999,7 @@ # define DP_EDP_14 0x03 # define DP_EDP_14a 0x04 /* eDP 1.4a */ # define DP_EDP_14b 0x05 /* eDP 1.4b */ +# define DP_EDP_15 0x06 /* eDP 1.5 */ #define DP_EDP_GENERAL_CAP_1 0x701 # define DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP (1 << 0) From patchwork Thu Feb 6 06:32:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13962291 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 26843C02196 for ; Thu, 6 Feb 2025 06:33:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BED6510E42D; Thu, 6 Feb 2025 06:33:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="h4ffWexu"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 156E310E42C; Thu, 6 Feb 2025 06:33:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738823592; x=1770359592; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AxVjKrGt7lFch1AHXL0EKcb8cyryluaX8/E+kxJnyK8=; b=h4ffWexuc2pCaxwZAj8/1D7N1YRXjaz2IcPbBhYFfluZmnmil60iG5+A GNZU9jWc1ivgBt3csBhJkBBPfaE/B/x+dWf0VwBDqBM9F4sCZgFpyZcs1 gF/DR6HbdCyDGmA13bvL8CE66BxNaGRE/DPzBLR1I2ZrABcqssuhL88Tk 15BqTVZaS3bvf4DtLXC9CMEFknPTrKHNI1p7I9G9dLfXKhMRUMLf6AoYv VlDRrdSZR14444ct8KFOjEQ3R685mSU2o/EjanRJlpkRtuJRysVFWr/NW 55FpzUXk790pnVDTmHlZYCM2donLexE7c6hLAkQeUPghqqSYEO0IV3h6Z g==; X-CSE-ConnectionGUID: ZdznImWxScG6AXpaqHoUKQ== X-CSE-MsgGUID: E1YDa7wdQCC7o5OWBpCa3A== X-IronPort-AV: E=McAfee;i="6700,10204,11336"; a="27014215" X-IronPort-AV: E=Sophos;i="6.13,263,1732608000"; d="scan'208";a="27014215" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2025 22:33:11 -0800 X-CSE-ConnectionGUID: W+P7OYj2Q3qP87lEf0Q5MQ== X-CSE-MsgGUID: AQfoX/GtSdGTy2uHiY2V+w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="112013677" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.10]) by orviesa008.jf.intel.com with ESMTP; 05 Feb 2025 22:33:10 -0800 From: Suraj Kandpal To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: uma.shankar@intel.com, arun.r.murthy@intel.com, ben.kao@intel.com, Suraj Kandpal Subject: [PATCH 2/8] drm/dp: Increase eDP display control capability size Date: Thu, 6 Feb 2025 12:02:47 +0530 Message-Id: <20250206063253.2827017-3-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250206063253.2827017-1-suraj.kandpal@intel.com> References: <20250206063253.2827017-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Increase the eDP display control capability size to take into account the general capability register 703 and 704 that have recently been added. Signed-off-by: Suraj Kandpal Reviewed-by: Arun R Murthy Acked-by: Maarten Lankhorst --- include/drm/display/drm_dp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/drm/display/drm_dp.h b/include/drm/display/drm_dp.h index 05e16f0144ff..784a32bfbad8 100644 --- a/include/drm/display/drm_dp.h +++ b/include/drm/display/drm_dp.h @@ -1670,7 +1670,7 @@ enum drm_dp_phy { #define DP_RECEIVER_CAP_SIZE 0xf #define DP_DSC_RECEIVER_CAP_SIZE 0x10 /* DSC Capabilities 0x60 through 0x6F */ #define EDP_PSR_RECEIVER_CAP_SIZE 2 -#define EDP_DISPLAY_CTL_CAP_SIZE 3 +#define EDP_DISPLAY_CTL_CAP_SIZE 5 #define DP_LTTPR_COMMON_CAP_SIZE 8 #define DP_LTTPR_PHY_CAP_SIZE 3 From patchwork Thu Feb 6 06:32:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13962292 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 2DE2DC02198 for ; Thu, 6 Feb 2025 06:33:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C3A2A10E42F; Thu, 6 Feb 2025 06:33:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="QrnP3Dpw"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id B084110E42E; Thu, 6 Feb 2025 06:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738823594; x=1770359594; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gtxDKMeP0R4aywy8S4ng84XE21QXblABMqMejDOfZ1A=; b=QrnP3Dpw7M+NjEvGDJj0mxlwoYm6Gsj6D/VwGFPGSRVjGGQHtOsjfIMZ JO7u1kjfqtLOHrzvYagsdLtBLaKkXbNGOw+PK6MzUCUEty96jSpMzg9Xp RLhd8OAgjBtsGa6zg1VUJd01XNlJ8ZHwFif+m1J385KWk7LxtIx2Hwapr Armnt3WJ7q86Tzd8UGfGCFdk2iKQnQrhnzXB1aKwBAgYv/1cNZgIgYVkr ea1VKwws3ZcKoCfl3uZdMbNrWpO2vBgsfrbf7FCNFERbLU2f+VUzTV890 AkDsOOzhAxJ5Qb+T9z1AnK26foaMkS5FVrpnXqZYKDi+H8puIE3mbIFgW g==; X-CSE-ConnectionGUID: gtVHvevtT+KVNCjFEiECjw== X-CSE-MsgGUID: Pm9Fl+6mQjqF9tZIiwe8LQ== X-IronPort-AV: E=McAfee;i="6700,10204,11336"; a="27014221" X-IronPort-AV: E=Sophos;i="6.13,263,1732608000"; d="scan'208";a="27014221" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2025 22:33:14 -0800 X-CSE-ConnectionGUID: NiUCrVDaTqKOMV+jKNGoZg== X-CSE-MsgGUID: 0se1rxQTSDi3pjiI75ywgA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="112013694" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.10]) by orviesa008.jf.intel.com with ESMTP; 05 Feb 2025 22:33:13 -0800 From: Suraj Kandpal To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: uma.shankar@intel.com, arun.r.murthy@intel.com, ben.kao@intel.com, Suraj Kandpal Subject: [PATCH 3/8] drm/i915/backlight: Use proper interface based on eDP version Date: Thu, 6 Feb 2025 12:02:48 +0530 Message-Id: <20250206063253.2827017-4-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250206063253.2827017-1-suraj.kandpal@intel.com> References: <20250206063253.2827017-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" eDP is supposed to use VESA interface when using revision 1.5 and above, use Intel interface for backlight control otherwise. Add check to use correct interface. Signed-off-by: Suraj Kandpal Tested-by: Ben Kao Reviewed-by: Arun R Murthy --- drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c index c846ef4acf5b..09e82f24d030 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c @@ -604,6 +604,7 @@ static const struct intel_panel_bl_funcs intel_dp_vesa_bl_funcs = { int intel_dp_aux_init_backlight_funcs(struct intel_connector *connector) { struct intel_display *display = to_intel_display(connector); + struct intel_dp *intel_dp = intel_attached_dp(connector); struct drm_device *dev = connector->base.dev; struct intel_panel *panel = &connector->panel; bool try_intel_interface = false, try_vesa_interface = false; @@ -640,6 +641,10 @@ int intel_dp_aux_init_backlight_funcs(struct intel_connector *connector) break; } + /* For eDP 1.5 and above we are supposed to use VESA interface for brightness control */ + if (intel_dp->edp_dpcd[0] >= DP_EDP_15) + try_vesa_interface = true; + /* * Since Intel has their own backlight control interface, the majority of machines out there * using DPCD backlight controls with Intel GPUs will be using this interface as opposed to @@ -653,7 +658,8 @@ int intel_dp_aux_init_backlight_funcs(struct intel_connector *connector) * backlight interface at all. This means that the only sensible way for us to detect both * interfaces is to probe for Intel's first, and VESA's second. */ - if (try_intel_interface && intel_dp_aux_supports_hdr_backlight(connector)) { + if (try_intel_interface && intel_dp_aux_supports_hdr_backlight(connector) && + intel_dp->edp_dpcd[0] <= DP_EDP_14b) { drm_dbg_kms(dev, "[CONNECTOR:%d:%s] Using Intel proprietary eDP backlight controls\n", connector->base.base.id, connector->base.name); panel->backlight.funcs = &intel_dp_hdr_bl_funcs; From patchwork Thu Feb 6 06:32:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13962297 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 8032EC02198 for ; Thu, 6 Feb 2025 06:33:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1EADE10E435; Thu, 6 Feb 2025 06:33:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="C1oQav9x"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 50CF810E433; Thu, 6 Feb 2025 06:33:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738823597; x=1770359597; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IWHOuTtGWIiNIXjE7VJu/Q9mBXYHdz7Cmdu26DbhqMg=; b=C1oQav9xx9XbWrxki84WHYlzDkOR3a+Jmk1bJ0mUKy3xZzpzPYyziEe7 u30HPO2n4Py8ghZls2MQH/L3ZQIO0ONV5bj4rSMyGRVKxkBJKR5RpzoCs IEiJYjPmXR86ck3mW5M2knHwLp/cBcOYi5wdI24acpV4Nbc+Et5B67mmL AzN2iLy5owaKfSBUTARUqHC1Xc50F5+Frh4u2cyzmVloXWCRUYu7dR5r/ xfVOPW1uKFcPUYSBB+RFoZfgfWL88OLqRIeF/do75J77z+OPORrjqoJXd anLGARI33bKn5AqNPIgVe6sL4DcbhytdFFOh/rafdzvJLNhOv7Yv22/bp w==; X-CSE-ConnectionGUID: 3ZG0MnU6QGGNcA8ntU8b6Q== X-CSE-MsgGUID: rc8iRG2UTua0/IiNPOwILw== X-IronPort-AV: E=McAfee;i="6700,10204,11336"; a="27014226" X-IronPort-AV: E=Sophos;i="6.13,263,1732608000"; d="scan'208";a="27014226" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2025 22:33:17 -0800 X-CSE-ConnectionGUID: WRV7mhsVQTiLKls2YaCIgw== X-CSE-MsgGUID: TdUt0gm2QOO2XEtC1ogFYQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="112013704" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.10]) by orviesa008.jf.intel.com with ESMTP; 05 Feb 2025 22:33:15 -0800 From: Suraj Kandpal To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: uma.shankar@intel.com, arun.r.murthy@intel.com, ben.kao@intel.com, Suraj Kandpal Subject: [PATCH 4/8] drm/i915/backlight: Check Luminance based brightness control for VESA Date: Thu, 6 Feb 2025 12:02:49 +0530 Message-Id: <20250206063253.2827017-5-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250206063253.2827017-1-suraj.kandpal@intel.com> References: <20250206063253.2827017-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Check if we are capable of controlling brightness via luminance which is dependent on PANEL_LUMINANCE_CONTROL_CAPABLE bit being set on EDP_GENERAL_CAPABILITY_2 register. --v2 -Prefer using luminance rather than nits [Jani] -Fix commit message --v3 -Fix the bit name used in commit message [Arun] -Use correct edp_dpcd[] to check the capability [Arun] Signed-off-by: Suraj Kandpal Tested-by: Ben Kao Reviewed-by: Arun R Murthy --- drivers/gpu/drm/i915/display/intel_display_types.h | 1 + drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index cb51b7936f93..3b64ad724b29 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -412,6 +412,7 @@ struct intel_panel { union { struct { struct drm_edp_backlight_info info; + bool luminance_control_support; } vesa; struct { bool sdr_uses_aux; diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c index 09e82f24d030..2599aa39b21d 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c @@ -575,6 +575,15 @@ intel_dp_aux_supports_vesa_backlight(struct intel_connector *connector) { struct intel_display *display = to_intel_display(connector); struct intel_dp *intel_dp = intel_attached_dp(connector); + struct intel_panel *panel = &connector->panel; + + if ((intel_dp->edp_dpcd[3] & DP_EDP_PANEL_LUMINANCE_CONTROL_CAPABLE)) { + drm_dbg_kms(display->drm, + "[CONNECTOR:%d:%s] AUX Luminance Based Backlight Control Supported!\n", + connector->base.base.id, connector->base.name); + panel->backlight.edp.vesa.luminance_control_support = true; + return true; + } if (drm_edp_backlight_supported(intel_dp->edp_dpcd)) { drm_dbg_kms(display->drm, From patchwork Thu Feb 6 06:32:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13962296 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 1D725C02196 for ; Thu, 6 Feb 2025 06:33:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AEE2C10E430; Thu, 6 Feb 2025 06:33:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="aQjv4STv"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id ED58110E42E; Thu, 6 Feb 2025 06:33: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=1738823600; x=1770359600; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VYBHGRuKwLfqGiumX9R+zylheXU0u3dXNYb64qy/bvA=; b=aQjv4STvzvNgoCqUP6udj9THL3trF/fnKZfFtcxUZUVlrnKCxVpbe+fJ quiOzAKNvNkaBTTFEIfqwhv9wzW3Ko0yJZsIB9cyeK99ZtfNF9DiyLUe8 GEC9Y0+1oIB1vdCpcrlzwkYlV8CjQ539Q0G63LGUagZABRZo6MiqLV5nU 9P6jEOYW1x5nvaMIwnBaQ0gJ27Hw8GpjsB7J7vmrvPppXDuNtLmJkrOTL c0XCTYpv2dkX7javW7QAtfNgcjQtVjoD7uLriv1OPTYzDYXeGmrx8tBps hGmtlzPb54NjHjyf2vBANCtf4Rgx1LkU1jjNrOTDq3XUKMY8YdplW+N7H w==; X-CSE-ConnectionGUID: UC39UtLyQkKLUy1n8M795w== X-CSE-MsgGUID: VCPodxC+QTWe8te5zPPFug== X-IronPort-AV: E=McAfee;i="6700,10204,11336"; a="27014232" X-IronPort-AV: E=Sophos;i="6.13,263,1732608000"; d="scan'208";a="27014232" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2025 22:33:19 -0800 X-CSE-ConnectionGUID: /oVrYPOFQ3WjWNCcUs8VXg== X-CSE-MsgGUID: aCkIo15rRTuNQYPeN1ntMQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="112013716" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.10]) by orviesa008.jf.intel.com with ESMTP; 05 Feb 2025 22:33:18 -0800 From: Suraj Kandpal To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: uma.shankar@intel.com, arun.r.murthy@intel.com, ben.kao@intel.com, Suraj Kandpal Subject: [PATCH 5/8] drm/i915/backlight: Modify function to get VESA brightness in Nits Date: Thu, 6 Feb 2025 12:02:50 +0530 Message-Id: <20250206063253.2827017-6-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250206063253.2827017-1-suraj.kandpal@intel.com> References: <20250206063253.2827017-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Modify vesa_get_brightness function to take into account luminance_control_support and based on that read the appropriate register and return the value. --v2 -Changes since we now use luminance instead of nits Signed-off-by: Suraj Kandpal Tested-by: Ben Kao Reviewed-by: Arun R Murthy --- .../drm/i915/display/intel_dp_aux_backlight.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c index 2599aa39b21d..ca5fc40fa13a 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c @@ -451,6 +451,26 @@ intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pi /* VESA backlight callbacks */ static u32 intel_dp_aux_vesa_get_backlight(struct intel_connector *connector, enum pipe unused) { + struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder); + struct intel_panel *panel = &connector->panel; + u8 buf[3]; + u32 val = 0; + int ret; + + if (panel->backlight.edp.vesa.luminance_control_support) { + ret = drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_PANEL_TARGET_LUMINANCE_VALUE, buf, + sizeof(buf)); + if (ret < 0) { + drm_err(intel_dp->aux.drm_dev, + "[CONNECTOR:%d:%s] Failed to read Luminance from DPCD\n", + connector->base.base.id, connector->base.name); + return 0; + } + + val |= buf[0] | buf[1] << 8 | buf[2] << 16; + return val / 1000; + } + return connector->panel.backlight.level; } From patchwork Thu Feb 6 06:32:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13962294 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 76855C02196 for ; Thu, 6 Feb 2025 06:33:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1BDF810E136; Thu, 6 Feb 2025 06:33:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="cLgWfMAJ"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 914A410E16A; Thu, 6 Feb 2025 06:33:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738823602; x=1770359602; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=i2bTUHVegsB+z7CQpmivpLAv2KoBb+8K9dTlrynYwGQ=; b=cLgWfMAJe1/uqiNlo9RKGBnhONiad4G+saZRDKbUUNvRPjIE3QgCuszK iBxx9pATrzTgjQ2SdZ+UNDGHN5MpdCqOB5xLw3aMWXmtQGRViPZga6Gtn LWUzCqa0cQIr5s7o0YSiKo2mtKTEek8eMk31arMSgZeHinQDaEZTphB46 Tbpq6yzgGjP59p70HiIiRSfP9qmHX+/IONXuZdOhj79oDOEcPiXp3geed wlB0I/0KDv/NMkjmoY6UcXzARuKlSWNgbUaywo6fnSP996+wRcJJQBNRJ Yp1PlWgk7Ki4cazxSKWnW5PF/w+3eLtDG6PAI1qP2BuSewtJk66wG40Ny Q==; X-CSE-ConnectionGUID: /o5MBBlNTuqwaiKHE2zK1w== X-CSE-MsgGUID: 5w4Qyr2XTaOhVVj3JE53lw== X-IronPort-AV: E=McAfee;i="6700,10204,11336"; a="27014236" X-IronPort-AV: E=Sophos;i="6.13,263,1732608000"; d="scan'208";a="27014236" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2025 22:33:22 -0800 X-CSE-ConnectionGUID: 7+6Buu6bRaaEy48xGOf0AA== X-CSE-MsgGUID: hFwe24KpRNO4SyE+xoycqw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="112013730" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.10]) by orviesa008.jf.intel.com with ESMTP; 05 Feb 2025 22:33:20 -0800 From: Suraj Kandpal To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: uma.shankar@intel.com, arun.r.murthy@intel.com, ben.kao@intel.com, Suraj Kandpal Subject: [PATCH 6/8] drm/i915/backlight: Add function to change brightness in nits for VESA Date: Thu, 6 Feb 2025 12:02:51 +0530 Message-Id: <20250206063253.2827017-7-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250206063253.2827017-1-suraj.kandpal@intel.com> References: <20250206063253.2827017-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Create a function that fills in the value for PANEL_TARGET_LUMINANCE_VALUE which helps in changing the luminance in nits using VESA interface. --v2 -Prefer using luminance over nits [Jani] Signed-off-by: Suraj Kandpal Tested-by: Ben Kao Reviewed-by: Arun R Murthy --- .../drm/i915/display/intel_dp_aux_backlight.c | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c index ca5fc40fa13a..b0640b5128b1 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c @@ -474,6 +474,31 @@ static u32 intel_dp_aux_vesa_get_backlight(struct intel_connector *connector, en return connector->panel.backlight.level; } +static int +intel_dp_aux_vesa_set_luminance(struct intel_connector *connector, u32 level) +{ + struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder); + u8 buf[3]; + int ret; + + level = level * 1000; + level &= 0xffffff; + buf[0] = (level & 0x0000ff); + buf[1] = (level & 0x00ff00) >> 8; + buf[2] = (level & 0xff0000) >> 16; + + ret = drm_dp_dpcd_write(&intel_dp->aux, DP_EDP_PANEL_TARGET_LUMINANCE_VALUE, + buf, sizeof(buf)); + if (ret != sizeof(buf)) { + drm_err(intel_dp->aux.drm_dev, + "%s: Failed to set VESA Aux Luminance: %d\n", + intel_dp->aux.name, ret); + return -EINVAL; + } else { + return 0; + } +} + static void intel_dp_aux_vesa_set_backlight(const struct drm_connector_state *conn_state, u32 level) { @@ -481,6 +506,11 @@ intel_dp_aux_vesa_set_backlight(const struct drm_connector_state *conn_state, u3 struct intel_panel *panel = &connector->panel; struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder); + if (panel->backlight.edp.vesa.luminance_control_support) { + if (!intel_dp_aux_vesa_set_luminance(connector, level)) + return; + } + if (!panel->backlight.edp.vesa.info.aux_set) { const u32 pwm_level = intel_backlight_level_to_pwm(connector, level); From patchwork Thu Feb 6 06:32:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13962295 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 7D6AEC0219B for ; Thu, 6 Feb 2025 06:33:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 23F7810E42C; Thu, 6 Feb 2025 06:33:26 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="IvxfDUYl"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6CFEE10E42C; Thu, 6 Feb 2025 06:33: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=1738823605; x=1770359605; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DXe9ZQrPUoJuVdAF+V0/NeWMRxH5RoRl3OkqbwCzIJs=; b=IvxfDUYlELZhzuUxr+zqmH/sK3CAN7c+OmRyV61S3PEpQYyQ8bMlXtCz I05A3ODA2QQ2uSjnYwSW1fFSL99Tv860gfRkOo++nSPL/5cy7mXjyFQ2x F/8twXD84wZ9kYou43l0u/yT/mNIATiLmpWnVhyXLhJN3WJXHlVJtGWHX gGC08PPOaQATp8SFZ1KkhHQyqGMQXAJfi7L8Nw6BIlp9RFgs9Hyu2AbWA Y8yR9qGPFgkNCbLs+t8rriBv9TZ2HZ5TB1sbNO/LjCIMRK0xvTV43jtcm whufUuPoGMeLCNW3Vb0o9i8Yv33eewnXSsjp+lHQFMEYrdwlWOjDM2yY1 Q==; X-CSE-ConnectionGUID: keHUaDh2SqWZdUWfAj3D6A== X-CSE-MsgGUID: Z8dPB3lcTyaVu8FGo98iyg== X-IronPort-AV: E=McAfee;i="6700,10204,11336"; a="27014241" X-IronPort-AV: E=Sophos;i="6.13,263,1732608000"; d="scan'208";a="27014241" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2025 22:33:25 -0800 X-CSE-ConnectionGUID: 35rk0aNBS2aaV65O3Kh+6w== X-CSE-MsgGUID: cWszZvjyTRqed7VMJHwxGg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="112013744" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.10]) by orviesa008.jf.intel.com with ESMTP; 05 Feb 2025 22:33:23 -0800 From: Suraj Kandpal To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: uma.shankar@intel.com, arun.r.murthy@intel.com, ben.kao@intel.com, Suraj Kandpal Subject: [PATCH 7/8] drm/i915/backlight: Setup nits based luminance via VESA Date: Thu, 6 Feb 2025 12:02:52 +0530 Message-Id: <20250206063253.2827017-8-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250206063253.2827017-1-suraj.kandpal@intel.com> References: <20250206063253.2827017-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Modify backlight setup function for VESA interface to take into account the nits based luminance. --v2 -Prefer using luminance over nits [Jani] Signed-off-by: Suraj Kandpal Tested-by: Ben Kao Reviewed-by: Arun R Murthy --- .../drm/i915/display/intel_dp_aux_backlight.c | 99 +++++++++++-------- 1 file changed, 59 insertions(+), 40 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c index b0640b5128b1..301a4dfdfbe5 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c @@ -560,56 +560,75 @@ static void intel_dp_aux_vesa_disable_backlight(const struct drm_connector_state static int intel_dp_aux_vesa_setup_backlight(struct intel_connector *connector, enum pipe pipe) { struct intel_display *display = to_intel_display(connector); + struct drm_luminance_range_info *luminance_range = + &connector->base.display_info.luminance_range; struct intel_dp *intel_dp = intel_attached_dp(connector); struct intel_panel *panel = &connector->panel; u16 current_level; u8 current_mode; int ret; - ret = drm_edp_backlight_init(&intel_dp->aux, &panel->backlight.edp.vesa.info, - panel->vbt.backlight.pwm_freq_hz, intel_dp->edp_dpcd, - ¤t_level, ¤t_mode); - if (ret < 0) - return ret; - - drm_dbg_kms(display->drm, - "[CONNECTOR:%d:%s] AUX VESA backlight enable is controlled through %s\n", - connector->base.base.id, connector->base.name, - dpcd_vs_pwm_str(panel->backlight.edp.vesa.info.aux_enable)); - drm_dbg_kms(display->drm, - "[CONNECTOR:%d:%s] AUX VESA backlight level is controlled through %s\n", - connector->base.base.id, connector->base.name, - dpcd_vs_pwm_str(panel->backlight.edp.vesa.info.aux_set)); - - if (!panel->backlight.edp.vesa.info.aux_set || !panel->backlight.edp.vesa.info.aux_enable) { - ret = panel->backlight.pwm_funcs->setup(connector, pipe); - if (ret < 0) { - drm_err(display->drm, - "[CONNECTOR:%d:%s] Failed to setup PWM backlight controls for eDP backlight: %d\n", - connector->base.base.id, connector->base.name, ret); - return ret; - } - } - - if (panel->backlight.edp.vesa.info.aux_set) { - panel->backlight.max = panel->backlight.edp.vesa.info.max; - panel->backlight.min = 0; - if (current_mode == DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD) { - panel->backlight.level = current_level; - panel->backlight.enabled = panel->backlight.level != 0; + if (panel->backlight.edp.vesa.luminance_control_support) { + if (luminance_range->max_luminance) { + panel->backlight.max = luminance_range->max_luminance; + panel->backlight.min = luminance_range->min_luminance; } else { - panel->backlight.level = panel->backlight.max; - panel->backlight.enabled = false; + panel->backlight.max = 512; + panel->backlight.min = 0; } + panel->backlight.level = intel_dp_aux_vesa_get_backlight(connector, 0); + panel->backlight.enabled = panel->backlight.level != 0; + drm_dbg_kms(display->drm, + "[CONNECTOR:%d:%s] AUX VESA Nits backlight level is controlled through DPCD\n", + connector->base.base.id, connector->base.name); } else { - panel->backlight.max = panel->backlight.pwm_level_max; - panel->backlight.min = panel->backlight.pwm_level_min; - if (current_mode == DP_EDP_BACKLIGHT_CONTROL_MODE_PWM) { - panel->backlight.level = panel->backlight.pwm_funcs->get(connector, pipe); - panel->backlight.enabled = panel->backlight.pwm_enabled; + ret = drm_edp_backlight_init(&intel_dp->aux, &panel->backlight.edp.vesa.info, + panel->vbt.backlight.pwm_freq_hz, intel_dp->edp_dpcd, + ¤t_level, ¤t_mode); + if (ret < 0) + return ret; + + drm_dbg_kms(display->drm, + "[CONNECTOR:%d:%s] AUX VESA backlight enable is controlled through %s\n", + connector->base.base.id, connector->base.name, + dpcd_vs_pwm_str(panel->backlight.edp.vesa.info.aux_enable)); + drm_dbg_kms(display->drm, + "[CONNECTOR:%d:%s] AUX VESA backlight level is controlled through %s\n", + connector->base.base.id, connector->base.name, + dpcd_vs_pwm_str(panel->backlight.edp.vesa.info.aux_set)); + + if (!panel->backlight.edp.vesa.info.aux_set || + !panel->backlight.edp.vesa.info.aux_enable) { + ret = panel->backlight.pwm_funcs->setup(connector, pipe); + if (ret < 0) { + drm_err(display->drm, + "[CONNECTOR:%d:%s] Failed to setup PWM backlight controls for eDP backlight: %d\n", + connector->base.base.id, connector->base.name, ret); + return ret; + } + } + + if (panel->backlight.edp.vesa.info.aux_set) { + panel->backlight.max = panel->backlight.edp.vesa.info.max; + panel->backlight.min = 0; + if (current_mode == DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD) { + panel->backlight.level = current_level; + panel->backlight.enabled = panel->backlight.level != 0; + } else { + panel->backlight.level = panel->backlight.max; + panel->backlight.enabled = false; + } } else { - panel->backlight.level = panel->backlight.max; - panel->backlight.enabled = false; + panel->backlight.max = panel->backlight.pwm_level_max; + panel->backlight.min = panel->backlight.pwm_level_min; + if (current_mode == DP_EDP_BACKLIGHT_CONTROL_MODE_PWM) { + panel->backlight.level = + panel->backlight.pwm_funcs->get(connector, pipe); + panel->backlight.enabled = panel->backlight.pwm_enabled; + } else { + panel->backlight.level = panel->backlight.max; + panel->backlight.enabled = false; + } } } From patchwork Thu Feb 6 06:32:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13962298 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 73DFEC02196 for ; Thu, 6 Feb 2025 06:33:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1DF5E10E16A; Thu, 6 Feb 2025 06:33:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="ZSle7xEu"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 09DB810E433; Thu, 6 Feb 2025 06:33:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738823608; x=1770359608; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O6PuGKSHAthZisdBIs/lDbKe14sxSue+Xnm+my2xrhQ=; b=ZSle7xEuHuhYvz4HWmTN+aMIWfF2JQDSlRr5DKQ/CR5PA4MJamA+SCcY VWHSlXxroS9Pj6wzKVUzyOINHt2boAP0kDpaNvjsw6QRBTQT2ZhHQg4/8 nL6LMyC1/nQcPWKZDoD0yQukeOpTL0J1Y7yCIHOyhH/1RbuBwtyS9pRdH 109qn8llA3fmrMzSpNCg1MIX8U8do/1psAvpMyjICCUri15uo3EAVxucv awuaWdoXzq/bTMHhlJ4e73uaJFHdppizwTWmIuB7rEfdiKAeiEFjjVL/L ASf+LnT+bOtxpExD2kxYeoWT42q1iRU+r0OYu1nwSEGLoAYayQpVEABwH g==; X-CSE-ConnectionGUID: h0qLuRXsQDm1o6i2zL9c2A== X-CSE-MsgGUID: gfZw2vj9StiyPsP4bc4ZDQ== X-IronPort-AV: E=McAfee;i="6700,10204,11336"; a="27014247" X-IronPort-AV: E=Sophos;i="6.13,263,1732608000"; d="scan'208";a="27014247" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2025 22:33:27 -0800 X-CSE-ConnectionGUID: Slkca4QWTpa5kjniMaA4ew== X-CSE-MsgGUID: BqGJwwjvQOKo6/LQcr38Gg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="112013757" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.10]) by orviesa008.jf.intel.com with ESMTP; 05 Feb 2025 22:33:26 -0800 From: Suraj Kandpal To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: uma.shankar@intel.com, arun.r.murthy@intel.com, ben.kao@intel.com, Suraj Kandpal Subject: [PATCH 8/8] drm/i915/backlight: Enable nits based luminance Date: Thu, 6 Feb 2025 12:02:53 +0530 Message-Id: <20250206063253.2827017-9-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250206063253.2827017-1-suraj.kandpal@intel.com> References: <20250206063253.2827017-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Enable nits based luminance by writing the PANEL_LUMINANCE_CONTROL bit and set the correct register to change brightness. Signed-off-by: Suraj Kandpal Tested-by: Ben Kao Reviewed-by: Arun R Murthy --- .../gpu/drm/i915/display/intel_dp_aux_backlight.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c index 301a4dfdfbe5..f53c8355d5be 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c @@ -527,6 +527,18 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state, struct intel_connector *connector = to_intel_connector(conn_state->connector); struct intel_panel *panel = &connector->panel; struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder); + int ret; + + if (panel->backlight.edp.vesa.luminance_control_support) { + ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, + DP_EDP_PANEL_LUMINANCE_CONTROL_ENABLE); + + if (ret == 1) + return; + + if (!intel_dp_aux_vesa_set_luminance(connector, level)) + return; + } if (!panel->backlight.edp.vesa.info.aux_enable) { u32 pwm_level; @@ -550,6 +562,9 @@ static void intel_dp_aux_vesa_disable_backlight(const struct drm_connector_state struct intel_panel *panel = &connector->panel; struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder); + if (panel->backlight.edp.vesa.luminance_control_support) + return; + drm_edp_backlight_disable(&intel_dp->aux, &panel->backlight.edp.vesa.info); if (!panel->backlight.edp.vesa.info.aux_enable)