Skip to content

Commit 489264f

Browse files
Merge pull request #170 from FrameworkComputer/left-right
Correctly identify right and left PD controllers
2 parents 84c3027 + 0b0fa1d commit 489264f

File tree

4 files changed

+38
-38
lines changed

4 files changed

+38
-38
lines changed

EXAMPLES_ADVANCED.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ Example on Framework 13 AMD Ryzen AI 300
88

99
```
1010
> sudo framework_tool.exe --pd-info
11-
Left / Ports 01
11+
Right / Ports 01
1212
Silicon ID: 0x3580
1313
Mode: MainFw
1414
Flash Row Size: 256 B
1515
Ports Enabled: 0, 1
1616
Bootloader Version: Base: 3.6.0.009, App: 0.0.01
1717
FW1 (Backup) Version: Base: 3.7.0.197, App: 0.0.0B
1818
FW2 (Main) Version: Base: 3.7.0.197, App: 0.0.0B
19-
Right / Ports 23
19+
Left / Ports 23
2020
Silicon ID: 0x3580
2121
Mode: MainFw
2222
Flash Row Size: 256 B

framework_lib/src/ccgx/device.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ enum ControlRegisters {
4343

4444
#[derive(Debug, PartialEq, Clone, Copy)]
4545
pub enum PdPort {
46-
Left01,
47-
Right23,
46+
Right01,
47+
Left23,
4848
Back,
4949
}
5050

@@ -58,21 +58,21 @@ impl PdPort {
5858
));
5959

6060
Ok(match (platform, self) {
61-
(Platform::GenericFramework((left, _, _), _), PdPort::Left01) => *left,
62-
(Platform::GenericFramework((_, right, _), _), PdPort::Right23) => *right,
61+
(Platform::GenericFramework((left, _, _), _), PdPort::Right01) => *left,
62+
(Platform::GenericFramework((_, right, _), _), PdPort::Left23) => *right,
6363
(Platform::GenericFramework((_, _, back), _), PdPort::Back) => *back,
6464
// Framework AMD Platforms (CCG8)
6565
(
6666
Platform::Framework13Amd7080
6767
| Platform::Framework13AmdAi300
6868
| Platform::Framework16Amd7080,
69-
PdPort::Left01,
69+
PdPort::Right01,
7070
) => 0x42,
7171
(
7272
Platform::Framework13Amd7080
7373
| Platform::Framework13AmdAi300
7474
| Platform::Framework16Amd7080,
75-
PdPort::Right23,
75+
PdPort::Left23,
7676
) => 0x40,
7777
(Platform::Framework16Amd7080, PdPort::Back) => 0x42,
7878
(Platform::FrameworkDesktopAmdAiMax300, PdPort::Back) => 0x08,
@@ -84,15 +84,15 @@ impl PdPort {
8484
| Platform::IntelGen12
8585
| Platform::IntelGen13
8686
| Platform::IntelCoreUltra1,
87-
PdPort::Left01,
87+
PdPort::Right01,
8888
) => 0x08,
8989
(
9090
Platform::Framework12IntelGen13
9191
| Platform::IntelGen11
9292
| Platform::IntelGen12
9393
| Platform::IntelGen13
9494
| Platform::IntelCoreUltra1,
95-
PdPort::Right23,
95+
PdPort::Left23,
9696
) => 0x40,
9797
(Platform::UnknownSystem, _) => {
9898
Err(EcError::DeviceError("Unsupported platform".to_string()))?
@@ -111,27 +111,27 @@ impl PdPort {
111111
)));
112112

113113
Ok(match (platform, self) {
114-
(Platform::GenericFramework(_, (left, _, _)), PdPort::Left01) => *left,
115-
(Platform::GenericFramework(_, (_, right, _)), PdPort::Right23) => *right,
114+
(Platform::GenericFramework(_, (left, _, _)), PdPort::Right01) => *left,
115+
(Platform::GenericFramework(_, (_, right, _)), PdPort::Left23) => *right,
116116
(Platform::GenericFramework(_, (_, _, back)), PdPort::Back) => *back,
117117
(Platform::IntelGen11, _) => 6,
118-
(Platform::IntelGen12 | Platform::IntelGen13, PdPort::Left01) => 6,
119-
(Platform::IntelGen12 | Platform::IntelGen13, PdPort::Right23) => 7,
118+
(Platform::IntelGen12 | Platform::IntelGen13, PdPort::Right01) => 6,
119+
(Platform::IntelGen12 | Platform::IntelGen13, PdPort::Left23) => 7,
120120
(
121121
Platform::Framework13Amd7080
122122
| Platform::Framework16Amd7080
123123
| Platform::IntelCoreUltra1
124124
| Platform::Framework13AmdAi300
125125
| Platform::Framework12IntelGen13,
126-
PdPort::Left01,
126+
PdPort::Right01,
127127
) => 1,
128128
(
129129
Platform::Framework13Amd7080
130130
| Platform::Framework16Amd7080
131131
| Platform::IntelCoreUltra1
132132
| Platform::Framework13AmdAi300
133133
| Platform::Framework12IntelGen13,
134-
PdPort::Right23,
134+
PdPort::Left23,
135135
) => 2,
136136
(Platform::Framework16Amd7080, PdPort::Back) => 5,
137137
(Platform::FrameworkDesktopAmdAiMax300, PdPort::Back) => 1,

framework_lib/src/ccgx/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ pub enum MainPdVersions {
252252
}
253253

254254
pub fn get_pd_controller_versions(ec: &CrosEc) -> EcResult<PdVersions> {
255-
let pd01 = PdController::new(PdPort::Left01, ec.clone()).get_fw_versions();
256-
let pd23 = PdController::new(PdPort::Right23, ec.clone()).get_fw_versions();
255+
let pd01 = PdController::new(PdPort::Right01, ec.clone()).get_fw_versions();
256+
let pd23 = PdController::new(PdPort::Left23, ec.clone()).get_fw_versions();
257257
let pd_back = PdController::new(PdPort::Back, ec.clone()).get_fw_versions();
258258

259259
match (pd01, pd23, pd_back) {

framework_lib/src/commandline/mod.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,13 @@ fn print_pd_details(ec: &CrosEc) {
247247
println!("Only supported on Framework systems");
248248
return;
249249
}
250-
let pd_01 = PdController::new(PdPort::Left01, ec.clone());
251-
let pd_23 = PdController::new(PdPort::Right23, ec.clone());
250+
let pd_01 = PdController::new(PdPort::Right01, ec.clone());
251+
let pd_23 = PdController::new(PdPort::Left23, ec.clone());
252252
let pd_back = PdController::new(PdPort::Back, ec.clone());
253253

254-
println!("Left / Ports 01");
254+
println!("Right / Ports 01");
255255
print_single_pd_details(&pd_01);
256-
println!("Right / Ports 23");
256+
println!("Left / Ports 23");
257257
print_single_pd_details(&pd_23);
258258
println!("Back");
259259
print_single_pd_details(&pd_back);
@@ -570,13 +570,13 @@ fn print_versions(ec: &CrosEc) {
570570
| esrt::ADL_RETIMER01_GUID
571571
| esrt::RPL_RETIMER01_GUID
572572
| esrt::MTL_RETIMER01_GUID => {
573-
left_retimer = Some(entry.fw_version);
573+
right_retimer = Some(entry.fw_version);
574574
}
575575
esrt::TGL_RETIMER23_GUID
576576
| esrt::ADL_RETIMER23_GUID
577577
| esrt::RPL_RETIMER23_GUID
578578
| esrt::MTL_RETIMER23_GUID => {
579-
right_retimer = Some(entry.fw_version);
579+
left_retimer = Some(entry.fw_version);
580580
}
581581
_ => {}
582582
}
@@ -1017,8 +1017,8 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
10171017
} else if let Some(pd) = args.pd_reset {
10181018
println!("Resetting PD {}...", pd);
10191019
print_err(match pd {
1020-
0 => PdController::new(PdPort::Left01, ec.clone()).reset_device(),
1021-
1 => PdController::new(PdPort::Right23, ec.clone()).reset_device(),
1020+
0 => PdController::new(PdPort::Right01, ec.clone()).reset_device(),
1021+
1 => PdController::new(PdPort::Left23, ec.clone()).reset_device(),
10221022
2 => PdController::new(PdPort::Back, ec.clone()).reset_device(),
10231023
_ => {
10241024
error!("PD {} does not exist", pd);
@@ -1028,8 +1028,8 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
10281028
} else if let Some(pd) = args.pd_disable {
10291029
println!("Disabling PD {}...", pd);
10301030
print_err(match pd {
1031-
0 => PdController::new(PdPort::Left01, ec.clone()).enable_ports(false),
1032-
1 => PdController::new(PdPort::Right23, ec.clone()).enable_ports(false),
1031+
0 => PdController::new(PdPort::Right01, ec.clone()).enable_ports(false),
1032+
1 => PdController::new(PdPort::Left23, ec.clone()).enable_ports(false),
10331033
2 => PdController::new(PdPort::Back, ec.clone()).enable_ports(false),
10341034
_ => {
10351035
error!("PD {} does not exist", pd);
@@ -1039,8 +1039,8 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
10391039
} else if let Some(pd) = args.pd_enable {
10401040
println!("Enabling PD {}...", pd);
10411041
print_err(match pd {
1042-
0 => PdController::new(PdPort::Left01, ec.clone()).enable_ports(true),
1043-
1 => PdController::new(PdPort::Right23, ec.clone()).enable_ports(true),
1042+
0 => PdController::new(PdPort::Right01, ec.clone()).enable_ports(true),
1043+
1 => PdController::new(PdPort::Left23, ec.clone()).enable_ports(true),
10441044
2 => PdController::new(PdPort::Back, ec.clone()).enable_ports(true),
10451045
_ => {
10461046
error!("PD {} does not exist", pd);
@@ -1376,8 +1376,8 @@ fn selftest(ec: &CrosEc) -> Option<()> {
13761376
println!(" - OK");
13771377
}
13781378

1379-
let pd_01 = PdController::new(PdPort::Left01, ec.clone());
1380-
let pd_23 = PdController::new(PdPort::Right23, ec.clone());
1379+
let pd_01 = PdController::new(PdPort::Right01, ec.clone());
1380+
let pd_23 = PdController::new(PdPort::Left23, ec.clone());
13811381
print!(" Getting PD01 info through I2C tunnel");
13821382
print_err(pd_01.get_silicon_id())?;
13831383
print_err(pd_01.get_device_info())?;
@@ -1554,22 +1554,22 @@ pub fn analyze_capsule(data: &[u8]) -> Option<capsule::EfiCapsuleHeader> {
15541554
println!(" Type: Framework RPL Insyde BIOS");
15551555
}
15561556
esrt::TGL_RETIMER01_GUID => {
1557-
println!(" Type: Framework TGL Retimer01 (Left)");
1557+
println!(" Type: Framework TGL Retimer01 (Right)");
15581558
}
15591559
esrt::TGL_RETIMER23_GUID => {
1560-
println!(" Type: Framework TGL Retimer23 (Right)");
1560+
println!(" Type: Framework TGL Retimer23 (Left)");
15611561
}
15621562
esrt::ADL_RETIMER01_GUID => {
1563-
println!(" Type: Framework ADL Retimer01 (Left)");
1563+
println!(" Type: Framework ADL Retimer01 (Right)");
15641564
}
15651565
esrt::ADL_RETIMER23_GUID => {
1566-
println!(" Type: Framework ADL Retimer23 (Right)");
1566+
println!(" Type: Framework ADL Retimer23 (Left)");
15671567
}
15681568
esrt::RPL_RETIMER01_GUID => {
1569-
println!(" Type: Framework RPL Retimer01 (Left)");
1569+
println!(" Type: Framework RPL Retimer01 (Right)");
15701570
}
15711571
esrt::RPL_RETIMER23_GUID => {
1572-
println!(" Type: Framework RPL Retimer23 (Right)");
1572+
println!(" Type: Framework RPL Retimer23 (Left)");
15731573
}
15741574
esrt::WINUX_GUID => {
15751575
println!(" Type: Windows UX capsule");

0 commit comments

Comments
 (0)