Skip to content

Commit 9e179fa

Browse files
committed
drm/asahi: initdata: Fudge t3 calculation a bit
This gives exact numbers for G14D on the test machine. It looks like a rounding thing, but it's not clear exactly what the original logic would be here... I'm guessing the macOS driver uses floats and a different order of operations and that's why it comes up with a different result sometimes. Also fix an incorrectly named variable. Signed-off-by: Asahi Lina <[email protected]>
1 parent 538ee13 commit 9e179fa

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/gpu/drm/asahi/initdata.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,18 @@ impl<'a> InitDataBuilder::ver<'a> {
124124
continue;
125125
}
126126

127-
let f_mhz = (ps.freq_hz / 1000) as u64;
127+
let f_khz = (ps.freq_hz / 1000) as u64;
128128
let v_max = ps.max_volt_mv() as u64;
129129

130130
t1.try_push(
131-
(1000000000 * (curve_cfg.t1_coef as u64) / (f_mhz * v_max))
131+
(1000000000 * (curve_cfg.t1_coef as u64) / (f_khz * v_max))
132132
.try_into()
133133
.unwrap(),
134134
)?;
135135

136136
for (j, scale) in curve_cfg.t3_scales.iter().enumerate() {
137137
t3[j].try_push(
138-
(t3_coef as u64 * 1000000000 * *scale as u64 / (f_mhz * v_max * 6))
138+
(t3_coef as u64 * 1000000100 * *scale as u64 / (f_khz * v_max * 6))
139139
.try_into()
140140
.unwrap(),
141141
)?;

0 commit comments

Comments
 (0)