drm/i915/dp: Tweak initial dpcd backlight.enabled value
In commit7994672309
("drm/i915: Assume 100% brightness when not in DPCD control mode"), we fixed the brightness level when DPCD control was not active to max brightness. This is as good as we can guess since most backlights go on full when uncontrolled. However in doing so we changed the semantics of the initial 'backlight.enabled' value. At least on Pixelbooks, they were relying on the brightness level in DP_EDP_BACKLIGHT_BRIGHTNESS_MSB to be 0 on boot such that enabled would be false. This causes the device to be enabled when the brightness is set. Without this, brightness control doesn't work. So by changing brightness to max, we also flipped enabled to be true on boot. To fix this, make enabled a function of brightness and backlight control mechanism. Fixes:7994672309
("drm/i915: Assume 100% brightness when not in DPCD control mode") Cc: Lyude Paul <lyude@redhat.com> Cc: Jani Nikula <jani.nikula@intel.com> Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Kevin Chowski <chowski@chromium.org>> Signed-off-by: Sean Paul <seanpaul@chromium.org> Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200918002845.32766-1-sean@poorly.run (cherry picked from commit4ade8f31c2
) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
Родитель
214bba5061
Коммит
354842df38
|
@ -52,6 +52,25 @@ static void set_aux_backlight_enable(struct intel_dp *intel_dp, bool enable)
|
|||
}
|
||||
}
|
||||
|
||||
static bool intel_dp_aux_backlight_dpcd_mode(struct intel_connector *connector)
|
||||
{
|
||||
struct intel_dp *intel_dp = intel_attached_dp(connector);
|
||||
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
|
||||
u8 mode_reg;
|
||||
|
||||
if (drm_dp_dpcd_readb(&intel_dp->aux,
|
||||
DP_EDP_BACKLIGHT_MODE_SET_REGISTER,
|
||||
&mode_reg) != 1) {
|
||||
drm_dbg_kms(&i915->drm,
|
||||
"Failed to read the DPCD register 0x%x\n",
|
||||
DP_EDP_BACKLIGHT_MODE_SET_REGISTER);
|
||||
return false;
|
||||
}
|
||||
|
||||
return (mode_reg & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) ==
|
||||
DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the current backlight value from DPCD register(s) based
|
||||
* on if 8-bit(MSB) or 16-bit(MSB and LSB) values are supported
|
||||
|
@ -61,24 +80,13 @@ static u32 intel_dp_aux_get_backlight(struct intel_connector *connector)
|
|||
struct intel_dp *intel_dp = intel_attached_dp(connector);
|
||||
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
|
||||
u8 read_val[2] = { 0x0 };
|
||||
u8 mode_reg;
|
||||
u16 level = 0;
|
||||
|
||||
if (drm_dp_dpcd_readb(&intel_dp->aux,
|
||||
DP_EDP_BACKLIGHT_MODE_SET_REGISTER,
|
||||
&mode_reg) != 1) {
|
||||
drm_dbg_kms(&i915->drm,
|
||||
"Failed to read the DPCD register 0x%x\n",
|
||||
DP_EDP_BACKLIGHT_MODE_SET_REGISTER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we're not in DPCD control mode yet, the programmed brightness
|
||||
* value is meaningless and we should assume max brightness
|
||||
*/
|
||||
if ((mode_reg & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) !=
|
||||
DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD)
|
||||
if (!intel_dp_aux_backlight_dpcd_mode(connector))
|
||||
return connector->panel.backlight.max;
|
||||
|
||||
if (drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_BACKLIGHT_BRIGHTNESS_MSB,
|
||||
|
@ -319,7 +327,8 @@ static int intel_dp_aux_setup_backlight(struct intel_connector *connector,
|
|||
|
||||
panel->backlight.min = 0;
|
||||
panel->backlight.level = intel_dp_aux_get_backlight(connector);
|
||||
panel->backlight.enabled = panel->backlight.level != 0;
|
||||
panel->backlight.enabled = intel_dp_aux_backlight_dpcd_mode(connector) &&
|
||||
panel->backlight.level != 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче