* Re: [PATCH 2/2] i2c-hid: remove mostly useless parameter 'debug'
From: Andy Shevchenko @ 2013-08-07 15:21 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Benjamin Tissoires, linux-input, Jiri Kosina, Mika Westerberg
In-Reply-To: <51FBF71E.1040802@redhat.com>
On Fri, 2013-08-02 at 20:14 +0200, Benjamin Tissoires wrote:
> On 02/08/13 16:49, Andy Shevchenko wrote:
> > Usually when I see such code I understood it was written in
> > pre-dynamic-debug epoch. So, my point is to switch to dynamic debug and
> > use it efficiently.
>
> Ok, so if you can guarantee me that adding the proper kernel parameter
> will allow me to retrieve all the i2c-hid logs from the boot, then I'd
> be happy to ack this. However, I have no way to test this right now, so
> I'll need to trust you (that's why I'm asking you to do proper testing).
Just to your information, I noticed that Greg KH did something like I
propose for usb drivers (misc, serial, ...).
So, it would be considered as third party opinion, I guess.
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply
* Re: [PATCH v2 1/1] input: ideapad_slidebar: new input driver
From: Dmitry Torokhov @ 2013-08-07 18:42 UTC (permalink / raw)
To: Andrey Moiseev
Cc: linux-input, arnoques, russianneuromancer, ike.pan, linux-kernel
In-Reply-To: <52022EAE.5040000@gmail.com>
Hi Andrey,
On Wed, Aug 07, 2013 at 03:25:34PM +0400, Andrey Moiseev wrote:
> +/* Keyboard handler */
> +static irq_handler_t kbd_irq_handler(int irq, void *dev_id,
> + struct pt_regs *regs)
> +{
> + /* Scancodes: e03b on move, bb on release */
> + int scancode = inb(0x60);
No, you should not just read KBC data without regard to what other
parts of kernel are doing (i8042 might be accessing it at the same time
because AUX IRQ was raised).
This driver has to be implemented as i8042 filter.
Thanks.
--
Dmitry
^ permalink raw reply
* Re: List corruption in hidraw_release in 3.11-rc4
From: Peter Wu @ 2013-08-07 22:28 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-input, Manoj Chourasia, linux-kernel, alnovak
In-Reply-To: <alpine.LNX.2.00.1308071533130.10425@pobox.suse.cz>
On Wednesday 07 August 2013 15:34:08 Jiri Kosina wrote:
> On Wed, 7 Aug 2013, Peter Wu wrote:
> > [..]
> > I have applied Manoj's patch[1] on top of 3.11-rc4 which seem to fix the
> > issue. One observation is that the new device is named /dev/hidraw1
> > instead of /dev/hidraw0. Example:
> >
> > f(){ hidraw-test /dev/hidraw$1 usb1;}
> > # needed for 3.11-rc4
> > f 1; f 1 # crash
> > # needed for 3.11-rc4 + patch
> > f 1; f 2 # ok
> >
> > Regards,
> > Peter
> >
> > [1]: http://lkml.org/lkml/2013/7/22/248
>
> That one I am still reviewing ... can I add your Tested-by: to it when
> I'll be applying it and pushing to Linus?
Sure, once you accept it you can add:
Tested-by: Peter Wu <lekensteyn@gmail.com>
While you are at it, are the other functions also safe? (i.e. hidraw_poll,
that one is not protected by any locks?)
Regards,
Peter
^ permalink raw reply
* [PATCH v3 1/1] input: ideapad_slidebar: new input driver
From: Andrey Moiseev @ 2013-08-08 9:38 UTC (permalink / raw)
To: linux-input
Cc: dmitry.torokhov, arnoques, russianneuromancer, ike.pan,
linux-kernel
v3: i8042 filter instead of direct keyboard access
ideapad_slidebar is a new driver which enables slidebars on some
Lenovo IdeaPad laptops (the slidebars work with SlideNav/Desktop
Navigator under Windows)
Fixes this: https://bugzilla.kernel.org/show_bug.cgi?id=16004
Registers 'IdeaPad Slidebar' input device and
/sys/devices/platform/ideapad_slidebar/slidebar_mode
for switching slidebar's modes.
Now works on:
IdeaPad Y550, Y550P.
May work on (testing and adding new models is needed):
Ideapad Y560, Y460, Y450, Y650,
and, probably, some others.
Driver source: https://github.com/o2genum/ideapad-slidebar.git
Patch is generated against current mainline kernel.
Signed-off-by: Andrey Moiseev <o2g.org.ru@gmail.com>
---
MAINTAINERS | 7 +
drivers/input/misc/Kconfig | 9 +
drivers/input/misc/Makefile | 1 +
drivers/input/misc/ideapad_slidebar.c | 377 ++++++++++++++++++++++++++++++++++
4 files changed, 394 insertions(+)
create mode 100644 drivers/input/misc/ideapad_slidebar.c
diff --git a/MAINTAINERS b/MAINTAINERS
index defc053..2ff3dd8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4096,6 +4096,13 @@ W: http://launchpad.net/ideapad-laptop
S: Maintained
F: drivers/platform/x86/ideapad-laptop.c
+IDEAPAD LAPTOP SLIDEBAR DRIVER
+M: Andrey Moiseev <o2g.org.ru@gmail.com>
+L: linux-input@vger.kernel.org
+W: https://github.com/o2genum/ideapad-slidebar
+S: Maintained
+F: drivers/input/misc/ideapad_slidebar.c
+
IDE/ATAPI DRIVERS
M: Borislav Petkov <bp@alien8.de>
L: linux-ide@vger.kernel.org
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 0b541cd..45729a9 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -647,4 +647,13 @@ config INPUT_SIRFSOC_ONKEY
If unsure, say N.
+config INPUT_IDEAPAD_SLIDEBAR
+ tristate "IdeaPad Laptop Slidebar"
+ depends on INPUT
+ help
+ Input driver for slidebars on some Lenovo IdeaPad laptops.
+
+ If you have an IdeaPad laptop with a slidebar, say Y or M here.
+ Module name is ideapad_slidebar.
+
endif
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 829de43..0ebfb6d 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -61,3 +61,4 @@ obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o
obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o
obj-$(CONFIG_INPUT_XEN_KBDDEV_FRONTEND) += xen-kbdfront.o
obj-$(CONFIG_INPUT_YEALINK) += yealink.o
+obj-$(CONFIG_INPUT_IDEAPAD_SLIDEBAR) += ideapad_slidebar.o
diff --git a/drivers/input/misc/ideapad_slidebar.c b/drivers/input/misc/ideapad_slidebar.c
new file mode 100644
index 0000000..c5b201f
--- /dev/null
+++ b/drivers/input/misc/ideapad_slidebar.c
@@ -0,0 +1,377 @@
+/*
+ * Input driver for slidebars on some Lenovo IdeaPad laptops
+ *
+ * Copyright (C) 2013 Andrey Moiseev <o2g.org.ru@gmail.com>
+ *
+ * Reverse-engineered from Lenovo SlideNav software (SBarHook.dll).
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * Trademarks are the property of their respective owners.
+ */
+
+/* Currently tested and works on:
+ * Lenovo IdeaPad Y550
+ * Lenovo IdeaPad Y550P
+ *
+ * Other models can be added easily. To test,
+ * load with 'force' parameter set 'true'.
+ *
+ * LEDs blinking and input mode are managed via sysfs,
+ * (hex, unsigned byte value):
+ * /sys/devices/platform/ideapad_slidebar/slidebar_mode
+ *
+ * The value is in byte range, however, I only figured out
+ * how bits 0b10011001 work. Some other bits, probably,
+ * are meaningfull too.
+ *
+ * Possible states:
+ *
+ * STD_INT, ONMOV_INT, OFF_INT, LAST_POLL, OFF_POLL
+ *
+ * Meaning:
+ * released touched
+ * STD 'heartbeat' lights follow the finger
+ * ONMOV no lights lights follow the finger
+ * LAST at last pos lights follow the finger
+ * OFF no lights no lights
+ *
+ * INT all input events are generated, interrupts are used
+ * POLL no input events by default, to get them,
+ * send 0b10000000 (read below)
+ *
+ * Commands: write
+ *
+ * All | 0b01001 -> STD_INT
+ * possible | 0b10001 -> ONMOV_INT
+ * states | 0b01000 -> OFF_INT
+ *
+ * | 0b0 -> LAST_POLL
+ * STD_INT or ONMOV_INT |
+ * | 0b1 -> STD_INT
+ *
+ * | 0b0 -> OFF_POLL
+ * OFF_INT or OFF_POLL |
+ * | 0b1 -> OFF_INT
+ *
+ * Any state | 0b10000000 -> if the slidebar has updated data,
+ * produce one input event (last position),
+ * switch to respective POLL mode
+ * (like 0x0), if not in POLL mode yet.
+ *
+ * Get current state: read
+ *
+ * masked by 0x11 read value means:
+ *
+ * 0x00 LAST
+ * 0x01 STD
+ * 0x10 OFF
+ * 0x11 ONMOV
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/dmi.h>
+#include <linux/spinlock.h>
+#include <linux/platform_device.h>
+#include <linux/input.h>
+#include <linux/io.h>
+#include <linux/i8042.h>
+
+static bool force;
+module_param(force, bool, 0);
+MODULE_PARM_DESC(force, "Force driver load, ignore DMI data");
+
+spinlock_t sio_lock = __SPIN_LOCK_UNLOCKED(sio_lock);
+
+static struct input_dev *slidebar_input_dev;
+static struct platform_device *slidebar_platform_dev;
+
+/* Hardware interacting */
+static int slidebar_pos_get(void)
+{
+ int res;
+ unsigned long flags;
+ spin_lock_irqsave(&sio_lock, flags);
+ outb(0xf4, 0xff29);
+ outb(0xbf, 0xff2a);
+ res = inb(0xff2b);
+ spin_unlock_irqrestore(&sio_lock, flags);
+ return res;
+}
+
+static unsigned char slidebar_mode_get(void)
+{
+ int res;
+ unsigned long flags;
+ spin_lock_irqsave(&sio_lock, flags);
+ outb(0xf7, 0xff29);
+ outb(0x8b, 0xff2a);
+ res = inb(0xff2b);
+ spin_unlock_irqrestore(&sio_lock, flags);
+ return res;
+}
+
+static void slidebar_mode_set(unsigned char mode)
+{
+ unsigned long flags;
+ spin_lock_irqsave(&sio_lock, flags);
+ outb(0xf7, 0xff29);
+ outb(0x8b, 0xff2a);
+ outb(mode, 0xff2b);
+ spin_unlock_irqrestore(&sio_lock, flags);
+}
+
+/* Listening the keyboard (i8042 filter) */
+static bool slidebar_i8042_filter(unsigned char data, unsigned char str,
+ struct serio *port)
+{
+ static bool extended, touched;
+ /* Scancodes: e03b on move, bb on release */
+ if (unlikely(data == 0xe0)) {
+ extended = true;
+ return false;
+ } else if (unlikely(extended && data == 0x3b)) {
+ extended = false;
+ if (!touched)
+ input_report_key(slidebar_input_dev, BTN_TOUCH, 1);
+ touched = true;
+ input_report_abs(slidebar_input_dev, ABS_X, slidebar_pos_get());
+ input_sync(slidebar_input_dev);
+ return false;
+ } else if (unlikely(!extended && data == 0xbb)) {
+ touched = false;
+ input_report_key(slidebar_input_dev, BTN_TOUCH, 0);
+ input_sync(slidebar_input_dev);
+ }
+
+ return false;
+}
+
+/* Input device */
+static int setup_input_dev(void)
+{
+ int err;
+
+ slidebar_input_dev = input_allocate_device();
+ if (!slidebar_input_dev) {
+ pr_err("ideapad_slidebar: Not enough memory\n");
+ return -ENOMEM;
+ }
+
+ slidebar_input_dev->name = "IdeaPad Slidebar";
+ slidebar_input_dev->id.bustype = BUS_HOST;
+ slidebar_input_dev->dev.parent = &slidebar_platform_dev->dev;
+ input_set_capability(slidebar_input_dev, EV_KEY, BTN_TOUCH);
+ input_set_capability(slidebar_input_dev, EV_ABS, ABS_X);
+ input_alloc_absinfo(slidebar_input_dev);
+ input_set_abs_params(slidebar_input_dev, ABS_X, 0, 0xff, 0, 0);
+
+ err = input_register_device(slidebar_input_dev);
+ if (err) {
+ pr_err("ideapad_slidebar: Failed to register device\n");
+ goto err_free_dev;
+ }
+
+ err = i8042_install_filter(slidebar_i8042_filter);
+ if (err) {
+ pr_err("ideapad_slidebar: Can't install i8042 filter \n");
+ goto err_unregister_dev;
+ }
+ return 0;
+
+err_unregister_dev:
+ input_unregister_device(slidebar_input_dev);
+err_free_dev:
+ input_free_device(slidebar_input_dev);
+ return err;
+}
+
+static void remove_input_dev(void)
+{
+ i8042_remove_filter(slidebar_i8042_filter);
+ input_unregister_device(slidebar_input_dev);
+ input_free_device(slidebar_input_dev);
+}
+
+/* Sysfs slidebar_mode interface */
+static ssize_t show_slidebar_mode(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ return sprintf(buf, "%x\n", slidebar_mode_get());
+}
+
+static ssize_t store_slidebar_mode(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ int mode;
+ if (!count)
+ return 0;
+
+ if (sscanf(buf, "%x", &mode) != 1)
+ return -EINVAL;
+
+ slidebar_mode_set(mode);
+ return count;
+}
+
+static DEVICE_ATTR(slidebar_mode, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH,
+ show_slidebar_mode, store_slidebar_mode);
+
+static struct attribute *ideapad_attributes[] = {
+ &dev_attr_slidebar_mode.attr,
+ NULL
+};
+
+static struct attribute_group ideapad_attribute_group = {
+ .attrs = ideapad_attributes
+};
+
+static int setup_slidebar_mode_dev(void)
+{
+ return sysfs_create_group(&slidebar_platform_dev->dev.kobj,
+ &ideapad_attribute_group);
+}
+
+static void remove_slidebar_mode_dev(void)
+{
+ return sysfs_remove_group(&slidebar_platform_dev->dev.kobj,
+ &ideapad_attribute_group);
+}
+
+/* Platform device */
+static int setup_platform_dev(void)
+{
+ int err;
+ slidebar_platform_dev = platform_device_alloc("ideapad_slidebar", -1);
+ if (!slidebar_platform_dev) {
+ pr_err("ideapad_slidebar: Not enough memory\n");
+ return -ENOMEM;
+ }
+
+ err = platform_device_add(slidebar_platform_dev);
+ if (err) {
+ pr_err("ideapad_slidebar: Failed to register plarform device\n");
+ goto err_free_platform_device;
+ }
+ return 0;
+
+err_free_platform_device:
+ platform_device_put(slidebar_platform_dev);
+ return err;
+}
+
+static void remove_platform_dev(void)
+{
+ platform_device_del(slidebar_platform_dev);
+ platform_device_put(slidebar_platform_dev);
+}
+
+/* Platform driver */
+static struct platform_driver slidebar_drv = {
+ .driver = {
+ .name = "ideapad_slidebar",
+ .owner = THIS_MODULE,
+ },
+};
+
+static int register_platform_drv(void)
+{
+ int err;
+ err = platform_driver_register(&slidebar_drv);
+ if (err)
+ pr_err("ideapad_slidebar: Failed to register platform driver\n");
+
+ return err;
+}
+
+static void unregister_platform_drv(void)
+{
+ platform_driver_unregister(&slidebar_drv);
+}
+
+/* DMI */
+static int ideapad_dmi_check(const struct dmi_system_id *id)
+{
+ pr_info("ideapad_slidebar: Laptop model '%s'\n", id->ident);
+ return 1;
+}
+
+static struct dmi_system_id __initdata ideapad_dmi_table[] = {
+ {
+ .ident = "Lenovo IdeaPad Y550",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "20017"),
+ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y550")
+ },
+ .callback = ideapad_dmi_check
+ },
+ {
+ .ident = "Lenovo IdeaPad Y550P",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "20035"),
+ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y550P")
+ },
+ .callback = ideapad_dmi_check
+ }
+};
+
+/* Init and cleanup */
+static int __init slidebar_init(void)
+{
+ int err;
+
+ if (!force && !dmi_check_system(ideapad_dmi_table))
+ return -ENODEV;
+
+ err = setup_platform_dev();
+ if (err)
+ return err;
+
+ err = register_platform_drv();
+ if (err)
+ goto err_remove_platform_dev;
+
+ err = setup_input_dev();
+ if (err)
+ goto err_unregister_platform_drv;
+
+ err = setup_slidebar_mode_dev();
+ if (err)
+ goto err_remove_input_dev;
+ return 0;
+
+err_remove_input_dev:
+ remove_input_dev();
+err_unregister_platform_drv:
+ unregister_platform_drv();
+err_remove_platform_dev:
+ remove_platform_dev();
+ return err;
+}
+
+static void __exit slidebar_exit(void)
+{
+ remove_slidebar_mode_dev();
+ remove_input_dev();
+ remove_platform_dev();
+ unregister_platform_drv();
+}
+
+module_init(slidebar_init);
+module_exit(slidebar_exit);
+
+MODULE_AUTHOR("Andrey Moiseev <o2g.org.ru@gmail.com>");
+MODULE_DESCRIPTION("Slidebar input support for some Lenovo IdeaPad laptops");
+MODULE_LICENSE("GPL");
+MODULE_VERSION("0.1");
+
+MODULE_ALIAS("dmi:*:svnLENOVO:pn20017:pvrLenovoIdeaPadY550:*");
+MODULE_ALIAS("dmi:*:svnLENOVO:pn20035:pvrLenovoIdeaPadY550P:*");
--
1.8.3.4
^ permalink raw reply related
* Re: [PATCH 1/2] include: dt-binding: input: create a DT header defining key codes.
From: Laxman Dewangan @ 2013-08-08 17:11 UTC (permalink / raw)
To: Stephen Warren
Cc: dmitry.torokhov@gmail.com, Stephen Warren, linux@arm.linux.org.uk,
linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
devicetree@vger.kernel.org, Ian Campbell, Rob Herring, Pawel Moll,
Mark Rutland
In-Reply-To: <52014E50.6030508@wwwdotorg.org>
On Wednesday 07 August 2013 12:58 AM, Stephen Warren wrote:
> (CC'ing DT bindings maintainers too, hence quoting a bit of the patch)
>
> On 08/06/2013 08:12 AM, Laxman Dewangan wrote:
>> Many of Key device tree bindings uses the constant number as key code
>> which matches with kernel header key code and then comment as follows
>> for reference/better readability:
>> linux,code = <102>; /* KEY_HOME */
>>
>> Create a DT header which defines all the key code so that DT key bindings
>> can use it as follows:
>> linux,code = <KEY_HOME>;
> This looks fine to me.
> Reviewed-by: Stephen Warren <swarren@nvidia.com>
>
> A comment in support of the patch: This is adding OS-specific content to
> the DT. However, the bindings this header file supports are already
> written that way. There's not really any alternative here, since some
> numbering scheme had to be chosen for keycodes, and it may as well be
> the same set as the first/primary OS that'll use the binding.
>
> As far as merging it, this patch should probably go through the core DT
> tree, perhaps in a topic branch so that e.g. Tegra an MVEBU can merge it
> in to apply your subsequent patches (or we can just wait until the next
> kernel release to merge them in).
Do I need to include anyone for this patch to be applied or can go
through Dmitry's input git branch?
^ permalink raw reply
* Re: [PATCH 1/2] include: dt-binding: input: create a DT header defining key codes.
From: Dmitry Torokhov @ 2013-08-08 17:13 UTC (permalink / raw)
To: Laxman Dewangan
Cc: Stephen Warren, Stephen Warren,
linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Ian Campbell,
Rob Herring, Pawel Moll, Mark Rutland
In-Reply-To: <5203D138.4030107-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
On Thu, Aug 08, 2013 at 10:41:20PM +0530, Laxman Dewangan wrote:
> On Wednesday 07 August 2013 12:58 AM, Stephen Warren wrote:
> >(CC'ing DT bindings maintainers too, hence quoting a bit of the patch)
> >
> >On 08/06/2013 08:12 AM, Laxman Dewangan wrote:
> >>Many of Key device tree bindings uses the constant number as key code
> >>which matches with kernel header key code and then comment as follows
> >>for reference/better readability:
> >> linux,code = <102>; /* KEY_HOME */
> >>
> >>Create a DT header which defines all the key code so that DT key bindings
> >>can use it as follows:
> >> linux,code = <KEY_HOME>;
> >This looks fine to me.
> >Reviewed-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> >
> >A comment in support of the patch: This is adding OS-specific content to
> >the DT. However, the bindings this header file supports are already
> >written that way. There's not really any alternative here, since some
> >numbering scheme had to be chosen for keycodes, and it may as well be
> >the same set as the first/primary OS that'll use the binding.
> >
> >As far as merging it, this patch should probably go through the core DT
> >tree, perhaps in a topic branch so that e.g. Tegra an MVEBU can merge it
> >in to apply your subsequent patches (or we can just wait until the next
> >kernel release to merge them in).
>
> Do I need to include anyone for this patch to be applied or can go
> through Dmitry's input git branch?
I am uncomfortable that we are duplicating the whole list of keycodes
here. Do you think we could split keycodes and other event codes from
include/uapi/linux/input.h into include/uapi/linux/input-events.h and
unclude it directly into DTS?
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH 1/2] include: dt-binding: input: create a DT header defining key codes.
From: Laxman Dewangan @ 2013-08-08 17:32 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Stephen Warren, Stephen Warren, linux@arm.linux.org.uk,
linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
devicetree@vger.kernel.org, Ian Campbell, Rob Herring, Pawel Moll,
Mark Rutland
In-Reply-To: <20130808171331.GA6960@core.coreip.homeip.net>
On Thursday 08 August 2013 10:43 PM, Dmitry Torokhov wrote:
> On Thu, Aug 08, 2013 at 10:41:20PM +0530, Laxman Dewangan wrote:
>> On Wednesday 07 August 2013 12:58 AM, Stephen Warren wrote:
>>> (CC'ing DT bindings maintainers too, hence quoting a bit of the patch)
>>>
>>> On 08/06/2013 08:12 AM, Laxman Dewangan wrote:
>>>> Many of Key device tree bindings uses the constant number as key code
>>>> which matches with kernel header key code and then comment as follows
>>>> for reference/better readability:
>>>> linux,code = <102>; /* KEY_HOME */
>>>>
>>>> Create a DT header which defines all the key code so that DT key bindings
>>>> can use it as follows:
>>>> linux,code = <KEY_HOME>;
>>> This looks fine to me.
>>> Reviewed-by: Stephen Warren <swarren@nvidia.com>
>>>
>>> A comment in support of the patch: This is adding OS-specific content to
>>> the DT. However, the bindings this header file supports are already
>>> written that way. There's not really any alternative here, since some
>>> numbering scheme had to be chosen for keycodes, and it may as well be
>>> the same set as the first/primary OS that'll use the binding.
>>>
>>> As far as merging it, this patch should probably go through the core DT
>>> tree, perhaps in a topic branch so that e.g. Tegra an MVEBU can merge it
>>> in to apply your subsequent patches (or we can just wait until the next
>>> kernel release to merge them in).
>> Do I need to include anyone for this patch to be applied or can go
>> through Dmitry's input git branch?
> I am uncomfortable that we are duplicating the whole list of keycodes
> here. Do you think we could split keycodes and other event codes from
> include/uapi/linux/input.h into include/uapi/linux/input-events.h and
> unclude it directly into DTS?
Yes, it will be very much possible to split this but I am not sure it is
allowed to include the header in DTS file which is not inside
include/dt-bindings.
If there is no limitation/restriction then we can split this adn amke
single header for key code which will be used by code and dts.
^ permalink raw reply
* Re: [PATCH 1/2] include: dt-binding: input: create a DT header defining key codes.
From: Stephen Warren @ 2013-08-08 17:25 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Laxman Dewangan, Stephen Warren, linux@arm.linux.org.uk,
linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
devicetree@vger.kernel.org, Ian Campbell, Rob Herring, Pawel Moll,
Mark Rutland
In-Reply-To: <20130808171331.GA6960@core.coreip.homeip.net>
On 08/08/2013 11:13 AM, Dmitry Torokhov wrote:
> On Thu, Aug 08, 2013 at 10:41:20PM +0530, Laxman Dewangan wrote:
>> On Wednesday 07 August 2013 12:58 AM, Stephen Warren wrote:
>>> (CC'ing DT bindings maintainers too, hence quoting a bit of the patch)
>>>
>>> On 08/06/2013 08:12 AM, Laxman Dewangan wrote:
>>>> Many of Key device tree bindings uses the constant number as key code
>>>> which matches with kernel header key code and then comment as follows
>>>> for reference/better readability:
>>>> linux,code = <102>; /* KEY_HOME */
>>>>
>>>> Create a DT header which defines all the key code so that DT key bindings
>>>> can use it as follows:
>>>> linux,code = <KEY_HOME>;
...
> I am uncomfortable that we are duplicating the whole list of keycodes
> here. Do you think we could split keycodes and other event codes from
> include/uapi/linux/input.h into include/uapi/linux/input-events.h and
> unclude it directly into DTS?
Device tree files can only include headers in include/dt-bindings.
Eventually/soon, all the DT files and the headers in the dt-bindings/
directory will be split out into a separate git tree, which does not
have access to include/uapi, or indeed any other Linux kernel header files.
^ permalink raw reply
* [PATCH 1/1] HID: hidraw: need to grab minors_lock in hidraw_report_event
From: yonghua zheng @ 2013-08-09 8:45 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-input
[-- Attachment #1: Type: text/plain, Size: 3380 bytes --]
Hi Jiri,
We met another kernel panic issue in hidraw_report_event while using
BT remote on our Android system, the panic log below shows a unhandle
kernel paging request at virtual address 001000f0, this can happen if
hidraw_report_event access a hidraw_list node which is already removed
by list_del() in hidraw_release.
One last thing list_del() does is set entry->next = LIST_POISON1;
where LIST_POISON1 is 00100100, and this should be able to explain why
panic address is 001000f0, hidraw_report_event try to access somewhere
in struct hidraw_list:
[ 1337.530941] Unable to handle kernel paging request at virtual
address 001000f0
[ 1337.538679] pgd = a0570000
[ 1337.541877] [001000f0] *pgd=00000000
[ 1337.545884] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
[ 1337.551373] Modules linked in: mbt8787 fusion(O) gal3d amp_core(O)
[ 1337.557834] CPU: 0 Tainted: G O (3.4.50+ #1)
[ 1337.563512] PC is at hidraw_report_event+0x38/0x98
[ 1337.568462] LR is at hidraw_report_event+0x70/0x98
[ 1337.573412] pc : [<8035286c>] lr : [<803528a4>] psr: a0000013
[ 1337.573416] sp : a0eede30 ip : a0eede30 fp : a0eede54
[ 1337.575086] [amp_driver] [vpp isr] MsgQ full
[ 1337.589671] r10: a0b7e4c0 r9 : a035b800 r8 : a0bb002c
[ 1337.595068] r7 : a0b7e4e4 r6 : 00000001 r5 : 0000001f r4 : 000ffef0
[ 1337.601809] r3 : a36db808 r2 : 00000020 r1 : 0000001f r0 : a0bb002c
[ 1337.608553] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
[ 1337.615923] Control: 10c5387d Table: 2157004a DAC: 00000015
So the fix is to grab the minors_lock to avoid list_del in the middle
of hidraw_report_event()
>From 725ed6c402f36e34479739a8d6c68f78f2f96d31 Mon Sep 17 00:00:00 2001
From: Yonghua Zheng <younghua.zheng@gmail.com>
Date: Fri, 9 Aug 2013 15:54:59 +0800
Subject: [PATCH 1/1] HID: hidraw: need to grab minors_lock in
hidraw_report_event
It is unsafe to call list_for_each_entry to go through each hidraw_list
node without grabing the minors_lock, because the dev->list can be
modified if other process calls hidraw_release to list_del itself from
the same &dev->list, if this happens, it can result in kernel panic
due to unable handle kernel paging request at invalid virtual address
Signed-off-by: Yonghua Zheng <younghua.zheng@gmail.com>
---
drivers/hid/hidraw.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 6f1feb2..8b408c4 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -458,6 +458,7 @@ int hidraw_report_event(struct hid_device *hid, u8
*data, int len)
struct hidraw_list *list;
int ret = 0;
+ mutex_lock(&minors_lock);
list_for_each_entry(list, &dev->list, node) {
int new_head = (list->head + 1) & (HIDRAW_BUFFER_SIZE - 1);
@@ -465,6 +466,7 @@ int hidraw_report_event(struct hid_device *hid, u8
*data, int len)
continue;
if (!(list->buffer[list->head].value = kmemdup(data, len,
GFP_ATOMIC))) {
+ mutex_unlock(&minors_lock);
ret = -ENOMEM;
break;
}
@@ -472,6 +474,7 @@ int hidraw_report_event(struct hid_device *hid, u8
*data, int len)
list->head = new_head;
kill_fasync(&list->fasync, SIGIO, POLL_IN);
}
+ mutex_unlock(&minors_lock);
wake_up_interruptible(&dev->wait);
return ret;
--
1.7.9.5
Best regards
Yonghua
[-- Attachment #2: 0001-HID-hidraw-need-to-grab-minors_lock-in-hidraw_report.patch --]
[-- Type: application/octet-stream, Size: 1636 bytes --]
From 725ed6c402f36e34479739a8d6c68f78f2f96d31 Mon Sep 17 00:00:00 2001
From: Yonghua Zheng <younghua.zheng@gmail.com>
Date: Fri, 9 Aug 2013 15:54:59 +0800
Subject: [PATCH 1/1] HID: hidraw: need to grab minors_lock in
hidraw_report_event
It is unsafe to call list_for_each_entry to go through each hidraw_list
node without grabing the minors_lock, because the dev->list can be
modified if other process calls hidraw_release to list_del itself from
the same &dev->list, if this happens, it can result in kernel panic
due to unable handle kernel paging request at invalid virtual address
Signed-off-by: Yonghua Zheng <younghua.zheng@gmail.com>
---
drivers/hid/hidraw.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 6f1feb2..8b408c4 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -458,6 +458,7 @@ int hidraw_report_event(struct hid_device *hid, u8 *data, int len)
struct hidraw_list *list;
int ret = 0;
+ mutex_lock(&minors_lock);
list_for_each_entry(list, &dev->list, node) {
int new_head = (list->head + 1) & (HIDRAW_BUFFER_SIZE - 1);
@@ -465,6 +466,7 @@ int hidraw_report_event(struct hid_device *hid, u8 *data, int len)
continue;
if (!(list->buffer[list->head].value = kmemdup(data, len, GFP_ATOMIC))) {
+ mutex_unlock(&minors_lock);
ret = -ENOMEM;
break;
}
@@ -472,6 +474,7 @@ int hidraw_report_event(struct hid_device *hid, u8 *data, int len)
list->head = new_head;
kill_fasync(&list->fasync, SIGIO, POLL_IN);
}
+ mutex_unlock(&minors_lock);
wake_up_interruptible(&dev->wait);
return ret;
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH 2/2] HID: hid-logitech-dj, querying_devices was never set
From: Jiri Kosina @ 2013-08-09 9:36 UTC (permalink / raw)
To: Sune Mølgaard
Cc: Benjamin Tissoires, Nestor Lopez Casado, Andrew de los Reyes,
joseph.salisbury, linux-input, linux-kernel@vger.kernel.org
In-Reply-To: <520164A5.2020008@molgaard.org>
On Tue, 6 Aug 2013, Sune Mølgaard wrote:
> Being affected by this bug, I can confirm that Linux 3.11-rc4 still
> exhibits the unwanted behaviour for me, but that commenting out the
> single line from the second patch makes it work.
>
> Thus, for requesting a revert on that line, you are most welcome to put
> me down as a "Tested-By".
Okay, this is now queued, and I will be pushing it to Linus.
Thanks,
--
Jiri Kosina
SUSE Labs
--
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 v4 1/1] input: ideapad_slidebar: new input driver
From: Andrey Moiseev @ 2013-08-10 7:49 UTC (permalink / raw)
To: linux-input
Cc: dmitry.torokhov, arnoques, russianneuromancer, ike.pan,
linux-kernel
v4: fixed broken BTN_TOUCH events
ideapad_slidebar is a new driver which enables slidebars on some
Lenovo IdeaPad laptops (the slidebars work with SlideNav/Desktop
Navigator under Windows)
Fixes this: https://bugzilla.kernel.org/show_bug.cgi?id=16004
Registers 'IdeaPad Slidebar' input device and
/sys/devices/platform/ideapad_slidebar/slidebar_mode
for switching slidebar's modes.
Now works on:
IdeaPad Y550, Y550P.
May work on (testing and adding new models is needed):
Ideapad Y560, Y460, Y450, Y650,
and, probably, some others.
Driver source: https://github.com/o2genum/ideapad-slidebar.git
Patch is generated against current mainline kernel.
Signed-off-by: Andrey Moiseev <o2g.org.ru@gmail.com>
---
MAINTAINERS | 7 +
drivers/input/misc/Kconfig | 9 +
drivers/input/misc/Makefile | 1 +
drivers/input/misc/ideapad_slidebar.c | 378 ++++++++++++++++++++++++++++++++++
4 files changed, 395 insertions(+)
create mode 100644 drivers/input/misc/ideapad_slidebar.c
diff --git a/MAINTAINERS b/MAINTAINERS
index defc053..2ff3dd8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4096,6 +4096,13 @@ W: http://launchpad.net/ideapad-laptop
S: Maintained
F: drivers/platform/x86/ideapad-laptop.c
+IDEAPAD LAPTOP SLIDEBAR DRIVER
+M: Andrey Moiseev <o2g.org.ru@gmail.com>
+L: linux-input@vger.kernel.org
+W: https://github.com/o2genum/ideapad-slidebar
+S: Maintained
+F: drivers/input/misc/ideapad_slidebar.c
+
IDE/ATAPI DRIVERS
M: Borislav Petkov <bp@alien8.de>
L: linux-ide@vger.kernel.org
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 0b541cd..45729a9 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -647,4 +647,13 @@ config INPUT_SIRFSOC_ONKEY
If unsure, say N.
+config INPUT_IDEAPAD_SLIDEBAR
+ tristate "IdeaPad Laptop Slidebar"
+ depends on INPUT
+ help
+ Input driver for slidebars on some Lenovo IdeaPad laptops.
+
+ If you have an IdeaPad laptop with a slidebar, say Y or M here.
+ Module name is ideapad_slidebar.
+
endif
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 829de43..0ebfb6d 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -61,3 +61,4 @@ obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o
obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o
obj-$(CONFIG_INPUT_XEN_KBDDEV_FRONTEND) += xen-kbdfront.o
obj-$(CONFIG_INPUT_YEALINK) += yealink.o
+obj-$(CONFIG_INPUT_IDEAPAD_SLIDEBAR) += ideapad_slidebar.o
diff --git a/drivers/input/misc/ideapad_slidebar.c b/drivers/input/misc/ideapad_slidebar.c
new file mode 100644
index 0000000..1145d7b
--- /dev/null
+++ b/drivers/input/misc/ideapad_slidebar.c
@@ -0,0 +1,378 @@
+/*
+ * Input driver for slidebars on some Lenovo IdeaPad laptops
+ *
+ * Copyright (C) 2013 Andrey Moiseev <o2g.org.ru@gmail.com>
+ *
+ * Reverse-engineered from Lenovo SlideNav software (SBarHook.dll).
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * Trademarks are the property of their respective owners.
+ */
+
+/* Currently tested and works on:
+ * Lenovo IdeaPad Y550
+ * Lenovo IdeaPad Y550P
+ *
+ * Other models can be added easily. To test,
+ * load with 'force' parameter set 'true'.
+ *
+ * LEDs blinking and input mode are managed via sysfs,
+ * (hex, unsigned byte value):
+ * /sys/devices/platform/ideapad_slidebar/slidebar_mode
+ *
+ * The value is in byte range, however, I only figured out
+ * how bits 0b10011001 work. Some other bits, probably,
+ * are meaningfull too.
+ *
+ * Possible states:
+ *
+ * STD_INT, ONMOV_INT, OFF_INT, LAST_POLL, OFF_POLL
+ *
+ * Meaning:
+ * released touched
+ * STD 'heartbeat' lights follow the finger
+ * ONMOV no lights lights follow the finger
+ * LAST at last pos lights follow the finger
+ * OFF no lights no lights
+ *
+ * INT all input events are generated, interrupts are used
+ * POLL no input events by default, to get them,
+ * send 0b10000000 (read below)
+ *
+ * Commands: write
+ *
+ * All | 0b01001 -> STD_INT
+ * possible | 0b10001 -> ONMOV_INT
+ * states | 0b01000 -> OFF_INT
+ *
+ * | 0b0 -> LAST_POLL
+ * STD_INT or ONMOV_INT |
+ * | 0b1 -> STD_INT
+ *
+ * | 0b0 -> OFF_POLL
+ * OFF_INT or OFF_POLL |
+ * | 0b1 -> OFF_INT
+ *
+ * Any state | 0b10000000 -> if the slidebar has updated data,
+ * produce one input event (last position),
+ * switch to respective POLL mode
+ * (like 0x0), if not in POLL mode yet.
+ *
+ * Get current state: read
+ *
+ * masked by 0x11 read value means:
+ *
+ * 0x00 LAST
+ * 0x01 STD
+ * 0x10 OFF
+ * 0x11 ONMOV
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/dmi.h>
+#include <linux/spinlock.h>
+#include <linux/platform_device.h>
+#include <linux/input.h>
+#include <linux/io.h>
+#include <linux/i8042.h>
+
+static bool force;
+module_param(force, bool, 0);
+MODULE_PARM_DESC(force, "Force driver load, ignore DMI data");
+
+spinlock_t sio_lock = __SPIN_LOCK_UNLOCKED(sio_lock);
+
+static struct input_dev *slidebar_input_dev;
+static struct platform_device *slidebar_platform_dev;
+
+/* Hardware interacting */
+static int slidebar_pos_get(void)
+{
+ int res;
+ unsigned long flags;
+ spin_lock_irqsave(&sio_lock, flags);
+ outb(0xf4, 0xff29);
+ outb(0xbf, 0xff2a);
+ res = inb(0xff2b);
+ spin_unlock_irqrestore(&sio_lock, flags);
+ return res;
+}
+
+static unsigned char slidebar_mode_get(void)
+{
+ int res;
+ unsigned long flags;
+ spin_lock_irqsave(&sio_lock, flags);
+ outb(0xf7, 0xff29);
+ outb(0x8b, 0xff2a);
+ res = inb(0xff2b);
+ spin_unlock_irqrestore(&sio_lock, flags);
+ return res;
+}
+
+static void slidebar_mode_set(unsigned char mode)
+{
+ unsigned long flags;
+ spin_lock_irqsave(&sio_lock, flags);
+ outb(0xf7, 0xff29);
+ outb(0x8b, 0xff2a);
+ outb(mode, 0xff2b);
+ spin_unlock_irqrestore(&sio_lock, flags);
+}
+
+/* Listening the keyboard (i8042 filter) */
+static bool slidebar_i8042_filter(unsigned char data, unsigned char str,
+ struct serio *port)
+{
+ static bool extended = false, touched = false;
+
+ /* Scancodes: e03b on move, bb on release */
+ if (unlikely(data == 0xe0)) {
+ extended = true;
+ return false;
+ } else if (unlikely(extended && (data == 0x3b))) {
+ extended = false;
+ if (!touched)
+ input_report_key(slidebar_input_dev, BTN_TOUCH, 1);
+ touched = true;
+ input_report_abs(slidebar_input_dev, ABS_X, slidebar_pos_get());
+ input_sync(slidebar_input_dev);
+ return false;
+ } else if (unlikely(extended && (data == 0xbb))) {
+ touched = false;
+ input_report_key(slidebar_input_dev, BTN_TOUCH, 0);
+ input_sync(slidebar_input_dev);
+ }
+
+ return false;
+}
+
+/* Input device */
+static int setup_input_dev(void)
+{
+ int err;
+
+ slidebar_input_dev = input_allocate_device();
+ if (!slidebar_input_dev) {
+ pr_err("ideapad_slidebar: Not enough memory\n");
+ return -ENOMEM;
+ }
+
+ slidebar_input_dev->name = "IdeaPad Slidebar";
+ slidebar_input_dev->id.bustype = BUS_HOST;
+ slidebar_input_dev->dev.parent = &slidebar_platform_dev->dev;
+ input_set_capability(slidebar_input_dev, EV_KEY, BTN_TOUCH);
+ input_set_capability(slidebar_input_dev, EV_ABS, ABS_X);
+ input_alloc_absinfo(slidebar_input_dev);
+ input_set_abs_params(slidebar_input_dev, ABS_X, 0, 0xff, 0, 0);
+
+ err = input_register_device(slidebar_input_dev);
+ if (err) {
+ pr_err("ideapad_slidebar: Failed to register device\n");
+ goto err_free_dev;
+ }
+
+ err = i8042_install_filter(slidebar_i8042_filter);
+ if (err) {
+ pr_err("ideapad_slidebar: Can't install i8042 filter \n");
+ goto err_unregister_dev;
+ }
+ return 0;
+
+err_unregister_dev:
+ input_unregister_device(slidebar_input_dev);
+err_free_dev:
+ input_free_device(slidebar_input_dev);
+ return err;
+}
+
+static void remove_input_dev(void)
+{
+ i8042_remove_filter(slidebar_i8042_filter);
+ input_unregister_device(slidebar_input_dev);
+ input_free_device(slidebar_input_dev);
+}
+
+/* Sysfs slidebar_mode interface */
+static ssize_t show_slidebar_mode(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ return sprintf(buf, "%x\n", slidebar_mode_get());
+}
+
+static ssize_t store_slidebar_mode(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ int mode;
+ if (!count)
+ return 0;
+
+ if (sscanf(buf, "%x", &mode) != 1)
+ return -EINVAL;
+
+ slidebar_mode_set(mode);
+ return count;
+}
+
+static DEVICE_ATTR(slidebar_mode, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH,
+ show_slidebar_mode, store_slidebar_mode);
+
+static struct attribute *ideapad_attributes[] = {
+ &dev_attr_slidebar_mode.attr,
+ NULL
+};
+
+static struct attribute_group ideapad_attribute_group = {
+ .attrs = ideapad_attributes
+};
+
+static int setup_slidebar_mode_dev(void)
+{
+ return sysfs_create_group(&slidebar_platform_dev->dev.kobj,
+ &ideapad_attribute_group);
+}
+
+static void remove_slidebar_mode_dev(void)
+{
+ return sysfs_remove_group(&slidebar_platform_dev->dev.kobj,
+ &ideapad_attribute_group);
+}
+
+/* Platform device */
+static int setup_platform_dev(void)
+{
+ int err;
+ slidebar_platform_dev = platform_device_alloc("ideapad_slidebar", -1);
+ if (!slidebar_platform_dev) {
+ pr_err("ideapad_slidebar: Not enough memory\n");
+ return -ENOMEM;
+ }
+
+ err = platform_device_add(slidebar_platform_dev);
+ if (err) {
+ pr_err("ideapad_slidebar: Failed to register plarform device\n");
+ goto err_free_platform_device;
+ }
+ return 0;
+
+err_free_platform_device:
+ platform_device_put(slidebar_platform_dev);
+ return err;
+}
+
+static void remove_platform_dev(void)
+{
+ platform_device_del(slidebar_platform_dev);
+ platform_device_put(slidebar_platform_dev);
+}
+
+/* Platform driver */
+static struct platform_driver slidebar_drv = {
+ .driver = {
+ .name = "ideapad_slidebar",
+ .owner = THIS_MODULE,
+ },
+};
+
+static int register_platform_drv(void)
+{
+ int err;
+ err = platform_driver_register(&slidebar_drv);
+ if (err)
+ pr_err("ideapad_slidebar: Failed to register platform driver\n");
+
+ return err;
+}
+
+static void unregister_platform_drv(void)
+{
+ platform_driver_unregister(&slidebar_drv);
+}
+
+/* DMI */
+static int ideapad_dmi_check(const struct dmi_system_id *id)
+{
+ pr_info("ideapad_slidebar: Laptop model '%s'\n", id->ident);
+ return 1;
+}
+
+static struct dmi_system_id __initdata ideapad_dmi_table[] = {
+ {
+ .ident = "Lenovo IdeaPad Y550",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "20017"),
+ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y550")
+ },
+ .callback = ideapad_dmi_check
+ },
+ {
+ .ident = "Lenovo IdeaPad Y550P",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "20035"),
+ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y550P")
+ },
+ .callback = ideapad_dmi_check
+ }
+};
+
+/* Init and cleanup */
+static int __init slidebar_init(void)
+{
+ int err;
+
+ if (!force && !dmi_check_system(ideapad_dmi_table))
+ return -ENODEV;
+
+ err = setup_platform_dev();
+ if (err)
+ return err;
+
+ err = register_platform_drv();
+ if (err)
+ goto err_remove_platform_dev;
+
+ err = setup_input_dev();
+ if (err)
+ goto err_unregister_platform_drv;
+
+ err = setup_slidebar_mode_dev();
+ if (err)
+ goto err_remove_input_dev;
+ return 0;
+
+err_remove_input_dev:
+ remove_input_dev();
+err_unregister_platform_drv:
+ unregister_platform_drv();
+err_remove_platform_dev:
+ remove_platform_dev();
+ return err;
+}
+
+static void __exit slidebar_exit(void)
+{
+ remove_slidebar_mode_dev();
+ remove_input_dev();
+ remove_platform_dev();
+ unregister_platform_drv();
+}
+
+module_init(slidebar_init);
+module_exit(slidebar_exit);
+
+MODULE_AUTHOR("Andrey Moiseev <o2g.org.ru@gmail.com>");
+MODULE_DESCRIPTION("Slidebar input support for some Lenovo IdeaPad laptops");
+MODULE_LICENSE("GPL");
+MODULE_VERSION("0.1");
+
+MODULE_ALIAS("dmi:*:svnLENOVO:pn20017:pvrLenovoIdeaPadY550:*");
+MODULE_ALIAS("dmi:*:svnLENOVO:pn20035:pvrLenovoIdeaPadY550P:*");
--
1.8.3.4
^ permalink raw reply related
* Re: [PATCH 2/2] HID: hid-logitech-dj, querying_devices was never set
From: Jiri Kosina @ 2013-08-10 17:21 UTC (permalink / raw)
To: Sune Mølgaard
Cc: Benjamin Tissoires, Nestor Lopez Casado, Andrew de los Reyes,
joseph.salisbury, linux-input, linux-kernel@vger.kernel.org
In-Reply-To: <520164A5.2020008@molgaard.org>
On Tue, 6 Aug 2013, Sune Mølgaard wrote:
> Being affected by this bug, I can confirm that Linux 3.11-rc4 still
> exhibits the unwanted behaviour for me, but that commenting out the
> single line from the second patch makes it work.
>
> Thus, for requesting a revert on that line, you are most welcome to put
> me down as a "Tested-By".
Will be reverted in 3.11-rc5 (8e5654ce69).
Thanks,
--
Jiri Kosina
SUSE Labs
--
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 1/3] Input: wistron_btns - Fix incorrect placement of __initconst
From: Sachin Kamat @ 2013-08-12 9:33 UTC (permalink / raw)
To: linux-input; +Cc: dmitry.torokhov, sachin.kamat, Miloslav Trmac
__initconst should be placed between the variable name and equal
sign for the variable to be placed in the intended section.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Miloslav Trmac <mitr@volny.cz>
---
drivers/input/misc/wistron_btns.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index 56536f4b9..35c33c6 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -635,7 +635,7 @@ static struct key_entry keymap_prestigio[] __initdata = {
* a list of buttons and their key codes (reported when loading this module
* with force=1) and the output of dmidecode to $MODULE_AUTHOR.
*/
-static const struct dmi_system_id __initconst dmi_ids[] = {
+static const struct dmi_system_id dmi_ids[] __initconst = {
{
/* Fujitsu-Siemens Amilo Pro V2000 */
.callback = dmi_matched,
--
1.7.9.5
^ permalink raw reply related
* [PATCH 2/3] Input: lifebook - Fix incorrect placement of __initconst
From: Sachin Kamat @ 2013-08-12 9:33 UTC (permalink / raw)
To: linux-input; +Cc: dmitry.torokhov, sachin.kamat
In-Reply-To: <1376300001-16706-1-git-send-email-sachin.kamat@linaro.org>
__initconst should be placed between the variable name and equal
sign for the variable to be placed in the intended section.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
drivers/input/mouse/lifebook.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index 2c4db63..23222dd5 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -44,7 +44,7 @@ static int lifebook_set_6byte_proto(const struct dmi_system_id *d)
return 1;
}
-static const struct dmi_system_id __initconst lifebook_dmi_table[] = {
+static const struct dmi_system_id lifebook_dmi_table[] __initconst = {
{
/* FLORA-ie 55mi */
.matches = {
--
1.7.9.5
^ permalink raw reply related
* [PATCH 3/3] Input: synaptics - Fix incorrect placement of __initconst
From: Sachin Kamat @ 2013-08-12 9:33 UTC (permalink / raw)
To: linux-input; +Cc: dmitry.torokhov, sachin.kamat
In-Reply-To: <1376300001-16706-1-git-send-email-sachin.kamat@linaro.org>
__initconst should be placed between the variable name and equal
sign for the variable to be placed in the intended section.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
drivers/input/mouse/synaptics.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index b2420ae..26386f9 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -1433,7 +1433,7 @@ static int synaptics_reconnect(struct psmouse *psmouse)
static bool impaired_toshiba_kbc;
-static const struct dmi_system_id __initconst toshiba_dmi_table[] = {
+static const struct dmi_system_id toshiba_dmi_table[] __initconst = {
#if defined(CONFIG_DMI) && defined(CONFIG_X86)
{
/* Toshiba Satellite */
@@ -1472,7 +1472,7 @@ static const struct dmi_system_id __initconst toshiba_dmi_table[] = {
static bool broken_olpc_ec;
-static const struct dmi_system_id __initconst olpc_dmi_table[] = {
+static const struct dmi_system_id olpc_dmi_table[] __initconst = {
#if defined(CONFIG_DMI) && defined(CONFIG_OLPC)
{
/* OLPC XO-1 or XO-1.5 */
--
1.7.9.5
^ permalink raw reply related
* [PATCH v5 1/1] input: ideapad_slidebar: new input driver
From: Andrey Moiseev @ 2013-08-12 10:23 UTC (permalink / raw)
To: linux-input
Cc: dmitry.torokhov, arnoques, russianneuromancer, ike.pan,
linux-kernel
v5: __initconst goes after var name
ideapad_slidebar is a new driver which enables slidebars on some
Lenovo IdeaPad laptops (the slidebars work with SlideNav/Desktop
Navigator under Windows)
Fixes this: https://bugzilla.kernel.org/show_bug.cgi?id=16004
Registers 'IdeaPad Slidebar' input device and
/sys/devices/platform/ideapad_slidebar/slidebar_mode
for switching slidebar's modes.
Now works on:
IdeaPad Y550, Y550P.
May work on (testing and adding new models is needed):
Ideapad Y560, Y460, Y450, Y650,
and, probably, some others.
Driver source: https://github.com/o2genum/ideapad-slidebar.git
Patch is generated against current mainline kernel.
Signed-off-by: Andrey Moiseev <o2g.org.ru@gmail.com>
---
MAINTAINERS | 7 +
drivers/input/misc/Kconfig | 9 +
drivers/input/misc/Makefile | 1 +
drivers/input/misc/ideapad_slidebar.c | 380 ++++++++++++++++++++++++++++++++++
4 files changed, 397 insertions(+)
create mode 100644 drivers/input/misc/ideapad_slidebar.c
diff --git a/MAINTAINERS b/MAINTAINERS
index defc053..2ff3dd8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4096,6 +4096,13 @@ W: http://launchpad.net/ideapad-laptop
S: Maintained
F: drivers/platform/x86/ideapad-laptop.c
+IDEAPAD LAPTOP SLIDEBAR DRIVER
+M: Andrey Moiseev <o2g.org.ru@gmail.com>
+L: linux-input@vger.kernel.org
+W: https://github.com/o2genum/ideapad-slidebar
+S: Maintained
+F: drivers/input/misc/ideapad_slidebar.c
+
IDE/ATAPI DRIVERS
M: Borislav Petkov <bp@alien8.de>
L: linux-ide@vger.kernel.org
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 0b541cd..45729a9 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -647,4 +647,13 @@ config INPUT_SIRFSOC_ONKEY
If unsure, say N.
+config INPUT_IDEAPAD_SLIDEBAR
+ tristate "IdeaPad Laptop Slidebar"
+ depends on INPUT
+ help
+ Input driver for slidebars on some Lenovo IdeaPad laptops.
+
+ If you have an IdeaPad laptop with a slidebar, say Y or M here.
+ Module name is ideapad_slidebar.
+
endif
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 829de43..0ebfb6d 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -61,3 +61,4 @@ obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o
obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o
obj-$(CONFIG_INPUT_XEN_KBDDEV_FRONTEND) += xen-kbdfront.o
obj-$(CONFIG_INPUT_YEALINK) += yealink.o
+obj-$(CONFIG_INPUT_IDEAPAD_SLIDEBAR) += ideapad_slidebar.o
diff --git a/drivers/input/misc/ideapad_slidebar.c b/drivers/input/misc/ideapad_slidebar.c
new file mode 100644
index 0000000..df437a4
--- /dev/null
+++ b/drivers/input/misc/ideapad_slidebar.c
@@ -0,0 +1,380 @@
+/*
+ * Input driver for slidebars on some Lenovo IdeaPad laptops
+ *
+ * Copyright (C) 2013 Andrey Moiseev <o2g.org.ru@gmail.com>
+ *
+ * Reverse-engineered from Lenovo SlideNav software (SBarHook.dll).
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * Trademarks are the property of their respective owners.
+ */
+
+/*
+ * Currently tested and works on:
+ * Lenovo IdeaPad Y550
+ * Lenovo IdeaPad Y550P
+ *
+ * Other models can be added easily. To test,
+ * load with 'force' parameter set 'true'.
+ *
+ * LEDs blinking and input mode are managed via sysfs,
+ * (hex, unsigned byte value):
+ * /sys/devices/platform/ideapad_slidebar/slidebar_mode
+ *
+ * The value is in byte range, however, I only figured out
+ * how bits 0b10011001 work. Some other bits, probably,
+ * are meaningfull too.
+ *
+ * Possible states:
+ *
+ * STD_INT, ONMOV_INT, OFF_INT, LAST_POLL, OFF_POLL
+ *
+ * Meaning:
+ * released touched
+ * STD 'heartbeat' lights follow the finger
+ * ONMOV no lights lights follow the finger
+ * LAST at last pos lights follow the finger
+ * OFF no lights no lights
+ *
+ * INT all input events are generated, interrupts are used
+ * POLL no input events by default, to get them,
+ * send 0b10000000 (read below)
+ *
+ * Commands: write
+ *
+ * All | 0b01001 -> STD_INT
+ * possible | 0b10001 -> ONMOV_INT
+ * states | 0b01000 -> OFF_INT
+ *
+ * | 0b0 -> LAST_POLL
+ * STD_INT or ONMOV_INT |
+ * | 0b1 -> STD_INT
+ *
+ * | 0b0 -> OFF_POLL
+ * OFF_INT or OFF_POLL |
+ * | 0b1 -> OFF_INT
+ *
+ * Any state | 0b10000000 -> if the slidebar has updated data,
+ * produce one input event (last position),
+ * switch to respective POLL mode
+ * (like 0x0), if not in POLL mode yet.
+ *
+ * Get current state: read
+ *
+ * masked by 0x11 read value means:
+ *
+ * 0x00 LAST
+ * 0x01 STD
+ * 0x10 OFF
+ * 0x11 ONMOV
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/dmi.h>
+#include <linux/spinlock.h>
+#include <linux/platform_device.h>
+#include <linux/input.h>
+#include <linux/io.h>
+#include <linux/i8042.h>
+
+static bool force;
+module_param(force, bool, 0);
+MODULE_PARM_DESC(force, "Force driver load, ignore DMI data");
+
+static spinlock_t sio_lock = __SPIN_LOCK_UNLOCKED(sio_lock);
+
+static struct input_dev *slidebar_input_dev;
+static struct platform_device *slidebar_platform_dev;
+
+/* Hardware interacting */
+static int slidebar_pos_get(void)
+{
+ int res;
+ unsigned long flags;
+ spin_lock_irqsave(&sio_lock, flags);
+ outb(0xf4, 0xff29);
+ outb(0xbf, 0xff2a);
+ res = inb(0xff2b);
+ spin_unlock_irqrestore(&sio_lock, flags);
+ return res;
+}
+
+static unsigned char slidebar_mode_get(void)
+{
+ int res;
+ unsigned long flags;
+ spin_lock_irqsave(&sio_lock, flags);
+ outb(0xf7, 0xff29);
+ outb(0x8b, 0xff2a);
+ res = inb(0xff2b);
+ spin_unlock_irqrestore(&sio_lock, flags);
+ return res;
+}
+
+static void slidebar_mode_set(unsigned char mode)
+{
+ unsigned long flags;
+ spin_lock_irqsave(&sio_lock, flags);
+ outb(0xf7, 0xff29);
+ outb(0x8b, 0xff2a);
+ outb(mode, 0xff2b);
+ spin_unlock_irqrestore(&sio_lock, flags);
+}
+
+/* Listening the keyboard (i8042 filter) */
+static bool slidebar_i8042_filter(unsigned char data, unsigned char str,
+ struct serio *port)
+{
+ static bool extended = false, touched = false;
+
+ /* Scancodes: e03b on move, e0bb on release */
+ if (unlikely(data == 0xe0)) {
+ extended = true;
+ return false;
+ } else if (unlikely(extended && (data == 0x3b))) {
+ extended = false;
+ if (!touched)
+ input_report_key(slidebar_input_dev, BTN_TOUCH, 1);
+ touched = true;
+ input_report_abs(slidebar_input_dev, ABS_X, slidebar_pos_get());
+ input_sync(slidebar_input_dev);
+ return false;
+ } else if (unlikely(extended && (data == 0xbb))) {
+ touched = false;
+ input_report_key(slidebar_input_dev, BTN_TOUCH, 0);
+ input_sync(slidebar_input_dev);
+ }
+
+ return false;
+}
+
+/* Input device */
+static int setup_input_dev(void)
+{
+ int err;
+
+ slidebar_input_dev = input_allocate_device();
+ if (!slidebar_input_dev) {
+ pr_err("ideapad_slidebar: Not enough memory\n");
+ return -ENOMEM;
+ }
+
+ slidebar_input_dev->name = "IdeaPad Slidebar";
+ slidebar_input_dev->id.bustype = BUS_HOST;
+ slidebar_input_dev->dev.parent = &slidebar_platform_dev->dev;
+ input_set_capability(slidebar_input_dev, EV_KEY, BTN_TOUCH);
+ input_set_capability(slidebar_input_dev, EV_ABS, ABS_X);
+ input_alloc_absinfo(slidebar_input_dev);
+ input_set_abs_params(slidebar_input_dev, ABS_X, 0, 0xff, 0, 0);
+
+ err = input_register_device(slidebar_input_dev);
+ if (err) {
+ pr_err("ideapad_slidebar: Failed to register device\n");
+ goto err_free_dev;
+ }
+
+ err = i8042_install_filter(slidebar_i8042_filter);
+ if (err) {
+ pr_err("ideapad_slidebar: Can't install i8042 filter \n");
+ goto err_unregister_dev;
+ }
+ return 0;
+
+err_unregister_dev:
+ input_unregister_device(slidebar_input_dev);
+err_free_dev:
+ input_free_device(slidebar_input_dev);
+ return err;
+}
+
+static void remove_input_dev(void)
+{
+ i8042_remove_filter(slidebar_i8042_filter);
+ input_unregister_device(slidebar_input_dev);
+ input_free_device(slidebar_input_dev);
+}
+
+/* Sysfs slidebar_mode interface */
+static ssize_t show_slidebar_mode(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ return sprintf(buf, "%x\n", slidebar_mode_get());
+}
+
+static ssize_t store_slidebar_mode(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ int mode;
+ if (!count)
+ return 0;
+
+ if (sscanf(buf, "%x", &mode) != 1)
+ return -EINVAL;
+
+ slidebar_mode_set(mode);
+ return count;
+}
+
+static DEVICE_ATTR(slidebar_mode, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH,
+ show_slidebar_mode, store_slidebar_mode);
+
+static struct attribute *ideapad_attributes[] = {
+ &dev_attr_slidebar_mode.attr,
+ NULL
+};
+
+static struct attribute_group ideapad_attribute_group = {
+ .attrs = ideapad_attributes
+};
+
+static int setup_slidebar_mode_dev(void)
+{
+ return sysfs_create_group(&slidebar_platform_dev->dev.kobj,
+ &ideapad_attribute_group);
+}
+
+static void remove_slidebar_mode_dev(void)
+{
+ return sysfs_remove_group(&slidebar_platform_dev->dev.kobj,
+ &ideapad_attribute_group);
+}
+
+/* Platform device */
+static int setup_platform_dev(void)
+{
+ int err;
+ slidebar_platform_dev = platform_device_alloc("ideapad_slidebar", -1);
+ if (!slidebar_platform_dev) {
+ pr_err("ideapad_slidebar: Not enough memory\n");
+ return -ENOMEM;
+ }
+
+ err = platform_device_add(slidebar_platform_dev);
+ if (err) {
+ pr_err("ideapad_slidebar: Failed to register plarform device\n");
+ goto err_free_platform_device;
+ }
+ return 0;
+
+err_free_platform_device:
+ platform_device_put(slidebar_platform_dev);
+ return err;
+}
+
+static void remove_platform_dev(void)
+{
+ platform_device_del(slidebar_platform_dev);
+ platform_device_put(slidebar_platform_dev);
+}
+
+/* Platform driver */
+static struct platform_driver slidebar_drv = {
+ .driver = {
+ .name = "ideapad_slidebar",
+ .owner = THIS_MODULE,
+ },
+};
+
+static int register_platform_drv(void)
+{
+ int err;
+ err = platform_driver_register(&slidebar_drv);
+ if (err)
+ pr_err("ideapad_slidebar: Failed to register platform driver\n");
+
+ return err;
+}
+
+static void unregister_platform_drv(void)
+{
+ platform_driver_unregister(&slidebar_drv);
+}
+
+/* DMI */
+static int ideapad_dmi_check(const struct dmi_system_id *id)
+{
+ pr_info("ideapad_slidebar: Laptop model '%s'\n", id->ident);
+ return 1;
+}
+
+static struct dmi_system_id ideapad_dmi_table[] __initconst = {
+ {
+ .ident = "Lenovo IdeaPad Y550",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "20017"),
+ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y550")
+ },
+ .callback = ideapad_dmi_check
+ },
+ {
+ .ident = "Lenovo IdeaPad Y550P",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "20035"),
+ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y550P")
+ },
+ .callback = ideapad_dmi_check
+ },
+ { }
+};
+
+/* Init and cleanup */
+static int __init slidebar_init(void)
+{
+ int err;
+
+ if (!force && !dmi_check_system(ideapad_dmi_table))
+ return -ENODEV;
+
+ err = setup_platform_dev();
+ if (err)
+ return err;
+
+ err = register_platform_drv();
+ if (err)
+ goto err_remove_platform_dev;
+
+ err = setup_input_dev();
+ if (err)
+ goto err_unregister_platform_drv;
+
+ err = setup_slidebar_mode_dev();
+ if (err)
+ goto err_remove_input_dev;
+ return 0;
+
+err_remove_input_dev:
+ remove_input_dev();
+err_unregister_platform_drv:
+ unregister_platform_drv();
+err_remove_platform_dev:
+ remove_platform_dev();
+ return err;
+}
+
+static void __exit slidebar_exit(void)
+{
+ remove_slidebar_mode_dev();
+ remove_input_dev();
+ remove_platform_dev();
+ unregister_platform_drv();
+}
+
+module_init(slidebar_init);
+module_exit(slidebar_exit);
+
+MODULE_AUTHOR("Andrey Moiseev <o2g.org.ru@gmail.com>");
+MODULE_DESCRIPTION("Slidebar input support for some Lenovo IdeaPad laptops");
+MODULE_LICENSE("GPL");
+MODULE_VERSION("0.1");
+
+MODULE_ALIAS("dmi:*:svnLENOVO:pn20017:pvrLenovoIdeaPadY550:*");
+MODULE_ALIAS("dmi:*:svnLENOVO:pn20035:pvrLenovoIdeaPadY550P:*");
--
1.8.3.4
^ permalink raw reply related
* Re: [PATCH 1/2] include: dt-binding: input: create a DT header defining key codes.
From: Dmitry Torokhov @ 2013-08-12 17:15 UTC (permalink / raw)
To: Stephen Warren
Cc: Laxman Dewangan, Stephen Warren,
linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Ian Campbell,
Rob Herring, Pawel Moll, Mark Rutland
In-Reply-To: <5203D487.5020507-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
On Thu, Aug 08, 2013 at 11:25:27AM -0600, Stephen Warren wrote:
> On 08/08/2013 11:13 AM, Dmitry Torokhov wrote:
> > On Thu, Aug 08, 2013 at 10:41:20PM +0530, Laxman Dewangan wrote:
> >> On Wednesday 07 August 2013 12:58 AM, Stephen Warren wrote:
> >>> (CC'ing DT bindings maintainers too, hence quoting a bit of the patch)
> >>>
> >>> On 08/06/2013 08:12 AM, Laxman Dewangan wrote:
> >>>> Many of Key device tree bindings uses the constant number as key code
> >>>> which matches with kernel header key code and then comment as follows
> >>>> for reference/better readability:
> >>>> linux,code = <102>; /* KEY_HOME */
> >>>>
> >>>> Create a DT header which defines all the key code so that DT key bindings
> >>>> can use it as follows:
> >>>> linux,code = <KEY_HOME>;
> ...
> > I am uncomfortable that we are duplicating the whole list of keycodes
> > here. Do you think we could split keycodes and other event codes from
> > include/uapi/linux/input.h into include/uapi/linux/input-events.h and
> > unclude it directly into DTS?
>
> Device tree files can only include headers in include/dt-bindings.
> Eventually/soon, all the DT files and the headers in the dt-bindings/
> directory will be split out into a separate git tree, which does not
> have access to include/uapi, or indeed any other Linux kernel header files.
OK, that makes it easier for me - please merge through whatever tree
that owns include/dt-bindings.
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH 1/2] include: dt-binding: input: create a DT header defining key codes.
From: Stephen Warren @ 2013-08-12 17:59 UTC (permalink / raw)
To: Dmitry Torokhov, Laxman Dewangan, Rob Herring
Cc: Stephen Warren, linux@arm.linux.org.uk,
linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
devicetree@vger.kernel.org, Ian Campbell, Pawel Moll,
Mark Rutland
In-Reply-To: <20130812171504.GA31418@core.coreip.homeip.net>
On 08/12/2013 11:15 AM, Dmitry Torokhov wrote:
> On Thu, Aug 08, 2013 at 11:25:27AM -0600, Stephen Warren wrote:
>> On 08/08/2013 11:13 AM, Dmitry Torokhov wrote:
>>> On Thu, Aug 08, 2013 at 10:41:20PM +0530, Laxman Dewangan wrote:
>>>> On Wednesday 07 August 2013 12:58 AM, Stephen Warren wrote:
>>>>> (CC'ing DT bindings maintainers too, hence quoting a bit of the patch)
>>>>>
>>>>> On 08/06/2013 08:12 AM, Laxman Dewangan wrote:
>>>>>> Many of Key device tree bindings uses the constant number as key code
>>>>>> which matches with kernel header key code and then comment as follows
>>>>>> for reference/better readability:
>>>>>> linux,code = <102>; /* KEY_HOME */
>>>>>>
>>>>>> Create a DT header which defines all the key code so that DT key bindings
>>>>>> can use it as follows:
>>>>>> linux,code = <KEY_HOME>;
>> ...
>>> I am uncomfortable that we are duplicating the whole list of keycodes
>>> here. Do you think we could split keycodes and other event codes from
>>> include/uapi/linux/input.h into include/uapi/linux/input-events.h and
>>> unclude it directly into DTS?
>>
>> Device tree files can only include headers in include/dt-bindings.
>> Eventually/soon, all the DT files and the headers in the dt-bindings/
>> directory will be split out into a separate git tree, which does not
>> have access to include/uapi, or indeed any other Linux kernel header files.
>
> OK, that makes it easier for me - please merge through whatever tree
> that owns include/dt-bindings.
Are there any objections to my taking both patches through the Tegra
tree? Patch 2/2 depends on 1/2 and is Tegra-specific. This should work
out fine unless anyone else wants to use the new header this kernel
cycle; if they do, this should go into a topic branch in the DT tree
that I can pull into the Tegra tree.
^ permalink raw reply
* Re: [PATCH 1/2] Revert "Revert "HID: Fix logitech-dj: missing Unifying device issue""
From: Peter Wu @ 2013-08-12 21:54 UTC (permalink / raw)
To: Peter Hurley
Cc: Nestor Lopez Casado, jkosina, benjamin.tissoires, adlr,
joseph.salisbury, linux-input, linux-kernel, Sarah Sharp,
linux-usb
In-Reply-To: <51E84FD1.4050400@hurleysoftware.com>
On Thursday 18 July 2013 16:28:01 Peter Hurley wrote:
> Before we revert to using the workaround, I'd like to suggest that
> this new "hidden" problem may be an interaction with the xhci_hcd host
> controller driver only.
>
> Looking at the related bug, the OP indicates the machine only has
> USB3 ports. Additionally, comments #7, #100, and #104 of the original
> bug report add additional information that would seem to confirm
> this suspicion.
>
> Let me add I have this USB device running on the uhci_hcd driver
> with or without this workaround on v3.10.
This problem does not seem specific to xhci, uhci seems also effected. Today I
upgraded a system (running Arch Linux) from kernel 3.9.9 to 3.10.5. After a
reboot to 3.10.5, things broke. The setup:
- There are two USB receivers plugged into USB 1.1 ports (different buses
according to lsusb, uhci), each receiver is paired to a K360 keyboard.
- One of the receivers are passed to a QEMU guest with -usbdevice host:$busid.
$devid. This keyboard is working (probably because QEMU performed a reset).
- Since 3.10.5, the keyboard that is *not* passed to the QEMU guest is not
functioning on reboot.
After closing the QEMU guest, the USB bus gets reset(?) after which the other
keyboard suddenly gets detected. I had only booted 3.10.5 twice before rolling
back to 3.9.9, both boots triggered the issue. Do I need to provide a usbmon,
lsusb, dmesg and/ or other details from 3.10.5?
Note that there are other Arch Linux users who have reported issues[1][2]
since upgrading to 3.10.z. Triggering a re-enumeration by writing the magic
HID++ message[3] makes the paired devices appear again (as reported in
forums[1], I haven't tried this on the affected UHCI machine).
While the underlying bug is fixed, can this patch be forwarded to stable? I see
that 3.10.6 has been released, but still without this patch.
Regards,
Peter
[1]: https://bbs.archlinux.org/viewtopic.php?id=167210
[2]: https://bugs.archlinux.org/task/35991
[3]: https://bbs.archlinux.org/viewtopic.php?pid=1309535#p1309535
^ permalink raw reply
* [PATCH 1/3] wistron_btns: drop bogus MODULE_VERSION macro
From: Stefan Lippers-Hollmann @ 2013-08-12 22:50 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Miloslav Trmac, linux-input, linux-kernel
MODULE_VERSION is pointless for an in-kernel module and git log confirms that
it has never been actually maintained as well (bumped a single time, despite
quite major feature additions later on, which haven't been reflected in
MODULE_VERSION).
Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
---
drivers/input/misc/wistron_btns.c | 1 -
1 file changed, 1 deletion(-)
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -46,7 +46,6 @@
MODULE_AUTHOR("Miloslav Trmac <mitr@volny.cz>");
MODULE_DESCRIPTION("Wistron laptop button driver");
MODULE_LICENSE("GPL v2");
-MODULE_VERSION("0.3");
static bool force; /* = 0; */
module_param(force, bool, 0);
^ permalink raw reply
* [PATCH 2/3] wistron_btns: mark the Medion MD96500 keymap as tested
From: Stefan Lippers-Hollmann @ 2013-08-12 22:53 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Miloslav Trmac, linux-input, linux-kernel
In-Reply-To: <201308130050.52800.s.L-H@gmx.de>
DMI: MEDIONPC WIM 2040/WIM 2040, BIOS R01-A0O 11/04/2005
wistron_btns: BIOS signature found at c00f6b00, entry point 000FDD50
input: Wistron laptop buttons as /devices/platform/wistron-bios/input/input5
Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
---
drivers/input/misc/wistron_btns.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -562,7 +562,7 @@ static struct key_entry keymap_wistron_m
{ KE_KEY, 0x36, {KEY_WWW} },
{ KE_WIFI, 0x30 },
{ KE_BLUETOOTH, 0x44 },
- { KE_END, FE_UNTESTED }
+ { KE_END, 0 }
};
static struct key_entry keymap_wistron_generic[] __initdata = {
^ permalink raw reply
* [PATCH 3/3] wistron_btns: add MODULE_DEVICE_TABLE
From: Stefan Lippers-Hollmann @ 2013-08-12 22:55 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Miloslav Trmac, linux-input, linux-kernel
In-Reply-To: <201308130050.52800.s.L-H@gmx.de>
This allows the wistron_btns module to be autoloaded on boot, its functionality
is required to support the hardware rfkill switches on most of the supported
notebooks, in order to unblock the hard blocked rfkill state for wireless and
bluetooth devices.
Tested on a Medion MD96500:
alias: dmi*:svn*MEDIONPC*:pn*WIM2040*:
Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
---
This patch may be considered RFC, while it is certainly the right thing to do,
some of the DMI matches might be a bit wide, e.g.:
dmi*:svn*FUJITSUSIEMENS*:pn*AMILOD*:
dmi*:svn*FUJITSUSIEMENS*:pn*AmiloD*:
dmi*:svn*FUJITSUSIEMENS*:pn*AMILOM*:
all others are very targetted - and I haven't noticed any issues by forcing
wistron_btns on system not requiring it so far.
drivers/input/misc/wistron_btns.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -971,6 +971,7 @@ static const struct dmi_system_id __init
},
{ NULL, }
};
+MODULE_DEVICE_TABLE(dmi, dmi_ids);
/* Copy the good keymap, as the original ones are free'd */
static int __init copy_keymap(void)
^ permalink raw reply
* [PATCH] input: qt1070: add power management ops
From: Bo Shen @ 2013-08-13 7:43 UTC (permalink / raw)
To: dmitry.torokhov; +Cc: Wenyou.Yang, Bo Shen, linux-arm-kernel, linux-input
Add power management ops for qt1070, it maybe a wakeup source
Signed-off-by: Bo Shen <voice.shen@atmel.com>
---
drivers/input/keyboard/qt1070.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/input/keyboard/qt1070.c b/drivers/input/keyboard/qt1070.c
index 42b773b..deefe5a 100644
--- a/drivers/input/keyboard/qt1070.c
+++ b/drivers/input/keyboard/qt1070.c
@@ -243,6 +243,30 @@ static int qt1070_remove(struct i2c_client *client)
return 0;
}
+#ifdef CONFIG_PM_SLEEP
+static int qt1070_suspend(struct device *dev)
+{
+ struct qt1070_data *data = dev_get_drvdata(dev);
+
+ if (device_may_wakeup(dev))
+ enable_irq_wake(data->irq);
+
+ return 0;
+}
+
+static int qt1070_resume(struct device *dev)
+{
+ struct qt1070_data *data = dev_get_drvdata(dev);
+
+ if (device_may_wakeup(dev))
+ disable_irq_wake(data->irq);
+
+ return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(qt1070_pm_ops, qt1070_suspend, qt1070_resume);
+
static const struct i2c_device_id qt1070_id[] = {
{ "qt1070", 0 },
{ },
@@ -253,6 +277,7 @@ static struct i2c_driver qt1070_driver = {
.driver = {
.name = "qt1070",
.owner = THIS_MODULE,
+ .pm = &qt1070_pm_ops,
},
.id_table = qt1070_id,
.probe = qt1070_probe,
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH 1/2] Revert "Revert "HID: Fix logitech-dj: missing Unifying device issue""
From: Peter Hurley @ 2013-08-13 12:13 UTC (permalink / raw)
To: Peter Wu
Cc: Nestor Lopez Casado, jkosina, benjamin.tissoires, adlr,
joseph.salisbury, linux-input, linux-kernel, Sarah Sharp,
linux-usb
In-Reply-To: <2324751.QaRpZppUQy@al>
On 08/12/2013 05:54 PM, Peter Wu wrote:
> On Thursday 18 July 2013 16:28:01 Peter Hurley wrote:
>> Before we revert to using the workaround, I'd like to suggest that
>> this new "hidden" problem may be an interaction with the xhci_hcd host
>> controller driver only.
>>
>> Looking at the related bug, the OP indicates the machine only has
>> USB3 ports. Additionally, comments #7, #100, and #104 of the original
>> bug report add additional information that would seem to confirm
>> this suspicion.
>>
>> Let me add I have this USB device running on the uhci_hcd driver
>> with or without this workaround on v3.10.
>
> This problem does not seem specific to xhci, uhci seems also effected.
If true, it would certainly help to have a bug report confirming uhci
failure from a bare-metal system which contained:
1) kernel version
2) complete dmesg output
3) lsusb -v output
4) lsmod output
5) usbmon capture from a plug attempt
> Today I
> upgraded a system (running Arch Linux) from kernel 3.9.9 to 3.10.5. After a
> reboot to 3.10.5, things broke. The setup:
>
> - There are two USB receivers plugged into USB 1.1 ports (different buses
> according to lsusb, uhci), each receiver is paired to a K360 keyboard.
> - One of the receivers are passed to a QEMU guest with -usbdevice host:$busid.
> $devid. This keyboard is working (probably because QEMU performed a reset).
> - Since 3.10.5, the keyboard that is *not* passed to the QEMU guest is not
> functioning on reboot.
>
> After closing the QEMU guest, the USB bus gets reset(?) after which the other
> keyboard suddenly gets detected. I had only booted 3.10.5 twice before rolling
> back to 3.9.9, both boots triggered the issue. Do I need to provide a usbmon,
> lsusb, dmesg and/ or other details from 3.10.5?
Do both keyboards work on bare metal? Seems like this problem might be
specific to qemu (or kvm) and you may get more insight on those lists.
> Note that there are other Arch Linux users who have reported issues[1][2]
Unfortunately, not even one user in the referenced reports identified
the usb hub the receiver was plugged into.
> since upgrading to 3.10.z. Triggering a re-enumeration by writing the magic
> HID++ message[3] makes the paired devices appear again (as reported in
> forums[1], I haven't tried this on the affected UHCI machine).
>
> While the underlying bug is fixed, can this patch be forwarded to stable? I see
> that 3.10.6 has been released, but still without this patch.
This is still a workaround and not really a fix for the underlying bug.
> Regards,
> Peter
>
> [1]: https://bbs.archlinux.org/viewtopic.php?id=167210
> [2]: https://bugs.archlinux.org/task/35991
> [3]: https://bbs.archlinux.org/viewtopic.php?pid=1309535#p1309535
^ permalink raw reply
* [PATCH] mc13xxx-ts: use zero as default value if no pdata was defined
From: Michael Grzeschik @ 2013-08-13 12:14 UTC (permalink / raw)
To: linux-input; +Cc: linux-kernel, kernel, Samuel Ortiz, Dmitry Torokhov
In case of devicetree, we currently don't have a way to append pdata for
the touchscreen. The current approach is to bail out in that case.
This patch makes it possible to probe the touchscreen without pdata
and use zero as default values for the atox and ato adc conversion.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
drivers/input/touchscreen/mc13783_ts.c | 14 +++++++++-----
drivers/mfd/mc13xxx-core.c | 11 +++++++----
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/input/touchscreen/mc13783_ts.c b/drivers/input/touchscreen/mc13783_ts.c
index d6f099c..0e24304 100644
--- a/drivers/input/touchscreen/mc13783_ts.c
+++ b/drivers/input/touchscreen/mc13783_ts.c
@@ -124,10 +124,17 @@ static void mc13783_ts_work(struct work_struct *work)
container_of(work, struct mc13783_ts_priv, work.work);
unsigned int mode = MC13XXX_ADC_MODE_TS;
unsigned int channel = 12;
+ u8 ato = 0;
+ bool atox = 0;
+
+ if (priv->touch) {
+ ato = priv->touch->ato;
+ atox = priv->touch->atox;
+ }
if (mc13xxx_adc_do_conversion(priv->mc13xxx,
mode, channel,
- priv->touch->ato, priv->touch->atox,
+ ato, atox,
priv->sample) == 0)
mc13783_ts_report_sample(priv);
}
@@ -183,11 +190,8 @@ static int __init mc13783_ts_probe(struct platform_device *pdev)
priv->mc13xxx = dev_get_drvdata(pdev->dev.parent);
priv->idev = idev;
priv->touch = dev_get_platdata(&pdev->dev);
- if (!priv->touch) {
+ if (!priv->touch)
dev_err(&pdev->dev, "missing platform data\n");
- ret = -ENODEV;
- goto err_free_mem;
- }
/*
* We need separate workqueue because mc13783_adc_do_conversion
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 2a9b100..278601f 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -694,10 +694,6 @@ err_revision:
if (mc13xxx->flags & MC13XXX_USE_RTC)
mc13xxx_add_subdevice(mc13xxx, "%s-rtc");
- if (mc13xxx->flags & MC13XXX_USE_TOUCHSCREEN)
- mc13xxx_add_subdevice_pdata(mc13xxx, "%s-ts",
- &pdata->touch, sizeof(pdata->touch));
-
if (pdata) {
mc13xxx_add_subdevice_pdata(mc13xxx, "%s-regulator",
&pdata->regulators, sizeof(pdata->regulators));
@@ -705,10 +701,17 @@ err_revision:
pdata->leds, sizeof(*pdata->leds));
mc13xxx_add_subdevice_pdata(mc13xxx, "%s-pwrbutton",
pdata->buttons, sizeof(*pdata->buttons));
+
+ if (mc13xxx->flags & MC13XXX_USE_TOUCHSCREEN)
+ mc13xxx_add_subdevice_pdata(mc13xxx, "%s-ts",
+ &pdata->touch, sizeof(pdata->touch));
} else {
mc13xxx_add_subdevice(mc13xxx, "%s-regulator");
mc13xxx_add_subdevice(mc13xxx, "%s-led");
mc13xxx_add_subdevice(mc13xxx, "%s-pwrbutton");
+
+ if (mc13xxx->flags & MC13XXX_USE_TOUCHSCREEN)
+ mc13xxx_add_subdevice(mc13xxx, "%s-ts");
}
return 0;
--
1.8.4.rc2
^ 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