linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/4] pmbus: associate PMBUS_SKIP_STATUS_CHECK with driver_data
       [not found] <cover.1546851856.git.xiaoting.liu@hxt-semitech.com>
@ 2019-01-07 10:57 ` Xiaoting Liu
  2019-01-07 14:04   ` Guenter Roeck
  2019-01-07 11:00 ` [PATCH v2 2/4] dt-bindings: hwmon: add dps650ab documentation Xiaoting Liu
  2019-01-07 11:06 ` [PATCH v2 4/4] hwmon: (pmbus) add support for DPS-650AB Xiaoting Liu
  2 siblings, 1 reply; 9+ messages in thread
From: Xiaoting Liu @ 2019-01-07 10:57 UTC (permalink / raw)
  To: linux, jdelvare
  Cc: openbmc, linux-hwmon, linux-kernel, shunyong.yang,
	dongsheng.wang, Xiaoting Liu

Current code compares device name with name in i2c_device_id to decide
whether PMBUS_SKIP_STATUS_CHECK should be set in pmbus_platform_data,
which makes adding new devices with PMBUS_SKIP_STATUS_CHECK should also
modify code in pmbus_probe().

This patch adds pmbus_device_info to save pages and flags. Its pointer
is put in driver_data of i2c_device_id, which makes adding new device
more straightforward.

Signed-off-by: Shunyong Yang <shunyong.yang@hxt-semitech.com>
Signed-off-by: Xiaoting Liu <xiaoting.liu@hxt-semitech.com>
---
v2:
  Move struct pmbus_device_info definition location from pmbus.h to pmbus.c.
  Change struct name from default_pmbus_info to pmbus_info_one.
  Change struct name from pmbus_info to pmbus_info_zero.
  Replace struct name dps460_pmbus_info and sgd009_pmbus_info with
  pmbus_info_one_skip.
---
 drivers/hwmon/pmbus/pmbus.c | 55 +++++++++++++++++++++++++++------------------
 1 file changed, 33 insertions(+), 22 deletions(-)

diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
index 7688dab32f6e..e38dd97cc49a 100644
--- a/drivers/hwmon/pmbus/pmbus.c
+++ b/drivers/hwmon/pmbus/pmbus.c
@@ -28,6 +28,11 @@
 #include <linux/pmbus.h>
 #include "pmbus.h"

+struct pmbus_device_info {
+       int pages;
+       u32 flags;
+};
+
 /*
  * Find sensor groups and status registers on each page.
  */
@@ -172,13 +177,15 @@ static int pmbus_probe(struct i2c_client *client,
        struct pmbus_driver_info *info;
        struct pmbus_platform_data *pdata = NULL;
        struct device *dev = &client->dev;
+       struct pmbus_device_info *device_info;

        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")) {
+       device_info = (struct pmbus_device_info *)id->driver_data;
+
+       if (device_info->flags & PMBUS_SKIP_STATUS_CHECK) {
                pdata = devm_kzalloc(dev, sizeof(struct pmbus_platform_data),
                                     GFP_KERNEL);
                if (!pdata)
@@ -187,36 +194,40 @@ static int pmbus_probe(struct i2c_client *client,
                pdata->flags = PMBUS_SKIP_STATUS_CHECK;
        }

-       info->pages = id->driver_data;
+       info->pages = device_info->pages;
        info->identify = pmbus_identify;
        dev->platform_data = pdata;

        return pmbus_do_probe(client, id, info);
 }

+static const struct pmbus_device_info pmbus_info_one = {1, 0};
+static const struct pmbus_device_info pmbus_info_zero = {0, 0};
+static const struct pmbus_device_info pmbus_info_one_skip = {
+                               1, PMBUS_SKIP_STATUS_CHECK};
 /*
  * Use driver_data to set the number of pages supported by the chip.
  */
 static const struct i2c_device_id pmbus_id[] = {
-       {"adp4000", 1},
-       {"bmr453", 1},
-       {"bmr454", 1},
-       {"dps460", 1},
-       {"dps800", 1},
-       {"mdt040", 1},
-       {"ncp4200", 1},
-       {"ncp4208", 1},
-       {"pdt003", 1},
-       {"pdt006", 1},
-       {"pdt012", 1},
-       {"pmbus", 0},
-       {"sgd009", 1},
-       {"tps40400", 1},
-       {"tps544b20", 1},
-       {"tps544b25", 1},
-       {"tps544c20", 1},
-       {"tps544c25", 1},
-       {"udt020", 1},
+       {"adp4000", (kernel_ulong_t)&pmbus_info_one},
+       {"bmr453", (kernel_ulong_t)&pmbus_info_one},
+       {"bmr454", (kernel_ulong_t)&pmbus_info_one},
+       {"dps460", (kernel_ulong_t)&pmbus_info_one_skip},
+       {"dps800", (kernel_ulong_t)&pmbus_info_one_skip},
+       {"mdt040", (kernel_ulong_t)&pmbus_info_one},
+       {"ncp4200", (kernel_ulong_t)&pmbus_info_one},
+       {"ncp4208", (kernel_ulong_t)&pmbus_info_one},
+       {"pdt003", (kernel_ulong_t)&pmbus_info_one},
+       {"pdt006", (kernel_ulong_t)&pmbus_info_one},
+       {"pdt012", (kernel_ulong_t)&pmbus_info_one},
+       {"pmbus", (kernel_ulong_t)&pmbus_info_zero},
+       {"sgd009", (kernel_ulong_t)&pmbus_info_one_skip},
+       {"tps40400", (kernel_ulong_t)&pmbus_info_one},
+       {"tps544b20", (kernel_ulong_t)&pmbus_info_one},
+       {"tps544b25", (kernel_ulong_t)&pmbus_info_one},
+       {"tps544c20", (kernel_ulong_t)&pmbus_info_one},
+       {"tps544c25", (kernel_ulong_t)&pmbus_info_one},
+       {"udt020", (kernel_ulong_t)&pmbus_info_one},
        {}
 };

--
1.8.3.1




This email is intended only for the named addressee. It may contain information that is confidential/private, legally privileged, or copyright-protected, and you should handle it accordingly. If you are not the intended recipient, you do not have legal rights to retain, copy, or distribute this email or its contents, and should promptly delete the email and all electronic copies in your system; do not retain copies in any media. If you have received this email in error, please notify the sender promptly. Thank you.



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

* [PATCH v2 2/4] dt-bindings: hwmon: add dps650ab documentation
       [not found] <cover.1546851856.git.xiaoting.liu@hxt-semitech.com>
  2019-01-07 10:57 ` [PATCH v2 1/4] pmbus: associate PMBUS_SKIP_STATUS_CHECK with driver_data Xiaoting Liu
@ 2019-01-07 11:00 ` Xiaoting Liu
  2019-01-07 13:58   ` Guenter Roeck
  2019-01-07 11:06 ` [PATCH v2 4/4] hwmon: (pmbus) add support for DPS-650AB Xiaoting Liu
  2 siblings, 1 reply; 9+ messages in thread
From: Xiaoting Liu @ 2019-01-07 11:00 UTC (permalink / raw)
  To: linux, jdelvare, robh+dt, mark.rutland, openbmc
  Cc: linux-hwmon, linux-kernel, devicetree, shunyong.yang,
	dongsheng.wang, Xiaoting Liu

Bindings for DPS650AB power, voltage, temperature, and fan monitering.

Signed-off-by: Xiaoting Liu <xiaoting.liu@hxt-semitech.com>
---
v2:
  Change the patch subject.
---
 Documentation/devicetree/bindings/hwmon/dps650ab.txt | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Documentation/devicetree/bindings/hwmon/dps650ab.txt b/Documentation/devicetree/bindings/hwmon/dps650ab.txt
new file mode 100644
index 000000000000..6bbbff89f6d5
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/dps650ab.txt
@@ -0,0 +1,11 @@
+Bindings for DPS650AB power, voltage, temperature, and fan monitering
+
+Required properties:
+- compatible : "dps650ab"
+- reg       : I2C address, one of 0x58, 0x59.
+
+Example:
+       dps650ab@58 {
+                   compatible = "dps650ab";
+                   reg = <0x58>;
+       };
--
1.8.3.1




This email is intended only for the named addressee. It may contain information that is confidential/private, legally privileged, or copyright-protected, and you should handle it accordingly. If you are not the intended recipient, you do not have legal rights to retain, copy, or distribute this email or its contents, and should promptly delete the email and all electronic copies in your system; do not retain copies in any media. If you have received this email in error, please notify the sender promptly. Thank you.



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

* [PATCH v2 4/4] hwmon: (pmbus) add support for DPS-650AB
       [not found] <cover.1546851856.git.xiaoting.liu@hxt-semitech.com>
  2019-01-07 10:57 ` [PATCH v2 1/4] pmbus: associate PMBUS_SKIP_STATUS_CHECK with driver_data Xiaoting Liu
  2019-01-07 11:00 ` [PATCH v2 2/4] dt-bindings: hwmon: add dps650ab documentation Xiaoting Liu
@ 2019-01-07 11:06 ` Xiaoting Liu
  2019-01-07 14:04   ` Guenter Roeck
  2 siblings, 1 reply; 9+ messages in thread
From: Xiaoting Liu @ 2019-01-07 11:06 UTC (permalink / raw)
  To: linux, jdelvare
  Cc: openbmc, linux-hwmon, linux-kernel, shunyong.yang,
	dongsheng.wang, Xiaoting Liu

Provide support for PSU DPS-650AB from Delta Electronics, INC.

Signed-off-by: Xiaoting Liu <xiaoting.liu@hxt-semitech.com>
---
v2:
  Change the patch subject and commit message.
  Drop dps650ab.c file.
  Replace struct name dps650ab_pmbus_info with pmbus_info_one_skip.
---
 drivers/hwmon/pmbus/pmbus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
index e38dd97cc49a..f6b35f858db8 100644
--- a/drivers/hwmon/pmbus/pmbus.c
+++ b/drivers/hwmon/pmbus/pmbus.c
@@ -213,6 +213,7 @@ static int pmbus_probe(struct i2c_client *client,
        {"bmr453", (kernel_ulong_t)&pmbus_info_one},
        {"bmr454", (kernel_ulong_t)&pmbus_info_one},
        {"dps460", (kernel_ulong_t)&pmbus_info_one_skip},
+       {"dps650ab", (kernel_ulong_t)&pmbus_info_one_skip},
        {"dps800", (kernel_ulong_t)&pmbus_info_one_skip},
        {"mdt040", (kernel_ulong_t)&pmbus_info_one},
        {"ncp4200", (kernel_ulong_t)&pmbus_info_one},
--
1.8.3.1




This email is intended only for the named addressee. It may contain information that is confidential/private, legally privileged, or copyright-protected, and you should handle it accordingly. If you are not the intended recipient, you do not have legal rights to retain, copy, or distribute this email or its contents, and should promptly delete the email and all electronic copies in your system; do not retain copies in any media. If you have received this email in error, please notify the sender promptly. Thank you.



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

* Re: [PATCH v2 2/4] dt-bindings: hwmon: add dps650ab documentation
  2019-01-07 11:00 ` [PATCH v2 2/4] dt-bindings: hwmon: add dps650ab documentation Xiaoting Liu
@ 2019-01-07 13:58   ` Guenter Roeck
  2019-01-08  8:57     ` Liu, Xiaoting
  0 siblings, 1 reply; 9+ messages in thread
From: Guenter Roeck @ 2019-01-07 13:58 UTC (permalink / raw)
  To: Xiaoting Liu, jdelvare, robh+dt, mark.rutland, openbmc
  Cc: linux-hwmon, linux-kernel, devicetree, shunyong.yang, dongsheng.wang

On 1/7/19 3:00 AM, Xiaoting Liu wrote:
> Bindings for DPS650AB power, voltage, temperature, and fan monitering.
> 
> Signed-off-by: Xiaoting Liu <xiaoting.liu@hxt-semitech.com>
> ---
> v2:
>    Change the patch subject.
> ---
>   Documentation/devicetree/bindings/hwmon/dps650ab.txt | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/dps650ab.txt b/Documentation/devicetree/bindings/hwmon/dps650ab.txt
> new file mode 100644
> index 000000000000..6bbbff89f6d5
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/dps650ab.txt
> @@ -0,0 +1,11 @@
> +Bindings for DPS650AB power, voltage, temperature, and fan monitering
> +

Assuming this is the Delta Electronics DPS-650-AB power supply, I think
you should mention that here.

> +Required properties:
> +- compatible : "dps650ab"

Again, assuming this is the Delta Electronics power supply, this should
probably be something like "delta,dps650ab".

Thanks,
Guenter

> +- reg       : I2C address, one of 0x58, 0x59.
> +
> +Example:
> +       dps650ab@58 {
> +                   compatible = "dps650ab";
> +                   reg = <0x58>;
> +       };
> --
> 1.8.3.1
> 
> 
> 
> 
> This email is intended only for the named addressee. It may contain information that is confidential/private, legally privileged, or copyright-protected, and you should handle it accordingly. If you are not the intended recipient, you do not have legal rights to retain, copy, or distribute this email or its contents, and should promptly delete the email and all electronic copies in your system; do not retain copies in any media. If you have received this email in error, please notify the sender promptly. Thank you.
> 
> 
> 


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

* Re: [PATCH v2 1/4] pmbus: associate PMBUS_SKIP_STATUS_CHECK with driver_data
  2019-01-07 10:57 ` [PATCH v2 1/4] pmbus: associate PMBUS_SKIP_STATUS_CHECK with driver_data Xiaoting Liu
@ 2019-01-07 14:04   ` Guenter Roeck
  2019-01-08  8:44     ` Liu, Xiaoting
  0 siblings, 1 reply; 9+ messages in thread
From: Guenter Roeck @ 2019-01-07 14:04 UTC (permalink / raw)
  To: Xiaoting Liu, jdelvare
  Cc: openbmc, linux-hwmon, linux-kernel, shunyong.yang, dongsheng.wang

On 1/7/19 2:57 AM, Xiaoting Liu wrote:
> Current code compares device name with name in i2c_device_id to decide
> whether PMBUS_SKIP_STATUS_CHECK should be set in pmbus_platform_data,
> which makes adding new devices with PMBUS_SKIP_STATUS_CHECK should also
> modify code in pmbus_probe().
> 
> This patch adds pmbus_device_info to save pages and flags. Its pointer
> is put in driver_data of i2c_device_id, which makes adding new device
> more straightforward.
> 
> Signed-off-by: Shunyong Yang <shunyong.yang@hxt-semitech.com>
> Signed-off-by: Xiaoting Liu <xiaoting.liu@hxt-semitech.com>
> ---
> v2:
>    Move struct pmbus_device_info definition location from pmbus.h to pmbus.c.
>    Change struct name from default_pmbus_info to pmbus_info_one.
>    Change struct name from pmbus_info to pmbus_info_zero.
>    Replace struct name dps460_pmbus_info and sgd009_pmbus_info with
>    pmbus_info_one_skip.
> ---
>   drivers/hwmon/pmbus/pmbus.c | 55 +++++++++++++++++++++++++++------------------
>   1 file changed, 33 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
> index 7688dab32f6e..e38dd97cc49a 100644
> --- a/drivers/hwmon/pmbus/pmbus.c
> +++ b/drivers/hwmon/pmbus/pmbus.c
> @@ -28,6 +28,11 @@
>   #include <linux/pmbus.h>
>   #include "pmbus.h"
> 
> +struct pmbus_device_info {
> +       int pages;
> +       u32 flags;
> +};
> +
>   /*
>    * Find sensor groups and status registers on each page.
>    */
> @@ -172,13 +177,15 @@ static int pmbus_probe(struct i2c_client *client,
>          struct pmbus_driver_info *info;
>          struct pmbus_platform_data *pdata = NULL;
>          struct device *dev = &client->dev;
> +       struct pmbus_device_info *device_info;
> 
>          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")) {
> +       device_info = (struct pmbus_device_info *)id->driver_data;
> +

Please no empty line between assignments and checking its results.

> +       if (device_info->flags & PMBUS_SKIP_STATUS_CHECK) {
>                  pdata = devm_kzalloc(dev, sizeof(struct pmbus_platform_data),
>                                       GFP_KERNEL);
>                  if (!pdata)
> @@ -187,36 +194,40 @@ static int pmbus_probe(struct i2c_client *client,
>                  pdata->flags = PMBUS_SKIP_STATUS_CHECK;
>          }
> 
> -       info->pages = id->driver_data;
> +       info->pages = device_info->pages;
>          info->identify = pmbus_identify;
>          dev->platform_data = pdata;
> 
>          return pmbus_do_probe(client, id, info);
>   }
> 
> +static const struct pmbus_device_info pmbus_info_one = {1, 0};
> +static const struct pmbus_device_info pmbus_info_zero = {0, 0};
> +static const struct pmbus_device_info pmbus_info_one_skip = {
> +                               1, PMBUS_SKIP_STATUS_CHECK};
>   /*
>    * Use driver_data to set the number of pages supported by the chip.
>    */
>   static const struct i2c_device_id pmbus_id[] = {
> -       {"adp4000", 1},
> -       {"bmr453", 1},
> -       {"bmr454", 1},
> -       {"dps460", 1},
> -       {"dps800", 1},
> -       {"mdt040", 1},
> -       {"ncp4200", 1},
> -       {"ncp4208", 1},
> -       {"pdt003", 1},
> -       {"pdt006", 1},
> -       {"pdt012", 1},
> -       {"pmbus", 0},
> -       {"sgd009", 1},
> -       {"tps40400", 1},
> -       {"tps544b20", 1},
> -       {"tps544b25", 1},
> -       {"tps544c20", 1},
> -       {"tps544c25", 1},
> -       {"udt020", 1},
> +       {"adp4000", (kernel_ulong_t)&pmbus_info_one},
> +       {"bmr453", (kernel_ulong_t)&pmbus_info_one},
> +       {"bmr454", (kernel_ulong_t)&pmbus_info_one},
> +       {"dps460", (kernel_ulong_t)&pmbus_info_one_skip},
> +       {"dps800", (kernel_ulong_t)&pmbus_info_one_skip},
> +       {"mdt040", (kernel_ulong_t)&pmbus_info_one},
> +       {"ncp4200", (kernel_ulong_t)&pmbus_info_one},
> +       {"ncp4208", (kernel_ulong_t)&pmbus_info_one},
> +       {"pdt003", (kernel_ulong_t)&pmbus_info_one},
> +       {"pdt006", (kernel_ulong_t)&pmbus_info_one},
> +       {"pdt012", (kernel_ulong_t)&pmbus_info_one},
> +       {"pmbus", (kernel_ulong_t)&pmbus_info_zero},
> +       {"sgd009", (kernel_ulong_t)&pmbus_info_one_skip},
> +       {"tps40400", (kernel_ulong_t)&pmbus_info_one},
> +       {"tps544b20", (kernel_ulong_t)&pmbus_info_one},
> +       {"tps544b25", (kernel_ulong_t)&pmbus_info_one},
> +       {"tps544c20", (kernel_ulong_t)&pmbus_info_one},
> +       {"tps544c25", (kernel_ulong_t)&pmbus_info_one},
> +       {"udt020", (kernel_ulong_t)&pmbus_info_one},
>          {}
>   };
> 
> --
> 1.8.3.1
> 
> 
> 
> 
> This email is intended only for the named addressee. It may contain information that is confidential/private, legally privileged, or copyright-protected, and you should handle it accordingly. If you are not the intended recipient, you do not have legal rights to retain, copy, or distribute this email or its contents, and should promptly delete the email and all electronic copies in your system; do not retain copies in any media. If you have received this email in error, please notify the sender promptly. Thank you.
> 

I think I mentioned that before. This legalese makes it all but impossible
for me to apply your patches.

Guenter



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

* Re: [PATCH v2 4/4] hwmon: (pmbus) add support for DPS-650AB
  2019-01-07 11:06 ` [PATCH v2 4/4] hwmon: (pmbus) add support for DPS-650AB Xiaoting Liu
@ 2019-01-07 14:04   ` Guenter Roeck
  2019-01-08  9:13     ` Liu, Xiaoting
  0 siblings, 1 reply; 9+ messages in thread
From: Guenter Roeck @ 2019-01-07 14:04 UTC (permalink / raw)
  To: Xiaoting Liu, jdelvare
  Cc: openbmc, linux-hwmon, linux-kernel, shunyong.yang, dongsheng.wang

On 1/7/19 3:06 AM, Xiaoting Liu wrote:
> Provide support for PSU DPS-650AB from Delta Electronics, INC.
> 

Where is patch 3/4 ?

> Signed-off-by: Xiaoting Liu <xiaoting.liu@hxt-semitech.com>
> ---
> v2:
>    Change the patch subject and commit message.
>    Drop dps650ab.c file.
>    Replace struct name dps650ab_pmbus_info with pmbus_info_one_skip.
> ---
>   drivers/hwmon/pmbus/pmbus.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
> index e38dd97cc49a..f6b35f858db8 100644
> --- a/drivers/hwmon/pmbus/pmbus.c
> +++ b/drivers/hwmon/pmbus/pmbus.c
> @@ -213,6 +213,7 @@ static int pmbus_probe(struct i2c_client *client,
>          {"bmr453", (kernel_ulong_t)&pmbus_info_one},
>          {"bmr454", (kernel_ulong_t)&pmbus_info_one},
>          {"dps460", (kernel_ulong_t)&pmbus_info_one_skip},
> +       {"dps650ab", (kernel_ulong_t)&pmbus_info_one_skip},
>          {"dps800", (kernel_ulong_t)&pmbus_info_one_skip},
>          {"mdt040", (kernel_ulong_t)&pmbus_info_one},
>          {"ncp4200", (kernel_ulong_t)&pmbus_info_one},
> --
> 1.8.3.1
> 
> 
> 
> 
> This email is intended only for the named addressee. It may contain information that is confidential/private, legally privileged, or copyright-protected, and you should handle it accordingly. If you are not the intended recipient, you do not have legal rights to retain, copy, or distribute this email or its contents, and should promptly delete the email and all electronic copies in your system; do not retain copies in any media. If you have received this email in error, please notify the sender promptly. Thank you.
> 
> 
> 


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

* RE: [PATCH v2 1/4] pmbus: associate PMBUS_SKIP_STATUS_CHECK with driver_data
  2019-01-07 14:04   ` Guenter Roeck
@ 2019-01-08  8:44     ` Liu, Xiaoting
  0 siblings, 0 replies; 9+ messages in thread
From: Liu, Xiaoting @ 2019-01-08  8:44 UTC (permalink / raw)
  To: Guenter Roeck, jdelvare
  Cc: openbmc, linux-hwmon, linux-kernel, Yang, Shunyong, Wang, Dongsheng

Hi Guenter Roeck,

Thanks for your reply.

-----Original Message-----
From: Guenter Roeck [mailto:groeck7@gmail.com] On Behalf Of Guenter Roeck
Sent: 2019年1月7日 22:04
To: Liu, Xiaoting <xiaoting.liu@hxt-semitech.com>; jdelvare@suse.com
Cc: openbmc@lists.ozlabs.org; linux-hwmon@vger.kernel.org; linux-kernel@vger.kernel.org; Yang, Shunyong <shunyong.yang@hxt-semitech.com>; Wang, Dongsheng <dongsheng.wang@hxt-semitech.com>
Subject: Re: [PATCH v2 1/4] pmbus: associate PMBUS_SKIP_STATUS_CHECK with driver_data

On 1/7/19 2:57 AM, Xiaoting Liu wrote:
> Current code compares device name with name in i2c_device_id to decide
> whether PMBUS_SKIP_STATUS_CHECK should be set in pmbus_platform_data,
> which makes adding new devices with PMBUS_SKIP_STATUS_CHECK should also
> modify code in pmbus_probe().
> 
> This patch adds pmbus_device_info to save pages and flags. Its pointer
> is put in driver_data of i2c_device_id, which makes adding new device
> more straightforward.
> 

> Signed-off-by: Shunyong Yang <shunyong.yang@hxt-semitech.com>
> Signed-off-by: Xiaoting Liu <xiaoting.liu@hxt-semitech.com>
> ---
> v2:
>    Move struct pmbus_device_info definition location from pmbus.h to pmbus.c.
>    Change struct name from default_pmbus_info to pmbus_info_one.
>    Change struct name from pmbus_info to pmbus_info_zero.
>    Replace struct name dps460_pmbus_info and sgd009_pmbus_info with
>    pmbus_info_one_skip.
> ---
>   drivers/hwmon/pmbus/pmbus.c | 55 +++++++++++++++++++++++++++------------------
>   1 file changed, 33 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
> index 7688dab32f6e..e38dd97cc49a 100644
> --- a/drivers/hwmon/pmbus/pmbus.c
> +++ b/drivers/hwmon/pmbus/pmbus.c
> @@ -28,6 +28,11 @@
>   #include <linux/pmbus.h>
>   #include "pmbus.h"
> 
> +struct pmbus_device_info {
> +       int pages;
> +       u32 flags;
> +};
> +
>   /*
>    * Find sensor groups and status registers on each page.
>    */
> @@ -172,13 +177,15 @@ static int pmbus_probe(struct i2c_client *client,
>          struct pmbus_driver_info *info;
>          struct pmbus_platform_data *pdata = NULL;
>          struct device *dev = &client->dev;
> +       struct pmbus_device_info *device_info;
> 
>          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")) {
> +       device_info = (struct pmbus_device_info *)id->driver_data;
> +

Please no empty line between assignments and checking its results.

Ok, we will remove the empty line.

> +       if (device_info->flags & PMBUS_SKIP_STATUS_CHECK) {
>                  pdata = devm_kzalloc(dev, sizeof(struct pmbus_platform_data),
>                                       GFP_KERNEL);
>                  if (!pdata)
> @@ -187,36 +194,40 @@ static int pmbus_probe(struct i2c_client *client,
>                  pdata->flags = PMBUS_SKIP_STATUS_CHECK;
>          }
> 
> -       info->pages = id->driver_data;
> +       info->pages = device_info->pages;
>          info->identify = pmbus_identify;
>          dev->platform_data = pdata;
> 
>          return pmbus_do_probe(client, id, info);
>   }
> 
> +static const struct pmbus_device_info pmbus_info_one = {1, 0};
> +static const struct pmbus_device_info pmbus_info_zero = {0, 0};
> +static const struct pmbus_device_info pmbus_info_one_skip = {
> +                               1, PMBUS_SKIP_STATUS_CHECK};
>   /*
>    * Use driver_data to set the number of pages supported by the chip.
>    */
>   static const struct i2c_device_id pmbus_id[] = {
> -       {"adp4000", 1},
> -       {"bmr453", 1},
> -       {"bmr454", 1},
> -       {"dps460", 1},
> -       {"dps800", 1},
> -       {"mdt040", 1},
> -       {"ncp4200", 1},
> -       {"ncp4208", 1},
> -       {"pdt003", 1},
> -       {"pdt006", 1},
> -       {"pdt012", 1},
> -       {"pmbus", 0},
> -       {"sgd009", 1},
> -       {"tps40400", 1},
> -       {"tps544b20", 1},
> -       {"tps544b25", 1},
> -       {"tps544c20", 1},
> -       {"tps544c25", 1},
> -       {"udt020", 1},
> +       {"adp4000", (kernel_ulong_t)&pmbus_info_one},
> +       {"bmr453", (kernel_ulong_t)&pmbus_info_one},
> +       {"bmr454", (kernel_ulong_t)&pmbus_info_one},
> +       {"dps460", (kernel_ulong_t)&pmbus_info_one_skip},
> +       {"dps800", (kernel_ulong_t)&pmbus_info_one_skip},
> +       {"mdt040", (kernel_ulong_t)&pmbus_info_one},
> +       {"ncp4200", (kernel_ulong_t)&pmbus_info_one},
> +       {"ncp4208", (kernel_ulong_t)&pmbus_info_one},
> +       {"pdt003", (kernel_ulong_t)&pmbus_info_one},
> +       {"pdt006", (kernel_ulong_t)&pmbus_info_one},
> +       {"pdt012", (kernel_ulong_t)&pmbus_info_one},
> +       {"pmbus", (kernel_ulong_t)&pmbus_info_zero},
> +       {"sgd009", (kernel_ulong_t)&pmbus_info_one_skip},
> +       {"tps40400", (kernel_ulong_t)&pmbus_info_one},
> +       {"tps544b20", (kernel_ulong_t)&pmbus_info_one},
> +       {"tps544b25", (kernel_ulong_t)&pmbus_info_one},
> +       {"tps544c20", (kernel_ulong_t)&pmbus_info_one},
> +       {"tps544c25", (kernel_ulong_t)&pmbus_info_one},
> +       {"udt020", (kernel_ulong_t)&pmbus_info_one},
>          {}
>   };
> 
> --
> 1.8.3.1
> 
> 
> 
> 
> This email is intended only for the named addressee. It may contain information that is confidential/private, legally privileged, or copyright-protected, and you should handle it accordingly. If you are not the intended recipient, you do not have legal rights to retain, copy, or distribute this email or its contents, and should promptly delete the email and all electronic copies in your system; do not retain copies in any media. If you have received this email in error, please notify the sender promptly. Thank you.
> 

I think I mentioned that before. This legalese makes it all but impossible
for me to apply your patches.

We will not show this message any more.

Thanks,
Xiaoting

Guenter



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

* Re: [PATCH v2 2/4] dt-bindings: hwmon: add dps650ab documentation
  2019-01-07 13:58   ` Guenter Roeck
@ 2019-01-08  8:57     ` Liu, Xiaoting
  0 siblings, 0 replies; 9+ messages in thread
From: Liu, Xiaoting @ 2019-01-08  8:57 UTC (permalink / raw)
  To: Guenter Roeck, jdelvare, robh+dt, mark.rutland, openbmc
  Cc: linux-hwmon, linux-kernel, devicetree, Yang, Shunyong, Wang, Dongsheng

On 2019/1/7 21:58, Guenter Roeck wrote:
> On 1/7/19 3:00 AM, Xiaoting Liu wrote:
>> Bindings for DPS650AB power, voltage, temperature, and fan monitering.
>>
>> Signed-off-by: Xiaoting Liu <xiaoting.liu@hxt-semitech.com>
>> ---
>> v2:
>>    Change the patch subject.
>> ---
>>   Documentation/devicetree/bindings/hwmon/dps650ab.txt | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/hwmon/dps650ab.txt b/Documentation/devicetree/bindings/hwmon/dps650ab.txt
>> new file mode 100644
>> index 000000000000..6bbbff89f6d5
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/hwmon/dps650ab.txt
>> @@ -0,0 +1,11 @@
>> +Bindings for DPS650AB power, voltage, temperature, and fan monitering
>> +
> Assuming this is the Delta Electronics DPS-650-AB power supply, I think
> you should mention that here.
I will update commit message as mentioned.
>
>> +Required properties:
>> +- compatible : "dps650ab"
> Again, assuming this is the Delta Electronics power supply, this should
> probably be something like "delta,dps650ab".

OK, I will add delta to compatible property.

Thanks,

Xiaoting

>
> Thanks,
> Guenter
>
>> +- reg       : I2C address, one of 0x58, 0x59.
>> +
>> +Example:
>> +       dps650ab@58 {
>> +                   compatible = "dps650ab";
>> +                   reg = <0x58>;
>> +       };
>> --
>> 1.8.3.1
>>
>>
>>
>>


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

* Re: [PATCH v2 4/4] hwmon: (pmbus) add support for DPS-650AB
  2019-01-07 14:04   ` Guenter Roeck
@ 2019-01-08  9:13     ` Liu, Xiaoting
  0 siblings, 0 replies; 9+ messages in thread
From: Liu, Xiaoting @ 2019-01-08  9:13 UTC (permalink / raw)
  To: Guenter Roeck, jdelvare
  Cc: openbmc, linux-hwmon, linux-kernel, Yang, Shunyong, Wang, Dongsheng

Hi Guenter Roeck,

Thanks for your reply.

On 2019/1/7 22:04, Guenter Roeck wrote:
> On 1/7/19 3:06 AM, Xiaoting Liu wrote:
>> Provide support for PSU DPS-650AB from Delta Electronics, INC.
>>
> Where is patch 3/4 ?

Sorry for forgetting to send patch 3/4 to you, please refer to the
following link,

https://lore.kernel.org/patchwork/patch/1029475/

Thanks,

Xiaoting

>> Signed-off-by: Xiaoting Liu <xiaoting.liu@hxt-semitech.com>
>> ---
>> v2:
>>    Change the patch subject and commit message.
>>    Drop dps650ab.c file.
>>    Replace struct name dps650ab_pmbus_info with pmbus_info_one_skip.
>> ---
>>   drivers/hwmon/pmbus/pmbus.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
>> index e38dd97cc49a..f6b35f858db8 100644
>> --- a/drivers/hwmon/pmbus/pmbus.c
>> +++ b/drivers/hwmon/pmbus/pmbus.c
>> @@ -213,6 +213,7 @@ static int pmbus_probe(struct i2c_client *client,
>>          {"bmr453", (kernel_ulong_t)&pmbus_info_one},
>>          {"bmr454", (kernel_ulong_t)&pmbus_info_one},
>>          {"dps460", (kernel_ulong_t)&pmbus_info_one_skip},
>> +       {"dps650ab", (kernel_ulong_t)&pmbus_info_one_skip},
>>          {"dps800", (kernel_ulong_t)&pmbus_info_one_skip},
>>          {"mdt040", (kernel_ulong_t)&pmbus_info_one},
>>          {"ncp4200", (kernel_ulong_t)&pmbus_info_one},
>> --
>> 1.8.3.1
>>
>>
>>
>


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

end of thread, other threads:[~2019-01-08  9:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1546851856.git.xiaoting.liu@hxt-semitech.com>
2019-01-07 10:57 ` [PATCH v2 1/4] pmbus: associate PMBUS_SKIP_STATUS_CHECK with driver_data Xiaoting Liu
2019-01-07 14:04   ` Guenter Roeck
2019-01-08  8:44     ` Liu, Xiaoting
2019-01-07 11:00 ` [PATCH v2 2/4] dt-bindings: hwmon: add dps650ab documentation Xiaoting Liu
2019-01-07 13:58   ` Guenter Roeck
2019-01-08  8:57     ` Liu, Xiaoting
2019-01-07 11:06 ` [PATCH v2 4/4] hwmon: (pmbus) add support for DPS-650AB Xiaoting Liu
2019-01-07 14:04   ` Guenter Roeck
2019-01-08  9:13     ` Liu, Xiaoting

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).