Commit 84d3d71f authored by Lee Shawn C's avatar Lee Shawn C Committed by Vandita Kulkarni

drm/i915/dsi: Retrieve max brightness level from VBT

So far, DCS backlight driver hardcode (0xFF) for max brightness level.
MIPI DCS spec allow max 0xFFFF for set_display_brightness (51h) command.
And VBT brightness precision bits can support 8 ~ 16 bits.

We should set correct precision bits in VBT that meet panel's request.
Driver can refer to this setting then configure max brightness level
in DCS backlight driver properly.

v2: modify variable name brightness_precision_bits instead of
    max_brightness_level.
v3: fix checkpatch warning.

Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Vandita Kulkarni <vandita.kulkarni@intel.com>
Cc: Cooper Chiou <cooper.chiou@intel.com>
Cc: William Tseng <william.tseng@intel.com>
Signed-off-by: default avatarLee Shawn C <shawn.c.lee@intel.com>
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarVandita Kulkarni <vandita.kulkarni@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210908115607.9633-5-shawn.c.lee@intel.com
parent fe01883f
...@@ -483,6 +483,9 @@ parse_lfp_backlight(struct drm_i915_private *i915, ...@@ -483,6 +483,9 @@ parse_lfp_backlight(struct drm_i915_private *i915,
level = 255; level = 255;
} }
i915->vbt.backlight.min_brightness = min_level; i915->vbt.backlight.min_brightness = min_level;
i915->vbt.backlight.brightness_precision_bits =
backlight_data->brightness_precision_bits[panel_type];
} else { } else {
level = backlight_data->level[panel_type]; level = backlight_data->level[panel_type];
i915->vbt.backlight.min_brightness = entry->min_brightness; i915->vbt.backlight.min_brightness = entry->min_brightness;
......
...@@ -147,10 +147,16 @@ static void dcs_enable_backlight(const struct intel_crtc_state *crtc_state, ...@@ -147,10 +147,16 @@ static void dcs_enable_backlight(const struct intel_crtc_state *crtc_state,
static int dcs_setup_backlight(struct intel_connector *connector, static int dcs_setup_backlight(struct intel_connector *connector,
enum pipe unused) enum pipe unused)
{ {
struct drm_device *dev = connector->base.dev;
struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_panel *panel = &connector->panel; struct intel_panel *panel = &connector->panel;
if (dev_priv->vbt.backlight.brightness_precision_bits > 8)
panel->backlight.max = (1 << dev_priv->vbt.backlight.brightness_precision_bits) - 1;
else
panel->backlight.max = PANEL_PWM_MAX_VALUE; panel->backlight.max = PANEL_PWM_MAX_VALUE;
panel->backlight.level = PANEL_PWM_MAX_VALUE;
panel->backlight.level = panel->backlight.max;
return 0; return 0;
} }
......
...@@ -689,6 +689,7 @@ struct intel_vbt_data { ...@@ -689,6 +689,7 @@ struct intel_vbt_data {
struct { struct {
u16 pwm_freq_hz; u16 pwm_freq_hz;
u16 brightness_precision_bits;
bool present; bool present;
bool active_low_pwm; bool active_low_pwm;
u8 min_brightness; /* min_brightness/255 of max */ u8 min_brightness; /* min_brightness/255 of max */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment