Decrease pmc latency

This commit is contained in:
Jeremy Soller
2020-02-24 09:45:10 -07:00
parent 130ab9d61f
commit 83c224c229
3 changed files with 111 additions and 59 deletions

View File

@ -99,26 +99,43 @@ void main(void) {
uint32_t last_time = 0; uint32_t last_time = 0;
for(main_cycle = 0; ; main_cycle++) { for(main_cycle = 0; ; main_cycle++) {
uint32_t time = time_get(); switch (main_cycle % 5) {
case 0:
// Handle power states // Handle power states
power_event(); power_event();
// Scans keyboard and sends keyboard packets break;
kbscan_event(); case 1:
// Passes through touchpad packets // Scans keyboard and sends keyboard packets
touchpad_event(&PS2_3); kbscan_event();
// Handle lid close/open break;
lid_event(); case 2:
// Checks for keyboard/mouse packets from host // Passes through touchpad packets
kbc_event(&KBC); touchpad_event(&PS2_3);
// Only run the following once a second break;
if (last_time > time || (time - last_time) >= 1000) { case 3:
last_time = time; // Checks for keyboard/mouse packets from host
// Updates fan status and temps kbc_event(&KBC);
peci_event(); break;
// Updates battery status case 4:
battery_event(); // Handle lid close/open
lid_event();
break;
} }
if (main_cycle == 0) {
uint32_t time = time_get();
// Only run the following once a second
if (last_time > time || (time - last_time) >= 1000) {
last_time = time;
// Updates fan status and temps
peci_event();
// Updates battery status
battery_event();
}
}
// Handles ACPI communication // Handles ACPI communication
pmc_event(&PMC_1); pmc_event(&PMC_1);
// AP/EC communication over SMFI // AP/EC communication over SMFI

View File

@ -99,26 +99,43 @@ void main(void) {
uint32_t last_time = 0; uint32_t last_time = 0;
for(main_cycle = 0; ; main_cycle++) { for(main_cycle = 0; ; main_cycle++) {
uint32_t time = time_get(); switch (main_cycle % 5) {
case 0:
// Handle power states // Handle power states
power_event(); power_event();
// Scans keyboard and sends keyboard packets break;
kbscan_event(); case 1:
// Passes through touchpad packets // Scans keyboard and sends keyboard packets
touchpad_event(&PS2_3); kbscan_event();
// Handle lid close/open break;
lid_event(); case 2:
// Checks for keyboard/mouse packets from host // Passes through touchpad packets
kbc_event(&KBC); touchpad_event(&PS2_3);
// Only run the following once a second break;
if (last_time > time || (time - last_time) >= 1000) { case 3:
last_time = time; // Checks for keyboard/mouse packets from host
// Updates fan status and temps kbc_event(&KBC);
peci_event(); break;
// Updates battery status case 4:
battery_event(); // Handle lid close/open
lid_event();
break;
} }
if (main_cycle == 0) {
uint32_t time = time_get();
// Only run the following once a second
if (last_time > time || (time - last_time) >= 1000) {
last_time = time;
// Updates fan status and temps
peci_event();
// Updates battery status
battery_event();
}
}
// Handles ACPI communication // Handles ACPI communication
pmc_event(&PMC_1); pmc_event(&PMC_1);
// AP/EC communication over SMFI // AP/EC communication over SMFI

View File

@ -101,28 +101,46 @@ void main(void) {
uint32_t last_time = 0; uint32_t last_time = 0;
for(main_cycle = 0; ; main_cycle++) { for(main_cycle = 0; ; main_cycle++) {
uint32_t time = time_get(); switch (main_cycle % 5) {
case 0:
// Handle power states // Handle power states
power_event(); power_event();
// Scans keyboard and sends keyboard packets break;
kbscan_event(); case 1:
// Passes through touchpad packets // Scans keyboard and sends keyboard packets
touchpad_event(&PS2_3); kbscan_event();
// Handle lid close/open break;
lid_event(); case 2:
// Checks for keyboard/mouse packets from host // Passes through touchpad packets
kbc_event(&KBC); touchpad_event(&PS2_3);
// Only run the following once a second break;
if (last_time > time || (time - last_time) >= 1000) { case 3:
last_time = time; // Checks for keyboard/mouse packets from host
// Updates fan status and temps kbc_event(&KBC);
peci_event(); break;
// Updates battery status case 4:
battery_event(); // Handle lid close/open
// Updates type-c port lid_event();
tcpm_event(); break;
} }
if (main_cycle == 0) {
uint32_t time = time_get();
// Only run the following once a second
if (last_time > time || (time - last_time) >= 1000) {
last_time = time;
// Updates fan status and temps
peci_event();
// Updates battery status
battery_event();
// Updates type-c port
tcpm_event();
}
}
// Handles ACPI communication // Handles ACPI communication
pmc_event(&PMC_1); pmc_event(&PMC_1);
// AP/EC communication over SMFI // AP/EC communication over SMFI