From: Michael Thalmeier <michael.thalmeier@hale.at>
To: linux@roeck-us.net, jdelvare@suse.de
Cc: lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org
Subject: [PATCH] hwmon: (lm75) put chip into shutdown mode on shutdown
Date: Thu, 6 Nov 2014 15:00:32 +0100 [thread overview]
Message-ID: <1415282432-3256-1-git-send-email-michael.thalmeier@hale.at> (raw)
In addition to going into shutdown mode on suspend also go into shutdown mode
on system shutdown. This way we can save a few mA when the main CPU is powered
off and the lm75 is still powered but not used any more.
Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
---
drivers/hwmon/lm75.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index 7ec5ccd..d860af9 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -433,10 +433,10 @@ static int lm75_detect(struct i2c_client *new_client,
}
#ifdef CONFIG_PM
-static int lm75_suspend(struct device *dev)
+
+static int _lm75_shutdown(struct i2c_client *client)
{
int status;
- struct i2c_client *client = to_i2c_client(dev);
status = lm75_read_value(client, LM75_REG_CONF);
if (status < 0) {
dev_dbg(&client->dev, "Can't read config? %d\n", status);
@@ -447,6 +447,18 @@ static int lm75_suspend(struct device *dev)
return 0;
}
+static void lm75_shutdown(struct i2c_client *client)
+{
+ _lm75_shutdown(client);
+}
+
+static int lm75_suspend(struct device *dev)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+
+ return _lm75_shutdown(client);
+}
+
static int lm75_resume(struct device *dev)
{
int status;
@@ -466,8 +478,10 @@ static const struct dev_pm_ops lm75_dev_pm_ops = {
.resume = lm75_resume,
};
#define LM75_DEV_PM_OPS (&lm75_dev_pm_ops)
+#define LM75_SHUTDOWN_OP lm75_shutdown
#else
#define LM75_DEV_PM_OPS NULL
+#define LM75_SHUTDOWN_OP NULL
#endif /* CONFIG_PM */
static struct i2c_driver lm75_driver = {
@@ -478,6 +492,7 @@ static struct i2c_driver lm75_driver = {
},
.probe = lm75_probe,
.remove = lm75_remove,
+ .shutdown = LM75_SHUTDOWN_OP,
.id_table = lm75_ids,
.detect = lm75_detect,
.address_list = normal_i2c,
--
1.9.3
next reply other threads:[~2014-11-06 14:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-06 14:00 Michael Thalmeier [this message]
2014-11-06 14:17 ` Guenter Roeck
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=1415282432-3256-1-git-send-email-michael.thalmeier@hale.at \
--to=michael.thalmeier@hale.at \
--cc=jdelvare@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lm-sensors@lm-sensors.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
all inboxes | Powered by JetHome®