[PATCH 0/3][SRU][OEM-5.10] backlight parsing for VBT 234+

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/3][SRU][OEM-5.10] backlight parsing for VBT 234+

AceLan Kao
From: "Chia-Lin Kao (AceLan)" <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1912157

[Impact]
Current driver fails to parse VBT 234+ and gets wrong brightness levels.
It leads to screen dim completely when brightness is set to lowest.

[Fix]
We need the commits to parse VBT 234+
https://patchwork.freedesktop.org/patch/394304/

[Test]
Verified on Dell machines

[Where problems could occur]
The patches are simple and with a separate flow control for VBT 234,
should have no impact for current brightness control.

José Roberto de Souza (3):
  drm/i915/vbt: Fix backlight parsing for VBT 234+
  drm/i915/vbt: Update the version and expected size of
    BDB_GENERAL_DEFINITIONS map
  drm/i915/vbt: Add VRR VBT toggle

 drivers/gpu/drm/i915/display/intel_bios.c     | 32 +++++++++++++++++--
 drivers/gpu/drm/i915/display/intel_vbt_defs.h | 13 ++++++--
 2 files changed, 40 insertions(+), 5 deletions(-)

--
2.25.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/3][SRU][OEM-5.10] drm/i915/vbt: Fix backlight parsing for VBT 234+

AceLan Kao
From: José Roberto de Souza <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1912157

Child min_brightness is obsolete from VBT 234+, instead the new
min_brightness field in the main structure should be used.

This new field is 16 bits wide, so backlight_precision_bits is needed
to check if value needs to be scaled down but it is only available in
VBT 236+ so working around it by using the also new backlight_level
in the main struct.

v2:
- missed that backlight_data->level is also obsolete

v3:
- s/backlight/brightness to better match specification
- using u16 to specify brightness level instead of a u32 : 16

BSpec: 20149
Reviewed-by: Matt Roper <[hidden email]>
Signed-off-by: José Roberto de Souza <[hidden email]>
Link: https://patchwork.freedesktop.org/patch/msgid/20201008211932.24989-1-jose.souza@...
(cherry picked from commit d381baad29b43511a7fc34c64402ef65029ab281)
Signed-off-by: Chia-Lin Kao (AceLan) <[hidden email]>
---
 drivers/gpu/drm/i915/display/intel_bios.c     | 30 +++++++++++++++++--
 drivers/gpu/drm/i915/display/intel_vbt_defs.h | 12 ++++++--
 2 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 23614a6728f1..7d9612701a43 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -426,6 +426,7 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv,
  const struct bdb_lfp_backlight_data *backlight_data;
  const struct lfp_backlight_data_entry *entry;
  int panel_type = dev_priv->vbt.panel_type;
+ u16 level;
 
  backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT);
  if (!backlight_data)
@@ -460,14 +461,39 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv,
 
  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;
+
+ if (bdb->version >= 234) {
+ u16 min_level;
+ bool scale;
+
+ level = backlight_data->brightness_level[panel_type].level;
+ min_level = backlight_data->brightness_min_level[panel_type].level;
+
+ if (bdb->version >= 236)
+ scale = backlight_data->brightness_precision_bits[panel_type] == 16;
+ else
+ scale = level > 255;
+
+ if (scale)
+ min_level = min_level / 255;
+
+ if (min_level > 255) {
+ drm_warn(&dev_priv->drm, "Brightness min level > 255\n");
+ level = 255;
+ }
+ dev_priv->vbt.backlight.min_brightness = min_level;
+ } else {
+ level = backlight_data->level[panel_type];
+ dev_priv->vbt.backlight.min_brightness = entry->min_brightness;
+ }
+
  drm_dbg_kms(&dev_priv->drm,
     "VBT backlight PWM modulation frequency %u Hz, "
     "active %s, min brightness %u, level %u, controller %u\n",
     dev_priv->vbt.backlight.pwm_freq_hz,
     dev_priv->vbt.backlight.active_low_pwm ? "low" : "high",
     dev_priv->vbt.backlight.min_brightness,
-    backlight_data->level[panel_type],
+    level,
     dev_priv->vbt.backlight.controller);
 }
 
diff --git a/drivers/gpu/drm/i915/display/intel_vbt_defs.h b/drivers/gpu/drm/i915/display/intel_vbt_defs.h
index 1a17ef519d74..0e153dbd4f0f 100644
--- a/drivers/gpu/drm/i915/display/intel_vbt_defs.h
+++ b/drivers/gpu/drm/i915/display/intel_vbt_defs.h
@@ -784,7 +784,7 @@ struct lfp_backlight_data_entry {
  u8 active_low_pwm:1;
  u8 obsolete1:5;
  u16 pwm_freq_hz;
- u8 min_brightness;
+ u8 min_brightness; /* Obsolete from 234+ */
  u8 obsolete2;
  u8 obsolete3;
 } __packed;
@@ -794,11 +794,19 @@ struct lfp_backlight_control_method {
  u8 controller:4;
 } __packed;
 
+struct lfp_brightness_level {
+ u16 level;
+ u16 reserved;
+} __packed;
+
 struct bdb_lfp_backlight_data {
  u8 entry_size;
  struct lfp_backlight_data_entry data[16];
- u8 level[16];
+ u8 level[16]; /* Obsolete from 234+ */
  struct lfp_backlight_control_method backlight_control[16];
+ struct lfp_brightness_level brightness_level[16]; /* 234+ */
+ struct lfp_brightness_level brightness_min_level[16]; /* 234+ */
+ u8 brightness_precision_bits[16]; /* 236+ */
 } __packed;
 
 /*
--
2.25.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH 2/3][SRU][OEM-5.10] drm/i915/vbt: Update the version and expected size of BDB_GENERAL_DEFINITIONS map

AceLan Kao
In reply to this post by AceLan Kao
From: José Roberto de Souza <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1912157

This will remove the "Expected child device config size for VBT
version 235 not known" debug message seen in TGL, although this is not
fixing anything it good to keep our VBT parser updated.

Reviewed-by: Matt Roper <[hidden email]>
Signed-off-by: José Roberto de Souza <[hidden email]>
Link: https://patchwork.freedesktop.org/patch/msgid/20201008211932.24989-2-jose.souza@...
(cherry picked from commit e4b3c3b3faafe8d471c352d64cc87ccc6a1cede6)
Signed-off-by: Chia-Lin Kao (AceLan) <[hidden email]>
---
 drivers/gpu/drm/i915/display/intel_bios.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 7d9612701a43..9b7c4bf7d6e5 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -1928,7 +1928,7 @@ parse_general_definitions(struct drm_i915_private *dev_priv,
  expected_size = 37;
  } else if (bdb->version <= 215) {
  expected_size = 38;
- } else if (bdb->version <= 229) {
+ } else if (bdb->version <= 237) {
  expected_size = 39;
  } else {
  expected_size = sizeof(*child);
--
2.25.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH 3/3][SRU][OEM-5.10] drm/i915/vbt: Add VRR VBT toggle

AceLan Kao
In reply to this post by AceLan Kao
From: José Roberto de Souza <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1912157

This will be used in future but already adding to VBT so we are
updated with VBT changes.

Reviewed-by: Matt Roper <[hidden email]>
Signed-off-by: José Roberto de Souza <[hidden email]>
Link: https://patchwork.freedesktop.org/patch/msgid/20201008211932.24989-3-jose.souza@...
(cherry picked from commit a23fe79ae5c0946558fcac71d14ca8f85fb728b0)
Signed-off-by: Chia-Lin Kao (AceLan) <[hidden email]>
---
 drivers/gpu/drm/i915/display/intel_vbt_defs.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/i915/display/intel_vbt_defs.h b/drivers/gpu/drm/i915/display/intel_vbt_defs.h
index 0e153dbd4f0f..187ec573de59 100644
--- a/drivers/gpu/drm/i915/display/intel_vbt_defs.h
+++ b/drivers/gpu/drm/i915/display/intel_vbt_defs.h
@@ -837,6 +837,7 @@ struct bdb_lfp_power {
  u16 lace_enabled_status;
  struct agressiveness_profile_entry aggressivenes[16];
  u16 hobl; /* 232+ */
+ u16 vrr_feature_enabled; /* 233+ */
 } __packed;
 
 /*
--
2.25.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED Re: [PATCH 0/3][SRU][OEM-5.10] backlight parsing for VBT 234+

Timo Aaltonen-6
In reply to this post by AceLan Kao
On 19.1.2021 11.34, AceLan Kao wrote:

> From: "Chia-Lin Kao (AceLan)" <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/bugs/1912157
>
> [Impact]
> Current driver fails to parse VBT 234+ and gets wrong brightness levels.
> It leads to screen dim completely when brightness is set to lowest.
>
> [Fix]
> We need the commits to parse VBT 234+
> https://patchwork.freedesktop.org/patch/394304/
>
> [Test]
> Verified on Dell machines
>
> [Where problems could occur]
> The patches are simple and with a separate flow control for VBT 234,
> should have no impact for current brightness control.
>
> José Roberto de Souza (3):
>    drm/i915/vbt: Fix backlight parsing for VBT 234+
>    drm/i915/vbt: Update the version and expected size of
>      BDB_GENERAL_DEFINITIONS map
>    drm/i915/vbt: Add VRR VBT toggle
>
>   drivers/gpu/drm/i915/display/intel_bios.c     | 32 +++++++++++++++++--
>   drivers/gpu/drm/i915/display/intel_vbt_defs.h | 13 ++++++--
>   2 files changed, 40 insertions(+), 5 deletions(-)
>

applied to oem-5.10, thanks


--
t

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team