From: Vadim Pasternak <vadimp@mellanox.com>
To: linux@roeck-us.net
Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org,
linux-kernel@vger.kernel.org, jiri@resnulli.us,
Vadim Pasternak <vadimp@mellanox.com>
Subject: [patch] Disable PMBus status check for DPS400 PSU controller
Date: Thu, 21 Jul 2016 14:55:53 +0000 [thread overview]
Message-ID: <1469112953-77032-1-git-send-email-vadimp@mellanox.com> (raw)
pmbus/dps400: disable PMBus status check through platform data structure to
provide support for PSU DPS-460, DPS-800 from Delta Electronics, INC and for
SGD009 from Acbel Polytech, INC.
These devices do not support the STATUS_CML register, and reports communication
error in response to this command.
For this reason for these controllers, the status register check is disabled.
Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/hwmon/pmbus/pmbus.c | 16 ++++++++++++++++
drivers/hwmon/pmbus/pmbus_core.c | 3 +++
2 files changed, 19 insertions(+)
diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
index 0a74991..44c736a 100644
--- a/drivers/hwmon/pmbus/pmbus.c
+++ b/drivers/hwmon/pmbus/pmbus.c
@@ -25,6 +25,7 @@
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/i2c.h>
+#include <linux/i2c/pmbus.h>
#include "pmbus.h"
/*
@@ -167,14 +168,26 @@ static int pmbus_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct pmbus_driver_info *info;
+ struct pmbus_platform_data *pdata = NULL;
+ struct device *dev = &client->dev;
info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info),
GFP_KERNEL);
if (!info)
return -ENOMEM;
+ if (!strcmp(id->name, "dps460") || !strcmp(id->name, "dps460") ||
+ !strcmp(id->name, "sgd009")) {
+ pdata = kzalloc(sizeof(struct pmbus_platform_data), GFP_KERNEL);
+ if (!pdata) {
+ kfree(info);
+ return -ENOMEM;
+ }
+ pdata->flags = PMBUS_SKIP_STATUS_CHECK;
+ }
info->pages = id->driver_data;
info->identify = pmbus_identify;
+ dev->platform_data = pdata;
return pmbus_do_probe(client, id, info);
}
@@ -199,6 +212,9 @@ static const struct i2c_device_id pmbus_id[] = {
{"tps544c20", 1},
{"tps544c25", 1},
{"udt020", 1},
+ {"dps460", 1},
+ {"dps800", 1},
+ {"sgd009", 1},
{}
};
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index ba59eae..3d98070 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -1931,8 +1931,11 @@ EXPORT_SYMBOL_GPL(pmbus_do_probe);
int pmbus_do_remove(struct i2c_client *client)
{
struct pmbus_data *data = i2c_get_clientdata(client);
+ const struct pmbus_platform_data *pdata =
+ dev_get_platdata(&client->dev);
hwmon_device_unregister(data->hwmon_dev);
kfree(data->group.attrs);
+ kfree(pdata);
return 0;
}
EXPORT_SYMBOL_GPL(pmbus_do_remove);
--
2.1.4
next reply other threads:[~2016-07-21 12:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-21 14:55 Vadim Pasternak [this message]
2016-07-21 13:41 ` Guenter Roeck
2016-07-21 14:08 ` Vadim Pasternak
2016-07-21 14:31 ` 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=1469112953-77032-1-git-send-email-vadimp@mellanox.com \
--to=vadimp@mellanox.com \
--cc=jdelvare@suse.com \
--cc=jiri@resnulli.us \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/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®