Skip to content

Commit cd888b9

Browse files
aledbfclaude
andcommitted
kernel: the VBT's own voltage swing tables, from drm-intel-next
The ThinkPad X9-15p's VBT asks for its own voltage swing and pre-emphasis tables on port D (USB-C, C20 PHY), which 7.2 ignores with a WARNING at every boot, driving the port with the defaults. Michał Grzelak's VS/PE-O series, in linux-next for 7.4, reads them from VBT block 57; it applies to 7.2.10 without fuzz. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 5eac1ca commit cd888b9

8 files changed

Lines changed: 1050 additions & 0 deletions
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
construct: linux-next (drm-intel-next), for 7.4: VS/PE-O, patch 1 of 8. The ThinkPad X9-15p's VBT
2+
asks for its own voltage swing and pre-emphasis tables on port D (USB-C, C20 PHY), which 7.2
3+
ignores with a WARNING at every boot (intel_bios.c, "Port D asks to use VBT vswing/preemph
4+
tables"), driving the port with the default tables. The series reads VBT block 57 and uses them.
5+
6+
From 3018008dc1c3ca1d8c3f0a2362e15a1f47e66616 Mon Sep 17 00:00:00 2001
7+
From: Michał Grzelak <michal.grzelak@intel.com>
8+
Date: Fri, 4 Sep 2026 14:31:41 +0200
9+
Subject: drm/i915/bios: search for VBT #57 by default
10+
MIME-Version: 1.0
11+
Content-Type: text/plain; charset=UTF-8
12+
Content-Transfer-Encoding: 8bit
13+
14+
Start searching for Vswing / Preemphasis Override Block during VBT
15+
parsing at init_bdb_blocks().
16+
17+
Check for failure since pre-ICL GOPs do not contain the block. Check
18+
also if VBT version is appropriately up-to-date.
19+
20+
v6->v7
21+
- parse VBT#57 before blocks dependent on child device list (Jani)
22+
- remove debug message (Suraj)
23+
24+
v3->v4
25+
- add Bspec (Suraj)
26+
27+
Bspec: 32063
28+
Signed-off-by: Michał Grzelak <michal.grzelak@intel.com>
29+
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
30+
Acked-by: Jani Nikula <jani.nikula@intel.com>
31+
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
32+
Link: https://patch.msgid.link/20260904123148.2165596-2-michal.grzelak@intel.com
33+
---
34+
drivers/gpu/drm/i915/display/intel_bios.c | 18 ++++++++++++++++++
35+
1 file changed, 18 insertions(+)
36+
37+
diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
38+
index 97cbae2e547e2..ece4df4a9d62a 100644
39+
--- a/drivers/gpu/drm/i915/display/intel_bios.c
40+
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
41+
@@ -200,6 +200,8 @@ static const struct {
42+
.min_size = sizeof(struct bdb_mipi_sequence) },
43+
{ .section_id = BDB_COMPRESSION_PARAMETERS,
44+
.min_size = sizeof(struct bdb_compression_parameters), },
45+
+ { .section_id = BDB_VSWING_PREEMPH,
46+
+ .min_size = sizeof(struct bdb_vswing_preemph), },
47+
{ .section_id = BDB_GENERIC_DTD,
48+
.min_size = sizeof(struct bdb_generic_dtd), },
49+
};
50+
@@ -2203,6 +2205,21 @@ parse_compression_parameters(struct intel_display *display)
51+
}
52+
}
53+
54+
+static void
55+
+parse_vswing_preemph_override(struct intel_display *display)
56+
+{
57+
+ const struct bdb_vswing_preemph *block;
58+
+
59+
+ if (display->vbt.version < 218)
60+
+ return;
61+
+
62+
+ block = bdb_find_section(display, BDB_VSWING_PREEMPH);
63+
+
64+
+ /* pre-ICL GOPs don't have VBT #57 */
65+
+ if (!block)
66+
+ return;
67+
+}
68+
+
69+
static u8 translate_iboost(struct intel_display *display, u8 val)
70+
{
71+
static const u8 mapping[] = { 1, 3, 7 }; /* See VBT spec */
72+
@@ -3291,6 +3308,7 @@ void intel_bios_init(struct intel_display *display)
73+
parse_general_features(display);
74+
parse_general_definitions(display);
75+
parse_driver_features(display);
76+
+ parse_vswing_preemph_override(display);
77+
78+
/* Depends on child device list */
79+
parse_compression_parameters(display);
80+
--
81+
cgit 1.3.1-korg
82+
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
construct: linux-next (drm-intel-next), for 7.4: VS/PE-O, patch 2 of 8 (see 0008).
2+
3+
From c76c03dab828709469558a6bdd55336ef9fd9420 Mon Sep 17 00:00:00 2001
4+
From: Michał Grzelak <michal.grzelak@intel.com>
5+
Date: Fri, 4 Sep 2026 14:31:42 +0200
6+
Subject: drm/i915/bios: store VBT #57's metadata in intel_vbt_data
7+
MIME-Version: 1.0
8+
Content-Type: text/plain; charset=UTF-8
9+
Content-Transfer-Encoding: 8bit
10+
11+
Store tables, number of tables, number of rows and number of columns in
12+
intel_vbt_data when search for the VBT #57 has succeeded. Structurize
13+
all VS/PE-O relevant metadata inside anonymous struct named as vspeo.
14+
15+
Presence of C20 or newer PHY causes each table to contain 16 rows. Each
16+
table contains 10 rows in case C20 PHY is absent. Use display version to
17+
determine number of rows since there is no helper in intel_bios.c to
18+
check presence of any C20+ PHY. pre-MTL platforms should have 10 rows
19+
while MTL+ should have 16 rows.
20+
21+
v5->v6
22+
- add Bspec (Suraj)
23+
24+
v3->v4
25+
- remove unnecessary init of VS/PE-O metadata (Suraj)
26+
- add helper for computing number of rows (Suraj)
27+
- fix num_rows's type (Jani, Suraj)
28+
- declare num_rows (Suraj)
29+
30+
Bspec: 68963
31+
Signed-off-by: Michał Grzelak <michal.grzelak@intel.com>
32+
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
33+
Acked-by: Jani Nikula <jani.nikula@intel.com>
34+
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
35+
Link: https://patch.msgid.link/20260904123148.2165596-3-michal.grzelak@intel.com
36+
---
37+
drivers/gpu/drm/i915/display/intel_bios.c | 10 ++++++++++
38+
drivers/gpu/drm/i915/display/intel_display_core.h | 7 +++++++
39+
2 files changed, 17 insertions(+)
40+
41+
diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
42+
index ece4df4a9d62a..06a8dd7581bb8 100644
43+
--- a/drivers/gpu/drm/i915/display/intel_bios.c
44+
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
45+
@@ -2205,6 +2205,11 @@ parse_compression_parameters(struct intel_display *display)
46+
}
47+
}
48+
49+
+static int vswing_preemph_num_rows(struct intel_display *display)
50+
+{
51+
+ return DISPLAY_VER(display) >= 14 ? 16 : 10;
52+
+}
53+
+
54+
static void
55+
parse_vswing_preemph_override(struct intel_display *display)
56+
{
57+
@@ -2218,6 +2223,11 @@ parse_vswing_preemph_override(struct intel_display *display)
58+
/* pre-ICL GOPs don't have VBT #57 */
59+
if (!block)
60+
return;
61+
+
62+
+ display->vbt.vspeo.tables = block->tables;
63+
+ display->vbt.vspeo.num_tables = block->num_tables;
64+
+ display->vbt.vspeo.num_columns = block->num_columns;
65+
+ display->vbt.vspeo.num_rows = vswing_preemph_num_rows(display);
66+
}
67+
68+
static u8 translate_iboost(struct intel_display *display, u8 val)
69+
diff --git a/drivers/gpu/drm/i915/display/intel_display_core.h b/drivers/gpu/drm/i915/display/intel_display_core.h
70+
index 7e988b7b1fe7a..c80b4a2f74f9e 100644
71+
--- a/drivers/gpu/drm/i915/display/intel_display_core.h
72+
+++ b/drivers/gpu/drm/i915/display/intel_display_core.h
73+
@@ -244,6 +244,13 @@ struct intel_vbt_data {
74+
struct list_head display_devices;
75+
struct list_head bdb_blocks;
76+
77+
+ struct {
78+
+ const u32 *tables;
79+
+ int num_tables;
80+
+ int num_columns;
81+
+ int num_rows;
82+
+ } vspeo;
83+
+
84+
struct sdvo_device_mapping {
85+
u8 initialized;
86+
u8 dvo_port;
87+
--
88+
cgit 1.3.1-korg
89+
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
construct: linux-next (drm-intel-next), for 7.4: VS/PE-O, patch 3 of 8 (see 0008).
2+
3+
From 1b15117625045baa107970a9a1ffb5638ab05414 Mon Sep 17 00:00:00 2001
4+
From: Michał Grzelak <michal.grzelak@intel.com>
5+
Date: Fri, 4 Sep 2026 14:31:43 +0200
6+
Subject: drm/i915/bios: print VS/PE-O port info
7+
MIME-Version: 1.0
8+
Content-Type: text/plain; charset=UTF-8
9+
Content-Transfer-Encoding: 8bit
10+
11+
Issue a debug message when port asks to override default Vswing /
12+
Preemphasis tables.
13+
14+
Add helper intel_bios_encoder_requests_vspeo() to check if port
15+
requests for overriding default VS/PE tables.
16+
17+
v6->v7
18+
- expand VS/PE-O acronym in debug logging (Jani)
19+
20+
v3->v4
21+
- change debug message when requesting VS/PE-O (Suraj)
22+
23+
Signed-off-by: Michał Grzelak <michal.grzelak@intel.com>
24+
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
25+
Acked-by: Jani Nikula <jani.nikula@intel.com>
26+
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
27+
Link: https://patch.msgid.link/20260904123148.2165596-4-michal.grzelak@intel.com
28+
---
29+
drivers/gpu/drm/i915/display/intel_bios.c | 10 ++++++++++
30+
drivers/gpu/drm/i915/display/intel_bios.h | 1 +
31+
2 files changed, 11 insertions(+)
32+
33+
diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
34+
index 06a8dd7581bb8..9610b794bc147 100644
35+
--- a/drivers/gpu/drm/i915/display/intel_bios.c
36+
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
37+
@@ -2801,6 +2801,11 @@ static void print_ddi_port(const struct intel_bios_encoder_data *devdata)
38+
"Port %c supports dynamic DDI allocation in TCSS\n",
39+
port_name(port));
40+
41+
+ if (intel_bios_encoder_requests_vspeo(devdata))
42+
+ drm_dbg_kms(display->drm,
43+
+ "Port %c requests vswing/pre-emphasis override\n",
44+
+ port_name(port));
45+
+
46+
hdmi_level_shift = intel_bios_hdmi_level_shift(devdata);
47+
if (hdmi_level_shift >= 0) {
48+
drm_dbg_kms(display->drm,
49+
@@ -3829,6 +3834,11 @@ int intel_bios_hdmi_ddc_pin(const struct intel_bios_encoder_data *devdata)
50+
return map_ddc_pin(devdata->display, devdata->child.ddc_pin);
51+
}
52+
53+
+bool intel_bios_encoder_requests_vspeo(const struct intel_bios_encoder_data *devdata)
54+
+{
55+
+ return devdata->display->vbt.version >= 218 && devdata->child.use_vbt_vswing;
56+
+}
57+
+
58+
bool intel_bios_encoder_supports_typec_usb(const struct intel_bios_encoder_data *devdata)
59+
{
60+
return devdata->display->vbt.version >= 195 && devdata->child.dp_usb_type_c;
61+
diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h
62+
index 75dff27b42289..7a50a272cd27d 100644
63+
--- a/drivers/gpu/drm/i915/display/intel_bios.h
64+
+++ b/drivers/gpu/drm/i915/display/intel_bios.h
65+
@@ -73,6 +73,7 @@ bool intel_bios_get_dsc_params(struct intel_encoder *encoder,
66+
const struct intel_bios_encoder_data *
67+
intel_bios_encoder_data_lookup(struct intel_display *display, enum port port);
68+
69+
+bool intel_bios_encoder_requests_vspeo(const struct intel_bios_encoder_data *devdata);
70+
bool intel_bios_encoder_supports_dvi(const struct intel_bios_encoder_data *devdata);
71+
bool intel_bios_encoder_supports_hdmi(const struct intel_bios_encoder_data *devdata);
72+
bool intel_bios_encoder_supports_dp(const struct intel_bios_encoder_data *devdata);
73+
--
74+
cgit 1.3.1-korg
75+
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
construct: linux-next (drm-intel-next), for 7.4: VS/PE-O, patch 4 of 8 (see 0008).
2+
3+
From a138a81d7805a025a778035c0850642381d1fdf9 Mon Sep 17 00:00:00 2001
4+
From: Michał Grzelak <michal.grzelak@intel.com>
5+
Date: Fri, 4 Sep 2026 14:31:44 +0200
6+
Subject: drm/i915/bios: de/allocate VS/PE-O buffers for each port
7+
MIME-Version: 1.0
8+
Content-Type: text/plain; charset=UTF-8
9+
Content-Transfer-Encoding: 8bit
10+
11+
Every devdata needs VS/PE-O dedicated buffers since each port can
12+
request an override. Add intel_ddi_buf_trans{,_entry} pointers into
13+
intel_bios_encoder_data.
14+
15+
Allocate struct intel_ddi_buf_trans{,_entry} for the port if VS/PE-O was
16+
requested and is supported. Keep NULL in vspeo if any allocation failed
17+
or VS/PE-O was not requested. It will be used later for checking if
18+
override should actually take place.
19+
20+
Note that we theoretically could store intel_ddi_buf_trans_entry inside
21+
`entries` field of newly allocated intel_ddi_buf_trans. However it will
22+
be impossible to overwrite the buffer during intel_ddi_get_buf_trans()
23+
without discarding const qualifier of `entries` field. This would
24+
involve either void casting or deconstifying entries field and in turn
25+
all predefined tables as well. Thus add a separate non-const qualified
26+
field into intel_bios_encoder_data for the buffer, which after
27+
overwriting will be promoted to be const qualified.
28+
29+
Deallocate the buffer as well as entries if requested.
30+
31+
v11->v12
32+
- set vspeo->num_entries once (Sashiko)
33+
- free allocated vspeo->entries (Sashiko)
34+
35+
v9->v10
36+
- add separate non-const field for `entries` caching
37+
- cache `entries` into const field after data is overwritten (Jani)
38+
39+
v4->v5
40+
- set devdata->vspeo->num_entries in intel_bios.c
41+
42+
Signed-off-by: Michał Grzelak <michal.grzelak@intel.com>
43+
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
44+
Acked-by: Jani Nikula <jani.nikula@intel.com>
45+
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
46+
Link: https://patch.msgid.link/20260904123148.2165596-5-michal.grzelak@intel.com
47+
---
48+
drivers/gpu/drm/i915/display/intel_bios.c | 31 +++++++++++++++++++++++++++++++
49+
1 file changed, 31 insertions(+)
50+
51+
diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
52+
index 9610b794bc147..1a09f7933e491 100644
53+
--- a/drivers/gpu/drm/i915/display/intel_bios.c
54+
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
55+
@@ -34,6 +34,7 @@
56+
#include <drm/drm_fixed.h>
57+
#include <drm/drm_print.h>
58+
59+
+#include "intel_ddi_buf_trans.h"
60+
#include "intel_display.h"
61+
#include "intel_display_core.h"
62+
#include "intel_display_rpm.h"
63+
@@ -72,6 +73,8 @@
64+
struct intel_bios_encoder_data {
65+
struct intel_display *display;
66+
67+
+ struct intel_ddi_buf_trans *vspeo;
68+
+ union intel_ddi_buf_trans_entry *entries;
69+
struct child_device_config child;
70+
struct dsc_compression_parameters_entry *dsc;
71+
struct list_head node;
72+
@@ -2648,6 +2651,30 @@ static void sanitize_device_type(struct intel_bios_encoder_data *devdata,
73+
devdata->child.device_type |= DEVICE_TYPE_NOT_HDMI_OUTPUT;
74+
}
75+
76+
+static void allocate_vswing_preemph_override(struct intel_bios_encoder_data *devdata)
77+
+{
78+
+ int num_rows = devdata->display->vbt.vspeo.num_rows;
79+
+ union intel_ddi_buf_trans_entry *entries;
80+
+ struct intel_ddi_buf_trans *vspeo;
81+
+
82+
+ if (!intel_bios_encoder_requests_vspeo(devdata))
83+
+ return;
84+
+
85+
+ vspeo = kzalloc_obj(*vspeo);
86+
+ if (!vspeo)
87+
+ return;
88+
+
89+
+ entries = kzalloc_objs(*entries, num_rows);
90+
+ if (!entries) {
91+
+ kfree(vspeo);
92+
+ return;
93+
+ }
94+
+
95+
+ devdata->entries = entries;
96+
+ devdata->vspeo = vspeo;
97+
+ devdata->vspeo->num_entries = num_rows;
98+
+}
99+
+
100+
static void sanitize_hdmi_level_shift(struct intel_bios_encoder_data *devdata,
101+
enum port port)
102+
{
103+
@@ -2866,6 +2893,7 @@ static void parse_ddi_port(struct intel_bios_encoder_data *devdata)
104+
sanitize_dedicated_external(devdata, port);
105+
sanitize_device_type(devdata, port);
106+
sanitize_hdmi_level_shift(devdata, port);
107+
+ allocate_vswing_preemph_override(devdata);
108+
}
109+
110+
static bool has_ddi_port_info(struct intel_display *display)
111+
@@ -3403,6 +3431,9 @@ void intel_bios_driver_remove(struct intel_display *display)
112+
list_for_each_entry_safe(devdata, nd, &display->vbt.display_devices,
113+
node) {
114+
list_del(&devdata->node);
115+
+
116+
+ kfree(devdata->entries);
117+
+ kfree(devdata->vspeo);
118+
kfree(devdata->dsc);
119+
kfree(devdata);
120+
}
121+
--
122+
cgit 1.3.1-korg
123+

0 commit comments

Comments
 (0)