* [PATCH RESEND v4 2/3] hwmon: (lm90) add support to handle IRQ
@ 2013-11-04 10:26 Wei Ni
[not found] ` <1383560793-11039-1-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Wei Ni @ 2013-11-04 10:26 UTC (permalink / raw)
To: khali-PUYAD+kWke1g9hUCZPvPmw, linux-0h96xk9xTtrk1uMJSBkQmQ
Cc: lm-sensors-GZX6beZjE8VD60Wz+7aTrA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Wei Ni
When the temperature exceed the limit range value,
the driver can handle the interrupt.
Signed-off-by: Wei Ni <wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
drivers/hwmon/lm90.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 57485ef..d55c25d 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -89,6 +89,7 @@
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
+#include <linux/interrupt.h>
/*
* Addresses to scan
@@ -1435,6 +1436,17 @@ static bool lm90_is_tripped(struct i2c_client *client, u16 *status)
return true;
}
+static irqreturn_t lm90_irq_thread(int irq, void *dev_id)
+{
+ struct i2c_client *client = dev_id;
+ u16 status;
+
+ if (lm90_is_tripped(client, &status))
+ return IRQ_HANDLED;
+ else
+ return IRQ_NONE;
+}
+
static int lm90_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
@@ -1511,6 +1523,18 @@ static int lm90_probe(struct i2c_client *client,
goto exit_remove_files;
}
+ if (client->irq) {
+ dev_dbg(dev, "IRQ: %d\n", client->irq);
+ err = devm_request_threaded_irq(dev, client->irq,
+ NULL, lm90_irq_thread,
+ IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+ "lm90", client);
+ if (err < 0) {
+ dev_err(dev, "cannot request IRQ: %d\n", client->irq);
+ goto exit_remove_files;
+ }
+ }
+
return 0;
exit_remove_files:
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RESEND v4 2/3] hwmon: (lm90) add support to handle IRQ
[not found] ` <1383560793-11039-1-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2013-11-04 10:33 ` Jean Delvare
0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2013-11-04 10:33 UTC (permalink / raw)
To: Wei Ni
Cc: linux-0h96xk9xTtrk1uMJSBkQmQ, lm-sensors-GZX6beZjE8VD60Wz+7aTrA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
On Mon, 4 Nov 2013 18:26:33 +0800, Wei Ni wrote:
> When the temperature exceed the limit range value,
> the driver can handle the interrupt.
>
> Signed-off-by: Wei Ni <wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
> drivers/hwmon/lm90.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
> (...)
Applied, thanks.
--
Jean Delvare
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-04 10:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-04 10:26 [PATCH RESEND v4 2/3] hwmon: (lm90) add support to handle IRQ Wei Ni
[not found] ` <1383560793-11039-1-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-11-04 10:33 ` Jean Delvare
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox