linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-input@vger.kernel.org
Subject: Re: [PATCH 3/3] input: mpu3050: Ensure we enable interrupts
Date: Sat, 24 Dec 2011 00:09:58 -0800	[thread overview]
Message-ID: <20111224080958.GB13020@core.coreip.homeip.net> (raw)
In-Reply-To: <20111215221857.8657.57262.stgit@bob.linux.org.uk>

On Thu, Dec 15, 2011 at 10:18:59PM +0000, Alan Cox wrote:
> From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> 
> This also changes the devname parameter delivered to
> request_threaded_irq() from "mpu_int" to "mpu3050".
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Signed-off-by: Alan Cox <alan@linux.intel.com>
> ---
> 
>  drivers/input/misc/mpu3050.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> 
> diff --git a/drivers/input/misc/mpu3050.c b/drivers/input/misc/mpu3050.c
> index 89c7160..cf42c78 100644
> --- a/drivers/input/misc/mpu3050.c
> +++ b/drivers/input/misc/mpu3050.c
> @@ -437,12 +437,20 @@ static int __devinit mpu3050_probe(struct i2c_client *client,
>  		error = request_threaded_irq(client->irq,
>  				NULL, mpu3050_interrupt_thread,
>  				IRQF_TRIGGER_RISING,
> -				"mpu_int", sensor);
> +				"mpu3050", sensor);
>  		if (error) {
>  			dev_err(&client->dev, "can't get IRQ %d, error %d\n",
>  					client->irq, error);
>  			goto err_pm_set_suspended;
>  		}
> +
> +		/* Enable interrupts */
> +		i2c_smbus_write_byte_data(sensor->client, MPU3050_INT_CFG,
> +					MPU3050_LATCH_INT_EN
> +					| MPU3050_RAW_RDY_EN
> +					| MPU3050_MPU_RDY_EN);
> +		if (ret < 0)
> +			goto err_free_irq;

You are testing a random variable here. Also, this belongs in open()
method. I will apply the patch below.

Thanks.

-- 
Dmitry

Input: mpu3050 - ensure we enable interrupts

From: Heikki Krogerus <heikki.krogerus@linux.intel.com>

This also changes the devname parameter delivered to
request_threaded_irq() from "mpu_int" to "mpu3050".

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

 drivers/input/misc/mpu3050.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)


diff --git a/drivers/input/misc/mpu3050.c b/drivers/input/misc/mpu3050.c
index 28a7b19..76905ae 100644
--- a/drivers/input/misc/mpu3050.c
+++ b/drivers/input/misc/mpu3050.c
@@ -148,9 +148,20 @@ static void mpu3050_set_power_mode(struct i2c_client *client, u8 val)
 static int mpu3050_input_open(struct input_dev *input)
 {
 	struct mpu3050_sensor *sensor = input_get_drvdata(input);
+	int error;
 
 	pm_runtime_get(sensor->dev);
 
+	/* Enable interrupts */
+	error = i2c_smbus_write_byte_data(sensor->client, MPU3050_INT_CFG,
+					  MPU3050_LATCH_INT_EN |
+					  MPU3050_RAW_RDY_EN |
+					  MPU3050_MPU_RDY_EN);
+	if (error < 0) {
+		pm_runtime_put(sensor->dev);
+		return error;
+	}
+
 	return 0;
 }
 
@@ -259,7 +270,7 @@ static int __devinit mpu3050_probe(struct i2c_client *client,
 	error = request_threaded_irq(client->irq,
 				     NULL, mpu3050_interrupt_thread,
 				     IRQF_TRIGGER_RISING,
-				     "mpu_int", sensor);
+				     "mpu3050", sensor);
 	if (error) {
 		dev_err(&client->dev,
 			"can't get IRQ %d, error %d\n", client->irq, error);

      reply	other threads:[~2011-12-24  8:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-15 22:18 [PATCH 0/3] mpu3050 updates Alan Cox
2011-12-15 22:18 ` [PATCH 1/3] input: mpu3050: Support for polled input device Alan Cox
2011-12-16 10:52   ` Shubhrajyoti
2011-12-28  5:07   ` Dmitry Torokhov
2011-12-15 22:18 ` [PATCH 2/3] input: mpu3050: Configure the sampling method Alan Cox
2011-12-24  8:07   ` Dmitry Torokhov
2011-12-15 22:18 ` [PATCH 3/3] input: mpu3050: Ensure we enable interrupts Alan Cox
2011-12-24  8:09   ` Dmitry Torokhov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111224080958.GB13020@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).