-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
driver: input: add input driver for rts5912 #86755
driver: input: add input driver for rts5912 #86755
Conversation
e0e0726
to
bd23873
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, just a couple of minor comments
@@ -17,6 +17,7 @@ | |||
zephyr,sram = &sram0; | |||
zephyr,console = &uart0; | |||
zephyr,flash = &flash0; | |||
zephyr,keyboard-scan = &kscan_input; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you drop this? this api is being removed in this release, sorry for the noise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
kscan_input: kscan-input { | ||
compatible = "zephyr,kscan-input"; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, drop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, drop it.
drivers/input/Kconfig.rts5912
Outdated
@@ -0,0 +1,10 @@ | |||
# Copyright (c) 2021 Realtek Corporation. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2025, happy new year :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy new year!
it's 2025
drivers/input/Kconfig.rts5912
Outdated
depends on DT_HAS_REALTEK_RTS5912_KBD_ENABLED | ||
select INPUT_KBD_MATRIX | ||
help | ||
This option enables the REALTEK keyboard scan driver. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realtek
? RealTek
? Pick one and stick to it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We picked RealTek here.
#define LOG_LEVEL CONFIG_INPUT_LOG_LEVEL | ||
LOG_MODULE_REGISTER(input_realtek_rts5912_kbd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOG_MODULE_REGISTER(input_realtek_rts5912_kbd, CONFIG_INPUT_LOG_LEVEL);
keep it compact
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
/* Set KSO output data */ | ||
key = irq_lock(); | ||
inst->SCANOUT = kso_val; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey just checking, inst->SCANOUT
is not going to change pins that are not mapped to the keyboad driver in pin control right? As in: if some of those pins are used as gpios, this should not be affecting them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We add the kso_ignore_mask to this function.
KBM_Type *const inst = config->base; | ||
|
||
/* Bits are active-low, so toggle it (return 1 means key pressed) */ | ||
return ((inst->SCANIN ^ data->ksi_pin_mask) & data->ksi_pin_mask); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you not just invert all the bits in the register all the time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, tks
BUILD_ASSERT(IN_RANGE(DT_INST_PROP(0, row_size), 1, 10), "invalid row-size"); | ||
BUILD_ASSERT(IN_RANGE(DT_INST_PROP(0, col_size), 1, 20), "invalid col-size"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10x20? that's a seriously big keyboard :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for review!
Our maximum keyboard can support kso19 and ksi9.
ff52039
to
d6a13c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabiobaltieri are there any tests or samples that this driver can be added to so that the module gets compiled by CI?
This should happen automatically since the device is instantiated in the board, at least in the weekly, but it also looks like the PR run here correctly built it as well, I see these in the junit file
|
soc/realtek/ec/rts5912/reg/reg_kbm.h
Outdated
* @brief Keyboard Matrix Controller (KBM) | ||
*/ | ||
|
||
typedef struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't create new typedefs. Use struct kbm_regs
or something similar. Also, make the entire structure volatile instead of the individual fields.
volatile struct kbm_regs *base;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks,
We change the way to define the kbm register and use volatile on the whole fields of the structure.
d6a13c7
to
85af136
Compare
soc/realtek/ec/rts5912/reg/reg_kbm.h
Outdated
uint32_t SCANOUT; | ||
uint32_t SCANIN; | ||
uint32_t INTEN; | ||
uint32_t CTRL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please snake case to match Zephyr coding style. Convert these fields to lower case.
https://docs.zephyrproject.org/latest/contribute/style/code.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks,
We use the snake case to name the variable.
85af136
to
8d6408c
Compare
Add input driver for Realtek rts5912. Signed-off-by: Lin Yu-Cheng <lin_yu_cheng@realtek.com>
8d6408c
to
faa0352
Compare
Add input driver for Realtek rts5912.