| 1 |
|
| 2 |
|
| 3 |
#include <cpu/intel/turbo.h> |
| 4 |
#include <device/device.h> |
| 5 |
#include <device/pci_def.h> |
| 6 |
#include <option.h> |
| 7 |
#include <static.h> |
| 8 |
#include <types.h> |
| 9 |
#include <variants.h> |
| 10 |
|
| 11 |
#include "soc/intel/apollolake/chip.h" |
| 12 |
|
| 13 |
enum cmos_power_profile get_power_profile(enum cmos_power_profile fallback) |
| 14 |
{ |
| 15 |
const unsigned int power_profile = get_uint_option("power_profile", fallback); |
| 16 |
return power_profile < NUM_POWER_PROFILES ? power_profile : fallback; |
| 17 |
} |
| 18 |
|
| 19 |
void devtree_update(void) |
| 20 |
{ |
| 21 |
config_t *cfg = config_of_soc(); |
| 22 |
|
| 23 |
struct soc_power_limits_config *soc_conf = |
| 24 |
&cfg->power_limits_config; |
| 25 |
|
| 26 |
struct device *nic_dev = pcidev_on_root(0x0c, 0); |
| 27 |
|
| 28 |
uint8_t performance_scale = 100; |
| 29 |
|
| 30 |
|
| 31 |
soc_conf->tdp_pl4 = 31; |
| 32 |
|
| 33 |
|
| 34 |
soc_conf->tdp_pl1_override = (soc_conf->tdp_pl2_override / 2) & ~1; |
| 35 |
|
| 36 |
|
| 37 |
switch (get_power_profile(PP_POWER_SAVER)) { |
| 38 |
case PP_POWER_SAVER: |
| 39 |
performance_scale -= 25; |
| 40 |
cfg->tcc_offset = 15; |
| 41 |
break; |
| 42 |
case PP_BALANCED: |
| 43 |
|
| 44 |
cfg->tcc_offset = 10; |
| 45 |
break; |
| 46 |
case PP_PERFORMANCE: |
| 47 |
performance_scale += 25; |
| 48 |
cfg->tcc_offset = 5; |
| 49 |
break; |
| 50 |
} |
| 51 |
|
| 52 |
soc_conf->tdp_pl1_override = (soc_conf->tdp_pl1_override * performance_scale) / 100; |
| 53 |
soc_conf->tdp_pl2_override = (soc_conf->tdp_pl2_override * performance_scale) / 100; |
| 54 |
|
| 55 |
|
| 56 |
if (get_uint_option("wireless", 1) == 0) |
| 57 |
nic_dev->enabled = 0; |
| 58 |
|
| 59 |
|
| 60 |
cfg->usb2_port[CONFIG_WEBCAM_USB_PORT].enable = get_uint_option("webcam", 1); |
| 61 |
} |