Commit Graph

24 Commits

Author SHA1 Message Date
Guenter Roeck ad56814fcc Input: mouse - use local variables consistently
If a function declares a variable to access a structure element,
use it consistently.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2017-01-21 23:52:22 -08:00
Dudley Du 3cd4786943 Input: cyapa - fix for losing events during device power transitions
When changing the scan rate as part of runtime-resume process we may lose
some of the events, because:

1) for gen3 trackpads, the driver must msleep() some time to ensure that
the device is ready to accept next command;

2) for gen5 and later trackpads, the queue dumping function will simply
ignore the events when waiting for the set power mode command response.

The solution is to keep polling and report those valid events when the set
power mode command is in progress.

Signed-off-by: Dudley Du <dudl@cypress.com>
Tested-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-03-04 11:32:13 -08:00
Dudley Du ddbb299db0 Input: cyapa - introduce device tree binding
Add device tree support for  Cypress trackpad devices.

Signed-off-by: Dudley Du <dudl@cypress.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-07-30 11:33:59 -07:00
Dudley Du 36e9615bd7 Input: cyapa - add regulator vcc support
We need to power up the chip before we can initialize it.

On systems that delegate task of powering up regulators to firmware we
assume that we'll be simply given a dummy regulator.

Signed-off-by: Dudley Du <dudl@cypress.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-07-30 11:33:59 -07:00
Dudley Du ce2ae9e3e6 Input: cyapa - add ACPI HID CYAP0002 for Gen6 devices
Add CYTP0002 to the list of ACPI HIDs recognized by the driver.

Signed-off-by: Dudley Du <dudl@cypress.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-07-23 17:34:06 -07:00
Dudley Du 757cae5a6f Input: cyapa - fully support runtime suspend power management
Fix the the runtime suspend power management not working issue when system
starts up and before user touches the trackpad device.
TEST=test on Chromebook.

Signed-off-by: Dudley Du <dudl@cypress.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-07-23 17:34:05 -07:00
Dudley Du 945525ee60 Input: cyapa - add proximity support for gen5 and gen6 modules
Gen5 and Gen6 trackpad devices are able to detect and report object
proximity data/events, add this function support in the cyapa driver
through the ABS_DISTANCE event.

Signed-off-by: Dudley Du <dudl@cypress.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-07-23 17:34:05 -07:00
Dudley Du c2c06c41f7 Input: cyapa - add gen6 device module support
Based on the cyapa core, add support for basic functionality of the gen6
trackpad devices. The driver can automatically determine what protocol
(gen3, gen5, or gen6) should be used with the attached trackpad device.

Signed-off-by: Dudley Du <dudl@cypress.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-07-23 17:34:04 -07:00
Dudley Du 94897619bf Input: cyapa - rename 'gen5' to 'pip' for chared code
Change 'gen5' to 'pip' for all macros, variables and functions that are
shared between gen5 and gen6 modules to make naming more clear and
readable.

Also fix a few spelling errors.

Signed-off-by: Dudley Du <dudl@cypress.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-07-23 17:34:03 -07:00
Krzysztof Kozlowski 800e3b9a68 Input: drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-07-17 16:57:00 -07:00
Dudley Du a333a03ce9 Input: cyapa - fix setting suspend scan rate
The suspend scan rate value should not exceed 1000, unfortunately when
implementing the limit we used max_t instead of min_t, causing the value to
be at least 1000.

Signed-off-by: Dudley Du <dudl@cypress.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-04-20 10:30:09 -07:00
Dan Carpenter b481077375 Input: cyapa - off by one in cyapa_update_fw_store()
If "(count == NAME_MAX)" then we could end up putting the NUL terminator
one space beyond the end of the fw_name[] array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-01-22 08:23:15 -08:00
Dudley Du 7b2171d7c4 Input: cyapa - add acpi device id support
Add acpi device tree support.
acpi device id "CYAP0000" is for old gen3 trackpad devices.
acpi device id "CYAP0001" is for new gen5 trackpad devices.

Signed-off-by: Dudley Du <dudl@cypress.com>
Tested-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-01-18 00:10:33 -08:00
Dudley Du c806b0b84d Input: cyapa - add sysfs interfaces support in the cyapa driver
Introduce control interfaces that are commonly used in pre- and after
production, for trackpad device state checking, managing and firmware image
updating.  These interfaces include mode, firmware_version and product_id
interfaces for reading firmware version and trackpad device product id
values, and update_fw interface to command firmware image update process.
There are also baseline and calibrate interfaces for reading and checking
trackpad device's sensors states.

Signed-off-by: Dudley Du <dudl@cypress.com>
Tested-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-01-18 00:10:30 -08:00
Dudley Du 672865080a Input: cyapa - add runtime power management support
This change implements runtime PM support in the driver and adds
runtime_suspend_scanrate_ms power management interface in device's power
group, so users or applications can control the runtime power management
strategy of trackpad device according to their requirements.

Signed-off-by: Dudley Du <dudl@cypress.com>
Tested-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-01-18 00:10:29 -08:00
Dudley Du 22e7db8111 Input: cyapa - add power management interfaces support for the device
Add suspend_scanrate_ms power management interfaces in device's
power group, so users or applications can control the power management
strategy of trackpad device according to their requirements.

Signed-off-by: Dudley Du <dudl@cypress.com>
Tested-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-01-18 00:10:29 -08:00
Dudley Du 6972a85960 Input: cyapa - add gen5 trackpad device basic functions support
This change adds support for Gen5 Cypress trackpads. The driver detects
generation of the device at probe time and automatically selects
appropriate protocol.

Signed-off-by: Dudley Du <dudl@cypress.com>
Tested-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-01-18 00:10:28 -08:00
Dudley Du 9f1cd85751 Input: cyapa - re-design driver to support multi-trackpad in one driver
In order to support multiple different chipsets and communication protocols
trackpad devices in one cyapa driver, the new cyapa driver is re-designed
with one cyapa driver core and multiple device specific functions component.
The cyapa driver core is contained in this patch, it supplies basic functions
that working with kernel and input subsystem, and also supplies the interfaces
that the specific devices' component can connect and work together with as
one driver.

Signed-off-by: Dudley Du <dudl@cypress.com>
Tested-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-01-18 00:10:28 -08:00
Dudley Du 823a11fdbd Input: cyapa - use 'error' for error codes
Let's use 'error' variable instead of 'ret' when we need to store erro
codes.

Signed-off-by: Dudley Du <dudley.dulixin@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-12-04 09:26:40 -08:00
Dudley Du f68a95cda6 Input: cyapa - fix resuming the device
Chage b1cfa7b438 tried to get away form using
irq in cyapa structure and use client->irq instead, but missed a couple of
spots making the touchpad inoperative after resume.

Reported-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Dudley Du <dudley.dulixin@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-12-03 15:39:14 -08:00
Dudley Du b1cfa7b438 Input: cyapa - switch to using managed resources
Use of managed resources simplifies error handling and device removal code.

Signed-off-by: Dudley Du <dudl@cypress.com>
[Dmitry: added open/close methods so cyapa_remove is no longer needed.]
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-11-09 22:59:48 -08:00
Jingoo Han 572081a431 Input: mouse - use __maybe_unused instead of ifdef around suspend/resume
Use __maybe_unused instead of ifdef guards around suspend/resume
functions, in order to increase build coverage and fix build warnings.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-11-02 00:10:07 -07:00
Benson Leung 6ddaf744c9 Input: cyapa - add support for smbus protocol
This patch adds support for the Cypress APA Smbus Trackpad type,
which uses a modified register map that fits within the
limitations of the smbus protocol.

Devices that use this protocol include:
CYTRA-116001-00 - Samsung Series 5 550 Chromebook trackpad
CYTRA-103002-00 - Acer C7 Chromebook trackpad
CYTRA-101003-00 - HP Pavilion 14 Chromebook trackpad

Signed-off-by: Dudley Du <dudl@cypress.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2013-02-13 20:21:17 -08:00
Benson Leung d7e34d12ba Input: add driver for Cypress APA I2C Trackpad
This patch introduces a driver for Cypress All Points Addressable
I2C Trackpad, including the ones in 2012 Samsung Chromebooks.

This device is compatible with MT protocol type B, providing identifiable
contacts.

Signed-off-by: Dudley Du <dudl@cypress.com>
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2013-01-17 00:28:10 -08:00