Skip to content

Commit 61e29a0

Browse files
Lyuderodrigovivi
authored andcommitted
drm/i915: Add support for panels with VESA backlights with PWM enable/disable
This simply adds proper support for panel backlights that can be controlled via VESA's backlight control protocol, but which also require that we enable and disable the backlight via PWM instead of via the DPCD interface. We also enable this by default, in order to fix some people's backlights that were broken by not having this enabled. For reference, backlights that require this and use VESA's backlight interface tend to be laptops with hybrid GPUs, but this very well may change in the future. v4: * Make sure that we call intel_backlight_level_to_pwm() in intel_dp_aux_vesa_enable_backlight() - vsyrjala Signed-off-by: Lyude Paul <[email protected]> Link: https://gitlab.freedesktop.org/drm/intel/-/issues/3680 Fixes: fe7d52b ("drm/i915/dp: Don't use DPCD backlights that need PWM enable/disable") Reviewed-by: Ville Syrjälä <[email protected]> Cc: <[email protected]> # v5.12+ Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 04f0d6c) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent d58071a commit 61e29a0

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,13 @@ intel_dp_aux_vesa_enable_backlight(const struct intel_crtc_state *crtc_state,
293293
struct intel_panel *panel = &connector->panel;
294294
struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder);
295295

296+
if (!panel->backlight.edp.vesa.info.aux_enable) {
297+
u32 pwm_level = intel_backlight_invert_pwm_level(connector,
298+
panel->backlight.pwm_level_max);
299+
300+
panel->backlight.pwm_funcs->enable(crtc_state, conn_state, pwm_level);
301+
}
302+
296303
drm_edp_backlight_enable(&intel_dp->aux, &panel->backlight.edp.vesa.info, level);
297304
}
298305

@@ -304,6 +311,10 @@ static void intel_dp_aux_vesa_disable_backlight(const struct drm_connector_state
304311
struct intel_dp *intel_dp = enc_to_intel_dp(connector->encoder);
305312

306313
drm_edp_backlight_disable(&intel_dp->aux, &panel->backlight.edp.vesa.info);
314+
315+
if (!panel->backlight.edp.vesa.info.aux_enable)
316+
panel->backlight.pwm_funcs->disable(old_conn_state,
317+
intel_backlight_invert_pwm_level(connector, 0));
307318
}
308319

309320
static int intel_dp_aux_vesa_setup_backlight(struct intel_connector *connector, enum pipe pipe)
@@ -321,6 +332,15 @@ static int intel_dp_aux_vesa_setup_backlight(struct intel_connector *connector,
321332
if (ret < 0)
322333
return ret;
323334

335+
if (!panel->backlight.edp.vesa.info.aux_enable) {
336+
ret = panel->backlight.pwm_funcs->setup(connector, pipe);
337+
if (ret < 0) {
338+
drm_err(&i915->drm,
339+
"Failed to setup PWM backlight controls for eDP backlight: %d\n",
340+
ret);
341+
return ret;
342+
}
343+
}
324344
panel->backlight.max = panel->backlight.edp.vesa.info.max;
325345
panel->backlight.min = 0;
326346
if (current_mode == DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD) {
@@ -340,12 +360,7 @@ intel_dp_aux_supports_vesa_backlight(struct intel_connector *connector)
340360
struct intel_dp *intel_dp = intel_attached_dp(connector);
341361
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
342362

343-
/* TODO: We currently only support AUX only backlight configurations, not backlights which
344-
* require a mix of PWM and AUX controls to work. In the mean time, these machines typically
345-
* work just fine using normal PWM controls anyway.
346-
*/
347-
if ((intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) &&
348-
drm_edp_backlight_supported(intel_dp->edp_dpcd)) {
363+
if (drm_edp_backlight_supported(intel_dp->edp_dpcd)) {
349364
drm_dbg_kms(&i915->drm, "AUX Backlight Control Supported!\n");
350365
return true;
351366
}

0 commit comments

Comments
 (0)