From f4353b37be8710203a4a5788e80e8aeb0233d42d Mon Sep 17 00:00:00 2001 From: Bharat Nihalani Date: Tue, 30 Mar 2010 14:02:04 +0530 Subject: tegra-nvec: Report keystroke for the key that is used to wake up. With this change, display comes up with a single key press; but the catch is that it only works with "Windows" and "F3" keys. This limitation is posed by Android and not EC. NOTE that for other than "Windows" and "F3" key presses, the system does wake up, but an additional "Windows"/"F3" key press is still required to get the display up. Also, explicitly letting EC know that it should allow any keyboard/mouse event for wake-up. This is the default behavior, but still wanted to explicitly specify. Change-Id: I2a1e7d90fbbfd810f2334ee3832e193bfb5e45b1 Reviewed-on: http://git-master/r/986 Reviewed-by: Sachin Nikam Tested-by: Sachin Nikam Reviewed-by: Mayuresh Kulkarni Reviewed-by: Gary King --- arch/arm/mach-tegra/include/nvec.h | 1 + .../odm_kit/platform/keyboard/nvodm_keyboard.c | 27 ++++++++++++++++++++-- .../odm_kit/platform/mouse/nvodm_mouse.c | 3 ++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-tegra/include/nvec.h b/arch/arm/mach-tegra/include/nvec.h index 54c5b1873ec1..4bd934f74a71 100644 --- a/arch/arm/mach-tegra/include/nvec.h +++ b/arch/arm/mach-tegra/include/nvec.h @@ -1026,6 +1026,7 @@ typedef struct NvEcSleepGlobalConfigureEventReportingRequestPayloadRec typedef enum { NvEcKeyboardSubtype_ConfigureWake = 0x3, + NvEcKeyboardSubtype_ConfigureWakeKeyReport, NvEcKeyboardSubtype_Reset = 0xff, NvEcKeyboardSubtype_Enable = 0xf4, diff --git a/arch/arm/mach-tegra/odm_kit/platform/keyboard/nvodm_keyboard.c b/arch/arm/mach-tegra/odm_kit/platform/keyboard/nvodm_keyboard.c index cbbc0d8b03a2..86ba9cbc6083 100644 --- a/arch/arm/mach-tegra/odm_kit/platform/keyboard/nvodm_keyboard.c +++ b/arch/arm/mach-tegra/odm_kit/platform/keyboard/nvodm_keyboard.c @@ -176,16 +176,39 @@ NvBool NvOdmKeyboardInit(void) Request.RequestType = NvEcRequestResponseType_Keyboard; Request.RequestSubtype = (NvEcRequestResponseSubtype) NvEcKeyboardSubtype_ConfigureWake; - Request.NumPayloadBytes = 1; + Request.NumPayloadBytes = 2; Request.Payload[0] = NVEC_KEYBOARD_WAKE_ENABLE_0_ACTION_ENABLE; + Request.Payload[1] = NVEC_KEYBOARD_EVENT_TYPE_0_ANY_KEY_PRESS_ENABLE; NvStatus = NvEcSendRequest(s_NvEcHandle, &Request, &Response, sizeof(Request), sizeof(Response)); - if (NvStatus != NvError_Success) + if (NvStatus != NvError_Success) { + goto cleanup; + } + + if (Response.Status != NvEcStatus_Success) { goto cleanup; + } + + /* enable key reporting on wake up */ + Request.PacketType = NvEcPacketType_Request; + Request.RequestType = NvEcRequestResponseType_Keyboard; + Request.RequestSubtype = (NvEcRequestResponseSubtype) + NvEcKeyboardSubtype_ConfigureWakeKeyReport; + Request.NumPayloadBytes = 1; + Request.Payload[0] = NVEC_KEYBOARD_REPORT_WAKE_KEY_0_ACTION_ENABLE; + + NvStatus = NvEcSendRequest(s_NvEcHandle, + &Request, + &Response, + sizeof(Request), + sizeof(Response)); + if (NvStatus != NvError_Success) { + goto cleanup; + } if (Response.Status != NvEcStatus_Success) { goto cleanup; diff --git a/arch/arm/mach-tegra/odm_kit/platform/mouse/nvodm_mouse.c b/arch/arm/mach-tegra/odm_kit/platform/mouse/nvodm_mouse.c index 842564241273..a527ea540d55 100644 --- a/arch/arm/mach-tegra/odm_kit/platform/mouse/nvodm_mouse.c +++ b/arch/arm/mach-tegra/odm_kit/platform/mouse/nvodm_mouse.c @@ -206,8 +206,9 @@ NvOdmMouseDeviceOpen( (NV_DRF_NUM(NVEC,SUBTYPE,AUX_PORT_ID,hMouseDev->ValidMousePorts[i]))) | (NvEcRequestResponseSubtype) NvEcAuxDeviceSubtype_ConfigureWake; - Request.NumPayloadBytes = 1; + Request.NumPayloadBytes = 2; Request.Payload[0] = NVEC_AUX_DEVICE_WAKE_ENABLE_0_ACTION_ENABLE; + Request.Payload[1] = NVEC_AUX_DEVICE_EVENT_TYPE_0_ANY_EVENT_ENABLE; err = NvEcSendRequest( hMouseDev->hEc, -- cgit v1.2.3