Skip to content

Commit

Permalink
drivers: ps2: Added gpio bit-banging driver
Browse files Browse the repository at this point in the history
  • Loading branch information
infused-kim committed Oct 4, 2023
1 parent 3d0d1bf commit d1d49ce
Show file tree
Hide file tree
Showing 5 changed files with 1,644 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/ps2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ zephyr_library_sources_ifdef(CONFIG_PS2_XEC ps2_mchp_xec.c)
zephyr_library_sources_ifdef(CONFIG_USERSPACE ps2_handlers.c)
zephyr_library_sources_ifdef(CONFIG_PS2_NPCX ps2_npcx_channel.c)
zephyr_library_sources_ifdef(CONFIG_PS2_NPCX ps2_npcx_controller.c)
zephyr_library_sources_ifdef(CONFIG_PS2_GPIO ps2_gpio.c)
1 change: 1 addition & 0 deletions drivers/ps2/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ if PS2

source "drivers/ps2/Kconfig.xec"
source "drivers/ps2/Kconfig.npcx"
source "drivers/ps2/Kconfig.gpio"

module = PS2
module-str = ps2
Expand Down
41 changes: 41 additions & 0 deletions drivers/ps2/Kconfig.gpio
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2017 Linaro Ltd.
# SPDX-License-Identifier: Apache-2.0

DT_COMPAT_PS2_GPIO := gpio-ps2

config PS2_GPIO
bool "GPIO bit banging PS/2 support"
default $(dt_compat_enabled,$(DT_COMPAT_PS2_GPIO))
help
Enable software driven (bit banging) PS/2 support using GPIO pins

if PS2_GPIO

# PS/2 events must be processed within 30-50us. Therefore we shift the
# BT_CTLR_LLL_PRIO from 0 to 1 and BT_CTLR_ULL_* priorities from 1 to 2.
# We then set the gpio priority to 0.
#
# On top of this, the following has to be added to the device tree:
# &gpiote {
# interrupts = < 0x6 0 >;
# };
#
# This allows the PS/2 interrupts to be triggered in time.

config BT_CTLR_ADVANCED_FEATURES
default y

config BT_CTLR_LLL_PRIO
default 1

config BT_CTLR_ULL_HIGH_PRIO
default 2

config BT_CTLR_ULL_LOW_PRIO
default 2

config PS2_GPIO_INTERRUPT_LOG_ENABLED
bool "Enable extensive interrupt logging."
default n

endif # PS2_GPIO
Loading

0 comments on commit d1d49ce

Please sign in to comment.