Skip to content

Commit

Permalink
Staging: initial version of the nvec driver
Browse files Browse the repository at this point in the history
This is an implementation of a NVidia compliant embedded controller
protocol driver. It is used on some ARM-Tegra boards for device
communication.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Marc Dietrich authored and Greg Kroah-Hartman committed May 19, 2011
1 parent 23a4231 commit 32890b9
Show file tree
Hide file tree
Showing 12 changed files with 1,543 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,7 @@ source "drivers/staging/altera-stapl/Kconfig"

source "drivers/staging/mei/Kconfig"

source "drivers/staging/nvec/Kconfig"

endif # !STAGING_EXCLUDE_BUILD
endif # STAGING
1 change: 1 addition & 0 deletions drivers/staging/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,4 @@ obj-$(CONFIG_TOUCHSCREEN_CLEARPAD_TM1217) += cptm1217/
obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += ste_rmi4/
obj-$(CONFIG_DRM_PSB) += gma500/
obj-$(CONFIG_INTEL_MEI) += mei/
obj-$(CONFIG_MFD_NVEC) += nvec/
27 changes: 27 additions & 0 deletions drivers/staging/nvec/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
config MFD_NVEC
bool "NV Tegra Embedded Controller SMBus Interface"
depends on I2C && GPIOLIB && ARCH_TEGRA
help
Say Y here to enable support for a nVidia compliant embedded
controller.

config KEYBOARD_NVEC
bool "Keyboard on nVidia compliant EC"
depends on MFD_NVEC
help
Say Y here to enable support for a keyboard connected to
a nVidia compliant embedded controller.

config SERIO_NVEC_PS2
bool "PS2 on nVidia EC"
depends on MFD_NVEC
help
Say Y here to enable support for a Touchpad / Mouse connected
to a nVidia compliant embedded controller.

config NVEC_POWER
bool "NVEC charger and battery"
depends on MFD_NVEC
help
Say Y to enable support for battery and charger interface for
nVidia compliant embedded controllers.
4 changes: 4 additions & 0 deletions drivers/staging/nvec/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
obj-$(CONFIG_SERIO_NVEC_PS2) += nvec_ps2.o
obj-$(CONFIG_MFD_NVEC) += nvec.o
obj-$(CONFIG_NVEC_POWER) += nvec_power.o
obj-$(CONFIG_KEYBOARD_NVEC) += nvec_kbd.o
14 changes: 14 additions & 0 deletions drivers/staging/nvec/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
NVEC: An NVidia compliant Embedded Controller Protocol Implemenation

This is an implementation of the NVEC protocol used to communicate with an
embedded controller (EC) via I2C bus. The EC is an I2C master while the host
processor is the I2C slave. Requests from the host processor to the EC are
started by triggering a gpio line.

There is no written documentation of the protocol available to the public,
but the source code[1] of the published nvec reference drivers can be a guide.
This driver is currently only used by the AC100 project[2], but it is likely,
that other Tegra boards (not yet mainlined, if ever) also use it.

[1] e.g. http://nv-tegra.nvidia.com/gitweb/?p=linux-2.6.git;a=tree;f=arch/arm/mach-tegra/nvec;hb=android-tegra-2.6.32
[2] http://gitorious.org/ac100, http://launchpad.net/ac100
8 changes: 8 additions & 0 deletions drivers/staging/nvec/TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ToDo list (incomplete, unordered)
- convert mouse, keyboard, and power to platform devices
- add copyright / driver author / license
- add compile as module support
- move nvec devices to mfd cells?
- adjust to kernel style


266 changes: 266 additions & 0 deletions drivers/staging/nvec/nvec-keytable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
/*
* drivers/input/keyboard/tegra-nvec.c
*
* Keyboard class input driver for keyboards connected to an NvEc compliant
* embedded controller
*
* Copyright (c) 2009, NVIDIA Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

static unsigned short code_tab_102us[] = {
KEY_GRAVE, // 0x00
KEY_ESC,
KEY_1,
KEY_2,
KEY_3,
KEY_4,
KEY_5,
KEY_6,
KEY_7,
KEY_8,
KEY_9,
KEY_0,
KEY_MINUS,
KEY_EQUAL,
KEY_BACKSPACE,
KEY_TAB,
KEY_Q, // 0x10
KEY_W,
KEY_E,
KEY_R,
KEY_T,
KEY_Y,
KEY_U,
KEY_I,
KEY_O,
KEY_P,
KEY_LEFTBRACE,
KEY_RIGHTBRACE,
KEY_ENTER,
KEY_LEFTCTRL,
KEY_A,
KEY_S,
KEY_D, // 0x20
KEY_F,
KEY_G,
KEY_H,
KEY_J,
KEY_K,
KEY_L,
KEY_SEMICOLON,
KEY_APOSTROPHE,
KEY_GRAVE,
KEY_LEFTSHIFT,
KEY_BACKSLASH,
KEY_Z,
KEY_X,
KEY_C,
KEY_V,
KEY_B, // 0x30
KEY_N,
KEY_M,
KEY_COMMA,
KEY_DOT,
KEY_SLASH,
KEY_RIGHTSHIFT,
KEY_KPASTERISK,
KEY_LEFTALT,
KEY_SPACE,
KEY_CAPSLOCK,
KEY_F1,
KEY_F2,
KEY_F3,
KEY_F4,
KEY_F5,
KEY_F6, // 0x40
KEY_F7,
KEY_F8,
KEY_F9,
KEY_F10,
KEY_FN,
0, //VK_SCROLL
KEY_KP7,
KEY_KP8,
KEY_KP9,
KEY_KPMINUS,
KEY_KP4,
KEY_KP5,
KEY_KP6,
KEY_KPPLUS,
KEY_KP1,
KEY_KP2, // 0x50
KEY_KP3,
KEY_KP0,
KEY_KPDOT,
KEY_MENU, //VK_SNAPSHOT
KEY_POWER,
KEY_102ND, //VK_OEM_102 henry+ 0x2B (43) BACKSLASH have been used,change to use 0X56 (86)
KEY_F11, //VK_F11
KEY_F12, //VK_F12
0,
0,
0,
0,
0,
0,
0,
0, // 60
0,
0,
KEY_SEARCH, // add search key map
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0, // 70
0,
0,
KEY_KP5, //73 for JP keyboard '\' key, report 0x4c
0,
0,
0,
0,
0,
0,
0,
0,
0,
KEY_KP9, //7d for JP keyboard '|' key, report 0x49
};

static unsigned short extcode_tab_us102[] = {
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0, // 0xE0 0x10
0,
0,
0,
0,
0,
0,
0,
0,
0, //VK_MEDIA_NEXT_TRACK,
0,
0,
0, //VK_RETURN,
KEY_RIGHTCTRL, //VK_RCONTROL,
0,
0,
KEY_MUTE, // 0xE0 0x20
0, //VK_LAUNCH_APP1
0, //VK_MEDIA_PLAY_PAUSE
0,
0, //VK_MEDIA_STOP
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
KEY_VOLUMEUP, // 0xE0 0x30
0,
0, //VK_BROWSER_HOME
0,
0,
KEY_KPSLASH, //VK_DIVIDE
0,
KEY_SYSRQ, //VK_SNAPSHOT
KEY_RIGHTALT, //VK_RMENU
0, //VK_OEM_NV_BACKLIGHT_UP
0, //VK_OEM_NV_BACKLIGHT_DN
0, //VK_OEM_NV_BACKLIGHT_AUTOTOGGLE
0, //VK_OEM_NV_POWER_INFO
0, //VK_OEM_NV_WIFI_TOGGLE
0, //VK_OEM_NV_DISPLAY_SELECT
0, //VK_OEM_NV_AIRPLANE_TOGGLE
0, //0xE0 0x40
KEY_LEFT, //VK_OEM_NV_RESERVED henry+ for JP keyboard
0, //VK_OEM_NV_RESERVED
0, //VK_OEM_NV_RESERVED
0, //VK_OEM_NV_RESERVED
0, //VK_OEM_NV_RESERVED
KEY_CANCEL,
KEY_HOME,
KEY_UP,
KEY_PAGEUP, //VK_PRIOR
0,
KEY_LEFT,
0,
KEY_RIGHT,
0,
KEY_END,
KEY_DOWN, // 0xE0 0x50
KEY_PAGEDOWN, //VK_NEXT
KEY_INSERT,
KEY_DELETE,
0,
0,
0,
0,
0,
0,
0,
KEY_LEFTMETA, //VK_LWIN
0, //VK_RWIN
KEY_ESC, //VK_APPS
KEY_KPMINUS, //for power button workaround
0,
0,
0,
0,
0,
0,
0, //VK_BROWSER_SEARCH
0, //VK_BROWSER_FAVORITES
0, //VK_BROWSER_REFRESH
0, //VK_BROWSER_STOP
0, //VK_BROWSER_FORWARD
0, //VK_BROWSER_BACK
0, //VK_LAUNCH_APP2
0, //VK_LAUNCH_MAIL
0, //VK_LAUNCH_MEDIA_SELECT
};

static unsigned short* code_tabs[] = {code_tab_102us, extcode_tab_us102 };
Loading

0 comments on commit 32890b9

Please sign in to comment.