* [PATCH 3/3 RESEND] input: tc3589x-keypad: support probing from device tree
From: Linus Walleij @ 2014-01-23 12:43 UTC (permalink / raw)
To: devicetree, Dmitry Torokhov, linux-input, Samuel Ortiz, Lee Jones
Cc: linux-kernel, linux-arm-kernel, Mark Rutland, Linus Walleij
Implement device tree probing for the tc3589x keypad driver.
This is modeled on the STMPE keypad driver and tested on the
Ux500 TVK1281618 UIB.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v2->v3:
- Use two local u32 variables to avoid weirdness in u8 casting
of the resulting values to the pointers.
ChangeLog v1->v2:
- Fix rows/columns binding to read two u32's insead of two
u8 /bits/ as noted by Mark Rutland.
---
drivers/input/keyboard/tc3589x-keypad.c | 66 ++++++++++++++++++++++++++++++++-
1 file changed, 64 insertions(+), 2 deletions(-)
diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
index 208de7cbb7fa..7f36e7addb86 100644
--- a/drivers/input/keyboard/tc3589x-keypad.c
+++ b/drivers/input/keyboard/tc3589x-keypad.c
@@ -297,6 +297,65 @@ static void tc3589x_keypad_close(struct input_dev *input)
tc3589x_keypad_disable(keypad);
}
+#ifdef CONFIG_OF
+static const struct tc3589x_keypad_platform_data *
+tc3589x_keypad_of_probe(struct device *dev)
+{
+ struct device_node *np = dev->of_node;
+ struct tc3589x_keypad_platform_data *plat;
+ u32 cols, rows;
+ u32 debounce_ms;
+ int proplen;
+
+ if (!np)
+ return ERR_PTR(-ENODEV);
+
+ plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL);
+ if (!plat)
+ return ERR_PTR(-ENOMEM);
+
+ of_property_read_u32(np, "keypad,num-columns", &cols);
+ of_property_read_u32(np, "keypad,num-rows", &rows);
+ plat->kcol = (u8) cols;
+ plat->krow = (u8) rows;
+ if (!plat->krow || !plat->kcol ||
+ plat->krow > TC_KPD_ROWS || plat->kcol > TC_KPD_COLUMNS) {
+ dev_err(dev,
+ "keypad columns/rows not properly specified (%ux%u)\n",
+ plat->kcol, plat->krow);
+ return ERR_PTR(-EINVAL);
+ }
+
+ if (!of_get_property(np, "linux,keymap", &proplen)) {
+ dev_err(dev, "property linux,keymap not found\n");
+ return ERR_PTR(-ENOENT);
+ }
+
+ plat->no_autorepeat = of_property_read_bool(np, "linux,no-autorepeat");
+ plat->enable_wakeup = of_property_read_bool(np, "linux,wakeup");
+
+ /* The custom delay format is ms/16 */
+ of_property_read_u32(np, "debounce-delay-ms", &debounce_ms);
+ if (debounce_ms)
+ plat->debounce_period = debounce_ms * 16;
+ else
+ plat->debounce_period = TC_KPD_DEBOUNCE_PERIOD;
+
+ plat->settle_time = TC_KPD_SETTLE_TIME;
+ /* FIXME: should be property of the IRQ resource? */
+ plat->irqtype = IRQF_TRIGGER_FALLING;
+
+ return plat;
+}
+#else
+static inline const struct tc3589x_keypad_platform_data *
+tc3589x_keypad_of_probe(struct device *dev)
+{
+ return ERR_PTR(-ENODEV);
+}
+#endif
+
+
static int tc3589x_keypad_probe(struct platform_device *pdev)
{
struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent);
@@ -307,8 +366,11 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
plat = tc3589x->pdata->keypad;
if (!plat) {
- dev_err(&pdev->dev, "invalid keypad platform data\n");
- return -EINVAL;
+ plat = tc3589x_keypad_of_probe(&pdev->dev);
+ if (IS_ERR(plat)) {
+ dev_err(&pdev->dev, "invalid keypad platform data\n");
+ return PTR_ERR(plat);
+ }
}
irq = platform_get_irq(pdev, 0);
--
1.8.4.2
^ permalink raw reply related
* Re: [PATCH 2/3 RESEND] mfd: tc3589x: Reform device tree probing
From: Lee Jones @ 2014-01-23 13:31 UTC (permalink / raw)
To: Linus Walleij
Cc: devicetree, Dmitry Torokhov, linux-input, Samuel Ortiz,
linux-kernel, linux-arm-kernel, Mark Rutland
In-Reply-To: <1390481008-23900-1-git-send-email-linus.walleij@linaro.org>
> This changes the following mechanisms in the TC3589x device tree
> probing path:
>
> - Use the .of_match_table in struct device_driver to match the
> device in the device tree.
> - Add matches for the proper compatible strings "toshiba,..."
> and all sub-variants, just as is done for the .id matches.
> - Move over all the allocation of platform data etc to the
> tc3589x_of_probe() function and follow the pattern of passing
> a platform data pointer back, or an error pointer on error,
> as found in the STMPE driver.
> - Match the new (proper) compatible strings for the GPIO and
> keypad MFD cells.
> - Use of_device_is_compatible() rather than just !strcmp()
> to discover which cells to instantiate.
>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> drivers/mfd/tc3589x.c | 84 ++++++++++++++++++++++++++++++++++++---------------
> 1 file changed, 59 insertions(+), 25 deletions(-)
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?
Acked-by: Lee Jones <lee.jones@linaro.org>
--
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 v4 1/2] input/uinput: replace breaks by goto out in uinput_ioctl_handler
From: David Herrmann @ 2014-01-23 14:35 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Benjamin Tissoires, Dmitry Torokhov, Peter Hutterer,
open list:HID CORE LAYER, linux-kernel
In-Reply-To: <1390411440-1158-1-git-send-email-benjamin.tissoires@redhat.com>
Hi Benjamin
On Wed, Jan 22, 2014 at 6:23 PM, Benjamin Tissoires
<benjamin.tissoires@redhat.com> wrote:
> From: Benjamin Tisssoires <benjamin.tissoires@redhat.com>
>
> The current implementation prevents us to add variable-length ioctl.
> Use a bunch of gotos instead of break to allow us to do so.
>
> No functional changes.
Looks good.
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Thanks
David
> Signed-off-by: Benjamin Tisssoires <benjamin.tissoires@redhat.com>
> ---
>
> changes since v3:
> - brand new patch :)
>
> drivers/input/misc/uinput.c | 56 ++++++++++++++++++++++-----------------------
> 1 file changed, 27 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
> index 7728359..d8ae08d 100644
> --- a/drivers/input/misc/uinput.c
> +++ b/drivers/input/misc/uinput.c
> @@ -693,51 +693,51 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
> switch (cmd) {
> case UI_DEV_CREATE:
> retval = uinput_create_device(udev);
> - break;
> + goto out;
>
> case UI_DEV_DESTROY:
> uinput_destroy_device(udev);
> - break;
> + goto out;
>
> case UI_SET_EVBIT:
> retval = uinput_set_bit(arg, evbit, EV_MAX);
> - break;
> + goto out;
>
> case UI_SET_KEYBIT:
> retval = uinput_set_bit(arg, keybit, KEY_MAX);
> - break;
> + goto out;
>
> case UI_SET_RELBIT:
> retval = uinput_set_bit(arg, relbit, REL_MAX);
> - break;
> + goto out;
>
> case UI_SET_ABSBIT:
> retval = uinput_set_bit(arg, absbit, ABS_MAX);
> - break;
> + goto out;
>
> case UI_SET_MSCBIT:
> retval = uinput_set_bit(arg, mscbit, MSC_MAX);
> - break;
> + goto out;
>
> case UI_SET_LEDBIT:
> retval = uinput_set_bit(arg, ledbit, LED_MAX);
> - break;
> + goto out;
>
> case UI_SET_SNDBIT:
> retval = uinput_set_bit(arg, sndbit, SND_MAX);
> - break;
> + goto out;
>
> case UI_SET_FFBIT:
> retval = uinput_set_bit(arg, ffbit, FF_MAX);
> - break;
> + goto out;
>
> case UI_SET_SWBIT:
> retval = uinput_set_bit(arg, swbit, SW_MAX);
> - break;
> + goto out;
>
> case UI_SET_PROPBIT:
> retval = uinput_set_bit(arg, propbit, INPUT_PROP_MAX);
> - break;
> + goto out;
>
> case UI_SET_PHYS:
> if (udev->state == UIST_CREATED) {
> @@ -753,18 +753,18 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
>
> kfree(udev->dev->phys);
> udev->dev->phys = phys;
> - break;
> + goto out;
>
> case UI_BEGIN_FF_UPLOAD:
> retval = uinput_ff_upload_from_user(p, &ff_up);
> if (retval)
> - break;
> + goto out;
>
> req = uinput_request_find(udev, ff_up.request_id);
> if (!req || req->code != UI_FF_UPLOAD ||
> !req->u.upload.effect) {
> retval = -EINVAL;
> - break;
> + goto out;
> }
>
> ff_up.retval = 0;
> @@ -775,65 +775,63 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
> memset(&ff_up.old, 0, sizeof(struct ff_effect));
>
> retval = uinput_ff_upload_to_user(p, &ff_up);
> - break;
> + goto out;
>
> case UI_BEGIN_FF_ERASE:
> if (copy_from_user(&ff_erase, p, sizeof(ff_erase))) {
> retval = -EFAULT;
> - break;
> + goto out;
> }
>
> req = uinput_request_find(udev, ff_erase.request_id);
> if (!req || req->code != UI_FF_ERASE) {
> retval = -EINVAL;
> - break;
> + goto out;
> }
>
> ff_erase.retval = 0;
> ff_erase.effect_id = req->u.effect_id;
> if (copy_to_user(p, &ff_erase, sizeof(ff_erase))) {
> retval = -EFAULT;
> - break;
> + goto out;
> }
>
> - break;
> + goto out;
>
> case UI_END_FF_UPLOAD:
> retval = uinput_ff_upload_from_user(p, &ff_up);
> if (retval)
> - break;
> + goto out;
>
> req = uinput_request_find(udev, ff_up.request_id);
> if (!req || req->code != UI_FF_UPLOAD ||
> !req->u.upload.effect) {
> retval = -EINVAL;
> - break;
> + goto out;
> }
>
> req->retval = ff_up.retval;
> uinput_request_done(udev, req);
> - break;
> + goto out;
>
> case UI_END_FF_ERASE:
> if (copy_from_user(&ff_erase, p, sizeof(ff_erase))) {
> retval = -EFAULT;
> - break;
> + goto out;
> }
>
> req = uinput_request_find(udev, ff_erase.request_id);
> if (!req || req->code != UI_FF_ERASE) {
> retval = -EINVAL;
> - break;
> + goto out;
> }
>
> req->retval = ff_erase.retval;
> uinput_request_done(udev, req);
> - break;
> -
> - default:
> - retval = -EINVAL;
> + goto out;
> }
>
> + retval = -EINVAL;
> out:
> mutex_unlock(&udev->mutex);
> return retval;
> --
> 1.8.4.2
>
^ permalink raw reply
* Re: [PATCH v4 2/2] input/uinput: add UI_GET_SYSNAME ioctl to retrieve the sysfs path
From: David Herrmann @ 2014-01-23 14:37 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Benjamin Tissoires, Dmitry Torokhov, Peter Hutterer,
open list:HID CORE LAYER, linux-kernel
In-Reply-To: <1390411440-1158-2-git-send-email-benjamin.tissoires@redhat.com>
Hi Benjamin
On Wed, Jan 22, 2014 at 6:24 PM, Benjamin Tissoires
<benjamin.tissoires@redhat.com> wrote:
> uinput is used in the xorg-integration-tests suite and in the wayland
> test suite. These automated tests suites create many virtual input
> devices and then hook something to read these newly created devices.
>
> Currently, uinput does not provide the created input device, which means
> that we rely on an heuristic to guess which input node was created.
> The problem is that is heuristic is subjected to races between different
> uinput devices or even with physical devices. Having a way to retrieve
> the sysfs path allows us to find without any doubts the event node.
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
>
> Hi guys,
>
> a new version of this patch with a brand new commit message.
> Happy reviewing :)
>
> changes since v3:
> - new commit message (I hope it will be better now)
> - removed the -EAGAIN stuff thanks to the previous patch (not in v3)
> - used "put_user(0, (char *)dest + len - 1);" instead of "copy_to_user(dest + len - 1, "\0", 1);"
> - check if maxlen == 0
>
> changes since v2:
> - the ioctl returns only the device name, thus I renamed the ioctl to UI_GET_SYSNAME
> - reordered uinput_str_to_user() arguments
> - be sure to terminate the user string we send by \0
> - abort if udev->state is not UIST_CREATED
> - dropped the patch 1/2 (adding resolution to uinput) because I think David has
> already it in one of his queues (ABS2 IIRC)
>
> The corresponding libevdev patch is still here:
> http://lists.freedesktop.org/archives/input-tools/2014-January/000757.html
>
> Cheers,
> Benjamin
>
> drivers/input/misc/uinput.c | 42 ++++++++++++++++++++++++++++++++++++++++++
> include/linux/uinput.h | 2 ++
> include/uapi/linux/uinput.h | 13 ++++++++++++-
> 3 files changed, 56 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
> index d8ae08d..b51269f 100644
> --- a/drivers/input/misc/uinput.c
> +++ b/drivers/input/misc/uinput.c
> @@ -20,6 +20,8 @@
> * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
> *
> * Changes/Revisions:
> + * 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>)
> + * - add UI_GET_SYSNAME ioctl
> * 0.3 09/04/2006 (Anssi Hannula <anssi.hannula@gmail.com>)
> * - updated ff support for the changes in kernel interface
> * - added MODULE_VERSION
> @@ -670,6 +672,30 @@ static int uinput_ff_upload_from_user(const char __user *buffer,
> __ret; \
> })
>
> +static int uinput_str_to_user(void __user *dest, const char *str,
> + unsigned int maxlen)
> +{
> + int len, ret;
> +
> + if (!str)
> + return -ENOENT;
> +
> + if (maxlen == 0)
> + return -EINVAL;
> +
> + len = strlen(str) + 1;
> + if (len > maxlen)
> + len = maxlen;
> +
> + ret = copy_to_user(dest, str, len);
Technically you could use "len - 1" here, but it's fine.
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Thanks
David
> + if (ret)
> + return -EFAULT;
> +
> + /* force terminating '\0' */
> + ret = put_user(0, (char *)dest + len - 1);
> + return ret ? -EFAULT : len;
> +}
> +
> static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
> unsigned long arg, void __user *p)
> {
> @@ -679,6 +705,8 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
> struct uinput_ff_erase ff_erase;
> struct uinput_request *req;
> char *phys;
> + const char *name;
> + unsigned int size;
>
> retval = mutex_lock_interruptible(&udev->mutex);
> if (retval)
> @@ -831,6 +859,20 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
> goto out;
> }
>
> + size = _IOC_SIZE(cmd);
> +
> + /* Now check variable-length commands */
> + switch (cmd & ~IOCSIZE_MASK) {
> + case UI_GET_SYSNAME(0):
> + if (udev->state != UIST_CREATED) {
> + retval = -ENOENT;
> + goto out;
> + }
> + name = dev_name(&udev->dev->dev);
> + retval = uinput_str_to_user(p, name, size);
> + goto out;
> + }
> +
> retval = -EINVAL;
> out:
> mutex_unlock(&udev->mutex);
> diff --git a/include/linux/uinput.h b/include/linux/uinput.h
> index 0a4487d..0994c0d 100644
> --- a/include/linux/uinput.h
> +++ b/include/linux/uinput.h
> @@ -20,6 +20,8 @@
> * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
> *
> * Changes/Revisions:
> + * 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>)
> + * - add UI_GET_SYSNAME ioctl
> * 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
> * - update ff support for the changes in kernel interface
> * - add UINPUT_VERSION
> diff --git a/include/uapi/linux/uinput.h b/include/uapi/linux/uinput.h
> index fe46431..0389b48 100644
> --- a/include/uapi/linux/uinput.h
> +++ b/include/uapi/linux/uinput.h
> @@ -20,6 +20,8 @@
> * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
> *
> * Changes/Revisions:
> + * 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>)
> + * - add UI_GET_SYSNAME ioctl
> * 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
> * - update ff support for the changes in kernel interface
> * - add UINPUT_VERSION
> @@ -35,7 +37,7 @@
> #include <linux/types.h>
> #include <linux/input.h>
>
> -#define UINPUT_VERSION 3
> +#define UINPUT_VERSION 4
>
>
> struct uinput_ff_upload {
> @@ -73,6 +75,15 @@ struct uinput_ff_erase {
> #define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase)
> #define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase)
>
> +/**
> + * UI_GET_SYSNAME - get the sysfs name of the created uinput device
> + *
> + * @return the sysfs name of the created virtual input device.
> + * The complete sysfs path is then /sys/devices/virtual/input/--NAME--
> + * Usually, it is in the form "inputN"
> + */
> +#define UI_GET_SYSNAME(len) _IOC(_IOC_READ, UINPUT_IOCTL_BASE, 300, len)
> +
> /*
> * To write a force-feedback-capable driver, the upload_effect
> * and erase_effect callbacks in input_dev must be implemented.
> --
> 1.8.4.2
>
^ permalink raw reply
* Re: [PATCH] Input: add short note about ABS_MISC+<n> axes
From: David Herrmann @ 2014-01-23 14:39 UTC (permalink / raw)
To: open list:HID CORE LAYER
Cc: Jiri Kosina, Dmitry Torokhov, Benjamin Tissoires, David Herrmann
In-Reply-To: <1387207386-4601-1-git-send-email-dh.herrmann@gmail.com>
Hi Dmitry
ping?
David
On Mon, Dec 16, 2013 at 4:23 PM, David Herrmann <dh.herrmann@gmail.com> wrote:
> We must not reassign those axes or we will break backwards-compat. Add a
> small note for that so we don't accidentally some day reuse these.
>
> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
> ---
> include/uapi/linux/input.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
> index a372627..da1125e 100644
> --- a/include/uapi/linux/input.h
> +++ b/include/uapi/linux/input.h
> @@ -816,6 +816,10 @@ struct input_keymap_entry {
>
> #define ABS_MISC 0x28
>
> +/* ABS_MISC+x is used by HID to assign to unknown axes. Note that they used to
> + * flow over into the MT definitions. For backwards-compatibility, we must
> + * not reassign [0x29-0x2e] */
> +
> #define ABS_MT_SLOT 0x2f /* MT slot being modified */
> #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
> #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
> --
> 1.8.5.1
>
^ 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
* 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
* [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
* [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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
* 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
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox