Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	 Jonathan Corbet <corbet@lwn.net>,
	 Patrick Rudolph <patrick.rudolph@9elements.com>,
	 Naresh Solanki <naresh.solanki@9elements.com>,
	 Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Jerome Brunet <jbrunet@baylibre.com>,
	 Delphine CC Chiu <Delphine_CC_Chiu@Wiwynn.com>
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-doc@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-i2c@vger.kernel.org
Subject: [PATCH v3 4/6] hwmon: (pmbus/core) clear faults after setting smbalert mask
Date: Thu, 24 Oct 2024 20:10:38 +0200	[thread overview]
Message-ID: <20241024-tps25990-v3-4-b6a6e9d4b506@baylibre.com> (raw)
In-Reply-To: <20241024-tps25990-v3-0-b6a6e9d4b506@baylibre.com>

pmbus_write_smbalert_mask() ignores the errors if the chip can't set
smbalert mask the standard way. It is not necessarily a problem for the irq
support if the chip is otherwise properly setup but it may leave an
uncleared fault behind.

pmbus_core will pick the fault on the next register_check(). The register
check will fails regardless of the actual register support by the chip.

This leads to missing attributes or debugfs entries for chips that should
provide them.

We cannot rely on register_check() as PMBUS_SMBALERT_MASK may be read-only.

Unconditionally clear the page fault after setting PMBUS_SMBALERT_MASK to
avoid the problem.

Suggested-by: Guenter Roeck <linux@roeck-us.net>
Fixes: 221819ca4c36 ("hwmon: (pmbus/core) Add interrupt support")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 drivers/hwmon/pmbus/pmbus_core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index ce697ca03de01c0e5a352f8f6b72671137721868..a0a397d571caa1a6620ef095f9cf63d94e8bda1d 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -3346,7 +3346,12 @@ static int pmbus_regulator_notify(struct pmbus_data *data, int page, int event)
 
 static int pmbus_write_smbalert_mask(struct i2c_client *client, u8 page, u8 reg, u8 val)
 {
-	return _pmbus_write_word_data(client, page, PMBUS_SMBALERT_MASK, reg | (val << 8));
+	int ret;
+
+	ret = _pmbus_write_word_data(client, page, PMBUS_SMBALERT_MASK, reg | (val << 8));
+	pmbus_clear_fault_page(client, -1);
+
+	return ret;
 }
 
 static irqreturn_t pmbus_fault_handler(int irq, void *pdata)

-- 
2.45.2


  parent reply	other threads:[~2024-10-24 18:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24 18:10 [PATCH v3 0/6] hwmon: pmbus: add tps25990 efuse support Jerome Brunet
2024-10-24 18:10 ` [PATCH v3 1/6] hwmon: (pmbus/core) allow drivers to override WRITE_PROTECT Jerome Brunet
2024-10-24 18:10 ` [PATCH v3 2/6] hwmon: (pmbus/core) improve handling of write protected regulators Jerome Brunet
2024-11-01 14:59   ` Guenter Roeck
2024-10-24 18:10 ` [PATCH v3 3/6] hwmon: (pmbus/core) add wp module param Jerome Brunet
2024-11-01 15:08   ` Guenter Roeck
2024-11-04  8:43     ` Jerome Brunet
2024-11-04 13:57       ` Guenter Roeck
2024-11-04 14:18       ` Guenter Roeck
2024-11-04 14:39         ` Jerome Brunet
2024-11-04 15:08           ` Guenter Roeck
2024-10-24 18:10 ` Jerome Brunet [this message]
2024-11-01 15:10   ` [PATCH v3 4/6] hwmon: (pmbus/core) clear faults after setting smbalert mask Guenter Roeck
2024-11-04  8:28     ` Jerome Brunet
2024-11-04 13:51       ` Guenter Roeck
2024-10-24 18:10 ` [PATCH v3 5/6] dt-bindings: hwmon: pmbus: add ti tps25990 support Jerome Brunet
2024-10-24 18:10 ` [PATCH v3 6/6] hwmon: (pmbus/tps25990): add initial support Jerome Brunet
2024-10-25 14:04   ` kernel test robot
2024-10-29 13:49   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241024-tps25990-v3-4-b6a6e9d4b506@baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=Delphine_CC_Chiu@Wiwynn.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=naresh.solanki@9elements.com \
    --cc=patrick.rudolph@9elements.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox