diff options
Diffstat (limited to 'drivers/input/touchscreen/rmi4')
| -rw-r--r-- | drivers/input/touchscreen/rmi4/Makefile | 18 | ||||
| -rw-r--r-- | drivers/input/touchscreen/rmi4/rmi_bus.c | 315 | ||||
| -rw-r--r-- | drivers/input/touchscreen/rmi4/rmi_dev.c | 428 | ||||
| -rw-r--r-- | drivers/input/touchscreen/rmi4/rmi_driver.c | 1354 | ||||
| -rw-r--r-- | drivers/input/touchscreen/rmi4/rmi_driver.h | 109 | ||||
| -rw-r--r-- | drivers/input/touchscreen/rmi4/rmi_f01.c | 775 | ||||
| -rw-r--r-- | drivers/input/touchscreen/rmi4/rmi_f09.c | 298 | ||||
| -rw-r--r-- | drivers/input/touchscreen/rmi4/rmi_f11.c | 1513 | ||||
| -rw-r--r-- | drivers/input/touchscreen/rmi4/rmi_f19.c | 1419 | ||||
| -rw-r--r-- | drivers/input/touchscreen/rmi4/rmi_f34.c | 821 | ||||
| -rw-r--r-- | drivers/input/touchscreen/rmi4/rmi_f54.c | 1347 | ||||
| -rw-r--r-- | drivers/input/touchscreen/rmi4/rmi_i2c.c | 421 | ||||
| -rw-r--r-- | drivers/input/touchscreen/rmi4/rmi_spi.c | 869 |
13 files changed, 9687 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/rmi4/Makefile b/drivers/input/touchscreen/rmi4/Makefile new file mode 100644 index 00000000000..a7375ed07a3 --- /dev/null +++ b/drivers/input/touchscreen/rmi4/Makefile | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | # | ||
| 2 | # Makefile for Synaptics Touchscreen (RMI4/SPI) | ||
| 3 | # | ||
| 4 | GCOV_PROFILE := y | ||
| 5 | |||
| 6 | ccflags-$(CONFIG_SPI_DEBUG) := -DDEBUG | ||
| 7 | |||
| 8 | #Synaptics SPI Sensor (2002) | ||
| 9 | obj-$(CONFIG_TOUCHSCREEN_SYN_RMI4_SPI) += rmi_bus.o | ||
| 10 | obj-$(CONFIG_TOUCHSCREEN_SYN_RMI4_SPI) += rmi_i2c.o | ||
| 11 | obj-$(CONFIG_TOUCHSCREEN_SYN_RMI4_SPI) += rmi_spi.o | ||
| 12 | obj-$(CONFIG_TOUCHSCREEN_SYN_RMI4_SPI) += rmi_driver.o rmi_f01.o | ||
| 13 | obj-$(CONFIG_TOUCHSCREEN_SYN_RMI4_SPI) += rmi_f09.o | ||
| 14 | obj-$(CONFIG_TOUCHSCREEN_SYN_RMI4_SPI) += rmi_f11.o | ||
| 15 | obj-$(CONFIG_TOUCHSCREEN_SYN_RMI4_SPI) += rmi_f19.o | ||
| 16 | obj-$(CONFIG_TOUCHSCREEN_SYN_RMI4_SPI) += rmi_f34.o | ||
| 17 | obj-$(CONFIG_TOUCHSCREEN_SYN_RMI4_SPI) += rmi_f54.o | ||
| 18 | obj-$(CONFIG_TOUCHSCREEN_SYN_RMI4_SPI) += rmi_dev.o | ||
diff --git a/drivers/input/touchscreen/rmi4/rmi_bus.c b/drivers/input/touchscreen/rmi4/rmi_bus.c new file mode 100644 index 00000000000..6a269df4ff3 --- /dev/null +++ b/drivers/input/touchscreen/rmi4/rmi_bus.c | |||
| @@ -0,0 +1,315 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2011 Synaptics Incorporated | ||
| 3 | * Copyright (c) 2011 Unixphere | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 18 | */ | ||
| 19 | #include <linux/kernel.h> | ||
| 20 | #include <linux/device.h> | ||
| 21 | #include <linux/pm.h> | ||
| 22 | #include <linux/slab.h> | ||
| 23 | #include <linux/list.h> | ||
| 24 | #include <linux/rmi.h> | ||
| 25 | |||
| 26 | static struct rmi_function_list { | ||
| 27 | struct list_head list; | ||
| 28 | struct rmi_function_handler *fh; | ||
| 29 | } rmi_supported_functions; | ||
| 30 | |||
| 31 | static int rmi_bus_match(struct device *dev, struct device_driver *driver) | ||
| 32 | { | ||
| 33 | struct rmi_driver *rmi_driver; | ||
| 34 | struct rmi_device *rmi_dev; | ||
| 35 | struct rmi_device_platform_data *pdata; | ||
| 36 | |||
| 37 | pr_info("in function ____%s____ \n", __func__); | ||
| 38 | rmi_driver = to_rmi_driver(driver); | ||
| 39 | rmi_dev = to_rmi_device(dev); | ||
| 40 | pdata = to_rmi_platform_data(rmi_dev); | ||
| 41 | |||
| 42 | pr_info(" rmi_driver->driver.name = %s\n", rmi_driver->driver.name); | ||
| 43 | pr_info(" device:rmi_device = 0x%x \n", rmi_dev); | ||
| 44 | pr_info(" device:rmi_device:rmi_device_platform_data:driver_name = %s \n", pdata->driver_name); | ||
| 45 | pr_info(" rmi_device:driver = 0x%x \n", rmi_dev->driver); | ||
| 46 | |||
| 47 | if (!strcmp(pdata->driver_name, rmi_driver->driver.name)) { | ||
| 48 | rmi_dev->driver = rmi_driver; | ||
| 49 | pr_info(" names match, so now rmi_device:driver = 0x%x \n",rmi_dev->driver); | ||
| 50 | return 1; | ||
| 51 | } | ||
| 52 | pr_info(" names DO NOT match, so return nothing \n"); | ||
| 53 | |||
| 54 | return 0; | ||
| 55 | } | ||
| 56 | |||
| 57 | #ifdef CONFIG_PM | ||
| 58 | static int rmi_bus_suspend(struct device *dev) | ||
| 59 | { | ||
| 60 | #ifdef GENERIC_SUBSYS_PM_OPS | ||
| 61 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | ||
| 62 | |||
| 63 | if (pm && pm->suspend) | ||
| 64 | return pm->suspend(dev); | ||
| 65 | #endif | ||
| 66 | |||
| 67 | return 0; | ||
| 68 | } | ||
| 69 | |||
| 70 | static int rmi_bus_resume(struct device *dev) | ||
| 71 | { | ||
| 72 | #ifdef GENERIC_SUBSYS_PM_OPS | ||
| 73 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | ||
| 74 | pr_info("in function ____%s____ \n", __func__); | ||
| 75 | |||
| 76 | if (pm && pm->resume) | ||
| 77 | return pm->resume(dev); | ||
| 78 | #endif | ||
| 79 | |||
| 80 | return 0; | ||
| 81 | } | ||
| 82 | #endif | ||
| 83 | |||
| 84 | static int rmi_bus_probe(struct device *dev) | ||
| 85 | { | ||
| 86 | struct rmi_driver *driver; | ||
| 87 | struct rmi_device *rmi_dev = to_rmi_device(dev); | ||
| 88 | |||
| 89 | pr_info("in function ____%s____ \n", __func__); | ||
| 90 | driver = rmi_dev->driver; | ||
| 91 | if (driver && driver->probe) | ||
| 92 | return driver->probe(rmi_dev); | ||
| 93 | |||
| 94 | return 0; | ||
| 95 | } | ||
| 96 | |||
| 97 | static int rmi_bus_remove(struct device *dev) | ||
| 98 | { | ||
| 99 | struct rmi_driver *driver; | ||
| 100 | struct rmi_device *rmi_dev = to_rmi_device(dev); | ||
| 101 | |||
| 102 | pr_info("in function ____%s____ \n", __func__); | ||
| 103 | driver = rmi_dev->driver; | ||
| 104 | if (driver && driver->remove) | ||
| 105 | return driver->remove(rmi_dev); | ||
| 106 | |||
| 107 | return 0; | ||
| 108 | } | ||
| 109 | |||
| 110 | static void rmi_bus_shutdown(struct device *dev) | ||
| 111 | { | ||
| 112 | struct rmi_driver *driver; | ||
| 113 | struct rmi_device *rmi_dev = to_rmi_device(dev); | ||
| 114 | |||
| 115 | driver = rmi_dev->driver; | ||
| 116 | if (driver && driver->shutdown) | ||
| 117 | driver->shutdown(rmi_dev); | ||
| 118 | } | ||
| 119 | |||
| 120 | static SIMPLE_DEV_PM_OPS(rmi_bus_pm_ops, | ||
| 121 | rmi_bus_suspend, rmi_bus_resume); | ||
| 122 | |||
| 123 | struct bus_type rmi_bus_type = { | ||
| 124 | .name = "rmi", | ||
| 125 | .match = rmi_bus_match, | ||
| 126 | .probe = rmi_bus_probe, | ||
| 127 | .remove = rmi_bus_remove, | ||
| 128 | .shutdown = rmi_bus_shutdown, | ||
| 129 | .pm = &rmi_bus_pm_ops | ||
| 130 | }; | ||
| 131 | |||
| 132 | int rmi_register_phys_device(struct rmi_phys_device *phys) | ||
| 133 | { | ||
| 134 | static int phys_device_num; | ||
| 135 | struct rmi_device_platform_data *pdata = phys->dev->platform_data; | ||
| 136 | struct rmi_device *rmi_dev; | ||
| 137 | |||
| 138 | pr_info("in function ____%s____ \n", __func__); | ||
| 139 | |||
| 140 | if (!pdata) { | ||
| 141 | dev_err(phys->dev, "no platform data!\n"); | ||
| 142 | return -EINVAL; | ||
| 143 | } | ||
| 144 | |||
| 145 | rmi_dev = kzalloc(sizeof(struct rmi_device), GFP_KERNEL); | ||
| 146 | if (!rmi_dev) | ||
| 147 | return -ENOMEM; | ||
| 148 | |||
| 149 | rmi_dev->phys = phys; | ||
| 150 | rmi_dev->dev.bus = &rmi_bus_type; | ||
| 151 | dev_set_name(&rmi_dev->dev, "sensor%02d", phys_device_num++); | ||
| 152 | |||
| 153 | phys->rmi_dev = rmi_dev; | ||
| 154 | pr_info(" registering physical device:\n"); | ||
| 155 | pr_info(" dev.init_name = \n", rmi_dev->dev.init_name); | ||
| 156 | pr_info(" dev.bus->name = \n", rmi_dev->dev.bus->name); | ||
| 157 | return device_register(&rmi_dev->dev); | ||
| 158 | } | ||
| 159 | EXPORT_SYMBOL(rmi_register_phys_device); | ||
| 160 | |||
| 161 | void rmi_unregister_phys_device(struct rmi_phys_device *phys) | ||
| 162 | { | ||
| 163 | struct rmi_device *rmi_dev = phys->rmi_dev; | ||
| 164 | pr_info("in function ____%s____ \n", __func__); | ||
| 165 | |||
| 166 | device_unregister(&rmi_dev->dev); | ||
| 167 | kfree(rmi_dev); | ||
| 168 | } | ||
| 169 | EXPORT_SYMBOL(rmi_unregister_phys_device); | ||
| 170 | |||
| 171 | int rmi_register_driver(struct rmi_driver *driver) | ||
| 172 | { | ||
