summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/link/board.h2
-rw-r--r--chip/lm4/keyboard_raw.c4
-rw-r--r--chip/lm4/switch.c4
-rw-r--r--include/chipset.h9
-rw-r--r--include/keyboard_scan.h11
5 files changed, 27 insertions, 3 deletions
diff --git a/board/link/board.h b/board/link/board.h
index 8200a53379..7d3c7c1ceb 100644
--- a/board/link/board.h
+++ b/board/link/board.h
@@ -23,7 +23,9 @@
#define CONFIG_CHIPSET_X86
#endif
#define CONFIG_EXTPOWER_GPIO
+#ifdef CONFIG_TASK_KEYPROTO
#define CONFIG_KEYBOARD_PROTOCOL_8042
+#endif
#define CONFIG_LID_SWITCH
#define CONFIG_LPC
#define CONFIG_ONEWIRE
diff --git a/chip/lm4/keyboard_raw.c b/chip/lm4/keyboard_raw.c
index 0db2766773..2104bd08a9 100644
--- a/chip/lm4/keyboard_raw.c
+++ b/chip/lm4/keyboard_raw.c
@@ -51,7 +51,7 @@ void keyboard_raw_task_start(void)
task_enable_irq(KB_SCAN_ROW_IRQ);
}
-void keyboard_raw_drive_column(int col)
+test_mockable void keyboard_raw_drive_column(int col)
{
if (col == KEYBOARD_COLUMN_NONE) {
/* Tri-state all outputs */
@@ -72,7 +72,7 @@ void keyboard_raw_drive_column(int col)
}
}
-int keyboard_raw_read_rows(void)
+test_mockable int keyboard_raw_read_rows(void)
{
/* Bits are active-low, so invert returned levels */
return LM4_GPIO_DATA(KB_SCAN_ROW_GPIO, 0xff) ^ 0xff;
diff --git a/chip/lm4/switch.c b/chip/lm4/switch.c
index e02489c806..76e28c95fd 100644
--- a/chip/lm4/switch.c
+++ b/chip/lm4/switch.c
@@ -191,7 +191,9 @@ static void power_button_pressed(uint64_t tnow)
pwrbtn_state = PWRBTN_STATE_PRESSED;
tnext_state = tnow;
*memmap_switches |= EC_SWITCH_POWER_BUTTON_PRESSED;
+#ifdef CONFIG_TASK_KEYPROTO
keyboard_set_power_button(1);
+#endif
host_set_single_event(EC_HOST_EVENT_POWER_BUTTON);
}
@@ -210,7 +212,9 @@ static void power_button_released(uint64_t tnow)
pwrbtn_state = PWRBTN_STATE_RELEASED;
tnext_state = tnow;
*memmap_switches &= ~EC_SWITCH_POWER_BUTTON_PRESSED;
+#ifdef CONFIG_TASK_KEYPROTO
keyboard_set_power_button(0);
+#endif
}
/**
diff --git a/include/chipset.h b/include/chipset.h
index d05eadec5a..bebd3f4553 100644
--- a/include/chipset.h
+++ b/include/chipset.h
@@ -51,7 +51,7 @@ static inline int chipset_in_state(int state_mask)
}
#endif
-
+#ifdef CONFIG_TASK_CHIPSET
/**
* Ask the chipset to exit the hard off state.
*
@@ -59,6 +59,9 @@ static inline int chipset_in_state(int state_mask)
* state to begin with.
*/
void chipset_exit_hard_off(void);
+#else
+static inline void chipset_exit_hard_off(void) { }
+#endif
/**
* Enable/disable CPU throttling.
@@ -67,6 +70,7 @@ void chipset_exit_hard_off(void);
*/
void chipset_throttle_cpu(int throttle);
+#ifdef CONFIG_TASK_CHIPSET
/**
* Immedaitely shut off power to main processor and chipset.
*
@@ -74,6 +78,9 @@ void chipset_throttle_cpu(int throttle);
* critical.
*/
void chipset_force_shutdown(void);
+#else
+static inline void chipset_force_shutdown(void) { }
+#endif
/**
* Reset the CPU and/or chipset.
diff --git a/include/keyboard_scan.h b/include/keyboard_scan.h
index e775477421..fb5cb5dde0 100644
--- a/include/keyboard_scan.h
+++ b/include/keyboard_scan.h
@@ -51,12 +51,19 @@ enum boot_key {
BOOT_KEY_OTHER = -1, /* None of the above */
};
+#ifdef CONFIG_TASK_KEYSCAN
/**
* Return the key held down at boot time in addition to the keyboard-controlled
* reset keys. Returns BOOT_KEY_OTHER if none of the keys specifically checked
* was pressed, or reset was not caused by a keyboard-controlled reset.
*/
enum boot_key keyboard_scan_get_boot_key(void);
+#else
+static inline enum boot_key keyboard_scan_get_boot_key(void)
+{
+ return BOOT_KEY_NONE;
+}
+#endif
/**
* Return a pointer to the current debounced keyboard matrix state, which is
@@ -64,10 +71,14 @@ enum boot_key keyboard_scan_get_boot_key(void);
*/
const uint8_t *keyboard_scan_get_state(void);
+#ifdef CONFIG_TASK_KEYSCAN
/**
* Enables/disables keyboard matrix scan.
*/
void keyboard_scan_enable(int enable);
+#else
+static inline void keyboard_scan_enable(int enable) { }
+#endif
#ifdef CONFIG_KEYBOARD_SUPPRESS_NOISE
/**