All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: (pmbus) delta-ahe50dc-fan: work around hardware quirk
@ 2022-04-27  3:51 ` Zev Weiss
  0 siblings, 0 replies; 4+ messages in thread
From: Zev Weiss @ 2022-04-27  3:51 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare, linux-hwmon
  Cc: linux-kernel, openbmc, Zev Weiss, stable

CLEAR_FAULTS commands can apparently sometimes trigger catastrophic
power output glitches on the ahe-50dc, so block them from being sent
at all.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Cc: stable@vger.kernel.org
---
 drivers/hwmon/pmbus/delta-ahe50dc-fan.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/hwmon/pmbus/delta-ahe50dc-fan.c b/drivers/hwmon/pmbus/delta-ahe50dc-fan.c
index 40dffd9c4cbf..f546f0c12497 100644
--- a/drivers/hwmon/pmbus/delta-ahe50dc-fan.c
+++ b/drivers/hwmon/pmbus/delta-ahe50dc-fan.c
@@ -14,6 +14,21 @@
 
 #define AHE50DC_PMBUS_READ_TEMP4 0xd0
 
+static int ahe50dc_fan_write_byte(struct i2c_client *client, int page, u8 value)
+{
+	/*
+	 * The CLEAR_FAULTS operation seems to sometimes (unpredictably, perhaps
+	 * 5% of the time or so) trigger a problematic phenomenon in which the
+	 * fan speeds surge momentarily and at least some (perhaps all?) of the
+	 * system's power outputs experience a glitch.
+	 *
+	 * However, according to Delta it should be OK to simply not send any
+	 * CLEAR_FAULTS commands (the device doesn't seem to be capable of
+	 * reporting any faults anyway), so just blackhole them unconditionally.
+	 */
+	return value == PMBUS_CLEAR_FAULTS ? -EOPNOTSUPP : -ENODATA;
+}
+
 static int ahe50dc_fan_read_word_data(struct i2c_client *client, int page, int phase, int reg)
 {
 	/* temp1 in (virtual) page 1 is remapped to mfr-specific temp4 */
@@ -68,6 +83,7 @@ static struct pmbus_driver_info ahe50dc_fan_info = {
 		PMBUS_HAVE_VIN | PMBUS_HAVE_FAN12 | PMBUS_HAVE_FAN34 |
 		PMBUS_HAVE_STATUS_FAN12 | PMBUS_HAVE_STATUS_FAN34 | PMBUS_PAGE_VIRTUAL,
 	.func[1] = PMBUS_HAVE_TEMP | PMBUS_PAGE_VIRTUAL,
+	.write_byte = ahe50dc_fan_write_byte,
 	.read_word_data = ahe50dc_fan_read_word_data,
 };
 
-- 
2.36.0


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

* [PATCH] hwmon: (pmbus) delta-ahe50dc-fan: work around hardware quirk
@ 2022-04-27  3:51 ` Zev Weiss
  0 siblings, 0 replies; 4+ messages in thread
From: Zev Weiss @ 2022-04-27  3:51 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare, linux-hwmon
  Cc: stable, openbmc, linux-kernel, Zev Weiss

CLEAR_FAULTS commands can apparently sometimes trigger catastrophic
power output glitches on the ahe-50dc, so block them from being sent
at all.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Cc: stable@vger.kernel.org
---
 drivers/hwmon/pmbus/delta-ahe50dc-fan.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/hwmon/pmbus/delta-ahe50dc-fan.c b/drivers/hwmon/pmbus/delta-ahe50dc-fan.c
index 40dffd9c4cbf..f546f0c12497 100644
--- a/drivers/hwmon/pmbus/delta-ahe50dc-fan.c
+++ b/drivers/hwmon/pmbus/delta-ahe50dc-fan.c
@@ -14,6 +14,21 @@
 
 #define AHE50DC_PMBUS_READ_TEMP4 0xd0
 
+static int ahe50dc_fan_write_byte(struct i2c_client *client, int page, u8 value)
+{
+	/*
+	 * The CLEAR_FAULTS operation seems to sometimes (unpredictably, perhaps
+	 * 5% of the time or so) trigger a problematic phenomenon in which the
+	 * fan speeds surge momentarily and at least some (perhaps all?) of the
+	 * system's power outputs experience a glitch.
+	 *
+	 * However, according to Delta it should be OK to simply not send any
+	 * CLEAR_FAULTS commands (the device doesn't seem to be capable of
+	 * reporting any faults anyway), so just blackhole them unconditionally.
+	 */
+	return value == PMBUS_CLEAR_FAULTS ? -EOPNOTSUPP : -ENODATA;
+}
+
 static int ahe50dc_fan_read_word_data(struct i2c_client *client, int page, int phase, int reg)
 {
 	/* temp1 in (virtual) page 1 is remapped to mfr-specific temp4 */
@@ -68,6 +83,7 @@ static struct pmbus_driver_info ahe50dc_fan_info = {
 		PMBUS_HAVE_VIN | PMBUS_HAVE_FAN12 | PMBUS_HAVE_FAN34 |
 		PMBUS_HAVE_STATUS_FAN12 | PMBUS_HAVE_STATUS_FAN34 | PMBUS_PAGE_VIRTUAL,
 	.func[1] = PMBUS_HAVE_TEMP | PMBUS_PAGE_VIRTUAL,
+	.write_byte = ahe50dc_fan_write_byte,
 	.read_word_data = ahe50dc_fan_read_word_data,
 };
 
-- 
2.36.0


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

* Re: [PATCH] hwmon: (pmbus) delta-ahe50dc-fan: work around hardware quirk
  2022-04-27  3:51 ` Zev Weiss
@ 2022-04-27 11:53   ` Guenter Roeck
  -1 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2022-04-27 11:53 UTC (permalink / raw)
  To: Zev Weiss; +Cc: Jean Delvare, linux-hwmon, linux-kernel, openbmc

On Tue, Apr 26, 2022 at 08:51:09PM -0700, Zev Weiss wrote:
> CLEAR_FAULTS commands can apparently sometimes trigger catastrophic
> power output glitches on the ahe-50dc, so block them from being sent
> at all.
> 
> Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
> Cc: stable@vger.kernel.org

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/pmbus/delta-ahe50dc-fan.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/hwmon/pmbus/delta-ahe50dc-fan.c b/drivers/hwmon/pmbus/delta-ahe50dc-fan.c
> index 40dffd9c4cbf..f546f0c12497 100644
> --- a/drivers/hwmon/pmbus/delta-ahe50dc-fan.c
> +++ b/drivers/hwmon/pmbus/delta-ahe50dc-fan.c
> @@ -14,6 +14,21 @@
>  
>  #define AHE50DC_PMBUS_READ_TEMP4 0xd0
>  
> +static int ahe50dc_fan_write_byte(struct i2c_client *client, int page, u8 value)
> +{
> +	/*
> +	 * The CLEAR_FAULTS operation seems to sometimes (unpredictably, perhaps
> +	 * 5% of the time or so) trigger a problematic phenomenon in which the
> +	 * fan speeds surge momentarily and at least some (perhaps all?) of the
> +	 * system's power outputs experience a glitch.
> +	 *
> +	 * However, according to Delta it should be OK to simply not send any
> +	 * CLEAR_FAULTS commands (the device doesn't seem to be capable of
> +	 * reporting any faults anyway), so just blackhole them unconditionally.
> +	 */
> +	return value == PMBUS_CLEAR_FAULTS ? -EOPNOTSUPP : -ENODATA;
> +}
> +
>  static int ahe50dc_fan_read_word_data(struct i2c_client *client, int page, int phase, int reg)
>  {
>  	/* temp1 in (virtual) page 1 is remapped to mfr-specific temp4 */
> @@ -68,6 +83,7 @@ static struct pmbus_driver_info ahe50dc_fan_info = {
>  		PMBUS_HAVE_VIN | PMBUS_HAVE_FAN12 | PMBUS_HAVE_FAN34 |
>  		PMBUS_HAVE_STATUS_FAN12 | PMBUS_HAVE_STATUS_FAN34 | PMBUS_PAGE_VIRTUAL,
>  	.func[1] = PMBUS_HAVE_TEMP | PMBUS_PAGE_VIRTUAL,
> +	.write_byte = ahe50dc_fan_write_byte,
>  	.read_word_data = ahe50dc_fan_read_word_data,
>  };
>  

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

* Re: [PATCH] hwmon: (pmbus) delta-ahe50dc-fan: work around hardware quirk
@ 2022-04-27 11:53   ` Guenter Roeck
  0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2022-04-27 11:53 UTC (permalink / raw)
  To: Zev Weiss; +Cc: linux-hwmon, openbmc, Jean Delvare, linux-kernel

On Tue, Apr 26, 2022 at 08:51:09PM -0700, Zev Weiss wrote:
> CLEAR_FAULTS commands can apparently sometimes trigger catastrophic
> power output glitches on the ahe-50dc, so block them from being sent
> at all.
> 
> Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
> Cc: stable@vger.kernel.org

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/pmbus/delta-ahe50dc-fan.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/hwmon/pmbus/delta-ahe50dc-fan.c b/drivers/hwmon/pmbus/delta-ahe50dc-fan.c
> index 40dffd9c4cbf..f546f0c12497 100644
> --- a/drivers/hwmon/pmbus/delta-ahe50dc-fan.c
> +++ b/drivers/hwmon/pmbus/delta-ahe50dc-fan.c
> @@ -14,6 +14,21 @@
>  
>  #define AHE50DC_PMBUS_READ_TEMP4 0xd0
>  
> +static int ahe50dc_fan_write_byte(struct i2c_client *client, int page, u8 value)
> +{
> +	/*
> +	 * The CLEAR_FAULTS operation seems to sometimes (unpredictably, perhaps
> +	 * 5% of the time or so) trigger a problematic phenomenon in which the
> +	 * fan speeds surge momentarily and at least some (perhaps all?) of the
> +	 * system's power outputs experience a glitch.
> +	 *
> +	 * However, according to Delta it should be OK to simply not send any
> +	 * CLEAR_FAULTS commands (the device doesn't seem to be capable of
> +	 * reporting any faults anyway), so just blackhole them unconditionally.
> +	 */
> +	return value == PMBUS_CLEAR_FAULTS ? -EOPNOTSUPP : -ENODATA;
> +}
> +
>  static int ahe50dc_fan_read_word_data(struct i2c_client *client, int page, int phase, int reg)
>  {
>  	/* temp1 in (virtual) page 1 is remapped to mfr-specific temp4 */
> @@ -68,6 +83,7 @@ static struct pmbus_driver_info ahe50dc_fan_info = {
>  		PMBUS_HAVE_VIN | PMBUS_HAVE_FAN12 | PMBUS_HAVE_FAN34 |
>  		PMBUS_HAVE_STATUS_FAN12 | PMBUS_HAVE_STATUS_FAN34 | PMBUS_PAGE_VIRTUAL,
>  	.func[1] = PMBUS_HAVE_TEMP | PMBUS_PAGE_VIRTUAL,
> +	.write_byte = ahe50dc_fan_write_byte,
>  	.read_word_data = ahe50dc_fan_read_word_data,
>  };
>  

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

end of thread, other threads:[~2022-04-27 11:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-27  3:51 [PATCH] hwmon: (pmbus) delta-ahe50dc-fan: work around hardware quirk Zev Weiss
2022-04-27  3:51 ` Zev Weiss
2022-04-27 11:53 ` Guenter Roeck
2022-04-27 11:53   ` 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.