Skip to content

Commit

Permalink
drm/asahi: initdata: Fudge t3 calculation a bit
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
asahilina committed Aug 9, 2023
1 parent 538ee13 commit 9e179fa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gpu/drm/asahi/initdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,18 @@ impl<'a> InitDataBuilder::ver<'a> {
continue;
}

let f_mhz = (ps.freq_hz / 1000) as u64;
let f_khz = (ps.freq_hz / 1000) as u64;
let v_max = ps.max_volt_mv() as u64;

t1.try_push(
(1000000000 * (curve_cfg.t1_coef as u64) / (f_mhz * v_max))
(1000000000 * (curve_cfg.t1_coef as u64) / (f_khz * v_max))
.try_into()
.unwrap(),
)?;

for (j, scale) in curve_cfg.t3_scales.iter().enumerate() {
t3[j].try_push(
(t3_coef as u64 * 1000000000 * *scale as u64 / (f_mhz * v_max * 6))
(t3_coef as u64 * 1000000100 * *scale as u64 / (f_khz * v_max * 6))
.try_into()
.unwrap(),
)?;
Expand Down

0 comments on commit 9e179fa

Please sign in to comment.