Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset KBC on CPU reset #377

Merged
merged 2 commits into from
Jul 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/board/system76/common/include/board/kbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
extern uint8_t kbc_leds;

void kbc_init(void);
void kbc_reset(void);
bool kbc_scancode(uint16_t key, bool pressed);
void kbc_event(struct Kbc *kbc);

Expand Down
5 changes: 5 additions & 0 deletions src/board/system76/common/kbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ void kbc_init(void) {
// Set IRQ mode to level-triggered
*(KBC.irq) = 0;
#endif

kbc_reset();
}

void kbc_reset(void) {
// Set "key lock" to disabled
*(KBC.status) = BIT(4);
}
Expand Down
4 changes: 3 additions & 1 deletion src/board/system76/common/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <board/config.h>
#include <board/fan.h>
#include <board/gpio.h>
#include <board/kbc.h>
#include <board/kbled.h>
#include <board/lid.h>
#include <board/peci.h>
Expand Down Expand Up @@ -341,7 +342,8 @@ void power_cpu_reset(void) {
acpi_reset();
// Reset fans
fan_reset();
//TODO: reset KBC and touchpad states
//TODO: reset touchpad states
kbc_reset();
kbled_reset();
// Set PL4
//TODO: if this returns false, retry?
Expand Down
2 changes: 0 additions & 2 deletions src/ec/ite/include/ec/kbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include <stdbool.h>
#include <stdint.h>

void kbc_init(void);

struct Kbc {
// Control register
volatile uint8_t *control;
Expand Down