From: Brandon Wyman <bjwyman@gmail.com>
To: Joel Stanley <joel@jms.id.au>,
openbmc@lists.ozlabs.org, Guenter Roeck <linux@roeck-us.net>,
Jean Delvare <jdelvare@suse.com>,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
Eddie James <eajames@linux.ibm.com>
Cc: Brandon Wyman <bjwyman@gmail.com>
Subject: [PATCH 2/2] hwmon: (pmbus/ibm-cffps) Use MFR_ID to choose version
Date: Mon, 4 Oct 2021 14:43:39 +0000 [thread overview]
Message-ID: <20211004144339.2634330-2-bjwyman@gmail.com> (raw)
In-Reply-To: <20211004144339.2634330-1-bjwyman@gmail.com>
There are multiple power supplies that will indicate
CFFPS_CCIN_VERSION_1, use the manufacturer ID to determine if it should
be treated as version cffps1 or version cffps2.
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
---
drivers/hwmon/pmbus/ibm-cffps.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c
index 2ee47cbbb665..292c87331f2b 100644
--- a/drivers/hwmon/pmbus/ibm-cffps.c
+++ b/drivers/hwmon/pmbus/ibm-cffps.c
@@ -502,16 +502,29 @@ static int ibm_cffps_probe(struct i2c_client *client)
u16 ccin_revision = 0;
u16 ccin_version = CFFPS_CCIN_VERSION_1;
int ccin = i2c_smbus_read_word_swapped(client, CFFPS_CCIN_CMD);
+ char mfg_id[I2C_SMBUS_BLOCK_MAX + 2] = { 0 };
if (ccin > 0) {
ccin_revision = FIELD_GET(CFFPS_CCIN_REVISION, ccin);
ccin_version = FIELD_GET(CFFPS_CCIN_VERSION, ccin);
}
+ rc = i2c_smbus_read_block_data(client, PMBUS_MFR_ID,
+ mfg_id);
+ if (rc < 0) {
+ dev_err(&client->dev,
+ "Failed to read Manufacturer ID\n");
+ return rc;
+ }
+
switch (ccin_version) {
default:
case CFFPS_CCIN_VERSION_1:
- vs = cffps1;
+ if ((strncmp(mfg_id, "ACBE", 4) == 0) ||
+ (strncmp(mfg_id, "ARTE", 4) == 0))
+ vs = cffps1;
+ else
+ vs = cffps2;
break;
case CFFPS_CCIN_VERSION_2:
vs = cffps2;
--
2.25.1
next prev parent reply other threads:[~2021-10-04 14:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-04 14:43 [PATCH 1/2] hwmon: (pmbus/ibm-cffps) Add mfg_id debugfs entry Brandon Wyman
2021-10-04 14:43 ` Brandon Wyman [this message]
2021-10-08 14:12 ` [PATCH 2/2] hwmon: (pmbus/ibm-cffps) Use MFR_ID to choose version Guenter Roeck
2021-10-08 14:10 ` [PATCH 1/2] hwmon: (pmbus/ibm-cffps) Add mfg_id debugfs entry Guenter Roeck
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=20211004144339.2634330-2-bjwyman@gmail.com \
--to=bjwyman@gmail.com \
--cc=eajames@linux.ibm.com \
--cc=jdelvare@suse.com \
--cc=joel@jms.id.au \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=openbmc@lists.ozlabs.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
all inboxes | Powered by JetHome®