On Tue, 29 Mar 2016, "Deepak, M" <m.dee...@intel.com> wrote: >> -----Original Message----- >> From: Nikula, Jani >> Sent: Tuesday, March 29, 2016 8:31 PM >> To: intel-gfx@lists.freedesktop.org; Deepak, M <m.dee...@intel.com> >> Cc: Nikula, Jani <jani.nik...@intel.com> >> Subject: [PATCH 3/5] drm/i915: Parse LFP brightness control field in VBT >> >> From: Deepak M <m.dee...@intel.com> >> >> These fields in VBT indicates the PWM source which is used and also the >> controller number. >> >> v2 by Jani: check for out of bounds access, some renames, change default >> type, etc. >> >> Signed-off-by: Deepak M <m.dee...@intel.com> >> Signed-off-by: Jani Nikula <jani.nik...@intel.com> >> --- >> drivers/gpu/drm/i915/i915_drv.h | 1 + >> drivers/gpu/drm/i915/intel_bios.c | 9 +++++++++ >> drivers/gpu/drm/i915/intel_bios.h | 8 ++++++++ >> drivers/gpu/drm/i915/intel_vbt_defs.h | 6 ++++++ >> 4 files changed, 24 insertions(+) >> >> diff --git a/drivers/gpu/drm/i915/i915_drv.h >> b/drivers/gpu/drm/i915/i915_drv.h index 0906dfd7b1a9..4a76b7b2dbd9 >> 100644 >> --- a/drivers/gpu/drm/i915/i915_drv.h >> +++ b/drivers/gpu/drm/i915/i915_drv.h >> @@ -1472,6 +1472,7 @@ struct intel_vbt_data { >> bool present; >> bool active_low_pwm; >> u8 min_brightness; /* min_brightness/255 of max */ >> + enum intel_backlight_type type; >> } backlight; >> >> /* MIPI DSI */ >> diff --git a/drivers/gpu/drm/i915/intel_bios.c >> b/drivers/gpu/drm/i915/intel_bios.c >> index 6985519921b4..2f639820aded 100644 >> --- a/drivers/gpu/drm/i915/intel_bios.c >> +++ b/drivers/gpu/drm/i915/intel_bios.c >> @@ -304,6 +304,15 @@ parse_lfp_backlight(struct drm_i915_private >> *dev_priv, >> return; >> } >> >> + dev_priv->vbt.backlight.type = INTEL_BACKLIGHT_DISPLAY_DDI; >> + if (bdb->version >= 191 && >> + get_blocksize(backlight_data) >= sizeof(*backlight_data)) { >> + const struct bdb_lfp_backlight_control_method *method; >> + >> + method = &backlight_data->backlight_control[panel_type]; >> + dev_priv->vbt.backlight.type = method->type; >> + } >> + >> dev_priv->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz; >> dev_priv->vbt.backlight.active_low_pwm = entry- >> >active_low_pwm; >> dev_priv->vbt.backlight.min_brightness = entry->min_brightness; >> diff --git a/drivers/gpu/drm/i915/intel_bios.h >> b/drivers/gpu/drm/i915/intel_bios.h >> index 149c3226e895..df6ce3e3d26f 100644 >> --- a/drivers/gpu/drm/i915/intel_bios.h >> +++ b/drivers/gpu/drm/i915/intel_bios.h >> @@ -30,6 +30,14 @@ >> #ifndef _INTEL_BIOS_H_ >> #define _INTEL_BIOS_H_ >> >> +enum intel_backlight_type { >> + INTEL_BACKLIGHT_PMIC, >> + INTEL_BACKLIGHT_LPSS, >> + INTEL_BACKLIGHT_DISPLAY_DDI, >> + INTEL_BACKLIGHT_CABC, > [Deepak, M] Better to rename CABC to PANEL_PWM, because CABC is not > the source of the PWM. There may be some panel which have the panel > PWM but may not support CABC.
How about INTEL_BACKLIGHT_DSI_DCS? The panel need not have PWM. Really, the panel need not have backlight either for panel brightness control (see OLED), but in this case I'd just conflate that into "backlight" as well. BR, Jani. >> + INTEL_BACKLIGHT_PANEL_DRIVER_INTERFACE, >> +}; >> + >> struct edp_power_seq { >> u16 t1_t3; >> u16 t8; >> diff --git a/drivers/gpu/drm/i915/intel_vbt_defs.h >> b/drivers/gpu/drm/i915/intel_vbt_defs.h >> index 749dceab7c02..2191076c3ff6 100644 >> --- a/drivers/gpu/drm/i915/intel_vbt_defs.h >> +++ b/drivers/gpu/drm/i915/intel_vbt_defs.h >> @@ -440,10 +440,16 @@ struct bdb_lfp_backlight_data_entry { >> u8 obsolete3; >> } __packed; >> >> +struct bdb_lfp_backlight_control_method { >> + u8 type:4; >> + u8 controller:4; >> +} __packed; >> + >> struct bdb_lfp_backlight_data { >> u8 entry_size; >> struct bdb_lfp_backlight_data_entry data[16]; >> u8 level[16]; >> + struct bdb_lfp_backlight_control_method backlight_control[16]; >> } __packed; >> >> struct aimdb_header { >> -- >> 2.1.4 > -- Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx