diff options
author | 2025-02-06 12:02:51 +0530 | |
---|---|---|
committer | 2025-02-06 22:14:42 +0530 | |
commit | b68074efcfcf7d8226ddb0b1326298671a04a3f7 (patch) | |
tree | b9d9bdea1518d934048fa9358021cb3b79c9f915 | |
parent | drm/i915/backlight: Modify function to get VESA brightness in Nits (diff) | |
download | wireguard-linux-b68074efcfcf7d8226ddb0b1326298671a04a3f7.tar.xz wireguard-linux-b68074efcfcf7d8226ddb0b1326298671a04a3f7.zip |
drm/i915/backlight: Add function to change brightness in nits for VESA
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 <suraj.kandpal@intel.com>
Tested-by: Ben Kao <ben.kao@intel.com>
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250206063253.2827017-7-suraj.kandpal@intel.com
-rw-r--r-- | drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c | 30 |
1 files changed, 30 insertions, 0 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 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); |