* Re: [PATCH 1/2] Input: Add keycodes for some missing Fn key combinations
From: Dmitry Torokhov @ 2014-05-17 20:30 UTC (permalink / raw)
To: Pali Rohár
Cc: Matthew Garrett, linux-input, platform-driver-x86, linux-hotplug,
Matthew Garrett, linux-kernel
In-Reply-To: <1400337817-14473-2-git-send-email-pali.rohar@gmail.com>
Hi Pali,
On Sat, May 17, 2014 at 04:43:36PM +0200, Pali Rohár wrote:
> There are already defined some Fn key combinations, but not all.
> This patch adds missing combinations for support in dell-wmi driver.
>
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> ---
> include/uapi/linux/input.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
> index f484952..3a32799 100644
> --- a/include/uapi/linux/input.h
> +++ b/include/uapi/linux/input.h
> @@ -672,6 +672,12 @@ struct input_keymap_entry {
> #define KEY_FN_F 0x1e2
> #define KEY_FN_S 0x1e3
> #define KEY_FN_B 0x1e4
> +#define KEY_FN_Q 0x1e5
> +#define KEY_FN_W 0x1e6
> +#define KEY_FN_R 0x1e7
> +#define KEY_FN_T 0x1e8
> +#define KEY_FN_A 0x1e9
> +#define KEY_FN_G 0x1ea
What do they actually do?
Thanks.
--
Dmitry
--
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 0/2] dell-wmi: Add support for Fn key combinations
From: Pali Rohár @ 2014-05-17 14:43 UTC (permalink / raw)
To: Dmitry Torokhov, Matthew Garrett
Cc: linux-input, platform-driver-x86, linux-hotplug, Matthew Garrett,
linux-kernel, Pali Rohár
In-Reply-To: <201405171639.45722@pali>
This patch series add support for Fn key combinations to dell-wmi driver.
I tested this patch series on laptop Dell Latitude E6440.
Here is Bios DMI table which contains scancode to keycode mapping:
Handle 0xB200, DMI type 178, 80 bytes
OEM-specific Type
Header and Data:
B2 50 00 B2 07 01 0C 00 08 01 0A 00 09 01 0B 00
0A 01 12 00 3B 00 20 00 42 00 18 00 48 00 14 00
50 00 13 00 10 00 FF 00 11 00 FF 00 12 00 FF 00
13 00 FF 00 14 00 FF 00 1E 00 FF 00 1F 00 FF 00
20 00 FF 00 21 00 FF 00 22 00 FF 00 4D 00 16 00
Strings:
As you can see, more different keys are mapped to one keycode 0xFF.
Pali Rohár (2):
Input: Add keycodes for some missing Fn key combinations
dell-wmi: Add support for Fn key combinations
drivers/platform/x86/dell-wmi.c | 27 ++++++++++++++++++++++++++-
include/uapi/linux/input.h | 6 ++++++
2 files changed, 32 insertions(+), 1 deletion(-)
--
1.7.9.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
* [PATCH 2/2] dell-wmi: Add support for Fn key combinations
From: Pali Rohár @ 2014-05-17 14:43 UTC (permalink / raw)
To: Dmitry Torokhov, Matthew Garrett
Cc: linux-input, platform-driver-x86, linux-hotplug, Matthew Garrett,
linux-kernel, Pali Rohár
In-Reply-To: <1400337817-14473-1-git-send-email-pali.rohar@gmail.com>
Bios DMI table contains scancodes for some Fn key combinations. But
corresponding keycodes in DMI table have same value 255. And dell-wmi driver
map value 255 to KEY_PROG3. This means that it is not possible to distinguish
between Fn key combinations (e.g Fn+Q and Fn+W), because kernel reports for all
of them only KEY_PROG3.
This patch adding new table for mapping Bios DMI scancodes to linux keycodes
when bios DMI keycode is set to "generic" keycode 255. So different Fn key
combinations will have different keycodes.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
drivers/platform/x86/dell-wmi.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
index 390e8e3..c54d675 100644
--- a/drivers/platform/x86/dell-wmi.c
+++ b/drivers/platform/x86/dell-wmi.c
@@ -140,7 +140,27 @@ static const u16 bios_to_linux_keycode[256] __initconst = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, KEY_PROG3
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/* table for bios code 0xff */
+static const u16 scancode_to_linux_keycode[256] __initconst = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ KEY_FN_Q, KEY_FN_W, KEY_FN_E, KEY_FN_R,
+ KEY_FN_T, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, KEY_FN_A, KEY_FN_S,
+ KEY_FN_D, KEY_FN_F, KEY_FN_G, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static struct input_dev *dell_wmi_input_dev;
@@ -212,6 +232,11 @@ static const struct key_entry * __init dell_wmi_prepare_new_keymap(void)
keymap[i].keycode = bios_entry->keycode < 256 ?
bios_to_linux_keycode[bios_entry->keycode] :
KEY_RESERVED;
+ if (bios_entry->keycode == 255 && bios_entry->scancode < 256)
+ keymap[i].keycode =
+ scancode_to_linux_keycode[bios_entry->scancode];
+ if (!keymap[i].keycode)
+ keymap[i].keycode = KEY_RESERVED;
}
keymap[hotkey_num].type = KE_END;
--
1.7.9.5
^ permalink raw reply related
* [PATCH 1/2] Input: Add keycodes for some missing Fn key combinations
From: Pali Rohár @ 2014-05-17 14:43 UTC (permalink / raw)
To: Dmitry Torokhov, Matthew Garrett
Cc: linux-input, platform-driver-x86, linux-hotplug, Matthew Garrett,
linux-kernel, Pali Rohár
In-Reply-To: <1400337817-14473-1-git-send-email-pali.rohar@gmail.com>
There are already defined some Fn key combinations, but not all.
This patch adds missing combinations for support in dell-wmi driver.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
include/uapi/linux/input.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index f484952..3a32799 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -672,6 +672,12 @@ struct input_keymap_entry {
#define KEY_FN_F 0x1e2
#define KEY_FN_S 0x1e3
#define KEY_FN_B 0x1e4
+#define KEY_FN_Q 0x1e5
+#define KEY_FN_W 0x1e6
+#define KEY_FN_R 0x1e7
+#define KEY_FN_T 0x1e8
+#define KEY_FN_A 0x1e9
+#define KEY_FN_G 0x1ea
#define KEY_BRL_DOT1 0x1f1
#define KEY_BRL_DOT2 0x1f2
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" 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
* usbhid: PicoLCD 256x64 USB error -71
From: Kieran Kunhya @ 2014-05-16 22:28 UTC (permalink / raw)
To: linux-input
As requested I forward my bug report to the list:
From time to time on an ASRock IMB-181D motherboard this device fails to be
added.
It seems to work reliably when using Windows 7.
The errors in dmesg vary but usually take the form:
[ 5.328040] usb 3-7: string descriptor 0 read error: -71
(snip)
[ 10.333605] usbhid 3-7:1.0: can't add hid device: -71
[ 10.333639] usbhid: probe of 3-7:1.0 failed with error -71
I can provide a PicoLCD unit if necessary and possibly also fund a
fix/workaround.
More information is available here:
https://bugzilla.kernel.org/show_bug.cgi?id=76341
Kieran Kunhya
--
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] Input: Introduce the use of the managed version of kzalloc
From: Himangi Saraogi @ 2014-05-16 19:28 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input, linux-kernel; +Cc: julia.lawall
This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions.
The following Coccinelle semantic patch was used for making the change:
@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
.probe = probefn,
.remove = removefn,
};
@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
<+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(&pdev->dev, e1, e2)
...
?-kfree(e);
...+>
}
@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
<...
- kfree(e);
...>
}
Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
---
Can I make the code simpler by changing the code:
poll_dev = input_allocate_polled_device();
if (!poll_dev) {
error = -ENOMEM;
goto failed;
}
to have only return -ENOMEM as there is no error message for failure of
kzalloc and the call to input_free_polled_device does nothing when
poll_dev is null.
drivers/input/keyboard/jornada680_kbd.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/input/keyboard/jornada680_kbd.c b/drivers/input/keyboard/jornada680_kbd.c
index 69b1f00..02c8f5b 100644
--- a/drivers/input/keyboard/jornada680_kbd.c
+++ b/drivers/input/keyboard/jornada680_kbd.c
@@ -185,7 +185,8 @@ static int jornada680kbd_probe(struct platform_device *pdev)
struct input_dev *input_dev;
int i, error;
- jornadakbd = kzalloc(sizeof(struct jornadakbd), GFP_KERNEL);
+ jornadakbd = devm_kzalloc(&pdev->dev, sizeof(struct jornadakbd),
+ GFP_KERNEL);
if (!jornadakbd)
return -ENOMEM;
@@ -233,7 +234,6 @@ static int jornada680kbd_probe(struct platform_device *pdev)
printk(KERN_ERR "Jornadakbd: failed to register driver, error: %d\n",
error);
input_free_polled_device(poll_dev);
- kfree(jornadakbd);
return error;
}
@@ -244,7 +244,6 @@ static int jornada680kbd_remove(struct platform_device *pdev)
input_unregister_polled_device(jornadakbd->poll_dev);
input_free_polled_device(jornadakbd->poll_dev);
- kfree(jornadakbd);
return 0;
}
--
1.9.1
^ permalink raw reply related
* [PATCH 3/3] synaptics: Change min/max quirk table to pnp-id matching
From: Hans de Goede @ 2014-05-16 18:46 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Peter Hutterer, Benjamin Tissoires, linux-input, stable,
Hans de Goede
In-Reply-To: <1400266009-5436-1-git-send-email-hdegoede@redhat.com>
Most of the affected models share pnp-ids for the touchpad. So switching
to pnp-ids give us 2 advantages:
1) It shrinks the quirk list
2) It will lower the new quirk addition frequency, ie the recently added W540
quirk would not have been necessary since it uses the same LEN0034 pnp ids
as other models already added before it
As an added bonus it actually puts the quirk on the actual psmouse, rather then
on the machine, which is technically more correct.
Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/input/mouse/synaptics.c | 149 ++++++++++------------------------------
1 file changed, 36 insertions(+), 113 deletions(-)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 395ec9c..c5ec703 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -117,6 +117,31 @@ void synaptics_reset(struct psmouse *psmouse)
}
#ifdef CONFIG_MOUSE_PS2_SYNAPTICS
+struct min_max_quirk {
+ const char * const *pnp_ids;
+ int x_min, x_max, y_min, y_max;
+};
+
+static const struct min_max_quirk min_max_pnpid_table[] = {
+ {
+ (const char * const []){"LEN0033", NULL},
+ 1024, 5052, 2258, 4832
+ },
+ {
+ (const char * const []){"LEN0035", "LEN0042", NULL},
+ 1232, 5710, 1156, 4696
+ },
+ {
+ (const char * const []){"LEN0034", "LEN0036", "LEN2004", NULL},
+ 1024, 5112, 2024, 4832
+ },
+ {
+ (const char * const []){"LEN2001", NULL},
+ 1024, 5022, 2508, 4832
+ },
+ { }
+};
+
/* This list has been kindly provided by Synaptics. */
static const char * const topbuttonpad_pnp_ids[] = {
"LEN0017",
@@ -129,7 +154,7 @@ static const char * const topbuttonpad_pnp_ids[] = {
"LEN002D",
"LEN002E",
"LEN0033", /* Helix */
- "LEN0034", /* T431s, T540, X1 Carbon 2nd */
+ "LEN0034", /* T431s, L440, L540, T540, W540, X1 Carbon 2nd */
"LEN0035", /* X240 */
"LEN0036", /* T440 */
"LEN0037",
@@ -142,7 +167,7 @@ static const char * const topbuttonpad_pnp_ids[] = {
"LEN0048",
"LEN0049",
"LEN2000",
- "LEN2001",
+ "LEN2001", /* Edge E431 */
"LEN2002",
"LEN2003",
"LEN2004", /* L440 */
@@ -316,20 +341,20 @@ static int synaptics_identify(struct psmouse *psmouse)
* Resolution is left zero if touchpad does not support the query
*/
-static const int *quirk_min_max;
-
static int synaptics_resolution(struct psmouse *psmouse)
{
struct synaptics_data *priv = psmouse->private;
unsigned char resp[3];
+ int i;
- if (quirk_min_max) {
- priv->x_min = quirk_min_max[0];
- priv->x_max = quirk_min_max[1];
- priv->y_min = quirk_min_max[2];
- priv->y_max = quirk_min_max[3];
- return 0;
- }
+ for (i = 0; min_max_pnpid_table[i].pnp_ids; i++)
+ if (matches_pnp_id(psmouse, min_max_pnpid_table[i].pnp_ids)) {
+ priv->x_min = min_max_pnpid_table[i].x_min;
+ priv->x_max = min_max_pnpid_table[i].x_max;
+ priv->y_min = min_max_pnpid_table[i].y_min;
+ priv->y_max = min_max_pnpid_table[i].y_max;
+ return 0;
+ }
if (SYN_ID_MAJOR(priv->identity) < 4)
return 0;
@@ -1550,112 +1575,10 @@ static const struct dmi_system_id olpc_dmi_table[] __initconst = {
{ }
};
-static const struct dmi_system_id min_max_dmi_table[] __initconst = {
-#if defined(CONFIG_DMI)
- {
- /* Lenovo ThinkPad Helix */
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Helix"),
- },
- .driver_data = (int []){1024, 5052, 2258, 4832},
- },
- {
- /* Lenovo ThinkPad X240 */
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X240"),
- },
- .driver_data = (int []){1232, 5710, 1156, 4696},
- },
- {
- /* Lenovo ThinkPad Edge E431 */
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Edge E431"),
- },
- .driver_data = (int []){1024, 5022, 2508, 4832},
- },
- {
- /* Lenovo ThinkPad T431s */
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T431"),
- },
- .driver_data = (int []){1024, 5112, 2024, 4832},
- },
- {
- /* Lenovo ThinkPad T440s */
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T440"),
- },
- .driver_data = (int []){1024, 5112, 2024, 4832},
- },
- {
- /* Lenovo ThinkPad L440 */
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L440"),
- },
- .driver_data = (int []){1024, 5112, 2024, 4832},
- },
- {
- /* Lenovo ThinkPad T540p */
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T540"),
- },
- .driver_data = (int []){1024, 5112, 2024, 4832},
- },
- {
- /* Lenovo ThinkPad L540 */
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L540"),
- },
- .driver_data = (int []){1024, 5112, 2024, 4832},
- },
- {
- /* Lenovo ThinkPad W540 */
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
- DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W540"),
- },
- .driver_data = (int []){1024, 5112, 2024, 4832},
- },
- {
- /* Lenovo Yoga S1 */
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
- DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
- "ThinkPad S1 Yoga"),
- },
- .driver_data = (int []){1232, 5710, 1156, 4696},
- },
- {
- /* Lenovo ThinkPad X1 Carbon Haswell (3rd generation) */
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
- DMI_MATCH(DMI_PRODUCT_VERSION,
- "ThinkPad X1 Carbon 2nd"),
- },
- .driver_data = (int []){1024, 5112, 2024, 4832},
- },
-#endif
- { }
-};
-
void __init synaptics_module_init(void)
{
- const struct dmi_system_id *min_max_dmi;
-
impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
broken_olpc_ec = dmi_check_system(olpc_dmi_table);
-
- min_max_dmi = dmi_first_match(min_max_dmi_table);
- if (min_max_dmi)
- quirk_min_max = min_max_dmi->driver_data;
}
static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
--
1.9.0
^ permalink raw reply related
* [PATCH 2/3] synaptics: Add a matches_pnp_id helper function
From: Hans de Goede @ 2014-05-16 18:46 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Peter Hutterer, Benjamin Tissoires, linux-input, stable,
Hans de Goede
In-Reply-To: <1400266009-5436-1-git-send-email-hdegoede@redhat.com>
This is a preparation patch for simplifying the min/max quirk table.
Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/input/mouse/synaptics.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 898e8bb..395ec9c 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -156,6 +156,18 @@ static const char * const topbuttonpad_pnp_ids[] = {
NULL
};
+static bool matches_pnp_id(struct psmouse *psmouse, const char * const ids[])
+{
+ int i;
+
+ if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4))
+ for (i = 0; ids[i]; i++)
+ if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i]))
+ return true;
+
+ return false;
+}
+
/*****************************************************************************
* Synaptics communications functions
****************************************************************************/
@@ -1365,17 +1377,8 @@ static void set_input_params(struct psmouse *psmouse,
if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
__set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
- /* See if this buttonpad has a top button area */
- if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4)) {
- for (i = 0; topbuttonpad_pnp_ids[i]; i++) {
- if (strstr(psmouse->ps2dev.serio->firmware_id,
- topbuttonpad_pnp_ids[i])) {
- __set_bit(INPUT_PROP_TOPBUTTONPAD,
- dev->propbit);
- break;
- }
- }
- }
+ if (matches_pnp_id(psmouse, topbuttonpad_pnp_ids))
+ __set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit);
/* Clickpads report only left button */
__clear_bit(BTN_RIGHT, dev->keybit);
__clear_bit(BTN_MIDDLE, dev->keybit);
--
1.9.0
^ permalink raw reply related
* [PATCH 1/3] synaptics: T540p: make the min/max identical to other LEN0034 models
From: Hans de Goede @ 2014-05-16 18:46 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Peter Hutterer, Benjamin Tissoires, linux-input, stable,
Hans de Goede
In-Reply-To: <1400266009-5436-1-git-send-email-hdegoede@redhat.com>
The T540p has a touchpad with pnp-id LEN0034, all the models with this pnp-id
have the same min/max values, except the T540p where the values are slightly
off. Fix them to be identical.
This is a preparation patch for simplifying the quirk table.
Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/input/mouse/synaptics.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index d4c05b1..898e8bb 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -1603,7 +1603,7 @@ static const struct dmi_system_id min_max_dmi_table[] __initconst = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T540"),
},
- .driver_data = (int []){1024, 5056, 2058, 4832},
+ .driver_data = (int []){1024, 5112, 2024, 4832},
},
{
/* Lenovo ThinkPad L540 */
--
1.9.0
^ permalink raw reply related
* [PATCH 0/3] synaptics: Change min/max quirk table to pnp-id matching
From: Hans de Goede @ 2014-05-16 18:46 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Peter Hutterer, Benjamin Tissoires, linux-input, stable
Hi Dmitry,
After seeing how happy you were with the last quirk patch for the synaptics
driver I thought it was time to make things somewhat better, hence this
patch set.
Most of the affected models share pnp-ids for the touchpad. So switching
to pnp-ids give us 2 advantages:
1) It shrinks the quirk list
2) It will lower the new quirk addition frequency
Note that this will not get rid of the need to add a new quirk every now
and then, but it should significantly reduce the frequency with which we add
them.
This has been tested on a T440s.
Since I would also like to avoid the need to still add new quirks to stable,
and since the prereqs are also all in stable, I've also put a CC stable on
this series.
Regards,
Hans
^ permalink raw reply
* Re: [PATCH 0/4] Input: atmel_mxt_ts - make it work on Tegra
From: Stephen Warren @ 2014-05-16 16:40 UTC (permalink / raw)
To: Nick Dyer
Cc: Dmitry Torokhov, Benson Leung, Yufeng Shen, Daniel Kurtz,
linux-input@vger.kernel.org, Stephen Warren, Bowens, Alan
In-Reply-To: <53763B06.7020100@itdev.co.uk>
On 05/16/2014 10:21 AM, Nick Dyer wrote:
> Stephen Warren wrote:
>> On 05/08/2014 01:50 PM, Nick Dyer wrote:
>>> The patches I posted at the end of March are the first 22 out of this tag:
>>>
>>> https://github.com/ndyer/linux/tree/for-next-20140316-v8
>>
>> I took those 22 patches, applied them on top of next-20150507 (which is
>> just what I happened to be developing on top of right now), and rebased
>> my patches which add DT support. You can find the result here if you want:
>>
>> git://github.com/swarren/linux-tegra.git tegra_dev
>
> Thanks for this. Would you be happy for me to pick these changes up and
> include them along with the other work I am sending to Dmitry? I am just
> beginning to do various updates to the whole series, one of the things I
> need to sort out is the device tree support.
That would be fine. I assume you'd only take the 2 Atmel driver patches.
I'll send the Tegra patches separately once the driver is merged.
One thing I wasn't really sure about: With your latest patches, it seems
like the bootloader address is auto-calculated from the application
address. As such, do I still need separate struct i2c_device for the
application and bootloader I2C addresses? If not, we should remove the
atmel,mxt-tp-bootloader from those patches. If so, I need to add the
second DT node back into the Tegra DT. Either way, it might be
preferable if we only had 1 node in DT, and the driver automatically
handled the two separate I2C addresses.
> I will need to add device tree parameters for the touchscreen as well as
> the touchpad, of course.
>
> By the way, the driver should work without any firmware file and just use
> the firmware and configuration from NVRAM - request_firmware() returns a
> failure and it continues through mxt_initialize().
Hmmm. I couldn't get that to work after applying the patches you posted.
However, it did with what's already in linux-next plus the patches I sent.
> In a later patch in my long series, I make the MXT_CFG_NAME configurable
> from platform data (because you may have multiple devices needing different
> configs), and leaving it null means the call to request_firmware() is skipped.
It'd be preferable to automatically derive the firmware name from the
device type (touchscreen/touchpad) or some other parameter that can be
calculated at run-time, or queried from HW (e.g. version # from
bootloader?). I'm not sure that putting firmware filenames in DT is a
good idea, but perhaps that would work. Deriving firmware filename from
the DT compatible value would work best. If different HW needs different
firmware, it should probably have a different compatible value in DT.
I don't want to build firmware filenames into the kernel at
compile-time, since I want to be able to take a single kernel and run it
on any ARM board, each of which might use different firmware, but all
the same, use the same root filesystem (on an SD card) on all boards,
without having to rename firmware.
^ permalink raw reply
* Re: [PATCH 0/4] Input: atmel_mxt_ts - make it work on Tegra
From: Nick Dyer @ 2014-05-16 16:21 UTC (permalink / raw)
To: Stephen Warren
Cc: Dmitry Torokhov, Benson Leung, Yufeng Shen, Daniel Kurtz,
linux-input@vger.kernel.org, Stephen Warren, Bowens, Alan
In-Reply-To: <537128D0.3060005@wwwdotorg.org>
Stephen Warren wrote:
> On 05/08/2014 01:50 PM, Nick Dyer wrote:
>> The patches I posted at the end of March are the first 22 out of this tag:
>>
>> https://github.com/ndyer/linux/tree/for-next-20140316-v8
>
> I took those 22 patches, applied them on top of next-20150507 (which is
> just what I happened to be developing on top of right now), and rebased
> my patches which add DT support. You can find the result here if you want:
>
> git://github.com/swarren/linux-tegra.git tegra_dev
Thanks for this. Would you be happy for me to pick these changes up and
include them along with the other work I am sending to Dmitry? I am just
beginning to do various updates to the whole series, one of the things I
need to sort out is the device tree support.
I will need to add device tree parameters for the touchscreen as well as
the touchpad, of course.
By the way, the driver should work without any firmware file and just use
the firmware and configuration from NVRAM - request_firmware() returns a
failure and it continues through mxt_initialize().
In a later patch in my long series, I make the MXT_CFG_NAME configurable
from platform data (because you may have multiple devices needing different
configs), and leaving it null means the call to request_firmware() is skipped.
^ permalink raw reply
* Re: [PATCH] HID: rmi: fix masks for x and w_x data
From: Jiri Kosina @ 2014-05-16 9:14 UTC (permalink / raw)
To: Benjamin Tissoires; +Cc: Andrew Duggan, linux-input, linux-kernel
In-Reply-To: <20140515211123.GA10497@mail.corp.redhat.com>
On Thu, 15 May 2014, Benjamin Tissoires wrote:
> > The F11 data in the HID report contains four bits of data for w_x and the least significant bits
> > of x. Currently only the first three bits are being used which is resulting in small jumps in
> > the position data on the x axis and in the w_x data.
> >
> > Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
> > ---
>
> Good catch. I might have considered that 3:0 means 3 bits, not 4. I must
> have been tired while writing it :)
>
> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* [PATCH v2] input: xpad: Prevent corruption of urb request.
From: Sarah Bessmer @ 2014-05-16 9:11 UTC (permalink / raw)
To: linux-input
The xpad_send_led_command() and xpad_play_effect() functions submit urb requests, but do not
wait for the previous urb request to complete before using the same resources to
submit a new request. This can lead to unpredictable undesirable effects, including
memory corruption and dereferencing of NULL pointers(and needless to say, kernel
panics).
Fix the issue by introducing a busy flag set on submission of the urb request, and
cleared on urb request completion. If this flag is set while in xpad_send_led_command()
or xpad_play_effect(), the led/rumble packet data is buffered, and will be sent from
the urb request completion routine when the current urb request finishes.
Patch tested with rumble against a Logitech F510 and an X-Box v1 pad.
Signed-off-by: Sarah Bessmer <aotos@fastmail.fm>
---
v2:
-fixed introduced race in xpad_irq_out()
--- linux-3.14.4/drivers/input/joystick/xpad.c.orig 2014-05-15 13:13:39.000000000 -0700
+++ linux-3.14.4/drivers/input/joystick/xpad.c 2014-05-16 02:00:56.000000000 -0700
@@ -78,6 +78,7 @@
#include <linux/stat.h>
#include <linux/module.h>
#include <linux/usb/input.h>
+#include <linux/spinlock.h>
#define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>"
#define DRIVER_DESC "X-Box pad driver"
@@ -282,7 +283,15 @@ struct usb_xpad {
struct urb *irq_out; /* urb for interrupt out report */
unsigned char *odata; /* output data */
dma_addr_t odata_dma;
- struct mutex odata_mutex;
+ int odata_busy;
+
+ spinlock_t pend_lock;
+
+ unsigned pend_rum;
+ unsigned char rum_data[XPAD_PKT_LEN];
+
+ unsigned pend_led;
+ unsigned char led_data[XPAD_PKT_LEN];
#endif
#if defined(CONFIG_JOYSTICK_XPAD_LEDS)
@@ -541,12 +550,37 @@ static void xpad_irq_out(struct urb *urb
struct usb_xpad *xpad = urb->context;
struct device *dev = &xpad->intf->dev;
int retval, status;
+ unsigned long flags;
status = urb->status;
switch (status) {
case 0:
/* success */
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ xpad->irq_out->transfer_buffer_length = 0;
+
+ if (xpad->pend_rum != 0) {
+ memcpy(xpad->odata, xpad->rum_data, xpad->pend_rum);
+ xpad->irq_out->transfer_buffer_length = xpad->pend_rum;
+ xpad->pend_rum = 0;
+ } else if (xpad->pend_led != 0) {
+ memcpy(xpad->odata, xpad->led_data, xpad->pend_led);
+ xpad->irq_out->transfer_buffer_length = xpad->pend_led;
+ xpad->pend_led = 0;
+ }
+
+ if (xpad->irq_out->transfer_buffer_length != 0) {
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+ if (usb_submit_urb(xpad->irq_out, GFP_ATOMIC) != 0) {
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ xpad->odata_busy = 0;
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+ }
+ } else {
+ xpad->odata_busy = 0;
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+ }
return;
case -ECONNRESET:
@@ -555,19 +589,27 @@ static void xpad_irq_out(struct urb *urb
/* this urb is terminated, clean up */
dev_dbg(dev, "%s - urb shutting down with status: %d\n",
__func__, status);
+
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ xpad->odata_busy = 0;
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
return;
default:
dev_dbg(dev, "%s - nonzero urb status received: %d\n",
__func__, status);
- goto exit;
- }
-exit:
- retval = usb_submit_urb(urb, GFP_ATOMIC);
- if (retval)
- dev_err(dev, "%s - usb_submit_urb failed with result %d\n",
- __func__, retval);
+ retval = usb_submit_urb(urb, GFP_ATOMIC);
+ if (retval) {
+ dev_err(dev, "%s - usb_submit_urb failed with result %d\n",
+ __func__, retval);
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ xpad->odata_busy = 0;
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+ }
+
+ return;
+ }
}
static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
@@ -585,7 +627,12 @@ static int xpad_init_output(struct usb_i
goto fail1;
}
- mutex_init(&xpad->odata_mutex);
+ xpad->odata_busy = 0;
+
+ spin_lock_init(&xpad->pend_lock);
+
+ xpad->pend_rum = 0;
+ xpad->pend_led = 0;
xpad->irq_out = usb_alloc_urb(0, GFP_KERNEL);
if (!xpad->irq_out) {
@@ -628,61 +675,91 @@ static void xpad_stop_output(struct usb_
#endif
#ifdef CONFIG_JOYSTICK_XPAD_FF
+static int xpad_make_rum_data(struct usb_xpad *xpad, __u16 strong, __u16 weak)
+{
+ switch (xpad->xtype) {
+
+ case XTYPE_XBOX:
+ xpad->rum_data[0] = 0x00;
+ xpad->rum_data[1] = 0x06;
+ xpad->rum_data[2] = 0x00;
+ xpad->rum_data[3] = strong / 256; /* left actuator */
+ xpad->rum_data[4] = 0x00;
+ xpad->rum_data[5] = weak / 256; /* right actuator */
+ xpad->pend_rum = 6;
+ return 0;
+
+
+ case XTYPE_XBOX360:
+ xpad->rum_data[0] = 0x00;
+ xpad->rum_data[1] = 0x08;
+ xpad->rum_data[2] = 0x00;
+ xpad->rum_data[3] = strong / 256; /* left actuator? */
+ xpad->rum_data[4] = weak / 256; /* right actuator? */
+ xpad->rum_data[5] = 0x00;
+ xpad->rum_data[6] = 0x00;
+ xpad->rum_data[7] = 0x00;
+ xpad->pend_rum = 8;
+ return 0;
+
+ case XTYPE_XBOX360W:
+ xpad->rum_data[0] = 0x00;
+ xpad->rum_data[1] = 0x01;
+ xpad->rum_data[2] = 0x0F;
+ xpad->rum_data[3] = 0xC0;
+ xpad->rum_data[4] = 0x00;
+ xpad->rum_data[5] = strong / 256;
+ xpad->rum_data[6] = weak / 256;
+ xpad->rum_data[7] = 0x00;
+ xpad->rum_data[8] = 0x00;
+ xpad->rum_data[9] = 0x00;
+ xpad->rum_data[10] = 0x00;
+ xpad->rum_data[11] = 0x00;
+ xpad->pend_rum = 12;
+ return 0;
+
+ }
+ return -1;
+}
+
static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect *effect)
{
struct usb_xpad *xpad = input_get_drvdata(dev);
if (effect->type == FF_RUMBLE) {
- __u16 strong = effect->u.rumble.strong_magnitude;
- __u16 weak = effect->u.rumble.weak_magnitude;
-
- switch (xpad->xtype) {
+ unsigned long flags;
+ int mrdrv;
- case XTYPE_XBOX:
- xpad->odata[0] = 0x00;
- xpad->odata[1] = 0x06;
- xpad->odata[2] = 0x00;
- xpad->odata[3] = strong / 256; /* left actuator */
- xpad->odata[4] = 0x00;
- xpad->odata[5] = weak / 256; /* right actuator */
- xpad->irq_out->transfer_buffer_length = 6;
-
- return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
-
- case XTYPE_XBOX360:
- xpad->odata[0] = 0x00;
- xpad->odata[1] = 0x08;
- xpad->odata[2] = 0x00;
- xpad->odata[3] = strong / 256; /* left actuator? */
- xpad->odata[4] = weak / 256; /* right actuator? */
- xpad->odata[5] = 0x00;
- xpad->odata[6] = 0x00;
- xpad->odata[7] = 0x00;
- xpad->irq_out->transfer_buffer_length = 8;
-
- return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
-
- case XTYPE_XBOX360W:
- xpad->odata[0] = 0x00;
- xpad->odata[1] = 0x01;
- xpad->odata[2] = 0x0F;
- xpad->odata[3] = 0xC0;
- xpad->odata[4] = 0x00;
- xpad->odata[5] = strong / 256;
- xpad->odata[6] = weak / 256;
- xpad->odata[7] = 0x00;
- xpad->odata[8] = 0x00;
- xpad->odata[9] = 0x00;
- xpad->odata[10] = 0x00;
- xpad->odata[11] = 0x00;
- xpad->irq_out->transfer_buffer_length = 12;
-
- return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ mrdrv = xpad_make_rum_data(xpad, effect->u.rumble.strong_magnitude,
+ effect->u.rumble.weak_magnitude);
+
+ if (mrdrv == 0 && !xpad->odata_busy) {
+ memcpy(xpad->odata, xpad->rum_data, xpad->pend_rum);
+ xpad->irq_out->transfer_buffer_length = xpad->pend_rum;
+ xpad->pend_rum = 0;
+ xpad->odata_busy = 1;
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+
+ if (usb_submit_urb(xpad->irq_out, GFP_ATOMIC) != 0) {
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ xpad->odata_busy = 0;
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+ }
+ } else {
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+
+ if (mrdrv == 0) {
+ dev_dbg(&xpad->dev->dev,
+ "%s - rumble while urb busy\n", __func__);
+ }
+ }
- default:
+ if (mrdrv != 0) {
dev_dbg(&xpad->dev->dev,
"%s - rumble command sent to unsupported xpad type: %d\n",
__func__, xpad->xtype);
+
return -1;
}
}
@@ -716,13 +793,30 @@ struct xpad_led {
static void xpad_send_led_command(struct usb_xpad *xpad, int command)
{
if (command >= 0 && command < 14) {
- mutex_lock(&xpad->odata_mutex);
- xpad->odata[0] = 0x01;
- xpad->odata[1] = 0x03;
- xpad->odata[2] = command;
- xpad->irq_out->transfer_buffer_length = 3;
- usb_submit_urb(xpad->irq_out, GFP_KERNEL);
- mutex_unlock(&xpad->odata_mutex);
+ unsigned long flags;
+
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ xpad->led_data[0] = 0x01;
+ xpad->led_data[1] = 0x03;
+ xpad->led_data[2] = command;
+ xpad->pend_led = 3;
+
+ if (!xpad->odata_busy) {
+ memcpy(xpad->odata, xpad->led_data, xpad->pend_led);
+ xpad->irq_out->transfer_buffer_length = xpad->pend_led;
+ xpad->pend_led = 0;
+ xpad->odata_busy = 1;
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+
+ if (usb_submit_urb(xpad->irq_out, GFP_KERNEL) != 0) {
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ xpad->odata_busy = 0;
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+ }
+ } else {
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+ dev_dbg(&xpad->dev->dev, "%s - led while urb busy\n", __func__);
+ }
}
}
^ permalink raw reply
* Re: Re: [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem
From: Carlo Caione @ 2014-05-16 7:40 UTC (permalink / raw)
To: boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
Cc: Carlo Caione, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
lee.jones-QSEj5FYQhm4dnm+yROfE0A,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
In-Reply-To: <5375015A.10701-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
On Thu, May 15, 2014 at 8:03 PM, Boris BREZILLON
<boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> Hello Carlo,
>
> On 11/04/2014 11:38, Carlo Caione wrote:
>> AXP202 and AXP209 come with two synchronous step-down DC-DCs and five
>> LDOs. This patch introduces basic support for those regulators.
>>
>> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>> ---
>> drivers/regulator/Kconfig | 7 +
>> drivers/regulator/Makefile | 1 +
> [...]
>> + if (!np)
>> + return 0;
>> +
>> + regulators = of_find_node_by_name(np, "regulators");
>
> I know I'm late, and this patch has already been applied, but shouldn't
> we use of_get_child_by_name instead of of_find_node_by_name.
> This might lead to wrong regulators node parsing if other regulators are
> defined in the DT after the axp20x node, because, AFAIK, this function
> searches for DT nodes defined after the specified np node, but not
> necessarely children of the np node.
Right. I'll prepare a fix. Feel free to submit a patch if you want.
Thank you,
--
Carlo Caione
^ permalink raw reply
* Re: [PATCH] HID: rmi: fix masks for x and w_x data
From: Benjamin Tissoires @ 2014-05-15 21:11 UTC (permalink / raw)
To: Andrew Duggan; +Cc: linux-input, linux-kernel, Jiri Kosina
In-Reply-To: <1400187149-7619-1-git-send-email-aduggan@synaptics.com>
On May 15 2014 or thereabouts, Andrew Duggan wrote:
> The F11 data in the HID report contains four bits of data for w_x and the least significant bits
> of x. Currently only the first three bits are being used which is resulting in small jumps in
> the position data on the x axis and in the w_x data.
>
> Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
> ---
Good catch. I might have considered that 3:0 means 3 bits, not 4. I must
have been tired while writing it :)
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cheers,
Benjamin
> drivers/hid/hid-rmi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
> index 7ebdc96..c529b03 100644
> --- a/drivers/hid/hid-rmi.c
> +++ b/drivers/hid/hid-rmi.c
> @@ -277,9 +277,9 @@ static void rmi_f11_process_touch(struct rmi_data *hdata, int slot,
> input_mt_report_slot_state(hdata->input, MT_TOOL_FINGER,
> finger_state == 0x01);
> if (finger_state == 0x01) {
> - x = (touch_data[0] << 4) | (touch_data[2] & 0x07);
> + x = (touch_data[0] << 4) | (touch_data[2] & 0x0F);
> y = (touch_data[1] << 4) | (touch_data[2] >> 4);
> - wx = touch_data[3] & 0x07;
> + wx = touch_data[3] & 0x0F;
> wy = touch_data[3] >> 4;
> wide = (wx > wy);
> major = max(wx, wy);
> --
> 1.9.1
>
^ permalink raw reply
* [PATCH] HID: rmi: fix masks for x and w_x data
From: Andrew Duggan @ 2014-05-15 20:52 UTC (permalink / raw)
To: linux-input, linux-kernel; +Cc: Jiri Kosina, Benjamin Tissoires, Andrew Duggan
The F11 data in the HID report contains four bits of data for w_x and the least significant bits
of x. Currently only the first three bits are being used which is resulting in small jumps in
the position data on the x axis and in the w_x data.
Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
---
drivers/hid/hid-rmi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
index 7ebdc96..c529b03 100644
--- a/drivers/hid/hid-rmi.c
+++ b/drivers/hid/hid-rmi.c
@@ -277,9 +277,9 @@ static void rmi_f11_process_touch(struct rmi_data *hdata, int slot,
input_mt_report_slot_state(hdata->input, MT_TOOL_FINGER,
finger_state == 0x01);
if (finger_state == 0x01) {
- x = (touch_data[0] << 4) | (touch_data[2] & 0x07);
+ x = (touch_data[0] << 4) | (touch_data[2] & 0x0F);
y = (touch_data[1] << 4) | (touch_data[2] >> 4);
- wx = touch_data[3] & 0x07;
+ wx = touch_data[3] & 0x0F;
wy = touch_data[3] >> 4;
wide = (wx > wy);
major = max(wx, wy);
--
1.9.1
^ permalink raw reply related
* [PATCH RFC] Input: xpad: Prevent corruption of urb request.
From: Sarah Bessmer @ 2014-05-15 20:51 UTC (permalink / raw)
To: linux-input
xpad_play_effect() can easily be called faster than the rumble force-feedback urb request can complete,
which will cause corruption of the urb request and can eventually lead to a kernel panic.
This patch prevents that from happening, deferring rumble(and LED) updates to the urb request completion routine.
Patch was tested against a Logitech F510. (I was unable to test any LED functionality)
Signed-off-by: Sarah Bessmer <aotos@fastmail.fm>
---
--- linux-3.14.4/drivers/input/joystick/xpad.c.orig 2014-05-15 13:13:39.000000000 -0700
+++ linux-3.14.4/drivers/input/joystick/xpad.c 2014-05-15 13:28:09.000000000 -0700
@@ -78,6 +78,7 @@
#include <linux/stat.h>
#include <linux/module.h>
#include <linux/usb/input.h>
+#include <linux/spinlock.h>
#define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>"
#define DRIVER_DESC "X-Box pad driver"
@@ -282,7 +283,15 @@ struct usb_xpad {
struct urb *irq_out; /* urb for interrupt out report */
unsigned char *odata; /* output data */
dma_addr_t odata_dma;
- struct mutex odata_mutex;
+ int odata_busy;
+
+ spinlock_t pend_lock;
+
+ unsigned pend_rum;
+ unsigned char rum_data[XPAD_PKT_LEN];
+
+ unsigned pend_led;
+ unsigned char led_data[XPAD_PKT_LEN];
#endif
#if defined(CONFIG_JOYSTICK_XPAD_LEDS)
@@ -541,12 +550,36 @@ static void xpad_irq_out(struct urb *urb
struct usb_xpad *xpad = urb->context;
struct device *dev = &xpad->intf->dev;
int retval, status;
+ unsigned long flags;
status = urb->status;
switch (status) {
case 0:
/* success */
+ xpad->irq_out->transfer_buffer_length = 0;
+
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ if (xpad->pend_rum != 0) {
+ memcpy(xpad->odata, xpad->rum_data, xpad->pend_rum);
+ xpad->irq_out->transfer_buffer_length = xpad->pend_rum;
+ xpad->pend_rum = 0;
+ } else if (xpad->pend_led != 0) {
+ memcpy(xpad->odata, xpad->led_data, xpad->pend_led);
+ xpad->irq_out->transfer_buffer_length = xpad->pend_led;
+ xpad->pend_led = 0;
+ } else {
+ xpad->odata_busy = 0;
+ }
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+
+ if (xpad->irq_out->transfer_buffer_length != 0) {
+ if (usb_submit_urb(xpad->irq_out, GFP_ATOMIC) != 0) {
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ xpad->odata_busy = 0;
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+ }
+ }
return;
case -ECONNRESET:
@@ -555,19 +588,27 @@ static void xpad_irq_out(struct urb *urb
/* this urb is terminated, clean up */
dev_dbg(dev, "%s - urb shutting down with status: %d\n",
__func__, status);
+
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ xpad->odata_busy = 0;
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
return;
default:
dev_dbg(dev, "%s - nonzero urb status received: %d\n",
__func__, status);
- goto exit;
- }
-exit:
- retval = usb_submit_urb(urb, GFP_ATOMIC);
- if (retval)
- dev_err(dev, "%s - usb_submit_urb failed with result %d\n",
- __func__, retval);
+ retval = usb_submit_urb(urb, GFP_ATOMIC);
+ if (retval) {
+ dev_err(dev, "%s - usb_submit_urb failed with result %d\n",
+ __func__, retval);
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ xpad->odata_busy = 0;
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+ }
+
+ return;
+ }
}
static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad)
@@ -585,7 +626,12 @@ static int xpad_init_output(struct usb_i
goto fail1;
}
- mutex_init(&xpad->odata_mutex);
+ xpad->odata_busy = 0;
+
+ spin_lock_init(&xpad->pend_lock);
+
+ xpad->pend_rum = 0;
+ xpad->pend_led = 0;
xpad->irq_out = usb_alloc_urb(0, GFP_KERNEL);
if (!xpad->irq_out) {
@@ -628,61 +674,91 @@ static void xpad_stop_output(struct usb_
#endif
#ifdef CONFIG_JOYSTICK_XPAD_FF
+static int xpad_make_rum_data(struct usb_xpad *xpad, __u16 strong, __u16 weak)
+{
+ switch (xpad->xtype) {
+
+ case XTYPE_XBOX:
+ xpad->rum_data[0] = 0x00;
+ xpad->rum_data[1] = 0x06;
+ xpad->rum_data[2] = 0x00;
+ xpad->rum_data[3] = strong / 256; /* left actuator */
+ xpad->rum_data[4] = 0x00;
+ xpad->rum_data[5] = weak / 256; /* right actuator */
+ xpad->pend_rum = 6;
+ return 0;
+
+
+ case XTYPE_XBOX360:
+ xpad->rum_data[0] = 0x00;
+ xpad->rum_data[1] = 0x08;
+ xpad->rum_data[2] = 0x00;
+ xpad->rum_data[3] = strong / 256; /* left actuator? */
+ xpad->rum_data[4] = weak / 256; /* right actuator? */
+ xpad->rum_data[5] = 0x00;
+ xpad->rum_data[6] = 0x00;
+ xpad->rum_data[7] = 0x00;
+ xpad->pend_rum = 8;
+ return 0;
+
+ case XTYPE_XBOX360W:
+ xpad->rum_data[0] = 0x00;
+ xpad->rum_data[1] = 0x01;
+ xpad->rum_data[2] = 0x0F;
+ xpad->rum_data[3] = 0xC0;
+ xpad->rum_data[4] = 0x00;
+ xpad->rum_data[5] = strong / 256;
+ xpad->rum_data[6] = weak / 256;
+ xpad->rum_data[7] = 0x00;
+ xpad->rum_data[8] = 0x00;
+ xpad->rum_data[9] = 0x00;
+ xpad->rum_data[10] = 0x00;
+ xpad->rum_data[11] = 0x00;
+ xpad->pend_rum = 12;
+ return 0;
+
+ }
+ return -1;
+}
+
static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect *effect)
{
struct usb_xpad *xpad = input_get_drvdata(dev);
if (effect->type == FF_RUMBLE) {
- __u16 strong = effect->u.rumble.strong_magnitude;
- __u16 weak = effect->u.rumble.weak_magnitude;
-
- switch (xpad->xtype) {
+ unsigned long flags;
+ int mrdrv;
- case XTYPE_XBOX:
- xpad->odata[0] = 0x00;
- xpad->odata[1] = 0x06;
- xpad->odata[2] = 0x00;
- xpad->odata[3] = strong / 256; /* left actuator */
- xpad->odata[4] = 0x00;
- xpad->odata[5] = weak / 256; /* right actuator */
- xpad->irq_out->transfer_buffer_length = 6;
-
- return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
-
- case XTYPE_XBOX360:
- xpad->odata[0] = 0x00;
- xpad->odata[1] = 0x08;
- xpad->odata[2] = 0x00;
- xpad->odata[3] = strong / 256; /* left actuator? */
- xpad->odata[4] = weak / 256; /* right actuator? */
- xpad->odata[5] = 0x00;
- xpad->odata[6] = 0x00;
- xpad->odata[7] = 0x00;
- xpad->irq_out->transfer_buffer_length = 8;
-
- return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
-
- case XTYPE_XBOX360W:
- xpad->odata[0] = 0x00;
- xpad->odata[1] = 0x01;
- xpad->odata[2] = 0x0F;
- xpad->odata[3] = 0xC0;
- xpad->odata[4] = 0x00;
- xpad->odata[5] = strong / 256;
- xpad->odata[6] = weak / 256;
- xpad->odata[7] = 0x00;
- xpad->odata[8] = 0x00;
- xpad->odata[9] = 0x00;
- xpad->odata[10] = 0x00;
- xpad->odata[11] = 0x00;
- xpad->irq_out->transfer_buffer_length = 12;
-
- return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ mrdrv = xpad_make_rum_data(xpad, effect->u.rumble.strong_magnitude,
+ effect->u.rumble.weak_magnitude);
+
+ if (mrdrv == 0 && !xpad->odata_busy) {
+ memcpy(xpad->odata, xpad->rum_data, xpad->pend_rum);
+ xpad->irq_out->transfer_buffer_length = xpad->pend_rum;
+ xpad->pend_rum = 0;
+ xpad->odata_busy = 1;
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+
+ if (usb_submit_urb(xpad->irq_out, GFP_ATOMIC) != 0) {
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ xpad->odata_busy = 0;
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+ }
+ } else {
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+
+ if (mrdrv == 0) {
+ dev_dbg(&xpad->dev->dev,
+ "%s - rumble while urb busy\n", __func__);
+ }
+ }
- default:
+ if (mrdrv != 0) {
dev_dbg(&xpad->dev->dev,
"%s - rumble command sent to unsupported xpad type: %d\n",
__func__, xpad->xtype);
+
return -1;
}
}
@@ -716,13 +792,30 @@ struct xpad_led {
static void xpad_send_led_command(struct usb_xpad *xpad, int command)
{
if (command >= 0 && command < 14) {
- mutex_lock(&xpad->odata_mutex);
- xpad->odata[0] = 0x01;
- xpad->odata[1] = 0x03;
- xpad->odata[2] = command;
- xpad->irq_out->transfer_buffer_length = 3;
- usb_submit_urb(xpad->irq_out, GFP_KERNEL);
- mutex_unlock(&xpad->odata_mutex);
+ unsigned long flags;
+
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ xpad->led_data[0] = 0x01;
+ xpad->led_data[1] = 0x03;
+ xpad->led_data[2] = command;
+ xpad->pend_led = 3;
+
+ if (!xpad->odata_busy) {
+ memcpy(xpad->odata, xpad->led_data, xpad->pend_led);
+ xpad->irq_out->transfer_buffer_length = xpad->pend_led;
+ xpad->pend_led = 0;
+ xpad->odata_busy = 1;
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+
+ if (usb_submit_urb(xpad->irq_out, GFP_KERNEL) != 0) {
+ spin_lock_irqsave(&xpad->pend_lock, flags);
+ xpad->odata_busy = 0;
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+ }
+ } else {
+ spin_unlock_irqrestore(&xpad->pend_lock, flags);
+ dev_dbg(&xpad->dev->dev, "%s - led while urb busy\n", __func__);
+ }
}
}
^ permalink raw reply
* Re: [PATCHv3 0/5] tsc2005 DT binding
From: Aaro Koskinen @ 2014-05-15 19:16 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Dmitry Torokhov, Dmitry Torokhov, linux-input, Tony Lindgren,
Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
devicetree, linux-omap, linux-kernel
In-Reply-To: <20140515142315.GA15716@earth.universe>
Hi,
On Thu, May 15, 2014 at 04:23:16PM +0200, Sebastian Reichel wrote:
> On Sat, Apr 26, 2014 at 01:56:14AM +0200, Sebastian Reichel wrote:
> > This adds device tree support for the tsc2005 touchscreen
> > controller, which is currently only used by the Nokia N900
> > board.
> >
> > The patch does not update the reset pin handling for platform
> > data based probe to avoid merge conflicts. The n900 platform
> > code will be removed in the near future (3.16?) and the driver
> > can be simplified once that has happened.
>
> Ping. It would be nice to see this patchset in 3.16, since its
> the last important hardware component missing for N900 DT boot.
FWIW, for all these patches feel free to add:
Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Thanks for great work,
A.
^ permalink raw reply
* Re: [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem
From: Mark Brown @ 2014-05-15 18:18 UTC (permalink / raw)
To: Boris BREZILLON
Cc: Carlo Caione, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
lee.jones-QSEj5FYQhm4dnm+yROfE0A
In-Reply-To: <5375015A.10701-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 465 bytes --]
On Thu, May 15, 2014 at 08:03:06PM +0200, Boris BREZILLON wrote:
> I know I'm late, and this patch has already been applied, but shouldn't
> we use of_get_child_by_name instead of of_find_node_by_name.
> This might lead to wrong regulators node parsing if other regulators are
> defined in the DT after the axp20x node, because, AFAIK, this function
> searches for DT nodes defined after the specified np node, but not
> necessarely children of the np node.
Yes.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem
From: Boris BREZILLON @ 2014-05-15 18:03 UTC (permalink / raw)
To: Carlo Caione, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
lee.jones-QSEj5FYQhm4dnm+yROfE0A
In-Reply-To: <1397209093-10077-7-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
Hello Carlo,
On 11/04/2014 11:38, Carlo Caione wrote:
> AXP202 and AXP209 come with two synchronous step-down DC-DCs and five
> LDOs. This patch introduces basic support for those regulators.
>
> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> ---
> drivers/regulator/Kconfig | 7 +
> drivers/regulator/Makefile | 1 +
[...]
> + if (!np)
> + return 0;
> +
> + regulators = of_find_node_by_name(np, "regulators");
I know I'm late, and this patch has already been applied, but shouldn't
we use of_get_child_by_name instead of of_find_node_by_name.
This might lead to wrong regulators node parsing if other regulators are
defined in the DT after the axp20x node, because, AFAIK, this function
searches for DT nodes defined after the specified np node, but not
necessarely children of the np node.
Best Regards,
Boris
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply
* Re: [PATCHv3 0/5] tsc2005 DT binding
From: Sebastian Reichel @ 2014-05-15 14:23 UTC (permalink / raw)
To: Dmitry Torokhov, Dmitry Torokhov, linux-input, Tony Lindgren,
Rob Herring
Cc: Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
linux-omap, linux-kernel
In-Reply-To: <1398470179-20880-1-git-send-email-sre@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 592 bytes --]
On Sat, Apr 26, 2014 at 01:56:14AM +0200, Sebastian Reichel wrote:
> This adds device tree support for the tsc2005 touchscreen
> controller, which is currently only used by the Nokia N900
> board.
>
> The patch does not update the reset pin handling for platform
> data based probe to avoid merge conflicts. The n900 platform
> code will be removed in the near future (3.16?) and the driver
> can be simplified once that has happened.
Ping. It would be nice to see this patchset in 3.16, since its
the last important hardware component missing for N900 DT boot.
-- Sebastian
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH] input: gpio-keys: Move the gpio-keys bindings documentation
From: Ezequiel Garcia @ 2014-05-15 14:22 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: devicetree, linux-gpio, linux-input, Linus Walleij
In-Reply-To: <20140512175806.GB16764@core.coreip.homeip.net>
On 12 May 10:58 AM, Dmitry Torokhov wrote:
> On Mon, May 12, 2014 at 11:33:44AM -0300, Ezequiel Garcia wrote:
> > This is an input driver and belongs to input not gpio.
> >
> > Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
>
> Fine by me, will DT guys pick the patch or shoudl I do it?
>
I'd say it's just a small file movement, so go for it!
BTW, forgot to prepare the patch with rename detection, want me to resend it?
--
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" 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] Input: wacom: Use unaligned access where necessary
From: Dmitry Torokhov @ 2014-05-14 23:59 UTC (permalink / raw)
To: Jason Gerecke; +Cc: linux-input, pingc
In-Reply-To: <1400111184-18878-1-git-send-email-killertofu@gmail.com>
On Wed, May 14, 2014 at 04:46:24PM -0700, Jason Gerecke wrote:
> A few caes of incorrectly using 'le16_to_cpup' instead of
> 'get_unaligned_le16' have been noticed and fixed.
>
> Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Applied, thank you.
> ---
> drivers/input/tablet/wacom_wac.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
> index 1c779a6..20ea522 100644
> --- a/drivers/input/tablet/wacom_wac.c
> +++ b/drivers/input/tablet/wacom_wac.c
> @@ -988,12 +988,12 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
> input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
>
> if (touch) {
> - int t_x = le16_to_cpup((__le16 *)&data[offset + 2]);
> - int c_x = le16_to_cpup((__le16 *)&data[offset + 4]);
> - int t_y = le16_to_cpup((__le16 *)&data[offset + 6]);
> - int c_y = le16_to_cpup((__le16 *)&data[offset + 8]);
> - int w = le16_to_cpup((__le16 *)&data[offset + 10]);
> - int h = le16_to_cpup((__le16 *)&data[offset + 12]);
> + int t_x = get_unaligned_le16(&data[offset + 2]);
> + int c_x = get_unaligned_le16(&data[offset + 4]);
> + int t_y = get_unaligned_le16(&data[offset + 6]);
> + int c_y = get_unaligned_le16(&data[offset + 8]);
> + int w = get_unaligned_le16(&data[offset + 10]);
> + int h = get_unaligned_le16(&data[offset + 12]);
>
> input_report_abs(input, ABS_MT_POSITION_X, t_x);
> input_report_abs(input, ABS_MT_POSITION_Y, t_y);
> @@ -1038,7 +1038,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
> for (i = 0; i < contacts_to_send; i++) {
> int offset = (WACOM_BYTES_PER_MT_PACKET + x_offset) * i + 3;
> bool touch = data[offset] & 0x1;
> - int id = le16_to_cpup((__le16 *)&data[offset + 1]);
> + int id = get_unaligned_le16(&data[offset + 1]);
> int slot = input_mt_get_slot_by_key(input, id);
>
> if (slot < 0)
> @@ -1047,8 +1047,8 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
> input_mt_slot(input, slot);
> input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
> if (touch) {
> - int x = le16_to_cpup((__le16 *)&data[offset + x_offset + 7]);
> - int y = le16_to_cpup((__le16 *)&data[offset + x_offset + 9]);
> + int x = get_unaligned_le16(&data[offset + x_offset + 7]);
> + int y = get_unaligned_le16(&data[offset + x_offset + 9]);
> input_report_abs(input, ABS_MT_POSITION_X, x);
> input_report_abs(input, ABS_MT_POSITION_Y, y);
> }
> --
> 1.9.2
>
--
Dmitry
^ permalink raw reply
* [PATCH] Input: wacom: Use unaligned access where necessary
From: Jason Gerecke @ 2014-05-14 23:46 UTC (permalink / raw)
To: linux-input, pingc, dmitry.torokhov; +Cc: Jason Gerecke
A few caes of incorrectly using 'le16_to_cpup' instead of
'get_unaligned_le16' have been noticed and fixed.
Signed-off-by: Jason Gerecke <killertofu@gmail.com>
---
drivers/input/tablet/wacom_wac.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 1c779a6..20ea522 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -988,12 +988,12 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
if (touch) {
- int t_x = le16_to_cpup((__le16 *)&data[offset + 2]);
- int c_x = le16_to_cpup((__le16 *)&data[offset + 4]);
- int t_y = le16_to_cpup((__le16 *)&data[offset + 6]);
- int c_y = le16_to_cpup((__le16 *)&data[offset + 8]);
- int w = le16_to_cpup((__le16 *)&data[offset + 10]);
- int h = le16_to_cpup((__le16 *)&data[offset + 12]);
+ int t_x = get_unaligned_le16(&data[offset + 2]);
+ int c_x = get_unaligned_le16(&data[offset + 4]);
+ int t_y = get_unaligned_le16(&data[offset + 6]);
+ int c_y = get_unaligned_le16(&data[offset + 8]);
+ int w = get_unaligned_le16(&data[offset + 10]);
+ int h = get_unaligned_le16(&data[offset + 12]);
input_report_abs(input, ABS_MT_POSITION_X, t_x);
input_report_abs(input, ABS_MT_POSITION_Y, t_y);
@@ -1038,7 +1038,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
for (i = 0; i < contacts_to_send; i++) {
int offset = (WACOM_BYTES_PER_MT_PACKET + x_offset) * i + 3;
bool touch = data[offset] & 0x1;
- int id = le16_to_cpup((__le16 *)&data[offset + 1]);
+ int id = get_unaligned_le16(&data[offset + 1]);
int slot = input_mt_get_slot_by_key(input, id);
if (slot < 0)
@@ -1047,8 +1047,8 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
input_mt_slot(input, slot);
input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
if (touch) {
- int x = le16_to_cpup((__le16 *)&data[offset + x_offset + 7]);
- int y = le16_to_cpup((__le16 *)&data[offset + x_offset + 9]);
+ int x = get_unaligned_le16(&data[offset + x_offset + 7]);
+ int y = get_unaligned_le16(&data[offset + x_offset + 9]);
input_report_abs(input, ABS_MT_POSITION_X, x);
input_report_abs(input, ABS_MT_POSITION_Y, y);
}
--
1.9.2
^ permalink raw reply related
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