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

On 10/07/2014 09:30 AM, 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>

The interrupt triggers the work queue. adp5588_setup() enable the HW 
interrupt.
Only if the device was configured before, without being resetb -
The earliest point in time where a problem could happen - is after the 
request_irq().

Anyways patch below doesn't harm and fixes a potential problem.

Acked-by: Michael Hennerich <michael.hennerich@analog.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);
>    err_free_mem:
>   	input_free_device(input);
>   	kfree(kpad);


-- 
Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif


^ permalink raw reply

* Re: [PATCH] Input: opencores-kbd: Switch to using managed resources
From: Tobias Klauser @ 2014-10-07 13:33 UTC (permalink / raw)
  To: Pramod Gurav; +Cc: linux-kernel, Dmitry Torokhov, linux-input
In-Reply-To: <1412681501-28072-1-git-send-email-pramod.gurav@smartplayin.com>

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

>  	if (!opencores_kbd->addr) {
>  		dev_err(&pdev->dev, "failed to remap I/O memory\n");
> -		error = -ENXIO;
> -		goto err_rel_mem;
> +		return -ENXIO;
>  	}
>  
>  	opencores_kbd->input = input;
> @@ -109,54 +109,26 @@ static int opencores_kbd_probe(struct platform_device *pdev)
>  	}
>  	__clear_bit(KEY_RESERVED, input->keybit);
>  
> -	error = request_irq(irq, &opencores_kbd_isr,
> +	error = devm_request_irq(&pdev->dev, irq, &opencores_kbd_isr,
>  			    IRQF_TRIGGER_RISING, pdev->name, opencores_kbd);

The second line should be aligned to the opening parenthesis:

	error = devm_request_irq(&pdev->dev, irq, &opencores_kbd_isr,
				 IRQF_TRIGGER_RISING, pdev->name, opencores_kbd);

^ permalink raw reply

* Re: [PATCH 2/6] mfd: rtsx_usb: fix platform device-id collision
From: Johan Hovold @ 2014-10-07 12:52 UTC (permalink / raw)
  To: Lee Jones
  Cc: Johan Hovold, Samuel Ortiz, Jiri Kosina, linux-input,
	Greg Kroah-Hartman, linux-kernel, linux-usb
In-Reply-To: <20141007092258.GR25331@lee--X1>

On Tue, Oct 07, 2014 at 10:22:58AM +0100, Lee Jones wrote:
> On Fri, 26 Sep 2014, Johan Hovold wrote:
> 
> > Hot-pluggable multi-function devices should use PLATFORM_DEVID_AUTO to
> > avoid name collisions on the platform bus.
> > 
> > This driver currently uses the USB-device address as an id. This makes
> > name collisions unlikely, but it could still happen if two devices are
> > connected to separate buses and gets assigned the same address.
> > 
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> > ---
> >  drivers/mfd/rtsx_usb.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> This patch is superfluous.

Well, it would have documented the fact that there could be probe
failures due to id collisions with current and older kernels.

> Just wait until the hotpluggable version is applied, then use it.

Fine with me. The collisions are quite unlikely anyway.

Thanks,
Johan

> > diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
> > index 71f387ce8cbd..78073e4b87e4 100644
> > --- a/drivers/mfd/rtsx_usb.c
> > +++ b/drivers/mfd/rtsx_usb.c
> > @@ -647,7 +647,7 @@ static int rtsx_usb_probe(struct usb_interface *intf,
> >  	/* initialize USB SG transfer timer */
> >  	setup_timer(&ucr->sg_timer, rtsx_usb_sg_timed_out, (unsigned long) ucr);
> >  
> > -	ret = mfd_add_devices(&intf->dev, usb_dev->devnum, rtsx_usb_cells,
> > +	ret = mfd_add_devices(&intf->dev, PLATFORM_DEVID_AUTO, rtsx_usb_cells,
> >  			ARRAY_SIZE(rtsx_usb_cells), NULL, 0, NULL);
> >  	if (ret)
> >  		goto out_init_fail;

^ permalink raw reply

* Elan TS driver patch
From: ELAN 劉嘉駿 @ 2014-10-07 11:27 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, bleung, Charles Mooney, Jeff.Chuang,
	'梁博翔'

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?

Thanks,
Scott

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH] Input: opencores-kbd: Switch to using managed resources
From: Pramod Gurav @ 2014-10-07 11:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pramod Gurav, Dmitry Torokhov, linux-input

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));
 	if (!opencores_kbd->addr) {
 		dev_err(&pdev->dev, "failed to remap I/O memory\n");
-		error = -ENXIO;
-		goto err_rel_mem;
+		return -ENXIO;
 	}
 
 	opencores_kbd->input = input;
@@ -109,54 +109,26 @@ static int opencores_kbd_probe(struct platform_device *pdev)
 	}
 	__clear_bit(KEY_RESERVED, input->keybit);
 
-	error = request_irq(irq, &opencores_kbd_isr,
+	error = devm_request_irq(&pdev->dev, irq, &opencores_kbd_isr,
 			    IRQF_TRIGGER_RISING, pdev->name, opencores_kbd);
 	if (error) {
 		dev_err(&pdev->dev, "unable to claim irq %d\n", irq);
-		goto err_unmap_mem;
+		return error;
 	}
 
 	error = input_register_device(input);
 	if (error) {
 		dev_err(&pdev->dev, "unable to register input device\n");
-		goto err_free_irq;
+		return error;
 	}
 
 	platform_set_drvdata(pdev, opencores_kbd);
 
 	return 0;
-
- err_free_irq:
-	free_irq(irq, opencores_kbd);
- err_unmap_mem:
-	iounmap(opencores_kbd->addr);
- err_rel_mem:
-	release_mem_region(res->start, resource_size(res));
- err_free_mem:
-	input_free_device(input);
-	kfree(opencores_kbd);
-
-	return error;
-}
-
-static int opencores_kbd_remove(struct platform_device *pdev)
-{
-	struct opencores_kbd *opencores_kbd = platform_get_drvdata(pdev);
-
-	free_irq(opencores_kbd->irq, opencores_kbd);
-
-	iounmap(opencores_kbd->addr);
-	release_mem_region(opencores_kbd->addr_res->start,
-		resource_size(opencores_kbd->addr_res));
-	input_unregister_device(opencores_kbd->input);
-	kfree(opencores_kbd);
-
-	return 0;
 }
 
 static struct platform_driver opencores_kbd_device_driver = {
 	.probe    = opencores_kbd_probe,
-	.remove   = opencores_kbd_remove,
 	.driver   = {
 		.name = "opencores-kbd",
 	},
-- 
1.7.9.5


^ permalink raw reply related

* Re: [PATCH 1/2] input: Add Qualcomm PM8941 power key driver
From: Kiran Padwal @ 2014-10-07  9:54 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-2-git-send-email-bjorn.andersson@sonymobile.com>

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?

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

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

Thanks,
--Kiran

^ permalink raw reply

* [PATCH 4/4] Input: pmic8xxx-keypad - update DT bindings documentation
From: Ivan T. Ivanov @ 2014-10-07  9:50 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Dmitry Torokhov
  Cc: Ivan T. Ivanov, Stephen Boyd, linux-input, devicetree,
	linux-kernel, linux-arm-msm
In-Reply-To: <1412675448-11990-1-git-send-email-iivanov@mm-sol.com>

Fix incorrect dimensions for 'debonce' and 'scan-delay' times.
Now they represent what driver really expect. Add possible
time quants for 'debonce', 'scan-delay' and 'row-hold' times.
Update bindings example.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 Documentation/devicetree/bindings/input/qcom,pm8xxx-keypad.txt | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/qcom,pm8xxx-keypad.txt b/Documentation/devicetree/bindings/input/qcom,pm8xxx-keypad.txt
index 2b60f8a..df5e2a1 100644
--- a/Documentation/devicetree/bindings/input/qcom,pm8xxx-keypad.txt
+++ b/Documentation/devicetree/bindings/input/qcom,pm8xxx-keypad.txt
@@ -54,20 +54,23 @@ PROPERTIES
 - debounce:
 	Usage: optional
 	Value type: <u32>
-	Definition: time in microseconds that key must be pressed or release
+	Definition: time in miliseconds that key must be pressed or release
 		    for key sense interrupt to trigger.
+		    Possible values: 5, 10, 15, 20.
 
 - scan-delay:
 	Usage: optional
 	Value type: <u32>
-	Definition: time in microseconds to pause between successive scans
+	Definition: time in miliseconds to pause between successive scans
 		    of the matrix array.
+		    Possible values: 1, 2, 4, 8, 16, 32, 64, 128.
 
 - row-hold:
 	Usage: optional
 	Value type: <u32>
 	Definition: time in nanoseconds to pause between scans of each row in
 		    the matrix array.
+		    Possible values: 30500, 61000, 122000.
 
 EXAMPLE
 
@@ -86,5 +89,5 @@ EXAMPLE
 		keypad,num-columns = <5>;
 		debounce = <15>;
 		scan-delay = <32>;
-		row-hold = <91500>;
+		row-hold = <61000>;
 	};
-- 
1.9.1

^ permalink raw reply related

* [PATCH 3/4] Input: pmic8xxx-keypad - add support keypad found in pm8941
From: Ivan T. Ivanov @ 2014-10-07  9:50 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Dmitry Torokhov
  Cc: Ivan T. Ivanov, Stephen Boyd, linux-input-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1412675448-11990-1-git-send-email-iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>

Controller seems to be the same. Just access to it is over SPMI bus
and registers and bits are reshuffled. Hopefully this is nicely
abstracted by regmap helpers.

Signed-off-by: Ivan T. Ivanov <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
---
 .../bindings/input/qcom,pm8xxx-keypad.txt          |  1 +
 drivers/input/keyboard/pmic8xxx-keypad.c           | 27 ++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/qcom,pm8xxx-keypad.txt b/Documentation/devicetree/bindings/input/qcom,pm8xxx-keypad.txt
index 7d8cb92..2b60f8a 100644
--- a/Documentation/devicetree/bindings/input/qcom,pm8xxx-keypad.txt
+++ b/Documentation/devicetree/bindings/input/qcom,pm8xxx-keypad.txt
@@ -8,6 +8,7 @@ PROPERTIES
 	Definition: must be one of:
 		    "qcom,pm8058-keypad"
 		    "qcom,pm8921-keypad"
+		    "qcom,pm8941-keypad"
 
 - reg:
 	Usage: required
diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c
index b82d161..2d4fa07 100644
--- a/drivers/input/keyboard/pmic8xxx-keypad.c
+++ b/drivers/input/keyboard/pmic8xxx-keypad.c
@@ -136,6 +136,32 @@ static const struct pmic8xxx_kp_info ssbi_kp = {
 	.row_hold	= REG_FIELD(0x149, 6, 7),
 };
 
+static const struct pmic8xxx_kp_info spmi_kp = {
+	.max_rows	= 10,
+	.min_rows	= 2,
+	.max_cols	= 8,
+	.min_cols	= 1,
+
+	.rows_select = {
+		1, 2, 3, 4, 5, 6, 7,
+		8, 9, 10
+	},
+
+	.recent_data	= 0xa87c,
+	.old_data	= 0xa85c,
+	.read_stride	= 2,
+
+	.events		= REG_FIELD(0xa808, 0, 1),
+	.scan_rows	= REG_FIELD(0xa840, 0, 3),
+	.scan_cols	= REG_FIELD(0xa840, 4, 6),
+	.enable		= REG_FIELD(0xa846, 7, 7),
+
+	.read_state	= REG_FIELD(0xa844, 0, 0),
+	.dbonce		= REG_FIELD(0xa842, 0, 1),
+	.pause		= REG_FIELD(0xa842, 3, 5),
+	.row_hold	= REG_FIELD(0xa842, 6, 7),
+};
+
 static u8 pmic8xxx_col_state(struct pmic8xxx_kp *kp, u8 col)
 {
 	/* all keys pressed on that particular row? */
@@ -715,6 +741,7 @@ static SIMPLE_DEV_PM_OPS(pm8xxx_kp_pm_ops,
 static const struct of_device_id pm8xxx_match_table[] = {
 	{ .compatible = "qcom,pm8058-keypad", .data = (void *)&ssbi_kp },
 	{ .compatible = "qcom,pm8921-keypad", .data = (void *)&ssbi_kp },
+	{ .compatible = "qcom,pm8941-keypad", .data = (void *)&spmi_kp },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, pm8xxx_match_table);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

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

Abstract access to bit and register definitions to simplify adding
support for similar controller, which be found on SPMI based pm8941.

Group hardware capabilities to controller specific structure, and
pass it to driver, based on compatible string.

Pre-compute minimum number of rows and columns to avoid runtime checks.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 drivers/input/keyboard/pmic8xxx-keypad.c | 260 ++++++++++++++++++-------------
 1 file changed, 154 insertions(+), 106 deletions(-)

diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c
index dd1fc95..b82d161 100644
--- a/drivers/input/keyboard/pmic8xxx-keypad.c
+++ b/drivers/input/keyboard/pmic8xxx-keypad.c
@@ -21,6 +21,7 @@
 #include <linux/mutex.h>
 #include <linux/regmap.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/input/matrix_keypad.h>
 
 #define PM8XXX_MAX_ROWS		18
@@ -28,9 +29,6 @@
 #define PM8XXX_ROW_SHIFT	3
 #define PM8XXX_MATRIX_MAX_SIZE	(PM8XXX_MAX_ROWS * PM8XXX_MAX_COLS)
 
-#define PM8XXX_MIN_ROWS		5
-#define PM8XXX_MIN_COLS		5
-
 #define MAX_SCAN_DELAY		128
 #define MIN_SCAN_DELAY		1
 
@@ -41,34 +39,34 @@
 #define MAX_DEBOUNCE_TIME	20
 #define MIN_DEBOUNCE_TIME	5
 
-#define KEYP_CTRL			0x148
-
-#define KEYP_CTRL_EVNTS_MASK		0x3
-
-#define KEYP_CTRL_SCAN_COLS_SHIFT	5
-#define KEYP_CTRL_SCAN_COLS_MIN		5
-#define KEYP_CTRL_SCAN_COLS_BITS	0x3
-
-#define KEYP_CTRL_SCAN_ROWS_SHIFT	2
-#define KEYP_CTRL_SCAN_ROWS_MIN		5
-#define KEYP_CTRL_SCAN_ROWS_BITS	0x7
-
-#define KEYP_CTRL_KEYP_EN		BIT(7)
-
-#define KEYP_SCAN			0x149
-
-#define KEYP_SCAN_DBOUNCE_SHIFT		1
-#define KEYP_SCAN_PAUSE_SHIFT		3
-#define KEYP_SCAN_ROW_HOLD_SHIFT	6
-
-/* bits of these registers represent
- * '0' for key press
- * '1' for key release
- */
-#define KEYP_RECENT_DATA		0x14B
-#define KEYP_OLD_DATA			0x14C
-
-#define KEYP_CLOCK_FREQ			32768
+#define KEYP_CLOCK_FREQ		32768
+
+/* Keypad capabilities and registers description */
+struct pmic8xxx_kp_info {
+	unsigned int max_rows;
+	unsigned int min_rows;
+	unsigned int max_cols;
+	unsigned int min_cols;
+
+	unsigned int rows_select[PM8XXX_MAX_ROWS];
+	/*
+	 * bits of these registers represent
+	 * '0' for key press
+	 * '1' for key release
+	 */
+	unsigned int recent_data;
+	unsigned int old_data;
+	unsigned int read_stride;
+
+	struct reg_field events;
+	struct reg_field scan_rows;
+	struct reg_field scan_cols;
+	struct reg_field enable;
+	struct reg_field read_state;
+	struct reg_field dbonce;
+	struct reg_field pause;
+	struct reg_field row_hold;
+};
 
 /**
  * struct pmic8xxx_kp - internal keypad data structure
@@ -98,7 +96,44 @@ struct pmic8xxx_kp {
 	u16 keystate[PM8XXX_MAX_ROWS];
 	u16 stuckstate[PM8XXX_MAX_ROWS];
 
-	u8 ctrl_reg;
+	struct regmap_field *events;
+	struct regmap_field *scan_rows;
+	struct regmap_field *scan_cols;
+	struct regmap_field *enable;
+	struct regmap_field *read_state;
+	struct regmap_field *dbonce;
+	struct regmap_field *pause;
+	struct regmap_field *row_hold;
+
+	unsigned int recent_data;
+	unsigned int old_data;
+	unsigned int read_stride;
+};
+
+static const struct pmic8xxx_kp_info ssbi_kp = {
+	.max_rows	= 18,
+	.min_rows	= 5,
+	.max_cols	= 8,
+	.min_cols	= 5,
+
+	.rows_select = {
+		0, 1, 2, 3, 4, 4, 5,
+		5, 6, 6, 6, 7, 7, 7,
+	},
+
+	.recent_data	= 0x14b,
+	.old_data	= 0x14c,
+	.read_stride	= 0,
+
+	.events		= REG_FIELD(0x148, 0, 1),
+	.scan_rows	= REG_FIELD(0x148, 2, 4),
+	.scan_cols	= REG_FIELD(0x148, 5, 6),
+	.enable		= REG_FIELD(0x148, 7, 7),
+
+	.read_state	= REG_FIELD(0x149, 0, 0),
+	.dbonce		= REG_FIELD(0x149, 1, 2),
+	.pause		= REG_FIELD(0x149, 3, 5),
+	.row_hold	= REG_FIELD(0x149, 6, 7),
 };
 
 static u8 pmic8xxx_col_state(struct pmic8xxx_kp *kp, u8 col)
@@ -125,17 +160,8 @@ static u8 pmic8xxx_col_state(struct pmic8xxx_kp *kp, u8 col)
 static int pmic8xxx_chk_sync_read(struct pmic8xxx_kp *kp)
 {
 	int rc;
-	unsigned int scan_val;
-
-	rc = regmap_read(kp->regmap, KEYP_SCAN, &scan_val);
-	if (rc < 0) {
-		dev_err(kp->dev, "Error reading KEYP_SCAN reg, rc=%d\n", rc);
-		return rc;
-	}
-
-	scan_val |= 0x1;
 
-	rc = regmap_write(kp->regmap, KEYP_SCAN, scan_val);
+	rc = regmap_field_write(kp->read_state, 1);
 	if (rc < 0) {
 		dev_err(kp->dev, "Error writing KEYP_SCAN reg, rc=%d\n", rc);
 		return rc;
@@ -151,10 +177,11 @@ static int pmic8xxx_kp_read_data(struct pmic8xxx_kp *kp, u16 *state,
 					u16 data_reg, int read_rows)
 {
 	int rc, row;
-	unsigned int val;
+	unsigned int val, offset;
 
 	for (row = 0; row < read_rows; row++) {
-		rc = regmap_read(kp->regmap, data_reg, &val);
+		offset = data_reg + row * kp->read_stride;
+		rc = regmap_read(kp->regmap, offset, &val);
 		if (rc)
 			return rc;
 		dev_dbg(kp->dev, "%d = %d\n", row, val);
@@ -168,17 +195,13 @@ static int pmic8xxx_kp_read_matrix(struct pmic8xxx_kp *kp, u16 *new_state,
 					 u16 *old_state)
 {
 	int rc, read_rows;
-	unsigned int scan_val;
 
-	if (kp->num_rows < PM8XXX_MIN_ROWS)
-		read_rows = PM8XXX_MIN_ROWS;
-	else
-		read_rows = kp->num_rows;
+	read_rows = kp->num_rows;
 
 	pmic8xxx_chk_sync_read(kp);
 
 	if (old_state) {
-		rc = pmic8xxx_kp_read_data(kp, old_state, KEYP_OLD_DATA,
+		rc = pmic8xxx_kp_read_data(kp, old_state, kp->old_data,
 						read_rows);
 		if (rc < 0) {
 			dev_err(kp->dev,
@@ -187,7 +210,7 @@ static int pmic8xxx_kp_read_matrix(struct pmic8xxx_kp *kp, u16 *new_state,
 		}
 	}
 
-	rc = pmic8xxx_kp_read_data(kp, new_state, KEYP_RECENT_DATA,
+	rc = pmic8xxx_kp_read_data(kp, new_state, kp->recent_data,
 					 read_rows);
 	if (rc < 0) {
 		dev_err(kp->dev,
@@ -198,14 +221,7 @@ static int pmic8xxx_kp_read_matrix(struct pmic8xxx_kp *kp, u16 *new_state,
 	/* 4 * 32KHz clocks */
 	udelay((4 * DIV_ROUND_UP(USEC_PER_SEC, KEYP_CLOCK_FREQ)) + 1);
 
-	rc = regmap_read(kp->regmap, KEYP_SCAN, &scan_val);
-	if (rc < 0) {
-		dev_err(kp->dev, "Error reading KEYP_SCAN reg, rc=%d\n", rc);
-		return rc;
-	}
-
-	scan_val &= 0xFE;
-	rc = regmap_write(kp->regmap, KEYP_SCAN, scan_val);
+	rc = regmap_field_write(kp->read_state, 0);
 	if (rc < 0)
 		dev_err(kp->dev, "Error writing KEYP_SCAN reg, rc=%d\n", rc);
 
@@ -341,17 +357,15 @@ static irqreturn_t pmic8xxx_kp_stuck_irq(int irq, void *data)
 static irqreturn_t pmic8xxx_kp_irq(int irq, void *data)
 {
 	struct pmic8xxx_kp *kp = data;
-	unsigned int ctrl_val, events;
+	unsigned int events;
 	int rc;
 
-	rc = regmap_read(kp->regmap, KEYP_CTRL, &ctrl_val);
+	rc = regmap_field_read(kp->events, &events);
 	if (rc < 0) {
 		dev_err(kp->dev, "failed to read keyp_ctrl register\n");
 		return IRQ_HANDLED;
 	}
 
-	events = ctrl_val & KEYP_CTRL_EVNTS_MASK;
-
 	rc = pmic8xxx_kp_scan_matrix(kp, events);
 	if (rc < 0)
 		dev_err(kp->dev, "failed to scan matrix\n");
@@ -360,35 +374,28 @@ static irqreturn_t pmic8xxx_kp_irq(int irq, void *data)
 }
 
 static int pmic8xxx_kpd_init(struct pmic8xxx_kp *kp,
-			     struct platform_device *pdev)
+			     struct platform_device *pdev,
+			     const struct pmic8xxx_kp_info *info)
 {
 	const struct device_node *of_node = pdev->dev.of_node;
 	unsigned int scan_delay_ms;
 	unsigned int row_hold_ns;
 	unsigned int debounce_ms;
 	int bits, rc, cycles;
-	u8 scan_val = 0, ctrl_val = 0;
-	static const u8 row_bits[] = {
-		0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7,
-	};
 
 	/* Find column bits */
-	if (kp->num_cols < KEYP_CTRL_SCAN_COLS_MIN)
-		bits = 0;
-	else
-		bits = kp->num_cols - KEYP_CTRL_SCAN_COLS_MIN;
-	ctrl_val = (bits & KEYP_CTRL_SCAN_COLS_BITS) <<
-		KEYP_CTRL_SCAN_COLS_SHIFT;
+	bits = kp->num_cols - info->min_cols;
 
-	/* Find row bits */
-	if (kp->num_rows < KEYP_CTRL_SCAN_ROWS_MIN)
-		bits = 0;
-	else
-		bits = row_bits[kp->num_rows - KEYP_CTRL_SCAN_ROWS_MIN];
+	rc = regmap_field_write(kp->scan_cols, bits);
+	if (rc < 0) {
+		dev_err(kp->dev, "Error writing KEYP_CTRL reg, rc=%d\n", rc);
+		return rc;
+	}
 
-	ctrl_val |= (bits << KEYP_CTRL_SCAN_ROWS_SHIFT);
+	/* Find row bits */
+	bits = info->rows_select[kp->num_rows - info->min_rows];
 
-	rc = regmap_write(kp->regmap, KEYP_CTRL, ctrl_val);
+	rc = regmap_field_write(kp->scan_rows, bits);
 	if (rc < 0) {
 		dev_err(kp->dev, "Error writing KEYP_CTRL reg, rc=%d\n", rc);
 		return rc;
@@ -425,17 +432,20 @@ static int pmic8xxx_kpd_init(struct pmic8xxx_kp *kp,
 
 	bits = (debounce_ms / 5) - 1;
 
-	scan_val |= (bits << KEYP_SCAN_DBOUNCE_SHIFT);
+	rc = regmap_field_write(kp->dbonce, bits);
+	if (rc)
+		dev_err(kp->dev, "Error writing KEYP_SCAN reg, rc=%d\n", rc);
 
 	bits = fls(scan_delay_ms) - 1;
-	scan_val |= (bits << KEYP_SCAN_PAUSE_SHIFT);
+
+	rc = regmap_field_write(kp->pause, bits);
+	if (rc)
+		dev_err(kp->dev, "Error writing KEYP_SCAN reg, rc=%d\n", rc);
 
 	/* Row hold time is a multiple of 32KHz cycles. */
 	cycles = (row_hold_ns * KEYP_CLOCK_FREQ) / NSEC_PER_SEC;
 
-	scan_val |= (cycles << KEYP_SCAN_ROW_HOLD_SHIFT);
-
-	rc = regmap_write(kp->regmap, KEYP_SCAN, scan_val);
+	rc = regmap_field_write(kp->row_hold, cycles);
 	if (rc)
 		dev_err(kp->dev, "Error writing KEYP_SCAN reg, rc=%d\n", rc);
 
@@ -447,9 +457,7 @@ static int pmic8xxx_kp_enable(struct pmic8xxx_kp *kp)
 {
 	int rc;
 
-	kp->ctrl_reg |= KEYP_CTRL_KEYP_EN;
-
-	rc = regmap_write(kp->regmap, KEYP_CTRL, kp->ctrl_reg);
+	rc = regmap_field_write(kp->enable, 1);
 	if (rc < 0)
 		dev_err(kp->dev, "Error writing KEYP_CTRL reg, rc=%d\n", rc);
 
@@ -460,9 +468,7 @@ static int pmic8xxx_kp_disable(struct pmic8xxx_kp *kp)
 {
 	int rc;
 
-	kp->ctrl_reg &= ~KEYP_CTRL_KEYP_EN;
-
-	rc = regmap_write(kp->regmap, KEYP_CTRL, kp->ctrl_reg);
+	rc = regmap_field_write(kp->enable, 0);
 	if (rc < 0)
 		return rc;
 
@@ -483,6 +489,8 @@ static void pmic8xxx_kp_close(struct input_dev *dev)
 	pmic8xxx_kp_disable(kp);
 }
 
+static const struct of_device_id pm8xxx_match_table[];
+
 /*
  * keypad controller should be initialized in the following sequence
  * only, otherwise it might get into FSM stuck state.
@@ -495,19 +503,22 @@ static void pmic8xxx_kp_close(struct input_dev *dev)
  */
 static int pmic8xxx_kp_probe(struct platform_device *pdev)
 {
+	const struct pmic8xxx_kp_info *info;
+	const struct of_device_id *id;
 	unsigned int rows, cols;
 	bool repeat;
 	bool wakeup;
 	struct pmic8xxx_kp *kp;
 	int rc;
-	unsigned int ctrl_val;
+
+	id = of_match_device(pm8xxx_match_table, &pdev->dev);
+	info = (const struct pmic8xxx_kp_info *)id->data;
 
 	rc = matrix_keypad_parse_of_params(&pdev->dev, &rows, &cols);
 	if (rc)
 		return rc;
 
-	if (cols > PM8XXX_MAX_COLS || rows > PM8XXX_MAX_ROWS ||
-	    cols < PM8XXX_MIN_COLS) {
+	if (cols > info->max_cols || rows > info->max_rows) {
 		dev_err(&pdev->dev, "invalid platform data\n");
 		return -EINVAL;
 	}
@@ -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);
+
 	kp->input = devm_input_allocate_device(&pdev->dev);
 	if (!kp->input) {
 		dev_err(&pdev->dev, "unable to allocate input device\n");
@@ -578,7 +634,7 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
 	memset(kp->keystate, 0xff, sizeof(kp->keystate));
 	memset(kp->stuckstate, 0xff, sizeof(kp->stuckstate));
 
-	rc = pmic8xxx_kpd_init(kp, pdev);
+	rc = pmic8xxx_kpd_init(kp, pdev, info);
 	if (rc < 0) {
 		dev_err(&pdev->dev, "unable to initialize keypad controller\n");
 		return rc;
@@ -600,14 +656,6 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
 		return rc;
 	}
 
-	rc = regmap_read(kp->regmap, KEYP_CTRL, &ctrl_val);
-	if (rc < 0) {
-		dev_err(&pdev->dev, "failed to read KEYP_CTRL register\n");
-		return rc;
-	}
-
-	kp->ctrl_reg = ctrl_val;
-
 	rc = input_register_device(kp->input);
 	if (rc < 0) {
 		dev_err(&pdev->dev, "unable to register keypad input device\n");
@@ -665,8 +713,8 @@ static SIMPLE_DEV_PM_OPS(pm8xxx_kp_pm_ops,
 			 pmic8xxx_kp_suspend, pmic8xxx_kp_resume);
 
 static const struct of_device_id pm8xxx_match_table[] = {
-	{ .compatible = "qcom,pm8058-keypad" },
-	{ .compatible = "qcom,pm8921-keypad" },
+	{ .compatible = "qcom,pm8058-keypad", .data = (void *)&ssbi_kp },
+	{ .compatible = "qcom,pm8921-keypad", .data = (void *)&ssbi_kp },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, pm8xxx_match_table);
-- 
1.9.1

^ permalink raw reply related

* [PATCH 1/4] Input: pmic8xxx-keypad - remove unused register and bit definitions
From: Ivan T. Ivanov @ 2014-10-07  9:50 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Ivan T. Ivanov, Stephen Boyd, linux-input, linux-kernel,
	linux-arm-msm
In-Reply-To: <1412675448-11990-1-git-send-email-iivanov@mm-sol.com>

These defines are not used by driver. Remove them.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 drivers/input/keyboard/pmic8xxx-keypad.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c
index 80c6b0e..dd1fc95 100644
--- a/drivers/input/keyboard/pmic8xxx-keypad.c
+++ b/drivers/input/keyboard/pmic8xxx-keypad.c
@@ -43,7 +43,6 @@
 
 #define KEYP_CTRL			0x148
 
-#define KEYP_CTRL_EVNTS			BIT(0)
 #define KEYP_CTRL_EVNTS_MASK		0x3
 
 #define KEYP_CTRL_SCAN_COLS_SHIFT	5
@@ -58,21 +57,10 @@
 
 #define KEYP_SCAN			0x149
 
-#define KEYP_SCAN_READ_STATE		BIT(0)
 #define KEYP_SCAN_DBOUNCE_SHIFT		1
 #define KEYP_SCAN_PAUSE_SHIFT		3
 #define KEYP_SCAN_ROW_HOLD_SHIFT	6
 
-#define KEYP_TEST			0x14A
-
-#define KEYP_TEST_CLEAR_RECENT_SCAN	BIT(6)
-#define KEYP_TEST_CLEAR_OLD_SCAN	BIT(5)
-#define KEYP_TEST_READ_RESET		BIT(4)
-#define KEYP_TEST_DTEST_EN		BIT(3)
-#define KEYP_TEST_ABORT_READ		BIT(0)
-
-#define KEYP_TEST_DBG_SELECT_SHIFT	1
-
 /* bits of these registers represent
  * '0' for key press
  * '1' for key release
-- 
1.9.1

^ permalink raw reply related

* [PATCH] input: lm8323: Switch to using managed resources
From: Pramod Gurav @ 2014-10-07  9:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pramod Gurav, Dmitry Torokhov, linux-input

This change switches to using devm_* APIs to allocate  resources.
This helps to simplify failure path in probe function as well as
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/lm8323.c |   39 ++++++++++++++++-----------------------
 1 file changed, 16 insertions(+), 23 deletions(-)

diff --git a/drivers/input/keyboard/lm8323.c b/drivers/input/keyboard/lm8323.c
index cb32e2b..c4325a1 100644
--- a/drivers/input/keyboard/lm8323.c
+++ b/drivers/input/keyboard/lm8323.c
@@ -653,12 +653,10 @@ static int lm8323_probe(struct i2c_client *client,
 		return -EINVAL;
 	}
 
-	lm = kzalloc(sizeof *lm, GFP_KERNEL);
-	idev = input_allocate_device();
-	if (!lm || !idev) {
-		err = -ENOMEM;
-		goto fail1;
-	}
+	lm = devm_kzalloc(&client->dev, sizeof(*lm), GFP_KERNEL);
+	idev = devm_input_allocate_device(&client->dev);
+	if (!lm || !idev)
+		return -ENOMEM;
 
 	lm->client = client;
 	lm->idev = idev;
@@ -695,21 +693,20 @@ static int lm8323_probe(struct i2c_client *client,
 	/* If a true probe check the device */
 	if (lm8323_read_id(lm, data) != 0) {
 		dev_err(&client->dev, "device not found\n");
-		err = -ENODEV;
-		goto fail1;
+		return -ENODEV;
 	}
 
 	for (pwm = 0; pwm < LM8323_NUM_PWMS; pwm++) {
 		err = init_pwm(lm, pwm + 1, &client->dev,
 			       pdata->pwm_names[pwm]);
 		if (err < 0)
-			goto fail2;
+			goto fail1;
 	}
 
 	lm->kp_enabled = true;
 	err = device_create_file(&client->dev, &dev_attr_disable_kp);
 	if (err < 0)
-		goto fail2;
+		goto fail1;
 
 	idev->name = pdata->name ? : "LM8323 keypad";
 	snprintf(lm->phys, sizeof(lm->phys),
@@ -730,14 +727,16 @@ static int lm8323_probe(struct i2c_client *client,
 	err = input_register_device(idev);
 	if (err) {
 		dev_dbg(&client->dev, "error registering input device\n");
-		goto fail3;
+		goto fail2;
 	}
 
-	err = request_threaded_irq(client->irq, NULL, lm8323_irq,
-			  IRQF_TRIGGER_LOW|IRQF_ONESHOT, "lm8323", lm);
+	err = devm_request_threaded_irq(&client->dev, client->irq, NULL,
+					lm8323_irq,
+					IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+					"lm8323", lm);
 	if (err) {
 		dev_err(&client->dev, "could not get IRQ %d\n", client->irq);
-		goto fail4;
+		goto fail3;
 	}
 
 	i2c_set_clientdata(client, lm);
@@ -747,18 +746,15 @@ static int lm8323_probe(struct i2c_client *client,
 
 	return 0;
 
-fail4:
+fail3:
 	input_unregister_device(idev);
 	idev = NULL;
-fail3:
-	device_remove_file(&client->dev, &dev_attr_disable_kp);
 fail2:
+	device_remove_file(&client->dev, &dev_attr_disable_kp);
+fail1:
 	while (--pwm >= 0)
 		if (lm->pwm[pwm].enabled)
 			led_classdev_unregister(&lm->pwm[pwm].cdev);
-fail1:
-	input_free_device(idev);
-	kfree(lm);
 	return err;
 }
 
@@ -768,7 +764,6 @@ static int lm8323_remove(struct i2c_client *client)
 	int i;
 
 	disable_irq_wake(client->irq);
-	free_irq(client->irq, lm);
 
 	input_unregister_device(lm->idev);
 
@@ -778,8 +773,6 @@ static int lm8323_remove(struct i2c_client *client)
 		if (lm->pwm[i].enabled)
 			led_classdev_unregister(&lm->pwm[i].cdev);
 
-	kfree(lm);
-
 	return 0;
 }
 
-- 
1.7.9.5


^ permalink raw reply related

* Re: [PATCH 6/6] mfd: core: fix platform-device id generation
From: Lee Jones @ 2014-10-07  9:25 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Samuel Ortiz, Jiri Kosina, linux-input, Greg Kroah-Hartman,
	linux-kernel, linux-usb
In-Reply-To: <1411728933-13351-7-git-send-email-johan@kernel.org>

On Fri, 26 Sep 2014, Johan Hovold wrote:

> Make sure to always honour multi-function devices registered with
> PLATFORM_DEVID_NONE (-1) or PLATFORM_DEVID_AUTO (-2) as id base. In this
> case it does not make sense to append the cell id to the mfd-id base and
> potentially change the requested behaviour.
> 
> Specifically this will allow multi-function devices to be registered
> with PLATFORM_DEVID_AUTO while still having non-zero cell ids.
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  drivers/mfd/mfd-core.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Applied for v3.19.

> diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
> index 892d343193ad..79f25633d7db 100644
> --- a/drivers/mfd/mfd-core.c
> +++ b/drivers/mfd/mfd-core.c
> @@ -87,9 +87,15 @@ static int mfd_add_device(struct device *parent, int id,
>  	struct platform_device *pdev;
>  	struct device_node *np = NULL;
>  	int ret = -ENOMEM;
> +	int platform_id;
>  	int r;
>  
> -	pdev = platform_device_alloc(cell->name, id + cell->id);
> +	if (id < 0)
> +		platform_id = id;
> +	else
> +		platform_id = id + cell->id;
> +
> +	pdev = platform_device_alloc(cell->name, platform_id);
>  	if (!pdev)
>  		goto fail_alloc;
>  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 5/6] HID: hid-sensor-hub: use mfd_add_hotplug_devices helper
From: Lee Jones @ 2014-10-07  9:24 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Samuel Ortiz, Jiri Kosina, linux-input, Greg Kroah-Hartman,
	linux-kernel, linux-usb
In-Reply-To: <1411728933-13351-6-git-send-email-johan@kernel.org>

On Fri, 26 Sep 2014, Johan Hovold wrote:

> Use mfd_add_hotplug_devices helper to register the subdevices.
> 
> Compile-only tested.
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  drivers/hid/hid-sensor-hub.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)

Applied for v3.19 with Jiri's Ack.

> diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
> index 2ac25760a9a9..fbe1a6d2aa53 100644
> --- a/drivers/hid/hid-sensor-hub.c
> +++ b/drivers/hid/hid-sensor-hub.c
> @@ -641,9 +641,6 @@ static int sensor_hub_probe(struct hid_device *hdev,
>  					goto err_stop_hw;
>  			}
>  			sd->hid_sensor_hub_client_devs[
> -				sd->hid_sensor_client_cnt].id =
> -							PLATFORM_DEVID_AUTO;
> -			sd->hid_sensor_hub_client_devs[
>  				sd->hid_sensor_client_cnt].name = name;
>  			sd->hid_sensor_hub_client_devs[
>  				sd->hid_sensor_client_cnt].platform_data =
> @@ -659,8 +656,9 @@ static int sensor_hub_probe(struct hid_device *hdev,
>  	if (last_hsdev)
>  		last_hsdev->end_collection_index = i;
>  
> -	ret = mfd_add_devices(&hdev->dev, 0, sd->hid_sensor_hub_client_devs,
> -		sd->hid_sensor_client_cnt, NULL, 0, NULL);
> +	ret = mfd_add_hotplug_devices(&hdev->dev,
> +			sd->hid_sensor_hub_client_devs,
> +			sd->hid_sensor_client_cnt);
>  	if (ret < 0)
>  		goto err_stop_hw;
>  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 4/6] mfd: use mfd_add_hotplug_devices helper
From: Lee Jones @ 2014-10-07  9:24 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Samuel Ortiz, Jiri Kosina, linux-input, Greg Kroah-Hartman,
	linux-kernel, linux-usb
In-Reply-To: <1411728933-13351-5-git-send-email-johan@kernel.org>

On Fri, 26 Sep 2014, Johan Hovold wrote:

> Use mfd_add_hotplug_devices helper to register the subdevices.
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  drivers/mfd/rtsx_usb.c   | 4 ++--
>  drivers/mfd/viperboard.c | 5 ++---
>  2 files changed, 4 insertions(+), 5 deletions(-)

Applied for v3.19.

> diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
> index 78073e4b87e4..5b17339fce7c 100644
> --- a/drivers/mfd/rtsx_usb.c
> +++ b/drivers/mfd/rtsx_usb.c
> @@ -647,8 +647,8 @@ static int rtsx_usb_probe(struct usb_interface *intf,
>  	/* initialize USB SG transfer timer */
>  	setup_timer(&ucr->sg_timer, rtsx_usb_sg_timed_out, (unsigned long) ucr);
>  
> -	ret = mfd_add_devices(&intf->dev, PLATFORM_DEVID_AUTO, rtsx_usb_cells,
> -			ARRAY_SIZE(rtsx_usb_cells), NULL, 0, NULL);
> +	ret = mfd_add_hotplug_devices(&intf->dev, rtsx_usb_cells,
> +			ARRAY_SIZE(rtsx_usb_cells));
>  	if (ret)
>  		goto out_init_fail;
>  
> diff --git a/drivers/mfd/viperboard.c b/drivers/mfd/viperboard.c
> index 3c2b8f9e3c84..be450ebcb52d 100644
> --- a/drivers/mfd/viperboard.c
> +++ b/drivers/mfd/viperboard.c
> @@ -93,9 +93,8 @@ static int vprbrd_probe(struct usb_interface *interface,
>  		 version >> 8, version & 0xff,
>  		 vb->usb_dev->bus->busnum, vb->usb_dev->devnum);
>  
> -	ret = mfd_add_devices(&interface->dev, PLATFORM_DEVID_AUTO,
> -				vprbrd_devs, ARRAY_SIZE(vprbrd_devs), NULL, 0,
> -				NULL);
> +	ret = mfd_add_hotplug_devices(&interface->dev, vprbrd_devs,
> +			ARRAY_SIZE(vprbrd_devs));
>  	if (ret != 0) {
>  		dev_err(&interface->dev, "Failed to add mfd devices to core.");
>  		goto error;

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 3/6] mfd: core: add helper function to register hotplug devices
From: Lee Jones @ 2014-10-07  9:24 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Samuel Ortiz, Jiri Kosina, linux-input, Greg Kroah-Hartman,
	linux-kernel, linux-usb
In-Reply-To: <1411728933-13351-4-git-send-email-johan@kernel.org>

On Fri, 26 Sep 2014, Johan Hovold wrote:

> Hot-pluggable multi-function devices should always be registered with
> PLATFORM_DEVID_AUTO to avoid name collisions on the platform bus. This
> helper also hides the memory map and irq parameters, which aren't used
> by hot-pluggable (e.g. USB-based) devices.
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  include/linux/mfd/core.h | 7 +++++++
>  1 file changed, 7 insertions(+)

Applied for v3.19.

> diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
> index f543de91ce19..1e47262a1c63 100644
> --- a/include/linux/mfd/core.h
> +++ b/include/linux/mfd/core.h
> @@ -108,6 +108,13 @@ extern int mfd_add_devices(struct device *parent, int id,
>  			   struct resource *mem_base,
>  			   int irq_base, struct irq_domain *irq_domain);
>  
> +static inline int mfd_add_hotplug_devices(struct device *parent,
> +		const struct mfd_cell *cells, int n_devs)
> +{
> +	return mfd_add_devices(parent, PLATFORM_DEVID_AUTO, cells, n_devs,
> +			NULL, 0, NULL);
> +}
> +
>  extern void mfd_remove_devices(struct device *parent);
>  
>  #endif

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply

* Re: [PATCH 2/6] mfd: rtsx_usb: fix platform device-id collision
From: Lee Jones @ 2014-10-07  9:22 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Samuel Ortiz, Jiri Kosina, linux-input, Greg Kroah-Hartman,
	linux-kernel, linux-usb
In-Reply-To: <1411728933-13351-3-git-send-email-johan@kernel.org>

On Fri, 26 Sep 2014, Johan Hovold wrote:

> Hot-pluggable multi-function devices should use PLATFORM_DEVID_AUTO to
> avoid name collisions on the platform bus.
> 
> This driver currently uses the USB-device address as an id. This makes
> name collisions unlikely, but it could still happen if two devices are
> connected to separate buses and gets assigned the same address.
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  drivers/mfd/rtsx_usb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

This patch is superfluous.

Just wait until the hotpluggable version is applied, then use it.

> diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
> index 71f387ce8cbd..78073e4b87e4 100644
> --- a/drivers/mfd/rtsx_usb.c
> +++ b/drivers/mfd/rtsx_usb.c
> @@ -647,7 +647,7 @@ static int rtsx_usb_probe(struct usb_interface *intf,
>  	/* initialize USB SG transfer timer */
>  	setup_timer(&ucr->sg_timer, rtsx_usb_sg_timed_out, (unsigned long) ucr);
>  
> -	ret = mfd_add_devices(&intf->dev, usb_dev->devnum, rtsx_usb_cells,
> +	ret = mfd_add_devices(&intf->dev, PLATFORM_DEVID_AUTO, rtsx_usb_cells,
>  			ARRAY_SIZE(rtsx_usb_cells), NULL, 0, NULL);
>  	if (ret)
>  		goto out_init_fail;

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 1/6] mfd: viperboard: fix platform-device id collision
From: Lee Jones @ 2014-10-07  9:21 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Samuel Ortiz, Jiri Kosina, linux-input, Greg Kroah-Hartman,
	linux-kernel, linux-usb
In-Reply-To: <1411728933-13351-2-git-send-email-johan@kernel.org>

On Fri, 26 Sep 2014, Johan Hovold wrote:

> Allow more than one viperboard to be connected by registering with
> PLATFORM_DEVID_AUTO instead of PLATFORM_DEVID_NONE.
> 
> The subdevices are currently registered with PLATFORM_DEVID_NONE, which
> will cause a name collision on the platform bus when a second viperboard
> is plugged in:

Applied to fixes.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* wireless logitech rumblepad 2 and hid|udev problem
From: Alessandro Fachin @ 2014-10-07  9:03 UTC (permalink / raw)
  To: linux-input

Hi,
I’m encountering many problems getting work a logitech wireless controller on my QNAP.
It works properly on my laptop with a centos7 kernel 3.10:
udevd —debug -> http://pastebin.com/nCPahDYJ 
If I try to press any buttons I can see the correctly events  works checking "cat /dev/input/event7”

But if I try to connect to my QNAP device kernel 3.12.6 I get:
udevd -debug ->  http://pastebin.com/km5nmtxp
Any /dev/input/event* doesn’t receive input from buttons that I pressed.
I also try to import all udevd*rules from centos to qnap but I have the same results!

The dmesg output is the same:
http://pastebin.com/0UKuwAVx

I recompile the QNAP kernel (x86) to have the same kernel configuration:

# HID support
#
CONFIG_HID=y
CONFIG_HID_BATTERY_STRENGTH=y
CONFIG_HIDRAW=y
# CONFIG_UHID is not set
CONFIG_HID_GENERIC=y
CONFIG_HID_LOGITECH=y
#
# USB HID support
#
CONFIG_USB_HID=y
CONFIG_HID_PID=y
CONFIG_USB_HIDDEV=y

On both system the joystick support is disabled.

Any suggests will be appreciated! Best regards. 

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 0/2] Qualcomm PM8941 power key driver
From: Ivan T. Ivanov @ 2014-10-07  9:01 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
In-Reply-To: <1412644321-27683-1-git-send-email-bjorn.andersson@sonymobile.com>


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. 

Regards,
Ivan 

^ permalink raw reply

* [PATCH] Input: adp5588-keys: cancel workqueue in failure path
From: Pramod Gurav @ 2014-10-07  7:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: Pramod Gurav, Michael Hennerich, Dmitry Torokhov, linux-input

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);
  err_free_mem:
 	input_free_device(input);
 	kfree(kpad);
-- 
1.7.9.5


^ permalink raw reply related

* Re: [PATCH 1/2] input: Add Qualcomm PM8941 power key driver
From: Dmitry Torokhov @ 2014-10-07  2:50 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: 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: <20141007015141.GG28481@sonymobile.com>

On Mon, Oct 06, 2014 at 06:52:51PM -0700, Bjorn Andersson wrote:
> On Mon 06 Oct 18:30 PDT 2014, Dmitry Torokhov wrote:
> 
> > Hi Bjorn,
> > 
> 
> Hi,
> 
> > On Mon, Oct 06, 2014 at 06:12:00PM -0700, Bjorn Andersson wrote:
> > > +
> > > +	rc = devm_request_threaded_irq(&pdev->dev, pwrkey->irq,
> > > +				NULL, pm8941_pwrkey_irq,
> > > +				IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
> > 
> > Do we need to hard-code IRQ flags like this? I'd rather we respect DT
> > data.
> > 
> 
> We could "move" it to DT but I don't think there's any other combination of
> these flags would make sense. If you insist I can remove it though.

No, that's fine if you are certain we want to react on both edges always.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 1/2] input: Add Qualcomm PM8941 power key driver
From: Bjorn Andersson @ 2014-10-07  1:52 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: 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: <20141007013001.GD39707@dtor-ws>

On Mon 06 Oct 18:30 PDT 2014, Dmitry Torokhov wrote:

> Hi Bjorn,
> 

Hi,

> On Mon, Oct 06, 2014 at 06:12:00PM -0700, Bjorn Andersson wrote:
> > +
> > +	rc = devm_request_threaded_irq(&pdev->dev, pwrkey->irq,
> > +				NULL, pm8941_pwrkey_irq,
> > +				IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
> 
> Do we need to hard-code IRQ flags like this? I'd rather we respect DT
> data.
> 

We could "move" it to DT but I don't think there's any other combination of
these flags would make sense. If you insist I can remove it though.

Regards,
Bjorn

^ permalink raw reply

* Re: [PATCH 1/2] input: Add Qualcomm PM8941 power key driver
From: Dmitry Torokhov @ 2014-10-07  1:30 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: 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-2-git-send-email-bjorn.andersson@sonymobile.com>

Hi Bjorn,

On Mon, Oct 06, 2014 at 06:12:00PM -0700, Bjorn Andersson wrote:
> +
> +	rc = devm_request_threaded_irq(&pdev->dev, pwrkey->irq,
> +				NULL, pm8941_pwrkey_irq,
> +				IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |

Do we need to hard-code IRQ flags like this? I'd rather we respect DT
data.

Thanks.

-- 
Dmitry

^ permalink raw reply

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

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

^ permalink raw reply related


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