Skip to content

Commit d1d49ce

Browse files
committed
drivers: ps2: Added gpio bit-banging driver
1 parent 3d0d1bf commit d1d49ce

File tree

5 files changed

+1644
-0
lines changed

5 files changed

+1644
-0
lines changed

drivers/ps2/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ zephyr_library_sources_ifdef(CONFIG_PS2_XEC ps2_mchp_xec.c)
66
zephyr_library_sources_ifdef(CONFIG_USERSPACE ps2_handlers.c)
77
zephyr_library_sources_ifdef(CONFIG_PS2_NPCX ps2_npcx_channel.c)
88
zephyr_library_sources_ifdef(CONFIG_PS2_NPCX ps2_npcx_controller.c)
9+
zephyr_library_sources_ifdef(CONFIG_PS2_GPIO ps2_gpio.c)

drivers/ps2/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ if PS2
1212

1313
source "drivers/ps2/Kconfig.xec"
1414
source "drivers/ps2/Kconfig.npcx"
15+
source "drivers/ps2/Kconfig.gpio"
1516

1617
module = PS2
1718
module-str = ps2

drivers/ps2/Kconfig.gpio

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright (c) 2017 Linaro Ltd.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
DT_COMPAT_PS2_GPIO := gpio-ps2
5+
6+
config PS2_GPIO
7+
bool "GPIO bit banging PS/2 support"
8+
default $(dt_compat_enabled,$(DT_COMPAT_PS2_GPIO))
9+
help
10+
Enable software driven (bit banging) PS/2 support using GPIO pins
11+
12+
if PS2_GPIO
13+
14+
# PS/2 events must be processed within 30-50us. Therefore we shift the
15+
# BT_CTLR_LLL_PRIO from 0 to 1 and BT_CTLR_ULL_* priorities from 1 to 2.
16+
# We then set the gpio priority to 0.
17+
#
18+
# On top of this, the following has to be added to the device tree:
19+
# &gpiote {
20+
# interrupts = < 0x6 0 >;
21+
# };
22+
#
23+
# This allows the PS/2 interrupts to be triggered in time.
24+
25+
config BT_CTLR_ADVANCED_FEATURES
26+
default y
27+
28+
config BT_CTLR_LLL_PRIO
29+
default 1
30+
31+
config BT_CTLR_ULL_HIGH_PRIO
32+
default 2
33+
34+
config BT_CTLR_ULL_LOW_PRIO
35+
default 2
36+
37+
config PS2_GPIO_INTERRUPT_LOG_ENABLED
38+
bool "Enable extensive interrupt logging."
39+
default n
40+
41+
endif # PS2_GPIO

0 commit comments

Comments
 (0)