hwmon: (pmbus) Detect if chip is write protected

If a chip is write protected, we can not change any limits, and we can
not clear status flags. This may be the reason why clearing status flags
is reported to not work for some chips. Detect the condition in the pmbus
core. If the chip is write protected, set limit attributes as read-only,
and set the flag indicating that the status flag should be ignored.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Guenter Roeck
2019-12-12 09:14:34 -08:00
parent d21ed22ba7
commit 9e347728c4
3 changed files with 33 additions and 1 deletions

View File

@@ -8,6 +8,8 @@
#ifndef _PMBUS_H_
#define _PMBUS_H_
#include <linux/bits.h>
/* flags */
/*
@@ -23,7 +25,14 @@
* communication errors for no explicable reason. For such chips, checking
* the status register must be disabled.
*/
#define PMBUS_SKIP_STATUS_CHECK (1 << 0)
#define PMBUS_SKIP_STATUS_CHECK BIT(0)
/*
* PMBUS_WRITE_PROTECTED
* Set if the chip is write protected and write protection is not determined
* by the standard WRITE_PROTECT command.
*/
#define PMBUS_WRITE_PROTECTED BIT(1)
struct pmbus_platform_data {
u32 flags; /* Device specific flags */