| 1 |
|
| 2 |
|
| 3 |
#include <acpi/acpigen.h> |
| 4 |
#include <amdblocks/alib.h> |
| 5 |
#include <types.h> |
| 6 |
|
| 7 |
static void acpigen_dptc_call_alib(const char *buf_name, uint8_t *buffer, size_t size) |
| 8 |
{ |
| 9 |
|
| 10 |
acpigen_write_name(buf_name); |
| 11 |
acpigen_write_byte_buffer(buffer, size); |
| 12 |
|
| 13 |
|
| 14 |
acpigen_emit_namestring("\\_SB.ALIB"); |
| 15 |
acpigen_write_integer(ALIB_FUNCTION_DYNAMIC_POWER_THERMAL_CONFIG); |
| 16 |
acpigen_emit_namestring(buf_name); |
| 17 |
} |
| 18 |
|
| 19 |
void acpigen_write_alib_dptc_default(uint8_t *default_param, size_t default_param_len) |
| 20 |
{ |
| 21 |
|
| 22 |
acpigen_write_scope("\\_SB"); |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
acpigen_write_method_serialized("DDEF", 0); |
| 41 |
acpigen_write_debug_string("DPTC: Using normal SOC DPTC Settings."); |
| 42 |
acpigen_dptc_call_alib("DEFB", default_param, default_param_len); |
| 43 |
acpigen_write_method_end(); |
| 44 |
|
| 45 |
acpigen_write_scope_end(); |
| 46 |
} |
| 47 |
|
| 48 |
void acpigen_write_alib_dptc_no_battery(uint8_t *no_battery_param, size_t no_battery_param_len) |
| 49 |
{ |
| 50 |
|
| 51 |
acpigen_write_scope("\\_SB"); |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
acpigen_write_method_serialized("DTHL", 0); |
| 70 |
acpigen_write_debug_string("DPTC: Using low/no battery mode SOC DPTC settings."); |
| 71 |
acpigen_dptc_call_alib("THTL", no_battery_param, no_battery_param_len); |
| 72 |
acpigen_write_method_end(); |
| 73 |
|
| 74 |
acpigen_write_scope_end(); |
| 75 |
} |
| 76 |
|
| 77 |
void acpigen_write_alib_dptc_tablet(uint8_t *tablet_param, size_t tablet_param_len) |
| 78 |
{ |
| 79 |
|
| 80 |
acpigen_write_scope("\\_SB"); |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
acpigen_write_method_serialized("DTAB", 0); |
| 99 |
acpigen_write_debug_string("DPTC: Using tablet mode SOC DPTC Settings."); |
| 100 |
acpigen_dptc_call_alib("TABB", tablet_param, tablet_param_len); |
| 101 |
acpigen_write_method_end(); |
| 102 |
|
| 103 |
acpigen_write_scope_end(); |
| 104 |
} |
| 105 |
|
| 106 |
void acpigen_write_alib_dptc_thermal_B(uint8_t *thermal_param_B, size_t thermal_param_B_len) |
| 107 |
{ |
| 108 |
|
| 109 |
acpigen_write_scope("\\_SB"); |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
acpigen_write_method_serialized("DTTB", 0); |
| 128 |
acpigen_write_debug_string("DPTC: TABLE B"); |
| 129 |
acpigen_dptc_call_alib("THTB", thermal_param_B, thermal_param_B_len); |
| 130 |
acpigen_write_method_end(); |
| 131 |
|
| 132 |
acpigen_write_scope_end(); |
| 133 |
} |
| 134 |
|
| 135 |
void acpigen_write_alib_dptc_thermal_C(uint8_t *thermal_param_C, size_t thermal_param_C_len) |
| 136 |
{ |
| 137 |
|
| 138 |
acpigen_write_scope("\\_SB"); |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
acpigen_write_method_serialized("DTTC", 0); |
| 157 |
acpigen_write_debug_string("DPTC: TABLE C"); |
| 158 |
acpigen_dptc_call_alib("THTC", thermal_param_C, thermal_param_C_len); |
| 159 |
acpigen_write_method_end(); |
| 160 |
|
| 161 |
acpigen_write_scope_end(); |
| 162 |
} |
| 163 |
|
| 164 |
void acpigen_write_alib_dptc_thermal_D(uint8_t *thermal_param_D, size_t thermal_param_D_len) |
| 165 |
{ |
| 166 |
|
| 167 |
acpigen_write_scope("\\_SB"); |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
acpigen_write_method_serialized("DTTD", 0); |
| 186 |
acpigen_write_debug_string("DPTC: TABLE D"); |
| 187 |
acpigen_dptc_call_alib("THTD", thermal_param_D, thermal_param_D_len); |
| 188 |
acpigen_write_method_end(); |
| 189 |
|
| 190 |
acpigen_write_scope_end(); |
| 191 |
} |
| 192 |
|
| 193 |
void acpigen_write_alib_dptc_thermal_E(uint8_t *thermal_param_E, size_t thermal_param_E_len) |
| 194 |
{ |
| 195 |
|
| 196 |
acpigen_write_scope("\\_SB"); |
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
acpigen_write_method_serialized("DTTE", 0); |
| 215 |
acpigen_write_debug_string("DPTC: TABLE E"); |
| 216 |
acpigen_dptc_call_alib("THTE", thermal_param_E, thermal_param_E_len); |
| 217 |
acpigen_write_method_end(); |
| 218 |
|
| 219 |
acpigen_write_scope_end(); |
| 220 |
} |
| 221 |
|
| 222 |
void acpigen_write_alib_dptc_thermal_F(uint8_t *thermal_param_F, size_t thermal_param_F_len) |
| 223 |
{ |
| 224 |
|
| 225 |
acpigen_write_scope("\\_SB"); |
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
acpigen_write_method_serialized("DTTF", 0); |
| 244 |
acpigen_write_debug_string("DPTC: TABLE F"); |
| 245 |
acpigen_dptc_call_alib("THTF", thermal_param_F, thermal_param_F_len); |
| 246 |
acpigen_write_method_end(); |
| 247 |
|
| 248 |
acpigen_write_scope_end(); |
| 249 |
} |