This is an update of the keyboard driver which Quanta previously posted to linux-input. Like the touchpad driver, I'm taking over maintenance for code aurora forum. The keyboard is attached to an embedded controller which is accessed through I2C. It has a dedicated I2C address and its own interrupt line, so it is not treated as an mfd. Although a PS/2 command, 0xF4, is used to initialize the keyboard, the EC does not respond to other PS/2 commands. I have tried a serio driver on the port and attempted to use keyboard drivers like xtkbd to communicate with it. These fail for similar reasons to those discussed in the qci touchpad thread. This is the reason for having this as a stand-alone driver. -- Neil -- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. --
This driver is for the QCI i2c keyboard used on Quanta smartbooks. Signed-off-by: Horace Fu <horace.fu@quantatw.com> [nleeder@codeaurora.org: cleanup to latest kernel standards] Signed-off-by: Neil Leeder <nleeder@codeaurora.org> --- drivers/input/keyboard/Kconfig | 12 ++ drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/qci_gkbd.c | 258 ++++++++++++++++++++++++++++++++++++ include/linux/input/qci_keyboard.h | 25 ++++ 4 files changed, 296 insertions(+), 0 deletions(-) create mode 100644 drivers/input/keyboard/qci_gkbd.c create mode 100644 include/linux/input/qci_keyboard.h diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 1ba2514..e610755 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig @@ -342,6 +342,18 @@ config KEYBOARD_PXA930_ROTARY To compile this driver as a module, choose M here: the module will be called pxa930_rotary. +config KEYBOARD_QCIGKBD + tristate "Quanta Computer Inc. keyboard" + depends on I2C + help + This driver supports the i2c keyboard on Quanta smartbook devices. + + Say Y here if you have a Quanta-based smartbook or notepad + device and want to use the Quanta i2c keyboard driver. + + To compile this driver as a module, choose M here: the + module will be called qci_gkbd. + config KEYBOARD_STOWAWAY tristate "Stowaway keyboard" select SERIO diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 4596d0c..103adc2 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile @@ -31,6 +31,7 @@ obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o obj-$(CONFIG_KEYBOARD_OPENCORES) += opencores-kbd.o obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keypad.o obj-$(CONFIG_KEYBOARD_PXA930_ROTARY) += pxa930_rotary.o +obj-$(CONFIG_KEYBOARD_QCIGKBD) += qci_gkbd.o obj-$(CONFIG_KEYBOARD_QT2160) += qt2160.o obj-$(CONFIG_KEYBOARD_SH_KEYSC) += sh_keysc.o obj-$(CONFIG_KEYBOARD_STOWAWAY) += ...
Hi Neil, If you are going to roll out new version of this patch to address the last comment from Dmitry, then I have couple of suggestions. If possible then please incorporate. Make EV_REP optional, not all the systems needs it by default. Better to introduce pdata->rep. Some of the systems would need each key press to wake up the system, so disable_irq in suspend would not be what they want. How about introducing pdata->wakeup flag and then using device_init_wakeup, device_may_wakeup, enable/disable_irq_wake friends in probe and .suspend/.resume functions. ---Trilok Soni -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. --
No, this is crazy... This is a twin-brother of the touchpad driver and I really do not understand why chip claiming to have PS/2 interface (3 ports if I were to believe the diagram) would not allow us talk to the devices... -- Dmitry --
I didn't provide a key bit of information, sorry. The keyboard is not attached to the EC's PS/2 port. It is on a matrix of GPIOs. I was trying to explain that even though the firmware on the EC uses 0xF4 written over i2c to initialize it, it doesn't appear to support other PS/2 commands directed to the keyboard on the GPIO matrix. -- Neil -- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. --
And still you are using only one GPIO in your driver? While WPCE775x does seem to have matrix keypad support I think that you are using one The device is initialized with 0xf4; the device is supposed to respond with 0xfa; I wonder what scancodes the device reports... It smells strongly of PS/2. Also, it is not controller that supports PS/2 commands but rather the device itself so I am still hopeful that we could make use of the standard drivers. Wan, you worked at Nuvoton, do you know if wpce775 fully supports PS/2 interface? -- Dmitry --
Hi Dmitry, I can assure you that the keyboard is on the 8*18 GPIO matrix on the Nuvoton EC (only 8*16 being used in the current design). There certainly are 3 PS/2 ports on the EC, but in the board designs I have only one of those is used as a PS/2 port, and that is for the touchpad. The other two ports are muxed with GPIOs and the pins are being used as GPIOs for other functions, not PS/2 ports. The firmware on the EC converts keypresses on the GPIO matrix to scancodes and sends them over I2C. The single GPIO used by the keyboard We can speculate on the reasons that the firmware on the EC uses 0xF4 & 0xFA for init and ack - my guess would be for a minimal amount of commonality with the PS/2 protocol - but it doesn't emulate the rest of the PS/2 protocol for the GPIO matrix device. I tried with atkbd. It issues reset, getid, setleds - all of which fail with no response from the EC. It only responds to F4. The scancodes reported are whatever the firmware provides. A previous version of firmware had some non-standard values and the driver had to use a look-up table to convert them to something useful. With the change to the current keyboard layout Quanta changed the scancodes reported to match the KEY_* values in input.h, which is why there is no table in the current driver. -- Neil -- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. --
I believe we still should support changing keymap via EVIOCSKEYCODE so we need to have the keymap even though the initial seed is 1:1 with scancodes. -- Dmitry --
Dmitry, Don't give up yet... I've been talking to Quanta and they are using a different EC in their new products, which should have better firmware support for serio over i2c. When I get the new hardware I will try again to overcome the issues that showed up on the previous firmware, and I'll submit new patches for both touchpad and keyboard. Thanks. -- Neil -- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. --
Hi Neil, Does this mean you are not interested in getting drivers for the current generation of hardware to mainline? Otherwise, please take a glance at these patches (I did some renaming/reformatting) and let me know if I broke them. The main question is whether 0xF5 works for shutting off the keyboard and the touchpad - I rather dislike that the drivers are asymmetrical in sense that they implement open() methods but not close(). Thanks. -- Dmitry
Hi Dmitry, That's correct - I don't think there is much future for the current hardware if we can come up with a cleaner solution for the new versions. I will test 0xF5 with the new hardware. I think we may still need a new keyboard driver, just rewritten to have a serio backend. If so, I will incorporate your changes as well as Trilok's review comments. Thanks for your reviews and code suggestions. -- Neil -- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. --
It would be great if newer hardware could make use of the atkbd driver (if it is going to use serio + PS/2 ports on the EC). Thanks. -- Dmitry --
