From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::244; helo=mail-wr0-x244.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 270002096966D for ; Fri, 25 May 2018 11:39:14 -0700 (PDT) Received: by mail-wr0-x244.google.com with SMTP id y15-v6so10759595wrg.11 for ; Fri, 25 May 2018 11:39:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gJINgBbIOW+N3zWXm1w500Xv+M0ghMBNZuBivtaCIOE=; b=Gcc06tRiEVwR6Mc1JeW1+TNu85uWEi8A2cSjDKaw6XkxXrVlwrh54kNxhOiX4j1xOP RwzvyGoCedHi6vwlny6vW3zdAcutjG4Nc2ISNh/meYHBXqzlgUKlla4YbcDHduIWoYer BG8rUUpfW6wvbVYUj4juaw6SNvZriUUQDAQBM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gJINgBbIOW+N3zWXm1w500Xv+M0ghMBNZuBivtaCIOE=; b=lcFQvLsLQIvq/3JGPjlWjBMW20m1OtboalKdXZDGYah9TGHFTDMoTLKaLYwpDfrT43 2Dkqyg87K/dSua/2UjPZaNaWO1Igw5NCyOsfHVWEIScwfRddvDK0iUoNDUiM6cLwbMQF zrjrzhGILAwXu9NVGGlmxD3gTn/OGKgmFIBa5iS2T70yoaYiuM3wDNZrEwCPE4skgXZS Zt1fo4P6oyBA+OkXA9Iupd7qxt3ujiSP4kao6wiDb1kusU9CStM1/xc/pP5Haq6nV4SF hu3+hnj4WpqcVi3isceaKNmnMalCTgN6z0KbQh/QpEMIyAHMJkG2kf3lwuc00wirXbuD dUMw== X-Gm-Message-State: ALKqPwfhdlPm+w9sF2a7/Nv8BbMSzFCsBL7Ybl7I32CUTiwgygY2mvgL HfLDtrKKO5p23v2i/aGkp6Ww884su8Y= X-Google-Smtp-Source: AB8JxZrHpdIkGzrO24vAoUGSKmoShYhvTz8nWbmSdmrq/wIFeT39iRPSGnKPVZzdmCD7kYZzaG24fw== X-Received: by 2002:adf:9561:: with SMTP id 88-v6mr2954754wrs.264.1527273552643; Fri, 25 May 2018 11:39:12 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id z18-v6sm30396807wrc.36.2018.05.25.11.39.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 May 2018 11:39:11 -0700 (PDT) Date: Fri, 25 May 2018 19:39:09 +0100 From: Leif Lindholm To: Haojian Zhuang Cc: edk2-devel@lists.01.org, Ard Biesheuvel Message-ID: <20180525183909.2uyppjenl2hpy6cv@bivouac.eciton.net> References: <1527122790-23592-1-git-send-email-haojian.zhuang@linaro.org> <1527122790-23592-7-git-send-email-haojian.zhuang@linaro.org> MIME-Version: 1.0 In-Reply-To: <1527122790-23592-7-git-send-email-haojian.zhuang@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH v6 edk2-platforms 6/6] Platform/HiKey: enable virtual keyboard X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 May 2018 18:39:14 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > Cc: Ard Biesheuvel > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Haojian Zhuang 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 > #include > #include > +#include > #include > > +#include > +#include > + > #include > #include > > 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 >