Skip to content

Commit c69c7bf

Browse files
committed
Detect darp11/darp10 using SPI device
1 parent 9088ace commit c69c7bf

1 file changed

Lines changed: 27 additions & 8 deletions

File tree

src/app/ec.rs

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,33 @@ impl EcComponent {
284284
"NS50_70PU" => "system76/darp8".to_string(),
285285
"NS50_70AU" => "system76/darp9".to_string(),
286286
"V5x0TU" => {
287-
// If GPP_E2 is high, this is the 16 inch variant
288-
unsafe {
289-
let sideband = Sideband::new(0xE000_0000);
290-
if sideband.gpio(0xD2, 0x36) & 2 == 2 {
291-
"system76/darp10-b".to_string()
292-
} else {
293-
"system76/darp10".to_string()
294-
}
287+
// Check SPI device at 1f.5 for Arrow Lake or Meteor Lake
288+
match pci_read(0x00, 0x1f, 0x5, 0x00).unwrap() {
289+
// 0x7723 is Arrow Lake (darp11)
290+
0x77238086 => {
291+
// If GPP_E2 is high, this is the 16 inch variant
292+
unsafe {
293+
let sideband = Sideband::new(0xE000_0000);
294+
if sideband.gpio(0xD2, 0x36) & 2 == 2 {
295+
"system76/darp11-b".to_string()
296+
} else {
297+
"system76/darp11".to_string()
298+
}
299+
}
300+
},
301+
// 0x7e23 is Meteor Lake (darp10)
302+
0x7e238086 => {
303+
// If GPP_E2 is high, this is the 16 inch variant
304+
unsafe {
305+
let sideband = Sideband::new(0xE000_0000);
306+
if sideband.gpio(0xD2, 0x36) & 2 == 2 {
307+
"system76/darp10-b".to_string()
308+
} else {
309+
"system76/darp10".to_string()
310+
}
311+
}
312+
},
313+
_ => model.to_string(),
295314
}
296315
}
297316
"NV40Mx" | "NV40Mx-DV" | "NV40MJ" => "system76/galp5".to_string(),

0 commit comments

Comments
 (0)