* Re: [PATCH v2] HID: kye: Add report fixup for Genius Gx Imperator Keyboard
From: Jiri Kosina @ 2013-07-15 8:27 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Benjamin Tissoires, Honza Brazdil, linux-input, linux-kernel
In-Reply-To: <1373875938-10165-1-git-send-email-benjamin.tissoires@redhat.com>
On Mon, 15 Jul 2013, Benjamin Tissoires wrote:
> Genius Gx Imperator Keyboard presents the same problem in its report
> descriptors than Genius Gila Gaming Mouse.
> Use the same fixup for both.
>
> Fixes:
> https://bugzilla.redhat.com/show_bug.cgi?id=928561
>
> Reported-and-tested-by: Honza Brazdil <jbrazdil@redhat.com>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
>
> with the proper blacklist in hid-core this time.
Applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* [PATCH v2] HID: kye: Add report fixup for Genius Gx Imperator Keyboard
From: Benjamin Tissoires @ 2013-07-15 8:12 UTC (permalink / raw)
To: Benjamin Tissoires, Jiri Kosina, Honza Brazdil, linux-input,
linux-kernel
Genius Gx Imperator Keyboard presents the same problem in its report
descriptors than Genius Gila Gaming Mouse.
Use the same fixup for both.
Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=928561
Reported-and-tested-by: Honza Brazdil <jbrazdil@redhat.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
with the proper blacklist in hid-core this time.
Cheers,
Benjamin
drivers/hid/hid-core.c | 1 +
drivers/hid/hid-ids.h | 1 +
drivers/hid/hid-kye.c | 45 ++++++++++++++++++++++++++++-----------------
3 files changed, 30 insertions(+), 17 deletions(-)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 8de5cb8..b0f2f45 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1594,6 +1594,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GX_IMPERATOR) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index c5aea29..0288531 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -479,6 +479,7 @@
#define USB_VENDOR_ID_KYE 0x0458
#define USB_DEVICE_ID_KYE_ERGO_525V 0x0087
#define USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE 0x0138
+#define USB_DEVICE_ID_GENIUS_GX_IMPERATOR 0x4018
#define USB_DEVICE_ID_KYE_GPEN_560 0x5003
#define USB_DEVICE_ID_KYE_EASYPEN_I405X 0x5010
#define USB_DEVICE_ID_KYE_MOUSEPEN_I608X 0x5011
diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c
index 1e2ee2aa..7384512 100644
--- a/drivers/hid/hid-kye.c
+++ b/drivers/hid/hid-kye.c
@@ -268,6 +268,26 @@ static __u8 easypen_m610x_rdesc_fixed[] = {
0xC0 /* End Collection */
};
+static __u8 *kye_consumer_control_fixup(struct hid_device *hdev, __u8 *rdesc,
+ unsigned int *rsize, int offset, const char *device_name) {
+ /*
+ * the fixup that need to be done:
+ * - change Usage Maximum in the Comsumer Control
+ * (report ID 3) to a reasonable value
+ */
+ if (*rsize >= offset + 31 &&
+ /* Usage Page (Consumer Devices) */
+ rdesc[offset] == 0x05 && rdesc[offset + 1] == 0x0c &&
+ /* Usage (Consumer Control) */
+ rdesc[offset + 2] == 0x09 && rdesc[offset + 3] == 0x01 &&
+ /* Usage Maximum > 12287 */
+ rdesc[offset + 10] == 0x2a && rdesc[offset + 12] > 0x2f) {
+ hid_info(hdev, "fixing up %s report descriptor\n", device_name);
+ rdesc[offset + 12] = 0x2f;
+ }
+ return rdesc;
+}
+
static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize)
{
@@ -315,23 +335,12 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
}
break;
case USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE:
- /*
- * the fixup that need to be done:
- * - change Usage Maximum in the Comsumer Control
- * (report ID 3) to a reasonable value
- */
- if (*rsize >= 135 &&
- /* Usage Page (Consumer Devices) */
- rdesc[104] == 0x05 && rdesc[105] == 0x0c &&
- /* Usage (Consumer Control) */
- rdesc[106] == 0x09 && rdesc[107] == 0x01 &&
- /* Usage Maximum > 12287 */
- rdesc[114] == 0x2a && rdesc[116] > 0x2f) {
- hid_info(hdev,
- "fixing up Genius Gila Gaming Mouse "
- "report descriptor\n");
- rdesc[116] = 0x2f;
- }
+ rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104,
+ "Genius Gila Gaming Mouse");
+ break;
+ case USB_DEVICE_ID_GENIUS_GX_IMPERATOR:
+ rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 83,
+ "Genius Gx Imperator Keyboard");
break;
}
return rdesc;
@@ -428,6 +437,8 @@ static const struct hid_device_id kye_devices[] = {
USB_DEVICE_ID_KYE_EASYPEN_M610X) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE,
USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
+ USB_DEVICE_ID_GENIUS_GX_IMPERATOR) },
{ }
};
MODULE_DEVICE_TABLE(hid, kye_devices);
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] HID: kye: Add report fixup for Genius Gx Imperator Keyboard
From: Benjamin Tissoires @ 2013-07-15 7:53 UTC (permalink / raw)
To: Jiri Kosina; +Cc: Benjamin Tissoires, Honza Brazdil, linux-input, linux-kernel
In-Reply-To: <alpine.LNX.2.00.1307142313220.29788@pobox.suse.cz>
On 07/14/2013 11:14 PM, Jiri Kosina wrote:
> On Fri, 12 Jul 2013, Benjamin Tissoires wrote:
>
>> Genius Gx Imperator Keyboard presents the same problem in its report
>> descriptors than Genius Gila Gaming Mouse.
>> Use the same fixup for both.
>>
>> Fixes:
>> https://bugzilla.redhat.com/show_bug.cgi?id=928561
>>
>> Reported-and-tested-by: Honza Brazdil <jbrazdil@redhat.com>
>> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
>> ---
>
> Hi Benjamin,
>
> I guess you are missing update of hid_have_special_driver[] list?
>
Oops, thanks for spotting this. I will send a v2 ASAP.
Cheers,
Benjamin
^ permalink raw reply
* [PATCH 1/1] MAINTAINERS: Change maintainer for cyttsp driver
From: Javier Martinez Canillas @ 2013-07-14 21:41 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Henrik Rydberg, Ferruh Yigit, ttdrivers, linux-input,
linux-kernel, Javier Martinez Canillas
I haven't had time to work on this driver for a long time and
Ferruh has been doing a great job making it more generic,
adding support for new hardware and providing bug fixes.
So, let's make MAINTAINERS reflect reality and add him as the
cyttsp maintainer instead of me.
Also, since Ferruh works for Cypress, we may change the driver
status from Maintained to Supported.
Signed-off-by: Javier Martinez Canillas <javier@dowhile0.org>
---
Ferruh, please send your ack if you are willing to take over
maintainance of this driver.
Also, please confirm that you have been working on behalf of
Cypress instead of doing it on your free time. Otherwise we
should keep the driver status to maintained instead supported.
Thanks a lot and best regards,
Javier
MAINTAINERS | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 9d771d9..4ba996c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2458,9 +2458,9 @@ S: Maintained
F: drivers/media/common/cypress_firmware*
CYTTSP TOUCHSCREEN DRIVER
-M: Javier Martinez Canillas <javier@dowhile0.org>
+M: Ferruh Yigit <fery@cypress.com>
L: linux-input@vger.kernel.org
-S: Maintained
+S: Supported
F: drivers/input/touchscreen/cyttsp*
F: include/linux/input/cyttsp.h
--
1.7.7.6
^ permalink raw reply related
* [PATCH 1/1] MAINTAINERS: Change maintainer for cyttsp driver
From: Javier Martinez Canillas @ 2013-07-14 21:41 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Henrik Rydberg, Ferruh Yigit, ttdrivers, linux-input,
linux-kernel, Javier Martinez Canillas
In-Reply-To: <1373838082-12372-1-git-send-email-javier@dowhile0.org>
I haven't had time to work on this driver for a long time and
Ferruh has been doing a great job making it more generic,
adding support for new hardware and providing bug fixes.
So, let's make MAINTAINERS reflect reality and add him as the
cyttsp maintainer instead of me.
Also, since Ferruh works for Cypress, we may change the driver
status from Maintained to Supported.
Signed-off-by: Javier Martinez Canillas <javier@dowhile0.org>
---
Ferruh, please send your ack if you are willing to take over
maintainance of this driver.
Also, please confirm that you have been working on behalf of
Cypress instead of doing it on your free time. Otherwise we
should keep the driver status to maintained instead supported.
Thanks a lot and best regards,
Javier
MAINTAINERS | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 9d771d9..4ba996c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2458,9 +2458,9 @@ S: Maintained
F: drivers/media/common/cypress_firmware*
CYTTSP TOUCHSCREEN DRIVER
-M: Javier Martinez Canillas <javier@dowhile0.org>
+M: Ferruh Yigit <fery@cypress.com>
L: linux-input@vger.kernel.org
-S: Maintained
+S: Supported
F: drivers/input/touchscreen/cyttsp*
F: include/linux/input/cyttsp.h
--
1.7.7.6
^ permalink raw reply related
* Re: [PATCH] HID: kye: Add report fixup for Genius Gx Imperator Keyboard
From: Jiri Kosina @ 2013-07-14 21:14 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Benjamin Tissoires, Honza Brazdil, linux-input, linux-kernel
In-Reply-To: <1373633613-4947-1-git-send-email-benjamin.tissoires@redhat.com>
On Fri, 12 Jul 2013, Benjamin Tissoires wrote:
> Genius Gx Imperator Keyboard presents the same problem in its report
> descriptors than Genius Gila Gaming Mouse.
> Use the same fixup for both.
>
> Fixes:
> https://bugzilla.redhat.com/show_bug.cgi?id=928561
>
> Reported-and-tested-by: Honza Brazdil <jbrazdil@redhat.com>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
>
> Hi Jiri,
>
> I have been reported this broken Genius device too.
> The patch applies on top of the branch for-3.11/upstream, but feel free to
> schedule it for 3.11 or 3.12. This time, only the multimedia (and macros) keys
> are broken. The core keyboard part is working fine without the patch.
>
> Cheers,
> Benjamin
>
> drivers/hid/hid-ids.h | 1 +
> drivers/hid/hid-kye.c | 45 ++++++++++++++++++++++++++++-----------------
> 2 files changed, 29 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index b2b692e..1f28df9 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -475,6 +475,7 @@
> #define USB_VENDOR_ID_KYE 0x0458
> #define USB_DEVICE_ID_KYE_ERGO_525V 0x0087
> #define USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE 0x0138
> +#define USB_DEVICE_ID_GENIUS_GX_IMPERATOR 0x4018
> #define USB_DEVICE_ID_KYE_GPEN_560 0x5003
> #define USB_DEVICE_ID_KYE_EASYPEN_I405X 0x5010
> #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X 0x5011
> diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c
> index 1e2ee2aa..7384512 100644
> --- a/drivers/hid/hid-kye.c
> +++ b/drivers/hid/hid-kye.c
> @@ -268,6 +268,26 @@ static __u8 easypen_m610x_rdesc_fixed[] = {
> 0xC0 /* End Collection */
> };
>
> +static __u8 *kye_consumer_control_fixup(struct hid_device *hdev, __u8 *rdesc,
> + unsigned int *rsize, int offset, const char *device_name) {
> + /*
> + * the fixup that need to be done:
> + * - change Usage Maximum in the Comsumer Control
> + * (report ID 3) to a reasonable value
> + */
> + if (*rsize >= offset + 31 &&
> + /* Usage Page (Consumer Devices) */
> + rdesc[offset] == 0x05 && rdesc[offset + 1] == 0x0c &&
> + /* Usage (Consumer Control) */
> + rdesc[offset + 2] == 0x09 && rdesc[offset + 3] == 0x01 &&
> + /* Usage Maximum > 12287 */
> + rdesc[offset + 10] == 0x2a && rdesc[offset + 12] > 0x2f) {
> + hid_info(hdev, "fixing up %s report descriptor\n", device_name);
> + rdesc[offset + 12] = 0x2f;
> + }
> + return rdesc;
> +}
> +
> static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
> unsigned int *rsize)
> {
> @@ -315,23 +335,12 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
> }
> break;
> case USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE:
> - /*
> - * the fixup that need to be done:
> - * - change Usage Maximum in the Comsumer Control
> - * (report ID 3) to a reasonable value
> - */
> - if (*rsize >= 135 &&
> - /* Usage Page (Consumer Devices) */
> - rdesc[104] == 0x05 && rdesc[105] == 0x0c &&
> - /* Usage (Consumer Control) */
> - rdesc[106] == 0x09 && rdesc[107] == 0x01 &&
> - /* Usage Maximum > 12287 */
> - rdesc[114] == 0x2a && rdesc[116] > 0x2f) {
> - hid_info(hdev,
> - "fixing up Genius Gila Gaming Mouse "
> - "report descriptor\n");
> - rdesc[116] = 0x2f;
> - }
> + rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104,
> + "Genius Gila Gaming Mouse");
> + break;
> + case USB_DEVICE_ID_GENIUS_GX_IMPERATOR:
> + rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 83,
> + "Genius Gx Imperator Keyboard");
> break;
> }
> return rdesc;
> @@ -428,6 +437,8 @@ static const struct hid_device_id kye_devices[] = {
> USB_DEVICE_ID_KYE_EASYPEN_M610X) },
> { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
> USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) },
> + { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
> + USB_DEVICE_ID_GENIUS_GX_IMPERATOR) },
> { }
> };
Hi Benjamin,
I guess you are missing update of hid_have_special_driver[] list?
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH 00/50] USB: cleanup spin_lock in URB->complete()
From: Ming Lei @ 2013-07-14 14:33 UTC (permalink / raw)
To: Andy Walls
Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
linux-input, linux-bluetooth, netdev, linux-wireless, linux-media,
alsa-devel, linux-kernel
In-Reply-To: <1373807844.4998.10.camel@palomino.walls.org>
On Sun, Jul 14, 2013 at 9:17 PM, Andy Walls <awalls@md.metrocast.net> wrote:
> On Thu, 2013-07-11 at 17:05 +0800, Ming Lei wrote:
>> Hi,
>>
>> As we are going to run URB->complete() in tasklet context[1][2],
>
> Hi,
>
> Please pardon my naivete, but why was it decided to use tasklets to
> defer work, as opposed to some other deferred work mechanism?
>
> It seems to me that getting rid of tasklets has been an objective for
> years:
>
> http://lwn.net/Articles/239633/
> http://lwn.net/Articles/520076/
> http://lwn.net/Articles/240054/
We discussed the problem in the below link previously[1], Steven
and Thomas suggested to use threaded irq handler, but which
may degrade USB mass storage performance, so we have to
take tasklet now until we rewrite transport part of USB mass storage
driver.
Also the conversion[2] has avoided the tasklet spin lock problem
already.
[1], http://marc.info/?t=137079119200001&r=1&w=2
[2], http://marc.info/?l=linux-usb&m=137286326726326&w=2
Thanks,
--
Ming Lei
^ permalink raw reply
* Re: [PATCH 00/50] USB: cleanup spin_lock in URB->complete()
From: Andy Walls @ 2013-07-14 13:17 UTC (permalink / raw)
To: Ming Lei
Cc: Greg Kroah-Hartman, linux-usb, Oliver Neukum, Alan Stern,
linux-input, linux-bluetooth, netdev, linux-wireless, linux-media,
alsa-devel, linux-kernel
In-Reply-To: <1373533573-12272-1-git-send-email-ming.lei@canonical.com>
On Thu, 2013-07-11 at 17:05 +0800, Ming Lei wrote:
> Hi,
>
> As we are going to run URB->complete() in tasklet context[1][2],
Hi,
Please pardon my naivete, but why was it decided to use tasklets to
defer work, as opposed to some other deferred work mechanism?
It seems to me that getting rid of tasklets has been an objective for
years:
http://lwn.net/Articles/239633/
http://lwn.net/Articles/520076/
http://lwn.net/Articles/240054/
Regards,
Andy
> and
> hard interrupt may be enabled when running URB completion handler[3],
> so we might need to disable interrupt when acquiring one lock in
> the completion handler for the below reasons:
>
> - URB->complete() holds a subsystem wide lock which may be acquired
> in another hard irq context, and the subsystem wide lock is acquired
> by spin_lock()/read_lock()/write_lock() in complete()
>
> - URB->complete() holds a private lock with spin_lock()/read_lock()/write_lock()
> but driver may export APIs to make other drivers acquire the same private
> lock in its interrupt handler.
>
> For the sake of safety and making the change simple, this patch set
> converts all spin_lock()/read_lock()/write_lock() in completion handler
> path into their irqsave version mechanically.
>
> But if you are sure the above two cases do not happen in your driver,
> please let me know and I can drop the unnecessary change.
>
> Also if you find some conversions are missed, also please let me know so
> that I can add it in the next round.
>
>
> [1], http://marc.info/?l=linux-usb&m=137286322526312&w=2
> [2], http://marc.info/?l=linux-usb&m=137286326726326&w=2
> [3], http://marc.info/?l=linux-usb&m=137286330626363&w=2
>
[snip]
>
>
> Thanks,
> --
> Ming Lei
^ permalink raw reply
* Re: [PATCH v3] Input: sysrq - DT binding for key sequences
From: Dmitry Torokhov @ 2013-07-13 20:41 UTC (permalink / raw)
To: mathieu.poirier
Cc: grant.likely, devicetree-discuss, john.stultz, linux-input,
kernel-team
In-Reply-To: <1373622962-16534-1-git-send-email-mathieu.poirier@linaro.org>
Hi Matthieu,
On Fri, Jul 12, 2013 at 03:56:02AM -0600, mathieu.poirier@linaro.org wrote:
> +
> + np = of_find_node_by_path("/chosen");
> + if (!np)
> + goto out;
> +
> + np = of_find_node_by_name(np, "linux,sysrq-reset-seq");
> + if (!np) {
> + pr_debug("No sysrq node found");
> + goto out;
> + }
Can if be folded into:
np = of_find_node_by_path("/chosen/linux,sysrq-reset-seq")
?
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH v2 1/3] input: mc13783: Prepare driver to support MC13892 and OF
From: Dmitry Torokhov @ 2013-07-13 6:46 UTC (permalink / raw)
To: Alexander Shiyan
Cc: linux-arm-kernel, linux-input, Grant Likely, Rob Herring,
Sascha Hauer, Shawn Guo
In-Reply-To: <1373689551-24375-1-git-send-email-shc_work@mail.ru>
Hi Alexander,
On Sat, Jul 13, 2013 at 08:25:49AM +0400, Alexander Shiyan wrote:
> +
> + for (i = 0; i < MAX13XXX_NUM_BUTTONS; i++)
> + if (priv->enabled & BIT(i)) {
> + ret = mc13xxx_irq_request(priv->mc13xxx,
> + priv->devtype->btn_def[i].irq,
> + mc13xxx_pwrbutton_irq, NULL,
> + priv);
> + if (!ret)
> + continue;
I'd rather we continued requesting interrupts in probe() as opposed to
open(). I believe the driver should acquire all resources it needs when
binding, instead of later.
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH 001/001] [Input:] Propagate hardware generated event timestamp to evdev.
From: Dmitry Torokhov @ 2013-07-13 6:44 UTC (permalink / raw)
To: Alexander Levitskiy
Cc: linux-input, linux-kernel, linux-doc, Rob Landley, Henrik Rydberg,
Arve Hjønnevåg, Stephen Boyd
In-Reply-To: <CAJVTVr=rbkYHD93N4H9ANy1Hsivdd_XFLONXxOBp+TR9LfAyaQ@mail.gmail.com>
Hi Sasha,
On Wed, Jul 10, 2013 at 01:38:00PM -0700, Alexander Levitskiy wrote:
> From: Sasha Levitskiy <sanek@google.com>
>
> Input: Propagate hardware event timestamp to evdev.
>
> Convey hardware generated timestamp associated with the current event packet.
> The use of these event codes by hardware drivers is optional.
> Used to reduce jitter and improve velocity tracking in ABS_MT and other timing
> sensitive devices.
>
> kernel v. 3.4
>
> Signed-off-by: Sasha Levitskiy <sanek@google.com>
> ---
> diff --git a/Documentation/input/event-codes.txt
> b/Documentation/input/event-codes.txt
> index 53305bd..f0f0e07 100644
> --- a/Documentation/input/event-codes.txt
> +++ b/Documentation/input/event-codes.txt
> @@ -91,6 +91,15 @@ sent in the evdev event stream.
> event and query the device (using EVIOCG* ioctls) to obtain its
> current state.
>
> +* SYN_TIME_SEC, SYN_TIME_NSEC:
> + - Used to convey hardware timestamp associated with the current
> + event packet. The use of these event codes by hardware drivers
> + is optional. If used, the hardware driver should send the timestamp
> + ahead of any other events associated with this packet. The timestamp
> + should be adjusted to CLOCK_MONOTONIC base.
> + This becomes useful for drivers of hardware that handle batching
> + without involving the main CPU.
We already have MSC_TIMESTAMP (which is in usec), do you really need
nsec resolution?
> +
> EV_KEY:
> ----------
> EV_KEY events take the form KEY_<name> or BTN_<name>. For example,
> KEY_A is used
> diff --git a/Documentation/input/multi-touch-protocol.txt
> b/Documentation/input/multi-touch-protocol.txt
> index 543101c..71af317 100644
> --- a/Documentation/input/multi-touch-protocol.txt
> +++ b/Documentation/input/multi-touch-protocol.txt
> @@ -80,6 +80,10 @@ Userspace can detect that a driver can report more
> total contacts than slots
> by noting that the largest supported BTN_TOOL_*TAP event is larger than the
> total number of type B slots reported in the absinfo for the ABS_MT_SLOT axis.
>
> +Velocity tracking and temporal precision can be improved if device provides
> +exact timestamp for touches reported through SYN_TIME_SEC and SYN_TIME_NSEC.
> +The timestamp should be reported ahead of everything else in the packet.
> +
> Protocol Example A
> ------------------
>
> diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
> index 41f79be..48baf6f 100644
> --- a/drivers/input/evdev.c
> +++ b/drivers/input/evdev.c
> @@ -37,6 +37,8 @@ struct evdev {
> struct mutex mutex;
> struct device dev;
> bool exist;
> + int hw_ts_sec;
> + int hw_ts_nsec;
> };
>
> struct evdev_client {
> @@ -109,7 +111,20 @@ static void evdev_event(struct input_handle *handle,
> struct input_event event;
> ktime_t time_mono, time_real;
>
> - time_mono = ktime_get();
> + if (type == EV_SYN && code == SYN_TIME_SEC) {
> + evdev->hw_ts_sec = value;
> + return;
Why do you need this special handling? Can you simply have MSC_TIMESTAMP
to be delivered as part of the event packet and use it instead of the
event timestamp if userspace chooses to do so?
Thanks.
--
Dmitry
^ permalink raw reply
* [git pull] Input updates for 3.11-rc0
From: Dmitry Torokhov @ 2013-07-13 6:38 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, linux-input
[-- Attachment #1: Type: text/plain, Size: 1645 bytes --]
Hi Linus,
Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus
or
master.kernel.org:/pub/scm/linux/kernel/git/dtor/input.git for-linus
to receive 2nd round of updates for the input subsystem. You will get an
update to Elantech driver to support hardware v7, fix to the new cyttsp4
driver to use proper addressing, ads7846 git device tree support and
nspire-keypad got a small cleanup.
Changelog:
---------
Daniel Mack (1):
Input: ads7846 - add device tree bindings
Daniel Tang (1):
Input: nspire-keypad - replace magic offset with define
Dmitry Torokhov (1):
Input: ads7846 - make sure we do not change platform data
Ferruh Yigit (1):
Input: cyttsp4 - use 16bit address for I2C/SPI communication
Matteo Delfino (1):
Input: elantech - fix for newer hardware versions (v7)
Diffstat:
--------
.../devicetree/bindings/input/ads7846.txt | 91 +++++++++++++++
drivers/input/keyboard/nspire-keypad.c | 2 +-
drivers/input/mouse/elantech.c | 17 +--
drivers/input/touchscreen/ads7846.c | 123 ++++++++++++++++++---
drivers/input/touchscreen/cyttsp4_core.h | 12 +-
drivers/input/touchscreen/cyttsp4_spi.c | 20 ++--
drivers/input/touchscreen/cyttsp_core.h | 8 +-
drivers/input/touchscreen/cyttsp_i2c_common.c | 30 +++--
drivers/input/touchscreen/cyttsp_spi.c | 6 +-
9 files changed, 253 insertions(+), 56 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/ads7846.txt
--
Dmitry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* [PATCH v2 3/3] input: mc13783: Add DT probe support
From: Alexander Shiyan @ 2013-07-13 4:25 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-input, Grant Likely, Rob Herring, Sascha Hauer,
Dmitry Torokhov, Shawn Guo, Alexander Shiyan
In-Reply-To: <1373689551-24375-1-git-send-email-shc_work@mail.ru>
Patch adds DT support for MC13783/MC13892 PMICs.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
Documentation/devicetree/bindings/mfd/mc13xxx.txt | 13 +++++
drivers/input/misc/mc13783-pwrbutton.c | 59 ++++++++++++++++++-----
2 files changed, 59 insertions(+), 13 deletions(-)
diff --git a/Documentation/devicetree/bindings/mfd/mc13xxx.txt b/Documentation/devicetree/bindings/mfd/mc13xxx.txt
index abd9e3c..cf8b61c 100644
--- a/Documentation/devicetree/bindings/mfd/mc13xxx.txt
+++ b/Documentation/devicetree/bindings/mfd/mc13xxx.txt
@@ -10,6 +10,12 @@ Optional properties:
- fsl,mc13xxx-uses-touch : Indicate the touchscreen controller is being used
Sub-nodes:
+- buttons : Contain power button nodes. Each button should be declared as
+ "button@<num>" and contain code in "linux,code" property.
+ Optional properties:
+ active-high : Change active button level from 0 to 1.
+ enable-reset: Performs hadware reset through PMIC.
+ debounce : Debounce value which will be taken from PMIC datasheet.
- regulators : Contain the regulator nodes. The regulators are bound using
their names as listed below with their registers and bits for enabling.
@@ -89,6 +95,13 @@ ecspi@70010000 { /* ECSPI1 */
interrupt-parent = <&gpio0>;
interrupts = <8>;
+ buttons {
+ button@1 {
+ linux,code = <0x1f>;
+ debounce = <1>;
+ };
+ };
+
regulators {
sw1_reg: mc13892__sw1 {
regulator-min-microvolt = <600000>;
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
index 855d576..2040eb2 100644
--- a/drivers/input/misc/mc13783-pwrbutton.c
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -24,6 +24,7 @@
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/input.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/mfd/mc13783.h>
#include <linux/mfd/mc13892.h>
@@ -121,21 +122,28 @@ static int __init mc13xxx_pwrbutton_probe(struct platform_device *pdev)
struct mc13xxx *mc13xxx = dev_get_drvdata(pdev->dev.parent);
struct mc13xxx_pwrb_devtype *devtype =
(struct mc13xxx_pwrb_devtype *)pdev->id_entry->driver_data;
+ struct device_node *parent, *child;
struct mc13xxx_pwrb *priv;
int i, reg = 0, ret = -EINVAL;
- if (!pdata) {
+ of_node_get(pdev->dev.parent->of_node);
+ parent = of_find_node_by_name(pdev->dev.parent->of_node, "buttons");
+ if (!pdata && !parent) {
dev_err(&pdev->dev, "Missing platform data\n");
return -ENODEV;
}
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
- if (!priv)
- return -ENOMEM;
+ if (!priv) {
+ ret = -ENOMEM;
+ goto out_node_put;
+ }
priv->input = devm_input_allocate_device(&pdev->dev);
- if (!priv->input)
- return -ENOMEM;
+ if (!priv->input) {
+ ret = -ENOMEM;
+ goto out_node_put;
+ }
priv->mc13xxx = mc13xxx;
priv->devtype = devtype;
@@ -143,15 +151,36 @@ static int __init mc13xxx_pwrbutton_probe(struct platform_device *pdev)
for (i = 0; i < MAX13XXX_NUM_BUTTONS; i++) {
u16 code, invert, reset, debounce;
+ const __be32 *prop;
+ char childname[5];
- if (!(pdata->buttons[i].flags & MC13XXX_BUTTON_ENABLE))
- continue;
- code = pdata->buttons[i].keycode;
- invert = !!(pdata->buttons[i].flags &
- MC13XXX_BUTTON_POL_INVERT);
- reset = !!(pdata->buttons[i].flags &
- MC13XXX_BUTTON_RESET_EN);
- debounce = pdata->buttons[i].flags;
+ if (parent) {
+ sprintf(childname, "button@%i", i + 1);
+ child = of_get_child_by_name(parent, childname);
+ if (!child)
+ continue;
+ prop = of_get_property(child, "linux,code", NULL);
+ if (prop)
+ code = be32_to_cpu(*prop) & 0xffff;
+ else {
+ dev_err(&pdev->dev,
+ "Button %i: Missing key code\n", i + 1);
+ continue;
+ }
+ invert = of_property_read_bool(child, "active-high");
+ reset = of_property_read_bool(child, "enable-reset");
+ prop = of_get_property(child, "debounce", NULL);
+ debounce = prop ? be32_to_cpu(*prop) : 0;
+ } else {
+ if (!(pdata->buttons[i].flags & MC13XXX_BUTTON_ENABLE))
+ continue;
+ code = pdata->buttons[i].keycode;
+ invert = !!(pdata->buttons[i].flags &
+ MC13XXX_BUTTON_POL_INVERT);
+ reset = !!(pdata->buttons[i].flags &
+ MC13XXX_BUTTON_RESET_EN);
+ debounce = pdata->buttons[i].flags;
+ }
priv->btn_code[i] = code;
if (code != KEY_RESERVED)
@@ -186,6 +215,10 @@ static int __init mc13xxx_pwrbutton_probe(struct platform_device *pdev)
if (ret)
dev_err(&pdev->dev, "Can't register input device: %i\n", ret);
+out_node_put:
+ if (parent)
+ of_node_put(parent);
+
return ret;
}
--
1.8.1.5
^ permalink raw reply related
* [PATCH v2 2/3] input: mc13783: Add MC13892 support
From: Alexander Shiyan @ 2013-07-13 4:25 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-input, Grant Likely, Rob Herring, Sascha Hauer,
Dmitry Torokhov, Shawn Guo, Alexander Shiyan
In-Reply-To: <1373689551-24375-1-git-send-email-shc_work@mail.ru>
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
drivers/input/misc/Kconfig | 6 +++---
drivers/input/misc/mc13783-pwrbutton.c | 10 +++++++++-
include/linux/mfd/mc13892.h | 4 ++++
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 0b541cd..0d83653 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -167,10 +167,10 @@ config INPUT_MAX8997_HAPTIC
module will be called max8997-haptic.
config INPUT_MC13783_PWRBUTTON
- tristate "MC13783 ON buttons"
- depends on MFD_MC13783
+ tristate "MC13783/MC13892 ON buttons"
+ depends on MFD_MC13XXX
help
- Support the ON buttons of MC13783 PMIC as an input device
+ Support the ON buttons of MC13783/MC13892 PMIC as an input device
reporting power button status.
To compile this driver as a module, choose M here: the module
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
index 33613ca..855d576 100644
--- a/drivers/input/misc/mc13783-pwrbutton.c
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -26,6 +26,7 @@
#include <linux/input.h>
#include <linux/platform_device.h>
#include <linux/mfd/mc13783.h>
+#include <linux/mfd/mc13892.h>
struct mc13xxx_button_def {
unsigned int irq;
@@ -194,8 +195,15 @@ static const struct mc13xxx_pwrb_devtype mc13783_pwrb_devtype = {
.btn_def[2] = { MC13783_IRQ_ONOFD3, BIT(5) }
};
+static const struct mc13xxx_pwrb_devtype mc13892_pwrb_devtype = {
+ .btn_def[0] = { MC13892_IRQ_ONOFD1, BIT(3) },
+ .btn_def[1] = { MC13892_IRQ_ONOFD2, BIT(4) },
+ .btn_def[2] = { MC13892_IRQ_ONOFD3, BIT(2) }
+};
+
static const struct platform_device_id mc13xxx_pwrbutton_id_table[] = {
{ "mc13783-pwrbutton", (kernel_ulong_t)&mc13783_pwrb_devtype },
+ { "mc13892-pwrbutton", (kernel_ulong_t)&mc13892_pwrb_devtype },
{ }
};
MODULE_DEVICE_TABLE(platform, mc13xxx_pwrbutton_id_table);
@@ -209,6 +217,6 @@ static struct platform_driver mc13xxx_pwrbutton_driver = {
};
module_platform_driver_probe(mc13xxx_pwrbutton_driver, mc13xxx_pwrbutton_probe);
-MODULE_DESCRIPTION("MC13783 Power Button");
+MODULE_DESCRIPTION("MC13XXX Power Button");
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Philippe Retornaz");
diff --git a/include/linux/mfd/mc13892.h b/include/linux/mfd/mc13892.h
index a00f2be..bdc3baf 100644
--- a/include/linux/mfd/mc13892.h
+++ b/include/linux/mfd/mc13892.h
@@ -36,4 +36,8 @@
#define MC13892_PWGT2SPI 22
#define MC13892_VCOINCELL 23
+#define MC13892_IRQ_ONOFD3 26
+#define MC13892_IRQ_ONOFD1 27
+#define MC13892_IRQ_ONOFD2 28
+
#endif
--
1.8.1.5
^ permalink raw reply related
* [PATCH v2 1/3] input: mc13783: Prepare driver to support MC13892 and OF
From: Alexander Shiyan @ 2013-07-13 4:25 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-input, Grant Likely, Rob Herring, Sascha Hauer,
Dmitry Torokhov, Shawn Guo, Alexander Shiyan
This patch is a preparation mc13xxx powerbutton driver to support
MC13892 and support the probe through the DT.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
arch/arm/mach-imx/mach-mx31moboard.c | 9 +-
drivers/input/misc/mc13783-pwrbutton.c | 361 ++++++++++++++-------------------
include/linux/mfd/mc13xxx.h | 28 +--
3 files changed, 173 insertions(+), 225 deletions(-)
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index 6f424ec..2a8aa43 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -276,9 +276,12 @@ static struct mc13xxx_leds_platform_data moboard_leds = {
};
static struct mc13xxx_buttons_platform_data moboard_buttons = {
- .b1on_flags = MC13783_BUTTON_DBNC_750MS | MC13783_BUTTON_ENABLE |
- MC13783_BUTTON_POL_INVERT,
- .b1on_key = KEY_POWER,
+ .buttons[0] = {
+ .keycode = KEY_POWER,
+ .flags = MC13XXX_BUTTON_ENABLE |
+ MC13XXX_BUTTON_DBNC_750MS |
+ MC13XXX_BUTTON_POL_INVERT,
+ },
};
static struct mc13xxx_codec_platform_data moboard_codec = {
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
index d0277a7..33613ca 100644
--- a/drivers/input/misc/mc13783-pwrbutton.c
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -24,248 +24,191 @@
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/input.h>
-#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/mfd/mc13783.h>
-#include <linux/sched.h>
-#include <linux/slab.h>
-
-struct mc13783_pwrb {
- struct input_dev *pwr;
- struct mc13xxx *mc13783;
-#define MC13783_PWRB_B1_POL_INVERT (1 << 0)
-#define MC13783_PWRB_B2_POL_INVERT (1 << 1)
-#define MC13783_PWRB_B3_POL_INVERT (1 << 2)
- int flags;
- unsigned short keymap[3];
+
+struct mc13xxx_button_def {
+ unsigned int irq;
+ unsigned int sense_bit;
};
-#define MC13783_REG_INTERRUPT_SENSE_1 5
-#define MC13783_IRQSENSE1_ONOFD1S (1 << 3)
-#define MC13783_IRQSENSE1_ONOFD2S (1 << 4)
-#define MC13783_IRQSENSE1_ONOFD3S (1 << 5)
+struct mc13xxx_pwrb_devtype {
+ struct mc13xxx_button_def btn_def[MAX13XXX_NUM_BUTTONS];
+};
-#define MC13783_REG_POWER_CONTROL_2 15
-#define MC13783_POWER_CONTROL_2_ON1BDBNC 4
-#define MC13783_POWER_CONTROL_2_ON2BDBNC 6
-#define MC13783_POWER_CONTROL_2_ON3BDBNC 8
-#define MC13783_POWER_CONTROL_2_ON1BRSTEN (1 << 1)
-#define MC13783_POWER_CONTROL_2_ON2BRSTEN (1 << 2)
-#define MC13783_POWER_CONTROL_2_ON3BRSTEN (1 << 3)
+struct mc13xxx_pwrb {
+ struct mc13xxx_pwrb_devtype *devtype;
+ unsigned int enabled;
+ unsigned int inverted;
+ u16 btn_code[MAX13XXX_NUM_BUTTONS];
+ struct input_dev *input;
+ struct mc13xxx *mc13xxx;
+};
-static irqreturn_t button_irq(int irq, void *_priv)
-{
- struct mc13783_pwrb *priv = _priv;
- int val;
-
- mc13xxx_irq_ack(priv->mc13783, irq);
- mc13xxx_reg_read(priv->mc13783, MC13783_REG_INTERRUPT_SENSE_1, &val);
-
- switch (irq) {
- case MC13783_IRQ_ONOFD1:
- val = val & MC13783_IRQSENSE1_ONOFD1S ? 1 : 0;
- if (priv->flags & MC13783_PWRB_B1_POL_INVERT)
- val ^= 1;
- input_report_key(priv->pwr, priv->keymap[0], val);
- break;
-
- case MC13783_IRQ_ONOFD2:
- val = val & MC13783_IRQSENSE1_ONOFD2S ? 1 : 0;
- if (priv->flags & MC13783_PWRB_B2_POL_INVERT)
- val ^= 1;
- input_report_key(priv->pwr, priv->keymap[1], val);
- break;
-
- case MC13783_IRQ_ONOFD3:
- val = val & MC13783_IRQSENSE1_ONOFD3S ? 1 : 0;
- if (priv->flags & MC13783_PWRB_B3_POL_INVERT)
- val ^= 1;
- input_report_key(priv->pwr, priv->keymap[2], val);
- break;
- }
+#define MC13XXX_REG_INTERRUPT_SENSE_1 5
+#define MC13XXX_REG_POWER_CONTROL_2 15
- input_sync(priv->pwr);
+static irqreturn_t mc13xxx_pwrbutton_irq(int irq, void *data)
+{
+ struct mc13xxx_pwrb *priv = data;
+ unsigned int i, val;
+
+ mc13xxx_irq_ack(priv->mc13xxx, irq);
+ mc13xxx_reg_read(priv->mc13xxx, MC13XXX_REG_INTERRUPT_SENSE_1, &val);
+
+ for (i = 0; i < MAX13XXX_NUM_BUTTONS; i++)
+ if (irq == priv->devtype->btn_def[i].irq) {
+ val = !!(val & priv->devtype->btn_def[i].sense_bit);
+ if (priv->inverted & BIT(i))
+ val = !val;
+ input_report_key(priv->input, priv->btn_code[i], val);
+ input_sync(priv->input);
+ break;
+ }
return IRQ_HANDLED;
}
-static int mc13783_pwrbutton_probe(struct platform_device *pdev)
+static int mc13xxx_pwrbutton_open(struct input_dev *dev)
{
- const struct mc13xxx_buttons_platform_data *pdata;
- struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent);
- struct input_dev *pwr;
- struct mc13783_pwrb *priv;
- int err = 0;
- int reg = 0;
-
- pdata = dev_get_platdata(&pdev->dev);
- if (!pdata) {
- dev_err(&pdev->dev, "missing platform data\n");
- return -ENODEV;
- }
-
- pwr = input_allocate_device();
- if (!pwr) {
- dev_dbg(&pdev->dev, "Can't allocate power button\n");
- return -ENOMEM;
- }
-
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
- if (!priv) {
- err = -ENOMEM;
- dev_dbg(&pdev->dev, "Can't allocate power button\n");
- goto free_input_dev;
- }
-
- reg |= (pdata->b1on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON1BDBNC;
- reg |= (pdata->b2on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON2BDBNC;
- reg |= (pdata->b3on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON3BDBNC;
-
- priv->pwr = pwr;
- priv->mc13783 = mc13783;
-
- mc13xxx_lock(mc13783);
-
- if (pdata->b1on_flags & MC13783_BUTTON_ENABLE) {
- priv->keymap[0] = pdata->b1on_key;
- if (pdata->b1on_key != KEY_RESERVED)
- __set_bit(pdata->b1on_key, pwr->keybit);
-
- if (pdata->b1on_flags & MC13783_BUTTON_POL_INVERT)
- priv->flags |= MC13783_PWRB_B1_POL_INVERT;
-
- if (pdata->b1on_flags & MC13783_BUTTON_RESET_EN)
- reg |= MC13783_POWER_CONTROL_2_ON1BRSTEN;
-
- err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD1,
- button_irq, "b1on", priv);
- if (err) {
- dev_dbg(&pdev->dev, "Can't request irq\n");
- goto free_priv;
+ struct mc13xxx_pwrb *priv = input_get_drvdata(dev);
+ int i, ret = 0;
+
+ mc13xxx_lock(priv->mc13xxx);
+
+ for (i = 0; i < MAX13XXX_NUM_BUTTONS; i++)
+ if (priv->enabled & BIT(i)) {
+ ret = mc13xxx_irq_request(priv->mc13xxx,
+ priv->devtype->btn_def[i].irq,
+ mc13xxx_pwrbutton_irq, NULL,
+ priv);
+ if (!ret)
+ continue;
+
+ dev_err(&dev->dev, "Can't request IRQ: %i\n", ret);
+
+ while (--i >= 0)
+ if (priv->enabled & BIT(i))
+ mc13xxx_irq_free(priv->mc13xxx,
+ priv->devtype->btn_def[i].irq,
+ priv);
+ break;
}
- }
-
- if (pdata->b2on_flags & MC13783_BUTTON_ENABLE) {
- priv->keymap[1] = pdata->b2on_key;
- if (pdata->b2on_key != KEY_RESERVED)
- __set_bit(pdata->b2on_key, pwr->keybit);
- if (pdata->b2on_flags & MC13783_BUTTON_POL_INVERT)
- priv->flags |= MC13783_PWRB_B2_POL_INVERT;
+ mc13xxx_unlock(priv->mc13xxx);
- if (pdata->b2on_flags & MC13783_BUTTON_RESET_EN)
- reg |= MC13783_POWER_CONTROL_2_ON2BRSTEN;
-
- err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD2,
- button_irq, "b2on", priv);
- if (err) {
- dev_dbg(&pdev->dev, "Can't request irq\n");
- goto free_irq_b1;
- }
- }
-
- if (pdata->b3on_flags & MC13783_BUTTON_ENABLE) {
- priv->keymap[2] = pdata->b3on_key;
- if (pdata->b3on_key != KEY_RESERVED)
- __set_bit(pdata->b3on_key, pwr->keybit);
+ return ret;
+}
- if (pdata->b3on_flags & MC13783_BUTTON_POL_INVERT)
- priv->flags |= MC13783_PWRB_B3_POL_INVERT;
+static void mc13xxx_pwrbutton_close(struct input_dev *dev)
+{
+ struct mc13xxx_pwrb *priv = input_get_drvdata(dev);
+ int i;
+
+ mc13xxx_lock(priv->mc13xxx);
+ for (i = 0; i < MAX13XXX_NUM_BUTTONS; i++)
+ if (priv->enabled & BIT(i))
+ mc13xxx_irq_free(priv->mc13xxx,
+ priv->devtype->btn_def[i].irq, priv);
+ mc13xxx_unlock(priv->mc13xxx);
+}
- if (pdata->b3on_flags & MC13783_BUTTON_RESET_EN)
- reg |= MC13783_POWER_CONTROL_2_ON3BRSTEN;
+static int __init mc13xxx_pwrbutton_probe(struct platform_device *pdev)
+{
+ struct mc13xxx_buttons_platform_data *pdata =
+ dev_get_platdata(&pdev->dev);
+ struct mc13xxx *mc13xxx = dev_get_drvdata(pdev->dev.parent);
+ struct mc13xxx_pwrb_devtype *devtype =
+ (struct mc13xxx_pwrb_devtype *)pdev->id_entry->driver_data;
+ struct mc13xxx_pwrb *priv;
+ int i, reg = 0, ret = -EINVAL;
- err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD3,
- button_irq, "b3on", priv);
- if (err) {
- dev_dbg(&pdev->dev, "Can't request irq: %d\n", err);
- goto free_irq_b2;
- }
+ if (!pdata) {
+ dev_err(&pdev->dev, "Missing platform data\n");
+ return -ENODEV;
}
- mc13xxx_reg_rmw(mc13783, MC13783_REG_POWER_CONTROL_2, 0x3FE, reg);
-
- mc13xxx_unlock(mc13783);
-
- pwr->name = "mc13783_pwrbutton";
- pwr->phys = "mc13783_pwrbutton/input0";
- pwr->dev.parent = &pdev->dev;
-
- pwr->keycode = priv->keymap;
- pwr->keycodemax = ARRAY_SIZE(priv->keymap);
- pwr->keycodesize = sizeof(priv->keymap[0]);
- __set_bit(EV_KEY, pwr->evbit);
+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
- err = input_register_device(pwr);
- if (err) {
- dev_dbg(&pdev->dev, "Can't register power button: %d\n", err);
- goto free_irq;
- }
+ priv->input = devm_input_allocate_device(&pdev->dev);
+ if (!priv->input)
+ return -ENOMEM;
+ priv->mc13xxx = mc13xxx;
+ priv->devtype = devtype;
platform_set_drvdata(pdev, priv);
- return 0;
-
-free_irq:
- mc13xxx_lock(mc13783);
-
- if (pdata->b3on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD3, priv);
-
-free_irq_b2:
- if (pdata->b2on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD2, priv);
-
-free_irq_b1:
- if (pdata->b1on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD1, priv);
-
-free_priv:
- mc13xxx_unlock(mc13783);
- kfree(priv);
-
-free_input_dev:
- input_free_device(pwr);
+ for (i = 0; i < MAX13XXX_NUM_BUTTONS; i++) {
+ u16 code, invert, reset, debounce;
+
+ if (!(pdata->buttons[i].flags & MC13XXX_BUTTON_ENABLE))
+ continue;
+ code = pdata->buttons[i].keycode;
+ invert = !!(pdata->buttons[i].flags &
+ MC13XXX_BUTTON_POL_INVERT);
+ reset = !!(pdata->buttons[i].flags &
+ MC13XXX_BUTTON_RESET_EN);
+ debounce = pdata->buttons[i].flags;
+
+ priv->btn_code[i] = code;
+ if (code != KEY_RESERVED)
+ __set_bit(code, priv->input->keybit);
+
+ priv->enabled |= BIT(i);
+ priv->inverted |= invert << i;
+ reg |= reset << (i + 1);
+ reg |= (debounce & 0x03) << (4 + i * 2);
+ }
- return err;
+ mc13xxx_lock(mc13xxx);
+ mc13xxx_reg_rmw(mc13xxx, MC13XXX_REG_POWER_CONTROL_2, 0x3fe, reg);
+ mc13xxx_unlock(mc13xxx);
+
+ priv->input->name = "mc13xxx_pwrbutton";
+ priv->input->phys = "mc13xxx_pwrbutton/input0";
+ priv->input->id.bustype = BUS_HOST;
+ priv->input->id.vendor = 0x0001;
+ priv->input->id.product = 0x0001;
+ priv->input->id.version = 0x0100;
+ priv->input->keycode = priv->btn_code;
+ priv->input->keycodemax = ARRAY_SIZE(priv->btn_code);
+ priv->input->keycodesize = sizeof(priv->btn_code[0]);
+ priv->input->open = mc13xxx_pwrbutton_open;
+ priv->input->close = mc13xxx_pwrbutton_close;
+ __set_bit(EV_KEY, priv->input->evbit);
+
+ input_set_drvdata(priv->input, priv);
+
+ ret = input_register_device(priv->input);
+ if (ret)
+ dev_err(&pdev->dev, "Can't register input device: %i\n", ret);
+
+ return ret;
}
-static int mc13783_pwrbutton_remove(struct platform_device *pdev)
-{
- struct mc13783_pwrb *priv = platform_get_drvdata(pdev);
- const struct mc13xxx_buttons_platform_data *pdata;
-
- pdata = dev_get_platdata(&pdev->dev);
-
- mc13xxx_lock(priv->mc13783);
-
- if (pdata->b3on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD3, priv);
- if (pdata->b2on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD2, priv);
- if (pdata->b1on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD1, priv);
-
- mc13xxx_unlock(priv->mc13783);
-
- input_unregister_device(priv->pwr);
- kfree(priv);
+static const struct mc13xxx_pwrb_devtype mc13783_pwrb_devtype = {
+ .btn_def[0] = { MC13783_IRQ_ONOFD1, BIT(3) },
+ .btn_def[1] = { MC13783_IRQ_ONOFD2, BIT(4) },
+ .btn_def[2] = { MC13783_IRQ_ONOFD3, BIT(5) }
+};
- return 0;
-}
+static const struct platform_device_id mc13xxx_pwrbutton_id_table[] = {
+ { "mc13783-pwrbutton", (kernel_ulong_t)&mc13783_pwrb_devtype },
+ { }
+};
+MODULE_DEVICE_TABLE(platform, mc13xxx_pwrbutton_id_table);
-static struct platform_driver mc13783_pwrbutton_driver = {
- .probe = mc13783_pwrbutton_probe,
- .remove = mc13783_pwrbutton_remove,
- .driver = {
- .name = "mc13783-pwrbutton",
+static struct platform_driver mc13xxx_pwrbutton_driver = {
+ .driver = {
+ .name = "mc13xxx-pwrbutton",
.owner = THIS_MODULE,
},
+ .id_table = mc13xxx_pwrbutton_id_table,
};
+module_platform_driver_probe(mc13xxx_pwrbutton_driver, mc13xxx_pwrbutton_probe);
-module_platform_driver(mc13783_pwrbutton_driver);
-
-MODULE_ALIAS("platform:mc13783-pwrbutton");
MODULE_DESCRIPTION("MC13783 Power Button");
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Philippe Retornaz");
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index 41ed592..b895538 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -142,20 +142,22 @@ struct mc13xxx_leds_platform_data {
u32 led_control[MAX_LED_CONTROL_REGS];
};
+#define MAX13XXX_NUM_BUTTONS 3
+
+struct mc13xxx_button {
+ u16 keycode;
+ unsigned int flags;
+#define MC13XXX_BUTTON_DBNC_0MS 0
+#define MC13XXX_BUTTON_DBNC_30MS 1
+#define MC13XXX_BUTTON_DBNC_150MS 2
+#define MC13XXX_BUTTON_DBNC_750MS 3
+#define MC13XXX_BUTTON_ENABLE (1 << 2)
+#define MC13XXX_BUTTON_POL_INVERT (1 << 3)
+#define MC13XXX_BUTTON_RESET_EN (1 << 4)
+};
+
struct mc13xxx_buttons_platform_data {
-#define MC13783_BUTTON_DBNC_0MS 0
-#define MC13783_BUTTON_DBNC_30MS 1
-#define MC13783_BUTTON_DBNC_150MS 2
-#define MC13783_BUTTON_DBNC_750MS 3
-#define MC13783_BUTTON_ENABLE (1 << 2)
-#define MC13783_BUTTON_POL_INVERT (1 << 3)
-#define MC13783_BUTTON_RESET_EN (1 << 4)
- int b1on_flags;
- unsigned short b1on_key;
- int b2on_flags;
- unsigned short b2on_key;
- int b3on_flags;
- unsigned short b3on_key;
+ struct mc13xxx_button buttons[MAX13XXX_NUM_BUTTONS];
};
struct mc13xxx_ts_platform_data {
--
1.8.1.5
^ permalink raw reply related
* Re: [PATCH 2/2] Bluetooth: hidp: remove wrong send_report at init
From: Benjamin Tissoires @ 2013-07-12 12:55 UTC (permalink / raw)
To: Gustavo Padovan, linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20130712100923.GA2065@joana>
On 07/12/2013 12:09 PM, Gustavo Padovan wrote:
> Hi Benjamin,
>
> * Benjamin Tissoires <benjamin.tissoires-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> [2013-07-11 15:41:30 +0200]:
>
>> The USB hid implementation does retrieve the reports during the start.
>> However, this implementation does not call the HID command GET_REPORT
>> (which would fetch the current status of each report), but use the
>> DATA command, which is an Output Report (so transmitting data from the
>> host to the device).
>> The Wiimote controller is already guarded against this problem in the
>> protocol, but it is not conformant to the specification to set all the
>> reports to 0 on start.
>>
>> Signed-off-by: Benjamin Tissoires <benjamin.tissoires-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>> ---
>> net/bluetooth/hidp/core.c | 14 --------------
>> 1 file changed, 14 deletions(-)
>
> Both patches have been applied to bluetooth-next. Thanks.
>
> Gustavo
>
Thanks Gustavo!
Cheers,
Benjamin
^ permalink raw reply
* [PATCH] HID: kye: Add report fixup for Genius Gx Imperator Keyboard
From: Benjamin Tissoires @ 2013-07-12 12:53 UTC (permalink / raw)
To: Benjamin Tissoires, Jiri Kosina, Honza Brazdil, linux-input,
linux-kernel
Genius Gx Imperator Keyboard presents the same problem in its report
descriptors than Genius Gila Gaming Mouse.
Use the same fixup for both.
Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=928561
Reported-and-tested-by: Honza Brazdil <jbrazdil@redhat.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
Hi Jiri,
I have been reported this broken Genius device too.
The patch applies on top of the branch for-3.11/upstream, but feel free to
schedule it for 3.11 or 3.12. This time, only the multimedia (and macros) keys
are broken. The core keyboard part is working fine without the patch.
Cheers,
Benjamin
drivers/hid/hid-ids.h | 1 +
drivers/hid/hid-kye.c | 45 ++++++++++++++++++++++++++++-----------------
2 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index b2b692e..1f28df9 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -475,6 +475,7 @@
#define USB_VENDOR_ID_KYE 0x0458
#define USB_DEVICE_ID_KYE_ERGO_525V 0x0087
#define USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE 0x0138
+#define USB_DEVICE_ID_GENIUS_GX_IMPERATOR 0x4018
#define USB_DEVICE_ID_KYE_GPEN_560 0x5003
#define USB_DEVICE_ID_KYE_EASYPEN_I405X 0x5010
#define USB_DEVICE_ID_KYE_MOUSEPEN_I608X 0x5011
diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c
index 1e2ee2aa..7384512 100644
--- a/drivers/hid/hid-kye.c
+++ b/drivers/hid/hid-kye.c
@@ -268,6 +268,26 @@ static __u8 easypen_m610x_rdesc_fixed[] = {
0xC0 /* End Collection */
};
+static __u8 *kye_consumer_control_fixup(struct hid_device *hdev, __u8 *rdesc,
+ unsigned int *rsize, int offset, const char *device_name) {
+ /*
+ * the fixup that need to be done:
+ * - change Usage Maximum in the Comsumer Control
+ * (report ID 3) to a reasonable value
+ */
+ if (*rsize >= offset + 31 &&
+ /* Usage Page (Consumer Devices) */
+ rdesc[offset] == 0x05 && rdesc[offset + 1] == 0x0c &&
+ /* Usage (Consumer Control) */
+ rdesc[offset + 2] == 0x09 && rdesc[offset + 3] == 0x01 &&
+ /* Usage Maximum > 12287 */
+ rdesc[offset + 10] == 0x2a && rdesc[offset + 12] > 0x2f) {
+ hid_info(hdev, "fixing up %s report descriptor\n", device_name);
+ rdesc[offset + 12] = 0x2f;
+ }
+ return rdesc;
+}
+
static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize)
{
@@ -315,23 +335,12 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
}
break;
case USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE:
- /*
- * the fixup that need to be done:
- * - change Usage Maximum in the Comsumer Control
- * (report ID 3) to a reasonable value
- */
- if (*rsize >= 135 &&
- /* Usage Page (Consumer Devices) */
- rdesc[104] == 0x05 && rdesc[105] == 0x0c &&
- /* Usage (Consumer Control) */
- rdesc[106] == 0x09 && rdesc[107] == 0x01 &&
- /* Usage Maximum > 12287 */
- rdesc[114] == 0x2a && rdesc[116] > 0x2f) {
- hid_info(hdev,
- "fixing up Genius Gila Gaming Mouse "
- "report descriptor\n");
- rdesc[116] = 0x2f;
- }
+ rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104,
+ "Genius Gila Gaming Mouse");
+ break;
+ case USB_DEVICE_ID_GENIUS_GX_IMPERATOR:
+ rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 83,
+ "Genius Gx Imperator Keyboard");
break;
}
return rdesc;
@@ -428,6 +437,8 @@ static const struct hid_device_id kye_devices[] = {
USB_DEVICE_ID_KYE_EASYPEN_M610X) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE,
USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
+ USB_DEVICE_ID_GENIUS_GX_IMPERATOR) },
{ }
};
MODULE_DEVICE_TABLE(hid, kye_devices);
--
1.8.3.1
^ permalink raw reply related
* [PATCH] input: twl6040-vibra: Remove support for legacy (pdata) mode
From: Peter Ujfalusi @ 2013-07-12 11:29 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
TWL6040 is used only with OMAP4/5 SoCs and they can only boot in in DT mode.
The support for pdata/legacy boot can be removed.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
drivers/input/misc/twl6040-vibra.c | 41 ++++++++++++++------------------------
1 file changed, 15 insertions(+), 26 deletions(-)
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c
index 0c2dfc8..7864b0c 100644
--- a/drivers/input/misc/twl6040-vibra.c
+++ b/drivers/input/misc/twl6040-vibra.c
@@ -257,7 +257,6 @@ static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL);
static int twl6040_vibra_probe(struct platform_device *pdev)
{
- struct twl6040_vibra_data *pdata = pdev->dev.platform_data;
struct device *twl6040_core_dev = pdev->dev.parent;
struct device_node *twl6040_core_node = NULL;
struct vibra_info *info;
@@ -270,8 +269,8 @@ static int twl6040_vibra_probe(struct platform_device *pdev)
"vibra");
#endif
- if (!pdata && !twl6040_core_node) {
- dev_err(&pdev->dev, "platform_data not available\n");
+ if (!twl6040_core_node) {
+ dev_err(&pdev->dev, "parent of node is missing?\n");
return -EINVAL;
}
@@ -284,27 +283,17 @@ static int twl6040_vibra_probe(struct platform_device *pdev)
info->dev = &pdev->dev;
info->twl6040 = dev_get_drvdata(pdev->dev.parent);
- if (pdata) {
- info->vibldrv_res = pdata->vibldrv_res;
- info->vibrdrv_res = pdata->vibrdrv_res;
- info->viblmotor_res = pdata->viblmotor_res;
- info->vibrmotor_res = pdata->vibrmotor_res;
- vddvibl_uV = pdata->vddvibl_uV;
- vddvibr_uV = pdata->vddvibr_uV;
- } else {
- of_property_read_u32(twl6040_core_node, "ti,vibldrv-res",
- &info->vibldrv_res);
- of_property_read_u32(twl6040_core_node, "ti,vibrdrv-res",
- &info->vibrdrv_res);
- of_property_read_u32(twl6040_core_node, "ti,viblmotor-res",
- &info->viblmotor_res);
- of_property_read_u32(twl6040_core_node, "ti,vibrmotor-res",
- &info->vibrmotor_res);
- of_property_read_u32(twl6040_core_node, "ti,vddvibl-uV",
- &vddvibl_uV);
- of_property_read_u32(twl6040_core_node, "ti,vddvibr-uV",
- &vddvibr_uV);
- }
+
+ of_property_read_u32(twl6040_core_node, "ti,vibldrv-res",
+ &info->vibldrv_res);
+ of_property_read_u32(twl6040_core_node, "ti,vibrdrv-res",
+ &info->vibrdrv_res);
+ of_property_read_u32(twl6040_core_node, "ti,viblmotor-res",
+ &info->viblmotor_res);
+ of_property_read_u32(twl6040_core_node, "ti,vibrmotor-res",
+ &info->vibrmotor_res);
+ of_property_read_u32(twl6040_core_node, "ti,vddvibl-uV", &vddvibl_uV);
+ of_property_read_u32(twl6040_core_node, "ti,vddvibr-uV", &vddvibr_uV);
if ((!info->vibldrv_res && !info->viblmotor_res) ||
(!info->vibrdrv_res && !info->vibrmotor_res)) {
@@ -334,8 +323,8 @@ static int twl6040_vibra_probe(struct platform_device *pdev)
* When booted with Device tree the regulators are attached to the
* parent device (twl6040 MFD core)
*/
- ret = regulator_bulk_get(pdata ? info->dev : twl6040_core_dev,
- ARRAY_SIZE(info->supplies), info->supplies);
+ ret = regulator_bulk_get(twl6040_core_dev, ARRAY_SIZE(info->supplies),
+ info->supplies);
if (ret) {
dev_err(info->dev, "couldn't get regulators %d\n", ret);
return ret;
--
1.8.2.1
^ permalink raw reply related
* Re: [PATCH] HID : core : fix hid delimiter local tag parsing.
From: Jiri Kosina @ 2013-07-12 10:40 UTC (permalink / raw)
To: pchavent; +Cc: linux-input, paul.chavent
In-Reply-To: <4754ed7e96bbb6e75d5b61d3997ce8e5@sybille.onecert.fr>
On Sun, 7 Jul 2013, pchavent wrote:
> When i plug an USB HID device with the DELIMITER tag in its report
> descriptor, the device doesn't load.
>
> The problem comes from the "return 1" in the DELIMITER switch of the local
> tags parsing.
>
> I join a trivial patch that return no error when encounter the DELIMITER tag.
>
> Please review it.
Interesting; apparently this bug has been there for ages. Please send me
your Signed-off-by: line as documented in Documentation/SubmittingPatches
so that I can queue your patch.
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH 2/2] Bluetooth: hidp: remove wrong send_report at init
From: Gustavo Padovan @ 2013-07-12 10:09 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Benjamin Tissoires, Marcel Holtmann, David Herrmann, Jiri Kosina,
linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1373550090-30379-3-git-send-email-benjamin.tissoires-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Hi Benjamin,
* Benjamin Tissoires <benjamin.tissoires-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> [2013-07-11 15:41:30 +0200]:
> The USB hid implementation does retrieve the reports during the start.
> However, this implementation does not call the HID command GET_REPORT
> (which would fetch the current status of each report), but use the
> DATA command, which is an Output Report (so transmitting data from the
> host to the device).
> The Wiimote controller is already guarded against this problem in the
> protocol, but it is not conformant to the specification to set all the
> reports to 0 on start.
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> net/bluetooth/hidp/core.c | 14 --------------
> 1 file changed, 14 deletions(-)
Both patches have been applied to bluetooth-next. Thanks.
Gustavo
^ permalink raw reply
* [PATCH v3] Input: sysrq - DT binding for key sequences
From: mathieu.poirier @ 2013-07-12 9:56 UTC (permalink / raw)
To: grant.likely, dmitry.torokhov
Cc: devicetree-discuss, john.stultz, linux-input, kernel-team,
mathieu.poirier
From: "Mathieu J. Poirier" <mathieu.poirier@linaro.org>
Adding a simple device tree binding for the specification of key sequences.
Definition of the keys found in the sequence are located in
'include/uapi/linux/input.h'.
For the sysrq driver, holding the sequence of keys down for a specific amount of time
will reset the system.
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
changes for v3:
- Simplified binding definition.
- Renamed binding and moved to chosen.
---
.../devicetree/bindings/input/input-reset.txt | 34 +++++++++++++
drivers/tty/sysrq.c | 58 ++++++++++++++++++++++
2 files changed, 92 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/input-reset.txt
diff --git a/Documentation/devicetree/bindings/input/input-reset.txt b/Documentation/devicetree/bindings/input/input-reset.txt
new file mode 100644
index 0000000..79504af
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/input-reset.txt
@@ -0,0 +1,34 @@
+Input: sysrq reset sequence
+
+A simple binding to represent a set of keys as described in
+include/uapi/linux/input.h. This is to communicate a
+sequence of keys to the sysrq driver. Upon holding the keys
+for a specified amount of time (if specified) the system is
+sync'ed and reset.
+
+Key sequences are global to the system but all the keys in a
+set must be coming from the same input device.
+
+The /chosen node should contain a 'linux,sysrq-reset-seq' child
+node to define a set of keys.
+
+Required property:
+sysrq-reset-seq: array of keycodes
+
+Optional property:
+timeout-ms: duration keys must be pressed together in microseconds
+before generating a sysrq
+
+Example:
+
+ chosen {
+ linux,sysrq-reset-seq {
+ keyset = <0x03
+ 0x04
+ 0x0a>;
+ timeout-ms = <3000>;
+ };
+ };
+
+Would represent KEY_2, KEY_3 and KEY_9.
+
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index b51c154..4b77adf 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -44,6 +44,7 @@
#include <linux/uaccess.h>
#include <linux/moduleparam.h>
#include <linux/jiffies.h>
+#include <linux/of.h>
#include <asm/ptrace.h>
#include <asm/irq_regs.h>
@@ -671,6 +672,54 @@ static void sysrq_detect_reset_sequence(struct sysrq_state *state,
}
}
+static void sysrq_of_get_keyreset_config(void)
+{
+ unsigned short key;
+ struct device_node *np;
+ const struct property *prop;
+ const __be32 *val;
+ int count, i;
+
+ np = of_find_node_by_path("/chosen");
+ if (!np)
+ goto out;
+
+ np = of_find_node_by_name(np, "linux,sysrq-reset-seq");
+ if (!np) {
+ pr_debug("No sysrq node found");
+ goto out;
+ }
+
+ prop = of_find_property(np, "keyset", NULL);
+ if (!prop || !prop->value) {
+ pr_err("Invalid input keyset");
+ goto out;
+ }
+
+ count = prop->length / sizeof(u32);
+ val = prop->value;
+
+ if (count > SYSRQ_KEY_RESET_MAX)
+ count = SYSRQ_KEY_RESET_MAX;
+
+ /* reset in case a __weak definition was present */
+ sysrq_reset_seq_len = 0;
+
+ for (i = 0; i < count; i++) {
+ key = (unsigned short)be32_to_cpup(val++);
+ if (key == KEY_RESERVED || key > KEY_MAX)
+ break;
+
+ sysrq_reset_seq[sysrq_reset_seq_len++] = key;
+ }
+
+ /* get reset timeout if any */
+ of_property_read_u32(np, "timeout-ms", &sysrq_reset_downtime_ms);
+
+ out:
+ ;
+}
+
static void sysrq_reinject_alt_sysrq(struct work_struct *work)
{
struct sysrq_state *sysrq =
@@ -688,6 +737,7 @@ static void sysrq_reinject_alt_sysrq(struct work_struct *work)
input_inject_event(handle, EV_KEY, KEY_SYSRQ, 1);
input_inject_event(handle, EV_SYN, SYN_REPORT, 1);
+
input_inject_event(handle, EV_KEY, KEY_SYSRQ, 0);
input_inject_event(handle, EV_KEY, alt_code, 0);
input_inject_event(handle, EV_SYN, SYN_REPORT, 1);
@@ -903,6 +953,7 @@ static inline void sysrq_register_handler(void)
int error;
int i;
+ /* first check if a __weak interface was instantiated */
for (i = 0; i < ARRAY_SIZE(sysrq_reset_seq); i++) {
key = platform_sysrq_reset_seq[i];
if (key == KEY_RESERVED || key > KEY_MAX)
@@ -911,6 +962,13 @@ static inline void sysrq_register_handler(void)
sysrq_reset_seq[sysrq_reset_seq_len++] = key;
}
+ /*
+ * DT configuration takes precedence over anything
+ * that would have been defined via the __weak
+ * interface
+ */
+ sysrq_of_get_keyreset_config();
+
error = input_register_handler(&sysrq_handler);
if (error)
pr_err("Failed to register input handler, error %d", error);
--
1.8.1.2
^ permalink raw reply related
* Re: [PATCH] HID: logitech-dj: use inlined helpers hid_hw_open/close
From: Jiri Kosina @ 2013-07-12 9:42 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Benjamin Tissoires, Nestor Lopez Casado, linux-input,
linux-kernel
In-Reply-To: <1373619662-15353-1-git-send-email-benjamin.tissoires@redhat.com>
On Fri, 12 Jul 2013, Benjamin Tissoires wrote:
> Use the inlined helpers hid_hw_open/close instead of direct calls to
> ->ll_driver->open() and ->ll_driver->close().
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* [PATCH] HID: multitouch: do not init reports for multitouch devices
From: Benjamin Tissoires @ 2013-07-12 9:08 UTC (permalink / raw)
To: Benjamin Tissoires, Jiri Kosina, Henrik Rydberg, Stephane Chatty,
linux-input, linux-kernel
Some multitouch screens do not like to be polled for input reports.
However, the Win8 spec says that all touches should be sent during
each report, making the initialization of reports unnecessary.
The Win7 spec is less precise, but we can safely assume that when
the module is loaded (at boot), no one is touching the screen.
Add the quirk HID_QUIRK_NO_INIT_REPORTS so that we do not have to
introduce a quirk for each problematic device.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
drivers/hid/hid-multitouch.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index d99b959..197c2e6 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -957,6 +957,15 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
/*
+ * Some multitouch screens do not like to be polled for input reports.
+ * However, the Win8 spec says that all touches should be sent during
+ * each report, making the initialization of reports unnecessary.
+ * The Win7 spec is less precise, but we can safely assume that when
+ * the module is loaded (at boot), no one is touching the screen.
+ */
+ hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;
+
+ /*
* This allows the driver to handle different input sensors
* that emits events through different reports on the same HID
* device.
--
1.8.3.1
^ permalink raw reply related
* [PATCH] HID: logitech-dj: use inlined helpers hid_hw_open/close
From: Benjamin Tissoires @ 2013-07-12 9:01 UTC (permalink / raw)
To: Benjamin Tissoires, Jiri Kosina, Nestor Lopez Casado, linux-input,
linux-kernel
Use the inlined helpers hid_hw_open/close instead of direct calls to
->ll_driver->open() and ->ll_driver->close().
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
drivers/hid/hid-logitech-dj.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 5207591a..db3192b 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -756,10 +756,10 @@ static int logi_dj_probe(struct hid_device *hdev,
}
/* This is enabling the polling urb on the IN endpoint */
- retval = hdev->ll_driver->open(hdev);
+ retval = hid_hw_open(hdev);
if (retval < 0) {
- dev_err(&hdev->dev, "%s:hdev->ll_driver->open returned "
- "error:%d\n", __func__, retval);
+ dev_err(&hdev->dev, "%s:hid_hw_open returned error:%d\n",
+ __func__, retval);
goto llopen_failed;
}
@@ -776,7 +776,7 @@ static int logi_dj_probe(struct hid_device *hdev,
return retval;
logi_dj_recv_query_paired_devices_failed:
- hdev->ll_driver->close(hdev);
+ hid_hw_close(hdev);
llopen_failed:
switch_to_dj_mode_fail:
@@ -818,7 +818,7 @@ static void logi_dj_remove(struct hid_device *hdev)
cancel_work_sync(&djrcv_dev->work);
- hdev->ll_driver->close(hdev);
+ hid_hw_close(hdev);
hid_hw_stop(hdev);
/* I suppose that at this point the only context that can access
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] input: don't call input_dev_release_keys() in resume
From: Oskar Andero @ 2013-07-12 7:44 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
Makarov, Aleksej
In-Reply-To: <20130705074632.GF11422@caracas.corpusers.net>
On 09:46 Fri 05 Jul , Oskar Andero wrote:
> Hi Dmitry,
>
> On 18:33 Thu 04 Apr , Dmitry Torokhov wrote:
> > Hi Oskar,
> >
> > On Thu, Mar 07, 2013 at 03:01:22PM +0100, oskar.andero@sonymobile.com wrote:
> > > From: Aleksej Makarov <aleksej.makarov@sonymobile.com>
> > >
> > > When waking up the platform by pressing a specific key, sending a
> > > release on that key makes it impossible to react on the event in
> > > user-space.
> > >
> >
> > No, we can not simply not release keys after resume from suspend, as
> > this leads to keys being stuck. Consider you are holding an 'I' key on
> > your external USB keyboard and close your laptop's lid. Then you release
> > the key and leave. Later you come back, open the lid waking the laptop
> > and observe endless stream of 'I' in your open terminal.
> >
> > Maybe we should release the keys during suspend time? I am not sure how
> > Android infrastructure will react to this though...
>
> I finally got the time to try this out. Releasing the keys in suspend
> also solves our problem. Would such patch work for the USB keyboard
> case you described? Theoretically, I think it should, right?
>
> So, basically:
>
> static int input_dev_suspend(struct device *dev)
> {
> struct input_dev *input_dev = to_input_dev(dev);
>
> - mutex_lock(&input_dev->mutex);
> -
> - if (input_dev->users)
> - input_dev_toggle(input_dev, false);
> -
> - mutex_unlock(&input_dev->mutex);
> + input_reset_device(input_dev);
>
> return 0;
> }
>
> static int input_dev_resume(struct device *dev)
> {
> - struct input_dev *input_dev = to_input_dev(dev);
> -
> - input_reset_device(input_dev);
> -
> return 0;
> }
>
> Should I send the patch?
Ping. Any thoughts on this?
Thanks!
-Oskar
^ 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