* [lm-sensors] [PATCH]: hwmon: (pmbus) Detect temperature sensors on all pages
@ 2014-06-17 7:16 Zhu, Richard (NSN - CN/Beijing)
2014-06-17 10:34 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Zhu, Richard (NSN - CN/Beijing) @ 2014-06-17 7:16 UTC (permalink / raw)
To: lm-sensors
Hi All,
When I was trouble shooting the TI power manager chip TPS40422, I found that the kernel pmbus driver (pmbus.c) was not trying to detect the temperature sensors other than page 0 for pmbus devices, so the temp2_input file couldn't be seen in sysfs. So I made a patch file to trying to solve the problem. Please help to review my findings, and to see if the patch can go to the upstream.
The following content is the content of the patch file:
[PATCH]: hwmon: (pmbus) Detect temperature sensors on all pages
For TI power management chip TPS40422, READ_TEMPERATURE_2 command is supported on
page 1 of the chip, but the original driver only tried to detect this command on
page 0, this will lead to a result that the temperature sensor in page 1 couldn't
be detected. This change is finding the temperature sensors on all pages to solve
the problem.
Signed-off-by: Zhu Laiwen <richard.zhu@nsn.com>
--- a/drivers/hwmon/pmbus/pmbus.c 2013-07-01 00:13:29.000000000 +0200
+++ b/drivers/hwmon/pmbus/pmbus.c 2014-06-16 05:26:28.388304000 +0200
@@ -59,20 +59,19 @@ static void pmbus_find_sensor_groups(str
if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_34))
info->func[0] |= PMBUS_HAVE_STATUS_FAN34;
}
- if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1))
- info->func[0] |= PMBUS_HAVE_TEMP;
- if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_2))
- info->func[0] |= PMBUS_HAVE_TEMP2;
- if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3))
- info->func[0] |= PMBUS_HAVE_TEMP3;
- if (info->func[0] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2
- | PMBUS_HAVE_TEMP3)
- && pmbus_check_byte_register(client, 0,
- PMBUS_STATUS_TEMPERATURE))
- info->func[0] |= PMBUS_HAVE_STATUS_TEMP;
-
/* Sensors detected on all pages */
for (page = 0; page < info->pages; page++) {
+ if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1))
+ info->func[page] |= PMBUS_HAVE_TEMP;
+ if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_2))
+ info->func[page] |= PMBUS_HAVE_TEMP2;
+ if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3))
+ info->func[page] |= PMBUS_HAVE_TEMP3;
+ if (info->func[page] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2
+ | PMBUS_HAVE_TEMP3)
+ && pmbus_check_byte_register(client, 0,
+ PMBUS_STATUS_TEMPERATURE))
+ info->func[page] |= PMBUS_HAVE_STATUS_TEMP;
if (pmbus_check_word_register(client, page, PMBUS_READ_VOUT)) {
info->func[page] |= PMBUS_HAVE_VOUT;
if (pmbus_check_byte_register(client, page,
Regards,
Richard
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [lm-sensors] [PATCH]: hwmon: (pmbus) Detect temperature sensors on all pages
2014-06-17 7:16 [lm-sensors] [PATCH]: hwmon: (pmbus) Detect temperature sensors on all pages Zhu, Richard (NSN - CN/Beijing)
@ 2014-06-17 10:34 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2014-06-17 10:34 UTC (permalink / raw)
To: lm-sensors
On 06/17/2014 12:16 AM, Zhu, Richard (NSN - CN/Beijing) wrote:
> Hi All,
>
> When I was trouble shooting the TI power manager chip TPS40422, I found that the kernel pmbus driver (pmbus.c) was not trying to detect the temperature sensors other than page 0 for pmbus devices, so the temp2_input file couldn't be seen in sysfs. So I made a patch file to trying to solve the problem. Please help to review my findings, and to see if the patch can go to the upstream.
>
>
> The following content is the content of the patch file:
> [PATCH]: hwmon: (pmbus) Detect temperature sensors on all pages
>
> For TI power management chip TPS40422, READ_TEMPERATURE_2 command is supported on
> page 1 of the chip, but the original driver only tried to detect this command on
> page 0, this will lead to a result that the temperature sensor in page 1 couldn't
> be detected. This change is finding the temperature sensors on all pages to solve
> the problem.
>
Problem is that many pmbus devices don't implement paged temperature sensors.
While this works for the TPS40422, it would result in duplicate detection for
many other chips with unpaged sensors. Which means we'll need a separate front-end
driver for this chip.
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-17 10:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-17 7:16 [lm-sensors] [PATCH]: hwmon: (pmbus) Detect temperature sensors on all pages Zhu, Richard (NSN - CN/Beijing)
2014-06-17 10:34 ` 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.