[PATCH 01/05] input: RMI4 header file

2012-12-18 Thread Christopher Heiny
In addition to the changes described in part 0/5, this fixes some cut
issues in the comments for module_rmi_function_driver.

Signed-off-by: Christopher Heiny 
Cc: Dmitry Torokhov 
Cc: Linus Walleij 
Cc: Joeri de Gram 
Acked-by: Jean Delvare 

---

 include/linux/rmi.h |   95 +++
 1 files changed, 43 insertions(+), 52 deletions(-)

diff --git a/include/linux/rmi.h b/include/linux/rmi.h
index daca41b..eec926f 100644
--- a/include/linux/rmi.h
+++ b/include/linux/rmi.h
@@ -2,25 +2,16 @@
  * Copyright (c) 2011, 2012 Synaptics Incorporated
  * Copyright (c) 2011 Unixphere
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
  */

 #ifndef _RMI_H
 #define _RMI_H
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -31,7 +22,6 @@
 #include 
 #include 
 #include 
-#include 

 extern struct bus_type rmi_bus_type;

@@ -73,7 +63,7 @@ enum rmi_attn_polarity {
  *   automatically enabled for this sensor.
  */
 struct rmi_f11_2d_axis_alignment {
-   bool swap_axes;
+   u32 swap_axes;
bool flip_x;
bool flip_y;
int clip_X_low;
@@ -82,7 +72,6 @@ struct rmi_f11_2d_axis_alignment {
int clip_Y_high;
int offset_X;
int offset_Y;
-   int rel_report_enabled;
u8 delta_x_threshold;
u8 delta_y_threshold;
 };
@@ -105,6 +94,7 @@ enum rmi_f11_sensor_type {

 /**
  * struct rmi_f11_sensor_data - overrides defaults for a single F11 2D sensor.
+ *
  * @axis_align - provides axis alignment overrides (see above).
  * @type_a - all modern RMI F11 firmwares implement Multifinger Type B
  * protocol.  Set this to true to force MF Type A behavior, in case you find
@@ -338,13 +328,14 @@ struct rmi_function_descriptor {
u8 function_version;
 };

-struct rmi_function;
+struct rmi_function_dev;
 struct rmi_device;

 /**
- * struct rmi_function_handler - driver routines for a particular RMI function.
+ * struct rmi_function_driver - driver routines for a particular RMI function.
  *
  * @func: The RMI function number
+ * @probe: Called when the handler is successfully matched to a function 
device.
  * @reset: Called when a reset of the touch sensor is detected.  The routine
  * should perform any out-of-the-ordinary reset handling that might be
  * necessary.  Restoring of touch sensor configuration registers should be
@@ -361,37 +352,31 @@ struct rmi_device;
  *
  * All callbacks are expected to return 0 on success, error code on failure.
  */
-struct rmi_function_handler {
+struct rmi_function_driver {
struct device_driver driver;

u8 func;
-   int (*probe)(struct rmi_function *fn);
-   void (*remove)(struct rmi_function *fn);
-   int (*config)(struct rmi_function *fn);
-   int (*reset)(struct rmi_function *fn);
-   int (*attention)(struct rmi_function *fn, unsigned long *irq_bits);
+   int (*probe)(struct rmi_function_dev *fc);
+   int (*remove)(struct rmi_function_dev *fc);
+   int (*config)(struct rmi_function_dev *fc);
+   int (*reset)(struct rmi_function_dev *fc);
+   int (*attention)(struct rmi_function_dev *fc,
+   unsigned long *irq_bits);
 #ifdef CONFIG_PM
-   int (*suspend)(struct rmi_function *fn);
-   int (*resume)(struct rmi_function *fn);
+   int (*suspend)(struct rmi_function_dev *fc);
+   int (*resume)(struct rmi_function_dev *fc);
 #endif
 };

-#define to_rmi_function_handler(d) \
-   container_of(d, struct rmi_function_handler, driver)
-
-int __must_check __rmi_register_function_handler(struct rmi_function_handler *,
-struct module *, const char *);
-#define rmi_register_function_handler(handler) \
-   __rmi_register_function_handler(handler, THIS_MODULE, KBUILD_MODNAME)
-
-void rmi_unregister_function_handler(struct rmi_function_handler *);
+#define to_rmi_function_driver(d) \
+   container_of(d, struct rmi_function_driver, driver);

 /**
- * struct rmi_function - represents the implementation of an RMI4
- * function for a particular device (basically, a driver 

[PATCH 01/05] input: RMI4 header file

2012-12-18 Thread Christopher Heiny
In addition to the changes described in part 0/5, this fixes some cutpaste
issues in the comments for module_rmi_function_driver.

Signed-off-by: Christopher Heiny che...@synaptics.com
Cc: Dmitry Torokhov dmitry.torok...@gmail.com
Cc: Linus Walleij linus.wall...@stericsson.com
Cc: Joeri de Gram j.de.g...@gmail.com
Acked-by: Jean Delvare kh...@linux-fr.org

---

 include/linux/rmi.h |   95 +++
 1 files changed, 43 insertions(+), 52 deletions(-)

diff --git a/include/linux/rmi.h b/include/linux/rmi.h
index daca41b..eec926f 100644
--- a/include/linux/rmi.h
+++ b/include/linux/rmi.h
@@ -2,25 +2,16 @@
  * Copyright (c) 2011, 2012 Synaptics Incorporated
  * Copyright (c) 2011 Unixphere
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
  */

 #ifndef _RMI_H
 #define _RMI_H
 #include linux/kernel.h
 #include linux/cdev.h
+#include linux/debugfs.h
 #include linux/device.h
 #include linux/interrupt.h
 #include linux/input.h
@@ -31,7 +22,6 @@
 #include linux/stat.h
 #include linux/types.h
 #include linux/wait.h
-#include linux/debugfs.h

 extern struct bus_type rmi_bus_type;

@@ -73,7 +63,7 @@ enum rmi_attn_polarity {
  *   automatically enabled for this sensor.
  */
 struct rmi_f11_2d_axis_alignment {
-   bool swap_axes;
+   u32 swap_axes;
bool flip_x;
bool flip_y;
int clip_X_low;
@@ -82,7 +72,6 @@ struct rmi_f11_2d_axis_alignment {
int clip_Y_high;
int offset_X;
int offset_Y;
-   int rel_report_enabled;
u8 delta_x_threshold;
u8 delta_y_threshold;
 };
@@ -105,6 +94,7 @@ enum rmi_f11_sensor_type {

 /**
  * struct rmi_f11_sensor_data - overrides defaults for a single F11 2D sensor.
+ *
  * @axis_align - provides axis alignment overrides (see above).
  * @type_a - all modern RMI F11 firmwares implement Multifinger Type B
  * protocol.  Set this to true to force MF Type A behavior, in case you find
@@ -338,13 +328,14 @@ struct rmi_function_descriptor {
u8 function_version;
 };

-struct rmi_function;
+struct rmi_function_dev;
 struct rmi_device;

 /**
- * struct rmi_function_handler - driver routines for a particular RMI function.
+ * struct rmi_function_driver - driver routines for a particular RMI function.
  *
  * @func: The RMI function number
+ * @probe: Called when the handler is successfully matched to a function 
device.
  * @reset: Called when a reset of the touch sensor is detected.  The routine
  * should perform any out-of-the-ordinary reset handling that might be
  * necessary.  Restoring of touch sensor configuration registers should be
@@ -361,37 +352,31 @@ struct rmi_device;
  *
  * All callbacks are expected to return 0 on success, error code on failure.
  */
-struct rmi_function_handler {
+struct rmi_function_driver {
struct device_driver driver;

u8 func;
-   int (*probe)(struct rmi_function *fn);
-   void (*remove)(struct rmi_function *fn);
-   int (*config)(struct rmi_function *fn);
-   int (*reset)(struct rmi_function *fn);
-   int (*attention)(struct rmi_function *fn, unsigned long *irq_bits);
+   int (*probe)(struct rmi_function_dev *fc);
+   int (*remove)(struct rmi_function_dev *fc);
+   int (*config)(struct rmi_function_dev *fc);
+   int (*reset)(struct rmi_function_dev *fc);
+   int (*attention)(struct rmi_function_dev *fc,
+   unsigned long *irq_bits);
 #ifdef CONFIG_PM
-   int (*suspend)(struct rmi_function *fn);
-   int (*resume)(struct rmi_function *fn);
+   int (*suspend)(struct rmi_function_dev *fc);
+   int (*resume)(struct rmi_function_dev *fc);
 #endif
 };

-#define to_rmi_function_handler(d) \
-   container_of(d, struct rmi_function_handler, driver)
-
-int __must_check __rmi_register_function_handler(struct rmi_function_handler *,
-struct module *, const char *);
-#define rmi_register_function_handler(handler) \
-   __rmi_register_function_handler(handler, THIS_MODULE, KBUILD_MODNAME)
-
-void rmi_unregister_function_handler(struct