@@ -37,9 +37,15 @@ pub enum PdPort {
37
37
impl PdPort {
38
38
/// SMBUS/I2C Address
39
39
fn i2c_address ( & self ) -> u16 {
40
- match self {
41
- PdPort :: Left01 => 0x08 ,
42
- PdPort :: Right23 => 0x40 ,
40
+ let config = Config :: get ( ) ;
41
+ let platform = & ( * config) . as_ref ( ) . unwrap ( ) . platform ;
42
+
43
+ match ( platform, self ) {
44
+ ( Platform :: Framework13Amd | Platform :: Framework16 , PdPort :: Left01 ) => 0x42 ,
45
+ ( Platform :: Framework13Amd | Platform :: Framework16 , PdPort :: Right23 ) => 0x40 ,
46
+ // Intel Platforms
47
+ ( _, PdPort :: Left01 ) => 0x08 ,
48
+ ( _, PdPort :: Right23 ) => 0x40 ,
43
49
}
44
50
}
45
51
@@ -54,11 +60,12 @@ impl PdPort {
54
60
( Platform :: IntelGen12 , PdPort :: Right23 ) => 7 ,
55
61
( Platform :: IntelGen13 , PdPort :: Left01 ) => 6 ,
56
62
( Platform :: IntelGen13 , PdPort :: Right23 ) => 7 ,
57
- // TODO: AMD
58
- ( _, _) => Err ( EcError :: DeviceError ( format ! (
59
- "Unsupported platform: {:?} {:?}" ,
60
- platform, self
61
- ) ) ) ?,
63
+ ( Platform :: Framework13Amd | Platform :: Framework16 , PdPort :: Left01 ) => 1 ,
64
+ ( Platform :: Framework13Amd | Platform :: Framework16 , PdPort :: Right23 ) => 2 ,
65
+ // (_, _) => Err(EcError::DeviceError(format!(
66
+ // "Unsupported platform: {:?} {:?}",
67
+ // platform, self
68
+ // )))?,
62
69
} )
63
70
}
64
71
}
0 commit comments