| 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 100 |
| 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 = &cfg->power_limits_config; |
| 20 |
|
| 21 |
struct device *nic_dev = pcidev_on_root(0x1c, 5); |
| 22 |
|
| 23 |
uint8_t performance_scale = 100; |
| 24 |
|
| 25 |
|
| 26 |
soc_conf->tdp_pl4 = 45; |
| 27 |
|
| 28 |
|
| 29 |
soc_conf->tdp_pl1_override = (soc_conf->tdp_pl2_override / 2) & ~1; |
| 30 |
|
| 31 |
|
| 32 |
switch (get_power_profile(PP_POWER_SAVER)) { |
| 33 |
case PP_POWER_SAVER: |
| 34 |
performance_scale -= 50; |
| 35 |
cfg->tcc_offset = TCC(80); |
| 36 |
break; |
| 37 |
case PP_BALANCED: |
| 38 |
performance_scale -= 25; |
| 39 |
cfg->tcc_offset = TCC(90); |
| 40 |
break; |
| 41 |
case PP_PERFORMANCE: |
| 42 |
|
| 43 |
cfg->tcc_offset = TCC(100); |
| 44 |
break; |
| 45 |
} |
| 46 |
|
| 47 |
soc_conf->tdp_pl1_override = (soc_conf->tdp_pl1_override * performance_scale) / 100; |
| 48 |
soc_conf->tdp_pl2_override = (soc_conf->tdp_pl2_override * performance_scale) / 100; |
| 49 |
|
| 50 |
|
| 51 |
if (get_uint_option("wireless", 1) == 0) |
| 52 |
nic_dev->enabled = 0; |
| 53 |
|
| 54 |
|
| 55 |
cfg->usb2_ports[CONFIG_CCD_PORT].enable = get_uint_option("webcam", 1); |
| 56 |
|
| 57 |
|
| 58 |
if (get_uint_option("card_reader", 1) == 0) |
| 59 |
cfg->usb2_ports[6].enable = 0; |
| 60 |
} |