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:
Jun Lin 2023-08-24 15:55:06 +08:00 committed by Carles Cufí
parent 4eb0b03a0f
commit 6e785a4886
9 changed files with 68 additions and 1 deletions

View file

@ -13,3 +13,9 @@
wakerx-gpios = <MCHP_GPIO_DECODE_155 GPIO_ACTIVE_HIGH>;
wakeup-source;
};
/ {
aliases {
ps2-port0 = &ps2_0;
};
};

View file

@ -13,3 +13,9 @@
wakerx-gpios = <MCHP_GPIO_DECODE_155 GPIO_ACTIVE_HIGH>;
wakeup-source;
};
/ {
aliases {
ps2-port0 = &ps2_0;
};
};

View file

@ -8,3 +8,9 @@
wakerx-gpios = <MCHP_GPIO_DECODE_115 GPIO_ACTIVE_HIGH>;
wakeup-source;
};
/ {
aliases {
ps2-port0 = &ps2_0;
};
};

View file

@ -0,0 +1,11 @@
/*
* Copyright (c) 2023 Microchip Technology Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
aliases {
ps2-port0 = &ps2_0;
};
};

View file

@ -0,0 +1,2 @@
CONFIG_CONSOLE=y
CONFIG_LOG=y

View 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";
};

View file

@ -0,0 +1,2 @@
CONFIG_CONSOLE=y
CONFIG_LOG=y

View 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";
};

View file

@ -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)
{