From: Leif Lindholm <leif.lindholm@linaro.org>
To: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: edk2-devel@lists.01.org, Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: [PATCH v6 edk2-platforms 6/6] Platform/HiKey: enable virtual keyboard
Date: Fri, 25 May 2018 19:39:09 +0100 [thread overview]
Message-ID: <20180525183909.2uyppjenl2hpy6cv@bivouac.eciton.net> (raw)
In-Reply-To: <1527122790-23592-7-git-send-email-haojian.zhuang@linaro.org>
On Thu, May 24, 2018 at 08:46:30AM +0800, Haojian Zhuang wrote:
> Enable virtual keyboard on HiKey platform. It detects the pattern
> in memory and GPIO pin setting, and simulates them into virtual
> key.
>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
I think I already gave you a reviewed-by for this one for v4.
/
Leif
> ---
> Platform/Hisilicon/HiKey/HiKey.dsc | 5 ++
> Platform/Hisilicon/HiKey/HiKey.fdf | 5 ++
> Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf | 5 ++
> Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.h | 5 ++
> Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c | 93 ++++++++++++++++++++
> 5 files changed, 113 insertions(+)
>
> diff --git a/Platform/Hisilicon/HiKey/HiKey.dsc b/Platform/Hisilicon/HiKey/HiKey.dsc
> index 5cc4ff27f01b..83dd68a820b1 100644
> --- a/Platform/Hisilicon/HiKey/HiKey.dsc
> +++ b/Platform/Hisilicon/HiKey/HiKey.dsc
> @@ -192,6 +192,11 @@ [Components.common]
> Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf
> ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
>
> + #
> + # Virtual Keyboard
> + #
> + EmbeddedPkg/Drivers/VirtualKeyboardDxe/VirtualKeyboardDxe.inf
> +
> Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
>
> #
> diff --git a/Platform/Hisilicon/HiKey/HiKey.fdf b/Platform/Hisilicon/HiKey/HiKey.fdf
> index 39020d27dbcd..2bca7232b6e5 100644
> --- a/Platform/Hisilicon/HiKey/HiKey.fdf
> +++ b/Platform/Hisilicon/HiKey/HiKey.fdf
> @@ -123,6 +123,11 @@ [FV.FvMain]
> INF Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf
> INF ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
>
> + #
> + # Virtual Keyboard
> + #
> + INF EmbeddedPkg/Drivers/VirtualKeyboardDxe/VirtualKeyboardDxe.inf
> +
> INF Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
>
> #
> diff --git a/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
> index 34734391b45a..41aa7f8081ed 100644
> --- a/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
> +++ b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
> @@ -28,11 +28,16 @@ [Packages]
> MdePkg/MdePkg.dec
>
> [LibraryClasses]
> + CacheMaintenanceLib
> DebugLib
> IoLib
> UefiLib
> UefiDriverEntryPoint
>
> +[Protocols]
> + gEmbeddedGpioProtocolGuid
> + gPlatformVirtualKeyboardProtocolGuid
> +
> [Guids]
> gEfiEndOfDxeEventGroupGuid
>
> diff --git a/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.h b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.h
> index 07f9ae6a949a..3d608183fa58 100644
> --- a/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.h
> +++ b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.h
> @@ -15,10 +15,15 @@
> #ifndef __HIKEYDXE_H__
> #define __HIKEYDXE_H__
>
> +#include <Library/CacheMaintenanceLib.h>
> #include <Library/DebugLib.h>
> #include <Library/IoLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> #include <Library/UefiLib.h>
>
> +#include <Protocol/EmbeddedGpio.h>
> +#include <Protocol/PlatformVirtualKeyboard.h>
> +
> #include <Hi6220.h>
> #include <Hi6220RegsPeri.h>
>
> diff --git a/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c
> index b812f8bd483d..afd2f050896a 100644
> --- a/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c
> +++ b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c
> @@ -43,6 +43,8 @@ UartInit (
> MmioWrite32 (PMUSSI_ONOFF8_REG, Val);
> }
>
> +STATIC EMBEDDED_GPIO *mGpio;
> +
> STATIC
> VOID
> MtcmosInit (
> @@ -87,6 +89,90 @@ HiKeyInitPeripherals (
>
> EFI_STATUS
> EFIAPI
> +VirtualKeyboardRegister (
> + IN VOID
> + )
> +{
> + EFI_STATUS Status;
> +
> + Status = gBS->LocateProtocol (
> + &gEmbeddedGpioProtocolGuid,
> + NULL,
> + (VOID **) &mGpio
> + );
> + if (EFI_ERROR (Status)) {
> + return Status;
> + }
> + return EFI_SUCCESS;
> +}
> +
> +EFI_STATUS
> +EFIAPI
> +VirtualKeyboardReset (
> + IN VOID
> + )
> +{
> + EFI_STATUS Status;
> +
> + if (mGpio == NULL) {
> + return EFI_INVALID_PARAMETER;
> + }
> + Status = mGpio->Set (mGpio, DETECT_J15_FASTBOOT, GPIO_MODE_INPUT);
> + return Status;
> +}
> +
> +BOOLEAN
> +EFIAPI
> +VirtualKeyboardQuery (
> + IN VIRTUAL_KBD_KEY *VirtualKey
> + )
> +{
> + EFI_STATUS Status;
> + UINTN Value = 0;
> +
> + if ((VirtualKey == NULL) || (mGpio == NULL)) {
> + return FALSE;
> + }
> + if (MmioRead32 (ADB_REBOOT_ADDRESS) == ADB_REBOOT_BOOTLOADER) {
> + goto Done;
> + } else {
> + Status = mGpio->Get (mGpio, DETECT_J15_FASTBOOT, &Value);
> + if (EFI_ERROR (Status) || (Value != 0)) {
> + return FALSE;
> + }
> + }
> +Done:
> + VirtualKey->Signature = VIRTUAL_KEYBOARD_KEY_SIGNATURE;
> + VirtualKey->Key.ScanCode = SCAN_NULL;
> + VirtualKey->Key.UnicodeChar = L'f';
> + return TRUE;
> +}
> +
> +EFI_STATUS
> +EFIAPI
> +VirtualKeyboardClear (
> + IN VIRTUAL_KBD_KEY *VirtualKey
> + )
> +{
> + if (VirtualKey == NULL) {
> + return EFI_INVALID_PARAMETER;
> + }
> + if (MmioRead32 (ADB_REBOOT_ADDRESS) == ADB_REBOOT_BOOTLOADER) {
> + MmioWrite32 (ADB_REBOOT_ADDRESS, ADB_REBOOT_NONE);
> + WriteBackInvalidateDataCacheRange ((VOID *)ADB_REBOOT_ADDRESS, 4);
> + }
> + return EFI_SUCCESS;
> +}
> +
> +PLATFORM_VIRTUAL_KBD_PROTOCOL mVirtualKeyboard = {
> + VirtualKeyboardRegister,
> + VirtualKeyboardReset,
> + VirtualKeyboardQuery,
> + VirtualKeyboardClear
> +};
> +
> +EFI_STATUS
> +EFIAPI
> HiKeyEntryPoint (
> IN EFI_HANDLE ImageHandle,
> IN EFI_SYSTEM_TABLE *SystemTable
> @@ -98,5 +184,12 @@ HiKeyEntryPoint (
> if (EFI_ERROR (Status)) {
> return Status;
> }
> +
> + Status = gBS->InstallProtocolInterface (
> + &ImageHandle,
> + &gPlatformVirtualKeyboardProtocolGuid,
> + EFI_NATIVE_INTERFACE,
> + &mVirtualKeyboard
> + );
> return Status;
> }
> --
> 2.7.4
>
prev parent reply other threads:[~2018-05-25 18:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-24 0:46 [PATCH v6 edk2-platforms 0/6] enable virtual keyboards Haojian Zhuang
2018-05-24 0:46 ` [PATCH v6 edk2-platforms 1/6] Platform/Hisilicon/HiKey960: add gpio platform driver Haojian Zhuang
2018-05-24 0:46 ` [PATCH v6 edk2-platforms 2/6] Platform/HiKey960: do basic initialization Haojian Zhuang
2018-05-25 18:32 ` Leif Lindholm
2018-05-24 0:46 ` [PATCH v6 edk2-platforms 3/6] Platform/HiKey960: enable virtual keyboard Haojian Zhuang
2018-05-25 18:33 ` Leif Lindholm
2018-05-24 0:46 ` [PATCH v6 edk2-platforms 4/6] Platform/Hisilicon/HiKey: add gpio platform driver Haojian Zhuang
2018-05-24 0:46 ` [PATCH v6 edk2-platforms 5/6] Platform/HiKey: do basic initialization on hikey Haojian Zhuang
2018-05-25 18:37 ` Leif Lindholm
2018-05-24 0:46 ` [PATCH v6 edk2-platforms 6/6] Platform/HiKey: enable virtual keyboard Haojian Zhuang
2018-05-25 18:39 ` Leif Lindholm [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180525183909.2uyppjenl2hpy6cv@bivouac.eciton.net \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox