All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] hwmon: (pmbus) Add explicit support for DPS-460, DPS-800, and SGD009
@ 2016-07-25  8:10 Vadim Pasternak
  2016-07-25  8:32 ` Jean Delvare
  0 siblings, 1 reply; 6+ messages in thread
From: Vadim Pasternak @ 2016-07-25  8:10 UTC (permalink / raw)
  To: linux; +Cc: jdelvare, linux-hwmon, linux-kernel, jiri, Vadim Pasternak

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 a
communication error in response to this command.
For this reason, the status register check is disabled for these controllers.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
 drivers/hwmon/pmbus/pmbus.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
index 0a74991..f28de37 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,27 @@ 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, "dps800") ||
+	    !strcmp(id->name, "sgd009")) {
+		pdata = devm_kzalloc(&client->dev,
+				     sizeof(struct pmbus_platform_data),
+				     GFP_KERNEL);
+		if (!pdata)
+			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);
 }
@@ -186,6 +200,8 @@ static const struct i2c_device_id pmbus_id[] = {
 	{"adp4000", 1},
 	{"bmr453", 1},
 	{"bmr454", 1},
+	{"dps460", 1},
+	{"dps800", 1},
 	{"mdt040", 1},
 	{"ncp4200", 1},
 	{"ncp4208", 1},
@@ -193,6 +209,7 @@ static const struct i2c_device_id pmbus_id[] = {
 	{"pdt006", 1},
 	{"pdt012", 1},
 	{"pmbus", 0},
+	{"sgd009", 1},
 	{"tps40400", 1},
 	{"tps544b20", 1},
 	{"tps544b25", 1},
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [patch] hwmon: (pmbus) Add explicit support for DPS-460, DPS-800, and SGD009
  2016-07-25  8:10 [patch] hwmon: (pmbus) Add explicit support for DPS-460, DPS-800, and SGD009 Vadim Pasternak
@ 2016-07-25  8:32 ` Jean Delvare
  2016-07-25  8:56   ` Vadim Pasternak
  0 siblings, 1 reply; 6+ messages in thread
From: Jean Delvare @ 2016-07-25  8:32 UTC (permalink / raw)
  To: Vadim Pasternak; +Cc: linux, linux-hwmon, linux-kernel, jiri

Hi Vadim,

On Mon, 25 Jul 2016 08:10:29 +0000, Vadim Pasternak wrote:
> 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 a
> communication error in response to this command.
> For this reason, the status register check is disabled for these controllers.
> 
> Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  drivers/hwmon/pmbus/pmbus.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
> index 0a74991..f28de37 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,27 @@ 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;

A blank line here would improve readability IMHO.

> +	if (!strcmp(id->name, "dps460") || !strcmp(id->name, "dps800") ||
> +	    !strcmp(id->name, "sgd009")) {
> +		pdata = devm_kzalloc(&client->dev,

You have defined dev, you might as well use it here, and also in the
other devm_kzalloc call.

> +				     sizeof(struct pmbus_platform_data),
> +				     GFP_KERNEL);
> +		if (!pdata)
> +			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);
>  }
> @@ -186,6 +200,8 @@ static const struct i2c_device_id pmbus_id[] = {
>  	{"adp4000", 1},
>  	{"bmr453", 1},
>  	{"bmr454", 1},
> +	{"dps460", 1},
> +	{"dps800", 1},
>  	{"mdt040", 1},
>  	{"ncp4200", 1},
>  	{"ncp4208", 1},
> @@ -193,6 +209,7 @@ static const struct i2c_device_id pmbus_id[] = {
>  	{"pdt006", 1},
>  	{"pdt012", 1},
>  	{"pmbus", 0},
> +	{"sgd009", 1},
>  	{"tps40400", 1},
>  	{"tps544b20", 1},
>  	{"tps544b25", 1},

(non-authoritative)
Reviewed-by: Jean Delvare <jdelvare@suse.de>

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [patch] hwmon: (pmbus) Add explicit support for DPS-460, DPS-800, and SGD009
  2016-07-25  8:32 ` Jean Delvare
@ 2016-07-25  8:56   ` Vadim Pasternak
  0 siblings, 0 replies; 6+ messages in thread
From: Vadim Pasternak @ 2016-07-25  8:56 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux, linux-hwmon, linux-kernel, jiri



> -----Original Message-----
> From: Jean Delvare [mailto:jdelvare@suse.de]
> Sent: Monday, July 25, 2016 11:32 AM
> To: Vadim Pasternak <vadimp@mellanox.com>
> Cc: linux@roeck-us.net; linux-hwmon@vger.kernel.org; linux-
> kernel@vger.kernel.org; jiri@resnulli.us
> Subject: Re: [patch] hwmon: (pmbus) Add explicit support for DPS-460, DPS-800,
> and SGD009
> 
> Hi Vadim,

Hi Jean,
Thank you for your comments.
Will resend modified patch. 

> 
> On Mon, 25 Jul 2016 08:10:29 +0000, Vadim Pasternak wrote:
> > 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 a
> > communication error in response to this command.
> > For this reason, the status register check is disabled for these controllers.
> >
> > Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
> > Reviewed-by: Jiri Pirko <jiri@mellanox.com>
> > ---
> >  drivers/hwmon/pmbus/pmbus.c | 17 +++++++++++++++++
> >  1 file changed, 17 insertions(+)
> >
> > diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
> > index 0a74991..f28de37 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,27 @@ 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;
> 
> A blank line here would improve readability IMHO.
> 
> > +	if (!strcmp(id->name, "dps460") || !strcmp(id->name, "dps800") ||
> > +	    !strcmp(id->name, "sgd009")) {
> > +		pdata = devm_kzalloc(&client->dev,
> 
> You have defined dev, you might as well use it here, and also in the other
> devm_kzalloc call.
> 
> > +				     sizeof(struct pmbus_platform_data),
> > +				     GFP_KERNEL);
> > +		if (!pdata)
> > +			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);  } @@ -186,6 +200,8 @@
> > static const struct i2c_device_id pmbus_id[] = {
> >  	{"adp4000", 1},
> >  	{"bmr453", 1},
> >  	{"bmr454", 1},
> > +	{"dps460", 1},
> > +	{"dps800", 1},
> >  	{"mdt040", 1},
> >  	{"ncp4200", 1},
> >  	{"ncp4208", 1},
> > @@ -193,6 +209,7 @@ static const struct i2c_device_id pmbus_id[] = {
> >  	{"pdt006", 1},
> >  	{"pdt012", 1},
> >  	{"pmbus", 0},
> > +	{"sgd009", 1},
> >  	{"tps40400", 1},
> >  	{"tps544b20", 1},
> >  	{"tps544b25", 1},
> 
> (non-authoritative)
> Reviewed-by: Jean Delvare <jdelvare@suse.de>
> 
> --
> Jean Delvare
> SUSE L3 Support

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] hwmon: (pmbus) Add explicit support for DPS-460, DPS-800, and SGD009
  2016-07-25 10:55 Vadim Pasternak
  2016-07-26  7:18 ` Jean Delvare
@ 2016-07-30 15:58 ` Guenter Roeck
  1 sibling, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2016-07-30 15:58 UTC (permalink / raw)
  To: Vadim Pasternak; +Cc: jdelvare, linux-hwmon, linux-kernel, jiri

On 07/25/2016 03:55 AM, Vadim Pasternak wrote:
> 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 a
> communication error in response to this command.
> For this reason, the status register check is disabled for these controllers.
>
> Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
> Reviewed-by: Jiri Pirko <jiri@mellanox.com>

Applied to -next.

Thanks,
Guenter



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] hwmon: (pmbus) Add explicit support for DPS-460, DPS-800, and SGD009
  2016-07-25 10:55 Vadim Pasternak
@ 2016-07-26  7:18 ` Jean Delvare
  2016-07-30 15:58 ` Guenter Roeck
  1 sibling, 0 replies; 6+ messages in thread
From: Jean Delvare @ 2016-07-26  7:18 UTC (permalink / raw)
  To: Vadim Pasternak; +Cc: linux, linux-hwmon, linux-kernel, jiri

On Mon, 25 Jul 2016 10:55:53 +0000, Vadim Pasternak wrote:
> 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 a
> communication error in response to this command.
> For this reason, the status register check is disabled for these controllers.
> 
> Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  drivers/hwmon/pmbus/pmbus.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> (...)

Reviewed-by: Jean Delvare <jdelvare@suse.de>

I leave the final ack to Guenter.

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch] hwmon: (pmbus) Add explicit support for DPS-460, DPS-800, and SGD009
@ 2016-07-25 10:55 Vadim Pasternak
  2016-07-26  7:18 ` Jean Delvare
  2016-07-30 15:58 ` Guenter Roeck
  0 siblings, 2 replies; 6+ messages in thread
From: Vadim Pasternak @ 2016-07-25 10:55 UTC (permalink / raw)
  To: linux; +Cc: jdelvare, linux-hwmon, linux-kernel, jiri, Vadim Pasternak

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 a
communication error in response to this command.
For this reason, the status register check is disabled for these controllers.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
 drivers/hwmon/pmbus/pmbus.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
index 0a74991..44ca8a9 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);
+	info = devm_kzalloc(dev, sizeof(struct pmbus_driver_info), GFP_KERNEL);
 	if (!info)
 		return -ENOMEM;
 
+	if (!strcmp(id->name, "dps460") || !strcmp(id->name, "dps800") ||
+	    !strcmp(id->name, "sgd009")) {
+		pdata = devm_kzalloc(dev, sizeof(struct pmbus_platform_data),
+				     GFP_KERNEL);
+		if (!pdata)
+			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);
 }
@@ -186,6 +199,8 @@ static const struct i2c_device_id pmbus_id[] = {
 	{"adp4000", 1},
 	{"bmr453", 1},
 	{"bmr454", 1},
+	{"dps460", 1},
+	{"dps800", 1},
 	{"mdt040", 1},
 	{"ncp4200", 1},
 	{"ncp4208", 1},
@@ -193,6 +208,7 @@ static const struct i2c_device_id pmbus_id[] = {
 	{"pdt006", 1},
 	{"pdt012", 1},
 	{"pmbus", 0},
+	{"sgd009", 1},
 	{"tps40400", 1},
 	{"tps544b20", 1},
 	{"tps544b25", 1},
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-07-30 15:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-25  8:10 [patch] hwmon: (pmbus) Add explicit support for DPS-460, DPS-800, and SGD009 Vadim Pasternak
2016-07-25  8:32 ` Jean Delvare
2016-07-25  8:56   ` Vadim Pasternak
2016-07-25 10:55 Vadim Pasternak
2016-07-26  7:18 ` Jean Delvare
2016-07-30 15:58 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.