[Intel-gfx] [PATCH 5/6] drm/i915: parse backlight modulation frequency from the BIOS VBT
Rodrigo Vivi
rodrigo.vivi at gmail.com
Fri Dec 6 13:45:05 CET 2013
Hi Jani,
On Mon, Dec 2, 2013 at 11:26 AM, Rodrigo Vivi <rodrigo.vivi at gmail.com> wrote:
> From: Jani Nikula <jani.nikula at intel.com>
>
> We don't actually do anything with the information yet, but parse and
> log what's in the VBT.
>
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi at gmail.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 5 +++++
> drivers/gpu/drm/i915/intel_bios.c | 29 +++++++++++++++++++++++++++++
> drivers/gpu/drm/i915/intel_bios.h | 16 ++++++++++++++++
> 3 files changed, 50 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 780f815..687eee2 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1185,6 +1185,11 @@ struct intel_vbt_data {
> int edp_bpp;
> struct edp_power_seq edp_pps;
>
> + struct {
> + u16 pwm_freq_hz;
> + bool active_low_pwm;
> + } backlight;
> +
> /* MIPI DSI */
> struct {
> u16 panel_id;
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index e4fba39..720ce55 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -281,6 +281,34 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
> }
> }
>
> +static void
> +parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
> +{
> + const struct bdb_lfp_backlight_data *backlight_data;
> + const struct bdb_lfp_backlight_data_entry *entry;
> +
> + backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT);
> + if (!backlight_data)
> + return;
> +
> + if (backlight_data->entry_size != sizeof(backlight_data->data[0])) {
> + DRM_DEBUG_KMS("Unsupported backlight data entry size %u\n",
> + backlight_data->entry_size);
> + return;
> + }
> +
> + entry = &backlight_data->data[panel_type];
> +
> + dev_priv->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz;
> + dev_priv->vbt.backlight.active_low_pwm = entry->active_low_pwm;
> + DRM_DEBUG_KMS("VBT backlight PWM modulation frequency %u Hz, "
> + "active %s, min brightness %u, level %u\n",
> + dev_priv->vbt.backlight.pwm_freq_hz,
> + dev_priv->vbt.backlight.active_low_pwm ? "low" : "high",
> + entry->min_brightness,
> + backlight_data->level[panel_type]);
> +}
> +
> /* Try to find sdvo panel data */
> static void
> parse_sdvo_panel_data(struct drm_i915_private *dev_priv,
> @@ -894,6 +922,7 @@ intel_parse_bios(struct drm_device *dev)
> parse_general_features(dev_priv, bdb);
> parse_general_definitions(dev_priv, bdb);
> parse_lfp_panel_data(dev_priv, bdb);
> + parse_lfp_backlight(dev_priv, bdb);
> parse_sdvo_panel_data(dev_priv, bdb);
> parse_sdvo_device_mapping(dev_priv, bdb);
> parse_device_mapping(dev_priv, bdb);
> diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
> index 81ed58c..282de5e 100644
> --- a/drivers/gpu/drm/i915/intel_bios.h
> +++ b/drivers/gpu/drm/i915/intel_bios.h
> @@ -373,6 +373,22 @@ struct bdb_lvds_lfp_data {
> struct bdb_lvds_lfp_data_entry data[16];
> } __packed;
>
> +struct bdb_lfp_backlight_data_entry {
> + u8 type:2;
> + u8 active_low_pwm:1;
I'd prefer inverted_polarity for this bit.
> + u8 obsolete1:5;
> + u16 pwm_freq_hz;
> + u8 min_brightness;
> + u8 obsolete2;
> + u8 obsolete3;
> +} __packed;
> +
> +struct bdb_lfp_backlight_data {
> + u8 entry_size;
> + struct bdb_lfp_backlight_data_entry data[16];
> + u8 level[16];
> +} __packed;
> +
> struct aimdb_header {
> char signature[16];
> char oem_device[20];
> --
> 1.8.3.1
>
with or without my bikeshed,
Reviewed-by: Rodrigo Vivi <rodrigo.vivi at gmail.com>
--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
More information about the Intel-gfx
mailing list