linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Enable adm1272 temperature reporting
@ 2021-05-12 17:04 Chu Lin
  2021-05-12 17:07 ` Chu Lin
  0 siblings, 1 reply; 2+ messages in thread
From: Chu Lin @ 2021-05-12 17:04 UTC (permalink / raw)
  To: linchuyuan, jasonling, zhongqil, linux, jdelvare, linux-hwmon,
	linux-kernel
  Cc: Chu Lin

adm1272 supports temperature reporting but it is disabled by default.

Tested:
ls temp1_*
temp1_crit           temp1_highest        temp1_max
temp1_crit_alarm     temp1_input          temp1_max_alarm

cat temp1_input
26642

Signed-off-by: Chu Lin <linchuyuan@google.com>
---
 drivers/hwmon/pmbus/adm1275.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c
index e7997f37b266..0be1b5777d2f 100644
--- a/drivers/hwmon/pmbus/adm1275.c
+++ b/drivers/hwmon/pmbus/adm1275.c
@@ -611,11 +611,13 @@ static int adm1275_probe(struct i2c_client *client)
 		tindex = 8;
 
 		info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT |
-			PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
+			PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
+			PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
 
-		/* Enable VOUT if not enabled (it is disabled by default) */
-		if (!(config & ADM1278_VOUT_EN)) {
-			config |= ADM1278_VOUT_EN;
+		/* Enable VOUT & TEMP1 if not enabled (disabled by default) */
+		if ((config & (ADM1278_VOUT_EN | ADM1278_TEMP1_EN)) !=
+		    (ADM1278_VOUT_EN | ADM1278_TEMP1_EN)) {
+			config |= ADM1278_VOUT_EN | ADM1278_TEMP1_EN;
 			ret = i2c_smbus_write_byte_data(client,
 							ADM1275_PMON_CONFIG,
 							config);
@@ -625,10 +627,6 @@ static int adm1275_probe(struct i2c_client *client)
 				return -ENODEV;
 			}
 		}
-
-		if (config & ADM1278_TEMP1_EN)
-			info->func[0] |=
-				PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
 		if (config & ADM1278_VIN_EN)
 			info->func[0] |= PMBUS_HAVE_VIN;
 		break;
-- 
2.31.1.607.g51e8a6a459-goog


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

* Re: [PATCH] Enable adm1272 temperature reporting
  2021-05-12 17:04 [PATCH] Enable adm1272 temperature reporting Chu Lin
@ 2021-05-12 17:07 ` Chu Lin
  0 siblings, 0 replies; 2+ messages in thread
From: Chu Lin @ 2021-05-12 17:07 UTC (permalink / raw)
  To: linchuyuan, Jason Ling, Zhongqi Li, Guenter Roeck, jdelvare,
	linux-hwmon, linux-kernel

Please discard this one.
Sent by error.

Thanks,
Chu

On Wed, May 12, 2021 at 10:04 AM Chu Lin <linchuyuan@google.com> wrote:
>
> adm1272 supports temperature reporting but it is disabled by default.
>
> Tested:
> ls temp1_*
> temp1_crit           temp1_highest        temp1_max
> temp1_crit_alarm     temp1_input          temp1_max_alarm
>
> cat temp1_input
> 26642
>
> Signed-off-by: Chu Lin <linchuyuan@google.com>
> ---
>  drivers/hwmon/pmbus/adm1275.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c
> index e7997f37b266..0be1b5777d2f 100644
> --- a/drivers/hwmon/pmbus/adm1275.c
> +++ b/drivers/hwmon/pmbus/adm1275.c
> @@ -611,11 +611,13 @@ static int adm1275_probe(struct i2c_client *client)
>                 tindex = 8;
>
>                 info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT |
> -                       PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
> +                       PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
> +                       PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
>
> -               /* Enable VOUT if not enabled (it is disabled by default) */
> -               if (!(config & ADM1278_VOUT_EN)) {
> -                       config |= ADM1278_VOUT_EN;
> +               /* Enable VOUT & TEMP1 if not enabled (disabled by default) */
> +               if ((config & (ADM1278_VOUT_EN | ADM1278_TEMP1_EN)) !=
> +                   (ADM1278_VOUT_EN | ADM1278_TEMP1_EN)) {
> +                       config |= ADM1278_VOUT_EN | ADM1278_TEMP1_EN;
>                         ret = i2c_smbus_write_byte_data(client,
>                                                         ADM1275_PMON_CONFIG,
>                                                         config);
> @@ -625,10 +627,6 @@ static int adm1275_probe(struct i2c_client *client)
>                                 return -ENODEV;
>                         }
>                 }
> -
> -               if (config & ADM1278_TEMP1_EN)
> -                       info->func[0] |=
> -                               PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
>                 if (config & ADM1278_VIN_EN)
>                         info->func[0] |= PMBUS_HAVE_VIN;
>                 break;
> --
> 2.31.1.607.g51e8a6a459-goog
>

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

end of thread, other threads:[~2021-05-12 19:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 17:04 [PATCH] Enable adm1272 temperature reporting Chu Lin
2021-05-12 17:07 ` Chu Lin

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