Linux Input/HID development
 help / color / mirror / Atom feed
* Re: Elan TS driver patch
From: Dmitry Torokhov @ 2014-10-07 16:03 UTC (permalink / raw)
  To: ELAN 劉嘉駿
  Cc: linux-input, bleung, Charles Mooney, Jeff.Chuang,
	'梁博翔'
In-Reply-To: <005301cfe221$abcd2460$03676d20$@emc.com.tw>

Hi Scott,

On Tue, Oct 07, 2014 at 07:27:25PM +0800, ELAN 劉嘉駿 wrote:
> Hi Dmitry:
> 	I submitted a patch to upstream for support Elan TS. Please refer to
> below link:
> 	https://lkml.org/lkml/2013/12/27/92
> 
> 	This driver is for many chromebook and you have some contributions
> on this:
> 	https://chromium-review.googlesource.com/#/c/218723/
>   https://chromium-review.googlesource.com/#/c/218612/
>   https://chromium-review.googlesource.com/#/c/218613/
>   https://chromium-review.googlesource.com/#/c/218722/
>   …
>   
> 	Do we need to re-submit this patch or you will apply it from your
> modification?

I believe the driver needs a few more changes before I can merge it in
mainline; I am looking at it.

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

* Re: 3.17-rc5: kernel oops when exiting X under heavy load
From: David Herrmann @ 2014-10-07 16:16 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Pavel Machek, kernel list, open list:HID CORE LAYER
In-Reply-To: <20141006181202.GA22781@dtor-ws>

Hi

On Mon, Oct 6, 2014 at 8:12 PM, Dmitry Torokhov <dtor@mail.ru> wrote:
> On Sat, Oct 04, 2014 at 01:11:10AM +0200, Pavel Machek wrote:
>> Hi!
>>
>> From the backtrace, it looks evdev related...?
>
> Hmm, looks like it...
>
>>
>>
>> Oct  4 00:59:47 duo wpa_supplicant[3824]: wlan0: SME: Trying to authenticate with 00:11:95:05:30:d7 (SSID='pavel' freq=2412 MHz)
>> Oct  4 00:59:47 duo wpa_supplicant[3824]: wlan0: Trying to associate with 00:11:95:05:30:d7 (SSID='pavel' freq=2412 MHz)
>> Oct  4 00:59:47 duo NetworkManager[3465]: <info> (wlan0): supplicant interface state: scanning -> authenticating
>> Oct  4 00:59:47 duo wpa_supplicant[3824]: wlan0: Associated with 00:11:95:05:30:d7
>> Oct  4 00:59:47 duo wpa_supplicant[3824]: wlan0: CTRL-EVENT-CONNECTED - Connection to 00:11:95:05:30:d7 completed (reauth) [id=0 id_str=]
>> Oct  4 00:59:47 duo NetworkManager[3465]: <info> (wlan0): supplicant interface state: authenticating -> associating
>> Oct  4 00:59:47 duo NetworkManager[3465]: <info> (wlan0): supplicant interface state: associating -> completed
>> Oct  4 00:59:55 duo kernel: BUG: unable to handle kernel paging request at f47b5000
>> Oct  4 00:59:55 duo kernel: IP: [<c42765ff>] memcpy+0xf/0x20
>> Oct  4 00:59:55 duo kernel: *pde = 373f3067 *pte = 347b5060
>> Oct  4 00:59:55 duo kernel: Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
>> Oct  4 00:59:55 duo kernel: Modules linked in:
>> Oct  4 00:59:55 duo kernel: CPU: 0 PID: 22293 Comm: Xorg Not tainted 3.17.0-rc5+ #399
>> Oct  4 00:59:55 duo kernel: Hardware name: LENOVO 17097HU/17097HU, BIOS 7BETD8WW (2.19 ) 03/31/2011
>> Oct  4 00:59:55 duo kernel: task: eb4b1580 ti: ec6a2000 task.ti: ec6a2000
>> Oct  4 00:59:55 duo kernel: EIP: 0060:[<c42765ff>] EFLAGS: 00213006 CPU: 0
>> Oct  4 00:59:55 duo kernel: EIP is at memcpy+0xf/0x20
>> Oct  4 00:59:55 duo kernel: EAX: f5c42000 EBX: 00000bfc ECX: 00000146 EDX: f47b491c
>> Oct  4 00:59:55 duo kernel: ESI: f47b5000 EDI: f5c426e4 EBP: ec6a3e80 ESP: ec6a3e74
>> Oct  4 00:59:55 duo kernel: DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
>> Oct  4 00:59:55 duo kernel: CR0: 80050033 CR2: f47b5000 CR3: 2c77d000 CR4: 00000710
>> Oct  4 00:59:55 duo kernel: Stack:
>> Oct  4 00:59:55 duo kernel: ec409800 f47b499c 00000bfc ec6a3ec4 c451f154 ec40980c f5c42000 c47ee121
>> Oct  4 00:59:55 duo kernel: 00000001 00000001 00000000 00203246 c47ef168 c451f367 f47cdcb4 eb4b1580
>> Oct  4 00:59:55 duo kernel: 00203246 eab3eec0 ec409800 ec409800 ec6a3f2c c451f468 f47b491c 000002ff
>> Oct  4 00:59:55 duo kernel: Call Trace:
>> Oct  4 00:59:55 duo kernel: [<c451f154>] evdev_handle_get_val.isra.7+0x54/0x240
>> Oct  4 00:59:55 duo kernel: [<c47ee121>] ? mutex_lock_interruptible_nested+0x31/0x330
>> Oct  4 00:59:55 duo kernel: [<c47ef168>] ? mutex_unlock+0x8/0x10
>> Oct  4 00:59:55 duo kernel: [<c451f367>] ? evdev_ioctl+0x27/0x7f0
>> Oct  4 00:59:55 duo kernel: [<c451f468>] evdev_ioctl+0x128/0x7f0
>> Oct  4 00:59:55 duo kernel: [<c40e9c5c>] ? cache_free_debugcheck+0x2ac/0x340
>> Oct  4 00:59:55 duo kernel: [<c451f340>] ? evdev_handle_get_val.isra.7+0x240/0x240
>> Oct  4 00:59:55 duo kernel: [<c40fead2>] do_vfs_ioctl+0x2f2/0x520
>> Oct  4 00:59:55 duo kernel: [<c40f8178>] ? final_putname+0x18/0x40
>> Oct  4 00:59:55 duo kernel: [<c40f8178>] ? final_putname+0x18/0x40
>> Oct  4 00:59:55 duo kernel: [<c40ee12a>] ? do_sys_open+0x17a/0x200
>> Oct  4 00:59:55 duo kernel: [<c40fed36>] SyS_ioctl+0x36/0x70
>> Oct  4 00:59:55 duo kernel: [<c47f105e>] syscall_call+0x7/0x7
>> Oct  4 00:59:55 duo kernel: [<c47f0000>] ? hrtimer_nanosleep_restart+0x60/0xa0
>> Oct  4 00:59:55 duo kernel: Code: fb ff ff 8b 43 54 2b 43 50 88 43 4e 5b 5d f3 c3 90 90 90 90 90 90 90 90 90 90 90 90 55 89 e5 57 89 c7 56 89 d6 53 89 cb c1 e9 02 <f3> a5 89 d9 83 e1 03 74 02 f3 a4 5b 5e 5f 5d c3 90 55 89 e5 57
>> Oct  4 00:59:55 duo kernel: EIP: [<c42765ff>] memcpy+0xf/0x20 SS:ESP 0068:ec6a3e74
>> Oct  4 00:59:55 duo kernel: CR2: 00000000f47b5000
>> Oct  4 00:59:55 duo kernel: ---[ end trace fee349319591dc44 ]---
>> Oct  4 01:04:08 duo rsyslogd: [origin software="rsyslogd" swVersion="8.4.0" x-pid="3490" x-info="http://www.rsyslog.com"] start
>>
>
> Does the patch below help by any chance?
>
> Thanks.
>
> --
> Dmitry
>
>
> Input: evdev - fix EVIOCG{type} ioctl
>
> From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>
> The 'max' size passed into the function is measured in number of bits
> (KEY_MAX, LED_MAX, etc) so we nedd to convert it accoidingly before tyring
> to copy the data out, otherwise we will try copying too much and end up
> with up with a page fault.
>
> Reported-by: Pavel Machek <pavel@ucw.cz>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/input/evdev.c |   13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
> index de05545..bc20348 100644
> --- a/drivers/input/evdev.c
> +++ b/drivers/input/evdev.c
> @@ -738,20 +738,23 @@ static int evdev_handle_set_keycode_v2(struct input_dev *dev, void __user *p)
>   */
>  static int evdev_handle_get_val(struct evdev_client *client,
>                                 struct input_dev *dev, unsigned int type,
> -                               unsigned long *bits, unsigned int max,
> -                               unsigned int size, void __user *p, int compat)
> +                               unsigned long *bits, unsigned int maxbit,
> +                               unsigned int maxlen, void __user *p,
> +                               int compat)
>  {
>         int ret;
>         unsigned long *mem;
> +       size_t len;
>
> -       mem = kmalloc(sizeof(unsigned long) * max, GFP_KERNEL);
> +       len = BITS_TO_LONGS(maxbit) * sizeof(unsigned long);
> +       mem = kmalloc(len, GFP_KERNEL);
>         if (!mem)
>                 return -ENOMEM;
>
>         spin_lock_irq(&dev->event_lock);
>         spin_lock(&client->buffer_lock);
>
> -       memcpy(mem, bits, sizeof(unsigned long) * max);
> +       memcpy(mem, bits, len);

So this is where it breaks? Because we copy from "bits", which is an
array in the input-device? Very unlikely to trigger, I guess. Sure, so
far we overallocate and copy way to much into the array, but the
bits_to_user() truncates it properly. So afaics, this only fails if
the kernel memory isn't accessible, and thus faults.

Patch looks good! Nice catch:

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>

Thanks
David

>
>         spin_unlock(&dev->event_lock);
>
> @@ -759,7 +762,7 @@ static int evdev_handle_get_val(struct evdev_client *client,
>
>         spin_unlock_irq(&client->buffer_lock);
>
> -       ret = bits_to_user(mem, max, size, p, compat);
> +       ret = bits_to_user(mem, maxbit, maxlen, p, compat);
>         if (ret < 0)
>                 evdev_queue_syn_dropped(client);
>

^ permalink raw reply

* Re: [PATCH] Input: opencores-kbd: Switch to using managed resources
From: Dmitry Torokhov @ 2014-10-07 16:17 UTC (permalink / raw)
  To: Tobias Klauser; +Cc: Pramod Gurav, linux-kernel, linux-input
In-Reply-To: <20141007133322.GL3279@distanz.ch>

On Tue, Oct 07, 2014 at 03:33:22PM +0200, Tobias Klauser wrote:
> On 2014-10-07 at 13:31:41 +0200, Pramod Gurav <pramod.gurav@smartplayin.com> wrote:
> > This change switch to managed resources to simplifies error handling
> > and module unloading and does away with platform_driver remove function.
> > 
> > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > Cc: linux-input@vger.kernel.org
> > Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
> > ---
> >  drivers/input/keyboard/opencores-kbd.c |   54 ++++++++------------------------
> >  1 file changed, 13 insertions(+), 41 deletions(-)
> > 
> > diff --git a/drivers/input/keyboard/opencores-kbd.c b/drivers/input/keyboard/opencores-kbd.c
> > index 7b9b441..ecacb87 100644
> > --- a/drivers/input/keyboard/opencores-kbd.c
> > +++ b/drivers/input/keyboard/opencores-kbd.c
> > @@ -56,27 +56,27 @@ static int opencores_kbd_probe(struct platform_device *pdev)
> >  		return -EINVAL;
> >  	}
> >  
> > -	opencores_kbd = kzalloc(sizeof(*opencores_kbd), GFP_KERNEL);
> > -	input = input_allocate_device();
> > +	opencores_kbd = devm_kzalloc(&pdev->dev, sizeof(*opencores_kbd),
> > +				     GFP_KERNEL);
> > +	input = devm_input_allocate_device(&pdev->dev);
> >  	if (!opencores_kbd || !input) {
> >  		dev_err(&pdev->dev, "failed to allocate device structures\n");
> > -		error = -ENOMEM;
> > -		goto err_free_mem;
> > +		return -ENOMEM;
> >  	}
> >  
> >  	opencores_kbd->addr_res = res;
> > -	res = request_mem_region(res->start, resource_size(res), pdev->name);
> > +	res = devm_request_mem_region(&pdev->dev, res->start,
> > +				      resource_size(res), pdev->name);
> >  	if (!res) {
> >  		dev_err(&pdev->dev, "failed to request I/O memory\n");
> > -		error = -EBUSY;
> > -		goto err_free_mem;
> > +		return -EBUSY;
> >  	}
> >  
> > -	opencores_kbd->addr = ioremap(res->start, resource_size(res));
> > +	opencores_kbd->addr = devm_ioremap(&pdev->dev, res->start,
> > +					   resource_size(res));
> 
> You could use devm_ioremap_resource() here and get rid of the call to
> devm_request_mem_region() and the check for !res above, i.e. something
> like:
> 
> 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> 	[...]
> 	opencores_kbd->addr = devm_ioremap_resource(&pdev->dev, res);
> 	if (!opencores_kbd->addr) {
> 		dev_err(&pdev->dev, "failed to remap I/O memory\n");
> 		return -ENXIO;
> 	}

You need to be careful with devm_ioremap_resource() ocnversions as it
returns ERR_PTR-encoded pointer on failures, not NULL.

I adjusted the patch to use devm_ioremap_resource() and applied.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] input: lm8323: Switch to using managed resources
From: Dmitry Torokhov @ 2014-10-07 16:32 UTC (permalink / raw)
  To: Pramod Gurav; +Cc: linux-kernel, linux-input
In-Reply-To: <1412674689-20132-1-git-send-email-pramod.gurav@smartplayin.com>

Hi Pramod,
On Tue, Oct 07, 2014 at 03:08:09PM +0530, Pramod Gurav wrote:
> This change switches to using devm_* APIs to allocate  resources.
> This helps to simplify failure path in probe function as well as
> remove function.
> 

I prefer not mixing the automatic and manual resource management in a
single driver, so if you can't convert everything to devm_* API I prefer
to leave the code as is.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] Input: adp5588-keys: cancel workqueue in failure path
From: Dmitry Torokhov @ 2014-10-07 16:38 UTC (permalink / raw)
  To: Pramod Gurav; +Cc: linux-kernel, Michael Hennerich, linux-input
In-Reply-To: <1412667049-6128-1-git-send-email-pramod.gurav@smartplayin.com>

On Tue, Oct 07, 2014 at 01:00:49PM +0530, Pramod Gurav wrote:
> This change introduces a label to call cancel_delayed_work_sync in
> failure path.
> 
> Cc: Michael Hennerich <michael.hennerich@analog.com>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-input@vger.kernel.org
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
> ---
>  drivers/input/keyboard/adp5588-keys.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
> index 5ef7fcf..b494062 100644
> --- a/drivers/input/keyboard/adp5588-keys.c
> +++ b/drivers/input/keyboard/adp5588-keys.c
> @@ -559,7 +559,7 @@ static int adp5588_probe(struct i2c_client *client,
>  	error = input_register_device(input);
>  	if (error) {
>  		dev_err(&client->dev, "unable to register input device\n");
> -		goto err_free_mem;
> +		goto err_delayed_work;
>  	}
>  
>  	error = request_irq(client->irq, adp5588_irq,
> @@ -592,6 +592,8 @@ static int adp5588_probe(struct i2c_client *client,
>   err_unreg_dev:
>  	input_unregister_device(input);
>  	input = NULL;
> + err_delayed_work:
> +	cancel_delayed_work_sync(&kpad->work);

We do not need to have a separate label, just need to cancel workqueue
after freeing interrupt. I adjusted the patch and applied.

Thanks.

-- 
Dmitry

^ permalink raw reply

* [git pull] Input updates for 3.18-rc0
From: Dmitry Torokhov @ 2014-10-07 16:59 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, linux-input, Jiri Kosina

Hi Linus,

Please pull from:

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

to receive updates for the input subsystem. You will receive a few new
haptic/button drivers, a rudimentary support for laptops using FocalTech
touchpads; xpad driver will bind to more devices, and a few other driver
fixes.

Changelog:
---------

Benjamin Valentin (1):
      Input: xpad - sync device IDs with xboxdrv

Dan Murphy (5):
      Input: drv260x - add TI drv260x haptics driver
      Input: drv260x - remove unused defines
      Input: drv260x - add check for ERM mode and LRA Libraries
      Input: drv260x - fix binding document
      Input: add support for the DRV2667 haptic driver

Frank Razenberg (1):
      Input: xpad - add VID/PID for Razer Sabertooth

Hans de Goede (2):
      Input: psmouse - add psmouse_matches_pnp_id helper function
      Input: psmouse - add support for detecting FocalTech PS/2 touchpads

Jaewon Kim (1):
      Input: add haptic driver on max77693

Jin Yao (1):
      Input: soc_button_array - convert to platform bus

Nishanth Menon (3):
      Input: introduce palmas-pwrbutton
      Input: palmas-pwrbutton - use IRQF_ONESHOT
      Input: palmas-pwrbutton - fix typo in the license string

Takashi Iwai (1):
      Input: joystick - use ktime for measuring timing

Todd Broch (1):
      Input: cros_ec_keyb - optimize ghosting algorithm


Diffstat:
--------

 .../devicetree/bindings/input/ti,drv260x.txt       |  50 ++
 .../devicetree/bindings/input/ti,drv2667.txt       |  17 +
 .../bindings/input/ti,palmas-pwrbutton.txt         |  36 +
 drivers/acpi/acpi_pnp.c                            |   2 -
 drivers/input/gameport/gameport.c                  |  41 +-
 drivers/input/joystick/analog.c                    |  71 +-
 drivers/input/joystick/xpad.c                      |  34 +
 drivers/input/keyboard/cros_ec_keyb.c              |  92 +--
 drivers/input/misc/Kconfig                         |  43 ++
 drivers/input/misc/Makefile                        |   4 +
 drivers/input/misc/drv260x.c                       | 741 +++++++++++++++++++++
 drivers/input/misc/drv2667.c                       | 500 ++++++++++++++
 drivers/input/misc/max77693-haptic.c               | 357 ++++++++++
 drivers/input/misc/palmas-pwrbutton.c              | 332 +++++++++
 drivers/input/misc/soc_button_array.c              |  60 +-
 drivers/input/mouse/Makefile                       |   2 +-
 drivers/input/mouse/focaltech.c                    |  52 ++
 drivers/input/mouse/focaltech.h                    |  22 +
 drivers/input/mouse/psmouse-base.c                 |  30 +
 drivers/input/mouse/psmouse.h                      |   1 +
 drivers/input/mouse/synaptics.c                    |  17 +-
 include/dt-bindings/input/ti-drv260x.h             |  36 +
 include/linux/mfd/max77693-private.h               |   9 +
 include/linux/platform_data/drv260x-pdata.h        |  28 +
 24 files changed, 2468 insertions(+), 109 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/ti,drv260x.txt
 create mode 100644 Documentation/devicetree/bindings/input/ti,drv2667.txt
 create mode 100644 Documentation/devicetree/bindings/input/ti,palmas-pwrbutton.txt
 create mode 100644 drivers/input/misc/drv260x.c
 create mode 100644 drivers/input/misc/drv2667.c
 create mode 100644 drivers/input/misc/max77693-haptic.c
 create mode 100644 drivers/input/misc/palmas-pwrbutton.c
 create mode 100644 drivers/input/mouse/focaltech.c
 create mode 100644 drivers/input/mouse/focaltech.h
 create mode 100644 include/dt-bindings/input/ti-drv260x.h
 create mode 100644 include/linux/platform_data/drv260x-pdata.h

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 2/4] Input: pmic8xxx-keypad - use regmap_field for register access
From: Dmitry Torokhov @ 2014-10-07 17:26 UTC (permalink / raw)
  To: Ivan T. Ivanov; +Cc: Stephen Boyd, linux-input, linux-kernel, linux-arm-msm
In-Reply-To: <1412675448-11990-3-git-send-email-iivanov@mm-sol.com>

Hi Ivan,

On Tue, Oct 07, 2014 at 12:50:46PM +0300, Ivan T. Ivanov wrote:
> @@ -527,10 +538,55 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, kp);
>  
> +	if (rows < info->min_rows)
> +		rows = info->min_rows;
> +
> +	if (cols < info->min_cols)
> +		cols = info->min_cols;
> +
>  	kp->num_rows	= rows;
>  	kp->num_cols	= cols;
>  	kp->dev		= &pdev->dev;
>  
> +	kp->events = devm_regmap_field_alloc(kp->dev, kp->regmap,
> +					     info->events);
> +	if (IS_ERR(kp->events))
> +		return PTR_ERR(kp->events);
> +
> +	kp->scan_rows = devm_regmap_field_alloc(kp->dev, kp->regmap,
> +						info->scan_rows);
> +	if (IS_ERR(kp->scan_rows))
> +		return PTR_ERR(kp->scan_rows);
> +
> +	kp->scan_cols = devm_regmap_field_alloc(kp->dev, kp->regmap,
> +						info->scan_cols);
> +	if (IS_ERR(kp->scan_cols))
> +		return PTR_ERR(kp->scan_cols);
> +
> +	kp->enable = devm_regmap_field_alloc(kp->dev, kp->regmap,
> +					     info->enable);
> +	if (IS_ERR(kp->enable))
> +		return PTR_ERR(kp->enable);
> +
> +	kp->read_state = devm_regmap_field_alloc(kp->dev, kp->regmap,
> +						 info->read_state);
> +	if (IS_ERR(kp->read_state))
> +		return PTR_ERR(kp->read_state);
> +
> +	kp->dbonce = devm_regmap_field_alloc(kp->dev, kp->regmap,
> +					     info->dbonce);
> +	if (IS_ERR(kp->dbonce))
> +		return PTR_ERR(kp->dbonce);
> +
> +	kp->pause = devm_regmap_field_alloc(kp->dev, kp->regmap, info->pause);
> +	if (IS_ERR(kp->pause))
> +		return PTR_ERR(kp->pause);
> +
> +	kp->row_hold = devm_regmap_field_alloc(kp->dev, kp->regmap,
> +					       info->row_hold);
> +	if (IS_ERR(kp->row_hold))
> +		return PTR_ERR(kp->row_hold);

Why do we have to allocate all regmap fields separately instead of
embedding them into keypad structure?

Thanks.

-- 
Dmitry

^ permalink raw reply

* [PATCH] HID: wacom: Prevent potential null dereference after disconnect
From: Jason Gerecke @ 2014-10-07 17:54 UTC (permalink / raw)
  To: jkosina, benjamin.tissoires, pinglinux
  Cc: linux-input, linux-kernel, Jason Gerecke

Repeated connect/disconnect cycles under GNOME can trigger an occasional
OOPS from within e.g. wacom_led_select_store, presumably due to a timing
issue where userspace begins setting a value immediately before the
device disconnects and our shared data is whisked away.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
---
 drivers/hid/wacom_sys.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 8593047..d9ae467 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -641,6 +641,9 @@ static ssize_t wacom_led_select_store(struct device *dev, int set_id,
 	unsigned int id;
 	int err;
 
+	if (!wacom)
+		return -ENODEV;
+
 	err = kstrtouint(buf, 10, &id);
 	if (err)
 		return err;
@@ -666,6 +669,8 @@ static ssize_t wacom_led##SET_ID##_select_show(struct device *dev,	\
 {									\
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);\
 	struct wacom *wacom = hid_get_drvdata(hdev);			\
+	if (!wacom)							\
+		return -ENODEV;						\
 	return scnprintf(buf, PAGE_SIZE, "%d\n",			\
 			 wacom->led.select[SET_ID]);			\
 }									\
@@ -702,7 +707,8 @@ static ssize_t wacom_##name##_luminance_store(struct device *dev,	\
 {									\
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);\
 	struct wacom *wacom = hid_get_drvdata(hdev);			\
-									\
+	if (!wacom)							\
+		return -ENODEV;						\
 	return wacom_luminance_store(wacom, &wacom->led.field,		\
 				     buf, count);			\
 }									\
@@ -710,6 +716,8 @@ static ssize_t wacom_##name##_luminance_show(struct device *dev,	\
 	struct device_attribute *attr, char *buf)			\
 {									\
 	struct wacom *wacom = dev_get_drvdata(dev);			\
+	if (!wacom)							\
+		return -ENODEV;
 	return scnprintf(buf, PAGE_SIZE, "%d\n", wacom->led.field);	\
 }									\
 static DEVICE_ATTR(name##_luminance, DEV_ATTR_RW_PERM,			\
@@ -729,6 +737,9 @@ static ssize_t wacom_button_image_store(struct device *dev, int button_id,
 	unsigned len;
 	u8 xfer_id;
 
+	if (!wacom)
+		return -ENODEV;
+
 	if (hdev->bus == BUS_BLUETOOTH) {
 		len = 256;
 		xfer_id = WAC_CMD_ICON_BT_XFER;
-- 
2.1.2

^ permalink raw reply related

* Re: [PATCH 0/2] Qualcomm PM8941 power key driver
From: Bjorn Andersson @ 2014-10-07 18:46 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: Dmitry Torokhov, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Grant Likely, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
In-Reply-To: <1412672510.1027.57.camel@iivanov-dev>

On Tue 07 Oct 02:01 PDT 2014, Ivan T. Ivanov wrote:

> 
> Hi Bjorn,
> 
> On Mon, 2014-10-06 at 18:11 -0700, Bjorn Andersson wrote:
> > These patches add dt bindings and a device driver for the power key block in
> > the Qualcomm PM8941 pmic.
> > 
> > Courtney Cavin (2):
> >   input: Add Qualcomm PM8941 power key driver
> >   input: pm8941-pwrkey: Add DT binding documentation
> > 
> >  .../bindings/input/qcom,pm8941-pwrkey.txt          |   43 +++++
> >  drivers/input/misc/Kconfig                         |   12 ++
> >  drivers/input/misc/Makefile                        |    1 +
> >  drivers/input/misc/pm8941-pwrkey.c                 |  196 ++++++++++++++++++++
> >  4 files changed, 252 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
> >  create mode 100644 drivers/input/misc/pm8941-pwrkey.c
> 
> Any reason why we cannot reuse pm8xxx-pwrkey driver? It have been
> converted to regmap already. 
> 

The boilerplate code is the same, but configuration registers have different
layout and values written in them are different. The pm8xxx block have separate
interrupts for press and release events while pm8941 have one interrupt for
both, so the pm8941 must read out the irq status bits to figure out which event
it was.

Maybe if we introduce some vagueness related to interrupts in the dt binding
documentation for pm8xxx we could simply reuse that binding.

Regards,
Bjorn

^ permalink raw reply

* Re: [PATCH 2/2] input: pm8941-pwrkey: Add DT binding documentation
From: Kumar Gala @ 2014-10-07 18:53 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Dmitry Torokhov, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Grant Likely, devicetree, linux-kernel, linux-input,
	linux-arm-msm, Courtney Cavin
In-Reply-To: <1412644321-27683-3-git-send-email-bjorn.andersson@sonymobile.com>


On Oct 6, 2014, at 8:12 PM, Bjorn Andersson <Bjorn.Andersson@sonymobile.com> wrote:

> From: Courtney Cavin <courtney.cavin@sonymobile.com>
> 
> Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> ---
> .../bindings/input/qcom,pm8941-pwrkey.txt          |   43 ++++++++++++++++++++
> 1 file changed, 43 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
> 
> diff --git a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
> new file mode 100644
> index 0000000..4d75e2c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
> @@ -0,0 +1,43 @@
> +Qualcomm PM8941 PMIC Power Key
> +
> +PROPERTIES
> +
> +- compatible:
> +	Usage: required
> +	Value type: <string>
> +	Definition: must be one of:
> +		    "qcom,pm8941-pwrkey"
> +
> +- reg:
> +	Usage: required
> +	Value type: <prop-encoded-array>
> +	Definition: base address of registers for block
> +
> +- interrupts:
> +	Usage: required
> +	Value type: <prop-encoded-array>
> +	Definition: key change interrupt; The format of the specifier is
> +		    defined by the binding document describing the node's
> +		    interrupt parent.
> +
> +- debounce:
> +	Usage: optional
> +	Value type: <u32>
> +	Definition: time in microseconds that key must be pressed or released
> +		    for state change interrupt to trigger.
> +
> +- bias-pull-up:
> +	Usage: optional
> +	Value type: <empty>

boolean, is probably better than <empty> here.

> +	Definition: presence of this property indicates that the KPDPWR_N pin
> +		    should be configured for pull up.
> +
> +EXAMPLE
> +
> +	pwrkey@800 {
> +		compatible = "qcom,pm8941-pwrkey";
> +		reg = <0x800>;
> +		interrupts = <0x0 0x8 0 0>;
> +		debounce = <15625>;
> +		bias-pull-up;
> +	};
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply

* Re: [PATCH v2] Input: driver for the Goodix touchpanel
From: Dmitry Torokhov @ 2014-10-07 20:58 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: Henrik Rydberg, linux-input, Benjamin Tissoires
In-Reply-To: <1411569838.29315.22.camel@hadess.net>

Hi Bastien,

On Wed, Sep 24, 2014 at 04:43:58PM +0200, Bastien Nocera wrote:
> Add a driver for the Goodix touchscreen panel found in Onda v975w
> tablets. The driver is based off the Android driver gt9xx.c found
> in some Android code dumps, but now bears no resemblance to the original
> driver.
> 
> The driver was tested on the aforementioned tablet.

I was looking over the driver once again and I have a few concerns.

> 
> Signed-off-by: Bastien Nocera <hadess@hadess.net>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> Tested-by: Bastien Nocera <hadess@hadess.net>
> ---
>  MAINTAINERS                        |   6 +
>  drivers/input/touchscreen/Kconfig  |  13 ++
>  drivers/input/touchscreen/Makefile |   1 +
>  drivers/input/touchscreen/goodix.c | 423 +++++++++++++++++++++++++++++++++++++
>  4 files changed, 443 insertions(+)
>  create mode 100644 drivers/input/touchscreen/goodix.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 670b3dc..7a37464 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -4057,6 +4057,12 @@ L:	linux-media@vger.kernel.org
>  S:	Maintained
>  F:	drivers/media/usb/go7007/
>  
> +GOODIX TOUCHSCREEN
> +M:	Bastien Nocera <hadess@hadess.net>
> +L:	linux-input@vger.kernel.org
> +S:	Maintained
> +F:	drivers/input/touchscreen/goodix.c
> +
>  GPIO SUBSYSTEM
>  M:	Linus Walleij <linus.walleij@linaro.org>
>  M:	Alexandre Courbot <gnurou@gmail.com>
> diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
> index 6bb9a7d..c328df3 100644
> --- a/drivers/input/touchscreen/Kconfig
> +++ b/drivers/input/touchscreen/Kconfig
> @@ -283,6 +283,19 @@ config TOUCHSCREEN_FUJITSU
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called fujitsu-ts.
>  
> +config TOUCHSCREEN_GOODIX
> +	tristate "Goodix I2C touchscreen"
> +	depends on I2C && ACPI
> +	help
> +	  Say Y here if you have the Goodix touchscreen (such as one
> +	  installed in Onda v975w tablets) connected to your
> +	  system.
> +
> +	  If unsure, say N.
> +
> +	  To compile this driver as a module, choose M here: the
> +	  module will be called goodix.
> +
>  config TOUCHSCREEN_ILI210X
>  	tristate "Ilitek ILI210X based touchscreen"
>  	depends on I2C
> diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
> index 4be94fc..55af212 100644
> --- a/drivers/input/touchscreen/Makefile
> +++ b/drivers/input/touchscreen/Makefile
> @@ -33,6 +33,7 @@ obj-$(CONFIG_TOUCHSCREEN_EETI)		+= eeti_ts.o
>  obj-$(CONFIG_TOUCHSCREEN_ELO)		+= elo.o
>  obj-$(CONFIG_TOUCHSCREEN_EGALAX)	+= egalax_ts.o
>  obj-$(CONFIG_TOUCHSCREEN_FUJITSU)	+= fujitsu_ts.o
> +obj-$(CONFIG_TOUCHSCREEN_GOODIX)	+= goodix.o
>  obj-$(CONFIG_TOUCHSCREEN_ILI210X)	+= ili210x.o
>  obj-$(CONFIG_TOUCHSCREEN_INEXIO)	+= inexio.o
>  obj-$(CONFIG_TOUCHSCREEN_INTEL_MID)	+= intel-mid-touch.o
> diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
> new file mode 100644
> index 0000000..fd02b5e
> --- /dev/null
> +++ b/drivers/input/touchscreen/goodix.c
> @@ -0,0 +1,423 @@
> +/*
> + *  driver for Goodix Touchscreens
> + *
> + *  Copyright (c) 2014 Red Hat Inc.
> + *
> + *  This code is based on gt9xx.c authored by andrew@goodix.com:
> + *
> + *  2010 - 2012 Goodix Technology.
> + */
> +
> +/*
> + * 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; version 2 of the License.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/i2c.h>
> +#include <linux/input.h>
> +#include <linux/input/mt.h>
> +#include <linux/module.h>
> +#include <linux/delay.h>
> +#include <linux/irq.h>
> +#include <linux/interrupt.h>
> +#include <linux/slab.h>
> +#include <asm/unaligned.h>
> +
> +struct goodix_ts_data {
> +	struct i2c_client *client;
> +	struct input_dev *input_dev;
> +	int abs_x_max;
> +	int abs_y_max;
> +	unsigned int max_touch_num;
> +	unsigned int int_trigger_type;
> +};
> +
> +#define GOODIX_MAX_HEIGHT		4096
> +#define GOODIX_MAX_WIDTH		4096
> +#define GOODIX_INT_TRIGGER		1
> +#define GOODIX_MAX_TOUCH		10
> +
> +#define GOODIX_CONFIG_MAX_LENGTH	240
> +
> +/* Register defineS */
> +#define GOODIX_READ_COOR_ADDR		0x814E
> +#define GOODIX_REG_CONFIG_DATA		0x8047
> +#define GOODIX_REG_VERSION		0x8140
> +
> +#define RESOLUTION_LOC		1
> +#define TRIGGER_LOC		6
> +
> +static const char *goodix_ts_name = "Goodix Capacitive TouchScreen";
> +static const unsigned long goodix_irq_flags[] = {
> +	IRQ_TYPE_EDGE_RISING,
> +	IRQ_TYPE_EDGE_FALLING,
> +	IRQ_TYPE_LEVEL_LOW,
> +	IRQ_TYPE_LEVEL_HIGH,
> +};
> +
> +/**
> + * goodix_i2c_read - read data from a register of the i2c slave device.
> + *
> + * @client: i2c device.
> + * @reg: the register to read from.
> + * @buf: raw write data buffer.
> + * @len: length of the buffer to write
> + */
> +static int goodix_i2c_read(struct i2c_client *client,
> +				u16 reg, u8 *buf, int len)
> +{
> +	struct i2c_msg msgs[2];
> +	u16 wbuf = cpu_to_be16(reg);
> +	int ret;
> +
> +	msgs[0].flags = 0;
> +	msgs[0].addr  = client->addr;
> +	msgs[0].len   = 2;
> +	msgs[0].buf   = (u8 *) &wbuf;
> +
> +	msgs[1].flags = I2C_M_RD;
> +	msgs[1].addr  = client->addr;
> +	msgs[1].len   = len;
> +	msgs[1].buf   = buf;
> +
> +	ret = i2c_transfer(client->adapter, msgs, 2);
> +	return ret < 0 ? ret : (ret != ARRAY_SIZE(msgs) ? -EIO : 0);
> +}
> +
> +/**
> + * goodix_i2c_write - write data to the i2c slave device.
> + *
> + * @client: i2c device.
> + * @reg: the register to read to.
> + * @buf: raw write data buffer.
> + * @len: length of the buffer to write
> + */
> +static int goodix_i2c_write(struct i2c_client *client,
> +				u16 reg, u8 *buf, int len)
> +{
> +	struct i2c_msg msg;
> +	int ret;
> +	u8 *wbuf;
> +	u16 *addr;
> +
> +	wbuf = kzalloc(len + 2, GFP_KERNEL);
> +	if (!buf)
> +		return -ENOMEM;
> +
> +	addr = ((u16 *) &wbuf[0]);
> +	*addr = cpu_to_be16(reg);
> +	memcpy(&wbuf[2], buf, len);
> +
> +	msg.flags = 0;
> +	msg.addr  = client->addr;
> +	msg.len   = len + 2;
> +	msg.buf   = wbuf;
> +
> +	ret = i2c_transfer(client->adapter, &msg, 1);
> +	kfree(wbuf);
> +	return ret < 0 ? ret : (ret != 1 ? -EIO : 0);
> +}
> +
> +static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data)
> +{
> +	int touch_num;
> +	int ret;
> +
> +	ret = goodix_i2c_read(ts->client, GOODIX_READ_COOR_ADDR, data, 10);
> +	if (ret < 0) {
> +		dev_err(&ts->client->dev, "I2C transfer error (%d)\n", ret);
> +		return ret;
> +	}
> +
> +	touch_num = data[0] & 0x0f;
> +	if (touch_num > GOODIX_MAX_TOUCH)
> +		return -EPROTO;
> +
> +	if (touch_num > 1) {
> +		ret = goodix_i2c_read(ts->client, GOODIX_READ_COOR_ADDR + 10,
> +				   &data[10], 8 * (touch_num - 1));
> +		if (ret < 0)
> +			return ret;
> +	}

I am a bit confused about this function. It looks like contact packet
size is 8 bytes, and they preceded by a byte with total number of
contacts reported, so why instead of 9 bytes we are reading 10?

> +
> +	return touch_num;
> +}
> +
> +static void goodix_ts_parse_touch(struct goodix_ts_data *ts, u8 *coor_data)
> +{
> +	int id = coor_data[0] & 0x0F;
> +	int input_x = get_unaligned_le16(&coor_data[1]);
> +	int input_y = get_unaligned_le16(&coor_data[3]);
> +	int input_w = get_unaligned_le16(&coor_data[5]);
> +
> +	input_mt_slot(ts->input_dev, id);
> +	input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true);
> +	input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x);
> +	input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, input_y);
> +	input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, input_w);
> +	input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, input_w);
> +}
> +
> +/**
> + * goodix_process_events - Process incoming events
> + *
> + * @ts: our goodix_ts_data pointer
> + *
> + * Called when the IRQ is triggered. Read the current device state, and push
> + * the input events to the user space.
> + */
> +static void goodix_process_events(struct goodix_ts_data *ts)
> +{
> +	u8  point_data[1 + 8 * GOODIX_MAX_TOUCH + 1];

Here again, why do we need extra byte?

> +	int touch_num;
> +	int i;
> +
> +	touch_num = goodix_ts_read_input_report(ts, point_data);
> +	if (touch_num < 0)
> +		return;
> +
> +	for (i = 0; i < touch_num; i++)
> +		goodix_ts_parse_touch(ts, &point_data[1 + 8 * i]);
> +
> +	input_mt_sync_frame(ts->input_dev);
> +	input_sync(ts->input_dev);
> +}
> +
> +/**
> + * goodix_ts_irq_handler - The IRQ handler
> + *
> + * @irq: interrupt number.
> + * @dev_id: private data pointer.
> + */
> +static irqreturn_t goodix_ts_irq_handler(int irq, void *dev_id)
> +{
> +	struct goodix_ts_data *ts = dev_id;
> +	u8  end_cmd[1] = {0};
> +
> +	goodix_process_events(ts);
> +
> +	if (goodix_i2c_write(ts->client,
> +				GOODIX_READ_COOR_ADDR, end_cmd, 1) < 0)
> +		dev_err(&ts->client->dev, "I2C write end_cmd error");

I am not happy that we need to allocate/deallocate memory for each
interrupt. We only write one command to the driver, we could simply use
i2c_master_send() with a constant buffer.

BTW, you need terminate kernel messages with \n.

Also, below is a patch with a few assorted changes that I'd like you to
try if you have time.

Thanks!

-- 
Dmitry


Input: goodix - random changes

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/goodix.c |  208 ++++++++++++++++--------------------
 1 file changed, 91 insertions(+), 117 deletions(-)

diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index fd02b5e..1c2131c 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -37,11 +37,12 @@ struct goodix_ts_data {
 #define GOODIX_MAX_HEIGHT		4096
 #define GOODIX_MAX_WIDTH		4096
 #define GOODIX_INT_TRIGGER		1
-#define GOODIX_MAX_TOUCH		10
+#define GOODIX_CONTACT_SIZE		8
+#define GOODIX_MAX_CONTACTS		10
 
 #define GOODIX_CONFIG_MAX_LENGTH	240
 
-/* Register defineS */
+/* Register defines */
 #define GOODIX_READ_COOR_ADDR		0x814E
 #define GOODIX_REG_CONFIG_DATA		0x8047
 #define GOODIX_REG_VERSION		0x8140
@@ -49,7 +50,6 @@ struct goodix_ts_data {
 #define RESOLUTION_LOC		1
 #define TRIGGER_LOC		6
 
-static const char *goodix_ts_name = "Goodix Capacitive TouchScreen";
 static const unsigned long goodix_irq_flags[] = {
 	IRQ_TYPE_EDGE_RISING,
 	IRQ_TYPE_EDGE_FALLING,
@@ -86,66 +86,38 @@ static int goodix_i2c_read(struct i2c_client *client,
 	return ret < 0 ? ret : (ret != ARRAY_SIZE(msgs) ? -EIO : 0);
 }
 
-/**
- * goodix_i2c_write - write data to the i2c slave device.
- *
- * @client: i2c device.
- * @reg: the register to read to.
- * @buf: raw write data buffer.
- * @len: length of the buffer to write
- */
-static int goodix_i2c_write(struct i2c_client *client,
-				u16 reg, u8 *buf, int len)
-{
-	struct i2c_msg msg;
-	int ret;
-	u8 *wbuf;
-	u16 *addr;
-
-	wbuf = kzalloc(len + 2, GFP_KERNEL);
-	if (!buf)
-		return -ENOMEM;
-
-	addr = ((u16 *) &wbuf[0]);
-	*addr = cpu_to_be16(reg);
-	memcpy(&wbuf[2], buf, len);
-
-	msg.flags = 0;
-	msg.addr  = client->addr;
-	msg.len   = len + 2;
-	msg.buf   = wbuf;
-
-	ret = i2c_transfer(client->adapter, &msg, 1);
-	kfree(wbuf);
-	return ret < 0 ? ret : (ret != 1 ? -EIO : 0);
-}
-
 static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data)
 {
 	int touch_num;
-	int ret;
+	int error;
 
-	ret = goodix_i2c_read(ts->client, GOODIX_READ_COOR_ADDR, data, 10);
-	if (ret < 0) {
-		dev_err(&ts->client->dev, "I2C transfer error (%d)\n", ret);
-		return ret;
+	/* XXX should we read GOODIX_CONTACT_SIZE + 1 (i.e. 9) instead of 10? */
+	error = goodix_i2c_read(ts->client, GOODIX_READ_COOR_ADDR, data, 10);
+	if (error) {
+		dev_err(&ts->client->dev, "I2C transfer error: %d\n", error);
+		return error;
 	}
 
 	touch_num = data[0] & 0x0f;
-	if (touch_num > GOODIX_MAX_TOUCH)
+	if (touch_num > GOODIX_MAX_CONTACTS)
 		return -EPROTO;
 
 	if (touch_num > 1) {
-		ret = goodix_i2c_read(ts->client, GOODIX_READ_COOR_ADDR + 10,
-				   &data[10], 8 * (touch_num - 1));
-		if (ret < 0)
-			return ret;
+		data += 10;
+		// data += GOODIX_CONTACT_SIZE + 1
+		error = goodix_i2c_read(ts->client,
+					GOODIX_READ_COOR_ADDR + 10,
+					// GOODIX_READ_COOR_ADDR + 1 + GOODIX_CONTACT_SIZE ???
+					data,
+					GOODIX_CONTACT_SIZE * (touch_num - 1));
+		if (error)
+			return error;
 	}
 
 	return touch_num;
 }
 
-static void goodix_ts_parse_touch(struct goodix_ts_data *ts, u8 *coor_data)
+static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data)
 {
 	int id = coor_data[0] & 0x0F;
 	int input_x = get_unaligned_le16(&coor_data[1]);
@@ -170,7 +142,8 @@ static void goodix_ts_parse_touch(struct goodix_ts_data *ts, u8 *coor_data)
  */
 static void goodix_process_events(struct goodix_ts_data *ts)
 {
-	u8  point_data[1 + 8 * GOODIX_MAX_TOUCH + 1];
+	// XXX why extra +1 ?
+	u8  point_data[1 + GOODIX_CONTACT_SIZE * GOODIX_MAX_CONTACTS + 1];
 	int touch_num;
 	int i;
 
@@ -179,7 +152,8 @@ static void goodix_process_events(struct goodix_ts_data *ts)
 		return;
 
 	for (i = 0; i < touch_num; i++)
-		goodix_ts_parse_touch(ts, &point_data[1 + 8 * i]);
+		goodix_ts_report_touch(ts,
+				&point_data[1 + GOODIX_CONTACT_SIZE * i]);
 
 	input_mt_sync_frame(ts->input_dev);
 	input_sync(ts->input_dev);
@@ -193,13 +167,16 @@ static void goodix_process_events(struct goodix_ts_data *ts)
  */
 static irqreturn_t goodix_ts_irq_handler(int irq, void *dev_id)
 {
+	static const u8 end_cmd[] = {
+		GOODIX_READ_COOR_ADDR & 0xff,
+		GOODIX_READ_COOR_ADDR >> 8,
+		0
+	};
 	struct goodix_ts_data *ts = dev_id;
-	u8  end_cmd[1] = {0};
 
 	goodix_process_events(ts);
 
-	if (goodix_i2c_write(ts->client,
-				GOODIX_READ_COOR_ADDR, end_cmd, 1) < 0)
+	if (i2c_master_send(ts->client, end_cmd, sizeof(end_cmd)) < 0)
 		dev_err(&ts->client->dev, "I2C write end_cmd error");
 
 	return IRQ_HANDLED;
@@ -214,14 +191,16 @@ static irqreturn_t goodix_ts_irq_handler(int irq, void *dev_id)
  */
 static void goodix_read_config(struct goodix_ts_data *ts)
 {
-	int ret;
 	u8 config[GOODIX_CONFIG_MAX_LENGTH];
+	int error;
 
-	ret = goodix_i2c_read(ts->client, GOODIX_REG_CONFIG_DATA, config,
+	error = goodix_i2c_read(ts->client, GOODIX_REG_CONFIG_DATA,
+			      config,
 			   GOODIX_CONFIG_MAX_LENGTH);
-	if (ret < 0) {
-		dev_err(&ts->client->dev,
-			"Error reading config, use default value!");
+	if (error) {
+		dev_warn(&ts->client->dev,
+			 "Error reading config (%d), using defaults\n",
+			 error);
 		ts->abs_x_max = GOODIX_MAX_WIDTH;
 		ts->abs_y_max = GOODIX_MAX_HEIGHT;
 		ts->int_trigger_type = GOODIX_INT_TRIGGER;
@@ -231,9 +210,9 @@ static void goodix_read_config(struct goodix_ts_data *ts)
 	ts->abs_x_max = get_unaligned_le16(&config[RESOLUTION_LOC]);
 	ts->abs_y_max = get_unaligned_le16(&config[RESOLUTION_LOC + 2]);
 	ts->int_trigger_type = (config[TRIGGER_LOC]) & 0x03;
-	if ((!ts->abs_x_max) || (!ts->abs_y_max)) {
+	if (!ts->abs_x_max || !ts->abs_y_max) {
 		dev_err(&ts->client->dev,
-			"Invalid config, use default value!");
+			"Invalid config, using defaults\n");
 		ts->abs_x_max = GOODIX_MAX_WIDTH;
 		ts->abs_y_max = GOODIX_MAX_HEIGHT;
 	}
@@ -248,13 +227,13 @@ static void goodix_read_config(struct goodix_ts_data *ts)
  */
 static int goodix_read_version(struct i2c_client *client, u16 *version)
 {
-	int ret;
+	int error;
 	u8 buf[6];
 
-	ret = goodix_i2c_read(client, GOODIX_REG_VERSION, buf, sizeof(buf));
-	if (ret < 0) {
-		dev_err(&client->dev, "read version failed");
-		return ret;
+	error = goodix_i2c_read(client, GOODIX_REG_VERSION, buf, sizeof(buf));
+	if (error) {
+		dev_err(&client->dev, "read version failed: %d\n", error);
+		return error;
 	}
 
 	if (version)
@@ -262,7 +241,7 @@ static int goodix_read_version(struct i2c_client *client, u16 *version)
 
 	dev_info(&client->dev, "IC VERSION: %6ph", buf);
 
-	return ret;
+	return 0;
 }
 
 /**
@@ -272,20 +251,22 @@ static int goodix_read_version(struct i2c_client *client, u16 *version)
  */
 static int goodix_i2c_test(struct i2c_client *client)
 {
-	u8 test;
-	int ret;
 	int retry = 0;
+	int error;
+	u8 test;
 
 	while (retry++ < 2) {
-		ret = goodix_i2c_read(client, GOODIX_REG_CONFIG_DATA,
-				      &test, 1);
-		if (ret >= 0)
-			return ret;
+		error = goodix_i2c_read(client, GOODIX_REG_CONFIG_DATA,
+					&test, 1);
+		if (!error)
+			return 0;
 
-		dev_err(&client->dev, "i2c test failed time %d.", retry);
+		dev_err(&client->dev, "i2c test failed attempt %d: %d\n",
+			retry, error);
 		msleep(20);
 	}
-	return ret;
+
+	return error;
 }
 
 /**
@@ -297,7 +278,7 @@ static int goodix_i2c_test(struct i2c_client *client)
  */
 static int goodix_request_input_dev(struct goodix_ts_data *ts)
 {
-	int ret;
+	int error;
 
 	ts->input_dev = devm_input_allocate_device(&ts->client->dev);
 	if (!ts->input_dev) {
@@ -316,79 +297,73 @@ static int goodix_request_input_dev(struct goodix_ts_data *ts)
 	input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0);
 	input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
 
-	input_mt_init_slots(ts->input_dev, GOODIX_MAX_TOUCH,
+	input_mt_init_slots(ts->input_dev, GOODIX_MAX_CONTACTS,
 			    INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
 
-	ts->input_dev->name = goodix_ts_name;
+	ts->input_dev->name = "Goodix Capacitive TouchScreen";
 	ts->input_dev->phys = "input/ts";
 	ts->input_dev->id.bustype = BUS_I2C;
 	ts->input_dev->id.vendor = 0x0416;
 	ts->input_dev->id.product = 0x1001;
 	ts->input_dev->id.version = 10427;
 
-	ret = input_register_device(ts->input_dev);
-	if (ret) {
-		dev_err(&ts->client->dev, "Failed to register %s input device",
-			  ts->input_dev->name);
-		return ret;
+	error = input_register_device(ts->input_dev);
+	if (error) {
+		dev_err(&ts->client->dev,
+			"Failed to register input device: %d", error);
+		return error;
 	}
 
 	return 0;
 }
 
 static int goodix_ts_probe(struct i2c_client *client,
-		const struct i2c_device_id *id)
+			   const struct i2c_device_id *id)
 {
-	int ret;
 	struct goodix_ts_data *ts;
+	unsigned long irq_flags;
+	int error;
 	u16 version_info;
 
-	dev_info(&client->dev, "I2C Address: 0x%02x", client->addr);
+	dev_dbg(&client->dev, "I2C Address: 0x%02x", client->addr);
 
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		dev_err(&client->dev, "I2C check functionality failed.");
-		return -ENODEV;
+		dev_err(&client->dev, "I2C check functionality failed.\n");
+		return -ENXIO;
 	}
+
 	ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL);
-	if (!ts) {
-		dev_err(&client->dev, "Alloc GFP_KERNEL memory failed.");
+	if (!ts)
 		return -ENOMEM;
-	}
 
 	ts->client = client;
 	i2c_set_clientdata(client, ts);
 
-	ret = goodix_i2c_test(client);
-	if (ret < 0) {
-		dev_err(&client->dev, "I2C communication ERROR!");
-		return ret;
+	error = goodix_i2c_test(client);
+	if (error) {
+		dev_err(&client->dev, "I2C communication failure: %d\n", error);
+		return error;
 	}
 
-	goodix_read_config(ts);
-
-	ret = goodix_request_input_dev(ts);
-	if (ret < 0) {
-		dev_err(&client->dev, "request input dev failed");
-		return ret;
+	error = goodix_read_version(client, &version_info);
+	if (error) {
+		dev_err(&client->dev, "Read version failed.");
+		return error;
 	}
 
-	ret = devm_request_threaded_irq(&ts->client->dev,
-					ts->client->irq, NULL,
-					goodix_ts_irq_handler,
-					goodix_irq_flags[ts->int_trigger_type]
-						| IRQF_ONESHOT,
-					ts->client->name,
-					ts);
-	if (ret < 0) {
-		dev_err(&ts->client->dev,
-			"Request IRQ failed! ERRNO: %d.", ret);
-		return ret;
-	}
+	goodix_read_config(ts);
 
-	ret = goodix_read_version(client, &version_info);
-	if (ret < 0) {
-		dev_err(&client->dev, "Read version failed.");
-		return ret;
+	error = goodix_request_input_dev(ts);
+	if (error)
+		return error;
+
+	irq_flags = goodix_irq_flags[ts->int_trigger_type] | IRQF_ONESHOT;
+	error = devm_request_threaded_irq(&ts->client->dev, client->irq,
+					  NULL, goodix_ts_irq_handler,
+					  irq_flags, client->name, ts);
+	if (error) {
+		dev_err(&client->dev, "request IRQ failed: %d.", error);
+		return error;
 	}
 
 	return 0;
@@ -414,7 +389,6 @@ static struct i2c_driver goodix_ts_driver = {
 		.acpi_match_table = goodix_acpi_match,
 	},
 };
-
 module_i2c_driver(goodix_ts_driver);
 
 MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>");

^ permalink raw reply related

* Re: [PATCH 1/2] input: Add Qualcomm PM8941 power key driver
From: Bjorn Andersson @ 2014-10-07 23:30 UTC (permalink / raw)
  To: Kiran Padwal
  Cc: Dmitry Torokhov, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Grant Likely, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, Cavin, Courtney
In-Reply-To: <5433B843.5060200@smartplayin.com>

On Tue 07 Oct 02:54 PDT 2014, Kiran Padwal wrote:

> On Tuesday 07 October 2014 06:42 AM, Bjorn Andersson wrote:
> > From: Courtney Cavin <courtney.cavin@sonymobile.com>
> > 
> > Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> > ---
> >  drivers/input/misc/Kconfig         |   12 +++
> >  drivers/input/misc/Makefile        |    1 +
> >  drivers/input/misc/pm8941-pwrkey.c |  196 ++++++++++++++++++++++++++++++++++++
> 
> <snip>
> 
> > +
> > +	platform_set_drvdata(pdev, pwrkey);
> > +	device_init_wakeup(&pdev->dev, 1);
> > +
> > +	return 0;
> > +}
> > +
> > +static int pm8941_pwrkey_remove(struct platform_device *pdev)
> > +{
> > +	device_init_wakeup(&pdev->dev, 0);
> 
> Shouldn't we unregister input device?
> 

It's allocated with devm_input_allocate_device() so I assumed that it goes away
upon the device being removed. Looking at input_register_device() seems to
confirm that.

> > +
> > +	return 0;
> > +}
> > +
> > +static const struct of_device_id pm8941_pwr_key_id_table[] = {
> > +	{ .compatible = "qcom,pm8941-pwrkey" },
> > +	{ }
> > +};
> > +MODULE_DEVICE_TABLE(of, pm8941_pwr_key_id_table);
> > +
> > +static struct platform_driver pm8941_pwrkey_driver = {
> > +	.probe		= pm8941_pwrkey_probe,
> > +	.remove		= pm8941_pwrkey_remove,
> > +	.driver		= {
> > +		.name	= "pm8941-pwrkey",
> > +		.owner	= THIS_MODULE,
> 
> This field can be removed because this driver which use the
> module_platform_driver api as this is overridden in
> platform_driver_register.
> 

Thanks

> > +		.pm	= &pm8941_pwr_key_pm_ops,
> > +		.of_match_table = of_match_ptr(pm8941_pwr_key_id_table),
> > +	},
> > +};
> > +module_platform_driver(pm8941_pwrkey_driver);
> > +
> > +MODULE_DESCRIPTION("PM8941 Power Key driver");
> > +MODULE_LICENSE("GPL v2");
> 
> May be you can add module author name.
> 

Courtney based this driver on the skeleton from pmic8xxx-pwrkey, so I don't
think it's right to say that there's any particular author. And you have the
git log...

Regards,
Bjorn

^ permalink raw reply

* Re: [PATCH 1/2] input: Add Qualcomm PM8941 power key driver
From: Dmitry Torokhov @ 2014-10-07 23:42 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Kiran Padwal, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Grant Likely, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, Cavin, Courtney
In-Reply-To: <20141007233045.GD31125@sonymobile.com>

On Tue, Oct 07, 2014 at 04:30:46PM -0700, Bjorn Andersson wrote:
> On Tue 07 Oct 02:54 PDT 2014, Kiran Padwal wrote:
> 
> > On Tuesday 07 October 2014 06:42 AM, Bjorn Andersson wrote:
> > > From: Courtney Cavin <courtney.cavin@sonymobile.com>
> > > 
> > > Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
> > > Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> > > ---
> > >  drivers/input/misc/Kconfig         |   12 +++
> > >  drivers/input/misc/Makefile        |    1 +
> > >  drivers/input/misc/pm8941-pwrkey.c |  196 ++++++++++++++++++++++++++++++++++++
> > 
> > <snip>
> > 
> > > +
> > > +	platform_set_drvdata(pdev, pwrkey);
> > > +	device_init_wakeup(&pdev->dev, 1);
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +static int pm8941_pwrkey_remove(struct platform_device *pdev)
> > > +{
> > > +	device_init_wakeup(&pdev->dev, 0);
> > 
> > Shouldn't we unregister input device?
> > 
> 
> It's allocated with devm_input_allocate_device() so I assumed that it goes away
> upon the device being removed. Looking at input_register_device() seems to
> confirm that.

Yes, devices allocated with devm_input_allocate_device() will be
unregistered and freed automatically.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] input: clps711x-keypad: Remove cond_resched() call
From: Dmitry Torokhov @ 2014-10-07 23:48 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: linux-input
In-Reply-To: <1411115346-22034-1-git-send-email-shc_work@mail.ru>

Hi Alexander,

On Fri, Sep 19, 2014 at 12:29:06PM +0400, Alexander Shiyan wrote:
> cond_resched() is not works as expected for clps711x-keypad driver
> and cause runtime error.
> This patch replaces this call with udelay().
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  drivers/input/keyboard/clps711x-keypad.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/keyboard/clps711x-keypad.c b/drivers/input/keyboard/clps711x-keypad.c
> index 552b65c..650205d 100644
> --- a/drivers/input/keyboard/clps711x-keypad.c
> +++ b/drivers/input/keyboard/clps711x-keypad.c
> @@ -9,13 +9,13 @@
>   * (at your option) any later version.
>   */
>  
> +#include <linux/delay.h>
>  #include <linux/input.h>
>  #include <linux/input-polldev.h>
>  #include <linux/module.h>
>  #include <linux/of_gpio.h>
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
> -#include <linux/sched.h>
>  #include <linux/input/matrix_keypad.h>
>  #include <linux/mfd/syscon.h>
>  #include <linux/mfd/syscon/clps711x.h>
> @@ -54,9 +54,9 @@ static void clps711x_keypad_poll(struct input_polled_dev *dev)
>  
>  			/* Read twice for protection against fluctuations */
>  			do {
> -				state = gpiod_get_value_cansleep(data->desc);
> -				cond_resched();
> -				state1 = gpiod_get_value_cansleep(data->desc);
> +				state = gpiod_get_value(data->desc);
> +				udelay(5);
> +				state1 = gpiod_get_value(data->desc);

Why are you changing gpiod_get_value_cansleep() -> gpiod_get_value().
I am not saying it is incorrect, but could you give reasoning in the
changelog?

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v4 2/3] cap11xx: Add support for various cap11xx devices
From: Dmitry Torokhov @ 2014-10-08  0:09 UTC (permalink / raw)
  To: Matt Ranostay
  Cc: galak, zonque, linux-input, linux-kernel, robh+dt, devicetree
In-Reply-To: <1412051189-22643-3-git-send-email-mranostay@gmail.com>

Hi Matt,

On Mon, Sep 29, 2014 at 09:26:28PM -0700, Matt Ranostay wrote:
> +	priv->num_channels = cap->num_channels;
> +	priv->keycodes = devm_kcalloc(dev,
> +		priv->num_channels, sizeof(u32), GFP_KERNEL);
> +	if (!priv->keycodes)
> +		return -ENOMEM;

Instead of allocating keymap separately can we do something like below?

Thanks.

-- 
Dmitry


Input: cap11xx - add support for various cap11xx devices

From: Matt Ranostay <mranostay@gmail.com>

Several other variants of the cap11xx device exists with a varying
number of capacitance detection channels. Add support for creating
the channels dynamically.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Reviewed-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 .../devicetree/bindings/input/cap11xx.txt          |    3 +
 drivers/input/keyboard/cap11xx.c                   |   62 +++++++++++++-------
 2 files changed, 42 insertions(+), 23 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/cap11xx.txt b/Documentation/devicetree/bindings/input/cap11xx.txt
index 738f5f3..8031aa5 100644
--- a/Documentation/devicetree/bindings/input/cap11xx.txt
+++ b/Documentation/devicetree/bindings/input/cap11xx.txt
@@ -7,9 +7,10 @@ Required properties:
 
 	compatible:		Must be on the following, depending on the model:
 					"microchip,cap1106"
+					"microchip,cap1126"
+					"microchip,cap1188"
 
 	reg:			The I2C slave address of the device.
-				Only 0x28 is valid.
 
 	interrupts:		Property describing the interrupt line the
 				device's ALERT#/CM_IRQ# pin is connected to.
diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
index 0da2e83..87fa209 100644
--- a/drivers/input/keyboard/cap11xx.c
+++ b/drivers/input/keyboard/cap11xx.c
@@ -1,7 +1,6 @@
 /*
  * Input driver for Microchip CAP11xx based capacitive touch sensors
  *
- *
  * (c) 2014 Daniel Mack <linux@zonque.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -54,8 +53,6 @@
 #define CAP11XX_REG_MANUFACTURER_ID	0xfe
 #define CAP11XX_REG_REVISION		0xff
 
-#define CAP11XX_NUM_CHN 6
-#define CAP11XX_PRODUCT_ID	0x55
 #define CAP11XX_MANUFACTURER_ID	0x5d
 
 struct cap11xx_priv {
@@ -63,7 +60,24 @@ struct cap11xx_priv {
 	struct input_dev *idev;
 
 	/* config */
-	unsigned short keycodes[CAP11XX_NUM_CHN];
+	u32 keycodes[];
+};
+
+struct cap11xx_hw_model {
+	uint8_t product_id;
+	unsigned int num_channels;
+};
+
+enum {
+	CAP1106,
+	CAP1126,
+	CAP1188,
+};
+
+static const struct cap11xx_hw_model cap11xx_devices[] = {
+	[CAP1106] = { .product_id = 0x55, .num_channels = 6 },
+	[CAP1126] = { .product_id = 0x53, .num_channels = 6 },
+	[CAP1188] = { .product_id = 0x50, .num_channels = 8 },
 };
 
 static const struct reg_default cap11xx_reg_defaults[] = {
@@ -150,7 +164,7 @@ static irqreturn_t cap11xx_thread_func(int irq_num, void *data)
 	if (ret < 0)
 		goto out;
 
-	for (i = 0; i < CAP11XX_NUM_CHN; i++)
+	for (i = 0; i < priv->idev->keycodemax; i++)
 		input_report_key(priv->idev, priv->keycodes[i],
 				 status & (1 << i));
 
@@ -187,11 +201,16 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
 	struct device *dev = &i2c_client->dev;
 	struct cap11xx_priv *priv;
 	struct device_node *node;
+	const struct cap11xx_hw_model *cap = &cap11xx_devices[id->driver_data];
 	int i, error, irq, gain = 0;
 	unsigned int val, rev;
-	u32 gain32, keycodes[CAP11XX_NUM_CHN];
+	u32 gain32;
+
+	BUG_ON(!cap->num_channels);
 
-	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	priv = devm_kzalloc(dev,
+			    sizeof(*priv) + cap->num_channels * sizeof(u32),
+			    GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
@@ -203,9 +222,9 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
 	if (error)
 		return error;
 
-	if (val != CAP11XX_PRODUCT_ID) {
+	if (val != cap->product_id) {
 		dev_err(dev, "Product ID: Got 0x%02x, expected 0x%02x\n",
-			val, CAP11XX_PRODUCT_ID);
+			val, cap->product_id);
 		return -ENODEV;
 	}
 
@@ -225,8 +244,8 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
 
 	dev_info(dev, "CAP11XX detected, revision 0x%02x\n", rev);
 	i2c_set_clientdata(i2c_client, priv);
-	node = dev->of_node;
 
+	node = dev->of_node;
 	if (!of_property_read_u32(node, "microchip,sensor-gain", &gain32)) {
 		if (is_power_of_2(gain32) && gain32 <= 8)
 			gain = ilog2(gain32);
@@ -234,17 +253,12 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
 			dev_err(dev, "Invalid sensor-gain value %d\n", gain32);
 	}
 
-	BUILD_BUG_ON(ARRAY_SIZE(keycodes) != ARRAY_SIZE(priv->keycodes));
-
 	/* Provide some useful defaults */
-	for (i = 0; i < ARRAY_SIZE(keycodes); i++)
-		keycodes[i] = KEY_A + i;
+	for (i = 0; i < cap->num_channels; i++)
+		priv->keycodes[i] = KEY_A + i;
 
 	of_property_read_u32_array(node, "linux,keycodes",
-				   keycodes, ARRAY_SIZE(keycodes));
-
-	for (i = 0; i < ARRAY_SIZE(keycodes); i++)
-		priv->keycodes[i] = keycodes[i];
+		priv->keycodes, cap->num_channels);
 
 	error = regmap_update_bits(priv->regmap, CAP11XX_REG_MAIN_CONTROL,
 				   CAP11XX_REG_MAIN_CONTROL_GAIN_MASK,
@@ -268,17 +282,17 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
 	if (of_property_read_bool(node, "autorepeat"))
 		__set_bit(EV_REP, priv->idev->evbit);
 
-	for (i = 0; i < CAP11XX_NUM_CHN; i++)
+	for (i = 0; i < cap->num_channels; i++)
 		__set_bit(priv->keycodes[i], priv->idev->keybit);
 
 	__clear_bit(KEY_RESERVED, priv->idev->keybit);
 
 	priv->idev->keycode = priv->keycodes;
 	priv->idev->keycodesize = sizeof(priv->keycodes[0]);
-	priv->idev->keycodemax = ARRAY_SIZE(priv->keycodes);
+	priv->idev->keycodemax = cap->num_channels;
 
 	priv->idev->id.vendor = CAP11XX_MANUFACTURER_ID;
-	priv->idev->id.product = CAP11XX_PRODUCT_ID;
+	priv->idev->id.product = cap->product_id;
 	priv->idev->id.version = rev;
 
 	priv->idev->open = cap11xx_input_open;
@@ -312,12 +326,16 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
 
 static const struct of_device_id cap11xx_dt_ids[] = {
 	{ .compatible = "microchip,cap1106", },
+	{ .compatible = "microchip,cap1126", },
+	{ .compatible = "microchip,cap1188", },
 	{}
 };
 MODULE_DEVICE_TABLE(of, cap11xx_dt_ids);
 
 static const struct i2c_device_id cap11xx_i2c_ids[] = {
-	{ "cap1106", 0 },
+	{ "cap1106", CAP1106 },
+	{ "cap1126", CAP1126 },
+	{ "cap1188", CAP1188 },
 	{}
 };
 MODULE_DEVICE_TABLE(i2c, cap11xx_i2c_ids);

^ permalink raw reply related

* Re: [PATCH] HID: rmi: Scan the report descriptor to determine if the device is suitable for the hid-rmi driver
From: Andrew Duggan @ 2014-10-08  0:36 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: linux-input, linux-kernel, Jiri Kosina
In-Reply-To: <20141003212533.GC23710@mail.corp.redhat.com>

Hi Benjamin,

Thanks for reviewing.

On 10/03/2014 02:25 PM, Benjamin Tissoires wrote:
> Hi Andrew,
>
> On Oct 02 2014 or thereabouts, Andrew Duggan wrote:
>> On composite HID devices there may be multiple HID devices on separate interfaces, but hid-rmi
>> should only bind to the touchpad. Commit e19ff99f256aeeff6c07b373e01883b72e049552 simply checked
>> that the interface protocol was set to mouse. Unfortuately, it is not always the case that the
>> touchpad has the mouse interface protocol set. This patch takes a different approach and scans
>> the report descriptor looking for the Vendor Specific Top Level Collection and the associated
>> usages and report IDs needed by the hid-rmi driver to interface with the device.
> I am going to leave for XDC 2014 next week and then I'll have one week
> off, so I prefer sending my impressions now (or it will have to wait 2
> more weeks).
>
> I am not sure this solution is sustainable in the long term. If every
> driver starts checking each vendor collection in core, there is no point
> in having core and drivers separated.
> Unfortunately, I can not think of an easier way of doing it. So I think
> (but Jiri can choose to ignore me) that we should at least hold this
> until 3.19 development starts.
I agree checking for specific vendor's reports in core isn't ideal, but 
I couldn't figure out a better way to uniquely identify our touchpad on 
certain composite USB devices.

Specifically, I am looking at the Razer Blade 14" laptop which has a 
composite USB device with 4 HID devices on separate interfaces. One is 
the touchpad, two others report to be keyboards, and the forth device 
shows up as a mouse. Since the VID and PID are identical, scanning the 
report descriptor is the only way to determine which device. There are 
slight differences in the report descriptors which we could use to make 
a guess. For instance our touchpad uses Application 
GenericDesktop.Pointer while the other device uses GenericDesktop.Mouse. 
The fact that only one has a vendor specific collection is also an 
indication. But, these indicators don't seem particularly conclusive. 
Also, the mouse device has it's interface protocol set to mouse instead 
of the touchpad, so the current code which checks that value would 
attach to the wrong device (if you add the Razer VID and PID to the 
Vendor specific handling check in hid_scan_report).

> One or two more comments inlined:
>
>> Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
>> ---
>>   drivers/hid/hid-core.c | 42 +++++++++++++++++++++++++++++++++++++-----
>>   include/linux/hid.h    |  8 +++++++-
>>   2 files changed, 44 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
>> index 12b6e67..498f674 100644
>> --- a/drivers/hid/hid-core.c
>> +++ b/drivers/hid/hid-core.c
>> @@ -686,6 +686,23 @@ static void hid_scan_input_usage(struct hid_parser *parser, u32 usage)
>>   
>>   	if (usage == HID_DG_CONTACTID)
>>   		hid->group = HID_GROUP_MULTITOUCH;
>> +
>> +	if (usage == 0xff000004 && parser->global.report_id == 0xb)
>> +		parser->scan_flags |= HID_SCAN_FLAG_RMI_INPUT_READ;
>> +
>> +	if (usage == 0xff000005 && parser->global.report_id == 0xc)
>> +		parser->scan_flags |= HID_SCAN_FLAG_RMI_ATTN;
>> +}
>> +
>> +static void hid_scan_output_usage(struct hid_parser *parser, u32 usage)
>> +{
>> +	struct hid_device *hid = parser->device;
>> +
>> +	if (usage == 0xff000002 && parser->global.report_id == 0x9)
>> +		parser->scan_flags |= HID_SCAN_FLAG_RMI_WRITE;
>> +
>> +	if (usage == 0xff000003 && parser->global.report_id == 0xa)
>> +		parser->scan_flags |= HID_SCAN_FLAG_RMI_OUTPUT_READ;
>>   }
>>   
>>   static void hid_scan_feature_usage(struct hid_parser *parser, u32 usage)
>> @@ -693,6 +710,9 @@ static void hid_scan_feature_usage(struct hid_parser *parser, u32 usage)
>>   	if (usage == 0xff0000c5 && parser->global.report_count == 256 &&
>>   	    parser->global.report_size == 8)
>>   		parser->scan_flags |= HID_SCAN_FLAG_MT_WIN_8;
>> +
>> +	if (usage == 0xff000006 && parser->global.report_id == 0xf)
>> +		parser->scan_flags |= HID_SCAN_FLAG_RMI_MODE;
>>   }
>>   
>>   static void hid_scan_collection(struct hid_parser *parser, unsigned type)
>> @@ -702,6 +722,9 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type)
>>   	if (((parser->global.usage_page << 16) == HID_UP_SENSOR) &&
>>   	    type == HID_COLLECTION_PHYSICAL)
>>   		hid->group = HID_GROUP_SENSOR_HUB;
>> +
>> +	if ((parser->global.usage_page << 16) == HID_UP_MSVENDOR)
>> +		parser->scan_flags |= HID_SCAN_FLAG_VENDOR_SPECIFIC;
>>   }
>>   
>>   static int hid_scan_main(struct hid_parser *parser, struct hid_item *item)
>> @@ -725,6 +748,10 @@ static int hid_scan_main(struct hid_parser *parser, struct hid_item *item)
>>   			hid_scan_input_usage(parser, parser->local.usage[i]);
>>   		break;
>>   	case HID_MAIN_ITEM_TAG_OUTPUT:
>> +		if (data & HID_MAIN_ITEM_CONSTANT)
>> +			break;
>> +		for (i = 0; i < parser->local.usage_index; i++)
>> +			hid_scan_output_usage(parser, parser->local.usage[i]);
>>   		break;
>>   	case HID_MAIN_ITEM_TAG_FEATURE:
>>   		for (i = 0; i < parser->local.usage_index; i++)
>> @@ -783,11 +810,16 @@ static int hid_scan_report(struct hid_device *hid)
>>   	* Vendor specific handlings
>>   	*/
>>   	if ((hid->vendor == USB_VENDOR_ID_SYNAPTICS) &&
>> -	    (hid->group == HID_GROUP_GENERIC) &&
>> -	    /* only bind to the mouse interface of composite USB devices */
>> -	    (hid->bus != BUS_USB || hid->type == HID_TYPE_USBMOUSE))
>> -		/* hid-rmi should take care of them, not hid-generic */
>> -		hid->group = HID_GROUP_RMI;
>> +	    (hid->group == HID_GROUP_GENERIC)) {
>> +		if ((parser->scan_flags & HID_SCAN_FLAG_VENDOR_SPECIFIC)
>> +			&& (parser->scan_flags & HID_SCAN_FLAG_RMI_WRITE)
>> +			&& (parser->scan_flags & HID_SCAN_FLAG_RMI_INPUT_READ)
>> +			&& (parser->scan_flags & HID_SCAN_FLAG_RMI_OUTPUT_READ)
>> +			&& (parser->scan_flags & HID_SCAN_FLAG_RMI_ATTN)
>> +			&& (parser->scan_flags & HID_SCAN_FLAG_RMI_MODE))
> Maybe you should consider defining:
> #define HID_SCAN_FLAGS_RMI HID_SCAN_FLAG_VENDOR_SPECIFIC | \
> 			   HID_SCAN_FLAG_RMI_WRITE | \
> 			   HID_SCAN_FLAG_RMI_INPUT_READ | \
> 			   HID_SCAN_FLAG_RMI_OUTPUT_READ | \
> 			   HID_SCAN_FLAG_RMI_ATTN | \
> 			   HID_SCAN_FLAG_RMI_MODE
>
> and then just test:
> if ((parser->scan_flags & HID_SCAN_FLAGS_RMI) == HID_SCAN_FLAGS_RMI)
>
>> +			/* hid-rmi should take care of them, not hid-generic */
>> +			hid->group = HID_GROUP_RMI;
>> +	}
>>   
>>   	/*
>>   	 * Vendor specific handlings
>> diff --git a/include/linux/hid.h b/include/linux/hid.h
>> index f53c4a9..82d1f82 100644
>> --- a/include/linux/hid.h
>> +++ b/include/linux/hid.h
>> @@ -547,7 +547,13 @@ static inline void hid_set_drvdata(struct hid_device *hdev, void *data)
>>   #define HID_GLOBAL_STACK_SIZE 4
>>   #define HID_COLLECTION_STACK_SIZE 4
>>   
>> -#define HID_SCAN_FLAG_MT_WIN_8			0x00000001
>> +#define HID_SCAN_FLAG_MT_WIN_8			BIT(0)
>> +#define HID_SCAN_FLAG_VENDOR_SPECIFIC		BIT(1)
>> +#define HID_SCAN_FLAG_RMI_WRITE			BIT(2)
>> +#define HID_SCAN_FLAG_RMI_INPUT_READ		BIT(3)
>> +#define HID_SCAN_FLAG_RMI_OUTPUT_READ		BIT(3)
> I guess this one should be BIT(4) and the two after should be shifted by
> one too.
Yep, this is a copy and paste mistake. I'll fix it if I end up 
submitting a v2.
>> +#define HID_SCAN_FLAG_RMI_ATTN			BIT(4)
>> +#define HID_SCAN_FLAG_RMI_MODE			BIT(5)
>>   
>>   struct hid_parser {
>>   	struct hid_global     global;
>> -- 
>> 1.9.1
>>
> Cheers,
> Benjamin

^ permalink raw reply

* RE: Elan TS driver patch
From: ELAN 劉嘉駿 @ 2014-10-08  1:06 UTC (permalink / raw)
  To: 'Dmitry Torokhov'
  Cc: linux-input, bleung, 'Charles Mooney',
	'Jeff.Chuang', '梁博翔'
In-Reply-To: <20141007160358.GA16469@dtor-ws>

Hi Dmitry:
	Thank for reply. Please let me know if anything needs we do.

Thanks,
Scott
	

-----Original Message-----
From: linux-input-owner@vger.kernel.org [mailto:linux-input-owner@vger.kernel.org] On Behalf Of Dmitry Torokhov
Sent: Wednesday, October 08, 2014 12:04 AM
To: ELAN 劉嘉駿
Cc: linux-input@vger.kernel.org; bleung@chromium.org; Charles Mooney; Jeff.Chuang; '梁博翔'
Subject: Re: Elan TS driver patch

Hi Scott,

On Tue, Oct 07, 2014 at 07:27:25PM +0800, ELAN 劉嘉駿 wrote:
> Hi Dmitry:
> 	I submitted a patch to upstream for support Elan TS. Please refer to 
> below link:
> 	https://lkml.org/lkml/2013/12/27/92
> 
> 	This driver is for many chromebook and you have some contributions on 
> this:
> 	https://chromium-review.googlesource.com/#/c/218723/
>   https://chromium-review.googlesource.com/#/c/218612/
>   https://chromium-review.googlesource.com/#/c/218613/
>   https://chromium-review.googlesource.com/#/c/218722/
>   …
>   
> 	Do we need to re-submit this patch or you will apply it from your 
> modification?

I believe the driver needs a few more changes before I can merge it in mainline; I am looking at it.

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

--
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

* ASUS N550JK Touchpad recognized wrongly as PS/2 mouse
From: Carla Rosenfield @ 2014-10-08  2:52 UTC (permalink / raw)
  To: linux-input

[1]
[ASUS N550JK] Touchpad recognized wrongly as PS/2 mouse

[2]
The touchpad on my ASUS N550JK laptop is being recognized as a PS/2
Logitech Wheel mouse, rather than as a touchpad. As such, I have not
been able to turn on edge-scrolling or two-finger-scrolling. The
touchpad does function as a simple mouse for moving the cursor and
right- and left-clicking. Simply booting and logging into the GUI (I'm
using XFCE) in the current upstream 3.17.0 generic amd64 kernel is
sufficient to reproduce this bug.

[3]

[4]
Linux version 3.17.0-031700-generic (apw@gomeisa) (gcc version 4.6.3
(Ubuntu/Linaro 4.6.3-1ubuntu5) ) #201410060605 SMP Mon Oct 6 10:07:09
UTC 2014

[5]

[6]

[7]
Description: Ubuntu 14.04.1 LTS
Release: 14.04


[7.1]
Linux viror 3.17.0-031700-generic #201410060605 SMP Mon Oct 6 10:07:09
UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Gnu C                  4.8
Gnu make               3.81
binutils               2.24
util-linux             2.20.1
mount                  support
module-init-tools      15
e2fsprogs              1.42.9
pcmciautils            018
PPP                    2.4.5
Linux C Library        2.19
Dynamic linker (ldd)   2.19
Procps                 3.3.9
Net-tools              1.60
Kbd                    1.15.5
Sh-utils               8.21
wireless-tools         30
Modules Loaded         ctr ccm bbswitch arc4 dm_crypt iwlmvm mac80211
rtsx_usb_ms memstick asus_nb_wmi asus_wmi intel_rapl sparse_keymap
mxm_wmi x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm
rfcomm bnep crct10dif_pclmul crc32_pclmul uvcvideo videobuf2_vmalloc
videobuf2_memops videobuf2_core ghash_clmulni_intel v4l2_common
aesni_intel videodev media hid_multitouch aes_x86_64 lrw joydev
iwlwifi gf128mul btusb glue_helper ablk_helper serio_raw cryptd
bluetooth rtc_efi cfg80211 lpc_ich wmi mac_hid binfmt_misc mei_me mei
snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic
snd_hda_intel snd_hda_controller snd_hda_codec snd_hwdep snd_pcm
snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq snd_seq_device
snd_timer snd ie31200_edac soundcore edac_core parport_pc ppdev lp
parport nls_iso8859_1 rtsx_usb_sdmmc rtsx_usb hid_generic usbhid hid
i915 i2c_algo_bit drm_kms_helper psmouse r8169 ahci drm libahci mii
video

[7.2]  processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz
stepping : 3
microcode : 0x17
cpu MHz : 2403.417
cache size : 6144 KB
physical id : 0
siblings : 8
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl
xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor
ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic
movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm
ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt
bugs :
bogomips : 4988.73
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz
stepping : 3
microcode : 0x17
cpu MHz : 3058.496
cache size : 6144 KB
physical id : 0
siblings : 8
core id : 1
cpu cores : 4
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl
xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor
ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic
movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm
ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt
bugs :
bogomips : 4988.73
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:

processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz
stepping : 3
microcode : 0x17
cpu MHz : 3310.742
cache size : 6144 KB
physical id : 0
siblings : 8
core id : 2
cpu cores : 4
apicid : 4
initial apicid : 4
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl
xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor
ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic
movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm
ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt
bugs :
bogomips : 4988.73
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:

processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz
stepping : 3
microcode : 0x17
cpu MHz : 3116.406
cache size : 6144 KB
physical id : 0
siblings : 8
core id : 3
cpu cores : 4
apicid : 6
initial apicid : 6
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl
xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor
ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic
movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm
ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt
bugs :
bogomips : 4988.73
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:

processor : 4
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz
stepping : 3
microcode : 0x17
cpu MHz : 3385.449
cache size : 6144 KB
physical id : 0
siblings : 8
core id : 0
cpu cores : 4
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl
xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor
ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic
movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm
ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt
bugs :
bogomips : 4988.73
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:

processor : 5
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz
stepping : 3
microcode : 0x17
cpu MHz : 3310.839
cache size : 6144 KB
physical id : 0
siblings : 8
core id : 1
cpu cores : 4
apicid : 3
initial apicid : 3
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl
xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor
ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic
movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm
ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt
bugs :
bogomips : 4988.73
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:

processor : 6
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz
stepping : 3
microcode : 0x17
cpu MHz : 3445.312
cache size : 6144 KB
physical id : 0
siblings : 8
core id : 2
cpu cores : 4
apicid : 5
initial apicid : 5
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl
xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor
ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic
movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm
ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt
bugs :
bogomips : 4988.73
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:

processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz
stepping : 3
microcode : 0x17
cpu MHz : 3349.121
cache size : 6144 KB
physical id : 0
siblings : 8
core id : 3
cpu cores : 4
apicid : 7
initial apicid : 7
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl
xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor
ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic
movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm
ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt
bugs :
bogomips : 4988.73
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:


[7.3]
ctr 13193 3 - Live 0x0000000000000000
ccm 17856 3 - Live 0x0000000000000000
bbswitch 13943 0 - Live 0x0000000000000000 (OE)
arc4 12573 2 - Live 0x0000000000000000
dm_crypt 23456 0 - Live 0x0000000000000000
iwlmvm 249097 0 - Live 0x0000000000000000
mac80211 696913 1 iwlmvm, Live 0x0000000000000000
rtsx_usb_ms 19050 0 - Live 0x0000000000000000
memstick 16968 1 rtsx_usb_ms, Live 0x0000000000000000
asus_nb_wmi 21128 0 - Live 0x0000000000000000
asus_wmi 24697 1 asus_nb_wmi, Live 0x0000000000000000
intel_rapl 19196 0 - Live 0x0000000000000000
sparse_keymap 13890 1 asus_wmi, Live 0x0000000000000000
mxm_wmi 13021 0 - Live 0x0000000000000000
x86_pkg_temp_thermal 14312 0 - Live 0x0000000000000000
intel_powerclamp 19099 0 - Live 0x0000000000000000
coretemp 13638 0 - Live 0x0000000000000000
kvm_intel 149257 0 - Live 0x0000000000000000
kvm 468567 1 kvm_intel, Live 0x0000000000000000
rfcomm 75114 12 - Live 0x0000000000000000
bnep 19884 2 - Live 0x0000000000000000
crct10dif_pclmul 14268 0 - Live 0x0000000000000000
crc32_pclmul 13180 0 - Live 0x0000000000000000
uvcvideo 86628 0 - Live 0x0000000000000000
videobuf2_vmalloc 13216 1 uvcvideo, Live 0x0000000000000000
videobuf2_memops 13362 1 videobuf2_vmalloc, Live 0x0000000000000000
videobuf2_core 59907 1 uvcvideo, Live 0x0000000000000000
ghash_clmulni_intel 13230 0 - Live 0x0000000000000000
v4l2_common 15715 1 videobuf2_core, Live 0x0000000000000000
aesni_intel 165469 96958 - Live 0x0000000000000000
videodev 163831 3 uvcvideo,videobuf2_core,v4l2_common, Live 0x0000000000000000
media 22008 2 uvcvideo,videodev, Live 0x0000000000000000
hid_multitouch 17657 0 - Live 0x0000000000000000
aes_x86_64 17131 1 aesni_intel, Live 0x0000000000000000
lrw 13323 1 aesni_intel, Live 0x0000000000000000
joydev 17587 0 - Live 0x0000000000000000
iwlwifi 190863 1 iwlmvm, Live 0x0000000000000000
gf128mul 14951 1 lrw, Live 0x0000000000000000
btusb 32408 0 - Live 0x0000000000000000
glue_helper 14095 1 aesni_intel, Live 0x0000000000000000
ablk_helper 13597 1 aesni_intel, Live 0x0000000000000000
serio_raw 13483 0 - Live 0x0000000000000000
cryptd 20531 48478 ghash_clmulni_intel,aesni_intel,ablk_helper, Live
0x0000000000000000
bluetooth 477455 22 rfcomm,bnep,btusb, Live 0x0000000000000000
rtc_efi 12760 0 - Live 0x0000000000000000
cfg80211 514757 3 iwlmvm,mac80211,iwlwifi, Live 0x0000000000000000
lpc_ich 21176 0 - Live 0x0000000000000000
wmi 19379 2 asus_wmi,mxm_wmi, Live 0x0000000000000000
mac_hid 13275 0 - Live 0x0000000000000000
binfmt_misc 17508 1 - Live 0x0000000000000000
mei_me 19524 0 - Live 0x0000000000000000
mei 88810 1 mei_me, Live 0x0000000000000000
snd_hda_codec_hdmi 52620 1 - Live 0x0000000000000000
snd_hda_codec_realtek 78564 1 - Live 0x0000000000000000
snd_hda_codec_generic 70087 1 snd_hda_codec_realtek, Live 0x0000000000000000
snd_hda_intel 30783 10 - Live 0x0000000000000000
snd_hda_controller 32234 1 snd_hda_intel, Live 0x0000000000000000
snd_hda_codec 145035 5
snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_codec_generic,snd_hda_intel,snd_hda_controller,
Live 0x0000000000000000
snd_hwdep 17709 1 snd_hda_codec, Live 0x0000000000000000
snd_pcm 105052 4
snd_hda_codec_hdmi,snd_hda_intel,snd_hda_controller,snd_hda_codec,
Live 0x0000000000000000
snd_seq_midi 13564 0 - Live 0x0000000000000000
snd_seq_midi_event 14899 1 snd_seq_midi, Live 0x0000000000000000
snd_rawmidi 31197 1 snd_seq_midi, Live 0x0000000000000000
snd_seq 63540 2 snd_seq_midi,snd_seq_midi_event, Live 0x0000000000000000
snd_seq_device 14497 3 snd_seq_midi,snd_rawmidi,snd_seq, Live 0x0000000000000000
snd_timer 30118 2 snd_pcm,snd_seq, Live 0x0000000000000000
snd 84025 31 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_codec_generic,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_rawmidi,snd_seq,snd_seq_device,snd_timer,
Live 0x0000000000000000
ie31200_edac 12938 0 - Live 0x0000000000000000
soundcore 15091 2 snd_hda_codec,snd, Live 0x0000000000000000
edac_core 52405 1 ie31200_edac, Live 0x0000000000000000
parport_pc 32906 0 - Live 0x0000000000000000
ppdev 17711 0 - Live 0x0000000000000000
lp 17799 0 - Live 0x0000000000000000
parport 42481 3 parport_pc,ppdev,lp, Live 0x0000000000000000
nls_iso8859_1 12713 1 - Live 0x0000000000000000
rtsx_usb_sdmmc 28381 0 - Live 0x0000000000000000
rtsx_usb 21330 2 rtsx_usb_ms,rtsx_usb_sdmmc, Live 0x0000000000000000
hid_generic 12559 0 - Live 0x0000000000000000
usbhid 53122 0 - Live 0x0000000000000000
hid 110572 4 hid_multitouch,hid_generic,usbhid, Live 0x0000000000000000
i915 993210 8 - Live 0x0000000000000000
i2c_algo_bit 13564 1 i915, Live 0x0000000000000000
drm_kms_helper 99872 1 i915, Live 0x0000000000000000
psmouse 118039 0 - Live 0x0000000000000000
r8169 77680 0 - Live 0x0000000000000000
ahci 30167 3 - Live 0x0000000000000000
drm 318542 7 i915,drm_kms_helper, Live 0x0000000000000000
libahci 32533 1 ahci, Live 0x0000000000000000
mii 13981 1 r8169, Live 0x0000000000000000
video 20569 2 asus_wmi,i915, Live 0x0000000000000000


[7.4]ctr 13193 3 - Live 0x0000000000000000
ccm 17856 3 - Live 0x0000000000000000
bbswitch 13943 0 - Live 0x0000000000000000 (OE)
arc4 12573 2 - Live 0x0000000000000000
dm_crypt 23456 0 - Live 0x0000000000000000
iwlmvm 249097 0 - Live 0x0000000000000000
mac80211 696913 1 iwlmvm, Live 0x0000000000000000
rtsx_usb_ms 19050 0 - Live 0x0000000000000000
memstick 16968 1 rtsx_usb_ms, Live 0x0000000000000000
asus_nb_wmi 21128 0 - Live 0x0000000000000000
asus_wmi 24697 1 asus_nb_wmi, Live 0x0000000000000000
intel_rapl 19196 0 - Live 0x0000000000000000
sparse_keymap 13890 1 asus_wmi, Live 0x0000000000000000
mxm_wmi 13021 0 - Live 0x0000000000000000
x86_pkg_temp_thermal 14312 0 - Live 0x0000000000000000
intel_powerclamp 19099 0 - Live 0x0000000000000000
coretemp 13638 0 - Live 0x0000000000000000
kvm_intel 149257 0 - Live 0x0000000000000000
kvm 468567 1 kvm_intel, Live 0x0000000000000000
rfcomm 75114 12 - Live 0x0000000000000000
bnep 19884 2 - Live 0x0000000000000000
crct10dif_pclmul 14268 0 - Live 0x0000000000000000
crc32_pclmul 13180 0 - Live 0x0000000000000000
uvcvideo 86628 0 - Live 0x0000000000000000
videobuf2_vmalloc 13216 1 uvcvideo, Live 0x0000000000000000
videobuf2_memops 13362 1 videobuf2_vmalloc, Live 0x0000000000000000
videobuf2_core 59907 1 uvcvideo, Live 0x0000000000000000
ghash_clmulni_intel 13230 0 - Live 0x0000000000000000
v4l2_common 15715 1 videobuf2_core, Live 0x0000000000000000
aesni_intel 165469 96958 - Live 0x0000000000000000
videodev 163831 3 uvcvideo,videobuf2_core,v4l2_common, Live 0x0000000000000000
media 22008 2 uvcvideo,videodev, Live 0x0000000000000000
hid_multitouch 17657 0 - Live 0x0000000000000000
aes_x86_64 17131 1 aesni_intel, Live 0x0000000000000000
lrw 13323 1 aesni_intel, Live 0x0000000000000000
joydev 17587 0 - Live 0x0000000000000000
iwlwifi 190863 1 iwlmvm, Live 0x0000000000000000
gf128mul 14951 1 lrw, Live 0x0000000000000000
btusb 32408 0 - Live 0x0000000000000000
glue_helper 14095 1 aesni_intel, Live 0x0000000000000000
ablk_helper 13597 1 aesni_intel, Live 0x0000000000000000
serio_raw 13483 0 - Live 0x0000000000000000
cryptd 20531 48478 ghash_clmulni_intel,aesni_intel,ablk_helper, Live
0x0000000000000000
bluetooth 477455 22 rfcomm,bnep,btusb, Live 0x0000000000000000
rtc_efi 12760 0 - Live 0x0000000000000000
cfg80211 514757 3 iwlmvm,mac80211,iwlwifi, Live 0x0000000000000000
lpc_ich 21176 0 - Live 0x0000000000000000
wmi 19379 2 asus_wmi,mxm_wmi, Live 0x0000000000000000
mac_hid 13275 0 - Live 0x0000000000000000
binfmt_misc 17508 1 - Live 0x0000000000000000
mei_me 19524 0 - Live 0x0000000000000000
mei 88810 1 mei_me, Live 0x0000000000000000
snd_hda_codec_hdmi 52620 1 - Live 0x0000000000000000
snd_hda_codec_realtek 78564 1 - Live 0x0000000000000000
snd_hda_codec_generic 70087 1 snd_hda_codec_realtek, Live 0x0000000000000000
snd_hda_intel 30783 10 - Live 0x0000000000000000
snd_hda_controller 32234 1 snd_hda_intel, Live 0x0000000000000000
snd_hda_codec 145035 5
snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_codec_generic,snd_hda_intel,snd_hda_controller,
Live 0x0000000000000000
snd_hwdep 17709 1 snd_hda_codec, Live 0x0000000000000000
snd_pcm 105052 4
snd_hda_codec_hdmi,snd_hda_intel,snd_hda_controller,snd_hda_codec,
Live 0x0000000000000000
snd_seq_midi 13564 0 - Live 0x0000000000000000
snd_seq_midi_event 14899 1 snd_seq_midi, Live 0x0000000000000000
snd_rawmidi 31197 1 snd_seq_midi, Live 0x0000000000000000
snd_seq 63540 2 snd_seq_midi,snd_seq_midi_event, Live 0x0000000000000000
snd_seq_device 14497 3 snd_seq_midi,snd_rawmidi,snd_seq, Live 0x0000000000000000
snd_timer 30118 2 snd_pcm,snd_seq, Live 0x0000000000000000
snd 84025 31 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_codec_generic,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_rawmidi,snd_seq,snd_seq_device,snd_timer,
Live 0x0000000000000000
ie31200_edac 12938 0 - Live 0x0000000000000000
soundcore 15091 2 snd_hda_codec,snd, Live 0x0000000000000000
edac_core 52405 1 ie31200_edac, Live 0x0000000000000000
parport_pc 32906 0 - Live 0x0000000000000000
ppdev 17711 0 - Live 0x0000000000000000
lp 17799 0 - Live 0x0000000000000000
parport 42481 3 parport_pc,ppdev,lp, Live 0x0000000000000000
nls_iso8859_1 12713 1 - Live 0x0000000000000000
rtsx_usb_sdmmc 28381 0 - Live 0x0000000000000000
rtsx_usb 21330 2 rtsx_usb_ms,rtsx_usb_sdmmc, Live 0x0000000000000000
hid_generic 12559 0 - Live 0x0000000000000000
usbhid 53122 0 - Live 0x0000000000000000
hid 110572 4 hid_multitouch,hid_generic,usbhid, Live 0x0000000000000000
i915 993210 8 - Live 0x0000000000000000
i2c_algo_bit 13564 1 i915, Live 0x0000000000000000
drm_kms_helper 99872 1 i915, Live 0x0000000000000000
psmouse 118039 0 - Live 0x0000000000000000
r8169 77680 0 - Live 0x0000000000000000
ahci 30167 3 - Live 0x0000000000000000
drm 318542 7 i915,drm_kms_helper, Live 0x0000000000000000
libahci 32533 1 ahci, Live 0x0000000000000000
mii 13981 1 r8169, Live 0x0000000000000000
video 20569 2 asus_wmi,i915, Live 0x0000000000000000

carla@viror:~$ cat /proc/iomem
00000000-00000fff : reserved
00001000-00057fff : System RAM
00058000-00058fff : reserved
00059000-0009dfff : System RAM
0009e000-0009ffff : reserved
000a0000-000bffff : PCI Bus 0000:00
000c0000-000c3fff : PCI Bus 0000:00
000c4000-000c7fff : PCI Bus 0000:00
000c8000-000cbfff : PCI Bus 0000:00
000cc000-000cffff : PCI Bus 0000:00
000d0000-000d3fff : PCI Bus 0000:00
000d4000-000d7fff : PCI Bus 0000:00
000d8000-000dbfff : PCI Bus 0000:00
000dc000-000dffff : PCI Bus 0000:00
000f0000-000fffff : System ROM
00100000-b9875fff : System RAM
  02000000-027a9ab7 : Kernel code
  027a9ab8-02d1e57f : Kernel data
  02e80000-02fc6fff : Kernel bss
b9876000-b987cfff : ACPI Non-volatile Storage
b987d000-ba0e7fff : System RAM
ba0e8000-ba373fff : reserved
ba374000-c98dffff : System RAM
c98e0000-c9af6fff : reserved
c9af7000-c9e1bfff : System RAM
c9e1c000-cab1efff : ACPI Non-volatile Storage
cab1f000-caf58fff : reserved
caf59000-caffefff : reserved
cafff000-caffffff : System RAM
cb000000-cbbfffff : RAM buffer
cbc00000-cfdfffff : reserved
  cbe00000-cfdfffff : Graphics Stolen Memory
cfe00000-feafffff : PCI Bus 0000:00
  cfe00000-cfffffff : PCI Bus 0000:03
  d0000000-dfffffff : 0000:00:02.0
  e0000000-f1ffffff : PCI Bus 0000:01
    e0000000-efffffff : 0000:01:00.0
    f0000000-f1ffffff : 0000:01:00.0
  f2100000-f21fffff : PCI Bus 0000:05
    f2100000-f2103fff : 0000:05:00.0
      f2100000-f2103fff : r8169
  f2200000-f23fffff : PCI Bus 0000:03
  f2400000-f25fffff : PCI Bus 0000:02
  f2600000-f27fffff : PCI Bus 0000:02
  f2800000-f29fffff : PCI Bus 0000:04
  f6000000-f70fffff : PCI Bus 0000:01
    f6000000-f6ffffff : 0000:01:00.0
    f7000000-f707ffff : 0000:01:00.0
  f7400000-f77fffff : 0000:00:02.0
  f7800000-f78fffff : PCI Bus 0000:05
    f7800000-f7800fff : 0000:05:00.0
      f7800000-f7800fff : r8169
  f7900000-f79fffff : PCI Bus 0000:04
    f7900000-f7901fff : 0000:04:00.0
      f7900000-f7901fff : iwlwifi
  f7a00000-f7a0ffff : 0000:00:14.0
    f7a00000-f7a0ffff : xhci_hcd
  f7a10000-f7a13fff : 0000:00:1b.0
    f7a10000-f7a13fff : ICH HD audio
  f7a14000-f7a17fff : 0000:00:03.0
    f7a14000-f7a17fff : ICH HD audio
  f7a19000-f7a190ff : 0000:00:1f.3
  f7a1a000-f7a1a7ff : 0000:00:1f.2
    f7a1a000-f7a1a7ff : ahci
  f7a1b000-f7a1b3ff : 0000:00:1d.0
    f7a1b000-f7a1b3ff : ehci_hcd
  f7a1c000-f7a1c3ff : 0000:00:1a.0
    f7a1c000-f7a1c3ff : ehci_hcd
  f7a1e000-f7a1e00f : 0000:00:16.0
    f7a1e000-f7a1e00f : mei_me
  f7fdf000-f7fdffff : pnp 00:08
  f7fe0000-f7feffff : pnp 00:08
  f8000000-fbffffff : PCI MMCONFIG 0000 [bus 00-3f]
    f8000000-fbffffff : reserved
      f8000000-fbffffff : pnp 00:08
fec00000-fec00fff : reserved
  fec00000-fec003ff : IOAPIC 0
fed00000-fed03fff : reserved
  fed00000-fed003ff : HPET 0
    fed00000-fed003ff : PNP0103:00
fed10000-fed17fff : pnp 00:08
fed18000-fed18fff : pnp 00:08
fed19000-fed19fff : pnp 00:08
fed1c000-fed1ffff : reserved
  fed1c000-fed1ffff : pnp 00:08
    fed1f410-fed1f414 : iTCO_wdt
fed20000-fed3ffff : pnp 00:08
fed40000-fed44fff : pnp 00:00
fed45000-fed8ffff : pnp 00:08
fed90000-fed90fff : dmar0
fed91000-fed91fff : dmar1
fee00000-fee00fff : Local APIC
  fee00000-fee00fff : reserved
ff000000-ffffffff : reserved
  ff000000-ffffffff : INT0800:00
    ff000000-ffffffff : pnp 00:08
100000000-42f1fffff : System RAM
42f200000-42fffffff : RAM buffer


[7.5]
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core
Processor DRAM Controller (rev 06)
Subsystem: ASUSTeK Computer Inc. Device 11cd
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort+ >SERR- <PERR- INTx-
Latency: 0
Capabilities: [e0] Vendor Specific Information: Len=0c <?>

00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core
Processor PCI Express x16 Controller (rev 06) (prog-if 00 [Normal
decode])
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
I/O behind bridge: 0000e000-0000efff
Memory behind bridge: f6000000-f70fffff
Prefetchable memory behind bridge: 00000000e0000000-00000000f1ffffff
Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- <SERR- <PERR-
BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B-
PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
Capabilities: [88] Subsystem: ASUSTeK Computer Inc. Device 11cd
Capabilities: [80] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-
Address: fee002d8  Data: 0000
Capabilities: [a0] Express (v2) Root Port (Slot+), MSI 00
DevCap: MaxPayload 256 bytes, PhantFunc 0
ExtTag- RBE+
DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
MaxPayload 256 bytes, MaxReadReq 128 bytes
DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
LnkCap: Port #2, Speed 8GT/s, Width x16, ASPM L0s L1, Exit Latency L0s
<256ns, L1 <8us
ClockPM- Surprise- LLActRep- BwNot+
LnkCtl: ASPM Disabled; RCB 64 bytes Disabled+ CommClk+
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 8GT/s, Width x16, TrErr- Train- SlotClk+ DLActive-
BWMgmt+ ABWMgmt+
SltCap: AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug- Surprise-
Slot #1, PowerLimit 75.000W; Interlock- NoCompl+
SltCtl: Enable: AttnBtn- PwrFlt- MRL- PresDet- CmdCplt- HPIrq- LinkChg-
Control: AttnInd Unknown, PwrInd Unknown, Power- Interlock-
SltSta: Status: AttnBtn- PowerFlt- MRL- CmdCplt- PresDet+ Interlock-
Changed: MRL- PresDet+ LinkState-
RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna+ CRSVisible-
RootCap: CRSVisible-
RootSta: PME ReqID 0000, PMEStatus- PMEPending-
DevCap2: Completion Timeout: Not Supported, TimeoutDis-, LTR+, OBFF
Via WAKE# ARIFwd-
DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Via
WAKE# ARIFwd-
LnkCtl2: Target Link Speed: 8GT/s, EnterCompliance- SpeedDis-
Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
Compliance De-emphasis: -6dB
LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete+,
EqualizationPhase1+
EqualizationPhase2+, EqualizationPhase3+, LinkEqualizationRequest-
Capabilities: [100 v1] Virtual Channel
Caps: LPEVC=0 RefClk=100ns PATEntryBits=1
Arb: Fixed- WRR32- WRR64- WRR128-
Ctrl: ArbSelect=Fixed
Status: InProgress-
VC0: Caps: PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
Arb: Fixed+ WRR32- WRR64- WRR128- TWRR128- WRR256-
Ctrl: Enable+ ID=0 ArbSelect=Fixed TC/VC=ff
Status: NegoPending+ InProgress-
Capabilities: [140 v1] Root Complex Link
Desc: PortNumber=02 ComponentID=01 EltType=Config
Link0: Desc: TargetPort=00 TargetComponent=01 AssocRCRB-
LinkType=MemMapped LinkValid+
Addr: 00000000fed19000
Capabilities: [d94 v1] #19
Kernel driver in use: pcieport

00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core
Processor Integrated Graphics Controller (rev 06) (prog-if 00 [VGA
controller])
Subsystem: ASUSTeK Computer Inc. Device 11cd
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
Interrupt: pin A routed to IRQ 34
Region 0: Memory at f7400000 (64-bit, non-prefetchable) [size=4M]
Region 2: Memory at d0000000 (64-bit, prefetchable) [size=256M]
Region 4: I/O ports at f000 [size=64]
Expansion ROM at <unassigned> [disabled]
Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-
Address: fee00018  Data: 0000
Capabilities: [d0] Power Management version 2
Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [a4] PCI Advanced Features
AFCap: TP+ FLR+
AFCtrl: FLR-
AFStatus: TP-
Kernel driver in use: i915

00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core
Processor HD Audio Controller (rev 06)
Subsystem: Intel Corporation Device 2010
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 36
Region 0: Memory at f7a14000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [50] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit-
Address: fee00498  Data: 0000
Capabilities: [70] Express (v1) Root Complex Integrated Endpoint, MSI 00
DevCap: MaxPayload 128 bytes, PhantFunc 0
ExtTag- RBE-
DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
MaxPayload 128 bytes, MaxReadReq 128 bytes
DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
Kernel driver in use: snd_hda_intel

00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset
Family USB xHCI (rev 05) (prog-if 30 [XHCI])
Subsystem: ASUSTeK Computer Inc. Device 11cd
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
Interrupt: pin A routed to IRQ 31
Region 0: Memory at f7a00000 (64-bit, non-prefetchable) [size=64K]
Capabilities: [70] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0-,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [80] MSI: Enable+ Count=1/8 Maskable- 64bit+
Address: 00000000fee003f8  Data: 0000
Kernel driver in use: xhci_hcd

00:16.0 Communication controller: Intel Corporation 8 Series/C220
Series Chipset Family MEI Controller #1 (rev 04)
Subsystem: ASUSTeK Computer Inc. Device 11cd
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
Interrupt: pin A routed to IRQ 35
Region 0: Memory at f7a1e000 (64-bit, non-prefetchable) [size=16]
Capabilities: [50] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [8c] MSI: Enable+ Count=1/1 Maskable- 64bit+
Address: 00000000fee00478  Data: 0000
Kernel driver in use: mei_me

00:1a.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset
Family USB EHCI #2 (rev 05) (prog-if 20 [EHCI])
Subsystem: ASUSTeK Computer Inc. Device 11cd
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
Interrupt: pin A routed to IRQ 16
Region 0: Memory at f7a1c000 (32-bit, non-prefetchable) [size=1K]
Capabilities: [50] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [58] Debug port: BAR=1 offset=00a0
Capabilities: [98] PCI Advanced Features
AFCap: TP+ FLR+
AFCtrl: FLR-
AFStatus: TP-
Kernel driver in use: ehci-pci

00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset
High Definition Audio Controller (rev 05)
Subsystem: ASUSTeK Computer Inc. Device 11cd
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 37
Region 0: Memory at f7a10000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [50] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
Address: 00000000fee004b8  Data: 0000
Capabilities: [70] Express (v1) Root Complex Integrated Endpoint, MSI 00
DevCap: MaxPayload 128 bytes, PhantFunc 0
ExtTag- RBE-
DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
MaxPayload 128 bytes, MaxReadReq 128 bytes
DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
Capabilities: [100 v1] Virtual Channel
Caps: LPEVC=0 RefClk=100ns PATEntryBits=1
Arb: Fixed- WRR32- WRR64- WRR128-
Ctrl: ArbSelect=Fixed
Status: InProgress-
VC0: Caps: PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
Arb: Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
Ctrl: Enable+ ID=0 ArbSelect=Fixed TC/VC=01
Status: NegoPending- InProgress-
VC1: Caps: PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
Arb: Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
Ctrl: Enable+ ID=2 ArbSelect=Fixed TC/VC=04
Status: NegoPending- InProgress-
Kernel driver in use: snd_hda_intel

00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset
Family PCI Express Root Port #1 (rev d5) (prog-if 00 [Normal decode])
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
I/O behind bridge: 0000f000-00000fff
Memory behind bridge: fff00000-000fffff
Prefetchable memory behind bridge: 00000000fff00000-00000000000fffff
Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- <SERR- <PERR-
BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B-
PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
Capabilities: [40] Express (v2) Root Port (Slot-), MSI 00
DevCap: MaxPayload 128 bytes, PhantFunc 0
ExtTag- RBE+
DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
MaxPayload 128 bytes, MaxReadReq 128 bytes
DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
LnkCap: Port #1, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s
<1us, L1 <4us
ClockPM- Surprise- LLActRep+ BwNot+
LnkCtl: ASPM L0s L1 Enabled; RCB 64 bytes Disabled- CommClk-
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s, Width x0, TrErr- Train- SlotClk+ DLActive-
BWMgmt- ABWMgmt-
RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna+ CRSVisible-
RootCap: CRSVisible-
RootSta: PME ReqID 0000, PMEStatus- PMEPending-
DevCap2: Completion Timeout: Range ABC, TimeoutDis+, LTR+, OBFF Via
WAKE# ARIFwd-
DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR+, OBFF
Disabled ARIFwd-
LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-
Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
Compliance De-emphasis: -6dB
LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-,
EqualizationPhase1-
EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
Address: fee002f8  Data: 0000
Capabilities: [90] Subsystem: ASUSTeK Computer Inc. Device 11cd
Capabilities: [a0] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Kernel driver in use: pcieport

00:1c.1 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset
Family PCI Express Root Port #2 (rev d5) (prog-if 00 [Normal decode])
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Bus: primary=00, secondary=03, subordinate=03, sec-latency=0
I/O behind bridge: 00002000-00002fff
Memory behind bridge: cfe00000-cfffffff
Prefetchable memory behind bridge: 00000000f2200000-00000000f23fffff
Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- <SERR- <PERR-
BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B-
PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
Capabilities: [40] Express (v2) Root Port (Slot+), MSI 00
DevCap: MaxPayload 128 bytes, PhantFunc 0
ExtTag- RBE+
DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
MaxPayload 128 bytes, MaxReadReq 128 bytes
DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
LnkCap: Port #2, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s
<1us, L1 <16us
ClockPM- Surprise- LLActRep+ BwNot+
LnkCtl: ASPM L0s L1 Enabled; RCB 64 bytes Disabled- CommClk-
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s, Width x0, TrErr- Train- SlotClk+ DLActive-
BWMgmt- ABWMgmt-
SltCap: AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug+ Surprise+
Slot #1, PowerLimit 10.000W; Interlock- NoCompl+
SltCtl: Enable: AttnBtn- PwrFlt- MRL- PresDet+ CmdCplt- HPIrq+ LinkChg+
Control: AttnInd Unknown, PwrInd Unknown, Power- Interlock-
SltSta: Status: AttnBtn- PowerFlt- MRL- CmdCplt- PresDet- Interlock-
Changed: MRL- PresDet- LinkState-
RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna+ CRSVisible-
RootCap: CRSVisible-
RootSta: PME ReqID 0000, PMEStatus- PMEPending-
DevCap2: Completion Timeout: Range ABC, TimeoutDis+, LTR+, OBFF Not
Supported ARIFwd-
DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR+, OBFF
Disabled ARIFwd-
LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-
Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
Compliance De-emphasis: -6dB
LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-,
EqualizationPhase1-
EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
Address: fee00338  Data: 0000
Capabilities: [90] Subsystem: ASUSTeK Computer Inc. Device 11cd
Capabilities: [a0] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Kernel driver in use: pcieport

00:1c.2 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset
Family PCI Express Root Port #3 (rev d5) (prog-if 00 [Normal decode])
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Bus: primary=00, secondary=04, subordinate=04, sec-latency=0
I/O behind bridge: 0000f000-00000fff
Memory behind bridge: f7900000-f79fffff
Prefetchable memory behind bridge: 00000000fff00000-00000000000fffff
Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- <SERR- <PERR-
BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B-
PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
Capabilities: [40] Express (v2) Root Port (Slot+), MSI 00
DevCap: MaxPayload 128 bytes, PhantFunc 0
ExtTag- RBE+
DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
MaxPayload 128 bytes, MaxReadReq 128 bytes
DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
LnkCap: Port #3, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s
<512ns, L1 <16us
ClockPM- Surprise- LLActRep+ BwNot+
LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk+
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive+
BWMgmt+ ABWMgmt-
SltCap: AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug- Surprise-
Slot #2, PowerLimit 10.000W; Interlock- NoCompl+
SltCtl: Enable: AttnBtn- PwrFlt- MRL- PresDet- CmdCplt- HPIrq- LinkChg-
Control: AttnInd Unknown, PwrInd Unknown, Power- Interlock-
SltSta: Status: AttnBtn- PowerFlt- MRL- CmdCplt- PresDet+ Interlock-
Changed: MRL- PresDet- LinkState+
RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna+ CRSVisible-
RootCap: CRSVisible-
RootSta: PME ReqID 0000, PMEStatus- PMEPending-
DevCap2: Completion Timeout: Range ABC, TimeoutDis+, LTR+, OBFF Not
Supported ARIFwd-
DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR+, OBFF
Disabled ARIFwd-
LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-
Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
Compliance De-emphasis: -6dB
LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-,
EqualizationPhase1-
EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
Address: fee00378  Data: 0000
Capabilities: [90] Subsystem: ASUSTeK Computer Inc. Device 11cd
Capabilities: [a0] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Kernel driver in use: pcieport

00:1c.3 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset
Family PCI Express Root Port #4 (rev d5) (prog-if 00 [Normal decode])
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Bus: primary=00, secondary=05, subordinate=05, sec-latency=0
I/O behind bridge: 0000d000-0000dfff
Memory behind bridge: f7800000-f78fffff
Prefetchable memory behind bridge: 00000000f2100000-00000000f21fffff
Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- <SERR- <PERR-
BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B-
PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
Capabilities: [40] Express (v2) Root Port (Slot+), MSI 00
DevCap: MaxPayload 128 bytes, PhantFunc 0
ExtTag- RBE+
DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
MaxPayload 128 bytes, MaxReadReq 128 bytes
DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
LnkCap: Port #4, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s
<512ns, L1 <16us
ClockPM- Surprise- LLActRep+ BwNot+
LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk+
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive+
BWMgmt+ ABWMgmt-
SltCap: AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug- Surprise-
Slot #3, PowerLimit 10.000W; Interlock- NoCompl+
SltCtl: Enable: AttnBtn- PwrFlt- MRL- PresDet- CmdCplt- HPIrq- LinkChg-
Control: AttnInd Unknown, PwrInd Unknown, Power- Interlock-
SltSta: Status: AttnBtn- PowerFlt- MRL- CmdCplt- PresDet+ Interlock-
Changed: MRL- PresDet- LinkState+
RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna+ CRSVisible-
RootCap: CRSVisible-
RootSta: PME ReqID 0000, PMEStatus- PMEPending-
DevCap2: Completion Timeout: Range ABC, TimeoutDis+, LTR+, OBFF Not
Supported ARIFwd-
DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR+, OBFF
Disabled ARIFwd-
LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-
Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
Compliance De-emphasis: -6dB
LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-,
EqualizationPhase1-
EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
Address: fee003b8  Data: 0000
Capabilities: [90] Subsystem: ASUSTeK Computer Inc. Device 11cd
Capabilities: [a0] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Kernel driver in use: pcieport

00:1d.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset
Family USB EHCI #1 (rev 05) (prog-if 20 [EHCI])
Subsystem: ASUSTeK Computer Inc. Device 11cd
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
Interrupt: pin A routed to IRQ 23
Region 0: Memory at f7a1b000 (32-bit, non-prefetchable) [size=1K]
Capabilities: [50] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [58] Debug port: BAR=1 offset=00a0
Capabilities: [98] PCI Advanced Features
AFCap: TP+ FLR+
AFCtrl: FLR-
AFStatus: TP-
Kernel driver in use: ehci-pci

00:1f.0 ISA bridge: Intel Corporation HM86 Express LPC Controller (rev 05)
Subsystem: ASUSTeK Computer Inc. Device 11cd
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
Capabilities: [e0] Vendor Specific Information: Len=0c <?>
Kernel driver in use: lpc_ich

00:1f.2 SATA controller: Intel Corporation 8 Series/C220 Series
Chipset Family 6-port SATA Controller 1 [AHCI mode] (rev 05) (prog-if
01 [AHCI 1.0])
Subsystem: ASUSTeK Computer Inc. Device 11cd
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
Interrupt: pin B routed to IRQ 32
Region 0: I/O ports at f0b0 [size=8]
Region 1: I/O ports at f0a0 [size=4]
Region 2: I/O ports at f090 [size=8]
Region 3: I/O ports at f080 [size=4]
Region 4: I/O ports at f060 [size=32]
Region 5: Memory at f7a1a000 (32-bit, non-prefetchable) [size=2K]
Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
Address: fee00418  Data: 0000
Capabilities: [70] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot+,D3cold-)
Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [a8] SATA HBA v1.0 BAR4 Offset=00000004
Kernel driver in use: ahci

00:1f.3 SMBus: Intel Corporation 8 Series/C220 Series Chipset Family
SMBus Controller (rev 05)
Subsystem: ASUSTeK Computer Inc. Device 11cd
Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Interrupt: pin C routed to IRQ 255
Region 0: Memory at f7a19000 (64-bit, non-prefetchable) [size=256]
Region 4: I/O ports at f040 [size=32]

01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 850M]
(rev ff) (prog-if ff)
!!! Unknown header type 7f

04:00.0 Network controller: Intel Corporation Wireless 7260 (rev 6b)
Subsystem: Intel Corporation Dual Band Wireless-AC 7260
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 38
Region 0: Memory at f7900000 (64-bit, non-prefetchable) [size=8K]
Capabilities: [c8] Power Management version 3
Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+
Address: 00000000fee004d8  Data: 0000
Capabilities: [40] Express (v2) Endpoint, MSI 00
DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s <512ns, L1 unlimited
ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset+
DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
RlxdOrd- ExtTag- PhantFunc- AuxPwr+ NoSnoop+ FLReset-
MaxPayload 128 bytes, MaxReadReq 128 bytes
DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency
L0s <4us, L1 <32us
ClockPM+ Surprise- LLActRep- BwNot-
LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk+
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive-
BWMgmt- ABWMgmt-
DevCap2: Completion Timeout: Range B, TimeoutDis+, LTR+, OBFF Via WAKE#
DevCtl2: Completion Timeout: 16ms to 55ms, TimeoutDis-, LTR+, OBFF Disabled
LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
Compliance De-emphasis: -6dB
LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-,
EqualizationPhase1-
EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
Capabilities: [100 v1] Advanced Error Reporting
UESta: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF-
MalfTLP- ECRC- UnsupReq- ACSViol-
UEMsk: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF-
MalfTLP- ECRC- UnsupReq- ACSViol-
UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+
MalfTLP+ ECRC- UnsupReq- ACSViol-
CESta: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
CEMsk: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
AERCap: First Error Pointer: 00, GenCap- CGenEn- ChkCap- ChkEn-
Capabilities: [140 v1] Device Serial Number f8-16-54-ff-ff-64-71-d4
Capabilities: [14c v1] Latency Tolerance Reporting
Max snoop latency: 71680ns
Max no snoop latency: 71680ns
Capabilities: [154 v1] Vendor Specific Information: ID=cafe Rev=1 Len=014 <?>
Kernel driver in use: iwlwifi

05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
Subsystem: ASUSTeK Computer Inc. Device 200f
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 33
Region 0: I/O ports at d000 [size=256]
Region 2: Memory at f7800000 (64-bit, non-prefetchable) [size=4K]
Region 4: Memory at f2100000 (64-bit, prefetchable) [size=16K]
Capabilities: [40] Power Management version 3
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
Address: 00000000fee00438  Data: 0000
Capabilities: [70] Express (v2) Endpoint, MSI 01
DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s <512ns, L1 <64us
ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
MaxPayload 128 bytes, MaxReadReq 4096 bytes
DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency
L0s unlimited, L1 <64us
ClockPM+ Surprise- LLActRep- BwNot-
LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk+
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive-
BWMgmt- ABWMgmt-
DevCap2: Completion Timeout: Range ABCD, TimeoutDis+, LTR+, OBFF Via
message/WAKE#
DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR+, OBFF Disabled
LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
Compliance De-emphasis: -6dB
LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-,
EqualizationPhase1-
EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
Capabilities: [b0] MSI-X: Enable- Count=4 Masked-
Vector table: BAR=4 offset=00000000
PBA: BAR=4 offset=00000800
Capabilities: [d0] Vital Product Data
Unknown small resource type 00, will not decode more.
Capabilities: [100 v1] Advanced Error Reporting
UESta: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF-
MalfTLP- ECRC- UnsupReq- ACSViol-
UEMsk: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF-
MalfTLP- ECRC- UnsupReq- ACSViol-
UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+
MalfTLP+ ECRC- UnsupReq- ACSViol-
CESta: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
CEMsk: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
AERCap: First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
Capabilities: [140 v1] Virtual Channel
Caps: LPEVC=0 RefClk=100ns PATEntryBits=1
Arb: Fixed- WRR32- WRR64- WRR128-
Ctrl: ArbSelect=Fixed
Status: InProgress-
VC0: Caps: PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
Arb: Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
Ctrl: Enable+ ID=0 ArbSelect=Fixed TC/VC=01
Status: NegoPending- InProgress-
Capabilities: [160 v1] Device Serial Number 14-17-43-36-68-4c-e0-00
Capabilities: [170 v1] Latency Tolerance Reporting
Max snoop latency: 71680ns
Max no snoop latency: 71680ns
Kernel driver in use: r8169



[7.6]
Attached devices:
Host: scsi2 Channel: 00 Id: 00 Lun: 00
  Vendor: MATSHITA Model: DVD-RAM UJ8E2 S  Rev: 1.00
  Type:   CD-ROM                           ANSI  SCSI revision: 05
Host: scsi4 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: SanDisk SD6SB1M2 Rev: 600
  Type:   Direct-Access                    ANSI  SCSI revision: 05


[7.7]
1     1681  1952  2096  3327  4345  4950  69   acpi         modules
10    17    1954  21    3328  4346  4984  7    asound       mounts
100   175   1958  2107  3329  4350  5     70   buddyinfo    mtrr
1024  176   196   2190  3330  4351  51    702  bus          net
1028  178   1963  22    34    4353  511   705  cgroups      pagetypeinfo
1034  179   1966  2207  3468  4372  514   708  cmdline      partitions
1035  1797  197   23    3476  4384  52    71   consoles     sched_debug
1038  18    1973  2339  36    4390  53    72   cpuinfo      schedstat
1072  180   1978  24    37    4394  530   724  crypto       scsi
1088  1802  1979  241   370   4398  531   725  devices      self
11    1808  1981  243   3773  44    54    73   diskstats    slabinfo
1111  181   1988  244   38    4402  55    74   dma          softirqs
1116  182   1990  245   3808  4406  56    75   driver       stat
119   183   1994  2482  384   4422  57    76   execdomains  swaps
12    1830  2     2491  3845  4452  579   771  fb           sys
120   1832  20    2493  3846  4498  58    78   filesystems  sysrq-trigger
1223  1834  2001  25    3847  4511  581   8    fs           sysvipc
1245  184   2011  2588  3849  46    585   80   interrupts   thread-self
1261  185   2012  2592  386   460   59    81   iomem        timer_list
1272  1855  2013  26    387   4605  60    815  ioports      timer_stats
1275  186   2026  27    388   461   606   82   irq          tty
1289  1865  2030  28    39    4612  61    846  kallsyms     uptime
13    1868  2034  280   41    4619  62    882  kcore        version
1303  1893  2035  29    4127  4631  63    889  keys         vmallocinfo
1319  1897  2037  3     4162  4632  632   9    key-users    vmstat
14    19    2038  31    4173  4676  64    927  kmsg         zoneinfo
1436  191   2039  3197  42    4690  65    935  kpagecount
1438  192   2042  32    422   47    655   94   kpageflags
1472  1924  2057  3206  4273  48    66    95   loadavg
15    1935  2067  3207  43    4848  67    954  locks
16    1938  2071  33    4335  49    672   959  mdstat
1632  1946  2077  3323  4342  4945  68    98   meminfo
1667  1950  2085  3326  4343  4949  681   99   misc


[X.]
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1378547

Hope I did that right and submitted to the right list. First time
reporting a bug in an upstream kernel. Thanks for all your fantastic
work making Linux usable for the moderately technical like me!

Bug originator: Carla Rosenfield
mailto: c.rosenfield@gmail.com

^ permalink raw reply

* [PATCH] Input: lpc32xx-keys: Switch to using managed resources
From: Pramod Gurav @ 2014-10-08  6:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pramod Gurav, Dmitry Torokhov, linux-input

This change switches to using devm_* managed resources APIs to
request the resources in probe to simplify probe error path and
module unloading.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 drivers/input/keyboard/lpc32xx-keys.c |   86 +++++++++------------------------
 1 file changed, 23 insertions(+), 63 deletions(-)

diff --git a/drivers/input/keyboard/lpc32xx-keys.c b/drivers/input/keyboard/lpc32xx-keys.c
index 8b1b013..6e244df 100644
--- a/drivers/input/keyboard/lpc32xx-keys.c
+++ b/drivers/input/keyboard/lpc32xx-keys.c
@@ -188,32 +188,27 @@ static int lpc32xx_kscan_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	kscandat = kzalloc(sizeof(struct lpc32xx_kscan_drv), GFP_KERNEL);
-	if (!kscandat) {
-		dev_err(&pdev->dev, "failed to allocate memory\n");
+	kscandat = devm_kzalloc(&pdev->dev, sizeof(*kscandat),
+				GFP_KERNEL);
+	if (!kscandat)
 		return -ENOMEM;
-	}
 
 	error = lpc32xx_parse_dt(&pdev->dev, kscandat);
 	if (error) {
 		dev_err(&pdev->dev, "failed to parse device tree\n");
-		goto err_free_mem;
+		return error;
 	}
 
 	keymap_size = sizeof(kscandat->keymap[0]) *
 				(kscandat->matrix_sz << kscandat->row_shift);
-	kscandat->keymap = kzalloc(keymap_size, GFP_KERNEL);
-	if (!kscandat->keymap) {
-		dev_err(&pdev->dev, "could not allocate memory for keymap\n");
-		error = -ENOMEM;
-		goto err_free_mem;
-	}
+	kscandat->keymap = devm_kzalloc(&pdev->dev, keymap_size, GFP_KERNEL);
+	if (!kscandat->keymap)
+		return -ENOMEM;
 
-	kscandat->input = input = input_allocate_device();
+	kscandat->input = input = devm_input_allocate_device(&pdev->dev);
 	if (!input) {
 		dev_err(&pdev->dev, "failed to allocate input device\n");
-		error = -ENOMEM;
-		goto err_free_keymap;
+		return -ENOMEM;
 	}
 
 	/* Setup key input */
@@ -234,39 +229,37 @@ static int lpc32xx_kscan_probe(struct platform_device *pdev)
 					   kscandat->keymap, kscandat->input);
 	if (error) {
 		dev_err(&pdev->dev, "failed to build keymap\n");
-		goto err_free_input;
+		return error;
 	}
 
 	input_set_drvdata(kscandat->input, kscandat);
 
-	kscandat->iores = request_mem_region(res->start, resource_size(res),
-					     pdev->name);
+	kscandat->iores = devm_request_mem_region(&pdev->dev, res->start,
+						  resource_size(res),
+						  pdev->name);
 	if (!kscandat->iores) {
 		dev_err(&pdev->dev, "failed to request I/O memory\n");
-		error = -EBUSY;
-		goto err_free_input;
+		return -EBUSY;
 	}
 
-	kscandat->kscan_base = ioremap(kscandat->iores->start,
+	kscandat->kscan_base = devm_ioremap(&pdev->dev, kscandat->iores->start,
 				       resource_size(kscandat->iores));
 	if (!kscandat->kscan_base) {
 		dev_err(&pdev->dev, "failed to remap I/O memory\n");
-		error = -EBUSY;
-		goto err_release_memregion;
+		return -EBUSY;
 	}
 
 	/* Get the key scanner clock */
-	kscandat->clk = clk_get(&pdev->dev, NULL);
+	kscandat->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(kscandat->clk)) {
 		dev_err(&pdev->dev, "failed to get clock\n");
-		error = PTR_ERR(kscandat->clk);
-		goto err_unmap;
+		return PTR_ERR(kscandat->clk);
 	}
 
 	/* Configure the key scanner */
 	error = clk_prepare_enable(kscandat->clk);
 	if (error)
-		goto err_clk_put;
+		return error;
 
 	writel(kscandat->deb_clks, LPC32XX_KS_DEB(kscandat->kscan_base));
 	writel(kscandat->scan_delay, LPC32XX_KS_SCAN_CTL(kscandat->kscan_base));
@@ -277,52 +270,20 @@ static int lpc32xx_kscan_probe(struct platform_device *pdev)
 	writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base));
 	clk_disable_unprepare(kscandat->clk);
 
-	error = request_irq(irq, lpc32xx_kscan_irq, 0, pdev->name, kscandat);
+	error = devm_request_irq(&pdev->dev, irq, lpc32xx_kscan_irq, 0,
+				 pdev->name, kscandat);
 	if (error) {
 		dev_err(&pdev->dev, "failed to request irq\n");
-		goto err_clk_put;
+		return error;
 	}
 
 	error = input_register_device(kscandat->input);
 	if (error) {
 		dev_err(&pdev->dev, "failed to register input device\n");
-		goto err_free_irq;
+		return error;
 	}
 
 	platform_set_drvdata(pdev, kscandat);
-	return 0;
-
-err_free_irq:
-	free_irq(irq, kscandat);
-err_clk_put:
-	clk_put(kscandat->clk);
-err_unmap:
-	iounmap(kscandat->kscan_base);
-err_release_memregion:
-	release_mem_region(kscandat->iores->start,
-			   resource_size(kscandat->iores));
-err_free_input:
-	input_free_device(kscandat->input);
-err_free_keymap:
-	kfree(kscandat->keymap);
-err_free_mem:
-	kfree(kscandat);
-
-	return error;
-}
-
-static int lpc32xx_kscan_remove(struct platform_device *pdev)
-{
-	struct lpc32xx_kscan_drv *kscandat = platform_get_drvdata(pdev);
-
-	free_irq(platform_get_irq(pdev, 0), kscandat);
-	clk_put(kscandat->clk);
-	iounmap(kscandat->kscan_base);
-	release_mem_region(kscandat->iores->start,
-			   resource_size(kscandat->iores));
-	input_unregister_device(kscandat->input);
-	kfree(kscandat->keymap);
-	kfree(kscandat);
 
 	return 0;
 }
@@ -378,7 +339,6 @@ MODULE_DEVICE_TABLE(of, lpc32xx_kscan_match);
 
 static struct platform_driver lpc32xx_kscan_driver = {
 	.probe		= lpc32xx_kscan_probe,
-	.remove		= lpc32xx_kscan_remove,
 	.driver		= {
 		.name	= DRV_NAME,
 		.owner	= THIS_MODULE,
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH] Input: mpr121: Switch to using managed resources
From: Pramod Gurav @ 2014-10-08  6:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pramod Gurav, Dmitry Torokhov, linux-input

This change switches to using devm_* managed resources APIs to
request the resources in probe to simplify probe error path and
module unloading and does away with remove function.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 drivers/input/keyboard/mpr121_touchkey.c |   35 +++++++-----------------------
 1 file changed, 8 insertions(+), 27 deletions(-)

diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c
index 009c822..49c578e 100644
--- a/drivers/input/keyboard/mpr121_touchkey.c
+++ b/drivers/input/keyboard/mpr121_touchkey.c
@@ -214,12 +214,12 @@ static int mpr_touchkey_probe(struct i2c_client *client,
 		return -EINVAL;
 	}
 
-	mpr121 = kzalloc(sizeof(struct mpr121_touchkey), GFP_KERNEL);
-	input_dev = input_allocate_device();
+	mpr121 = devm_kzalloc(&client->dev, sizeof(*mpr121),
+			      GFP_KERNEL);
+	input_dev = devm_input_allocate_device(&client->dev);
 	if (!mpr121 || !input_dev) {
 		dev_err(&client->dev, "Failed to allocate memory\n");
-		error = -ENOMEM;
-		goto err_free_mem;
+		return -ENOMEM;
 	}
 
 	mpr121->client = client;
@@ -243,44 +243,26 @@ static int mpr_touchkey_probe(struct i2c_client *client,
 	error = mpr121_phys_init(pdata, mpr121, client);
 	if (error) {
 		dev_err(&client->dev, "Failed to init register\n");
-		goto err_free_mem;
+		return error;
 	}
 
-	error = request_threaded_irq(client->irq, NULL,
+	error = devm_request_threaded_irq(&client->dev, client->irq, NULL,
 				     mpr_touchkey_interrupt,
 				     IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 				     client->dev.driver->name, mpr121);
 	if (error) {
 		dev_err(&client->dev, "Failed to register interrupt\n");
-		goto err_free_mem;
+		return error;
 	}
 
 	error = input_register_device(input_dev);
 	if (error)
-		goto err_free_irq;
+		return error;
 
 	i2c_set_clientdata(client, mpr121);
 	device_init_wakeup(&client->dev, pdata->wakeup);
 
 	return 0;
-
-err_free_irq:
-	free_irq(client->irq, mpr121);
-err_free_mem:
-	input_free_device(input_dev);
-	kfree(mpr121);
-	return error;
-}
-
-static int mpr_touchkey_remove(struct i2c_client *client)
-{
-	struct mpr121_touchkey *mpr121 = i2c_get_clientdata(client);
-
-	free_irq(client->irq, mpr121);
-	input_unregister_device(mpr121->input_dev);
-	kfree(mpr121);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -327,7 +309,6 @@ static struct i2c_driver mpr_touchkey_driver = {
 	},
 	.id_table	= mpr121_id,
 	.probe		= mpr_touchkey_probe,
-	.remove		= mpr_touchkey_remove,
 };
 
 module_i2c_driver(mpr_touchkey_driver);
-- 
1.7.9.5


^ permalink raw reply related

* Re: [PATCH] Input: opencores-kbd: Switch to using managed resources
From: Tobias Klauser @ 2014-10-08  7:09 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Pramod Gurav, linux-kernel, linux-input
In-Reply-To: <20141007161716.GB16469@dtor-ws>

On 2014-10-07 at 18:17:16 +0200, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> On Tue, Oct 07, 2014 at 03:33:22PM +0200, Tobias Klauser wrote:
> > On 2014-10-07 at 13:31:41 +0200, Pramod Gurav <pramod.gurav@smartplayin.com> wrote:
> > > This change switch to managed resources to simplifies error handling
> > > and module unloading and does away with platform_driver remove function.
> > > 
> > > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > > Cc: linux-input@vger.kernel.org
> > > Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
> > > ---
> > >  drivers/input/keyboard/opencores-kbd.c |   54 ++++++++------------------------
> > >  1 file changed, 13 insertions(+), 41 deletions(-)
> > > 
> > > diff --git a/drivers/input/keyboard/opencores-kbd.c b/drivers/input/keyboard/opencores-kbd.c
> > > index 7b9b441..ecacb87 100644
> > > --- a/drivers/input/keyboard/opencores-kbd.c
> > > +++ b/drivers/input/keyboard/opencores-kbd.c
> > > @@ -56,27 +56,27 @@ static int opencores_kbd_probe(struct platform_device *pdev)
> > >  		return -EINVAL;
> > >  	}
> > >  
> > > -	opencores_kbd = kzalloc(sizeof(*opencores_kbd), GFP_KERNEL);
> > > -	input = input_allocate_device();
> > > +	opencores_kbd = devm_kzalloc(&pdev->dev, sizeof(*opencores_kbd),
> > > +				     GFP_KERNEL);
> > > +	input = devm_input_allocate_device(&pdev->dev);
> > >  	if (!opencores_kbd || !input) {
> > >  		dev_err(&pdev->dev, "failed to allocate device structures\n");
> > > -		error = -ENOMEM;
> > > -		goto err_free_mem;
> > > +		return -ENOMEM;
> > >  	}
> > >  
> > >  	opencores_kbd->addr_res = res;
> > > -	res = request_mem_region(res->start, resource_size(res), pdev->name);
> > > +	res = devm_request_mem_region(&pdev->dev, res->start,
> > > +				      resource_size(res), pdev->name);
> > >  	if (!res) {
> > >  		dev_err(&pdev->dev, "failed to request I/O memory\n");
> > > -		error = -EBUSY;
> > > -		goto err_free_mem;
> > > +		return -EBUSY;
> > >  	}
> > >  
> > > -	opencores_kbd->addr = ioremap(res->start, resource_size(res));
> > > +	opencores_kbd->addr = devm_ioremap(&pdev->dev, res->start,
> > > +					   resource_size(res));
> > 
> > You could use devm_ioremap_resource() here and get rid of the call to
> > devm_request_mem_region() and the check for !res above, i.e. something
> > like:
> > 
> > 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > 	[...]
> > 	opencores_kbd->addr = devm_ioremap_resource(&pdev->dev, res);
> > 	if (!opencores_kbd->addr) {
> > 		dev_err(&pdev->dev, "failed to remap I/O memory\n");
> > 		return -ENXIO;
> > 	}
> 
> You need to be careful with devm_ioremap_resource() ocnversions as it
> returns ERR_PTR-encoded pointer on failures, not NULL.

Ah yes of course, I was a bit too quick with my top-of-the-head
conversion. Thanks for fixing it up.

^ permalink raw reply

* Xbox Controllers: Should hid be used?
From: Zachary L @ 2014-10-08  7:09 UTC (permalink / raw)
  To: linux-input

Other 3rd party drivers (and seemingly Microsoft's driver as well) uses HID to 
describe the [any Xbox] controller's features. We can see uses of this in other 
drivers:

TattieBogle - 
http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/OsxDriver

XBCD - http://www.redcl0ud.com/xbcd.html

Xpad has avoided the use of the hid subsystem for whatever reason, for over a 
decade now. That said, I don't know of any compelling reason to not avoid it. 
But I did it anyways... I made a small usb driver, implemented a stub 
hid_ll_driver, copied the descriptor from TattieBogle... and it works... sort 
of. 

The button layout is obviously different from what we have now and I cannot get 
the D-pad working using a Hat Switch usage or the D-pad usages to save my life. 

I realize that just because other drivers use HID, doesn't mean I should 
although perhaps there's a compelling reason that I'm missing. Is there any 
worth to this work?

What I have is bare bones but works for (incorrectly mapped, using 
TattieBogle's report descriptor) input: https://github.com/computerquip/xpad4

Any feedback would be appreciated.


^ permalink raw reply

* Re: [PATCH 2/4] Input: pmic8xxx-keypad - use regmap_field for register access
From: Ivan T. Ivanov @ 2014-10-08  9:13 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Stephen Boyd, linux-input, linux-kernel, linux-arm-msm
In-Reply-To: <20141007172606.GG16469@dtor-ws>

On Tue, 2014-10-07 at 10:26 -0700, Dmitry Torokhov wrote:
> Hi Ivan,
> 
> On Tue, Oct 07, 2014 at 12:50:46PM +0300, Ivan T. Ivanov wrote:
> > @@ -527,10 +538,55 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
> >  

> > +
> > +	kp->row_hold = devm_regmap_field_alloc(kp->dev, kp->regmap,
> > +					       info->row_hold);
> > +	if (IS_ERR(kp->row_hold))
> > +		return PTR_ERR(kp->row_hold);
> 
> Why do we have to allocate all regmap fields separately instead of
> embedding them into keypad structure?
> 

No particular reason. Will rework it.

Thank you,
Ivan

> Thanks.
> 

^ permalink raw reply

* usbhid: 10 seconds delay with N-Trig Duosense
From: Christian Hesse @ 2014-10-08  9:20 UTC (permalink / raw)
  To: linux-input

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

Hello everybody,

I am having trouble with N-Trig Duosense in a Lenovo Thinkpad T410s. Kernel
version is 3.16.4. In lsusb the device identifies as:

Bus 002 Device 004: ID 1b96:0001 N-Trig Duosense Transparent
Electromagnetic Digitizer

The touchscreen works, however loading usbhid module results in a 10 seconds
delay. I have tried to add some quirks, looks like the only way to get rid of
the delay is to ignore the device completly with HID_QUIRK_IGNORE:

usbhid.quirks=0x1b96:0x0001:0x4

Any chance to make the device work without delay?

Please CC as I am not subscribed to the list.
-- 
Schoene Gruesse
Chris
                         O< ascii ribbon campaign
                   stop html mail - www.asciiribbon.org

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

^ permalink raw reply

* Re: [PATCH 2/4] Input: pmic8xxx-keypad - use regmap_field for register access
From: Ivan T. Ivanov @ 2014-10-08  9:30 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Stephen Boyd, linux-input, linux-kernel, linux-arm-msm
In-Reply-To: <1412759584.13569.0.camel@iivanov-dev>

On Wed, 2014-10-08 at 12:13 +0300, Ivan T. Ivanov wrote:
> On Tue, 2014-10-07 at 10:26 -0700, Dmitry Torokhov wrote:
> > Hi Ivan,
> > 
> > On Tue, Oct 07, 2014 at 12:50:46PM +0300, Ivan T. Ivanov wrote:
> > > @@ -527,10 +538,55 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
> > >  
> 
> > > +
> > > +	kp->row_hold = devm_regmap_field_alloc(kp->dev, kp->regmap,
> > > +					       info->row_hold);
> > > +	if (IS_ERR(kp->row_hold))
> > > +		return PTR_ERR(kp->row_hold);
> > 
> > Why do we have to allocate all regmap fields separately instead of
> > embedding them into keypad structure?
> > 
> 
> No particular reason. Will rework it.
> 

Oops. struct regmap_field is opaque. It seems that the allocation
is the only way that I could have instance of it.

Regards,
Ivan

^ permalink raw reply


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