| 1 |
|
| 2 |
|
| 3 |
#include <chip.h> |
| 4 |
#include <cpu/intel/turbo.h> |
| 5 |
#include <device/device.h> |
| 6 |
#include <device/pci_def.h> |
| 7 |
#include <option.h> |
| 8 |
#include <static.h> |
| 9 |
#include <types.h> |
| 10 |
#include <variants.h> |
| 11 |
|
| 12 |
#define TJ_MAX 110 |
| 13 |
#define TCC(temp) (TJ_MAX - temp) |
| 14 |
|
| 15 |
void devtree_update(void) |
| 16 |
{ |
| 17 |
config_t *cfg = config_of_soc(); |
| 18 |
|
| 19 |
struct soc_power_limits_config *soc_conf_10core = |
| 20 |
&cfg->power_limits_config[ADL_P_282_442_482_28W_CORE]; |
| 21 |
|
| 22 |
struct soc_power_limits_config *soc_conf_12core = |
| 23 |
&cfg->power_limits_config[ADL_P_682_28W_CORE]; |
| 24 |
|
| 25 |
struct device *gna_dev = pcidev_on_root(0x08, 0); |
| 26 |
|
| 27 |
uint8_t performance_scale = 100; |
| 28 |
|
| 29 |
|
| 30 |
soc_conf_10core->tdp_pl4 = 65; |
| 31 |
soc_conf_12core->tdp_pl4 = 65; |
| 32 |
|
| 33 |
|
| 34 |
soc_conf_10core->tdp_pl1_override = (soc_conf_10core->tdp_pl2_override / 2) & ~1; |
| 35 |
soc_conf_12core->tdp_pl1_override = (soc_conf_12core->tdp_pl2_override / 2) & ~1; |
| 36 |
|
| 37 |
|
| 38 |
switch (get_power_profile(PP_POWER_SAVER)) { |
| 39 |
case PP_POWER_SAVER: |
| 40 |
performance_scale -= 50; |
| 41 |
cfg->tcc_offset = TCC(80); |
| 42 |
break; |
| 43 |
case PP_BALANCED: |
| 44 |
performance_scale -= 25; |
| 45 |
cfg->tcc_offset = TCC(90); |
| 46 |
break; |
| 47 |
case PP_PERFORMANCE: |
| 48 |
|
| 49 |
cfg->tcc_offset = TCC(100); |
| 50 |
break; |
| 51 |
} |
| 52 |
|
| 53 |
soc_conf_10core->tdp_pl1_override = (soc_conf_10core->tdp_pl1_override * performance_scale) / 100; |
| 54 |
soc_conf_10core->tdp_pl2_override = (soc_conf_10core->tdp_pl2_override * performance_scale) / 100; |
| 55 |
|
| 56 |
soc_conf_12core->tdp_pl1_override = (soc_conf_12core->tdp_pl1_override * performance_scale) / 100; |
| 57 |
soc_conf_12core->tdp_pl2_override = (soc_conf_12core->tdp_pl2_override * performance_scale) / 100; |
| 58 |
|
| 59 |
|
| 60 |
if (get_uint_option("wireless", 1) == 0) |
| 61 |
cfg->usb2_ports[9].enable = 0; |
| 62 |
|
| 63 |
|
| 64 |
if (get_uint_option("webcam", 1) == 0) |
| 65 |
cfg->usb2_ports[CONFIG_CCD_PORT].enable = 0; |
| 66 |
|
| 67 |
|
| 68 |
if (get_uint_option("fingerprint_reader", 1) == 0) |
| 69 |
cfg->usb2_ports[5].enable = 0; |
| 70 |
|
| 71 |
|
| 72 |
if (get_uint_option("card_reader", 1) == 0) |
| 73 |
cfg->usb2_ports[3].enable = 0; |
| 74 |
|
| 75 |
|
| 76 |
if (get_uint_option("gna", 0) == 0) |
| 77 |
gna_dev->enabled = 0; |
| 78 |
} |