From: Suraj Kandpal <suraj.kandpal@intel.com>
To: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: ankit.k.nautiyal@intel.com, arun.r.murthy@intel.com,
Suraj Kandpal <suraj.kandpal@intel.com>
Subject: [PATCH 06/13] drm/dp: Modify drm_edp_probe_state
Date: Fri, 11 Apr 2025 09:59:02 +0530 [thread overview]
Message-ID: <20250411042909.2626807-7-suraj.kandpal@intel.com> (raw)
In-Reply-To: <20250411042909.2626807-1-suraj.kandpal@intel.com>
Modify drm_edp_probe_state to read current level from
DP_EDP_PANEL_TARGET_LUMINANCE_VALUE. We divide it by
1000 since the value in this register is in millinits.
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
---
drivers/gpu/drm/display/drm_dp_helper.c | 35 ++++++++++++++++++-------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
index c58973d8c5f0..bb1242a1bf6b 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -4185,7 +4185,7 @@ drm_edp_backlight_probe_state(struct drm_dp_aux *aux, struct drm_edp_backlight_i
u8 *current_mode)
{
int ret;
- u8 buf[2];
+ u8 buf[3];
u8 mode_reg;
ret = drm_dp_dpcd_read_byte(aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, &mode_reg);
@@ -4202,17 +4202,32 @@ drm_edp_backlight_probe_state(struct drm_dp_aux *aux, struct drm_edp_backlight_i
if (*current_mode == DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD) {
int size = 1 + bl->lsb_reg_used;
- ret = drm_dp_dpcd_read_data(aux, DP_EDP_BACKLIGHT_BRIGHTNESS_MSB, buf, size);
- if (ret < 0) {
- drm_dbg_kms(aux->drm_dev, "%s: Failed to read backlight level: %d\n",
- aux->name, ret);
- return ret;
+ if (bl->luminance_set) {
+ ret = drm_dp_dpcd_read_data(aux, DP_EDP_PANEL_TARGET_LUMINANCE_VALUE,
+ buf, sizeof(buf));
+ if (ret < 0) {
+ drm_dbg_kms(aux->drm_dev,
+ "%s: Failed to read backlight level: %d\n",
+ aux->name, ret);
+ return ret;
}
- if (bl->lsb_reg_used)
- return (buf[0] << 8) | buf[1];
- else
- return buf[0];
+ return (buf[0] | buf[1] << 8 | buf[2] << 16) / 1000;
+ } else {
+ ret = drm_dp_dpcd_read_data(aux, DP_EDP_BACKLIGHT_BRIGHTNESS_MSB,
+ buf, size);
+ if (ret < 0) {
+ drm_dbg_kms(aux->drm_dev,
+ "%s: Failed to read backlight level: %d\n",
+ aux->name, ret);
+ return ret;
+ }
+
+ if (bl->lsb_reg_used)
+ return (buf[0] << 8) | buf[1];
+ else
+ return buf[0];
+ }
}
/*
--
2.34.1
next prev parent reply other threads:[~2025-04-11 4:29 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 4:28 [PATCH 00/13] Modify drm helpers to use luminance Suraj Kandpal
2025-04-11 4:28 ` [PATCH 01/13] drm/dp: Introduce new member in drm_backlight_info Suraj Kandpal
2025-04-11 4:28 ` [PATCH 02/13] drm/dp: Add argument in drm_edp_backlight_init Suraj Kandpal
2025-04-11 4:28 ` [PATCH 03/13] drm/dp: Add argument for luminance range info " Suraj Kandpal
2025-04-11 4:29 ` [PATCH 04/13] drm/dp: Move from u16 to u32 for max in drm_edp_backlight_info Suraj Kandpal
2025-04-11 4:29 ` [PATCH 05/13] drm/dp: Change current_level argument type to u32 Suraj Kandpal
2025-04-11 4:29 ` Suraj Kandpal [this message]
2025-04-11 4:29 ` [PATCH 07/13] drm/dp: Change argument type for drm_edp_backlight_set_level Suraj Kandpal
2025-04-11 10:39 ` Jani Nikula
2025-04-14 4:16 ` Kandpal, Suraj
2025-04-11 4:29 ` [PATCH 08/13] drm/dp: Modify drm_edp_backlight_set_level Suraj Kandpal
2025-04-11 4:29 ` [PATCH 09/13] drm/dp: Change argument type of drm_edp_backlight_enable Suraj Kandpal
2025-04-11 4:29 ` [PATCH 10/13] drm/dp: Enable backlight control using luminance Suraj Kandpal
2025-04-11 4:29 ` [PATCH 11/13] drm/i915/backlight: Use drm helper to initialize edp backlight Suraj Kandpal
2025-04-11 4:29 ` [PATCH 12/13] drm/i915/backlight: Use drm helper to set " Suraj Kandpal
2025-04-11 4:29 ` [PATCH 13/13] drm/i915/backlight: Use drm_edp_backlight_enable Suraj Kandpal
2025-04-11 4:36 ` ✓ CI.Patch_applied: success for Modify drm helpers to use luminance Patchwork
2025-04-11 4:36 ` ✓ CI.checkpatch: " Patchwork
2025-04-11 4:37 ` ✓ CI.KUnit: " Patchwork
2025-04-11 4:46 ` ✓ CI.Build: " Patchwork
2025-04-11 4:48 ` ✓ CI.Hooks: " Patchwork
2025-04-11 4:49 ` ✗ CI.checksparse: warning " Patchwork
2025-04-11 5:35 ` ✓ Xe.CI.BAT: success " Patchwork
2025-04-11 8:12 ` ✗ Xe.CI.Full: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2025-04-14 4:16 [PATCH 00/13] " Suraj Kandpal
2025-04-14 4:16 ` [PATCH 06/13] drm/dp: Modify drm_edp_probe_state Suraj Kandpal
2025-05-07 12:08 ` kernel test robot
2025-06-20 4:34 ` Murthy, Arun R
2025-05-09 5:18 [PATCH 00/13] Modify drm helpers to use luminance Suraj Kandpal
2025-05-09 5:18 ` [PATCH 06/13] drm/dp: Modify drm_edp_probe_state Suraj Kandpal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250411042909.2626807-7-suraj.kandpal@intel.com \
--to=suraj.kandpal@intel.com \
--cc=ankit.k.nautiyal@intel.com \
--cc=arun.r.murthy@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=nouveau@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox