Skip to content

Commit 444c3c8

Browse files
hoshinolinamarcan
authored andcommitted
kboot_gpu: Dummy t8112 power calculation
This is wrong but it will do for now Signed-off-by: Asahi Lina <[email protected]>
1 parent 9ebc38c commit 444c3c8

1 file changed

Lines changed: 25 additions & 9 deletions

File tree

src/kboot_gpu.c

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,28 @@ struct perf_state {
2222
u32 volt;
2323
};
2424

25-
u32 t8103_pwr_scale[] = {0, 63, 80, 108, 150, 198, 210};
25+
static u32 t8103_pwr_scale[] = {0, 63, 80, 108, 150, 198, 210};
2626

27-
int calc_power_t8103(int sgx, u32 count, u32 table_count, const struct perf_state *perf_states,
28-
u32 *max_pwr)
27+
// TODO this isn't a static table any more
28+
static u32 t8112_pwr_scale[] = {0, 66, 92, 119, 153, 184, 214, 240, 240};
29+
30+
static int calc_power_t81xx(int sgx, u32 count, u32 table_count,
31+
const struct perf_state *perf_states, u32 *max_pwr)
2932
{
3033
UNUSED(sgx);
34+
u32 *pwr_scale;
35+
u32 pwr_scale_count;
3136

32-
u32 pwr_scale_count = ARRAY_SIZE(t8103_pwr_scale);
37+
switch (chip_id) {
38+
case T8103:
39+
pwr_scale = t8103_pwr_scale;
40+
pwr_scale_count = ARRAY_SIZE(t8103_pwr_scale);
41+
break;
42+
case T8112:
43+
pwr_scale = t8112_pwr_scale;
44+
pwr_scale_count = ARRAY_SIZE(t8112_pwr_scale);
45+
break;
46+
}
3347

3448
if (table_count != 1)
3549
bail("ADT: GPU: expected 1 perf state table but got %d\n", table_count);
@@ -38,15 +52,16 @@ int calc_power_t8103(int sgx, u32 count, u32 table_count, const struct perf_stat
3852
bail("ADT: GPU: expected %d perf states but got %d\n", pwr_scale_count, count);
3953

4054
for (u32 i = 0; i < pwr_scale_count; i++)
41-
max_pwr[i] = (u32)perf_states[i].volt * (u32)t8103_pwr_scale[i] * 100;
55+
max_pwr[i] = (u32)perf_states[i].volt * (u32)pwr_scale[i] * 100;
4256

4357
return 0;
4458
}
4559

46-
u32 t6000_pwr_scale[] = {0, 15, 19, 25, 34, 50, 100};
60+
// TODO
61+
static u32 t6000_pwr_scale[] = {0, 15, 19, 25, 34, 50, 100};
4762

48-
int calc_power_t600x(int sgx, u32 count, u32 table_count, const struct perf_state *perf_states,
49-
u32 *max_pwr)
63+
static int calc_power_t600x(int sgx, u32 count, u32 table_count,
64+
const struct perf_state *perf_states, u32 *max_pwr)
5065
{
5166
UNUSED(sgx);
5267
UNUSED(perf_states);
@@ -114,7 +129,8 @@ int dt_set_gpu(void *dt)
114129

115130
switch (chip_id) {
116131
case T8103:
117-
calc_power = calc_power_t8103;
132+
case T8112:
133+
calc_power = calc_power_t81xx;
118134
break;
119135
case T6000:
120136
case T6001:

0 commit comments

Comments
 (0)