Linux Input/HID development
 help / color / mirror / Atom feed
* Re: [PATCH 00/15] Input: synaptics-rmi4 - cleanup and add DT support
From: Courtney Cavin @ 2014-01-25  1:08 UTC (permalink / raw)
  To: Christopher Heiny; +Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
In-Reply-To: <52E2F62B.80101@synaptics.com>

On Sat, Jan 25, 2014 at 12:24:27AM +0100, Christopher Heiny wrote:
> On 01/23/2014 04:00 PM, Courtney Cavin wrote:
> > This is an attempt to get this driver closer to being in an upstream-able form.
> > In the process, this drops legacy callback methods for managing power and GPIO
> > configuration, in favor of the already existing frameworks.  Most of this
> > series is cleanup, but there are a few intermixed bug fixes to make it all
> > work.
> 
> Hi Courtney!
> 
> Thanks for the extensive patches.  There's a great deal of cool stuff in 
> there that we're really happy to see (as in "buy Courtney a beer! No, 
> make it two beers!" levels of happy).  We really want to get the driver 
> upstream, and your improvements will help a lot.  The device tree work 
> looks to be particularly helpful.
> 

Thanks. Glad to help!

> Unfortunately some of your cleanup is too aggressive, and winds up 
> breaking code outside of the current patch submissions.  The current 
> patch codebase is significantly reduced in size in order to be more 
> manageable, but there's a non-trivial amount of production code outside 
> that codebase that depends on things like the current GPIO/IRQ handling, 
> the debugfs infrastructure, platform suspend/resume, and so on.  This 
> code will be submitted after the core of the driver is upstreamed. 
> Tearing out the supporting code now and then putting it all back later 
> just makes more work for all concerned.

I can definitely understand that some of your production code must
manage older kernels and alternative features.  The problem I see here is
that the driver will never get upstreamed with the GPIO/IRQ handling and
unused variables in the first place.  It is unnecessary in mainline, and
therefore should not exist in mainline.  I am not the maintainer though,
so... Dmitry should probably chime in on this.

> 
> Additionally, some of your changes are redundant to, or in conflict 
> with, patches submitted over the past few weeks.  Have you been 
> following that series and discussions relating to them?  It would 
> probably be more efficient for you to offer comments on those patches, 
> rather than submitting conflicting work.
> 

I did not see any specific logical conflicts other than saving the F01
container, which was needed for testing, and was independent of IRQ
counting.  Other than that, there should only need to be rebasing
one-way or the other.  I am simply basing my patches off of what exists
in the tree, which prevents awkward patch-series dependencies.

I did look at your patches, but didn't comment because I had nothing to
say.  I'll be sure to participate in patch discussions if I have
something to add.

... and after double checking, I just noticed that 1/15 conflicts
with your PDT scan cleanup, as we both have C++ comment style cleanup.
Whoops.

> We'll be going over the new feature and bug fix parts of this patch 
> series, and will send comments in the next couple of workdays.
> 
> 				Thanks,
> 					Chris
> 

I'm looking forward to some comments.

-Courtney

> >
> > This patch series is based off of the synaptics-rmi4 branch merged into
> > Linus' 3.13.  A tree is available at [1].
> >
> > This was tested on Synaptics TM2281-001 & TM2282-001.
> >
> > [1] http://github.com/courtc/linux.git
> > 	tag for-input/synaptics-rmi4
> >
> > Courtney Cavin (15):
> >    Input: synaptics-rmi4 - fix checkpatch.pl, sparse and GCC warnings
> >    Input: synaptics-rmi4 - don't kfree devm_ alloced memory
> >    Input: synaptics-rmi4 - don't free devices directly
> >    Input: synaptics-rmi4 - remove sensor name from platform data
> >    Input: synaptics-rmi4 - remove gpio handling and polling
> >    Input: synaptics-rmi4 - remove platform suspend callbacks
> >    Input: synaptics-rmi4 - remove remaining debugfs code
> >    Input: synaptics-rmi4 - cleanup platform data
> >    Input: synaptics-rmi4 - remove unused defines and variables
> >    Input: synaptics-rmi4 - add devicetree support
> >    Input: synaptics-rmi4 - add regulator support
> >    Input: synaptics-rmi4 - don't immediately set page on probe
> >    Input: synaptics-rmi4 - properly set F01 container on PDT scan
> >    Input: synaptics-rmi4 - ensure we have IRQs before reading status
> >    Input: synaptics-rmi4 - correct RMI4 spec url
> >
> >   Documentation/devicetree/bindings/input/rmi4.txt   | 117 +++++
> >   .../devicetree/bindings/vendor-prefixes.txt        |   1 +
> >   drivers/input/rmi4/Kconfig                         |   1 -
> >   drivers/input/rmi4/rmi_bus.c                       | 131 +-----
> >   drivers/input/rmi4/rmi_bus.h                       |  18 +-
> >   drivers/input/rmi4/rmi_driver.c                    | 321 +++++--------
> >   drivers/input/rmi4/rmi_driver.h                    |  33 +-
> >   drivers/input/rmi4/rmi_f01.c                       | 163 ++++---
> >   drivers/input/rmi4/rmi_f11.c                       | 523 ++++++---------------
> >   drivers/input/rmi4/rmi_i2c.c                       |  55 +--
> >   include/linux/rmi.h                                | 219 ++-------
> >   11 files changed, 551 insertions(+), 1031 deletions(-)
> >   create mode 100644 Documentation/devicetree/bindings/input/rmi4.txt
> >
> 
> 
> -- 
> 
> Christopher Heiny
> Senior Staff Firmware Engineer
> Synaptics Incorporated

^ permalink raw reply

* Re: [PATCH 00/15] Input: synaptics-rmi4 - cleanup and add DT support
From: Christopher Heiny @ 2014-01-24 23:24 UTC (permalink / raw)
  To: Courtney Cavin, linux-input; +Cc: dmitry.torokhov
In-Reply-To: <1390521623-6491-1-git-send-email-courtney.cavin@sonymobile.com>

On 01/23/2014 04:00 PM, Courtney Cavin wrote:
> This is an attempt to get this driver closer to being in an upstream-able form.
> In the process, this drops legacy callback methods for managing power and GPIO
> configuration, in favor of the already existing frameworks.  Most of this
> series is cleanup, but there are a few intermixed bug fixes to make it all
> work.

Hi Courtney!

Thanks for the extensive patches.  There's a great deal of cool stuff in 
there that we're really happy to see (as in "buy Courtney a beer! No, 
make it two beers!" levels of happy).  We really want to get the driver 
upstream, and your improvements will help a lot.  The device tree work 
looks to be particularly helpful.

Unfortunately some of your cleanup is too aggressive, and winds up 
breaking code outside of the current patch submissions.  The current 
patch codebase is significantly reduced in size in order to be more 
manageable, but there's a non-trivial amount of production code outside 
that codebase that depends on things like the current GPIO/IRQ handling, 
the debugfs infrastructure, platform suspend/resume, and so on.  This 
code will be submitted after the core of the driver is upstreamed. 
Tearing out the supporting code now and then putting it all back later 
just makes more work for all concerned.

Additionally, some of your changes are redundant to, or in conflict 
with, patches submitted over the past few weeks.  Have you been 
following that series and discussions relating to them?  It would 
probably be more efficient for you to offer comments on those patches, 
rather than submitting conflicting work.

We'll be going over the new feature and bug fix parts of this patch 
series, and will send comments in the next couple of workdays.

				Thanks,
					Chris

>
> This patch series is based off of the synaptics-rmi4 branch merged into
> Linus' 3.13.  A tree is available at [1].
>
> This was tested on Synaptics TM2281-001 & TM2282-001.
>
> [1] http://github.com/courtc/linux.git
> 	tag for-input/synaptics-rmi4
>
> Courtney Cavin (15):
>    Input: synaptics-rmi4 - fix checkpatch.pl, sparse and GCC warnings
>    Input: synaptics-rmi4 - don't kfree devm_ alloced memory
>    Input: synaptics-rmi4 - don't free devices directly
>    Input: synaptics-rmi4 - remove sensor name from platform data
>    Input: synaptics-rmi4 - remove gpio handling and polling
>    Input: synaptics-rmi4 - remove platform suspend callbacks
>    Input: synaptics-rmi4 - remove remaining debugfs code
>    Input: synaptics-rmi4 - cleanup platform data
>    Input: synaptics-rmi4 - remove unused defines and variables
>    Input: synaptics-rmi4 - add devicetree support
>    Input: synaptics-rmi4 - add regulator support
>    Input: synaptics-rmi4 - don't immediately set page on probe
>    Input: synaptics-rmi4 - properly set F01 container on PDT scan
>    Input: synaptics-rmi4 - ensure we have IRQs before reading status
>    Input: synaptics-rmi4 - correct RMI4 spec url
>
>   Documentation/devicetree/bindings/input/rmi4.txt   | 117 +++++
>   .../devicetree/bindings/vendor-prefixes.txt        |   1 +
>   drivers/input/rmi4/Kconfig                         |   1 -
>   drivers/input/rmi4/rmi_bus.c                       | 131 +-----
>   drivers/input/rmi4/rmi_bus.h                       |  18 +-
>   drivers/input/rmi4/rmi_driver.c                    | 321 +++++--------
>   drivers/input/rmi4/rmi_driver.h                    |  33 +-
>   drivers/input/rmi4/rmi_f01.c                       | 163 ++++---
>   drivers/input/rmi4/rmi_f11.c                       | 523 ++++++---------------
>   drivers/input/rmi4/rmi_i2c.c                       |  55 +--
>   include/linux/rmi.h                                | 219 ++-------
>   11 files changed, 551 insertions(+), 1031 deletions(-)
>   create mode 100644 Documentation/devicetree/bindings/input/rmi4.txt
>


-- 

Christopher Heiny
Senior Staff Firmware Engineer
Synaptics Incorporated

^ permalink raw reply

* [git pull] Input updates for 3.14-rc0
From: Dmitry Torokhov @ 2014-01-24 16:31 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, linux-input

[-- Attachment #1: Type: text/plain, Size: 17628 bytes --]

Hi Linus,

Please pull from:

	git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus
or
	master.kernel.org:/pub/scm/linux/kernel/git/dtor/input.git for-linus

to receive first round of updates for the input subsystem. Just a swath
of driver fixes and cleanups, no new drivers this time (although ALPS
now supports one of the newer protocols, more to come).

Changelog:
---------

Aleksej Makarov (1):
      Input: don't call input_dev_release_keys() in resume

Alexander Shiyan (1):
      Input: add a new driver for GPIO beeper

Antonio Ospite (3):
      Input: joystick - refer to /dev/input/js0 in documentation
      Input: joystick - use sizeof(VARIABLE) in documentation
      Input: fix typos in Documentation/input/gamepad.txt

Denis Carikli (1):
      Input: tsc2007 - add device tree support.

Dmitry Torokhov (6):
      Input: tsc2007 - remove unused poll_delay from platform data
      Input: tsc2007 - convert to use devres-managed resources
      Input: samsung-keypad - favor platform data if present
      Input: pmic8xxx-pwrkey - switch to using managed resources
      Input: twl6040-vibra - remove unneeded check for CONFIG_OF
      Input: twl4030-keypad - convert to using managed resources

Doug Anderson (1):
      Input: cros_ec_keyb - fix problems with backslash

Fabio Estevam (1):
      Input: ads7846 - use IS_ENABLED() macro

Geert Uytterhoeven (1):
      Input: logips2pp - fix spelling s/reciver/receiver/

Guenter Roeck (1):
      Input: ads7846 - convert to hwmon_device_register_with_groups()

Hans de Goede (1):
      Input: elantech -  improve clickpad detection

Jason Gerecke (1):
      Input: wacom - scale up touch width and height values for Intuos Pro

Jingoo Han (2):
      Input: serio - remove unnecessary pci_set_drvdata()
      Input: use dev_get_platdata()

K. Y. Srinivasan (1):
      Input: hyperv-keyboard - pass through 0xE1 prefix

Laurent Pinchart (1):
      Input: sh_keysc - restrict non-COMPILE_TEST compilation

Libo Chen (2):
      Input: twl4030-vibra - add missing of_node_put
      Input: twl6040-vibra - add missing of_node_put

Lothar Waßmann (1):
      Input: edt_ft5x06 - use devm_* functions where appropriate

Mark Salter (10):
      Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on alpha
      Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on ARM/Footbridge
      Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on IA64
      Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on mips
      Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on powerpc
      Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO for SH_CAYMAN
      Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on sparc
      Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on unicore32
      Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on x86
      Input: i8042 - cleanup SERIO_I8042 dependencies

Paul Gortmaker (1):
      Input: delete non-required instances of include <linux/init.h>

Petr Sebor (1):
      Input: xpad - add new USB IDs for Logitech F310 and F710

Ping Cheng (5):
      Input: wacom - make sure touch_max is set for touch devices
      Input: wacom - add support for three new Intuos devices
      Input: wacom - add reporting of SW_MUTE_DEVICE events
      Input: wacom - fix wacom->shared guards for dual input devices
      Input: wacom - add support for DTU-1031

Rashika Kheria (1):
      Input: cyttsp - include appropriate header file in cyttsp_i2c_common.c

Sachin Kamat (2):
      Input: keypad-ep93xx - cleanup header file
      Input: keypad-omap - cleanup header file

Sebastian Reichel (4):
      Input: twl4030-pwrbutton - add device tree support
      Input: twl4030-pwrbutton - use dev_err for errors
      Input: twl4030-pwrbutton - simplify driver using devm_*
      Input: twl4030-keypad - add device tree support

Stephen Boyd (4):
      Input: pm8xxx-vibrator - switch to using managed resources
      Input: pm8xxx-vibrator - migrate to regmap APIs
      Input: pmic8xxx-pwrkey - pass input device directly to interrupt
      Input: pmic8xxx-pwrkey - migrate to regmap APIs

Thomaz de Oliveira dos Reis (1):
      Input: xpad - change D-PAD mapping on Razer devices

Wei Yongjun (2):
      Input: zforce - fix error return code in zforce_start()
      Input: pmic8xxx-pwrkey - pass correct device identity to free_irq()

Yunkang Tang (1):
      Input: ALPS - add support for "Dolphin" devices


Diffstat:
--------

 .../devicetree/bindings/input/gpio-beeper.txt      |  13 ++
 .../bindings/input/touchscreen/tsc2007.txt         |  41 ++++
 .../devicetree/bindings/input/twl4030-keypad.txt   |  27 +++
 .../bindings/input/twl4030-pwrbutton.txt           |  21 ++
 Documentation/input/gamepad.txt                    |   6 +-
 Documentation/input/joystick-api.txt               |  38 ++--
 Documentation/input/joystick.txt                   |   8 +-
 arch/alpha/Kconfig                                 |   1 +
 arch/arm/mach-footbridge/Kconfig                   |   1 +
 arch/arm/mach-imx/mach-cpuimx35.c                  |   2 +-
 arch/arm/mach-imx/mach-cpuimx51sd.c                |   2 +-
 arch/ia64/Kconfig                                  |   1 +
 arch/mips/Kconfig                                  |   1 +
 arch/powerpc/Kconfig                               |   1 +
 arch/sh/boards/Kconfig                             |   1 +
 arch/sh/boards/mach-ecovec24/setup.c               |   2 +-
 arch/sparc/Kconfig                                 |   1 +
 arch/unicore32/Kconfig                             |   1 +
 arch/x86/Kconfig                                   |   1 +
 drivers/input/gameport/emu10k1-gp.c                |   1 -
 drivers/input/gameport/fm801-gp.c                  |   1 -
 drivers/input/input.c                              |  76 +++++--
 drivers/input/joystick/a3d.c                       |   1 -
 drivers/input/joystick/adi.c                       |   1 -
 drivers/input/joystick/cobra.c                     |   1 -
 drivers/input/joystick/gf2k.c                      |   1 -
 drivers/input/joystick/grip.c                      |   1 -
 drivers/input/joystick/grip_mp.c                   |   1 -
 drivers/input/joystick/guillemot.c                 |   1 -
 drivers/input/joystick/iforce/iforce.h             |   1 -
 drivers/input/joystick/interact.c                  |   1 -
 drivers/input/joystick/joydump.c                   |   1 -
 drivers/input/joystick/magellan.c                  |   1 -
 drivers/input/joystick/sidewinder.c                |   1 -
 drivers/input/joystick/spaceball.c                 |   1 -
 drivers/input/joystick/spaceorb.c                  |   1 -
 drivers/input/joystick/stinger.c                   |   1 -
 drivers/input/joystick/tmdc.c                      |   1 -
 drivers/input/joystick/twidjoy.c                   |   1 -
 drivers/input/joystick/warrior.c                   |   1 -
 drivers/input/joystick/xpad.c                      |   7 +-
 drivers/input/joystick/zhenhua.c                   |   1 -
 drivers/input/keyboard/Kconfig                     |   2 +-
 drivers/input/keyboard/adp5520-keys.c              |   3 +-
 drivers/input/keyboard/adp5588-keys.c              |  11 +-
 drivers/input/keyboard/adp5589-keys.c              |   9 +-
 drivers/input/keyboard/bf54x-keys.c                |   5 +-
 drivers/input/keyboard/cros_ec_keyb.c              |  15 +-
 drivers/input/keyboard/davinci_keyscan.c           |   2 +-
 drivers/input/keyboard/ep93xx_keypad.c             |   2 +-
 drivers/input/keyboard/goldfish_events.c           |   1 -
 drivers/input/keyboard/gpio_keys_polled.c          |   1 -
 drivers/input/keyboard/hil_kbd.c                   |   1 -
 drivers/input/keyboard/imx_keypad.c                |   4 +-
 drivers/input/keyboard/jornada680_kbd.c            |   1 -
 drivers/input/keyboard/jornada720_kbd.c            |   1 -
 drivers/input/keyboard/lkkbd.c                     |   1 -
 drivers/input/keyboard/lm8323.c                    |   2 +-
 drivers/input/keyboard/lm8333.c                    |   3 +-
 drivers/input/keyboard/matrix_keypad.c             |   1 -
 drivers/input/keyboard/max7359_keypad.c            |   3 +-
 drivers/input/keyboard/mcs_touchkey.c              |   3 +-
 drivers/input/keyboard/mpr121_touchkey.c           |   4 +-
 drivers/input/keyboard/newtonkbd.c                 |   1 -
 drivers/input/keyboard/nomadik-ske-keypad.c        |   3 +-
 drivers/input/keyboard/omap-keypad.c               |   3 +-
 drivers/input/keyboard/omap4-keypad.c              |   1 -
 drivers/input/keyboard/pxa27x_keypad.c             |   1 -
 drivers/input/keyboard/pxa930_rotary.c             |   4 +-
 drivers/input/keyboard/qt1070.c                    |   1 -
 drivers/input/keyboard/qt2160.c                    |   1 -
 drivers/input/keyboard/samsung-keypad.c            |  37 ++--
 drivers/input/keyboard/sh_keysc.c                  |   5 +-
 drivers/input/keyboard/spear-keyboard.c            |   1 -
 drivers/input/keyboard/stmpe-keypad.c              |   1 -
 drivers/input/keyboard/stowaway.c                  |   1 -
 drivers/input/keyboard/sunkbd.c                    |   1 -
 drivers/input/keyboard/tc3589x-keypad.c            |   1 -
 drivers/input/keyboard/tca6416-keypad.c            |   2 +-
 drivers/input/keyboard/tnetv107x-keypad.c          |   2 +-
 drivers/input/keyboard/twl4030_keypad.c            | 122 +++++------
 drivers/input/keyboard/w90p910_keypad.c            |   3 +-
 drivers/input/keyboard/xtkbd.c                     |   1 -
 drivers/input/misc/Kconfig                         |   9 +
 drivers/input/misc/Makefile                        |   1 +
 drivers/input/misc/ad714x.c                        |   5 +-
 drivers/input/misc/adxl34x.c                       |   3 +-
 drivers/input/misc/atlas_btns.c                    |   1 -
 drivers/input/misc/bfin_rotary.c                   |   3 +-
 drivers/input/misc/bma150.c                        |   3 +-
 drivers/input/misc/cma3000_d0x.c                   |   2 +-
 drivers/input/misc/cobalt_btns.c                   |   1 -
 drivers/input/misc/da9052_onkey.c                  |   1 -
 drivers/input/misc/da9055_onkey.c                  |   1 -
 drivers/input/misc/dm355evm_keys.c                 |   1 -
 drivers/input/misc/gp2ap002a00f.c                  |   2 +-
 drivers/input/misc/gpio-beeper.c                   | 127 ++++++++++++
 drivers/input/misc/gpio_tilt_polled.c              |   4 +-
 drivers/input/misc/keyspan_remote.c                |   1 -
 drivers/input/misc/kxtj9.c                         |   3 +-
 drivers/input/misc/max8997_haptic.c                |   1 -
 drivers/input/misc/mc13783-pwrbutton.c             |   1 -
 drivers/input/misc/mpu3050.c                       |   1 -
 drivers/input/misc/pcap_keys.c                     |   1 -
 drivers/input/misc/pcf50633-input.c                |   1 -
 drivers/input/misc/pcf8574_keypad.c                |   1 -
 drivers/input/misc/pcspkr.c                        |   1 -
 drivers/input/misc/pm8xxx-vibrator.c               | 107 +++-------
 drivers/input/misc/pmic8xxx-pwrkey.c               | 106 ++++------
 drivers/input/misc/powermate.c                     |   1 -
 drivers/input/misc/pwm-beeper.c                    |   2 +-
 drivers/input/misc/retu-pwrbutton.c                |   1 -
 drivers/input/misc/rotary_encoder.c                |   1 -
 drivers/input/misc/sgi_btns.c                      |   1 -
 drivers/input/misc/sirfsoc-onkey.c                 |   1 -
 drivers/input/misc/twl4030-pwrbutton.c             |  46 ++---
 drivers/input/misc/twl4030-vibra.c                 |   6 +-
 drivers/input/misc/twl6040-vibra.c                 |   8 +-
 drivers/input/misc/wm831x-on.c                     |   1 -
 drivers/input/misc/yealink.c                       |   1 -
 drivers/input/mouse/alps.c                         | 214 +++++++++++++++----
 drivers/input/mouse/alps.h                         |   7 +-
 drivers/input/mouse/appletouch.c                   |   1 -
 drivers/input/mouse/bcm5974.c                      |   1 -
 drivers/input/mouse/cypress_ps2.c                  |   1 -
 drivers/input/mouse/elantech.c                     |  45 +++-
 drivers/input/mouse/gpio_mouse.c                   |   3 +-
 drivers/input/mouse/logips2pp.c                    |   2 +-
 drivers/input/mouse/navpoint.c                     |   1 -
 drivers/input/mouse/pxa930_trkball.c               |   3 +-
 drivers/input/mouse/sermouse.c                     |   1 -
 drivers/input/mouse/synaptics_usb.c                |   1 -
 drivers/input/mouse/vsxxxaa.c                      |   1 -
 drivers/input/serio/Kconfig                        |  11 +-
 drivers/input/serio/altera_ps2.c                   |   1 -
 drivers/input/serio/ambakmi.c                      |   1 -
 drivers/input/serio/hyperv-keyboard.c              |   4 +-
 drivers/input/serio/libps2.c                       |   1 -
 drivers/input/serio/olpc_apsp.c                    |   1 -
 drivers/input/serio/pcips2.c                       |   2 -
 drivers/input/serio/q40kbd.c                       |   1 -
 drivers/input/serio/rpckbd.c                       |   1 -
 drivers/input/serio/serio_raw.c                    |   1 -
 drivers/input/serio/xilinx_ps2.c                   |   1 -
 drivers/input/tablet/acecad.c                      |   1 -
 drivers/input/tablet/aiptek.c                      |   1 -
 drivers/input/tablet/gtco.c                        |   1 -
 drivers/input/tablet/hanwang.c                     |   1 -
 drivers/input/tablet/kbtab.c                       |   1 -
 drivers/input/tablet/wacom.h                       |   1 -
 drivers/input/tablet/wacom_sys.c                   |  23 ++-
 drivers/input/tablet/wacom_wac.c                   | 169 +++++++++++++--
 drivers/input/tablet/wacom_wac.h                   |  13 +-
 drivers/input/touchscreen/88pm860x-ts.c            |   2 +-
 drivers/input/touchscreen/ad7877.c                 |   3 +-
 drivers/input/touchscreen/ad7879.c                 |   5 +-
 drivers/input/touchscreen/ads7846.c                |  86 +++-----
 drivers/input/touchscreen/atmel_mxt_ts.c           |   3 +-
 drivers/input/touchscreen/atmel_tsadcc.c           |   3 +-
 drivers/input/touchscreen/cy8ctmg110_ts.c          |   2 +-
 drivers/input/touchscreen/cyttsp_core.c            |   4 +-
 drivers/input/touchscreen/cyttsp_i2c_common.c      |   2 +
 drivers/input/touchscreen/da9034-ts.c              |   3 +-
 drivers/input/touchscreen/dynapro.c                |   1 -
 drivers/input/touchscreen/edt-ft5x06.c             |  71 +++----
 drivers/input/touchscreen/eeti_ts.c                |   2 +-
 drivers/input/touchscreen/egalax_ts.c              |   1 -
 drivers/input/touchscreen/elo.c                    |   1 -
 drivers/input/touchscreen/fujitsu_ts.c             |   1 -
 drivers/input/touchscreen/gunze.c                  |   1 -
 drivers/input/touchscreen/hampshire.c              |   1 -
 drivers/input/touchscreen/ili210x.c                |   2 +-
 drivers/input/touchscreen/inexio.c                 |   1 -
 drivers/input/touchscreen/intel-mid-touch.c        |   1 -
 drivers/input/touchscreen/jornada720_ts.c          |   1 -
 drivers/input/touchscreen/lpc32xx_ts.c             |   1 -
 drivers/input/touchscreen/mainstone-wm97xx.c       |   1 -
 drivers/input/touchscreen/max11801_ts.c            |   1 -
 drivers/input/touchscreen/mcs5000_ts.c             |   5 +-
 drivers/input/touchscreen/mms114.c                 |   1 -
 drivers/input/touchscreen/mtouch.c                 |   1 -
 drivers/input/touchscreen/pcap_ts.c                |   1 -
 drivers/input/touchscreen/penmount.c               |   1 -
 drivers/input/touchscreen/pixcir_i2c_ts.c          |   3 +-
 drivers/input/touchscreen/s3c2410_ts.c             |   5 +-
 drivers/input/touchscreen/st1232.c                 |   2 +-
 drivers/input/touchscreen/stmpe-ts.c               |   1 -
 drivers/input/touchscreen/ti_am335x_tsc.c          |   1 -
 drivers/input/touchscreen/touchit213.c             |   1 -
 drivers/input/touchscreen/touchright.c             |   1 -
 drivers/input/touchscreen/touchwin.c               |   1 -
 drivers/input/touchscreen/tsc2005.c                |   2 +-
 drivers/input/touchscreen/tsc2007.c                | 230 ++++++++++++++-------
 drivers/input/touchscreen/tsc40.c                  |   1 -
 drivers/input/touchscreen/ucb1400_ts.c             |   9 +-
 drivers/input/touchscreen/usbtouchscreen.c         |   1 -
 drivers/input/touchscreen/wacom_w8001.c            |   1 -
 drivers/input/touchscreen/wm831x-ts.c              |   1 -
 drivers/input/touchscreen/wm97xx-core.c            |   2 +-
 drivers/input/touchscreen/zforce_ts.c              |   3 +-
 drivers/input/touchscreen/zylonite-wm97xx.c        |   1 -
 include/linux/i2c/tsc2007.h                        |   8 +-
 include/linux/platform_data/keypad-ep93xx.h        |  10 +-
 include/linux/platform_data/keypad-omap.h          |   6 +-
 204 files changed, 1245 insertions(+), 768 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/gpio-beeper.txt
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt
 create mode 100644 Documentation/devicetree/bindings/input/twl4030-keypad.txt
 create mode 100644 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
 create mode 100644 drivers/input/misc/gpio-beeper.c


-- 
Dmitry


[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* [PATCH 2/2] iio: hid-sensor-hub: Remove hard coded indexes
From: Srinivas Pandruvada @ 2014-01-24  2:50 UTC (permalink / raw)
  To: jic23, jkosina; +Cc: linux-iio, linux-input, Srinivas Pandruvada
In-Reply-To: <1390531822-7640-1-git-send-email-srinivas.pandruvada@linux.intel.com>

Remove the hard coded indexes, instead search for usage id and
use the index to set the power and report state.
This will fix issue, where the report descriptor doesn't contain
the full list of possible selector for power and report state.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 .../iio/common/hid-sensors/hid-sensor-trigger.c    | 39 ++++++++++++++--------
 include/linux/hid-sensor-ids.h                     | 16 ++++-----
 2 files changed, 33 insertions(+), 22 deletions(-)

diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
index 7dcf839..dbefbda 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
@@ -38,29 +38,40 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig,
 	if (state) {
 		if (sensor_hub_device_open(st->hsdev))
 			return -EIO;
-		state_val =
-		HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM;
-		report_val =
-		HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM;
-
+		state_val = hid_sensor_get_usage_index(st->hsdev,
+			st->power_state.report_id,
+			st->power_state.index,
+			HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM);
+		report_val = hid_sensor_get_usage_index(st->hsdev,
+			st->report_state.report_id,
+			st->report_state.index,
+			HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM);
 	} else {
 		sensor_hub_device_close(st->hsdev);
-		state_val =
-		HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM;
-		report_val =
-		HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM;
+		state_val = hid_sensor_get_usage_index(st->hsdev,
+			st->power_state.report_id,
+			st->power_state.index,
+			HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM);
+		report_val = hid_sensor_get_usage_index(st->hsdev,
+			st->report_state.report_id,
+			st->report_state.index,
+			HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM);
 	}
-
 	st->data_ready = state;
-	state_val += st->power_state.logical_minimum;
-	report_val += st->report_state.logical_minimum;
-	sensor_hub_set_feature(st->hsdev, st->power_state.report_id,
+
+	if (state_val >= 0) {
+		state_val += st->power_state.logical_minimum;
+		sensor_hub_set_feature(st->hsdev, st->power_state.report_id,
 					st->power_state.index,
 					(s32)state_val);
+	}
 
-	sensor_hub_set_feature(st->hsdev, st->report_state.report_id,
+	if (report_val >= 0) {
+		report_val += st->report_state.logical_minimum;
+		sensor_hub_set_feature(st->hsdev, st->report_state.report_id,
 					st->report_state.index,
 					(s32)report_val);
+	}
 
 	return 0;
 }
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index beaf965..f860760 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -130,15 +130,15 @@
 #define HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS		0x1000
 
 /* Power state enumerations */
-#define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM		0x00
-#define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM		0x01
-#define HID_USAGE_SENSOR_PROP_POWER_STATE_D1_LOW_POWER_ENUM		0x02
-#define HID_USAGE_SENSOR_PROP_POWER_STATE_D2_STANDBY_WITH_WAKE_ENUM	0x03
-#define HID_USAGE_SENSOR_PROP_POWER_STATE_D3_SLEEP_WITH_WAKE_ENUM	0x04
-#define HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM		0x05
+#define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM	0x200850
+#define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM	0x200851
+#define HID_USAGE_SENSOR_PROP_POWER_STATE_D1_LOW_POWER_ENUM	0x200852
+#define HID_USAGE_SENSOR_PROP_POWER_STATE_D2_STANDBY_WITH_WAKE_ENUM 0x200853
+#define HID_USAGE_SENSOR_PROP_POWER_STATE_D3_SLEEP_WITH_WAKE_ENUM 0x200854
+#define HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM	0x200855
 
 /* Report State enumerations */
-#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM		0x00
-#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM		0x01
+#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM	0x200840
+#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM	0x200841
 
 #endif
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 1/2] hid: hid-sensor-hub: Add selector api
From: Srinivas Pandruvada @ 2014-01-24  2:50 UTC (permalink / raw)
  To: jic23-DgEjT+Ai2ygdnm+yROfE0A, jkosina-AlSwsSmVLrQ
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA, Srinivas Pandruvada

In some report descriptors, they leave holes in the selectors. In
this case if we use hardcoded selector values, this will result
in invalid values. For example, if there is selectors defined for
Power State from OFF to D0 to D3. We can't use indexes of these states
if some states are not implemented or not present in the report decriptors.
In this case, we need to get the indexes from report descriptors.

One API is added to get the index of a selector. This API will
search for usage id in the field usage list and return the index.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 drivers/hid/hid-sensor-hub.c   | 22 ++++++++++++++++++++++
 include/linux/hid-sensor-hub.h |  3 +++
 2 files changed, 25 insertions(+)

diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 46f4480..ad2b869 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -291,6 +291,28 @@ err_free:
 }
 EXPORT_SYMBOL_GPL(sensor_hub_input_attr_get_raw_value);
 
+int hid_sensor_get_usage_index(struct hid_sensor_hub_device *hsdev,
+				u32 report_id, int field_index, u32 usage_id)
+{
+	struct hid_report *report;
+	struct hid_field *field;
+	int i;
+
+	report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
+	if (!report || (field_index >= report->maxfield))
+		goto done_proc;
+
+	field = report->field[field_index];
+	for (i = 0; i < field->maxusage; ++i) {
+		if (field->usage[i].hid == usage_id)
+			return field->usage[i].usage_index;
+	}
+
+done_proc:
+	return -EINVAL;
+}
+EXPORT_SYMBOL_GPL(hid_sensor_get_usage_index);
+
 int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
 				u8 type,
 				u32 usage_id,
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index b914ca3..205eba0 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -218,4 +218,7 @@ int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st,
 int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st,
 					int *val1, int *val2);
 
+int hid_sensor_get_usage_index(struct hid_sensor_hub_device *hsdev,
+				u32 report_id, int field_index, u32 usage_id);
+
 #endif
-- 
1.8.3.2

^ permalink raw reply related

* Re: [PATCH 00/15] Input: synaptics-rmi4 - cleanup and add DT support
From: Courtney Cavin @ 2014-01-24  0:06 UTC (permalink / raw)
  To: linux-input@vger.kernel.org
  Cc: dmitry.torokhov@gmail.com, cheiny@synaptics.com
In-Reply-To: <1390521623-6491-1-git-send-email-courtney.cavin@sonymobile.com>

On Fri, Jan 24, 2014 at 01:00:08AM +0100, Courtney Cavin wrote:
> This is an attempt to get this driver closer to being in an upstream-able form.
> In the process, this drops legacy callback methods for managing power and GPIO
> configuration, in favor of the already existing frameworks.  Most of this
> series is cleanup, but there are a few intermixed bug fixes to make it all
> work.
> 
> This patch series is based off of the synaptics-rmi4 branch merged into
> Linus' 3.13.  A tree is available at [1].
> 
> This was tested on Synaptics TM2281-001 & TM2282-001.
> 
> [1] http://github.com/courtc/linux.git
> 	tag for-input/synaptics-rmi4
> 
> Courtney Cavin (15):
>   Input: synaptics-rmi4 - fix checkpatch.pl, sparse and GCC warnings
>   Input: synaptics-rmi4 - don't kfree devm_ alloced memory
>   Input: synaptics-rmi4 - don't free devices directly
>   Input: synaptics-rmi4 - remove sensor name from platform data
>   Input: synaptics-rmi4 - remove gpio handling and polling
>   Input: synaptics-rmi4 - remove platform suspend callbacks
>   Input: synaptics-rmi4 - remove remaining debugfs code
>   Input: synaptics-rmi4 - cleanup platform data
>   Input: synaptics-rmi4 - remove unused defines and variables
>   Input: synaptics-rmi4 - add devicetree support
>   Input: synaptics-rmi4 - add regulator support
>   Input: synaptics-rmi4 - don't immediately set page on probe
>   Input: synaptics-rmi4 - properly set F01 container on PDT scan
>   Input: synaptics-rmi4 - ensure we have IRQs before reading status
>   Input: synaptics-rmi4 - correct RMI4 spec url
> 
>  Documentation/devicetree/bindings/input/rmi4.txt   | 117 +++++
>  .../devicetree/bindings/vendor-prefixes.txt        |   1 +
>  drivers/input/rmi4/Kconfig                         |   1 -
>  drivers/input/rmi4/rmi_bus.c                       | 131 +-----
>  drivers/input/rmi4/rmi_bus.h                       |  18 +-
>  drivers/input/rmi4/rmi_driver.c                    | 321 +++++--------
>  drivers/input/rmi4/rmi_driver.h                    |  33 +-
>  drivers/input/rmi4/rmi_f01.c                       | 163 ++++---
>  drivers/input/rmi4/rmi_f11.c                       | 523 ++++++---------------
>  drivers/input/rmi4/rmi_i2c.c                       |  55 +--
>  include/linux/rmi.h                                | 219 ++-------
>  11 files changed, 551 insertions(+), 1031 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/input/rmi4.txt

Oh no!  Terribly sorry about the threading.  Somehow my gitconfig
'chainreplyto' setting was reset to 'true'.  It won't happen again ...
hopefully.

-Courtney

^ permalink raw reply

* [PATCH 15/15] Input: synaptics-rmi4 - correct RMI4 spec url
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny
In-Reply-To: <1390521623-6491-15-git-send-email-courtney.cavin@sonymobile.com>

Cc: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
---
 drivers/input/rmi4/rmi_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 9d8d6ec..9d845a4 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -7,7 +7,7 @@
  * The RMI4 specification can be found here (URL split for line length):
  *
  * http://www.synaptics.com/sites/default/files/
- *      511-000136-01-Rev-E-RMI4%20Intrfacing%20Guide.pdf
+ *      511-000136-01-Rev-E-RMI4-Interfacing-Guide.pdf
  *
  * 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
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH 14/15] Input: synaptics-rmi4 - ensure we have IRQs before reading status
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny
In-Reply-To: <1390521623-6491-14-git-send-email-courtney.cavin@sonymobile.com>

Cc: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
---
 drivers/input/rmi4/rmi_f01.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c
index 22b57f2..06fc5bc 100644
--- a/drivers/input/rmi4/rmi_f01.c
+++ b/drivers/input/rmi4/rmi_f01.c
@@ -318,13 +318,15 @@ static int rmi_f01_initialize(struct rmi_function *fn)
 	ctrl_base_addr += sizeof(u8);
 
 	data->interrupt_enable_addr = ctrl_base_addr;
-	error = rmi_read_block(rmi_dev, ctrl_base_addr,
-				data->device_control.interrupt_enable,
-				sizeof(u8) * (data->num_of_irq_regs));
-	if (error < 0) {
-		dev_err(&fn->dev,
-			"Failed to read F01 control interrupt enable register.\n");
-		goto error_exit;
+	if (data->num_of_irq_regs > 0) {
+		error = rmi_read_block(rmi_dev, ctrl_base_addr,
+					data->device_control.interrupt_enable,
+					sizeof(u8) * (data->num_of_irq_regs));
+		if (error < 0) {
+			dev_err(&fn->dev,
+				"Failed to read F01 control interrupt enable register.\n");
+			goto error_exit;
+		}
 	}
 
 	ctrl_base_addr += data->num_of_irq_regs;
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH 13/15] Input: synaptics-rmi4 - properly set F01 container on PDT scan
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny
In-Reply-To: <1390521623-6491-13-git-send-email-courtney.cavin@sonymobile.com>

Cc: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
---
 drivers/input/rmi4/rmi_driver.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 52345ae..9d8d6ec 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -488,6 +488,8 @@ static int create_function(struct rmi_device *rmi_dev,
 		return error;
 
 	list_add_tail(&fn->node, &data->function_list);
+	if (pdt->function_number == 0x01)
+		data->f01_container = fn;
 
 	return 0;
 }
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH 12/15] Input: synaptics-rmi4 - don't immediately set page on probe
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny
In-Reply-To: <1390521623-6491-12-git-send-email-courtney.cavin@sonymobile.com>

Since at the point of I2C probe, we cannot know if the voltage
regulators are on, wait until the physical driver requests a read before
setting the page.

Cc: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
---
 drivers/input/rmi4/rmi_i2c.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c
index 377d4cc..50ed5fd 100644
--- a/drivers/input/rmi4/rmi_i2c.c
+++ b/drivers/input/rmi4/rmi_i2c.c
@@ -209,15 +209,8 @@ static int rmi_i2c_probe(struct i2c_client *client,
 	rmi_i2c->xport.proto_name = "i2c";
 	rmi_i2c->xport.ops = &rmi_i2c_ops;
 
-	/*
-	 * Setting the page to zero will (a) make sure the PSR is in a
-	 * known state, and (b) make sure we can talk to the device.
-	 */
-	retval = rmi_set_page(rmi_i2c, 0);
-	if (retval) {
-		dev_err(&client->dev, "Failed to set page select to 0.\n");
-		return retval;
-	}
+	/* make sure we set the page on the first write */
+	rmi_i2c->page = -1;
 
 	retval = rmi_register_transport_device(&rmi_i2c->xport);
 	if (retval) {
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH 11/15] Input: synaptics-rmi4 - add regulator support
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny
In-Reply-To: <1390521623-6491-11-git-send-email-courtney.cavin@sonymobile.com>

Add support for VDD and VIO power supplies.  Since we may need a delay
after turning on the chip, adjust code to manage that.  This removes the
scanning for active interrupts on resume, as we should get an interrupt
when the chip is ready.

Cc: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
---
 Documentation/devicetree/bindings/input/rmi4.txt | 10 +++++
 drivers/input/rmi4/rmi_driver.c                  | 53 +++++++++++++++++++++++-
 drivers/input/rmi4/rmi_driver.h                  |  4 ++
 3 files changed, 66 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/input/rmi4.txt b/Documentation/devicetree/bindings/input/rmi4.txt
index fff9db7..d41beac 100644
--- a/Documentation/devicetree/bindings/input/rmi4.txt
+++ b/Documentation/devicetree/bindings/input/rmi4.txt
@@ -12,6 +12,16 @@ interrupts:
 	Desc: See devicetree/bindings/interrupt-controller/interrupts.txt;
 		Trigger sense required in mask
 
+vdd-supply:
+	Usage: optional (default: no regulator)
+	Type: <prop-encoded-array>
+	Desc: VDD power supply; See devicetree/bindings/regulator/regulator.txt
+
+vio-supply:
+	Usage: optional (default: no regulator)
+	Type: <prop-encoded-array>
+	Desc: VIO power supply; See devicetree/bindings/regulator/regulator.txt
+
 syn,reset-delay:
 	Usage: optional (default: 100)
 	Type: u32, milliseconds
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 92415ce..52345ae 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -28,6 +28,7 @@
 #include <linux/uaccess.h>
 #include <linux/of_irq.h>
 #include <linux/of.h>
+#include <linux/regulator/consumer.h>
 #include <uapi/linux/input.h>
 #include "rmi_bus.h"
 #include "rmi_driver.h"
@@ -101,7 +102,7 @@ static int enable_sensor(struct rmi_device *rmi_dev)
 
 	data->enabled = true;
 
-	return process_interrupt_requests(rmi_dev);
+	return 0;
 }
 
 static void rmi_free_function_list(struct rmi_device *rmi_dev)
@@ -616,14 +617,29 @@ error_exit:
 static int rmi_driver_suspend(struct device *dev)
 {
 	struct rmi_device *rmi_dev = to_rmi_device(dev);
+	struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
 
 	disable_sensor(rmi_dev);
+
+	regulator_disable(data->vio);
+	regulator_disable(data->vdd);
+
 	return 0;
 }
 
 static int rmi_driver_resume(struct device *dev)
 {
 	struct rmi_device *rmi_dev = to_rmi_device(dev);
+	struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
+	int retval;
+
+	retval = regulator_enable(data->vdd);
+	if (retval)
+		return retval;
+	retval = regulator_enable(data->vio);
+	if (retval)
+		return retval;
+
 	return enable_sensor(rmi_dev);
 }
 
@@ -634,7 +650,12 @@ static SIMPLE_DEV_PM_OPS(rmi_driver_pm, rmi_driver_suspend, rmi_driver_resume);
 static int rmi_driver_remove(struct device *dev)
 {
 	struct rmi_device *rmi_dev = to_rmi_device(dev);
+	struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
+
 	disable_sensor(rmi_dev);
+
+	regulator_disable(data->vio);
+	regulator_disable(data->vdd);
 	rmi_free_function_list(rmi_dev);
 
 	return 0;
@@ -649,6 +670,7 @@ static int rmi_driver_probe(struct device *dev)
 	int retval = 0;
 	struct rmi_device *rmi_dev;
 	unsigned int irq;
+	bool delay_start = false;
 	u32 reset_delay;
 
 	dev_dbg(dev, "%s: Starting probe.\n", __func__);
@@ -696,6 +718,33 @@ static int rmi_driver_probe(struct device *dev)
 	dev_set_drvdata(&rmi_dev->dev, data);
 	mutex_init(&data->pdt_mutex);
 
+	data->vdd = devm_regulator_get_optional(dev, "vdd");
+	if (IS_ERR(data->vdd)) {
+		dev_err(dev, "Failed to get regulator 'vdd'\n");
+		return PTR_ERR(data->vdd);
+	}
+	data->vio = devm_regulator_get_optional(dev, "vio");
+	if (IS_ERR(data->vio)) {
+		dev_err(dev, "Failed to get regulator 'vio'\n");
+		return PTR_ERR(data->vio);
+	}
+
+	if (data->vdd && !regulator_is_enabled(data->vdd))
+		delay_start = true;
+	if (data->vio && !regulator_is_enabled(data->vio))
+		delay_start = true;
+
+	retval = regulator_enable(data->vdd);
+	if (retval) {
+		dev_err(dev, "Failed to enable regulator\n");
+		return retval;
+	}
+	retval = regulator_enable(data->vio);
+	if (retval) {
+		dev_err(dev, "Failed to enable regulator\n");
+		return retval;
+	}
+
 	/*
 	 * Right before a warm boot, the sensor might be in some unusual state,
 	 * such as F54 diagnostics, or F34 bootloader mode.  In order to clear
@@ -714,6 +763,8 @@ static int rmi_driver_probe(struct device *dev)
 	 */
 	if (!reset_delay)
 		reset_delay = DEFAULT_RESET_DELAY_MS;
+	if (delay_start)
+		mdelay(reset_delay);
 	retval = rmi_initial_reset(rmi_dev, reset_delay);
 	if (retval)
 		dev_warn(dev, "RMI initial reset failed! Continuing in spite of this.\n");
diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h
index eafbdb3..d553722 100644
--- a/drivers/input/rmi4/rmi_driver.h
+++ b/drivers/input/rmi4/rmi_driver.h
@@ -29,9 +29,13 @@
 
 #define RMI_PDT_PROPS_HAS_BSR 0x02
 
+struct regulator;
+
 struct rmi_driver_data {
 	struct list_head function_list;
 
+	struct regulator *vdd;
+	struct regulator *vio;
 	struct rmi_device *rmi_dev;
 
 	struct rmi_function *f01_container;
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH 10/15] Input: synaptics-rmi4 - add devicetree support
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny
In-Reply-To: <1390521623-6491-10-git-send-email-courtney.cavin@sonymobile.com>

Cc: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
---
 Documentation/devicetree/bindings/input/rmi4.txt   | 107 +++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.txt        |   1 +
 drivers/input/rmi4/rmi_bus.c                       |  12 +-
 drivers/input/rmi4/rmi_bus.h                       |   3 +-
 drivers/input/rmi4/rmi_driver.c                    |  44 +++++--
 drivers/input/rmi4/rmi_f01.c                       | 107 +++++++++++++++--
 drivers/input/rmi4/rmi_f11.c                       | 133 ++++++++++++++++++++-
 drivers/input/rmi4/rmi_i2c.c                       |  19 +--
 8 files changed, 388 insertions(+), 38 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/rmi4.txt

diff --git a/Documentation/devicetree/bindings/input/rmi4.txt b/Documentation/devicetree/bindings/input/rmi4.txt
new file mode 100644
index 0000000..fff9db7
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/rmi4.txt
@@ -0,0 +1,107 @@
+Synaptics RMI4-based input device binding
+
+PROPERTIES
+
+compatible:
+	Usage: required
+	Type: string, must be "syn,rmi_i2c"
+
+interrupts:
+	Usage: required
+	Type: <prop-encoded-array>
+	Desc: See devicetree/bindings/interrupt-controller/interrupts.txt;
+		Trigger sense required in mask
+
+syn,reset-delay:
+	Usage: optional (default: 100)
+	Type: u32, milliseconds
+	Desc: Delay after issuing a reset
+
+syn,power-no-sleep:
+	Usage: optional, mutually exclusive with syn,power-sleep
+		(default: chip-specific)
+	Type: boolean
+	Desc: Disable sleep mode
+
+syn,power-sleep:
+	Usage: optional, mutually exclusive with syn,power-no-sleep
+		(default: chip-specific)
+	Type: boolean
+	Desc: Enable sleep mode
+
+syn,power-wakeup-thresh:
+	Usage: optional (default: chip-specific)
+	Type: u32, chip-specific unit [0-255]
+	Desc: Capacitance threshold at which device should wake
+
+syn,power-doze-holdoff:
+	Usage: optional (default: chip-specific)
+	Type: u32, milliseconds [0-25500]
+	Desc: Idle delay before entering sleep mode
+
+syn,power-doze-interval:
+	Usage: optional (default: chip-specific)
+	Type: u32, milliseconds [0-2550]
+	Desc: Interval between checks for idle
+
+syn,2d-rezero-wait:
+	Usage: optional (default: no re-zeroing)
+	Type: u32, milliseconds [0-65535]
+	Desc: Delay after resume to re-zero sensor
+
+syn,2d-axis-swap:
+	Usage: optional (default: false)
+	Type: boolean
+	Desc: Swap X and Y axis
+
+syn,2d-flip-x:
+	Usage: optional (default: false)
+	Type: boolean
+	Desc: Invert X axis
+
+syn,2d-flip-y:
+	Usage: optional (default: false)
+	Type: boolean
+	Desc: Invert Y axis
+
+syn,2d-clip-range:
+	Usage: optional (default: clip disabled)
+	Type: u32 array (<top left bottom right>) [0-65535]
+	Usage: Clip values outside this range
+
+syn,2d-offset:
+	Usage: optional (default: offset disabled)
+	Type: u32 array (<X-offset Y-offset>) [0-65535]
+	Usage: Add offset values to reported events
+
+syn,2d-delta-thresh:
+	Usage: optional (default: chip-specific)
+	Type: u32 array (<X-delta Y-delta>) [0-255]
+	Usage: Minimum delta before event is reported
+
+syn,2d-sensor-type:
+	Usage: optional (default: chip-specific)
+	Type: string, "indirect" or "direct"
+	Usage: Set screen type for event reporting
+
+syn,2d-type-a:
+	Usage: optional (default: false)
+	Type: boolean
+	Usage: Sensor supports only Multifinger Type A protocol
+
+EXAMPLE
+
+i2c@0 {
+	compatible = "...";
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	synaptics_rmi4@2c {
+		compatible = "syn,rmi_i2c";
+		reg = <0x2c>;
+
+		interrupts = <61 IRQ_TYPE_EDGE_FALLING>;
+
+		syn,2d-clip-range = <0 0 1919 1079>;
+	};
+};
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index edbb8d8..3388986 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -72,6 +72,7 @@ snps 	Synopsys, Inc.
 st	STMicroelectronics
 ste	ST-Ericsson
 stericsson	ST-Ericsson
+syn	Synaptics, Inc.
 ti	Texas Instruments
 toshiba	Toshiba Corporation
 toumaz	Toumaz
diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
index a51e6b4..57de579 100644
--- a/drivers/input/rmi4/rmi_bus.c
+++ b/drivers/input/rmi4/rmi_bus.c
@@ -52,14 +52,11 @@ bool rmi_is_physical_device(struct device *dev)
 int rmi_register_transport_device(struct rmi_transport_dev *xport)
 {
 	static atomic_t transport_device_count = ATOMIC_INIT(0);
-	struct rmi_device_platform_data *pdata = xport->dev->platform_data;
 	struct rmi_device *rmi_dev;
 	int error;
 
-	if (!pdata) {
-		dev_err(xport->dev, "no platform data!\n");
-		return -EINVAL;
-	}
+	if (unlikely(!rmi_bus_type.p))
+		return -EPROBE_DEFER;
 
 	rmi_dev = kzalloc(sizeof(struct rmi_device), GFP_KERNEL);
 	if (!rmi_dev)
@@ -70,8 +67,10 @@ int rmi_register_transport_device(struct rmi_transport_dev *xport)
 
 	dev_set_name(&rmi_dev->dev, "sensor%02d", rmi_dev->number);
 
+	rmi_dev->dev.parent = xport->dev;
 	rmi_dev->dev.bus = &rmi_bus_type;
 	rmi_dev->dev.type = &rmi_device_type;
+	rmi_dev->dev.of_node = xport->dev->of_node;
 
 	xport->rmi_dev = rmi_dev;
 
@@ -206,6 +205,9 @@ int __rmi_register_function_handler(struct rmi_function_handler *handler,
 	struct device_driver *driver = &handler->driver;
 	int error;
 
+	if (WARN_ON(unlikely(!rmi_bus_type.p)))
+		return -EAGAIN;
+
 	driver->bus = &rmi_bus_type;
 	driver->owner = owner;
 	driver->mod_name = mod_name;
diff --git a/drivers/input/rmi4/rmi_bus.h b/drivers/input/rmi4/rmi_bus.h
index a21e4c4..51f9372 100644
--- a/drivers/input/rmi4/rmi_bus.h
+++ b/drivers/input/rmi4/rmi_bus.h
@@ -212,7 +212,8 @@ struct rmi_device {
 };
 
 #define to_rmi_device(d) container_of(d, struct rmi_device, dev)
-#define to_rmi_platform_data(d) ((d)->xport->dev->platform_data)
+#define to_rmi_xport_device(d) ((d)->xport->dev)
+#define to_rmi_platform_data(d) (dev_get_platdata(to_rmi_xport_device(d)))
 
 bool rmi_is_physical_device(struct device *dev);
 
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 9ec7b93..92415ce 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -26,6 +26,8 @@
 #include <linux/rmi.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
+#include <linux/of_irq.h>
+#include <linux/of.h>
 #include <uapi/linux/input.h>
 #include "rmi_bus.h"
 #include "rmi_driver.h"
@@ -498,7 +500,7 @@ static int create_function(struct rmi_device *rmi_dev,
  * We have to do this before actually building the PDT because the reflash
  * updates (if any) might cause various registers to move around.
  */
-static int rmi_initial_reset(struct rmi_device *rmi_dev)
+static int rmi_initial_reset(struct rmi_device *rmi_dev, u32 reset_delay)
 {
 	struct pdt_entry pdt_entry;
 	int page;
@@ -507,8 +509,6 @@ static int rmi_initial_reset(struct rmi_device *rmi_dev)
 	bool has_f01 = false;
 	int i;
 	int retval;
-	const struct rmi_device_platform_data *pdata =
-			to_rmi_platform_data(rmi_dev);
 
 	dev_dbg(dev, "Initial reset.\n");
 
@@ -538,7 +538,7 @@ static int rmi_initial_reset(struct rmi_device *rmi_dev)
 						retval);
 					return retval;
 				}
-				mdelay(pdata->reset_delay_ms);
+				mdelay(reset_delay);
 				done = true;
 				has_f01 = true;
 				break;
@@ -648,6 +648,8 @@ static int rmi_driver_probe(struct device *dev)
 	struct rmi_device_platform_data *pdata;
 	int retval = 0;
 	struct rmi_device *rmi_dev;
+	unsigned int irq;
+	u32 reset_delay;
 
 	dev_dbg(dev, "%s: Starting probe.\n", __func__);
 
@@ -661,6 +663,28 @@ static int rmi_driver_probe(struct device *dev)
 	rmi_dev->driver = rmi_driver;
 
 	pdata = to_rmi_platform_data(rmi_dev);
+	if (pdata == NULL) {
+#ifdef CONFIG_OF
+		const char *p;
+
+		p = "syn,reset-delay";
+		retval = of_property_read_u32(dev->of_node, p, &reset_delay);
+		if (retval && retval != -EINVAL) {
+			dev_err(dev, "Invalid '%s' property\n", p);
+			return -EINVAL;
+		}
+		if (retval == -EINVAL)
+			reset_delay = 0;
+
+		irq = irq_of_parse_and_map(dev->of_node, 0);
+#else
+		dev_err(dev, "No pdata\n");
+		return -EINVAL;
+#endif
+	} else {
+		reset_delay = pdata->reset_delay_ms;
+		irq = pdata->irq;
+	}
 
 	data = devm_kzalloc(dev, sizeof(struct rmi_driver_data), GFP_KERNEL);
 	if (!data) {
@@ -688,9 +712,9 @@ static int rmi_driver_probe(struct device *dev)
 	 * and leave the customer's device unusable.  So we warn them, and
 	 * continue processing.
 	 */
-	if (!pdata->reset_delay_ms)
-		pdata->reset_delay_ms = DEFAULT_RESET_DELAY_MS;
-	retval = rmi_initial_reset(rmi_dev);
+	if (!reset_delay)
+		reset_delay = DEFAULT_RESET_DELAY_MS;
+	retval = rmi_initial_reset(rmi_dev, reset_delay);
 	if (retval)
 		dev_warn(dev, "RMI initial reset failed! Continuing in spite of this.\n");
 
@@ -762,10 +786,10 @@ static int rmi_driver_probe(struct device *dev)
 		goto err_free_data;
 	}
 
-	data->irq = pdata->irq;
-	if (data->irq < 0) {
+	data->irq = irq;
+	if (data->irq < 0 || data->irq == NO_IRQ) {
 		dev_err(dev, "Failed to get attn IRQ.\n");
-		retval = data->irq;
+		retval = -EINVAL;
 		goto err_free_data;
 
 	}
diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c
index 4cb9fcb..22b57f2 100644
--- a/drivers/input/rmi4/rmi_f01.c
+++ b/drivers/input/rmi4/rmi_f01.c
@@ -12,6 +12,7 @@
 #include <linux/rmi.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
+#include <linux/of.h>
 #include "rmi_driver.h"
 
 #define RMI_PRODUCT_ID_LENGTH    10
@@ -169,15 +170,104 @@ static int rmi_f01_read_properties(struct rmi_device *rmi_dev,
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static int rmi_f01_of_parse(struct device *dev,
+		struct rmi_f01_power_management *cdata)
+{
+	bool sleep, nosleep;
+	const char *p;
+	u32 val;
+	int rc;
+
+	if (dev->of_node == NULL)
+		return -EINVAL;
+
+	memset(cdata, 0, sizeof(*cdata));
+
+	sleep = of_property_read_bool(dev->of_node, "syn,power-sleep");
+	nosleep = of_property_read_bool(dev->of_node, "syn,power-nosleep");
+	if (sleep && nosleep) {
+		dev_err(dev, "'syn,power-sleep' and 'syn,power-nosleep' are mutually exclusive\n");
+		return -EINVAL;
+	}
+	if (sleep)
+		cdata->nosleep = RMI_F01_NOSLEEP_OFF;
+	else if (nosleep)
+		cdata->nosleep = RMI_F01_NOSLEEP_ON;
+
+	p = "syn,power-wakeup-thresh";
+	rc = of_property_read_u32(dev->of_node, p, &val);
+	if (rc && rc != -EINVAL) {
+		dev_err(dev, "Invalid '%s' property\n", p);
+		return rc;
+	}
+	if (rc != -EINVAL) {
+		if (val & ~0xff) {
+			dev_err(dev, "'%s' out of range [0-255]\n", p);
+			return -EINVAL;
+		}
+		cdata->wakeup_threshold = val;
+	}
+
+	p = "syn,power-doze-holdoff";
+	rc = of_property_read_u32(dev->of_node, p, &val);
+	if (rc && rc != -EINVAL) {
+		dev_err(dev, "Invalid '%s' property\n", p);
+		return rc;
+	}
+	if (rc != -EINVAL) {
+		if (val > 25500) {
+			dev_err(dev, "'%s' out of range [0-25500]ms\n", p);
+			return -EINVAL;
+		}
+		cdata->doze_holdoff = (val + 50) / 100;
+	}
+
+	p = "syn,power-doze-interval";
+	rc = of_property_read_u32(dev->of_node, p, &val);
+	if (rc && rc != -EINVAL) {
+		dev_err(dev, "Invalid '%s' property\n", p);
+		return rc;
+	}
+	if (rc != -EINVAL) {
+		if (val > 2550) {
+			dev_err(dev, "'%s' out of range [0-2550]ms\n", p);
+			return -EINVAL;
+		}
+		cdata->doze_interval = (val + 5) / 10;
+	}
+
+	return 0;
+}
+#else
+static int rmi_f01_of_parse(struct device *dev,
+		struct rmi_f01_power_management *cdata)
+{
+	return -EINVAL;
+}
+#endif
+
 static int rmi_f01_initialize(struct rmi_function *fn)
 {
 	u8 temp;
 	int error;
 	u16 ctrl_base_addr;
+	struct rmi_f01_power_management cdata;
 	struct rmi_device *rmi_dev = fn->rmi_dev;
+	struct device *dev = to_rmi_xport_device(rmi_dev);
 	struct rmi_driver_data *driver_data = dev_get_drvdata(&rmi_dev->dev);
 	struct f01_data *data = fn->data;
-	struct rmi_device_platform_data *pdata = to_rmi_platform_data(rmi_dev);
+	struct rmi_device_platform_data *pdata = dev_get_platdata(dev);
+
+	if (pdata != NULL) {
+		cdata = pdata->power_management;
+	} else {
+		error = rmi_f01_of_parse(dev, &cdata);
+		if (error) {
+			dev_err(dev, "Unable to parse DT data\n");
+			return error;
+		}
+	}
 
 	/*
 	 * Set the configured bit and (optionally) other important stuff
@@ -191,7 +281,7 @@ static int rmi_f01_initialize(struct rmi_function *fn)
 		dev_err(&fn->dev, "Failed to read F01 control.\n");
 		return error;
 	}
-	switch (pdata->power_management.nosleep) {
+	switch (cdata.nosleep) {
 	case RMI_F01_NOSLEEP_DEFAULT:
 		break;
 	case RMI_F01_NOSLEEP_OFF:
@@ -262,9 +352,9 @@ static int rmi_f01_initialize(struct rmi_function *fn)
 		data->doze_interval_addr = ctrl_base_addr;
 		ctrl_base_addr++;
 
-		if (pdata->power_management.doze_interval) {
+		if (cdata.doze_interval) {
 			data->device_control.doze_interval =
-				pdata->power_management.doze_interval;
+				cdata.doze_interval;
 			error = rmi_write(rmi_dev, data->doze_interval_addr,
 					data->device_control.doze_interval);
 			if (error < 0) {
@@ -283,9 +373,9 @@ static int rmi_f01_initialize(struct rmi_function *fn)
 		data->wakeup_threshold_addr = ctrl_base_addr;
 		ctrl_base_addr++;
 
-		if (pdata->power_management.wakeup_threshold) {
+		if (cdata.wakeup_threshold) {
 			data->device_control.wakeup_threshold =
-				pdata->power_management.wakeup_threshold;
+				cdata.wakeup_threshold;
 			error = rmi_write(rmi_dev, data->wakeup_threshold_addr,
 					data->device_control.wakeup_threshold);
 			if (error < 0) {
@@ -306,9 +396,8 @@ static int rmi_f01_initialize(struct rmi_function *fn)
 		data->doze_holdoff_addr = ctrl_base_addr;
 		ctrl_base_addr++;
 
-		if (pdata->power_management.doze_holdoff) {
-			data->device_control.doze_holdoff =
-				pdata->power_management.doze_holdoff;
+		if (cdata.doze_holdoff) {
+			data->device_control.doze_holdoff = cdata.doze_holdoff;
 			error = rmi_write(rmi_dev, data->doze_holdoff_addr,
 					data->device_control.doze_holdoff);
 			if (error < 0) {
diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c
index b114f25..837b6e7 100644
--- a/drivers/input/rmi4/rmi_f11.c
+++ b/drivers/input/rmi4/rmi_f11.c
@@ -13,6 +13,7 @@
 #include <linux/input.h>
 #include <linux/input/mt.h>
 #include <linux/kconfig.h>
+#include <linux/of.h>
 #include <linux/rmi.h>
 #include <linux/slab.h>
 #include "rmi_driver.h"
@@ -794,9 +795,120 @@ static void f11_set_abs_params(struct rmi_function *fn)
 				     0, MT_TOOL_FINGER, 0, 0);
 }
 
+#ifdef CONFIG_OF
+static int rmi_f11_of_parse(struct device *dev,
+		struct rmi_f11_sensor_data *cdata)
+{
+	const char *type;
+	const char *p;
+	u32 a[4];
+	int rc;
+
+	if (dev->of_node == NULL)
+		return -EINVAL;
+
+	memset(cdata, 0, sizeof(*cdata));
+
+	p = "syn,2d-rezero-wait";
+	rc = of_property_read_u32(dev->of_node, p, &a[0]);
+	if (rc && rc != -EINVAL) {
+		dev_err(dev, "Invalid '%s' property\n", p);
+		return rc;
+	}
+	if (rc != -EINVAL) {
+		if (a[0] & ~0xffff) {
+			dev_err(dev, "'%s' value out of range [0-65535]\n", p);
+			return -EINVAL;
+		}
+		cdata->rezero_wait = a[0];
+	}
+
+	cdata->type_a = of_property_read_bool(dev->of_node, "syn,2d-type-a");
+	cdata->axis_align.swap_axes = of_property_read_bool(dev->of_node,
+			"syn,2d-axis-swap");
+	cdata->axis_align.flip_x = of_property_read_bool(dev->of_node,
+			"syn,2d-flip-x");
+	cdata->axis_align.flip_y = of_property_read_bool(dev->of_node,
+			"syn,2d-flip-y");
+
+	p = "syn-2d-clip-range";
+	rc = of_property_read_u32_array(dev->of_node, p, a, 4);
+	if (rc && rc != -EINVAL) {
+		dev_err(dev, "Invalid '%s' property\n", p);
+		return rc;
+	}
+	if (rc != -EINVAL) {
+		if ((a[0] | a[1] | a[2] | a[3]) & ~0xffff) {
+			dev_err(dev, "'%s' values out of range [0-65535]\n", p);
+			return -EINVAL;
+		}
+		cdata->axis_align.clip_x_low = a[0];
+		cdata->axis_align.clip_y_low = a[1];
+		cdata->axis_align.clip_x_high = a[2];
+		cdata->axis_align.clip_y_high = a[3];
+	}
+
+	p = "syn-2d-offset";
+	rc = of_property_read_u32_array(dev->of_node, p, a, 2);
+	if (rc && rc != -EINVAL) {
+		dev_err(dev, "Invalid '%s' property\n", p);
+		return rc;
+	}
+	if (rc != -EINVAL) {
+		if ((a[0] | a[1]) & ~0xffff) {
+			dev_err(dev, "'%s' values out of range [0-65535]\n", p);
+			return -EINVAL;
+		}
+		cdata->axis_align.offset_x = a[0];
+		cdata->axis_align.offset_y = a[1];
+	}
+
+	p = "syn,2d-delta-thresh";
+	rc = of_property_read_u32_array(dev->of_node, p, a, 2);
+	if (rc && rc != -EINVAL) {
+		dev_err(dev, "Invalid '%s' property\n", p);
+		return rc;
+	}
+	if (rc != -EINVAL) {
+		if ((a[0] | a[1]) & ~0xff) {
+			dev_err(dev, "'%s' values out of range [0-255]\n", p);
+			return -EINVAL;
+		}
+		cdata->axis_align.delta_x_threshold = a[0];
+		cdata->axis_align.delta_y_threshold = a[1];
+	}
+
+	p = "syn,2d-sensor-type";
+	rc = of_property_read_string(dev->of_node, p, &type);
+	if (rc && rc != -EINVAL) {
+		dev_err(dev, "Invalid '%s' property\n", p);
+		return rc;
+	}
+	if (rc != -EINVAL) {
+		if (!strcmp(type, "direct")) {
+			cdata->sensor_type = RMI_F11_SENSOR_DIRECT;
+		} else if (!strcmp(type, "indirect")) {
+			cdata->sensor_type = RMI_F11_SENSOR_INDIRECT;
+		} else {
+			dev_err(dev, "'%s' must be one of: \"indirect\", \"direct\"\n", p);
+			return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+#else
+static int rmi_f11_of_parse(struct device *dev,
+		struct rmi_f11_sensor_data *cdata)
+{
+	return -EINVAL;
+}
+#endif
+
 static int rmi_f11_initialize(struct rmi_function *fn)
 {
 	struct rmi_device *rmi_dev = fn->rmi_dev;
+	struct device *dev = to_rmi_xport_device(rmi_dev);
 	struct f11_data *f11;
 	struct f11_2d_ctrl *ctrl;
 	u8 query_offset;
@@ -804,12 +916,23 @@ static int rmi_f11_initialize(struct rmi_function *fn)
 	u16 control_base_addr;
 	u16 max_x_pos, max_y_pos, temp;
 	int rc;
-	struct rmi_device_platform_data *pdata = to_rmi_platform_data(rmi_dev);
+	struct rmi_device_platform_data *pdata = dev_get_platdata(dev);
+	struct rmi_f11_sensor_data cdata;
 	struct f11_2d_sensor *sensor;
 	u8 buf;
 
 	dev_dbg(&fn->dev, "Initializing F11 values.\n");
 
+	if (pdata != NULL) {
+		cdata = pdata->f11_sensor_data;
+	} else {
+		rc = rmi_f11_of_parse(dev, &cdata);
+		if (rc) {
+			dev_err(dev, "Unable to parse DT data\n");
+			return rc;
+		}
+	}
+
 	/*
 	** init instance data, fill in values and create any sysfs files
 	*/
@@ -818,7 +941,7 @@ static int rmi_f11_initialize(struct rmi_function *fn)
 		return -ENOMEM;
 
 	fn->data = f11;
-	f11->rezero_wait_ms = pdata->f11_sensor_data.rezero_wait;
+	f11->rezero_wait_ms = cdata.rezero_wait;
 
 	query_base_addr = fn->fd.query_base_addr;
 	control_base_addr = fn->fd.control_base_addr;
@@ -851,9 +974,9 @@ static int rmi_f11_initialize(struct rmi_function *fn)
 		return rc;
 	}
 
-	sensor->axis_align = pdata->f11_sensor_data.axis_align;
-	sensor->type_a = pdata->f11_sensor_data.type_a;
-	sensor->sensor_type = pdata->f11_sensor_data.sensor_type;
+	sensor->axis_align = cdata.axis_align;
+	sensor->type_a = cdata.type_a;
+	sensor->sensor_type = cdata.sensor_type;
 
 	rc = rmi_read_block(rmi_dev,
 		control_base_addr + F11_CTRL_SENSOR_MAX_X_POS_OFFSET,
diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c
index aebf974..377d4cc 100644
--- a/drivers/input/rmi4/rmi_i2c.c
+++ b/drivers/input/rmi4/rmi_i2c.c
@@ -186,16 +186,9 @@ static const struct rmi_transport_ops rmi_i2c_ops = {
 static int rmi_i2c_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	const struct rmi_device_platform_data *pdata =
-				dev_get_platdata(&client->dev);
 	struct rmi_i2c_xport *rmi_i2c;
 	int retval;
 
-	if (!pdata) {
-		dev_err(&client->dev, "no platform data\n");
-		return -EINVAL;
-	}
-
 	dev_dbg(&client->dev, "Probing %#02x.\n", client->addr);
 
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
@@ -258,10 +251,20 @@ static const struct i2c_device_id rmi_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, rmi_id);
 
+#ifdef CONFIG_OF
+static struct of_device_id rmi_match_table[] = {
+	{ .compatible = "syn,rmi_i2c", },
+	{ },
+};
+#else
+#define rmi_match_table NULL
+#endif
+
 static struct i2c_driver rmi_i2c_driver = {
 	.driver = {
 		.owner	= THIS_MODULE,
-		.name	= "rmi_i2c"
+		.name	= "rmi_i2c",
+		.of_match_table = rmi_match_table,
 	},
 	.id_table	= rmi_id,
 	.probe		= rmi_i2c_probe,
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH 09/15] Input: synaptics-rmi4 - remove unused defines and variables
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny
In-Reply-To: <1390521623-6491-9-git-send-email-courtney.cavin@sonymobile.com>

This is neither a library nor documentation, so it doesn't need to
contain all of the information available.  Remove most of the unused
struct members and defines.  If they are need to implement some
functionality at a later point, they can be added back at that point.

Cc: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
---
 drivers/input/rmi4/rmi_bus.h    |   1 -
 drivers/input/rmi4/rmi_driver.c |   3 -
 drivers/input/rmi4/rmi_f01.c    |  40 -----
 drivers/input/rmi4/rmi_f11.c    | 375 ----------------------------------------
 4 files changed, 419 deletions(-)

diff --git a/drivers/input/rmi4/rmi_bus.h b/drivers/input/rmi4/rmi_bus.h
index 62fd544..a21e4c4 100644
--- a/drivers/input/rmi4/rmi_bus.h
+++ b/drivers/input/rmi4/rmi_bus.h
@@ -278,7 +278,6 @@ static inline int rmi_write_block(struct rmi_device *d, u16 addr,
 
 int rmi_register_transport_device(struct rmi_transport_dev *xport);
 void rmi_unregister_transport_device(struct rmi_transport_dev *xport);
-int rmi_for_each_dev(void *data, int (*func)(struct device *dev, void *data));
 
 /**
  * module_rmi_driver() - Helper macro for registering a function driver
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index e44eff7..9ec7b93 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -32,15 +32,12 @@
 
 #define RMI4_MAX_N_IRQS 256
 
-#define HAS_NONSTANDARD_PDT_MASK 0x40
 #define RMI4_MAX_PAGE 0xff
 #define RMI4_PAGE_SIZE 0x100
 
 #define RMI_DEVICE_RESET_CMD	0x01
 #define DEFAULT_RESET_DELAY_MS	100
 
-#define DEFAULT_POLL_INTERVAL_MS	13
-
 static irqreturn_t rmi_irq_thread(int irq, void *p)
 {
 	struct rmi_transport_dev *xport = p;
diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c
index 98bc65a9..4cb9fcb 100644
--- a/drivers/input/rmi4/rmi_f01.c
+++ b/drivers/input/rmi4/rmi_f01.c
@@ -15,27 +15,11 @@
 #include "rmi_driver.h"
 
 #define RMI_PRODUCT_ID_LENGTH    10
-#define RMI_PRODUCT_INFO_LENGTH   2
-
-#define RMI_DATE_CODE_LENGTH      3
-
-#define PRODUCT_ID_OFFSET 0x10
-#define PRODUCT_INFO_OFFSET 0x1E
-
-
-/* Force a firmware reset of the sensor */
-#define RMI_F01_CMD_DEVICE_RESET	1
 
 /* Various F01_RMI_QueryX bits */
-
-#define RMI_F01_QRY1_CUSTOM_MAP		(1 << 0)
-#define RMI_F01_QRY1_NON_COMPLIANT	(1 << 1)
 #define RMI_F01_QRY1_HAS_LTS		(1 << 2)
-#define RMI_F01_QRY1_HAS_SENSOR_ID	(1 << 3)
-#define RMI_F01_QRY1_HAS_CHARGER_INP	(1 << 4)
 #define RMI_F01_QRY1_HAS_ADJ_DOZE	(1 << 5)
 #define RMI_F01_QRY1_HAS_ADJ_DOZE_HOFF	(1 << 6)
-#define RMI_F01_QRY1_HAS_PROPS_2	(1 << 7)
 
 #define RMI_F01_QRY5_YEAR_MASK		0x1f
 #define RMI_F01_QRY6_MONTH_MASK		0x0f
@@ -52,7 +36,6 @@ struct f01_basic_properties {
 	bool has_adjustable_doze_holdoff;
 	char dom[11]; /* YYYY/MM/DD + '\0' */
 	u8 product_id[RMI_PRODUCT_ID_LENGTH + 1];
-	u16 productinfo;
 };
 
 /* F01 device status bits */
@@ -87,19 +70,6 @@ struct f01_basic_properties {
 #define RMI_F01_CRTL0_NOSLEEP_BIT	(1 << 2)
 
 /*
- * When this bit is set, the touch controller employs a noise-filtering
- * algorithm designed for use with a connected battery charger.
- */
-#define RMI_F01_CRTL0_CHARGER_BIT	(1 << 5)
-
-/*
- * Sets the report rate for the device. The effect of this setting is
- * highly product dependent. Check the spec sheet for your particular
- * touch sensor.
- */
-#define RMI_F01_CRTL0_REPORTRATE_BIT	(1 << 6)
-
-/*
  * Written by the host as an indicator that the device has been
  * successfully configured.
  */
@@ -127,7 +97,6 @@ struct f01_data {
 	struct f01_basic_properties properties;
 
 	struct f01_device_control device_control;
-	struct mutex control_mutex;
 
 	u8 device_status;
 
@@ -135,11 +104,9 @@ struct f01_data {
 	u16 doze_interval_addr;
 	u16 wakeup_threshold_addr;
 	u16 doze_holdoff_addr;
-	int irq_count;
 	int num_of_irq_regs;
 
 #ifdef CONFIG_PM_SLEEP
-	bool suspended;
 	bool old_nosleep;
 #endif
 };
@@ -199,10 +166,6 @@ static int rmi_f01_read_properties(struct rmi_device *rmi_dev,
 		RMI_PRODUCT_ID_LENGTH);
 	props->product_id[RMI_PRODUCT_ID_LENGTH] = '\0';
 
-	props->productinfo =
-			((basic_query[2] & RMI_F01_QRY2_PRODINFO_MASK) << 7) |
-			(basic_query[3] & RMI_F01_QRY2_PRODINFO_MASK);
-
 	return 0;
 }
 
@@ -216,8 +179,6 @@ static int rmi_f01_initialize(struct rmi_function *fn)
 	struct f01_data *data = fn->data;
 	struct rmi_device_platform_data *pdata = to_rmi_platform_data(rmi_dev);
 
-	mutex_init(&data->control_mutex);
-
 	/*
 	 * Set the configured bit and (optionally) other important stuff
 	 * in the device control register.
@@ -263,7 +224,6 @@ static int rmi_f01_initialize(struct rmi_function *fn)
 		return error;
 	}
 
-	data->irq_count = driver_data->irq_count;
 	data->num_of_irq_regs = driver_data->num_of_irq_regs;
 	ctrl_base_addr += sizeof(u8);
 
diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c
index 9d94b1a..b114f25 100644
--- a/drivers/input/rmi4/rmi_f11.c
+++ b/drivers/input/rmi4/rmi_f11.c
@@ -7,8 +7,6 @@
  * the Free Software Foundation.
  */
 
-#define FUNCTION_DATA f11_data
-
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/device.h>
@@ -19,9 +17,6 @@
 #include <linux/slab.h>
 #include "rmi_driver.h"
 
-#define F11_MAX_NUM_OF_FINGERS		10
-#define F11_MAX_NUM_OF_TOUCH_SHAPES	16
-
 #define F11_REL_POS_MIN		-128
 #define F11_REL_POS_MAX		127
 
@@ -30,14 +25,12 @@
 #define F11_CTRL_SENSOR_MAX_X_POS_OFFSET	6
 #define F11_CTRL_SENSOR_MAX_Y_POS_OFFSET	8
 
-#define DEFAULT_XY_MAX 9999
 #define DEFAULT_MAX_ABS_MT_PRESSURE 255
 #define DEFAULT_MAX_ABS_MT_TOUCH 15
 #define DEFAULT_MAX_ABS_MT_ORIENTATION 1
 #define DEFAULT_MIN_ABS_MT_TRACKING_ID 1
 #define DEFAULT_MAX_ABS_MT_TRACKING_ID 10
 #define NAME_BUFFER_SIZE 256
-#define FUNCTION_NUMBER 0x11
 
 /** A note about RMI4 F11 register structure.
  *
@@ -81,108 +74,37 @@
 #define RMI_F11_HAS_QUERY28             (1 << 7)
 
 /** Defs for Query 1 */
-
 #define RMI_F11_NR_FINGERS_MASK 0x07
 #define RMI_F11_HAS_REL                 (1 << 3)
 #define RMI_F11_HAS_ABS                 (1 << 4)
 #define RMI_F11_HAS_GESTURES            (1 << 5)
-#define RMI_F11_HAS_SENSITIVITY_ADJ     (1 << 6)
-#define RMI_F11_CONFIGURABLE            (1 << 7)
-
-/** Defs for Query 2, 3, and 4. */
-#define RMI_F11_NR_ELECTRODES_MASK      0x7F
 
 /** Defs for Query 5 */
-
-#define RMI_F11_ABS_DATA_SIZE_MASK      0x03
-#define RMI_F11_HAS_ANCHORED_FINGER     (1 << 2)
-#define RMI_F11_HAS_ADJ_HYST            (1 << 3)
-#define RMI_F11_HAS_DRIBBLE             (1 << 4)
-#define RMI_F11_HAS_BENDING_CORRECTION  (1 << 5)
-#define RMI_F11_HAS_LARGE_OBJECT_SUPPRESSION    (1 << 6)
 #define RMI_F11_HAS_JITTER_FILTER       (1 << 7)
 
 /** Defs for Query 7 */
-#define RMI_F11_HAS_SINGLE_TAP                  (1 << 0)
-#define RMI_F11_HAS_TAP_AND_HOLD                (1 << 1)
-#define RMI_F11_HAS_DOUBLE_TAP                  (1 << 2)
-#define RMI_F11_HAS_EARLY_TAP                   (1 << 3)
 #define RMI_F11_HAS_FLICK                       (1 << 4)
-#define RMI_F11_HAS_PRESS                       (1 << 5)
 #define RMI_F11_HAS_PINCH                       (1 << 6)
-#define RMI_F11_HAS_CHIRAL                      (1 << 7)
 
 /** Defs for Query 8 */
-#define RMI_F11_HAS_PALM_DET                    (1 << 0)
 #define RMI_F11_HAS_ROTATE                      (1 << 1)
 #define RMI_F11_HAS_TOUCH_SHAPES                (1 << 2)
-#define RMI_F11_HAS_SCROLL_ZONES                (1 << 3)
-#define RMI_F11_HAS_INDIVIDUAL_SCROLL_ZONES     (1 << 4)
-#define RMI_F11_HAS_MF_SCROLL                   (1 << 5)
-#define RMI_F11_HAS_MF_EDGE_MOTION              (1 << 6)
-#define RMI_F11_HAS_MF_SCROLL_INERTIA           (1 << 7)
 
 /** Defs for Query 9. */
 #define RMI_F11_HAS_PEN                         (1 << 0)
-#define RMI_F11_HAS_PROXIMITY                   (1 << 1)
-#define RMI_F11_HAS_PALM_DET_SENSITIVITY        (1 << 2)
-#define RMI_F11_HAS_SUPPRESS_ON_PALM_DETECT     (1 << 3)
-#define RMI_F11_HAS_TWO_PEN_THRESHOLDS          (1 << 4)
-#define RMI_F11_HAS_CONTACT_GEOMETRY            (1 << 5)
-#define RMI_F11_HAS_PEN_HOVER_DISCRIMINATION    (1 << 6)
-#define RMI_F11_HAS_PEN_FILTERS                 (1 << 7)
 
 /** Defs for Query 10. */
 #define RMI_F11_NR_TOUCH_SHAPES_MASK            0x1F
 
-/** Defs for Query 11 */
-
-#define RMI_F11_HAS_Z_TUNING                    (1 << 0)
-#define RMI_F11_HAS_ALGORITHM_SELECTION         (1 << 1)
-#define RMI_F11_HAS_W_TUNING                    (1 << 2)
-#define RMI_F11_HAS_PITCH_INFO                  (1 << 3)
-#define RMI_F11_HAS_FINGER_SIZE                 (1 << 4)
-#define RMI_F11_HAS_SEGMENTATION_AGGRESSIVENESS (1 << 5)
-#define RMI_F11_HAS_XY_CLIP                     (1 << 6)
-#define RMI_F11_HAS_DRUMMING_FILTER             (1 << 7)
-
 /** Defs for Query 12. */
-
-#define RMI_F11_HAS_GAPLESS_FINGER              (1 << 0)
-#define RMI_F11_HAS_GAPLESS_FINGER_TUNING       (1 << 1)
-#define RMI_F11_HAS_8BIT_W                      (1 << 2)
-#define RMI_F11_HAS_ADJUSTABLE_MAPPING          (1 << 3)
 #define RMI_F11_HAS_INFO2                       (1 << 4)
-#define RMI_F11_HAS_PHYSICAL_PROPS              (1 << 5)
-#define RMI_F11_HAS_FINGER_LIMIT                (1 << 6)
-#define RMI_F11_HAS_LINEAR_COEFF                (1 << 7)
-
-/** Defs for Query 13. */
-
-#define RMI_F11_JITTER_WINDOW_MASK              0x1F
-#define RMI_F11_JITTER_FILTER_MASK              0x60
-#define RMI_F11_JITTER_FILTER_SHIFT             5
 
 /** Defs for Query 14. */
-#define RMI_F11_LIGHT_CONTROL_MASK              0x03
 #define RMI_F11_IS_CLEAR                        (1 << 2)
-#define RMI_F11_CLICKPAD_PROPS_MASK             0x18
-#define RMI_F11_CLICKPAD_PROPS_SHIFT            3
-#define RMI_F11_MOUSE_BUTTONS_MASK              0x60
-#define RMI_F11_MOUSE_BUTTONS_SHIFT             5
-#define RMI_F11_HAS_ADVANCED_GESTURES           (1 << 7)
 
 #define RMI_F11_QUERY_SIZE                      4
 #define RMI_F11_QUERY_GESTURE_SIZE              2
 
-#define F11_LIGHT_CTL_NONE 0x00
-#define F11_LUXPAD	   0x01
-#define F11_DUAL_MODE      0x02
-
-#define F11_NOT_CLICKPAD     0x00
-#define F11_HINGED_CLICKPAD  0x01
-#define F11_UNIFORM_CLICKPAD 0x02
-
 /**
  * Query registers 1 through 4 are always present.
  *
@@ -191,55 +113,18 @@
  * @has_rel - the sensor supports relative motion reporting.
  * @has_abs - the sensor supports absolute poition reporting.
  * @has_gestures - the sensor supports gesture reporting.
- * @has_sensitivity_adjust - the sensor supports a global sensitivity
- * adjustment.
- * @configurable - the sensor supports various configuration options.
- * @num_of_x_electrodes -  the maximum number of electrodes the 2-D sensor
- * supports on the X axis.
- * @num_of_y_electrodes -  the maximum number of electrodes the 2-D sensor
- * supports on the Y axis.
- * @max_electrodes - the total number of X and Y electrodes that may be
- * configured.
  *
  * Query 5 is present if the has_abs bit is set.
  *
- * @abs_data_size - describes the format of data reported by the absolute
- * data source.  Only one format (the kind used here) is supported at this
- * time.
- * @has_anchored_finger - then the sensor supports the high-precision second
- * finger tracking provided by the manual tracking and motion sensitivity
- * options.
- * @has_adjust_hyst - the difference between the finger release threshold and
- * the touch threshold.
- * @has_dribble - the sensor supports the generation of dribble interrupts,
- * which may be enabled or disabled with the dribble control bit.
- * @has_bending_correction - Bending related data registers 28 and 36, and
- * control register 52..57 are present.
- * @has_large_object_suppression - control register 58 and data register 28
- * exist.
  * @has_jitter_filter - query 13 and control 73..76 exist.
  *
  * Gesture information queries 7 and 8 are present if has_gestures bit is set.
  *
- * @has_single_tap - a basic single-tap gesture is supported.
- * @has_tap_n_hold - tap-and-hold gesture is supported.
- * @has_double_tap - double-tap gesture is supported.
- * @has_early_tap - early tap is supported and reported as soon as the finger
- * lifts for any tap event that could be interpreted as either a single tap
- * or as the first tap of a double-tap or tap-and-hold gesture.
  * @has_flick - flick detection is supported.
- * @has_press - press gesture reporting is supported.
  * @has_pinch - pinch gesture detection is supported.
- * @has_palm_det - the 2-D sensor notifies the host whenever a large conductive
- * object such as a palm or a cheek touches the 2-D sensor.
  * @has_rotate - rotation gesture detection is supported.
  * @has_touch_shapes - TouchShapes are supported.  A TouchShape is a fixed
  * rectangular area on the sensor that behaves like a capacitive button.
- * @has_scroll_zones - scrolling areas near the sensor edges are supported.
- * @has_individual_scroll_zones - if 1, then 4 scroll zones are supported;
- * if 0, then only two are supported.
- * @has_mf_scroll - the multifinger_scrolling bit will be set when
- * more than one finger is involved in a scrolling action.
  *
  * Convenience for checking bytes in the gesture info registers.  This is done
  * often enough that we put it here to declutter the conditionals
@@ -251,68 +136,21 @@
  *
  * @has_pen - detection of a stylus is supported and registers F11_2D_Ctrl20
  * and F11_2D_Ctrl21 exist.
- * @has_proximity - detection of fingers near the sensor is supported and
- * registers F11_2D_Ctrl22 through F11_2D_Ctrl26 exist.
- * @has_palm_det_sensitivity -  the sensor supports the palm detect sensitivity
- * feature and register F11_2D_Ctrl27 exists.
- * @has_two_pen_thresholds - is has_pen is also set, then F11_2D_Ctrl35 exists.
- * @has_contact_geometry - the sensor supports the use of contact geometry to
- * map absolute X and Y target positions and registers F11_2D_Data18
- * through F11_2D_Data27 exist.
  *
  * Touch shape info (query 10) is present if has_touch_shapes is set.
  *
  * @nr_touch_shapes - the total number of touch shapes supported.
  *
  * Query 11 is present if the has_query11 bit is set in query 0.
- *
- * @has_z_tuning - if set, the sensor supports Z tuning and registers
- * F11_2D_Ctrl29 through F11_2D_Ctrl33 exist.
- * @has_algorithm_selection - controls choice of noise suppression algorithm
- * @has_w_tuning - the sensor supports Wx and Wy scaling and registers
- * F11_2D_Ctrl36 through F11_2D_Ctrl39 exist.
- * @has_pitch_info - the X and Y pitches of the sensor electrodes can be
- * configured and registers F11_2D_Ctrl40 and F11_2D_Ctrl41 exist.
- * @has_finger_size -  the default finger width settings for the
- * sensor can be configured and registers F11_2D_Ctrl42 through F11_2D_Ctrl44
- * exist.
- * @has_segmentation_aggressiveness - the sensor’s ability to distinguish
- * multiple objects close together can be configured and register F11_2D_Ctrl45
- * exists.
- * @has_XY_clip -  the inactive outside borders of the sensor can be
- * configured and registers F11_2D_Ctrl46 through F11_2D_Ctrl49 exist.
- * @has_drumming_filter - the sensor can be configured to distinguish
- * between a fast flick and a quick drumming movement and registers
- * F11_2D_Ctrl50 and F11_2D_Ctrl51 exist.
- *
  * Query 12 is present if hasQuery12 bit is set.
  *
- * @has_gapless_finger - control registers relating to gapless finger are
- * present.
- * @has_gapless_finger_tuning - additional control and data registers relating
- * to gapless finger are present.
- * @has_8bit_w - larger W value reporting is supported.
- * @has_adjustable_mapping - TBD
  * @has_info2 - the general info query14 is present
- * @has_physical_props - additional queries describing the physical properties
- * of the sensor are present.
- * @has_finger_limit - indicates that F11 Ctrl 80 exists.
- * @has_linear_coeff - indicates that F11 Ctrl 81 exists.
  *
  * Query 13 is present if Query 5's has_jitter_filter bit is set.
- * @jitter_window_size - used by Design Studio 4.
- * @jitter_filter_type - used by Design Studio 4.
- *
  * Query 14 is present if query 12's has_general_info2 flag is set.
  *
- * @light_control - Indicates what light/led control features are present, if
- * any.
  * @is_clear - if set, this is a clear sensor (indicating direct pointing
  * application), otherwise it's opaque (indicating indirect pointing).
- * @clickpad_props - specifies if this is a clickpad, and if so what sort of
- * mechanism it uses
- * @mouse_buttons - specifies the number of mouse buttons present (if any).
- * @has_advanced_gestures - advanced driver gestures are supported.
  */
 struct f11_2d_sensor_queries {
 	/* query1 */
@@ -320,112 +158,34 @@ struct f11_2d_sensor_queries {
 	bool has_rel;
 	bool has_abs;
 	bool has_gestures;
-	bool has_sensitivity_adjust;
-	bool configurable;
-
-	/* query2 */
-	u8 nr_x_electrodes;
 
-	/* query3 */
-	u8 nr_y_electrodes;
-
-	/* query4 */
-	u8 max_electrodes;
-
-	/* query5 */
-	u8 abs_data_size;
-	bool has_anchored_finger;
-	bool has_adj_hyst;
-	bool has_dribble;
-	bool has_bending_correction;
-	bool has_large_object_suppression;
 	bool has_jitter_filter;
 
 	u8 f11_2d_query6;
 
 	/* query 7 */
-	bool has_single_tap;
-	bool has_tap_n_hold;
-	bool has_double_tap;
-	bool has_early_tap;
 	bool has_flick;
-	bool has_press;
 	bool has_pinch;
-	bool has_chiral;
-
 	bool query7_nonzero;
 
 	/* query 8 */
-	bool has_palm_det;
 	bool has_rotate;
 	bool has_touch_shapes;
-	bool has_scroll_zones;
-	bool has_individual_scroll_zones;
-	bool has_mf_scroll;
-	bool has_mf_edge_motion;
-	bool has_mf_scroll_inertia;
-
 	bool query8_nonzero;
 
 	/* Query 9 */
 	bool has_pen;
-	bool has_proximity;
-	bool has_palm_det_sensitivity;
-	bool has_suppress_on_palm_detect;
-	bool has_two_pen_thresholds;
-	bool has_contact_geometry;
-	bool has_pen_hover_discrimination;
-	bool has_pen_filters;
 
 	/* Query 10 */
 	u8 nr_touch_shapes;
 
-	/* Query 11. */
-	bool has_z_tuning;
-	bool has_algorithm_selection;
-	bool has_w_tuning;
-	bool has_pitch_info;
-	bool has_finger_size;
-	bool has_segmentation_aggressiveness;
-	bool has_XY_clip;
-	bool has_drumming_filter;
-
 	/* Query 12 */
-	bool has_gapless_finger;
-	bool has_gapless_finger_tuning;
-	bool has_8bit_w;
-	bool has_adjustable_mapping;
 	bool has_info2;
-	bool has_physical_props;
-	bool has_finger_limit;
-	bool has_linear_coeff_2;
-
-	/* Query 13 */
-	u8 jitter_window_size;
-	u8 jitter_filter_type;
 
 	/* Query 14 */
-	u8 light_control;
 	bool is_clear;
-	u8 clickpad_props;
-	u8 mouse_buttons;
-	bool has_advanced_gestures;
 };
 
-/* Defs for Ctrl0. */
-#define RMI_F11_REPORT_MODE_MASK        0x07
-#define RMI_F11_ABS_POS_FILT            (1 << 3)
-#define RMI_F11_REL_POS_FILT            (1 << 4)
-#define RMI_F11_REL_BALLISTICS          (1 << 5)
-#define RMI_F11_DRIBBLE                 (1 << 6)
-#define RMI_F11_REPORT_BEYOND_CLIP      (1 << 7)
-
-/* Defs for Ctrl1. */
-#define RMI_F11_PALM_DETECT_THRESH_MASK 0x0F
-#define RMI_F11_MOTION_SENSITIVITY_MASK 0x30
-#define RMI_F11_MANUAL_TRACKING         (1 << 6)
-#define RMI_F11_MANUAL_TRACKED_FINGER   (1 << 7)
-
 #define RMI_F11_DELTA_X_THRESHOLD       2
 #define RMI_F11_DELTA_Y_THRESHOLD       3
 
@@ -439,24 +199,6 @@ struct f11_2d_ctrl {
 #define RMI_F11_ABS_BYTES 5
 #define RMI_F11_REL_BYTES 2
 
-/* Defs for Data 8 */
-
-#define RMI_F11_SINGLE_TAP              (1 << 0)
-#define RMI_F11_TAP_AND_HOLD            (1 << 1)
-#define RMI_F11_DOUBLE_TAP              (1 << 2)
-#define RMI_F11_EARLY_TAP               (1 << 3)
-#define RMI_F11_FLICK                   (1 << 4)
-#define RMI_F11_PRESS                   (1 << 5)
-#define RMI_F11_PINCH                   (1 << 6)
-
-/* Defs for Data 9 */
-
-#define RMI_F11_PALM_DETECT                     (1 << 0)
-#define RMI_F11_ROTATE                          (1 << 1)
-#define RMI_F11_SHAPE                           (1 << 2)
-#define RMI_F11_SCROLLZONE                      (1 << 3)
-#define RMI_F11_GESTURE_FINGER_COUNT_MASK       0x70
-
 /** Handy pointers into our data buffer.
  *
  * @f_state - start of finger state registers.
@@ -467,8 +209,6 @@ struct f11_2d_ctrl {
  * @pinch   - pinch motion register (if present).
  * @flick   - flick distance X & Y, flick time (if present).
  * @rotate  - rotate motion and finger separation.
- * @multi_scroll - chiral deltas for X and Y (if present).
- * @scroll_zones - scroll deltas for 4 regions (if present).
  */
 struct f11_2d_data {
 	u8	*f_state;
@@ -480,8 +220,6 @@ struct f11_2d_data {
 	u8	*flick;
 	u8	*rotate;
 	u8	*shapes;
-	s8	*multi_scroll;
-	s8	*scroll_zones;
 };
 
 /**
@@ -495,7 +233,6 @@ struct f11_2d_data {
  * @nbr_fingers - How many fingers can this sensor report?
  * @data_pkt - buffer for data reported by this sensor.
  * @pkt_size - number of bytes in that buffer.
- * @sensor_index - identifies this particular 2D touch sensor
  * @type_a - some early RMI4 2D sensors do not reliably track the finger
  * position when two fingers are on the device.  When this is true, we
  * assume we have one of those sensors and report events appropriately.
@@ -514,7 +251,6 @@ struct f11_2d_sensor {
 	u8 nbr_fingers;
 	u8 *data_pkt;
 	int pkt_size;
-	u8 sensor_index;
 	bool type_a;
 	enum rmi_f11_sensor_type sensor_type;
 	struct input_dev *input;
@@ -529,7 +265,6 @@ struct f11_2d_sensor {
  *
  * @dev_query - F11 device specific query registers.
  * @dev_controls - F11 device specific control registers.
- * @dev_controls_mutex - lock for the control registers.
  * @rezero_wait_ms - if nonzero, upon resume we will wait this many
  * milliseconds before rezeroing the sensor(s).  This is useful in systems with
  * poor electrical behavior on resume, where the initial calibration of the
@@ -543,7 +278,6 @@ struct f11_data {
 	bool has_query27;
 	bool has_query28;
 	struct f11_2d_ctrl dev_controls;
-	struct mutex dev_controls_mutex;
 	u16 rezero_wait_ms;
 	struct f11_2d_sensor sensor;
 };
@@ -871,16 +605,6 @@ static int rmi_f11_get_query_parameters(struct rmi_device *rmi_dev,
 	sensor_query->has_rel = !!(query_buf[0] & RMI_F11_HAS_REL);
 	sensor_query->has_abs = !!(query_buf[0] & RMI_F11_HAS_ABS);
 	sensor_query->has_gestures = !!(query_buf[0] & RMI_F11_HAS_GESTURES);
-	sensor_query->has_sensitivity_adjust =
-		!!(query_buf[0] && RMI_F11_HAS_SENSITIVITY_ADJ);
-	sensor_query->configurable = !!(query_buf[0] & RMI_F11_CONFIGURABLE);
-
-	sensor_query->nr_x_electrodes =
-				query_buf[1] & RMI_F11_NR_ELECTRODES_MASK;
-	sensor_query->nr_y_electrodes =
-				query_buf[2] & RMI_F11_NR_ELECTRODES_MASK;
-	sensor_query->max_electrodes =
-				query_buf[3] & RMI_F11_NR_ELECTRODES_MASK;
 
 	query_size = RMI_F11_QUERY_SIZE;
 
@@ -889,18 +613,6 @@ static int rmi_f11_get_query_parameters(struct rmi_device *rmi_dev,
 		if (rc < 0)
 			return rc;
 
-		sensor_query->abs_data_size =
-			query_buf[0] & RMI_F11_ABS_DATA_SIZE_MASK;
-		sensor_query->has_anchored_finger =
-			!!(query_buf[0] & RMI_F11_HAS_ANCHORED_FINGER);
-		sensor_query->has_adj_hyst =
-			!!(query_buf[0] & RMI_F11_HAS_ADJ_HYST);
-		sensor_query->has_dribble =
-			!!(query_buf[0] & RMI_F11_HAS_DRIBBLE);
-		sensor_query->has_bending_correction =
-			!!(query_buf[0] & RMI_F11_HAS_BENDING_CORRECTION);
-		sensor_query->has_large_object_suppression =
-		!!(query_buf[0] && RMI_F11_HAS_LARGE_OBJECT_SUPPRESSION);
 		sensor_query->has_jitter_filter =
 			!!(query_buf[0] & RMI_F11_HAS_JITTER_FILTER);
 		query_size++;
@@ -920,40 +632,16 @@ static int rmi_f11_get_query_parameters(struct rmi_device *rmi_dev,
 		if (rc < 0)
 			return rc;
 
-		sensor_query->has_single_tap =
-			!!(query_buf[0] & RMI_F11_HAS_SINGLE_TAP);
-		sensor_query->has_tap_n_hold =
-			!!(query_buf[0] & RMI_F11_HAS_TAP_AND_HOLD);
-		sensor_query->has_double_tap =
-			!!(query_buf[0] & RMI_F11_HAS_DOUBLE_TAP);
-		sensor_query->has_early_tap =
-			!!(query_buf[0] & RMI_F11_HAS_EARLY_TAP);
 		sensor_query->has_flick =
 			!!(query_buf[0] & RMI_F11_HAS_FLICK);
-		sensor_query->has_press =
-			!!(query_buf[0] & RMI_F11_HAS_PRESS);
 		sensor_query->has_pinch =
 			!!(query_buf[0] & RMI_F11_HAS_PINCH);
-		sensor_query->has_chiral =
-			!!(query_buf[0] & RMI_F11_HAS_CHIRAL);
 
 		/* query 8 */
-		sensor_query->has_palm_det =
-			!!(query_buf[1] & RMI_F11_HAS_PALM_DET);
 		sensor_query->has_rotate =
 			!!(query_buf[1] & RMI_F11_HAS_ROTATE);
 		sensor_query->has_touch_shapes =
 			!!(query_buf[1] & RMI_F11_HAS_TOUCH_SHAPES);
-		sensor_query->has_scroll_zones =
-			!!(query_buf[1] & RMI_F11_HAS_SCROLL_ZONES);
-		sensor_query->has_individual_scroll_zones =
-			!!(query_buf[1] & RMI_F11_HAS_INDIVIDUAL_SCROLL_ZONES);
-		sensor_query->has_mf_scroll =
-			!!(query_buf[1] & RMI_F11_HAS_MF_SCROLL);
-		sensor_query->has_mf_edge_motion =
-			!!(query_buf[1] & RMI_F11_HAS_MF_EDGE_MOTION);
-		sensor_query->has_mf_scroll_inertia =
-			!!(query_buf[1] & RMI_F11_HAS_MF_SCROLL_INERTIA);
 
 		sensor_query->query7_nonzero = !!(query_buf[0]);
 		sensor_query->query8_nonzero = !!(query_buf[1]);
@@ -968,20 +656,6 @@ static int rmi_f11_get_query_parameters(struct rmi_device *rmi_dev,
 
 		sensor_query->has_pen =
 			!!(query_buf[0] & RMI_F11_HAS_PEN);
-		sensor_query->has_proximity =
-			!!(query_buf[0] & RMI_F11_HAS_PROXIMITY);
-		sensor_query->has_palm_det_sensitivity =
-			!!(query_buf[0] & RMI_F11_HAS_PALM_DET_SENSITIVITY);
-		sensor_query->has_suppress_on_palm_detect =
-			!!(query_buf[0] & RMI_F11_HAS_SUPPRESS_ON_PALM_DETECT);
-		sensor_query->has_two_pen_thresholds =
-			!!(query_buf[0] & RMI_F11_HAS_TWO_PEN_THRESHOLDS);
-		sensor_query->has_contact_geometry =
-			!!(query_buf[0] & RMI_F11_HAS_CONTACT_GEOMETRY);
-		sensor_query->has_pen_hover_discrimination =
-			!!(query_buf[0] & RMI_F11_HAS_PEN_HOVER_DISCRIMINATION);
-		sensor_query->has_pen_filters =
-			!!(query_buf[0] & RMI_F11_HAS_PEN_FILTERS);
 
 		query_size++;
 	}
@@ -1002,24 +676,6 @@ static int rmi_f11_get_query_parameters(struct rmi_device *rmi_dev,
 		if (rc < 0)
 			return rc;
 
-		sensor_query->has_z_tuning =
-			!!(query_buf[0] & RMI_F11_HAS_Z_TUNING);
-		sensor_query->has_algorithm_selection =
-			!!(query_buf[0] & RMI_F11_HAS_ALGORITHM_SELECTION);
-		sensor_query->has_w_tuning =
-			!!(query_buf[0] & RMI_F11_HAS_W_TUNING);
-		sensor_query->has_pitch_info =
-			!!(query_buf[0] & RMI_F11_HAS_PITCH_INFO);
-		sensor_query->has_finger_size =
-			!!(query_buf[0] & RMI_F11_HAS_FINGER_SIZE);
-		sensor_query->has_segmentation_aggressiveness =
-			!!(query_buf[0] &
-				RMI_F11_HAS_SEGMENTATION_AGGRESSIVENESS);
-		sensor_query->has_XY_clip =
-			!!(query_buf[0] & RMI_F11_HAS_XY_CLIP);
-		sensor_query->has_drumming_filter =
-			!!(query_buf[0] & RMI_F11_HAS_DRUMMING_FILTER);
-
 		query_size++;
 	}
 
@@ -1028,22 +684,8 @@ static int rmi_f11_get_query_parameters(struct rmi_device *rmi_dev,
 		if (rc < 0)
 			return rc;
 
-		sensor_query->has_gapless_finger =
-			!!(query_buf[0] & RMI_F11_HAS_GAPLESS_FINGER);
-		sensor_query->has_gapless_finger_tuning =
-			!!(query_buf[0] & RMI_F11_HAS_GAPLESS_FINGER_TUNING);
-		sensor_query->has_8bit_w =
-			!!(query_buf[0] & RMI_F11_HAS_8BIT_W);
-		sensor_query->has_adjustable_mapping =
-			!!(query_buf[0] & RMI_F11_HAS_ADJUSTABLE_MAPPING);
 		sensor_query->has_info2 =
 			!!(query_buf[0] & RMI_F11_HAS_INFO2);
-		sensor_query->has_physical_props =
-			!!(query_buf[0] & RMI_F11_HAS_PHYSICAL_PROPS);
-		sensor_query->has_finger_limit =
-			!!(query_buf[0] & RMI_F11_HAS_FINGER_LIMIT);
-		sensor_query->has_linear_coeff_2 =
-			!!(query_buf[0] & RMI_F11_HAS_LINEAR_COEFF);
 
 		query_size++;
 	}
@@ -1053,12 +695,6 @@ static int rmi_f11_get_query_parameters(struct rmi_device *rmi_dev,
 		if (rc < 0)
 			return rc;
 
-		sensor_query->jitter_window_size = query_buf[0] &
-			RMI_F11_JITTER_WINDOW_MASK;
-		sensor_query->jitter_filter_type = (query_buf[0] &
-			RMI_F11_JITTER_FILTER_MASK) >>
-			RMI_F11_JITTER_FILTER_SHIFT;
-
 		query_size++;
 	}
 
@@ -1067,18 +703,8 @@ static int rmi_f11_get_query_parameters(struct rmi_device *rmi_dev,
 		if (rc < 0)
 			return rc;
 
-		sensor_query->light_control =
-			query_buf[0] & RMI_F11_LIGHT_CONTROL_MASK;
 		sensor_query->is_clear =
 			!!(query_buf[0] & RMI_F11_IS_CLEAR);
-		sensor_query->clickpad_props =
-			(query_buf[0] & RMI_F11_CLICKPAD_PROPS_MASK) >>
-			RMI_F11_CLICKPAD_PROPS_SHIFT;
-		sensor_query->mouse_buttons =
-			(query_buf[0] & RMI_F11_MOUSE_BUTTONS_MASK) >>
-			RMI_F11_MOUSE_BUTTONS_SHIFT;
-		sensor_query->has_advanced_gestures =
-			!!(query_buf[0] & RMI_F11_HAS_ADVANCED_GESTURES);
 
 		query_size++;
 	}
@@ -1276,7 +902,6 @@ static int rmi_f11_initialize(struct rmi_function *fn)
 				rc);
 	}
 
-	mutex_init(&f11->dev_controls_mutex);
 	return 0;
 }
 
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 08/15] Input: synaptics-rmi4 - cleanup platform data
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny
In-Reply-To: <1390521623-6491-8-git-send-email-courtney.cavin@sonymobile.com>

Update platform data documentation and remove unneeded/unused stuff in
platform data.

If these items are needed at some later point, they should be added
then.  Until that point, we should unclutter the code.

Cc: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
---
 drivers/input/rmi4/rmi_f11.c |  14 ++--
 include/linux/rmi.h          | 157 ++++++++++---------------------------------
 2 files changed, 40 insertions(+), 131 deletions(-)

diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c
index 87d85ab..9d94b1a 100644
--- a/drivers/input/rmi4/rmi_f11.c
+++ b/drivers/input/rmi4/rmi_f11.c
@@ -1109,7 +1109,7 @@ static void f11_set_abs_params(struct rmi_function *fn)
 	/* We assume touchscreen unless demonstrably a touchpad or specified
 	 * as a touchpad in the platform data
 	 */
-	if (sensor->sensor_type == rmi_f11_sensor_touchpad ||
+	if (sensor->sensor_type == RMI_F11_SENSOR_INDIRECT ||
 			(sensor->sens_query.has_info2 &&
 				!sensor->sens_query.is_clear))
 		input_flags = INPUT_PROP_POINTER;
@@ -1192,7 +1192,7 @@ static int rmi_f11_initialize(struct rmi_function *fn)
 		return -ENOMEM;
 
 	fn->data = f11;
-	f11->rezero_wait_ms = pdata->f11_rezero_wait;
+	f11->rezero_wait_ms = pdata->f11_sensor_data.rezero_wait;
 
 	query_base_addr = fn->fd.query_base_addr;
 	control_base_addr = fn->fd.control_base_addr;
@@ -1225,13 +1225,9 @@ static int rmi_f11_initialize(struct rmi_function *fn)
 		return rc;
 	}
 
-	if (pdata->f11_sensor_data) {
-		sensor->axis_align =
-			pdata->f11_sensor_data->axis_align;
-		sensor->type_a = pdata->f11_sensor_data->type_a;
-		sensor->sensor_type =
-				pdata->f11_sensor_data->sensor_type;
-	}
+	sensor->axis_align = pdata->f11_sensor_data.axis_align;
+	sensor->type_a = pdata->f11_sensor_data.type_a;
+	sensor->sensor_type = pdata->f11_sensor_data.sensor_type;
 
 	rc = rmi_read_block(rmi_dev,
 		control_base_addr + F11_CTRL_SENSOR_MAX_X_POS_OFFSET,
diff --git a/include/linux/rmi.h b/include/linux/rmi.h
index f3775eb..60ddd98 100644
--- a/include/linux/rmi.h
+++ b/include/linux/rmi.h
@@ -37,8 +37,8 @@
  *               the specified value
  * @offset_x - this value will be added to all reported X coordinates
  * @offset_y - this value will be added to all reported Y coordinates
- * @rel_report_enabled - if set to true, the relative reporting will be
- *               automatically enabled for this sensor.
+ * @delta_x_threshold - delta X movement required before reporting event
+ * @delta_y_threshold - delta Y movement required before reporting event
  */
 struct rmi_f11_2d_axis_alignment {
 	bool swap_axes;
@@ -57,34 +57,36 @@ struct rmi_f11_2d_axis_alignment {
 /** This is used to override any hints an F11 2D sensor might have provided
  * as to what type of sensor it is.
  *
- * @rmi_f11_sensor_default - do not override, determine from F11_2D_QUERY14 if
- * available.
- * @rmi_f11_sensor_touchscreen - treat the sensor as a touchscreen (direct
- * pointing).
- * @rmi_f11_sensor_touchpad - thread the sensor as a touchpad (indirect
- * pointing).
+ * @RMI_F11_SENSOR_DEFAULT - determine from F11_2D_QUERY14 if available.
+ * @RMI_F11_SENSOR_DIRECT - direct pointing sensor (e.g. touchscreen)
+ * @RMI_F11_SENSOR_INDIRECT - indirect pointing sensor (e.g touchpad)
  */
 enum rmi_f11_sensor_type {
-	rmi_f11_sensor_default = 0,
-	rmi_f11_sensor_touchscreen,
-	rmi_f11_sensor_touchpad
+	RMI_F11_SENSOR_DEFAULT = 0,
+	RMI_F11_SENSOR_DIRECT,
+	RMI_F11_SENSOR_INDIRECT
 };
 
 /**
  * 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
- * an older sensor.
+ *           protocol.  Set this to true to force MF Type A behavior, in case
+ *           you find an older sensor.
  * @sensor_type - Forces the driver to treat the sensor as an indirect
- * pointing device (touchpad) rather than a direct pointing device
- * (touchscreen).  This is useful when F11_2D_QUERY14 register is not
- * available.
+ *                pointing device (touchpad) rather than a direct pointing
+ *                device (touchscreen).  This is useful when F11_2D_QUERY14
+ *                register is not available.
+ * @rezero_wait - if non-zero, this is how may milliseconds the sensor will
+ *                wait before being be re-zeroed on exit from suspend.  If this
+ *                value is zero, the sensor will not be re-zeroed on resume.
  */
 struct rmi_f11_sensor_data {
 	struct rmi_f11_2d_axis_alignment axis_align;
 	bool type_a;
 	enum rmi_f11_sensor_type sensor_type;
+	u16 rezero_wait;
 };
 
 /**
@@ -98,20 +100,22 @@ enum rmi_f01_nosleep {
 };
 
 /**
- * struct rmi_f01_power_management -When non-zero, these values will be written
- * to the touch sensor to override the default firmware settigns.  For a
- * detailed explanation of what each field does, see the corresponding
- * documention in the RMI4 specification.
+ * struct rmi_f01_power_management - touch sensor power settings
+ *
+ * When non-zero, these values will be written to the touch sensor to override
+ * the default firmware settings.  For a detailed explanation of what each
+ * field does, see the corresponding documentation in the RMI4 specification.
  *
  * @nosleep - specifies whether the device is permitted to sleep or doze (that
- * is, enter a temporary low power state) when no fingers are touching the
- * sensor.
+ *            is, enter a temporary low power state) when no fingers are
+ *            touching the sensor.
  * @wakeup_threshold - controls the capacitance threshold at which the touch
- * sensor will decide to wake up from that low power state.
+ *                     sensor will decide to wake up from that low power state.
  * @doze_holdoff - controls how long the touch sensor waits after the last
- * finger lifts before entering the doze state, in units of 100ms.
+ *                 finger lifts before entering the doze state, in units of
+ *                 100ms.
  * @doze_interval - controls the interval between checks for finger presence
- * when the touch sensor is in doze mode, in units of 10ms.
+ *                  when the touch sensor is in doze mode, in units of 10ms.
  */
 struct rmi_f01_power_management {
 	enum rmi_f01_nosleep nosleep;
@@ -121,114 +125,23 @@ struct rmi_f01_power_management {
 };
 
 /**
- * struct rmi_button_map - used to specify the initial input subsystem key
- * event codes to be generated by buttons (or button like entities) on the
- * touch sensor.
- * @nbuttons - length of the button map.
- * @map - the key event codes for the corresponding buttons on the touch
- * sensor.
- */
-struct rmi_button_map {
-	u8 nbuttons;
-	u8 *map;
-};
-
-struct rmi_f30_gpioled_map {
-	u8 ngpioleds;
-	u8 *map;
-};
-
-/**
- * struct rmi_device_platform_data_spi - provides parameters used in SPI
- * communications.  All Synaptics SPI products support a standard SPI
- * interface; some also support what is called SPI V2 mode, depending on
- * firmware and/or ASIC limitations.  In V2 mode, the touch sensor can
- * support shorter delays during certain operations, and these are specified
- * separately from the standard mode delays.
- *
- * @block_delay - for standard SPI transactions consisting of both a read and
- * write operation, the delay (in microseconds) between the read and write
- * operations.
- * @split_read_block_delay_us - for V2 SPI transactions consisting of both a
- * read and write operation, the delay (in microseconds) between the read and
- * write operations.
- * @read_delay_us - the delay between each byte of a read operation in normal
- * SPI mode.
- * @write_delay_us - the delay between each byte of a write operation in normal
- * SPI mode.
- * @split_read_byte_delay_us - the delay between each byte of a read operation
- * in V2 mode.
- * @pre_delay_us - the delay before the start of a SPI transaction.  This is
- * typically useful in conjunction with custom chip select assertions (see
- * below).
- * @post_delay_us - the delay after the completion of an SPI transaction.  This
- * is typically useful in conjunction with custom chip select assertions (see
- * below).
- * @cs_assert - For systems where the SPI subsystem does not control the CS/SSB
- * line, or where such control is broken, you can provide a custom routine to
- * handle a GPIO as CS/SSB.  This routine will be called at the beginning and
- * end of each SPI transaction.  The RMI SPI implementation will wait
- * pre_delay_us after this routine returns before starting the SPI transfer;
- * and post_delay_us after completion of the SPI transfer(s) before calling it
- * with assert==FALSE.
- */
-struct rmi_device_platform_data_spi {
-	u32 block_delay_us;
-	u32 split_read_block_delay_us;
-	u32 read_delay_us;
-	u32 write_delay_us;
-	u32 split_read_byte_delay_us;
-	u32 pre_delay_us;
-	u32 post_delay_us;
-
-	void *cs_assert_data;
-	int (*cs_assert) (const void *cs_assert_data, const bool assert);
-};
-
-/**
  * struct rmi_device_platform_data - system specific configuration info.
  *
  * @irq - attention IRQ
- * @firmware_name - if specified will override default firmware name,
- * for reflashing.
- *
  * @reset_delay_ms - after issuing a reset command to the touch sensor, the
- * driver waits a few milliseconds to give the firmware a chance to
- * to re-initialize.  You can override the default wait period here.
- *
- * @spi_data - override default settings for SPI delays and SSB management (see
- * above).
- *
+ *                   driver waits a few milliseconds to give the firmware a
+ *                   chance to to re-initialize.  You can override the default
+ *                   wait period here.
  * @f11_sensor_data - platform data for the F11 2D sensor.
- * @f11_rezero_wait - if non-zero, this is how may milliseconds the F11 2D
- * sensor will wait before being be rezeroed on exit from suspend.  If
- * this value is zero, the F11 2D sensor will not be rezeroed on resume.
- * @power_management - overrides default touch sensor doze mode settings (see
- * above)
- * @f19_button_map - provide initial input subsystem key mappings for F19.
- * @f1a_button_map - provide initial input subsystem key mappings for F1A.
- * @gpioled_map - provides initial settings for GPIOs and LEDs controlled by
- * F30.
- * @f41_button_map - provide initial input subsystem key mappings for F41.
+ * @power_management - touch sensor power settings (see above)
  */
 struct rmi_device_platform_data {
 	int irq;
-	int reset_delay_ms;
-
-	struct rmi_device_platform_data_spi spi_data;
+	u32 reset_delay_ms;
 
 	/* function handler pdata */
-	struct rmi_f11_sensor_data *f11_sensor_data;
-	u16 f11_rezero_wait;
+	struct rmi_f11_sensor_data f11_sensor_data;
 	struct rmi_f01_power_management power_management;
-	struct rmi_button_map *f19_button_map;
-	struct rmi_button_map *f1a_button_map;
-	struct rmi_f30_gpioled_map *gpioled_map;
-	struct rmi_button_map *f41_button_map;
-
-#ifdef CONFIG_RMI4_FWLIB
-	char *firmware_name;
-#endif
 };
 
 /**
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH 07/15] Input: synaptics-rmi4 - remove remaining debugfs code
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny
In-Reply-To: <1390521623-6491-7-git-send-email-courtney.cavin@sonymobile.com>

As most of this code was already removed, the remainder does nothing.
Remove it.

Cc: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
---
 drivers/input/rmi4/Kconfig      |   1 -
 drivers/input/rmi4/rmi_bus.c    | 103 ----------------------------------------
 drivers/input/rmi4/rmi_bus.h    |  12 -----
 drivers/input/rmi4/rmi_driver.c |   3 --
 drivers/input/rmi4/rmi_driver.h |  12 -----
 drivers/input/rmi4/rmi_f11.c    |   2 +-
 include/linux/rmi.h             |   7 ++-
 7 files changed, 4 insertions(+), 136 deletions(-)

diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig
index d0c7b6e..22d5599 100644
--- a/drivers/input/rmi4/Kconfig
+++ b/drivers/input/rmi4/Kconfig
@@ -14,7 +14,6 @@ config RMI4_CORE
 config RMI4_DEBUG
 	bool "RMI4 Debugging"
 	depends on RMI4_CORE
-	select DEBUG_FS
 	help
 	  Say Y here to enable debug feature in the RMI4 driver.
 
diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
index fd14acb..a51e6b4 100644
--- a/drivers/input/rmi4/rmi_bus.c
+++ b/drivers/input/rmi4/rmi_bus.c
@@ -15,14 +15,9 @@
 #include <linux/rmi.h>
 #include <linux/slab.h>
 #include <linux/types.h>
-#include <linux/debugfs.h>
 #include "rmi_bus.h"
 #include "rmi_driver.h"
 
-#ifdef CONFIG_RMI4_DEBUG
-static struct dentry *rmi_debugfs_root;
-#endif
-
 /*
  * RMI Physical devices
  *
@@ -47,34 +42,6 @@ bool rmi_is_physical_device(struct device *dev)
 	return dev->type == &rmi_device_type;
 }
 
-#ifdef CONFIG_RMI4_DEBUG
-
-static void rmi_physical_setup_debugfs(struct rmi_device *rmi_dev)
-{
-	rmi_dev->debugfs_root = debugfs_create_dir(dev_name(&rmi_dev->dev),
-						   rmi_debugfs_root);
-	if (!rmi_dev->debugfs_root)
-		dev_warn(&rmi_dev->dev, "Failed to create debugfs root.\n");
-}
-
-static void rmi_physical_teardown_debugfs(struct rmi_device *rmi_dev)
-{
-	if (rmi_dev->debugfs_root)
-		debugfs_remove_recursive(rmi_dev->debugfs_root);
-}
-
-#else
-
-static void rmi_physical_setup_debugfs(struct rmi_device *rmi_dev)
-{
-}
-
-static void rmi_physical_teardown_debugfs(struct rmi_device *rmi_dev)
-{
-}
-
-#endif
-
 /**
  * rmi_register_transport_device - register a transport device connection
  * on the RMI bus.  Transport drivers provide communication from the devices
@@ -108,8 +75,6 @@ int rmi_register_transport_device(struct rmi_transport_dev *xport)
 
 	xport->rmi_dev = rmi_dev;
 
-	rmi_physical_setup_debugfs(rmi_dev);
-
 	error = device_register(&rmi_dev->dev);
 	if (error) {
 		put_device(&rmi_dev->dev);
@@ -132,7 +97,6 @@ void rmi_unregister_transport_device(struct rmi_transport_dev *xport)
 {
 	struct rmi_device *rmi_dev = xport->rmi_dev;
 
-	rmi_physical_teardown_debugfs(rmi_dev);
 	device_unregister(&rmi_dev->dev);
 }
 EXPORT_SYMBOL(rmi_unregister_transport_device);
@@ -156,37 +120,6 @@ bool rmi_is_function_device(struct device *dev)
 	return dev->type == &rmi_function_type;
 }
 
-#ifdef CONFIG_RMI4_DEBUG
-
-static void rmi_function_setup_debugfs(struct rmi_function *fn)
-{
-	char dirname[12];
-
-	snprintf(dirname, sizeof(dirname), "F%02X", fn->fd.function_number);
-	fn->debugfs_root = debugfs_create_dir(dirname,
-					      fn->rmi_dev->debugfs_root);
-	if (!fn->debugfs_root)
-		dev_warn(&fn->dev, "Failed to create debugfs dir.\n");
-}
-
-static void rmi_function_teardown_debugfs(struct rmi_function *fn)
-{
-	if (fn->debugfs_root)
-		debugfs_remove_recursive(fn->debugfs_root);
-}
-
-#else
-
-static void rmi_function_setup_debugfs(struct rmi_function *fn)
-{
-}
-
-static void rmi_function_teardown_debugfs(struct rmi_function *fn)
-{
-}
-
-#endif
-
 static int rmi_function_match(struct device *dev, struct device_driver *drv)
 {
 	struct rmi_function_handler *handler = to_rmi_function_handler(drv);
@@ -234,8 +167,6 @@ int rmi_register_function(struct rmi_function *fn)
 	fn->dev.type = &rmi_function_type;
 	fn->dev.bus = &rmi_bus_type;
 
-	rmi_function_setup_debugfs(fn);
-
 	error = device_register(&fn->dev);
 	if (error) {
 		dev_err(&rmi_dev->dev,
@@ -250,13 +181,11 @@ int rmi_register_function(struct rmi_function *fn)
 	return 0;
 
 error_exit:
-	rmi_function_teardown_debugfs(fn);
 	return error;
 }
 
 void rmi_unregister_function(struct rmi_function *fn)
 {
-	rmi_function_teardown_debugfs(fn);
 	device_unregister(&fn->dev);
 }
 
@@ -325,34 +254,6 @@ struct bus_type rmi_bus_type = {
 	.name		= "rmi",
 };
 
-#ifdef CONFIG_RMI4_DEBUG
-
-static void rmi_bus_setup_debugfs(void)
-{
-	rmi_debugfs_root = debugfs_create_dir(rmi_bus_type.name, NULL);
-	if (!rmi_debugfs_root)
-		pr_err("%s: Failed to create debugfs root\n",
-		       __func__);
-}
-
-static void rmi_bus_teardown_debugfs(void)
-{
-	if (rmi_debugfs_root)
-		debugfs_remove_recursive(rmi_debugfs_root);
-}
-
-#else
-
-static void rmi_bus_setup_debugfs(void)
-{
-}
-
-static void rmi_bus_teardown_debugfs(void)
-{
-}
-
-#endif
-
 static int __init rmi_bus_init(void)
 {
 	int error;
@@ -364,8 +265,6 @@ static int __init rmi_bus_init(void)
 		return error;
 	}
 
-	rmi_bus_setup_debugfs();
-
 	error = rmi_register_f01_handler();
 	if (error) {
 		pr_err("%s: error registering the RMI F01 handler: %d\n",
@@ -385,7 +284,6 @@ static int __init rmi_bus_init(void)
 err_unregister_f01:
 	rmi_unregister_f01_handler();
 err_unregister_bus:
-	rmi_bus_teardown_debugfs();
 	bus_unregister(&rmi_bus_type);
 	return error;
 }
@@ -400,7 +298,6 @@ static void __exit rmi_bus_exit(void)
 
 	rmi_unregister_physical_driver();
 	rmi_unregister_f01_handler();
-	rmi_bus_teardown_debugfs();
 	bus_unregister(&rmi_bus_type);
 }
 module_exit(rmi_bus_exit);
diff --git a/drivers/input/rmi4/rmi_bus.h b/drivers/input/rmi4/rmi_bus.h
index 2bad2ed..62fd544 100644
--- a/drivers/input/rmi4/rmi_bus.h
+++ b/drivers/input/rmi4/rmi_bus.h
@@ -19,7 +19,6 @@
 #include <linux/stat.h>
 #include <linux/types.h>
 #include <linux/wait.h>
-#include <linux/debugfs.h>
 #include <linux/rmi.h>
 
 struct rmi_device;
@@ -39,7 +38,6 @@ struct rmi_device;
  * @data: Private data pointer
  *
  * @node: entry in device's list of functions
- * @debugfs_root: used during debugging
  */
 struct rmi_function {
 	struct rmi_function_descriptor fd;
@@ -50,10 +48,6 @@ struct rmi_function {
 	unsigned long *irq_mask;
 	void *data;
 	struct list_head node;
-
-#ifdef CONFIG_RMI4_DEBUG
-	struct dentry *debugfs_root;
-#endif
 };
 
 #define to_rmi_function(d)	container_of(d, struct rmi_function, dev)
@@ -208,8 +202,6 @@ struct rmi_transport_ops {
  * @number: Unique number for the device on the bus.
  * @driver: Pointer to associated driver
  * @xport: Pointer to the transport interface
- * @debugfs_root: base for this particular sensor device.
- *
  */
 struct rmi_device {
 	struct device dev;
@@ -217,10 +209,6 @@ struct rmi_device {
 
 	struct rmi_driver *driver;
 	struct rmi_transport_dev *xport;
-
-#ifdef CONFIG_RMI4_DEBUG
-	struct dentry *debugfs_root;
-#endif
 };
 
 #define to_rmi_device(d) container_of(d, struct rmi_device, dev)
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 691b6fb..e44eff7 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -16,7 +16,6 @@
 
 #include <linux/kernel.h>
 #include <linux/bitmap.h>
-#include <linux/debugfs.h>
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/fs.h>
@@ -42,8 +41,6 @@
 
 #define DEFAULT_POLL_INTERVAL_MS	13
 
-#define IRQ_DEBUG(data) (IS_ENABLED(CONFIG_RMI4_DEBUG) && data->irq_debug)
-
 static irqreturn_t rmi_irq_thread(int irq, void *p)
 {
 	struct rmi_transport_dev *xport = p;
diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h
index f28166f..eafbdb3 100644
--- a/drivers/input/rmi4/rmi_driver.h
+++ b/drivers/input/rmi4/rmi_driver.h
@@ -38,7 +38,6 @@ struct rmi_driver_data {
 	bool f01_bootloader_mode;
 
 	u32 attn_count;
-	u32 irq_debug;	/* Should be bool, but debugfs wants u32 */
 	int irq;
 	int num_of_irq_regs;
 	int irq_count;
@@ -54,17 +53,6 @@ struct rmi_driver_data {
 
 	bool enabled;
 
-#ifdef CONFIG_RMI4_DEBUG
-	struct dentry *debugfs_delay;
-	struct dentry *debugfs_xport;
-	struct dentry *debugfs_reg_ctl;
-	struct dentry *debugfs_reg;
-	struct dentry *debugfs_irq;
-	struct dentry *debugfs_attn_count;
-	u16 reg_debug_addr;
-	u8 reg_debug_size;
-#endif
-
 	void *data;
 };
 
diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c
index 553afd8..87d85ab 100644
--- a/drivers/input/rmi4/rmi_f11.c
+++ b/drivers/input/rmi4/rmi_f11.c
@@ -515,7 +515,7 @@ struct f11_2d_sensor {
 	u8 *data_pkt;
 	int pkt_size;
 	u8 sensor_index;
-	u32 type_a;	/* boolean but debugfs API requires u32 */
+	bool type_a;
 	enum rmi_f11_sensor_type sensor_type;
 	struct input_dev *input;
 	struct input_dev *mouse_input;
diff --git a/include/linux/rmi.h b/include/linux/rmi.h
index 41c2c04..f3775eb 100644
--- a/include/linux/rmi.h
+++ b/include/linux/rmi.h
@@ -21,7 +21,6 @@
 #include <linux/stat.h>
 #include <linux/types.h>
 #include <linux/wait.h>
-#include <linux/debugfs.h>
 
 /**
  * struct rmi_f11_axis_alignment - target axis alignment
@@ -42,9 +41,9 @@
  *               automatically enabled for this sensor.
  */
 struct rmi_f11_2d_axis_alignment {
-	u32 swap_axes;	/* boolean, but u32 is needed by debugfs API */
-	u32 flip_x;	/* boolean */
-	u32 flip_y;	/* boolean */
+	bool swap_axes;
+	bool flip_x;
+	bool flip_y;
 	u16 clip_x_low;
 	u16 clip_y_low;
 	u16 clip_x_high;
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH 06/15] Input: synaptics-rmi4 - remove platform suspend callbacks
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny
In-Reply-To: <1390521623-6491-6-git-send-email-courtney.cavin@sonymobile.com>

These are unnecessary and ugly. Remove them, and all related code.

Cc: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
---
 drivers/input/rmi4/rmi_driver.c | 57 ++---------------------------------------
 drivers/input/rmi4/rmi_driver.h | 10 --------
 include/linux/rmi.h             | 20 ---------------
 3 files changed, 2 insertions(+), 85 deletions(-)

diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 780742f..691b6fb 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -621,60 +621,16 @@ error_exit:
 #ifdef CONFIG_PM_SLEEP
 static int rmi_driver_suspend(struct device *dev)
 {
-	struct rmi_driver_data *data;
-	int retval = 0;
 	struct rmi_device *rmi_dev = to_rmi_device(dev);
 
-	data = dev_get_drvdata(&rmi_dev->dev);
-
-	mutex_lock(&data->suspend_mutex);
-
-	if (data->pre_suspend) {
-		retval = data->pre_suspend(data->pm_data);
-		if (retval)
-			goto exit;
-	}
-
 	disable_sensor(rmi_dev);
-
-	if (data->post_suspend)
-		retval = data->post_suspend(data->pm_data);
-
-exit:
-	mutex_unlock(&data->suspend_mutex);
-	return retval;
+	return 0;
 }
 
 static int rmi_driver_resume(struct device *dev)
 {
-	struct rmi_driver_data *data;
-	int retval = 0;
 	struct rmi_device *rmi_dev = to_rmi_device(dev);
-
-	data = dev_get_drvdata(&rmi_dev->dev);
-	mutex_lock(&data->suspend_mutex);
-
-	if (data->pre_resume) {
-		retval = data->pre_resume(data->pm_data);
-		if (retval)
-			goto exit;
-	}
-
-	retval = enable_sensor(rmi_dev);
-	if (retval)
-		goto exit;
-
-
-	if (data->post_resume) {
-		retval = data->post_resume(data->pm_data);
-		if (retval)
-			goto exit;
-	}
-
-	data->suspended = false;
-exit:
-	mutex_unlock(&data->suspend_mutex);
-	return retval;
+	return enable_sensor(rmi_dev);
 }
 
 #endif /* CONFIG_PM_SLEEP */
@@ -811,15 +767,6 @@ static int rmi_driver_probe(struct device *dev)
 		retval = -ENOMEM;
 		goto err_free_data;
 	}
-	if (IS_ENABLED(CONFIG_PM)) {
-		data->pm_data = pdata->pm_data;
-		data->pre_suspend = pdata->pre_suspend;
-		data->post_suspend = pdata->post_suspend;
-		data->pre_resume = pdata->pre_resume;
-		data->post_resume = pdata->post_resume;
-
-		mutex_init(&data->suspend_mutex);
-	}
 
 	data->irq = pdata->irq;
 	if (data->irq < 0) {
diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h
index aef5521..f28166f 100644
--- a/drivers/input/rmi4/rmi_driver.h
+++ b/drivers/input/rmi4/rmi_driver.h
@@ -53,16 +53,6 @@ struct rmi_driver_data {
 	u8 bsr;
 
 	bool enabled;
-#ifdef CONFIG_PM_SLEEP
-	bool suspended;
-	struct mutex suspend_mutex;
-
-	void *pm_data;
-	int (*pre_suspend) (const void *pm_data);
-	int (*post_suspend) (const void *pm_data);
-	int (*pre_resume) (const void *pm_data);
-	int (*post_resume) (const void *pm_data);
-#endif
 
 #ifdef CONFIG_RMI4_DEBUG
 	struct dentry *debugfs_delay;
diff --git a/include/linux/rmi.h b/include/linux/rmi.h
index 326e741..41c2c04 100644
--- a/include/linux/rmi.h
+++ b/include/linux/rmi.h
@@ -204,8 +204,6 @@ struct rmi_device_platform_data_spi {
  * @f11_rezero_wait - if non-zero, this is how may milliseconds the F11 2D
  * sensor will wait before being be rezeroed on exit from suspend.  If
  * this value is zero, the F11 2D sensor will not be rezeroed on resume.
- * @pre_suspend - this will be called before any other suspend operations are
- * done.
  * @power_management - overrides default touch sensor doze mode settings (see
  * above)
  * @f19_button_map - provide initial input subsystem key mappings for F19.
@@ -213,16 +211,6 @@ struct rmi_device_platform_data_spi {
  * @gpioled_map - provides initial settings for GPIOs and LEDs controlled by
  * F30.
  * @f41_button_map - provide initial input subsystem key mappings for F41.
- *
- * @post_suspend - this will be called after all suspend operations are
- * completed.  This is the ONLY safe place to power off an RMI sensor
- * during the suspend process.
- * @pre_resume - this is called before any other resume operations.  If you
- * powered off the RMI4 sensor in post_suspend(), then you MUST power it back
- * here, and you MUST wait an appropriate time for the ASIC to come up
- * (100ms to 200ms, depending on the sensor) before returning.
- * @pm_data - this will be passed to the various (pre|post)_(suspend/resume)
- * functions.
  */
 struct rmi_device_platform_data {
 	int irq;
@@ -242,14 +230,6 @@ struct rmi_device_platform_data {
 #ifdef CONFIG_RMI4_FWLIB
 	char *firmware_name;
 #endif
-
-#ifdef	CONFIG_PM
-	void *pm_data;
-	int (*pre_suspend) (const void *pm_data);
-	int (*post_suspend) (const void *pm_data);
-	int (*pre_resume) (const void *pm_data);
-	int (*post_resume) (const void *pm_data);
-#endif
 };
 
 /**
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH 05/15] Input: synaptics-rmi4 - remove gpio handling and polling
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny
In-Reply-To: <1390521623-6491-5-git-send-email-courtney.cavin@sonymobile.com>

Since all the configuration needed for an irq can be provided in other
ways, remove all gpio->irq functionality. This cleans up the code quite
a bit.

This also gets rid of polling functionality, as this should be done
elsewhere if absolutely needed.

Cc: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
---
 drivers/input/rmi4/rmi_driver.c | 143 +++++-----------------------------------
 drivers/input/rmi4/rmi_driver.h |   7 --
 drivers/input/rmi4/rmi_i2c.c    |  24 +------
 include/linux/rmi.h             |  31 +--------
 4 files changed, 20 insertions(+), 185 deletions(-)

diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 5fb582c..780742f 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -20,7 +20,6 @@
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/fs.h>
-#include <linux/gpio.h>
 #include <linux/kconfig.h>
 #include <linux/list.h>
 #include <linux/module.h>
@@ -50,74 +49,17 @@ static irqreturn_t rmi_irq_thread(int irq, void *p)
 	struct rmi_transport_dev *xport = p;
 	struct rmi_device *rmi_dev = xport->rmi_dev;
 	struct rmi_driver *driver = rmi_dev->driver;
-	struct rmi_device_platform_data *pdata = xport->dev->platform_data;
 	struct rmi_driver_data *data;
 
 	data = dev_get_drvdata(&rmi_dev->dev);
-
-	if (IRQ_DEBUG(data))
-		dev_dbg(xport->dev, "ATTN gpio, value: %d.\n",
-				gpio_get_value(pdata->attn_gpio));
-
-	if (gpio_get_value(pdata->attn_gpio) == pdata->attn_polarity) {
-		data->attn_count++;
-		if (driver && driver->irq_handler && rmi_dev)
-			driver->irq_handler(rmi_dev, irq);
-	}
+	if (driver && driver->irq_handler && rmi_dev)
+		driver->irq_handler(rmi_dev, irq);
 
 	return IRQ_HANDLED;
 }
 
 static int process_interrupt_requests(struct rmi_device *rmi_dev);
 
-static void rmi_poll_work(struct work_struct *work)
-{
-	struct rmi_driver_data *data =
-			container_of(work, struct rmi_driver_data, poll_work);
-	struct rmi_device *rmi_dev = data->rmi_dev;
-
-	process_interrupt_requests(rmi_dev);
-}
-
-/*
- * This is the timer function for polling - it simply has to schedule work
- * and restart the timer.
- */
-static enum hrtimer_restart rmi_poll_timer(struct hrtimer *timer)
-{
-	struct rmi_driver_data *data =
-			container_of(timer, struct rmi_driver_data, poll_timer);
-
-	if (!data->enabled)
-		return HRTIMER_NORESTART;
-	if (!work_pending(&data->poll_work))
-		schedule_work(&data->poll_work);
-	hrtimer_start(&data->poll_timer, data->poll_interval, HRTIMER_MODE_REL);
-	return HRTIMER_NORESTART;
-}
-
-static int enable_polling(struct rmi_device *rmi_dev)
-{
-	struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
-
-	dev_dbg(&rmi_dev->dev, "Polling enabled.\n");
-	INIT_WORK(&data->poll_work, rmi_poll_work);
-	hrtimer_init(&data->poll_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	data->poll_timer.function = rmi_poll_timer;
-	hrtimer_start(&data->poll_timer, data->poll_interval, HRTIMER_MODE_REL);
-
-	return 0;
-}
-
-static void disable_polling(struct rmi_device *rmi_dev)
-{
-	struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
-
-	dev_dbg(&rmi_dev->dev, "Polling disabled.\n");
-	hrtimer_cancel(&data->poll_timer);
-	cancel_work_sync(&data->poll_work);
-}
-
 static void disable_sensor(struct rmi_device *rmi_dev)
 {
 	struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
@@ -125,9 +67,6 @@ static void disable_sensor(struct rmi_device *rmi_dev)
 	if (!data->enabled)
 		return;
 
-	if (!data->irq)
-		disable_polling(rmi_dev);
-
 	if (rmi_dev->xport->ops->disable_device)
 		rmi_dev->xport->ops->disable_device(rmi_dev->xport);
 
@@ -155,20 +94,14 @@ static int enable_sensor(struct rmi_device *rmi_dev)
 	}
 
 	xport = rmi_dev->xport;
-	if (data->irq) {
-		retval = request_threaded_irq(data->irq,
-				xport->hard_irq ? xport->hard_irq : NULL,
-				xport->irq_thread ?
-					xport->irq_thread : rmi_irq_thread,
-				data->irq_flags,
-				dev_name(&rmi_dev->dev), xport);
-		if (retval)
-			return retval;
-	} else {
-		retval = enable_polling(rmi_dev);
-		if (retval < 0)
-			return retval;
-	}
+	retval = request_threaded_irq(data->irq,
+			xport->hard_irq ? xport->hard_irq : NULL,
+			xport->irq_thread ?
+				xport->irq_thread : rmi_irq_thread,
+			IRQF_ONESHOT,
+			dev_name(&rmi_dev->dev), xport);
+	if (retval)
+		return retval;
 
 	data->enabled = true;
 
@@ -751,16 +684,9 @@ static SIMPLE_DEV_PM_OPS(rmi_driver_pm, rmi_driver_suspend, rmi_driver_resume);
 static int rmi_driver_remove(struct device *dev)
 {
 	struct rmi_device *rmi_dev = to_rmi_device(dev);
-	const struct rmi_device_platform_data *pdata =
-					to_rmi_platform_data(rmi_dev);
-	const struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
-
 	disable_sensor(rmi_dev);
 	rmi_free_function_list(rmi_dev);
 
-	if (data->gpio_held)
-		gpio_free(pdata->attn_gpio);
-
 	return 0;
 }
 
@@ -895,51 +821,12 @@ static int rmi_driver_probe(struct device *dev)
 		mutex_init(&data->suspend_mutex);
 	}
 
-	if (gpio_is_valid(pdata->attn_gpio)) {
-		static const char GPIO_LABEL[] = "attn";
-		unsigned long gpio_flags = GPIOF_DIR_IN;
-
-		data->irq = gpio_to_irq(pdata->attn_gpio);
-		if (pdata->level_triggered) {
-			data->irq_flags = IRQF_ONESHOT |
-				((pdata->attn_polarity == RMI_ATTN_ACTIVE_HIGH)
-				? IRQF_TRIGGER_HIGH : IRQF_TRIGGER_LOW);
-		} else {
-			data->irq_flags =
-				(pdata->attn_polarity == RMI_ATTN_ACTIVE_HIGH)
-				? IRQF_TRIGGER_RISING : IRQF_TRIGGER_FALLING;
-		}
+	data->irq = pdata->irq;
+	if (data->irq < 0) {
+		dev_err(dev, "Failed to get attn IRQ.\n");
+		retval = data->irq;
+		goto err_free_data;
 
-		if (IS_ENABLED(CONFIG_RMI4_DEV))
-			gpio_flags |= GPIOF_EXPORT;
-
-		retval = gpio_request_one(pdata->attn_gpio, gpio_flags,
-					  GPIO_LABEL);
-		if (retval) {
-			dev_warn(dev, "WARNING: Failed to request ATTN gpio %d, code=%d.\n",
-				 pdata->attn_gpio, retval);
-			retval = 0;
-		} else {
-			dev_info(dev, "Obtained ATTN gpio %d.\n",
-					pdata->attn_gpio);
-			data->gpio_held = true;
-			if (IS_ENABLED(CONFIG_RMI4_DEV)) {
-				retval = gpio_export_link(dev,
-						GPIO_LABEL, pdata->attn_gpio);
-				if (retval) {
-					dev_warn(dev,
-						"WARNING: Failed to symlink ATTN gpio!\n");
-					retval = 0;
-				} else {
-					dev_info(dev, "Exported ATTN gpio %d.",
-						pdata->attn_gpio);
-				}
-			}
-		}
-	} else {
-		data->poll_interval = ktime_set(0,
-			(pdata->poll_interval_ms ? pdata->poll_interval_ms :
-			DEFAULT_POLL_INTERVAL_MS) * 1000 * 1000);
 	}
 
 	if (data->f01_container->dev.driver) {
diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h
index 4f44a54..aef5521 100644
--- a/drivers/input/rmi4/rmi_driver.h
+++ b/drivers/input/rmi4/rmi_driver.h
@@ -39,9 +39,7 @@ struct rmi_driver_data {
 
 	u32 attn_count;
 	u32 irq_debug;	/* Should be bool, but debugfs wants u32 */
-	bool gpio_held;
 	int irq;
-	int irq_flags;
 	int num_of_irq_regs;
 	int irq_count;
 	unsigned long *irq_status;
@@ -50,11 +48,6 @@ struct rmi_driver_data {
 	bool irq_stored;
 	struct mutex irq_mutex;
 
-	/* Following are used when polling. */
-	struct hrtimer poll_timer;
-	struct work_struct poll_work;
-	ktime_t poll_interval;
-
 	struct mutex pdt_mutex;
 	u8 pdt_props;
 	u8 bsr;
diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c
index 910f05c..aebf974 100644
--- a/drivers/input/rmi4/rmi_i2c.c
+++ b/drivers/input/rmi4/rmi_i2c.c
@@ -196,8 +196,7 @@ static int rmi_i2c_probe(struct i2c_client *client,
 		return -EINVAL;
 	}
 
-	dev_dbg(&client->dev, "Probing %#02x (GPIO %d).\n",
-		client->addr, pdata->attn_gpio);
+	dev_dbg(&client->dev, "Probing %#02x.\n", client->addr);
 
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
 		dev_err(&client->dev,
@@ -205,15 +204,6 @@ static int rmi_i2c_probe(struct i2c_client *client,
 		return -ENODEV;
 	}
 
-	if (pdata->gpio_config) {
-		retval = pdata->gpio_config(pdata->gpio_data, true);
-		if (retval < 0) {
-			dev_err(&client->dev, "Failed to configure GPIOs, code: %d.\n",
-				retval);
-			return retval;
-		}
-	}
-
 	rmi_i2c = devm_kzalloc(&client->dev, sizeof(struct rmi_i2c_xport),
 				GFP_KERNEL);
 	if (!rmi_i2c)
@@ -240,7 +230,7 @@ static int rmi_i2c_probe(struct i2c_client *client,
 	if (retval) {
 		dev_err(&client->dev, "Failed to register transport driver at 0x%.2X.\n",
 			client->addr);
-		goto err_gpio;
+		goto err;
 	}
 
 	i2c_set_clientdata(client, rmi_i2c);
@@ -249,24 +239,16 @@ static int rmi_i2c_probe(struct i2c_client *client,
 			client->addr);
 	return 0;
 
-err_gpio:
-	if (pdata->gpio_config)
-		pdata->gpio_config(pdata->gpio_data, false);
-
+err:
 	return retval;
 }
 
 static int rmi_i2c_remove(struct i2c_client *client)
 {
-	const struct rmi_device_platform_data *pdata =
-				dev_get_platdata(&client->dev);
 	struct rmi_i2c_xport *rmi_i2c = i2c_get_clientdata(client);
 
 	rmi_unregister_transport_device(&rmi_i2c->xport);
 
-	if (pdata->gpio_config)
-		pdata->gpio_config(pdata->gpio_data, false);
-
 	return 0;
 }
 
diff --git a/include/linux/rmi.h b/include/linux/rmi.h
index 65b59b5..326e741 100644
--- a/include/linux/rmi.h
+++ b/include/linux/rmi.h
@@ -23,11 +23,6 @@
 #include <linux/wait.h>
 #include <linux/debugfs.h>
 
-enum rmi_attn_polarity {
-	RMI_ATTN_ACTIVE_LOW = 0,
-	RMI_ATTN_ACTIVE_HIGH = 1
-};
-
 /**
  * struct rmi_f11_axis_alignment - target axis alignment
  * @swap_axes: set to TRUE if desired to swap x- and y-axis
@@ -194,25 +189,10 @@ struct rmi_device_platform_data_spi {
 /**
  * struct rmi_device_platform_data - system specific configuration info.
  *
+ * @irq - attention IRQ
  * @firmware_name - if specified will override default firmware name,
  * for reflashing.
  *
- * @attn_gpio - the index of a GPIO that will be used to provide the ATTN
- * interrupt from the touch sensor.
- * @attn_polarity - indicates whether ATTN is active high or low.
- * @level_triggered - by default, the driver uses edge triggered interrupts.
- * However, this can cause problems with suspend/resume on some platforms.  In
- * that case, set this to 1 to use level triggered interrupts.
- * @gpio_config - a routine that will be called when the driver is loaded to
- * perform any platform specific GPIO configuration, and when it is unloaded
- * for GPIO de-configuration.  This is typically used to configure the ATTN
- * GPIO and the I2C or SPI pins, if necessary.
- * @gpio_data - platform specific data to be passed to the GPIO configuration
- * function.
- *
- * @poll_interval_ms - the time in milliseconds between reads of the interrupt
- * status register.  This is ignored if attn_gpio is non-zero.
- *
  * @reset_delay_ms - after issuing a reset command to the touch sensor, the
  * driver waits a few milliseconds to give the firmware a chance to
  * to re-initialize.  You can override the default wait period here.
@@ -245,14 +225,7 @@ struct rmi_device_platform_data_spi {
  * functions.
  */
 struct rmi_device_platform_data {
-	int attn_gpio;
-	enum rmi_attn_polarity attn_polarity;
-	bool level_triggered;
-	void *gpio_data;
-	int (*gpio_config)(void *gpio_data, bool configure);
-
-	int poll_interval_ms;
-
+	int irq;
 	int reset_delay_ms;
 
 	struct rmi_device_platform_data_spi spi_data;
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH 04/15] Input: synaptics-rmi4 - remove sensor name from platform data
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny
In-Reply-To: <1390521623-6491-4-git-send-email-courtney.cavin@sonymobile.com>

The driver/device already has a name, no need for another one.

Cc: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
---
 drivers/input/rmi4/rmi_bus.c    | 4 ++--
 drivers/input/rmi4/rmi_driver.c | 7 ++-----
 drivers/input/rmi4/rmi_f11.c    | 3 +--
 drivers/input/rmi4/rmi_i2c.c    | 3 +--
 include/linux/rmi.h             | 4 ----
 5 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
index cd7bfbd..fd14acb 100644
--- a/drivers/input/rmi4/rmi_bus.c
+++ b/drivers/input/rmi4/rmi_bus.c
@@ -116,8 +116,8 @@ int rmi_register_transport_device(struct rmi_transport_dev *xport)
 		return error;
 	}
 
-	dev_dbg(xport->dev, "%s: Registered %s as %s.\n", __func__,
-		pdata->sensor_name, dev_name(&rmi_dev->dev));
+	dev_dbg(xport->dev, "%s: Registered %s\n", __func__,
+		dev_name(&rmi_dev->dev));
 
 	return 0;
 }
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 4965589..5fb582c 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -531,12 +531,10 @@ static int create_function(struct rmi_device *rmi_dev,
 {
 	struct device *dev = &rmi_dev->dev;
 	struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
-	struct rmi_device_platform_data *pdata = to_rmi_platform_data(rmi_dev);
 	struct rmi_function *fn;
 	int error;
 
-	dev_dbg(dev, "Initializing F%02X for %s.\n",
-		pdt->function_number, pdata->sensor_name);
+	dev_dbg(dev, "Initializing F%02X\n", pdt->function_number);
 
 	fn = kzalloc(sizeof(struct rmi_function), GFP_KERNEL);
 	if (!fn) {
@@ -822,8 +820,7 @@ static int rmi_driver_probe(struct device *dev)
 
 	retval = rmi_scan_pdt(rmi_dev);
 	if (retval) {
-		dev_err(dev, "PDT scan for %s failed with code %d.\n",
-			pdata->sensor_name, retval);
+		dev_err(dev, "PDT scan failed with code %d.\n", retval);
 		goto err_free_data;
 	}
 
diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c
index 4e0a296..553afd8 100644
--- a/drivers/input/rmi4/rmi_f11.c
+++ b/drivers/input/rmi4/rmi_f11.c
@@ -1182,8 +1182,7 @@ static int rmi_f11_initialize(struct rmi_function *fn)
 	struct f11_2d_sensor *sensor;
 	u8 buf;
 
-	dev_dbg(&fn->dev, "Initializing F11 values for %s.\n",
-		 pdata->sensor_name);
+	dev_dbg(&fn->dev, "Initializing F11 values.\n");
 
 	/*
 	** init instance data, fill in values and create any sysfs files
diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c
index 24d8a04..910f05c 100644
--- a/drivers/input/rmi4/rmi_i2c.c
+++ b/drivers/input/rmi4/rmi_i2c.c
@@ -196,8 +196,7 @@ static int rmi_i2c_probe(struct i2c_client *client,
 		return -EINVAL;
 	}
 
-	dev_dbg(&client->dev, "Probing %s at %#02x (GPIO %d).\n",
-		pdata->sensor_name ? pdata->sensor_name : "-no name-",
+	dev_dbg(&client->dev, "Probing %#02x (GPIO %d).\n",
 		client->addr, pdata->attn_gpio);
 
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
diff --git a/include/linux/rmi.h b/include/linux/rmi.h
index 735e978..65b59b5 100644
--- a/include/linux/rmi.h
+++ b/include/linux/rmi.h
@@ -194,8 +194,6 @@ struct rmi_device_platform_data_spi {
 /**
  * struct rmi_device_platform_data - system specific configuration info.
  *
- * @sensor_name - this is used for various diagnostic messages.
- *
  * @firmware_name - if specified will override default firmware name,
  * for reflashing.
  *
@@ -247,8 +245,6 @@ struct rmi_device_platform_data_spi {
  * functions.
  */
 struct rmi_device_platform_data {
-	char *sensor_name;	/* Used for diagnostics. */
-
 	int attn_gpio;
 	enum rmi_attn_polarity attn_polarity;
 	bool level_triggered;
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH 03/15] Input: synaptics-rmi4 - don't free devices directly
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny
In-Reply-To: <1390521623-6491-3-git-send-email-courtney.cavin@sonymobile.com>

Devices use a kobject to manage references, do not delete the memory
while still referenced.  Instead, call put_device() to release the
reference.

Cc: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
---
 drivers/input/rmi4/rmi_bus.c    | 8 +++++---
 drivers/input/rmi4/rmi_driver.c | 6 +-----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
index 8a939f3..cd7bfbd 100644
--- a/drivers/input/rmi4/rmi_bus.c
+++ b/drivers/input/rmi4/rmi_bus.c
@@ -94,8 +94,7 @@ int rmi_register_transport_device(struct rmi_transport_dev *xport)
 		return -EINVAL;
 	}
 
-	rmi_dev = devm_kzalloc(xport->dev,
-				sizeof(struct rmi_device), GFP_KERNEL);
+	rmi_dev = kzalloc(sizeof(struct rmi_device), GFP_KERNEL);
 	if (!rmi_dev)
 		return -ENOMEM;
 
@@ -112,8 +111,10 @@ int rmi_register_transport_device(struct rmi_transport_dev *xport)
 	rmi_physical_setup_debugfs(rmi_dev);
 
 	error = device_register(&rmi_dev->dev);
-	if (error)
+	if (error) {
+		put_device(&rmi_dev->dev);
 		return error;
+	}
 
 	dev_dbg(xport->dev, "%s: Registered %s as %s.\n", __func__,
 		pdata->sensor_name, dev_name(&rmi_dev->dev));
@@ -240,6 +241,7 @@ int rmi_register_function(struct rmi_function *fn)
 		dev_err(&rmi_dev->dev,
 			"Failed device_register function device %s\n",
 			dev_name(&fn->dev));
+		put_device(&fn->dev);
 		goto error_exit;
 	}
 
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 5c6379c..4965589 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -557,15 +557,11 @@ static int create_function(struct rmi_device *rmi_dev,
 
 	error = rmi_register_function(fn);
 	if (error)
-		goto err_free_mem;
+		return error;
 
 	list_add_tail(&fn->node, &data->function_list);
 
 	return 0;
-
-err_free_mem:
-	kfree(fn);
-	return error;
 }
 
 /*
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH 02/15] Input: synaptics-rmi4 - don't kfree devm_ alloced memory
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny
In-Reply-To: <1390521623-6491-2-git-send-email-courtney.cavin@sonymobile.com>

Cc: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
---
 drivers/input/rmi4/rmi_f01.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c
index cf1081f..98bc65a9 100644
--- a/drivers/input/rmi4/rmi_f01.c
+++ b/drivers/input/rmi4/rmi_f01.c
@@ -390,7 +390,7 @@ static int rmi_f01_initialize(struct rmi_function *fn)
 	return 0;
 
  error_exit:
-	kfree(data);
+	devm_kfree(&fn->dev, data);
 	return error;
 }
 
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH 01/15] Input: synaptics-rmi4 - fix checkpatch.pl, sparse and GCC warnings
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny
In-Reply-To: <1390521623-6491-1-git-send-email-courtney.cavin@sonymobile.com>

Cc: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
---
 drivers/input/rmi4/rmi_bus.c    |  4 ++--
 drivers/input/rmi4/rmi_bus.h    |  2 +-
 drivers/input/rmi4/rmi_driver.c | 17 ++++++++++++-----
 drivers/input/rmi4/rmi_f11.c    |  4 +++-
 4 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
index 96a76e7..8a939f3 100644
--- a/drivers/input/rmi4/rmi_bus.c
+++ b/drivers/input/rmi4/rmi_bus.c
@@ -37,7 +37,7 @@ static void rmi_release_device(struct device *dev)
 	kfree(rmi_dev);
 }
 
-struct device_type rmi_device_type = {
+static struct device_type rmi_device_type = {
 	.name		= "rmi_sensor",
 	.release	= rmi_release_device,
 };
@@ -145,7 +145,7 @@ static void rmi_release_function(struct device *dev)
 	kfree(fn);
 }
 
-struct device_type rmi_function_type = {
+static struct device_type rmi_function_type = {
 	.name		= "rmi_function",
 	.release	= rmi_release_function,
 };
diff --git a/drivers/input/rmi4/rmi_bus.h b/drivers/input/rmi4/rmi_bus.h
index decb479..2bad2ed 100644
--- a/drivers/input/rmi4/rmi_bus.h
+++ b/drivers/input/rmi4/rmi_bus.h
@@ -103,7 +103,7 @@ int __must_check __rmi_register_function_handler(struct rmi_function_handler *,
 #define rmi_register_function_handler(handler) \
 	__rmi_register_function_handler(handler, THIS_MODULE, KBUILD_MODNAME)
 
-void rmi_unregister_function_handler(struct rmi_function_handler *);
+void rmi_unregister_function_handler(struct rmi_function_handler *handler);
 
 /**
  * struct rmi_driver - driver for an RMI4 sensor on the RMI bus.
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 3483e5b..5c6379c 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -32,6 +32,8 @@
 #include "rmi_bus.h"
 #include "rmi_driver.h"
 
+#define RMI4_MAX_N_IRQS 256
+
 #define HAS_NONSTANDARD_PDT_MASK 0x40
 #define RMI4_MAX_PAGE 0xff
 #define RMI4_PAGE_SIZE 0x100
@@ -260,7 +262,7 @@ static void process_one_interrupt(struct rmi_function *fn,
 		unsigned long *irq_status, struct rmi_driver_data *data)
 {
 	struct rmi_function_handler *fh;
-	DECLARE_BITMAP(irq_bits, data->num_of_irq_regs);
+	DECLARE_BITMAP(irq_bits, RMI4_MAX_N_IRQS);
 
 	if (!fn || !fn->dev.driver)
 		return;
@@ -325,7 +327,7 @@ static int process_interrupt_requests(struct rmi_device *rmi_dev)
 static int rmi_driver_set_input_params(struct rmi_device *rmi_dev,
 				struct input_dev *input)
 {
-	// FIXME: set up parent
+	/* FIXME: set up parent */
 	input->name = SYNAPTICS_INPUT_DEVICE_NAME;
 	input->id.vendor  = SYNAPTICS_VENDOR_ID;
 	input->id.bustype = BUS_RMI;
@@ -466,7 +468,7 @@ static int rmi_driver_reset_handler(struct rmi_device *rmi_dev)
 /*
  * Construct a function's IRQ mask. This should be called once and stored.
  */
-int rmi_driver_irq_get_mask(struct rmi_device *rmi_dev,
+static int rmi_driver_irq_get_mask(struct rmi_device *rmi_dev,
 		struct rmi_function *fn) {
 	int i;
 	struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
@@ -665,7 +667,7 @@ static int rmi_scan_pdt(struct rmi_device *rmi_dev)
 					pdt_entry.function_number, page);
 			done = false;
 
-			// XXX need to make sure we create F01 first...
+			/* XXX need to make sure we create F01 first... */
 			retval = create_function(rmi_dev,
 					&pdt_entry, &irq_count, page_start);
 
@@ -674,6 +676,11 @@ static int rmi_scan_pdt(struct rmi_device *rmi_dev)
 		}
 		done = done || data->f01_bootloader_mode;
 	}
+	if (irq_count > RMI4_MAX_N_IRQS) {
+		dev_err(dev, "Too many IRQs specified\n");
+		retval = -EINVAL;
+		goto error_exit;
+	}
 	data->irq_count = irq_count;
 	data->num_of_irq_regs = (irq_count + 7) / 8;
 	dev_dbg(dev, "%s: Done with PDT scan.\n", __func__);
@@ -953,7 +960,7 @@ static int rmi_driver_probe(struct device *dev)
 	return retval;
 }
 
-struct rmi_driver rmi_physical_driver = {
+static struct rmi_driver rmi_physical_driver = {
 	.driver = {
 		.owner	= THIS_MODULE,
 		.name	= "rmi_physical",
diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c
index c2be9de..4e0a296 100644
--- a/drivers/input/rmi4/rmi_f11.c
+++ b/drivers/input/rmi4/rmi_f11.c
@@ -610,6 +610,8 @@ static void rmi_f11_abs_pos_report(struct f11_data *f11,
 	int temp;
 	u8 abs_base = n_finger * RMI_F11_ABS_BYTES;
 
+	orient = z = w_min = w_max = 0;
+
 	if (finger_state) {
 		x = (data->abs_pos[abs_base] << 4) |
 			(data->abs_pos[abs_base + 2] & 0x0F);
@@ -1413,7 +1415,7 @@ static int rmi_f11_config(struct rmi_function *fn)
 	return 0;
 }
 
-int rmi_f11_attention(struct rmi_function *fn,
+static int rmi_f11_attention(struct rmi_function *fn,
 						unsigned long *irq_bits)
 {
 	struct rmi_device *rmi_dev = fn->rmi_dev;
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH 00/15] Input: synaptics-rmi4 - cleanup and add DT support
From: Courtney Cavin @ 2014-01-24  0:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, cheiny

This is an attempt to get this driver closer to being in an upstream-able form.
In the process, this drops legacy callback methods for managing power and GPIO
configuration, in favor of the already existing frameworks.  Most of this
series is cleanup, but there are a few intermixed bug fixes to make it all
work.

This patch series is based off of the synaptics-rmi4 branch merged into
Linus' 3.13.  A tree is available at [1].

This was tested on Synaptics TM2281-001 & TM2282-001.

[1] http://github.com/courtc/linux.git
	tag for-input/synaptics-rmi4

Courtney Cavin (15):
  Input: synaptics-rmi4 - fix checkpatch.pl, sparse and GCC warnings
  Input: synaptics-rmi4 - don't kfree devm_ alloced memory
  Input: synaptics-rmi4 - don't free devices directly
  Input: synaptics-rmi4 - remove sensor name from platform data
  Input: synaptics-rmi4 - remove gpio handling and polling
  Input: synaptics-rmi4 - remove platform suspend callbacks
  Input: synaptics-rmi4 - remove remaining debugfs code
  Input: synaptics-rmi4 - cleanup platform data
  Input: synaptics-rmi4 - remove unused defines and variables
  Input: synaptics-rmi4 - add devicetree support
  Input: synaptics-rmi4 - add regulator support
  Input: synaptics-rmi4 - don't immediately set page on probe
  Input: synaptics-rmi4 - properly set F01 container on PDT scan
  Input: synaptics-rmi4 - ensure we have IRQs before reading status
  Input: synaptics-rmi4 - correct RMI4 spec url

 Documentation/devicetree/bindings/input/rmi4.txt   | 117 +++++
 .../devicetree/bindings/vendor-prefixes.txt        |   1 +
 drivers/input/rmi4/Kconfig                         |   1 -
 drivers/input/rmi4/rmi_bus.c                       | 131 +-----
 drivers/input/rmi4/rmi_bus.h                       |  18 +-
 drivers/input/rmi4/rmi_driver.c                    | 321 +++++--------
 drivers/input/rmi4/rmi_driver.h                    |  33 +-
 drivers/input/rmi4/rmi_f01.c                       | 163 ++++---
 drivers/input/rmi4/rmi_f11.c                       | 523 ++++++---------------
 drivers/input/rmi4/rmi_i2c.c                       |  55 +--
 include/linux/rmi.h                                | 219 ++-------
 11 files changed, 551 insertions(+), 1031 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/rmi4.txt

-- 
1.8.1.5


^ permalink raw reply

* [PATCH] HID: multitouch: add FocalTech FTxxxx support
From: Benjamin Tissoires @ 2014-01-23 21:33 UTC (permalink / raw)
  To: Benjamin Tissoires, Jiri Kosina, Henrik Rydberg, linux-input,
	linux-kernel

This is a Win7 device which does not work correctly with the default
settings (not the previous default BT).
However, the quirk ALWAYS_TRUE makes it working like a charm.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---

Hi Jiri,

well, it's been a long time since I did not add those kind of small patches.
And I really hope not having to do some gain soon :)

Cheers,
Benjamin

 drivers/hid/hid-ids.h        | 1 +
 drivers/hid/hid-multitouch.c | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 92b40c0..67f89dd 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -240,6 +240,7 @@
 
 #define USB_VENDOR_ID_CYGNAL		0x10c4
 #define USB_DEVICE_ID_CYGNAL_RADIO_SI470X	0x818a
+#define USB_DEVICE_ID_FOCALTECH_FTXXXX_MULTITOUCH	0x81b9
 
 #define USB_VENDOR_ID_CYPRESS		0x04b4
 #define USB_DEVICE_ID_CYPRESS_MOUSE	0x0001
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index f134d73..221d503 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -1166,6 +1166,11 @@ static const struct hid_device_id mt_devices[] = {
 		MT_USB_DEVICE(USB_VENDOR_ID_FLATFROG,
 			USB_DEVICE_ID_MULTITOUCH_3200) },
 
+	/* FocalTech Panels */
+	{ .driver_data = MT_CLS_SERIAL,
+		MT_USB_DEVICE(USB_VENDOR_ID_CYGNAL,
+			USB_DEVICE_ID_FOCALTECH_FTXXXX_MULTITOUCH) },
+
 	/* GeneralTouch panel */
 	{ .driver_data = MT_CLS_GENERALTOUCH_TWOFINGERS,
 		MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
-- 
1.8.3.1


^ permalink raw reply related

* Re: [PATCH 2/3 RESEND] mfd: tc3589x: Reform device tree probing
From: Lee Jones @ 2014-01-23 15:11 UTC (permalink / raw)
  To: Linus Walleij
  Cc: devicetree@vger.kernel.org, Dmitry Torokhov, Linux Input,
	Samuel Ortiz, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Mark Rutland
In-Reply-To: <CACRpkdZjRG=cmWHmmFNS+=guCwQoFpu8T3r4YHr6t_XihvmaWA@mail.gmail.com>

> > Patch looks good to me. Is there any reason why we should rush this in
> > for v3.14, or is it okay to go to -next?
> 
> No rush, but it's been on review like forever so unless there is
> some noise from the DT people at -rc1 I'd be very happy if you
> could apply patches 1 & 2 by then.

I'm just waiting for their Ack. If I don't have it soon I'll review it
myself and any changes will have to come in via subsequent patch
submissions.

I think it's sensible to head for v3.15 for this set.

> The third one can be applied out-of-order to the input tree after
> that.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 2/3 RESEND] mfd: tc3589x: Reform device tree probing
From: Linus Walleij @ 2014-01-23 15:04 UTC (permalink / raw)
  To: Lee Jones
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Dmitry Torokhov, Linux Input, Samuel Ortiz,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Mark Rutland
In-Reply-To: <20140123133141.GD8586@lee--X1>

On Thu, Jan 23, 2014 at 2:31 PM, Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:

> Patch looks good to me. Is there any reason why we should rush this in
> for v3.14, or is it okay to go to -next?

No rush, but it's been on review like forever so unless there is
some noise from the DT people at -rc1 I'd be very happy if you
could apply patches 1 & 2 by then.

The third one can be applied out-of-order to the input tree after
that.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox