diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_dp_aux_backlight.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 87 |
1 files changed, 3 insertions, 84 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c index b25cd88fc1c5..d2830ba3162e 100644 --- a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c @@ -173,24 +173,6 @@ static bool intel_dp_aux_set_pwm_freq(struct intel_connector *connector) return true; } -/* -* Set minimum / maximum dynamic brightness percentage. This value is expressed -* as the percentage of normal brightness in 5% increments. -*/ -static bool -intel_dp_aux_set_dynamic_backlight_percent(struct intel_dp *intel_dp, - u32 min, u32 max) -{ - u8 dbc[] = { DIV_ROUND_CLOSEST(min, 5), DIV_ROUND_CLOSEST(max, 5) }; - - if (drm_dp_dpcd_write(&intel_dp->aux, DP_EDP_DBC_MINIMUM_BRIGHTNESS_SET, - dbc, sizeof(dbc)) < 0) { - DRM_DEBUG_KMS("Failed to write aux DBC brightness level\n"); - return false; - } - return true; -} - static void intel_dp_aux_enable_backlight(const struct intel_crtc_state *crtc_state, const struct drm_connector_state *conn_state) { @@ -226,14 +208,6 @@ static void intel_dp_aux_enable_backlight(const struct intel_crtc_state *crtc_st if (intel_dp_aux_set_pwm_freq(connector)) new_dpcd_buf |= DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE; - if (i915.enable_dbc && - (intel_dp->edp_dpcd[2] & DP_EDP_DYNAMIC_BACKLIGHT_CAP)) { - if(intel_dp_aux_set_dynamic_backlight_percent(intel_dp, 0, 100)) { - new_dpcd_buf |= DP_EDP_DYNAMIC_BACKLIGHT_ENABLE; - DRM_DEBUG_KMS("Enable dynamic brightness.\n"); - } - } - if (new_dpcd_buf != dpcd_buf) { if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, new_dpcd_buf) < 0) { @@ -277,66 +251,15 @@ intel_dp_aux_display_control_capable(struct intel_connector *connector) /* Check the eDP Display control capabilities registers to determine if * the panel can support backlight control over the aux channel */ - if ((intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP) && - (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP)) { + if (intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP && + (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP) && + !(intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP)) { DRM_DEBUG_KMS("AUX Backlight Control Supported!\n"); return true; } return false; } -/* - * Heuristic function whether we should use AUX for backlight adjustment or not. - * - * We should use AUX for backlight brightness adjustment if panel doesn't this - * via PWM pin or using AUX is better than using PWM pin. - * - * The heuristic to determine that using AUX pin is better than using PWM pin is - * that the panel support any of the feature list here. - * - Regional backlight brightness adjustment - * - Backlight PWM frequency set - * - More than 8 bits resolution of brightness level - * - Backlight enablement via AUX and not by BL_ENABLE pin - * - * If all above are not true, assume that using PWM pin is better. - */ -static bool -intel_dp_aux_display_control_heuristic(struct intel_connector *connector) -{ - struct intel_dp *intel_dp = enc_to_intel_dp(&connector->encoder->base); - uint8_t reg_val; - - /* Panel doesn't support adjusting backlight brightness via PWN pin */ - if (!(intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP)) - return true; - - /* Panel supports regional backlight brightness adjustment */ - if (drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_GENERAL_CAP_3, - ®_val) != 1) { - DRM_DEBUG_KMS("Failed to read DPCD register 0x%x\n", - DP_EDP_GENERAL_CAP_3); - return false; - } - if (reg_val > 0) - return true; - - /* Panel supports backlight PWM frequency set */ - if (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP) - return true; - - /* Panel supports more than 8 bits resolution of brightness level */ - if (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT) - return true; - - /* Panel supports enabling backlight via AUX but not by BL_ENABLE pin */ - if ((intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) && - !(intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_PIN_ENABLE_CAP)) - return true; - - return false; - -} - int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector) { struct intel_panel *panel = &intel_connector->panel; @@ -347,10 +270,6 @@ int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector) if (!intel_dp_aux_display_control_capable(intel_connector)) return -ENODEV; - if (i915.enable_dpcd_backlight == -1 && - !intel_dp_aux_display_control_heuristic(intel_connector)) - return -ENODEV; - panel->backlight.setup = intel_dp_aux_setup_backlight; panel->backlight.enable = intel_dp_aux_enable_backlight; panel->backlight.disable = intel_dp_aux_disable_backlight; |