sample: driver: ps2: use aliases to select the ps2 instance
This sample uses the DEVICE_DT_GET_ONE(COMPAT) to select the ps2 device for a specific chip. This commit changes it to use the aliases to let more chips which support the ps2 driver can build this sample. Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
This commit is contained in:
parent
4eb0b03a0f
commit
6e785a4886
|
@ -13,3 +13,9 @@
|
|||
wakerx-gpios = <MCHP_GPIO_DECODE_155 GPIO_ACTIVE_HIGH>;
|
||||
wakeup-source;
|
||||
};
|
||||
|
||||
/ {
|
||||
aliases {
|
||||
ps2-port0 = &ps2_0;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -13,3 +13,9 @@
|
|||
wakerx-gpios = <MCHP_GPIO_DECODE_155 GPIO_ACTIVE_HIGH>;
|
||||
wakeup-source;
|
||||
};
|
||||
|
||||
/ {
|
||||
aliases {
|
||||
ps2-port0 = &ps2_0;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -8,3 +8,9 @@
|
|||
wakerx-gpios = <MCHP_GPIO_DECODE_115 GPIO_ACTIVE_HIGH>;
|
||||
wakeup-source;
|
||||
};
|
||||
|
||||
/ {
|
||||
aliases {
|
||||
ps2-port0 = &ps2_0;
|
||||
};
|
||||
};
|
||||
|
|
11
samples/drivers/ps2/boards/mec172xmodular_assy6930.overlay
Normal file
11
samples/drivers/ps2/boards/mec172xmodular_assy6930.overlay
Normal file
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Microchip Technology Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/ {
|
||||
aliases {
|
||||
ps2-port0 = &ps2_0;
|
||||
};
|
||||
};
|
2
samples/drivers/ps2/boards/npcx7m6fb_evb.conf
Normal file
2
samples/drivers/ps2/boards/npcx7m6fb_evb.conf
Normal file
|
@ -0,0 +1,2 @@
|
|||
CONFIG_CONSOLE=y
|
||||
CONFIG_LOG=y
|
17
samples/drivers/ps2/boards/npcx7m6fb_evb.overlay
Normal file
17
samples/drivers/ps2/boards/npcx7m6fb_evb.overlay
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Nuvoton Technology Corporation.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/ {
|
||||
aliases {
|
||||
ps2-port0 = &ps2_channel0;
|
||||
};
|
||||
};
|
||||
|
||||
&ps2_channel0 {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&ps2_0_dat_clk_gp67_70>;
|
||||
pinctrl-names = "default";
|
||||
};
|
2
samples/drivers/ps2/boards/npcx9m6f_evb.conf
Normal file
2
samples/drivers/ps2/boards/npcx9m6f_evb.conf
Normal file
|
@ -0,0 +1,2 @@
|
|||
CONFIG_CONSOLE=y
|
||||
CONFIG_LOG=y
|
17
samples/drivers/ps2/boards/npcx9m6f_evb.overlay
Normal file
17
samples/drivers/ps2/boards/npcx9m6f_evb.overlay
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Nuvoton Technology Corporation.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/ {
|
||||
aliases {
|
||||
ps2-port0 = &ps2_channel0;
|
||||
};
|
||||
};
|
||||
|
||||
&ps2_channel0 {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&ps2_0_dat_clk_gp67_70>;
|
||||
pinctrl-names = "default";
|
||||
};
|
|
@ -34,7 +34,7 @@ K_MSGQ_DEFINE(aux_to_host_queue, sizeof(uint8_t), 8, 4);
|
|||
K_TIMER_DEFINE(block_ps2_timer, saturate_ps2, NULL);
|
||||
|
||||
static const struct device *const ps2_0_dev =
|
||||
DEVICE_DT_GET_ONE(microchip_xec_ps2);
|
||||
DEVICE_DT_GET(DT_ALIAS(ps2_port0));
|
||||
|
||||
static void saturate_ps2(struct k_timer *timer)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue