input: cyapa: instruction of cyapa patches
Subsystems (2)
v17 cover input: cyapa: instruction of cyapa patches
V17 patches have below updates, details of other updates see history list:
1) Fix kernel oops when system booting up with finger on TP.
2) Remove unnecessary error log that may to system.
3) Slipt out pm sleep code into cyapa_prepare_wakeup_controls(), remove #indefs in function body of CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME.
4) Supply stubs to cyapa_gen3_ops and cyapa_gen5_ops data structure to avoid checking for presence of various methods in ops.
5) Changing CYAPA_BOOTLOADER() and CYAPA_OPERATIONAL() macros to static inline functions as cyapa_is_bootloader_mode() and cyapa_is_operational_mode().
6) Remove touching runtime suspend state during system calling cyapa_suspend().
7) Change to enable runtime PM until make sure device is out of bootloader.
8) Change to return -EAGAIN when bootloader is busy.
9) Correct word spell issue and code styles.
This patch series is aimed to re-design the cyapa driver to support old gen3 trackpad devices and new gen5 trackpad devices in one cyapa driver, it's for easily productions support based on customers' requirements. And add sysfs functions and interfaces supported that required by users and customers.
Since the earlier gen3 and the latest gen5 trackpad devices using two different chipsets, and have different protocols and interfaces, so if supported these two type trackpad devices in two different drivers, then it will be difficult to manage productions and later firmware updates. e.g.: It will cause customer don't know which one trackpad device firmware image to use and update when it has been used and integrated
in same one productions, so here we support these two trackpad devices in same on driver.
Dudley Du (12):
input: cyapa: re-design driver to support multi-trackpad in one driver
input: cyapa: add gen5 trackpad device basic functions support
input: cyapa: add power management interfaces support for the device
input: cyapa: add runtime power management interfaces support for the
device
input: cyapa: add sysfs interfaces support in the cyapa driver
input: cyapa: add gen3 trackpad device firmware update function
support
input: cyapa: add gen3 trackpad device read baseline function support
input: cyapa: add gen3 trackpad device force re-calibrate function
support
input: cyapa: add gen5 trackpad device firmware update function
support
input: cyapa: add gen5 trackpad device read baseline function support
input: cyapa: add gen5 trackpad device force re-calibrate function
support
input: cyapa: add acpi device id support
drivers/input/mouse/Kconfig | 1 + drivers/input/mouse/Makefile | 3 +- drivers/input/mouse/cyapa.c | 1701 ++++++++++++++--------- drivers/input/mouse/cyapa.h | 303 +++++ drivers/input/mouse/cyapa_gen3.c | 1229 +++++++++++++++++ drivers/input/mouse/cyapa_gen5.c | 2773 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 5348 insertions(+), 662 deletions(-) create mode 100644 drivers/input/mouse/cyapa.h create mode 100644 drivers/input/mouse/cyapa_gen3.c create mode 100644 drivers/input/mouse/cyapa_gen5.c
History patch series modifications list:
V16 patches have below main updates compared with v15 patches:
1) Fix all miss-spelling and space issue.
2) Rename variables and functions with much more clearer names.
3) Initialize and document tries near where it will be used.
4) Modify cmd buffer to struct for more descriptive way.
V15 patches have below main updates compared with v14 patches:
1) Fix all warning errors of sparse tool when running with "make C=1".
2) Change variable name "unique_str" to "product_id" for clearer meanings.
3) Update cyapa_i2c_write function to return error directly when length > 31.
V14 patches have below main updates compared with v13 patches:
1) Correct 9 miss spelling issues of "bufferred" to "buffered".
2) Fix the upgrade issue of removing MOUSE_CYAPA config when make oldconfig by replase "depends on I2C && CRC_ITU_T" with
"depends on I2C"
"select CRC_ITU_T"
in patch 9.
V13 patches have below main updates compared with v12 patches:
1) Remove all debugfs interface, including read_fw and raw_data interfaces.
2) This patches are made based linux next-20141208.
V12 patches have below main updates compared with v11 patches:
1) Add check that when TP is detected but not operational, do not exit driver immediately, but wait and export the update_fw interface for recovering.
2) Re-arrange the function codes, remove unnesseary protype definitions in the header file.
V11 patches have below main updates compared with v10 patches:
1) Add add acpi device id supported for old gen3 and new gen5 trackpad devices.
2) Fix the unable to update firmware issue when cyapa_open is not called which means the irq for firwmare update process is not enabled. This fix by checking if the irq is enabled, if not then enable irq before start to do firmware update.
V10 patches have below main updates compared with v9 patches:
1) Modify code to following kernel code style.
e.g.: correct to use error as return name when there is only error path, and fix the checkpatch.sh wanting in the driver.
2) Remove cyapa_remove method and use input open and close interface to following device resouse management infrastructure.
3) Modify cyapa_detect method to return tristate issue to make the return value much more consistent and clear.
4) Use platform supplied functions as possible instead of driver specific rewritten version.
V9 patches have below updates compared with v8 patches:
1) Removed all async thread stuff from the driver.
2) Split driver into 18 patches for each function change one patch.
V8 patches have below updates compared with v7 patches:
1) [PATCH v8 01/13] - Remove the async thread for device detect in probe routine, now the device detect process is completely done within the device probe routine.
2) [PATCH v8 01/13] - Split the irq cmd handler function to separated function cyapa_default_irq_cmd_handler() and set it to interface cyapa_default_ops.irq_cmd_handler.
3) [PATCH v8 06/13] - Add cyapa->gen check in cyapa_gen3_irq_cmd_handler() to avoid miss-enter when device protocol is still in detecting.
V7 patches have below updates compared with v6 patches:
1) [PATCH v7 01/13] - Split the irq cmd handler function to separated function cyapa_default_irq_cmd_handler() and set it to interface cyapa_default_ops.irq_cmd_handler.
2) [PATCH v7 06/13] - Add cyapa->gen check in cyapa_gen3_irq_cmd_handler() to avoid miss-enter when device protocol is still in detecting.
V6 patches have below updates compared with v5 patches:
1) Remove patch 14 of the lid filtering from the cyapa driver.
V5 patches have below updates compared with v4 patches:
1) Uses get_device()/put_device() instead of kobject_get()/kobject_put();
2) Fix memories freed before debugfs entries issue;
3) Make cyapa_debugs_root valid in driver module level
in module_init()/moudle_exit() ;
4) Fix i2c_transfer() may return partial transfer issues.
5) Add cyapa->removed flag to avoid detecting thread may still running when driver module is removed.
6) Fix the meanings of some comments and return error code not clear issue.
PATCH v17 1/12 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.
TEST=test on Chromebooks.
--- drivers/input/mouse/Makefile | 3 +- drivers/input/mouse/cyapa.c | 1076 +++++++++++++++----------------------- drivers/input/mouse/cyapa.h | 296 +++++++++++ drivers/input/mouse/cyapa_gen3.c | 807 ++++++++++++++++++++++++++++ 4 files changed, 1516 insertions(+), 666 deletions(-) create mode 100644 drivers/input/mouse/cyapa.h create mode 100644 drivers/input/mouse/cyapa_gen3.c
drivers/input/mouse/Makefile +2 -1
@@ -8,7 +8,7 @@ obj-$(CONFIG_MOUSE_AMIGA) += amimouse.o obj-$(CONFIG_MOUSE_APPLETOUCH) += appletouch.o obj-$(CONFIG_MOUSE_ATARI) += atarimouse.o obj-$(CONFIG_MOUSE_BCM5974) += bcm5974.o -obj-$(CONFIG_MOUSE_CYAPA) += cyapa.o +obj-$(CONFIG_MOUSE_CYAPA) += cyapatp.o obj-$(CONFIG_MOUSE_ELAN_I2C) += elan_i2c.o obj-$(CONFIG_MOUSE_GPIO) += gpio_mouse.o obj-$(CONFIG_MOUSE_INPORT) += inport.o
@@ -24,6 +24,7 @@ obj-$(CONFIG_MOUSE_SYNAPTICS_I2C) += synaptics_i2c.o obj-$(CONFIG_MOUSE_SYNAPTICS_USB) += synaptics_usb.o obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o +cyapatp-objs := cyapa.o cyapa_gen3.o psmouse-objs := psmouse-base.o synaptics.o focaltech.o psmouse-$(CONFIG_MOUSE_PS2_ALPS) += alps.o
drivers/input/mouse/cyapa.c +411 -665
1,280 lines not on this page · raw message
drivers/input/mouse/cyapa.h new file +296 -0
296 lines not on this page · raw message
drivers/input/mouse/cyapa_gen3.c new file +807 -0
807 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v17 2/12 input: cyapa: add gen5 trackpad device basic functions support
In reply to Dudley DuBased on the cyapa core, add the gen5 trackpad device's basic functions supported, so gen5 trackpad device can work with kernel input system. And also based on the state parse interface, the cyapa driver can automatically determine the attached is gen3 or gen5 protocol trackpad device, then set the correct protocol to work with the attached trackpad device.
TEST=test on Chromebooks.
--- drivers/input/mouse/Makefile | 2 +- drivers/input/mouse/cyapa.c | 13 + drivers/input/mouse/cyapa.h | 1 + drivers/input/mouse/cyapa_gen5.c | 1678 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 1693 insertions(+), 1 deletion(-) create mode 100644 drivers/input/mouse/cyapa_gen5.c
drivers/input/mouse/Makefile +1 -1
@@ -24,7 +24,7 @@ obj-$(CONFIG_MOUSE_SYNAPTICS_I2C) += synaptics_i2c.o obj-$(CONFIG_MOUSE_SYNAPTICS_USB) += synaptics_usb.o obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o -cyapatp-objs := cyapa.o cyapa_gen3.o +cyapatp-objs := cyapa.o cyapa_gen3.o cyapa_gen5.o psmouse-objs := psmouse-base.o synaptics.o focaltech.o psmouse-$(CONFIG_MOUSE_PS2_ALPS) += alps.o
drivers/input/mouse/cyapa.c +13 -0
@@ -184,6 +184,14 @@ static int cyapa_get_state(struct cyapa *cyapa)if (!error) goto out_detected; } +if ((cyapa->gen ==CYAPA_GEN_UNKNOWN || + cyapa->gen ==CYAPA_GEN5 ) && + !smbus && even_addr) { + error = cyapa_gen5_ops.state_parse (cyapa, + status,BL_STATUS_SIZE ); +if (!error) + goto out_detected; + }/* * Write 0x00 0x00 to trackpad device to force update its
@@ -272,6 +280,9 @@ static int cyapa_check_is_operational(struct cyapa *cyapa)return error;switch (cyapa->gen) { +case CYAPA_GEN5 : + cyapa->ops = &cyapa_gen5_ops; +break ;case CYAPA_GEN3 : cyapa->ops = &cyapa_gen3_ops;break ;
@@ -506,6 +517,8 @@ static int cyapa_initialize(struct cyapa *cyapa)/* ops.initialize() is aimed to prepare for module communications. */ error = cyapa_gen3_ops.initialize (cyapa); +if (!error) + error = cyapa_gen5_ops.initialize (cyapa);if (error)return error;
drivers/input/mouse/cyapa.h +1 -0
@@ -292,5 +292,6 @@ u16 cyapa_pwr_cmd_to_sleep_time(u8 pwr_mode);extern const char product_id[];extern const struct cyapa_dev_ops cyapa_gen3_ops; +extern const struct cyapa_dev_ops cyapa_gen5_ops;#endif
drivers/input/mouse/cyapa_gen5.c new file +1678 -0
1,678 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v17 3/12 input: cyapa: add power management interfaces support for the device
In reply to Dudley DuAdd suspend_scanrate_ms power management interfaces in device's power group, so users or applications can control the power management strategy of trackpad device as their requirements. TEST=test on Chromebooks.
--- drivers/input/mouse/cyapa.c | 127 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+)
drivers/input/mouse/cyapa.c +127 -0
@@ -604,6 +604,127 @@ out:return IRQ_HANDLED ; } +/* +************************************************************** +* sysfs interface +************************************************************** +*/ +#ifdef CONFIG_PM_SLEEP +static ssize_t cyapa_show_suspend_scanrate (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct cyapa *cyapa =dev_get_drvdata (dev); +u8 pwr_cmd = cyapa->suspend_power_mode; +u16 sleep_time; +int len; +int error; + + error =mutex_lock_interruptible (&cyapa->state_sync_lock); +if (error) +return error; + pwr_cmd = cyapa->suspend_power_mode; + sleep_time = cyapa->suspend_sleep_time; +mutex_unlock (&cyapa->state_sync_lock); + +if (pwr_cmd ==PWR_MODE_BTN_ONLY ) { + len =scnprintf (buf,PAGE_SIZE ,"%s\n" ,BTN_ONLY_MODE_NAME ); + }else if (pwr_cmd ==PWR_MODE_OFF ) { + len =scnprintf (buf,PAGE_SIZE ,"%s\n" ,OFF_MODE_NAME ); + }else { +if (cyapa->gen ==CYAPA_GEN3 ) + sleep_time =cyapa_pwr_cmd_to_sleep_time (pwr_cmd); + len =scnprintf (buf,PAGE_SIZE ,"%u\n" , sleep_time); + } + +return len; +} + +static ssize_t cyapa_update_suspend_scanrate (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct cyapa *cyapa =dev_get_drvdata (dev); +u16 sleep_time; +int error; + + error =mutex_lock_interruptible (&cyapa->state_sync_lock); +if (error) +return error; + +if (sysfs_streq (buf,BTN_ONLY_MODE_NAME )) { + cyapa->suspend_power_mode =PWR_MODE_BTN_ONLY ; + }else if (sysfs_streq (buf,OFF_MODE_NAME )) { + cyapa->suspend_power_mode =PWR_MODE_OFF ; + }else if (!kstrtou16 (buf,10 , &sleep_time)) { + cyapa->suspend_sleep_time =max_t (u16, sleep_time,1000 ); + cyapa->suspend_power_mode = +cyapa_sleep_time_to_pwr_cmd (cyapa->suspend_sleep_time); + }else { + count =0 ; + } + +mutex_unlock (&cyapa->state_sync_lock); + +return count ? count : -EINVAL ; +} + +static DEVICE_ATTR(suspend_scanrate_ms, S_IRUGO|S_IWUSR, + cyapa_show_suspend_scanrate, + cyapa_update_suspend_scanrate); + +static struct attribute *cyapa_power_wakeup_entries[] = { + &dev_attr_suspend_scanrate_ms.attr, +NULL , +}; + +static const struct attribute_group cyapa_power_wakeup_group = { + .name = power_group_name, + .attrs = cyapa_power_wakeup_entries, +}; + +static void cyapa_remove_power_wakeup_group (void *data) +{ +struct cyapa *cyapa = data; + +sysfs_unmerge_group (&cyapa->client->dev.kobj, + &cyapa_power_wakeup_group); +} + +static int cyapa_prepare_wakeup_controls (struct cyapa *cyapa) +{ +struct i2c_client *client = cyapa->client; +struct device *dev = &client->dev; +int error; + +if (device_can_wakeup (dev)) { + error =sysfs_merge_group (&client->dev.kobj, + &cyapa_power_wakeup_group); +if (error) { +dev_err (dev,"failed to add power wakeup group: %d\n" , + error); +return error; + } + + error =devm_add_action (dev, + cyapa_remove_power_wakeup_group, cyapa); +if (error) { +cyapa_remove_power_wakeup_group (cyapa); +dev_err (dev,"failed to add power cleanup action: %d\n" , + error); +return error; + } + } + +return 0 ; +} +#else +static inline int cyapa_prepare_wakeup_controls (struct cyapa *cyapa) +{ +return 0 ; +} +#endif /* CONFIG_PM_SLEEP */ +static int cyapa_probe (struct i2c_client *client,const struct i2c_device_id *dev_id) {
@@ -643,6 +764,12 @@ static int cyapa_probe(struct i2c_client *client,return error; } + error =cyapa_prepare_wakeup_controls (cyapa); +if (error) { +dev_err (dev,"failed to prepare wakeup controls: %d\n" , error); +return error; + } + error = devm_request_threaded_irq(dev, client->irq, NULL, cyapa_irq, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Signature · 1 line
1.9.1
PATCH v17 4/12 input: cyapa: add runtime power management interfaces support for the device
In reply to Dudley DuAdd runtime_suspend_scanrate_ms power management interfaces in device's power group, so users or applications can control the runtime power management strategy of trackpad device as their requirements. TEST=test on Chromebooks.
--- drivers/input/mouse/cyapa.c | 180 +++++++++++++++++++++++++++++++++++++++++++- drivers/input/mouse/cyapa.h | 4 + 2 files changed, 183 insertions(+), 1 deletion(-)
drivers/input/mouse/cyapa.c +179 -1
@@ -23,6 +23,7 @@#include <linux/mutex.h> #include <linux/slab.h> #include <linux/uaccess.h> +#include <linux/pm_runtime.h> #include "cyapa.h"
@@ -357,6 +358,10 @@ static int cyapa_open(struct input_dev *input) }enable_irq (client->irq); +if (!pm_runtime_enabled (&client->dev)) { +pm_runtime_set_active (&client->dev); +pm_runtime_enable (&client->dev); + } out:mutex_unlock (&cyapa->state_sync_lock);return error;
@@ -370,8 +375,11 @@ static void cyapa_close(struct input_dev *input)mutex_lock (&cyapa->state_sync_lock);disable_irq (client->irq); +if (pm_runtime_enabled (&client->dev)) +pm_runtime_disable (&client->dev);if (cyapa->operational) cyapa->ops->set_power_mode (cyapa,PWR_MODE_OFF ,0 ); +pm_runtime_set_suspended (&client->dev);mutex_unlock (&cyapa->state_sync_lock); }
@@ -539,6 +547,9 @@ static int cyapa_reinitialize(struct cyapa *cyapa)struct input_dev *input = cyapa->input;int error; +if (pm_runtime_enabled (dev)) +pm_runtime_disable (dev); +/* Avoid command failures when TP was in OFF state. */ if (cyapa->operational) cyapa->ops->set_power_mode (cyapa,PWR_MODE_FULL_ACTIVE ,0 );
@@ -561,6 +572,13 @@ out:/* Reset to power OFF state to save power when no user open. */ if (cyapa->operational) cyapa->ops->set_power_mode (cyapa,PWR_MODE_OFF ,0 ); + }else if (!error && cyapa->operational) { +/* +* Make sure only enable runtime PM when device is +* in operational mode and input->users > 0. +*/ +pm_runtime_set_active (dev); +pm_runtime_enable (dev); }return error;
@@ -571,6 +589,7 @@ static irqreturn_t cyapa_irq(int irq, void *dev_id)struct cyapa *cyapa = dev_id;struct device *dev = &cyapa->client->dev; +pm_runtime_get_sync (dev);if (device_may_wakeup (dev))pm_wakeup_event (dev,0 );
@@ -601,6 +620,8 @@ static irqreturn_t cyapa_irq(int irq, void *dev_id) } out: +pm_runtime_mark_last_busy (dev); +pm_runtime_put_sync_autosuspend (dev);return IRQ_HANDLED ; }
@@ -725,6 +746,118 @@ static inline int cyapa_prepare_wakeup_controls(struct cyapa *cyapa) }#endif /* CONFIG_PM_SLEEP */ +#ifdef CONFIG_PM_RUNTIME +static ssize_t cyapa_show_rt_suspend_scanrate (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct cyapa *cyapa =dev_get_drvdata (dev); +u8 pwr_cmd; +u16 sleep_time; +int error; + + error =mutex_lock_interruptible (&cyapa->state_sync_lock); +if (error) +return error; + pwr_cmd = cyapa->runtime_suspend_power_mode; + sleep_time = cyapa->runtime_suspend_sleep_time; +mutex_unlock (&cyapa->state_sync_lock); + +if (cyapa->gen ==CYAPA_GEN3 ) +return scnprintf (buf,PAGE_SIZE ,"%u\n" , +cyapa_pwr_cmd_to_sleep_time (pwr_cmd)); +return scnprintf (buf,PAGE_SIZE ,"%u\n" , sleep_time); +} + +static ssize_t cyapa_update_rt_suspend_scanrate (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct cyapa *cyapa =dev_get_drvdata (dev); +u16 time; +int error; + +if (buf ==NULL || count ==0 ||kstrtou16 (buf,10 , &time)) { +dev_err (dev,"invalid runtime suspend scanrate ms parameter\n" ); +return -EINVAL ; + } + +/* +* When the suspend scanrate is changed, pm_runtime_get to resume +* a potentially suspended device, update to the new pwr_cmd +* and then pm_runtime_put to suspend into the new power mode. +*/ +pm_runtime_get_sync (dev); + error =mutex_lock_interruptible (&cyapa->state_sync_lock); +if (error) +return error; + cyapa->runtime_suspend_sleep_time =max_t (u16, time,1000 ); + cyapa->runtime_suspend_power_mode = +cyapa_sleep_time_to_pwr_cmd (cyapa->runtime_suspend_sleep_time); +mutex_unlock (&cyapa->state_sync_lock); +pm_runtime_put_sync_autosuspend (dev); + +return count; +} + +static DEVICE_ATTR(runtime_suspend_scanrate_ms, S_IRUGO|S_IWUSR, + cyapa_show_rt_suspend_scanrate, + cyapa_update_rt_suspend_scanrate); + +static struct attribute *cyapa_power_runtime_entries[] = { + &dev_attr_runtime_suspend_scanrate_ms.attr, +NULL , +}; + +static const struct attribute_group cyapa_power_runtime_group = { + .name = power_group_name, + .attrs = cyapa_power_runtime_entries, +}; + +static void cyapa_remove_power_runtime_group (void *data) +{ +struct cyapa *cyapa = data; + +sysfs_unmerge_group (&cyapa->client->dev.kobj, + &cyapa_power_runtime_group); +} + +static int cyapa_start_runtime (struct cyapa *cyapa) +{ +struct device *dev = &cyapa->client->dev; +int error; + + cyapa->runtime_suspend_power_mode =PWR_MODE_IDLE ; + cyapa->runtime_suspend_sleep_time = +cyapa_pwr_cmd_to_sleep_time (cyapa->runtime_suspend_power_mode); + + error =sysfs_merge_group (&dev->kobj, &cyapa_power_runtime_group); +if (error) { +dev_err (dev, +"failed to create power runtime group: %d\n" , error); +return error; + } + + error =devm_add_action (dev, cyapa_remove_power_runtime_group, cyapa); +if (error) { +cyapa_remove_power_runtime_group (cyapa); +dev_err (dev, +"failed to add power runtime cleanup action: %d\n" , + error); +return error; + } + +/* runtime is enabled until device is operational and opened. */ +pm_runtime_set_suspended (dev); +pm_runtime_use_autosuspend (dev); +pm_runtime_set_autosuspend_delay (dev,AUTOSUSPEND_DELAY ); + +return 0 ; +} +#else +static inline int cyapa_start_runtime (struct cyapa *cyapa) {return 0 ; } +#endif /* CONFIG_PM_RUNTIME */ +static int cyapa_probe (struct i2c_client *client,const struct i2c_device_id *dev_id) {
@@ -770,6 +903,12 @@ static int cyapa_probe(struct i2c_client *client,return error; } + error =cyapa_start_runtime (cyapa); +if (error) { +dev_err (dev,"failed to start pm_runtime: %d\n" , error); +return error; + } + error = devm_request_threaded_irq(dev, client->irq, NULL, cyapa_irq, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
@@ -810,6 +949,13 @@ static int __maybe_unused cyapa_suspend(struct device *dev)if (error)return error; +/* +* Runtime PM is enable only when device is in operational mode and +* users in use, so need check it before disable it to +* avoid unbalance warning. +*/ +if (pm_runtime_enabled (dev)) +pm_runtime_disable (dev);disable_irq (client->irq);/*
@@ -846,6 +992,7 @@ static int __maybe_unused cyapa_resume(struct device *dev) cyapa->irq_wake = false; } +/* Update device states and runtime PM states. */ error =cyapa_reinitialize (cyapa);if (error)dev_warn (dev,"failed to reinitialize TP device: %d\n" , error);
@@ -856,7 +1003,38 @@ static int __maybe_unused cyapa_resume(struct device *dev)return 0 ; } -static SIMPLE_DEV_PM_OPS(cyapa_pm_ops, cyapa_suspend, cyapa_resume); +#ifdef CONFIG_PM_RUNTIME +static int cyapa_runtime_suspend (struct device *dev) +{ +struct cyapa *cyapa =dev_get_drvdata (dev); +int error; + + error = cyapa->ops->set_power_mode (cyapa, + cyapa->runtime_suspend_power_mode, + cyapa->runtime_suspend_sleep_time); +if (error) +dev_warn (dev,"runtime suspend failed: %d\n" , error); + +return 0 ; +} + +static int cyapa_runtime_resume (struct device *dev) +{ +struct cyapa *cyapa =dev_get_drvdata (dev); +int error; + + error = cyapa->ops->set_power_mode (cyapa,PWR_MODE_FULL_ACTIVE ,0 ); +if (error) +dev_warn (dev,"runtime resume failed: %d\n" , error); + +return 0 ; +} +#endif /* CONFIG_PM_RUNTIME */ + +static const struct dev_pm_ops cyapa_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(cyapa_suspend, cyapa_resume) +SET_RUNTIME_PM_OPS (cyapa_runtime_suspend, cyapa_runtime_resume,NULL ) +};static const struct i2c_device_id cyapa_id_table[] = { {"cyapa" ,0 },
drivers/input/mouse/cyapa.h +4 -0
@@ -242,6 +242,10 @@ struct cyapa {/* power mode settings */ u8 suspend_power_mode;u16 suspend_sleep_time; +#ifdef CONFIG_PM_RUNTIME +u8 runtime_suspend_power_mode; +u16 runtime_suspend_sleep_time; +#endif /* CONFIG_PM_RUNTIME */ u8 dev_pwr_mode;u16 dev_sleep_time;
Signature · 1 line
1.9.1
PATCH v17 5/12 input: cyapa: add sysfs interfaces support in the cyapa driver
In reply to Dudley DuAdd device's basic control and features supported in cyapa driver through sysfs file system interfaces. These interfaces are commonly used in pre- and after production, for trackpad device state checking, managing and firmware image updating.
These interfaces including mode, firmware_version and product_id interfaces for reading firmware version and trackpad device product id values, and including update_fw interface to command firmware image update process. Also including baseline and calibrate interfaces for reading and checking trackpad device's sensors states. TEST=test on Chromebooks.
--- drivers/input/mouse/cyapa.c | 302 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 302 insertions(+)
drivers/input/mouse/cyapa.c +302 -0
@@ -32,6 +32,8 @@#define CYAPA_ADAPTER_FUNC_SMBUS 2#define CYAPA_ADAPTER_FUNC_BOTH 3 +#define CYAPA_FW_NAME "cyapa.bin" +const char product_id[] ="CYTRA" ;static int cyapa_reinitialize (struct cyapa *cyapa);
@@ -475,6 +477,29 @@ static int cyapa_create_input_dev(struct cyapa *cyapa)return 0 ; } +static void cyapa_enable_irq_for_cmd (struct cyapa *cyapa) +{ +struct input_dev *input = cyapa->input; + +if (!input || !input->users) { +if (cyapa->operational) + cyapa->ops->set_power_mode (cyapa, +PWR_MODE_FULL_ACTIVE ,0 ); +enable_irq (cyapa->client->irq); + } +} + +static void cyapa_disable_irq_for_cmd (struct cyapa *cyapa) +{ +struct input_dev *input = cyapa->input; + +if (!input || !input->users) { +disable_irq (cyapa->client->irq); +if (cyapa->operational) + cyapa->ops->set_power_mode (cyapa,PWR_MODE_OFF ,0 ); + } +} +/* * cyapa_sleep_time_to_pwr_cmd and cyapa_pwr_cmd_to_sleep_time *
@@ -858,6 +883,270 @@ static int cyapa_start_runtime(struct cyapa *cyapa)static inline int cyapa_start_runtime (struct cyapa *cyapa) {return 0 ; }#endif /* CONFIG_PM_RUNTIME */ +static ssize_t cyapa_show_fm_ver (struct device *dev, +struct device_attribute *attr,char *buf) +{ +int error; +struct cyapa *cyapa =dev_get_drvdata (dev); + + error =mutex_lock_interruptible (&cyapa->state_sync_lock); +if (error) +return error; + error =scnprintf (buf,PAGE_SIZE ,"%d.%d\n" , cyapa->fw_maj_ver, + cyapa->fw_min_ver); +mutex_unlock (&cyapa->state_sync_lock); +return error; +} + +static ssize_t cyapa_show_product_id (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct cyapa *cyapa =dev_get_drvdata (dev); +int size; +int error; + + error =mutex_lock_interruptible (&cyapa->state_sync_lock); +if (error) +return error; + size =scnprintf (buf,PAGE_SIZE ,"%s\n" , cyapa->product_id); +mutex_unlock (&cyapa->state_sync_lock); +return size; +} + +static int cyapa_firmware (struct cyapa *cyapa,const char *fw_name) +{ +struct device *dev = &cyapa->client->dev; +const struct firmware *fw; +int error; + + error =request_firmware (&fw, fw_name, dev); +if (error) { +dev_err (dev,"Could not load firmware from %s: %d\n" , + fw_name, error); +return error; + } + + error = cyapa->ops->check_fw (cyapa, fw); +if (error) { +dev_err (dev,"Invalid CYAPA firmware image: %s\n" , + fw_name); + goto done; + } + +/* +* Resume the potentially suspended device because doing FW +* update on a device not in the FULL mode has a chance to +* fail. +*/ +pm_runtime_get_sync (dev); + +/* Require IRQ support for firmware update commands. */ +cyapa_enable_irq_for_cmd (cyapa); + + error = cyapa->ops->bl_enter (cyapa); +if (error) { +dev_err (dev,"bl_enter failed, %d\n" , error); + goto err_detect; + } + + error = cyapa->ops->bl_activate (cyapa); +if (error) { +dev_err (dev,"bl_activate failed, %d\n" , error); + goto err_detect; + } + + error = cyapa->ops->bl_initiate (cyapa, fw); +if (error) { +dev_err (dev,"bl_initiate failed, %d\n" , error); + goto err_detect; + } + + error = cyapa->ops->update_fw (cyapa, fw); +if (error) { +dev_err (dev,"update_fw failed, %d\n" , error); + goto err_detect; + } + +err_detect: +cyapa_disable_irq_for_cmd (cyapa); +pm_runtime_put_noidle (dev); + +done: +release_firmware (fw); +return error; +} + +static ssize_t cyapa_update_fw_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct cyapa *cyapa =dev_get_drvdata (dev); +char fw_name[NAME_MAX ]; +int ret, error; + +if (count >NAME_MAX ) { +dev_err (dev,"File name too long\n" ); +return -EINVAL ; + } + +memcpy (fw_name, buf, count); +if (fw_name[count -1 ] =='\n' ) + fw_name[count -1 ] ='\0' ; +else + fw_name[count] ='\0' ; + +if (cyapa->input) { +/* +* Force the input device to be registered after the firmware +* image is updated, so if the corresponding parameters updated +* in the new firmware image can taken effect immediately. +*/ +input_unregister_device (cyapa->input); + cyapa->operational = false; + cyapa->input =NULL ; + } + + error =mutex_lock_interruptible (&cyapa->state_sync_lock); +if (error) { +/* +* Whatever, do reinitialize to try to recover TP state to +* previous state just as it entered fw update entrance. +*/ +cyapa_reinitialize (cyapa); +return error; + } + + error =cyapa_firmware (cyapa, fw_name); +if (error) +dev_err (dev,"firmware update failed: %d\n" , error); +else +dev_dbg (dev,"firmware update successfully done.\n" ); + +/* +* Redetect trackpad device states because firmware update process +* will reset trackpad device into bootloader mode. +*/ + ret =cyapa_reinitialize (cyapa); +if (ret) { +dev_err (dev,"failed to redetect after updated: %d\n" , ret); + error = error ? error : ret; + } + +mutex_unlock (&cyapa->state_sync_lock); + +return error ? error : count; +} + +static ssize_t cyapa_calibrate_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct cyapa *cyapa =dev_get_drvdata (dev); +int error; + + error =mutex_lock_interruptible (&cyapa->state_sync_lock); +if (error) +return error; + +if (cyapa->operational) { +cyapa_enable_irq_for_cmd (cyapa); + error = cyapa->ops->calibrate_store (dev, attr, buf, count); +cyapa_disable_irq_for_cmd (cyapa); + }else { + error = -EBUSY ;/* Still running in bootloader mode. */ + } + +mutex_unlock (&cyapa->state_sync_lock); +return error <0 ? error : count; +} + +static ssize_t cyapa_show_baseline (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct cyapa *cyapa =dev_get_drvdata (dev); +ssize_t error; + + error =mutex_lock_interruptible (&cyapa->state_sync_lock); +if (error) +return error; + +if (cyapa->operational) { +cyapa_enable_irq_for_cmd (cyapa); + error = cyapa->ops->show_baseline (dev, attr, buf); +cyapa_disable_irq_for_cmd (cyapa); + }else { + error = -EBUSY ;/* Still running in bootloader mode. */ + } + +mutex_unlock (&cyapa->state_sync_lock); +return error; +} + +static char *cyapa_state_to_string (struct cyapa *cyapa) +{ +switch (cyapa->state) { +case CYAPA_STATE_BL_BUSY : +return "bootloader busy" ; +case CYAPA_STATE_BL_IDLE : +return "bootloader idle" ; +case CYAPA_STATE_BL_ACTIVE : +return "bootloader active" ; +case CYAPA_STATE_GEN5_BL : +return "bootloader" ; +case CYAPA_STATE_OP : +case CYAPA_STATE_GEN5_APP : +return "operational" ;/* Normal valid state. */ +default : +return "invalid mode" ; + } +} + +static ssize_t cyapa_show_mode (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct cyapa *cyapa =dev_get_drvdata (dev); +int size; +int error; + + error =mutex_lock_interruptible (&cyapa->state_sync_lock); +if (error) +return error; + + size =scnprintf (buf,PAGE_SIZE ,"gen%d %s\n" , + cyapa->gen,cyapa_state_to_string (cyapa)); + +mutex_unlock (&cyapa->state_sync_lock); +return size; +} + +static DEVICE_ATTR(firmware_version, S_IRUGO, cyapa_show_fm_ver, NULL); +static DEVICE_ATTR(product_id, S_IRUGO, cyapa_show_product_id, NULL); +static DEVICE_ATTR(update_fw, S_IWUSR, NULL, cyapa_update_fw_store); +static DEVICE_ATTR(baseline, S_IRUGO, cyapa_show_baseline, NULL); +static DEVICE_ATTR(calibrate, S_IWUSR, NULL, cyapa_calibrate_store); +static DEVICE_ATTR(mode, S_IRUGO, cyapa_show_mode, NULL); + +static struct attribute *cyapa_sysfs_entries[] = { + &dev_attr_firmware_version.attr, + &dev_attr_product_id.attr, + &dev_attr_update_fw.attr, + &dev_attr_baseline.attr, + &dev_attr_calibrate.attr, + &dev_attr_mode.attr, +NULL , +}; + +static const struct attribute_group cyapa_sysfs_group = { + .attrs = cyapa_sysfs_entries, +}; + +static void cyapa_remove_sysfs_group (void *data) +{ +struct cyapa *cyapa = data; + +sysfs_remove_group (&cyapa->client->dev.kobj, &cyapa_sysfs_group); +} +static int cyapa_probe (struct i2c_client *client,const struct i2c_device_id *dev_id) {
@@ -897,6 +1186,19 @@ static int cyapa_probe(struct i2c_client *client,return error; } + error =sysfs_create_group (&client->dev.kobj, &cyapa_sysfs_group); +if (error) { +dev_err (dev,"failed to create sysfs entries: %d\n" , error); +return error; + } + + error =devm_add_action (dev, cyapa_remove_sysfs_group, cyapa); +if (error) { +cyapa_remove_sysfs_group (cyapa); +dev_err (dev,"failed to add sysfs cleanup action: %d\n" , error); +return error; + } + error =cyapa_prepare_wakeup_controls (cyapa);if (error) {dev_err (dev,"failed to prepare wakeup controls: %d\n" , error);
Signature · 1 line
1.9.1
PATCH v17 6/12 input: cyapa: add gen3 trackpad device firmware update function support
In reply to Dudley DuAdd firmware image update function supported for gen3 trackpad device, it can be used through sysfs update_fw interface.
TEST=test on Chromebooks.
--- drivers/input/mouse/cyapa_gen3.c | 291 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 291 insertions(+)
drivers/input/mouse/cyapa_gen3.c +291 -0
@@ -20,6 +20,7 @@#include <linux/input/mt.h> #include <linux/module.h> #include <linux/slab.h> +#include <linux/unaligned/access_ok.h> #include "cyapa.h"
@@ -115,6 +116,18 @@ struct cyapa_reg_data {struct cyapa_touch touches[5 ]; } __packed; +struct gen3_write_block_cmd { +u8 checksum_seed;/* Always be 0xff */ +u8 cmd_code;/* command code: 0x39 */ +u8 key[8 ];/* 8-byte security key */ +__be16 block_num; +u8 block_data[CYAPA_FW_BLOCK_SIZE ]; +u8 block_checksum;/* Calculated using bytes 12 - 75 */ +u8 cmd_checksum;/* Calculated using bytes 0-76 */ +} __packed; + +static const u8 security_key[] = { +0x00 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x06 ,0x07 };static const u8 bl_activate[] = {0x00 ,0xff ,0x38 ,0x00 ,0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x06 ,0x07 };static const u8 bl_deactivate[] = {0x00 ,0xff ,0x3b ,0x00 ,0x01 ,0x02 ,0x03 ,
@@ -423,6 +436,69 @@ static int cyapa_gen3_state_parse(struct cyapa *cyapa, u8 *reg_data, int len)return -EAGAIN ; } +/* +* Enter bootloader by soft resetting the device. +* +* If device is already in the bootloader, the function just returns. +* Otherwise, reset the device; after reset, device enters bootloader idle +* state immediately. +* +* Returns: +* 0 on success +* -EAGAIN device was reset, but is not now in bootloader idle state +* < 0 if the device never responds within the timeout +*/ +static int cyapa_gen3_bl_enter (struct cyapa *cyapa) +{ +int error; + + error =cyapa_poll_state (cyapa,500 ); +if (error) +return error; +if (cyapa->state ==CYAPA_STATE_BL_IDLE ) { +/* Already in BL_IDLE. Skipping reset. */ +return 0 ; + } + +if (cyapa->state !=CYAPA_STATE_OP ) +return -EAGAIN ; + + cyapa->state =CYAPA_STATE_NO_DEVICE ; + error =cyapa_write_byte (cyapa,CYAPA_CMD_SOFT_RESET ,0x01 ); +if (error) +return -EIO ; + +usleep_range (25000 ,50000 ); + error =cyapa_poll_state (cyapa,500 ); +if (error) +return error; +if ((cyapa->state !=CYAPA_STATE_BL_IDLE ) || + (cyapa->status[REG_BL_STATUS ] &BL_STATUS_WATCHDOG )) +return -EAGAIN ; + +return 0 ; +} + +static int cyapa_gen3_bl_activate (struct cyapa *cyapa) +{ +int error; + + error =cyapa_i2c_reg_write_block (cyapa,0 ,sizeof (bl_activate), + bl_activate); +if (error) +return error; + +/* Wait for bootloader to activate; takes between 2 and 12 seconds */ +msleep (2000 ); + error =cyapa_poll_state (cyapa,11000 ); +if (error) +return error; +if (cyapa->state !=CYAPA_STATE_BL_ACTIVE ) +return -EAGAIN ; + +return 0 ; +} +static int cyapa_gen3_bl_deactivate (struct cyapa *cyapa) {int error;
@@ -483,6 +559,212 @@ static int cyapa_gen3_bl_exit(struct cyapa *cyapa)return 0 ; } +static u16 cyapa_gen3_csum (const u8 *buf,size_t count) +{ +int i; +u16 csum =0 ; + +for (i =0 ; i < count; i++) + csum += buf[i]; + +return csum; +} + +/* +* Verify the integrity of a CYAPA firmware image file. +* +* The firmware image file is 30848 bytes, composed of 482 64-byte blocks. +* +* The first 2 blocks are the firmware header. +* The next 480 blocks are the firmware image. +* +* The first two bytes of the header hold the header checksum, computed by +* summing the other 126 bytes of the header. +* The last two bytes of the header hold the firmware image checksum, computed +* by summing the 30720 bytes of the image modulo 0xffff. +* +* Both checksums are stored little-endian. +*/ +static int cyapa_gen3_check_fw (struct cyapa *cyapa,const struct firmware *fw) +{ +struct device *dev = &cyapa->client->dev; +u16 csum; +u16 csum_expected; + +/* Firmware must match exact 30848 bytes = 482 64-byte blocks. */ +if (fw->size !=CYAPA_FW_SIZE ) { +dev_err (dev,"invalid firmware size = %zu, expected %u.\n" , + fw->size,CYAPA_FW_SIZE ); +return -EINVAL ; + } + +/* Verify header block */ + csum_expected = (fw->data[0 ] <<8 ) | fw->data[1 ]; + csum =cyapa_gen3_csum (&fw->data[2 ],CYAPA_FW_HDR_SIZE -2 ); +if (csum != csum_expected) { +dev_err (dev,"%s %04x, expected: %04x\n" , +"invalid firmware header checksum = " , + csum, csum_expected); +return -EINVAL ; + } + +/* Verify firmware image */ + csum_expected = (fw->data[CYAPA_FW_HDR_SIZE -2 ] <<8 ) | + fw->data[CYAPA_FW_HDR_SIZE -1 ]; + csum =cyapa_gen3_csum (&fw->data[CYAPA_FW_HDR_SIZE ], +CYAPA_FW_DATA_SIZE ); +if (csum != csum_expected) { +dev_err (dev,"%s %04x, expected: %04x\n" , +"invalid firmware header checksum = " , + csum, csum_expected); +return -EINVAL ; + } +return 0 ; +} + +/* +* Write a |len| byte long buffer |buf| to the device, by chopping it up into a +* sequence of smaller |CYAPA_CMD_LEN|-length write commands. +* +* The data bytes for a write command are prepended with the 1-byte offset +* of the data relative to the start of |buf|. +*/ +static int cyapa_gen3_write_buffer (struct cyapa *cyapa, +const u8 *buf,size_t len) +{ +int error; +size_t i; +unsigned char cmd[CYAPA_CMD_LEN +1 ]; +size_t cmd_len; + +for (i =0 ; i < len; i +=CYAPA_CMD_LEN ) { +const u8 *payload = &buf[i]; + + cmd_len = (len - i >=CYAPA_CMD_LEN ) ?CYAPA_CMD_LEN : len - i; + cmd[0 ] = i; +memcpy (&cmd[1 ], payload, cmd_len); + + error =cyapa_i2c_reg_write_block (cyapa,0 , cmd_len +1 , cmd); +if (error) +return error; + } +return 0 ; +} + +/* +* A firmware block write command writes 64 bytes of data to a single flash +* page in the device. The 78-byte block write command has the format: +* <0xff> <CMD> <Key> <Start> <Data> <Data-Checksum> <CMD Checksum> +* +* <0xff> - every command starts with 0xff +* <CMD> - the write command value is 0x39 +* <Key> - write commands include an 8-byte key: { 00 01 02 03 04 05 06 07 } +* <Block> - Memory Block number (address / 64) (16-bit, big-endian) +* <Data> - 64 bytes of firmware image data +* <Data Checksum> - sum of 64 <Data> bytes, modulo 0xff +* <CMD Checksum> - sum of 77 bytes, from 0xff to <Data Checksum> +* +* Each write command is split into 5 i2c write transactions of up to 16 bytes. +* Each transaction starts with an i2c register offset: (00, 10, 20, 30, 40). +*/ +static int cyapa_gen3_write_fw_block (struct cyapa *cyapa, +u16 block,const u8 *data) +{ +int ret; +struct gen3_write_block_cmd write_block_cmd; +u8 status[BL_STATUS_SIZE ]; +int tries; +u8 bl_status, bl_error; + +/* Set write command and security key bytes. */ + write_block_cmd.checksum_seed =GEN3_BL_CMD_CHECKSUM_SEED ; + write_block_cmd.cmd_code =GEN3_BL_CMD_WRITE_BLOCK ; +memcpy (write_block_cmd.key, security_key,sizeof (security_key)); +put_unaligned_be16 (block, &write_block_cmd.block_num); +memcpy (write_block_cmd.block_data, data,CYAPA_FW_BLOCK_SIZE ); + write_block_cmd.block_checksum =cyapa_gen3_csum ( + write_block_cmd.block_data,CYAPA_FW_BLOCK_SIZE ); + write_block_cmd.cmd_checksum =cyapa_gen3_csum ((u8 *)&write_block_cmd, +sizeof (write_block_cmd) -1 ); + + ret =cyapa_gen3_write_buffer (cyapa, (u8 *)&write_block_cmd, +sizeof (write_block_cmd)); +if (ret) +return ret; + +/* Wait for write to finish */ + tries =11 ;/* Programming for one block can take about 100ms. */ +do { +usleep_range (10000 ,20000 ); + +/* Check block write command result status. */ + ret =cyapa_i2c_reg_read_block (cyapa,BL_HEAD_OFFSET , +BL_STATUS_SIZE , status); +if (ret !=BL_STATUS_SIZE ) +return (ret <0 ) ? ret : -EIO ; + }while ((status[REG_BL_STATUS ] &BL_STATUS_BUSY ) && --tries); + +/* Ignore WATCHDOG bit and reserved bits. */ + bl_status = status[REG_BL_STATUS ] & ~BL_STATUS_REV_MASK ; + bl_error = status[REG_BL_ERROR ] & ~BL_ERROR_RESERVED ; + +if (bl_status &BL_STATUS_BUSY ) + ret = -ETIMEDOUT ; +else if (bl_status !=BL_STATUS_RUNNING || + bl_error !=BL_ERROR_BOOTLOADING ) + ret = -EIO ; +else + ret =0 ; + +return ret; +} + +static int cyapa_gen3_write_blocks (struct cyapa *cyapa, +size_t start_block,size_t block_count, +const u8 *image_data) +{ +int error; +int i; + +for (i =0 ; i < block_count; i++) { +size_t block = start_block + i; +size_t addr = i *CYAPA_FW_BLOCK_SIZE ; +const u8 *data = &image_data[addr]; + + error =cyapa_gen3_write_fw_block (cyapa, block, data); +if (error) +return error; + } +return 0 ; +} + +static int cyapa_gen3_do_fw_update (struct cyapa *cyapa, +const struct firmware *fw) +{ +struct device *dev = &cyapa->client->dev; +int error; + +/* First write data, starting at byte 128 of fw->data */ + error =cyapa_gen3_write_blocks (cyapa, +CYAPA_FW_DATA_BLOCK_START ,CYAPA_FW_DATA_BLOCK_COUNT , + &fw->data[CYAPA_FW_HDR_BLOCK_COUNT *CYAPA_FW_BLOCK_SIZE ]); +if (error) { +dev_err (dev,"FW update aborted, write image: %d\n" , error); +return error; + } + +/* Then write checksum */ + error =cyapa_gen3_write_blocks (cyapa, +CYAPA_FW_HDR_BLOCK_START ,CYAPA_FW_HDR_BLOCK_COUNT , + &fw->data[0 ]); +if (error) { +dev_err (dev,"FW update aborted, write checksum: %d\n" , error); +return error; + } + +return 0 ; +} +/* * cyapa_get_wait_time_for_pwr_cmd *
@@ -791,10 +1073,19 @@ static int cyapa_gen3_irq_handler(struct cyapa *cyapa) }static int cyapa_gen3_initialize (struct cyapa *cyapa) {return 0 ; } +static int cyapa_gen3_bl_initiate (struct cyapa *cyapa, +const struct firmware *fw) {return 0 ; }static int cyapa_gen3_empty_output_data (struct cyapa *cyapa,u8 *buf,int *len,cb_sort func) {return 0 ; }const struct cyapa_dev_ops cyapa_gen3_ops = { + .check_fw = cyapa_gen3_check_fw, + .bl_enter = cyapa_gen3_bl_enter, + .bl_activate = cyapa_gen3_bl_activate, + .update_fw = cyapa_gen3_do_fw_update, + .bl_deactivate = cyapa_gen3_bl_deactivate, + .bl_initiate = cyapa_gen3_bl_initiate, + .initialize = cyapa_gen3_initialize, .state_parse = cyapa_gen3_state_parse,
Signature · 1 line
1.9.1
PATCH v17 7/12 input: cyapa: add gen3 trackpad device read baseline function support
In reply to Dudley DuAdd read baseline function supported for gen3 trackpad device, it can be used through sysfs baseline interface. TEST=test on Chromebooks.
--- drivers/input/mouse/cyapa_gen3.c | 72 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+)
drivers/input/mouse/cyapa_gen3.c +72 -0
@@ -765,6 +765,76 @@ static int cyapa_gen3_do_fw_update(struct cyapa *cyapa,return 0 ; } +static ssize_t cyapa_gen3_show_baseline (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct cyapa *cyapa =dev_get_drvdata (dev); +int max_baseline, min_baseline; +int tries; +int ret; + + ret =cyapa_read_byte (cyapa,CYAPA_CMD_DEV_STATUS ); +if (ret <0 ) { +dev_err (dev,"Error reading dev status. err = %d\n" , ret); + goto out; + } +if ((ret &CYAPA_DEV_NORMAL ) !=CYAPA_DEV_NORMAL ) { +dev_warn (dev,"Trackpad device is busy. device state = 0x%x\n" , + ret); + ret = -EAGAIN ; + goto out; + } + + ret =cyapa_write_byte (cyapa,CYAPA_CMD_SOFT_RESET , +OP_REPORT_BASELINE_MASK ); +if (ret <0 ) { +dev_err (dev,"Failed to send report baseline command. %d\n" , + ret); + goto out; + } + + tries =3 ;/* Try for 30 to 60 ms */ +do { +usleep_range (10000 ,20000 ); + + ret =cyapa_read_byte (cyapa,CYAPA_CMD_DEV_STATUS ); +if (ret <0 ) { +dev_err (dev,"Error reading dev status. err = %d\n" , + ret); + goto out; + } +if ((ret &CYAPA_DEV_NORMAL ) ==CYAPA_DEV_NORMAL ) +break ; + }while (--tries); + +if (tries ==0 ) { +dev_err (dev,"Device timed out going to Normal state.\n" ); + ret = -ETIMEDOUT ; + goto out; + } + + ret =cyapa_read_byte (cyapa,CYAPA_CMD_MAX_BASELINE ); +if (ret <0 ) { +dev_err (dev,"Failed to read max baseline. err = %d\n" , ret); + goto out; + } + max_baseline = ret; + + ret =cyapa_read_byte (cyapa,CYAPA_CMD_MIN_BASELINE ); +if (ret <0 ) { +dev_err (dev,"Failed to read min baseline. err = %d\n" , ret); + goto out; + } + min_baseline = ret; + +dev_dbg (dev,"Baseline report successful. Max: %d Min: %d\n" , + max_baseline, min_baseline); + ret =scnprintf (buf,PAGE_SIZE ,"%d %d\n" , max_baseline, min_baseline); + +out: +return ret; +} +/* * cyapa_get_wait_time_for_pwr_cmd *
@@ -1086,6 +1156,8 @@ const struct cyapa_dev_ops cyapa_gen3_ops = { .bl_deactivate = cyapa_gen3_bl_deactivate, .bl_initiate = cyapa_gen3_bl_initiate, + .show_baseline = cyapa_gen3_show_baseline, + .initialize = cyapa_gen3_initialize, .state_parse = cyapa_gen3_state_parse,
Signature · 1 line
1.9.1
PATCH v17 8/12 input: cyapa: add gen3 trackpad device force re-calibrate function support
In reply to Dudley DuAdd force re-calibrate function supported for gen3 trackpad device, it can be used through sysfs calibrate interface. TEST=test on Chromebooks.
--- drivers/input/mouse/cyapa_gen3.c | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+)
drivers/input/mouse/cyapa_gen3.c +59 -0
@@ -765,6 +765,64 @@ static int cyapa_gen3_do_fw_update(struct cyapa *cyapa,return 0 ; } +static ssize_t cyapa_gen3_do_calibrate (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct cyapa *cyapa =dev_get_drvdata (dev); +int tries; +int ret; + + ret =cyapa_read_byte (cyapa,CYAPA_CMD_DEV_STATUS ); +if (ret <0 ) { +dev_err (dev,"Error reading dev status: %d\n" , ret); + goto out; + } +if ((ret &CYAPA_DEV_NORMAL ) !=CYAPA_DEV_NORMAL ) { +dev_warn (dev,"Trackpad device is busy, device state: 0x%02x\n" , + ret); + ret = -EAGAIN ; + goto out; + } + + ret =cyapa_write_byte (cyapa,CYAPA_CMD_SOFT_RESET , +OP_RECALIBRATION_MASK ); +if (ret <0 ) { +dev_err (dev,"Failed to send calibrate command: %d\n" , + ret); + goto out; + } + + tries =20 ;/* max recalibration timeout 2s. */ +do { +/* +* For this recalibration, the max time will not exceed 2s. +* The average time is approximately 500 - 700 ms, and we +* will check the status every 100 - 200ms. +*/ +usleep_range (100000 ,200000 ); + + ret =cyapa_read_byte (cyapa,CYAPA_CMD_DEV_STATUS ); +if (ret <0 ) { +dev_err (dev,"Error reading dev status: %d\n" , + ret); + goto out; + } +if ((ret &CYAPA_DEV_NORMAL ) ==CYAPA_DEV_NORMAL ) +break ; + }while (--tries); + +if (tries ==0 ) { +dev_err (dev,"Failed to calibrate. Timeout.\n" ); + ret = -ETIMEDOUT ; + goto out; + } +dev_dbg (dev,"Calibration successful.\n" ); + +out: +return ret <0 ? ret : count; +} +static ssize_t cyapa_gen3_show_baseline (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -1157,6 +1215,7 @@ const struct cyapa_dev_ops cyapa_gen3_ops = { .bl_initiate = cyapa_gen3_bl_initiate, .show_baseline = cyapa_gen3_show_baseline, + .calibrate_store = cyapa_gen3_do_calibrate, .initialize = cyapa_gen3_initialize,
Signature · 1 line
1.9.1
PATCH v17 9/12 input: cyapa: add gen5 trackpad device firmware update function support
In reply to Dudley DuAdd firmware image update function supported for gen5 trackpad device, it can be used through sysfs update_fw interface.
TEST=test on Chromebooks.
--- drivers/input/mouse/Kconfig | 1 + drivers/input/mouse/cyapa_gen5.c | 390 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 391 insertions(+)
drivers/input/mouse/Kconfig +1 -0
@@ -206,6 +206,7 @@ config MOUSE_BCM5974 config MOUSE_CYAPA tristate "Cypress APA I2C Trackpad support" depends on I2C + select CRC_ITU_T help This driver adds support for Cypress All Points Addressable (APA) I2C Trackpads, including the ones used in 2012 Samsung Chromebooks.
drivers/input/mouse/cyapa_gen5.c +390 -0
433 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v17 10/12 input: cyapa: add gen5 trackpad device read baseline function support
In reply to Dudley DuAdd read baseline function supported for gen5 trackpad device, it can be used through sysfs baseline interface. TEST=test on Chromebooks.
--- drivers/input/mouse/cyapa.h | 2 + drivers/input/mouse/cyapa_gen5.c | 640 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 642 insertions(+)
drivers/input/mouse/cyapa.h +2 -0
@@ -265,6 +265,8 @@ struct cyapa {u8 y_origin;/* Y Axis Origin: 0 = top; 1 = bottom. */ int electrodes_x;/* Number of electrodes on the X Axis*/ int electrodes_y;/* Number of electrodes on the Y Axis*/ +int electrodes_rx;/* Number of Rx electrodes */ +int aligned_electrodes_rx;/* 4 aligned */ int max_z;/*
drivers/input/mouse/cyapa_gen5.c +640 -0
658 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v17 11/12 input: cyapa: add gen5 trackpad device force re-calibrate function support
In reply to Dudley DuAdd force re-calibrate function supported for gen5 trackpad device, it can be used through sysfs calibrate interface. TEST=test on Chromebooks.
--- drivers/input/mouse/cyapa_gen5.c | 65 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+)
drivers/input/mouse/cyapa_gen5.c +65 -0
@@ -1714,6 +1714,70 @@ static int cyapa_gen5_suspend_scanning(struct cyapa *cyapa)return 0 ; } +static int cyapa_gen5_calibrate_pwcs (struct cyapa *cyapa, +u8 calibrate_sensing_mode_type) +{ +struct gen5_app_cmd_head *app_cmd_head; +u8 cmd[8 ]; +u8 resp_data[6 ]; +int resp_len; +int error; + +/* Try to dump all buffered data before doing command. */ +cyapa_empty_pip_output_data (cyapa,NULL ,NULL ,NULL ); + +memset (cmd,0 ,sizeof (cmd)); + app_cmd_head = (struct gen5_app_cmd_head *)cmd; +put_unaligned_le16 (GEN5_OUTPUT_REPORT_ADDR , &app_cmd_head->addr); +put_unaligned_le16 (sizeof (cmd) -2 , &app_cmd_head->length); + app_cmd_head->report_id =GEN5_APP_CMD_REPORT_ID ; + app_cmd_head->cmd_code =GEN5_CMD_CALIBRATE ; + app_cmd_head->parameter_data[0 ] = calibrate_sensing_mode_type; + resp_len =sizeof (resp_data); + error =cyapa_i2c_pip_cmd_irq_sync (cyapa, + cmd,sizeof (cmd), + resp_data, &resp_len, +5000 , cyapa_gen5_sort_tsg_pip_app_resp_data, true); +if (error || !VALID_CMD_RESP_HEADER (resp_data,GEN5_CMD_CALIBRATE ) || + !GEN5_CMD_COMPLETE_SUCCESS (resp_data[5 ])) +return error <0 ? error : -EAGAIN ; + +return 0 ; +} + +static ssize_t cyapa_gen5_do_calibrate (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct cyapa *cyapa =dev_get_drvdata (dev); +int error, calibrate_error; + +/* 1. Suspend Scanning*/ + error =cyapa_gen5_suspend_scanning (cyapa); +if (error) +return error; + +/* 2. Do mutual capacitance fine calibrate. */ + calibrate_error =cyapa_gen5_calibrate_pwcs (cyapa, +CYAPA_SENSING_MODE_MUTUAL_CAP_FINE ); +if (calibrate_error) + goto resume_scanning; + +/* 3. Do self capacitance calibrate. */ + calibrate_error =cyapa_gen5_calibrate_pwcs (cyapa, +CYAPA_SENSING_MODE_SELF_CAP ); +if (calibrate_error) + goto resume_scanning; + +resume_scanning: +/* 4. Resume Scanning*/ + error =cyapa_gen5_resume_scanning (cyapa); +if (error || calibrate_error) +return error ? error : calibrate_error; + +return count; +} +static s32 twos_complement_to_s32 (s32 value,int num_bits) {if (value >> (num_bits -1 ))
@@ -2695,6 +2759,7 @@ const struct cyapa_dev_ops cyapa_gen5_ops = { .bl_deactivate = cyapa_gen5_bl_deactivate, .show_baseline = cyapa_gen5_show_baseline, + .calibrate_store = cyapa_gen5_do_calibrate, .initialize = cyapa_gen5_initialize,
Signature · 1 line
1.9.1
PATCH v17 12/12 input: cyapa: add acpi device id support
In reply to Dudley DuAdd acpi device tree support.
acpi device id "CYAP0000" is for old gen3 trackpad devices. acpi device id "CYAP0001" is for new gen5 trackpad devices. TEST=test on Chromebooks.
--- drivers/input/mouse/cyapa.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/input/mouse/cyapa.c +13 -0
@@ -24,6 +24,7 @@#include <linux/slab.h> #include <linux/uaccess.h> #include <linux/pm_runtime.h> +#include <linux/acpi.h> #include "cyapa.h"
@@ -1344,11 +1345,23 @@ static const struct i2c_device_id cyapa_id_table[] = { };MODULE_DEVICE_TABLE (i2c, cyapa_id_table); +#ifdef CONFIG_ACPI +static const struct acpi_device_id cyapa_acpi_id[] = { + {"CYAP0000" ,0 },/* Gen3 trackpad with 0x67 I2C address. */ + {"CYAP0001" ,0 },/* Gen5 trackpad with 0x24 I2C address. */ + { } +}; +MODULE_DEVICE_TABLE (acpi, cyapa_acpi_id); +#endif +static struct i2c_driver cyapa_driver = { .driver = { .name ="cyapa" , .owner =THIS_MODULE , .pm = &cyapa_pm_ops, +#ifdef CONFIG_ACPI + .acpi_match_table =ACPI_PTR (cyapa_acpi_id), +#endif }, .probe = cyapa_probe,
Signature · 1 line
1.9.1
Dudley,
Quoted 8 lines · Dudley Du
V17 patches have below updates, details of other updates see history list:
1) Fix kernel oops when system booting up with finger on TP.
2) Remove unnecessary error log that may to system.
3) Slipt out pm sleep code intocyapa_prepare_wakeup_controls(), remove #indefs in function body ofCONFIG_PM_SLEEPandCONFIG_PM_RUNTIME.
4) Supply stubs tocyapa_gen3_opsandcyapa_gen5_opsdata structure to avoid checking for presence of various methods in ops.
6) Fix the meanings of some comments and return error code not clear issue.
[...]
It has build errors :(
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CHK kernel/config_data.h
CC [M] drivers/input/mouse/cyapa.o
In file included from include/linux/device.h:25:0,
from include/linux/i2c.h:30,
from drivers/input/mouse/cyapa.c:18:
drivers/input/mouse/cyapa.c:1339:21: error: ‘cyapa_runtime_suspend’ undeclared here (not in a function)
SET_RUNTIME_PM_OPS(cyapa_runtime_suspend, cyapa_runtime_resume, NULL)
^
include/linux/pm.h:347:21: note: in definition of macro ‘SET_RUNTIME_PM_OPS’
.runtime_suspend = suspend_fn, \
^
drivers/input/mouse/cyapa.c:1339:44: error: ‘cyapa_runtime_resume’ undeclared here (not in a function)
SET_RUNTIME_PM_OPS(cyapa_runtime_suspend, cyapa_runtime_resume, NULL)
^
include/linux/pm.h:348:20: note: in definition of macro ‘SET_RUNTIME_PM_OPS’
.runtime_resume = resume_fn, \
^scripts/Makefile.build:257: recipe for target 'drivers/input/mouse/cyapa.o' failed make[3]: *** [drivers/input/mouse/cyapa.o] Error 1 scripts/Makefile.build:402: recipe for target 'drivers/input/mouse' failed make[2]: *** [drivers/input/mouse] Error 2 scripts/Makefile.build:402: recipe for target 'drivers/input' failed make[1]: *** [drivers/input] Error 2
make[1]: *** Waiting for unfinished jobs....
Makefile:955: recipe for target 'drivers' failed
make: *** [drivers] Error 2
make: *** Waiting for unfinished jobs....
Signature · 5 lines
- Jeremiah Mahler -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks, Jeremiah.
It seems the power manage code has been updated in kernel-next, the same code didn't genereate any error before.
I updated with latest kernel-next, the compiling error also happened. To fix this code, need to add stubs for cyapa_runtime_suspend() and cyapa_runtime_resume() when CONFIG_PM_RUNTIME is not defined.
#ifdef CONFIG_PM_RUNTIME
static int cyapa_runtime_suspend(struct device *dev) {
struct cyapa *cyapa = dev_get_drvdata(dev); int error;
error = cyapa->ops->set_power_mode(cyapa, cyapa->runtime_suspend_power_mode, cyapa->runtime_suspend_sleep_time);
if (error)
dev_warn(dev, "runtime suspend failed: %d\n", error);
return 0;
}
static int cyapa_runtime_resume(struct device *dev) {
struct cyapa *cyapa = dev_get_drvdata(dev); int error;
error = cyapa->ops->set_power_mode(cyapa, PWR_MODE_FULL_ACTIVE, 0); if (error)
dev_warn(dev, "runtime resume failed: %d\n", error);
return 0;
}
+#else
+static inline int cyapa_runtime_suspend(struct device *dev) { return 0; } +static inline int cyapa_runtime_resume(struct device *dev) { return 0; }
#endif /* CONFIG_PM_RUNTIME */
static const struct dev_pm_ops cyapa_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(cyapa_suspend, cyapa_resume) SET_RUNTIME_PM_OPS(cyapa_runtime_suspend, cyapa_runtime_resume, NULL) };
Thanks,
dudley
Quoted 61 lines
-----Original Message-----
From: Jeremiah Mahler [mailto:[email protected]]
Sent: 2015年1月1日 0:11
To: Dudley Du
Cc: [email protected]; [email protected]; [email protected]; David Solda; [email protected]; [email protected]
Subject: Re: [PATCH v17 00/12] input: cyapa: instruction of cyapa patchesDudley,
Quoted 5 lines · Dudley Du
V17 patches have below updates, details of other updates see history list:
1) Fix kernel oops when system booting up with finger on TP.
2) Remove unnecessary error log that may to system.
3) Slipt out pm sleep code intocyapa_prepare_wakeup_controls(), remove #indefs in function body ofCONFIG_PM_SLEEPand
CONFIG_PM_RUNTIME.Quoted 3 lines
4) Supply stubs to
cyapa_gen3_opsandcyapa_gen5_opsdata structure to avoid checking for presence of various methods in ops.
6) Fix the meanings of some comments and return error code not clear issue.[...]
It has build errors :(
CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h CALL scripts/checksyscalls.sh CHK include/generated/compile.h CHK kernel/config_data.h CC [M] drivers/input/mouse/cyapa.o In file included from include/linux/device.h:25:0, from include/linux/i2c.h:30, from drivers/input/mouse/cyapa.c:18:
drivers/input/mouse/cyapa.c:1339:21: error: ‘cyapa_runtime_suspend’ undeclared here (not in a function)
SET_RUNTIME_PM_OPS(cyapa_runtime_suspend,cyapa_runtime_resume,
NULL)^ include/linux/pm.h:347:21: note: in definition of macro ‘SET_RUNTIME_PM_OPS’ .runtime_suspend = suspend_fn, \ ^
drivers/input/mouse/cyapa.c:1339:44: error: ‘cyapa_runtime_resume’ undeclared here (not in a function)
SET_RUNTIME_PM_OPS(cyapa_runtime_suspend,cyapa_runtime_resume,
NULL)^ include/linux/pm.h:348:20: note: in definition of macro ‘SET_RUNTIME_PM_OPS’ .runtime_resume = resume_fn, \ ^
scripts/Makefile.build:257: recipe for target 'drivers/input/mouse/cyapa.o' failed make[3]: *** [drivers/input/mouse/cyapa.o] Error 1scripts/Makefile.build:402: recipe for target 'drivers/input/mouse' failed make[2]: *** [drivers/input/mouse] Error 2scripts/Makefile.build:402: recipe for target 'drivers/input' failed make[1]: *** [drivers/input] Error 2
make[1]: *** Waiting for unfinished jobs....
Makefile:955: recipe for target 'drivers' failed
make: *** [drivers] Error 2
make: *** Waiting for unfinished jobs....
Quoted 2 lines
--
- Jeremiah Mahler
This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.
Hi Dmitry, Jeremiah,
Besides the the compile error, do you have any other comments on input cyapa v17 pathces?
Thanks,
Dudley
Quoted 105 lines
-----Original Message-----
From: Dudley Du
Sent: 2015年1月5日 9:57
To: 'Jeremiah Mahler'
Cc: [email protected]; [email protected]; [email protected]; David Solda; [email protected]; [email protected]
Subject: RE: [PATCH v17 00/12] input: cyapa: instruction of cyapa patchesThanks, Jeremiah.
It seems the power manage code has been updated in kernel-next, the same code didn't genereate any error before.
I updated with latest kernel-next, the compiling error also happened. To fix this code, need to add stubs forcyapa_runtime_suspend()andcyapa_runtime_resume()whenCONFIG_PM_RUNTIMEis not defined.#ifdef
CONFIG_PM_RUNTIME
static intcyapa_runtime_suspend(struct device *dev){
struct cyapa *cyapa =dev_get_drvdata(dev); int error;error =
cyapa->ops->set_power_mode(cyapa, cyapa->runtime_suspend_power_mode, cyapa->runtime_suspend_sleep_time);
if (error)
dev_warn(dev, "runtime suspend failed: %d\n", error);return 0;
}static int
cyapa_runtime_resume(struct device *dev){
struct cyapa *cyapa =dev_get_drvdata(dev); int error;error =
cyapa->ops->set_power_mode(cyapa, PWR_MODE_FULL_ACTIVE, 0); if (error)
dev_warn(dev, "runtime resume failed: %d\n", error);return 0;
}(quoted diff) +3
-0+#else +static inline int cyapa_runtime_suspend(struct device *dev) { return 0; } +static inline int cyapa_runtime_resume(struct device *dev) { return 0; } #endif /* CONFIG_PM_RUNTIME */ static const struct dev_pm_ops cyapa_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(cyapa_suspend, cyapa_resume) SET_RUNTIME_PM_OPS(cyapa_runtime_suspend, cyapa_runtime_resume,NULL)
};Thanks,
dudleyQuoted 34 lines
-----Original Message-----
From: Jeremiah Mahler [mailto:[email protected]]
Sent: 2015年1月1日 0:11
To: Dudley Du
Cc: [email protected]; [email protected]; [email protected]; David Solda; [email protected]; [email protected]
Subject: Re: [PATCH v17 00/12] input: cyapa: instruction of cyapa patchesDudley,
Quoted 5 lines · Dudley Du
V17 patches have below updates, details of other updates see history list:
1) Fix kernel oops when system booting up with finger on TP.
2) Remove unnecessary error log that may to system.
3) Slipt out pm sleep code intocyapa_prepare_wakeup_controls(), remove #indefs in function body ofCONFIG_PM_SLEEPand
CONFIG_PM_RUNTIME.Quoted 3 lines
4) Supply stubs to
cyapa_gen3_opsandcyapa_gen5_opsdata structure to avoid checking for presence of various methods in ops.
6) Fix the meanings of some comments and return error code not clear issue.[...]
It has build errors :(
CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h CALL scripts/checksyscalls.sh CHK include/generated/compile.h CHK kernel/config_data.h CC [M] drivers/input/mouse/cyapa.o In file included from include/linux/device.h:25:0, from include/linux/i2c.h:30, from drivers/input/mouse/cyapa.c:18:Quoted 6 lines
drivers/input/mouse/cyapa.c:1339:21: error: ‘cyapa_runtime_suspend’ undeclared here (not in a function)
SET_RUNTIME_PM_OPS(cyapa_runtime_suspend,cyapa_runtime_resume,
NULL)^
include/linux/pm.h:347:21: note: in definition of macro‘SET_RUNTIME_PM_OPS’
Quoted 8 lines
.runtime_suspend = suspend_fn, \ ^
drivers/input/mouse/cyapa.c:1339:44: error: ‘cyapa_runtime_resume’ undeclared here (not in a function)
SET_RUNTIME_PM_OPS(cyapa_runtime_suspend,cyapa_runtime_resume,
NULL)^
include/linux/pm.h:348:20: note: in definition of macro
Quoted 16 lines
‘SET_RUNTIME_PM_OPS’
Quoted 15 lines
.runtime_resume = resume_fn, \ ^
scripts/Makefile.build:257: recipe for target 'drivers/input/mouse/cyapa.o' failed make[3]: *** [drivers/input/mouse/cyapa.o] Error 1scripts/Makefile.build:402: recipe for target 'drivers/input/mouse' failed make[2]: *** [drivers/input/mouse] Error 2scripts/Makefile.build:402: recipe for target 'drivers/input' failed make[1]: *** [drivers/input] Error 2
make[1]: *** Waiting for unfinished jobs....
Makefile:955: recipe for target 'drivers' failed
make: *** [drivers] Error 2
make: *** Waiting for unfinished jobs....--
- Jeremiah Mahler
This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.