aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-google-hammer.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-04-01Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/inputLinus Torvalds1-26/+25
Pull input updates from Dmitry Torokhov: - a revert of a patch resetting extra buttons on touchpads claiming to be buttonpads as this caused regression on certain Dell devices - a new driver for Mediatek MT6779 keypad - a new driver for Imagis touchscreen - rework of Google/Chrome OS "Vivaldi" keyboard handling - assorted driver fixes. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (31 commits) Revert "Input: clear BTN_RIGHT/MIDDLE on buttonpads" Input: adi - remove redundant variable z Input: add Imagis touchscreen driver dt-bindings: input/touchscreen: bindings for Imagis Input: synaptics - enable InterTouch on ThinkPad T14/P14s Gen 1 AMD Input: stmfts - fix reference leak in stmfts_input_open Input: add bounds checking to input_set_capability() Input: iqs5xx - use local input_dev pointer HID: google: modify HID device groups of eel HID: google: Add support for vivaldi to hid-hammer HID: google: extract Vivaldi hid feature mapping for use in hid-hammer Input: extract ChromeOS vivaldi physmap show function HID: google: switch to devm when registering keyboard backlight LED Input: mt6779-keypad - fix signedness bug Input: mt6779-keypad - add MediaTek keypad driver dt-bindings: input: Add bindings for Mediatek matrix keypad Input: da9063 - use devm_delayed_work_autocancel() Input: goodix - fix race on driver unbind Input: goodix - use input_copy_abs() helper Input: add input_copy_abs() function ...
2022-03-14HID: google: modify HID device groups of eelZhengqiao Xia1-1/+1
If HID_GROUP of eel is set to HID_GROUP_GENERIC, Whiskers Tablet Mode Switch of eel hammer will not be detected by system because the hid-vivaldi driver probes the device. When it is set to HID_GROUP_VIVALDI, system will detect Whiskers Tablet Mode Switch successfully and also support the vivaldi keyboard layout. Tested-by: "Sean O'Brien" <seobrien@chromium.org> Acked-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Zhengqiao Xia <xiazhengqiao@huaqin.corp-partner.google.com> [swboyd@chromium.org: Expand on commit text] Signed-off-by: Stephen Boyd <swboyd@chromium.org> Tested-by: Stephen Boyd <swboyd@chromium.org> # coachz, wormdingler Link: https://lore.kernel.org/r/20220228075446.466016-6-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2022-03-14HID: google: Add support for vivaldi to hid-hammerStephen Boyd1-0/+11
Add support to the hammer driver to parse vivaldi keyboard layouts and expose them to userspace. This allows hammer devices to use vivaldi function row keys while also supporting the other features this driver supports, like the CBAS (chrome base attached switch) and a keyboard backlight. Signed-off-by: Stephen Boyd <swboyd@chromium.org> Tested-by: Stephen Boyd <swboyd@chromium.org> # coachz, wormdingler Link: https://lore.kernel.org/r/20220228075446.466016-5-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2022-03-14HID: google: switch to devm when registering keyboard backlight LEDDmitry Torokhov1-25/+13
We can use devm to register keyboard backlight LED on hammer devices, this will allow us to use HID's driver data for something else later. Link: https://lore.kernel.org/r/20220228075446.466016-2-dmitry.torokhov@gmail.com Tested-by: Stephen Boyd <swboyd@chromium.org> # coachz, wormdingler Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2022-02-02HID: google: Use struct_size() helper in kzalloc()Gustavo A. R. Silva1-1/+1
Make use of the struct_size() helper instead of an open-coded version, in order to avoid any potential type mistakes or integer overflows that, in the worst scenario, could lead to heap overflows. Also, address the following sparse warnings: drivers/hid/hid-google-hammer.c:61:23: warning: using sizeof on a flexible structure Link: https://github.com/KSPP/linux/issues/174 Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-12-03HID: google: add eel USB idxiazhengqiao1-0/+2
Add one additional hammer-like device. Signed-off-by: xiazhengqiao <xiazhengqiao@huaqin.corp-partner.google.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Link: https://lore.kernel.org/r/20211203030119.28612-1-xiazhengqiao@huaqin.corp-partner.google.com
2021-05-05HID: google: Add of_match table to Whiskers switch device.Ikjoon Jang1-0/+10
Add a device tree match table for "cros-cbas" switch device. Signed-off-by: Ikjoon Jang <ikjn@chromium.org> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-03-08HID: google: add don USB idShou-Chieh Hsu1-0/+2
Add 1 additional hammer-like device. Signed-off-by: Shou-Chieh Hsu <shouchieh@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-02-02HID: google: Get HID report on probe to confirm tablet switch stateNicolas Boichat1-19/+66
This forces reading the base folded state anytime the device is probed, to make sure it's in sync. This is useful after a reboot, if the device re-enumerates for any reason (e.g. ESD shock), or if the driver is unbound/rebound (debugging/testing). Without this, the tablet switch state is only synchronized after a key is pressed (since the device would then send a report that includes the switch state), leading to strange UX (e.g. UI mode changes when a key is pressed after reboot). This is not a problem on detachable base attach, as the device, by itself, sends a report after it is booted up. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2020-03-16HID: google: add moonball USB idChen-Tsung Hsieh1-0/+2
Add 1 additional hammer-like device. Signed-off-by: Chen-Tsung Hsieh <chentsung@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2019-11-29Merge branch 'for-5.5/whiskers' into for-linusJiri Kosina1-43/+103
- robustification of tablet mode support in google-whiskers driver (Dmitry Torokhov)
2019-10-10HID: google: Detect base folded usage instead of hard-coding whiskersNicolas Boichat1-28/+25
Some other hammer-like device will emit a similar code, let's look for the folded event in HID usage table, instead of hard-coding whiskers in many places. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2019-10-10HID: google: add magnemite/masterball USB idsNicolas Boichat1-0/+4
Add 2 additional hammer-like devices. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2019-10-01HID: google: whiskers: signal tablet mode on connectDmitry Torokhov1-6/+6
When we receive "keyboard position" event from Whiskers we can conclude that the base is attached, even if we did not get EC event for that. We may miss EC event because there are some units which have a lot of leakage on the ADC pins that the EC uses to determine whether or not a base is attached. Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2019-10-01HID: google: whiskers: signal tablet mode switch on disconnectDmitry Torokhov1-1/+23
Currently, the tablet mode switch that takes two signals as its input: base attached switch from the EC and some GMR signal from whiskers when it's folded over. This tablet mode switch is then sent to Chrome, which changes the UI. However, there are some units which have a lot of leakage on the ADC pins that the EC uses to determine whether or not a base is attached. This can result in the base being physically detached, but the EC thinking that it's still attached. The user would then be stuck in laptop mode and wouldn't be able to rotate their display. To work around this let's send "tablet mode" signal when we remove HID interface, which normally happens when we physically disconnect whiskers. Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2019-10-01HID: google: whiskers: more robust tablet mode detectionDmitry Torokhov1-15/+56
The USB interface may get detected before the platform/EC one, so let's note the state of the base (if we receive event) and use it to correctly initialize the tablet mode switch state. Also let's start the HID interface immediately when probing, this will ensure that we correctly process "base folded" events that may be sent as we initialize the base. Note that this requires us to add a remove() function where we stop and close the hardware and switch the LED registration away from devm interface as we need to make sure that we destroy the LED instance before we stop the hardware. Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2019-09-02mfd / platform: cros_ec: Reorganize platform and mfd includesEnric Balletbo i Serra1-2/+2
There is a bit of mess between cros-ec mfd includes and platform includes. For example, we have a linux/mfd/cros_ec.h include that exports the interface implemented in platform/chrome/cros_ec_proto.c. Or we have a linux/mfd/cros_ec_commands.h file that is non related to the multifunction device (in the sense that is not exporting any function of the mfd device). This causes crossed includes between mfd and platform/chrome subsystems and makes the code difficult to read, apart from creating 'curious' situations where a platform/chrome driver includes a linux/mfd/cros_ec.h file just to get the exported functions that are implemented in another platform/chrome driver. In order to have a better separation on what the cros-ec multifunction driver does and what the cros-ec core provides move and rework the affected includes doing: - Move cros_ec_commands.h to include/linux/platform_data/cros_ec_commands.h - Get rid of the parts that are implemented in the platform/chrome/cros_ec_proto.c driver from include/linux/mfd/cros_ec.h to a new file include/linux/platform_data/cros_ec_proto.h - Update all the drivers with the new includes, so - Drivers that only need to know about the protocol include - linux/platform_data/cros_ec_proto.h - linux/platform_data/cros_ec_commands.h - Drivers that need to know about the cros-ec mfd device also include - linux/mfd/cros_ec.h Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mark Brown <broonie@kernel.org> Acked-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Neil Armstrong <narmstrong@baylibre.com> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> Series changes: 3 - Fix dereferencing pointer to incomplete type 'struct cros_ec_dev' (lkp) Signed-off-by: Lee Jones <lee.jones@linaro.org>
2018-10-09HID: google: drop superfluous const before SIMPLE_DEV_PM_OPS()Jiri Kosina1-1/+1
SIMPLE_DEV_PM_OPS() already implies const for the type; drop the extra modifier. Fixes: eb1aac4c8744f75460c34d71b0c73bebf3e8ee5c ("HID: google: add support tablet mode switch for Whiskers") Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-10-09HID: google: add support tablet mode switch for WhiskersDmitry Torokhov1-19/+394
Whiskers is a foldable base, and thus requires combining "base presence" signal coming from EC with base state signal (folded/unfolded) coming from USB/HID interface to produce proper SW_TABLET_MODE event. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-06-11HID: google: Add support for whiskersNicolas Boichat1-0/+2
Another device in the hammer class, with USB id 0x5030. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-03-28HID: google: Enable PM Full On mode when adjusting backlightHaridhar Kalvala1-0/+14
hammer LED backlight brightness is not getting set when USB device is in suspend state. This patch fixes the issue by requesting USB HID device to be in FULLON mode, so that sending hardware output report and hardware raw request won't fail to set brightness, and set device back to NORMAL mode once this call returns. Signed-off-by: Haridhar Kalvala <haridhar.kalvala@intel.com> Reviewed-by: Dmitry Torokhov <dtor@chromium.org> Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-03-27HID: google: add google hammer HID driverWei-Ning Huang1-0/+124
Add Google hammer HID driver. This driver allow us to control hammer keyboard backlight and support future features. Signed-off-by: Wei-Ning Huang <wnhuang@google.com> Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>