[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20211008141235.GA2044602@roeck-us.net>
Date: Fri, 8 Oct 2021 07:12:35 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Brandon Wyman <bjwyman@...il.com>
Cc: Joel Stanley <joel@....id.au>, openbmc@...ts.ozlabs.org,
Jean Delvare <jdelvare@...e.com>, linux-hwmon@...r.kernel.org,
linux-kernel@...r.kernel.org, Eddie James <eajames@...ux.ibm.com>
Subject: Re: [PATCH 2/2] hwmon: (pmbus/ibm-cffps) Use MFR_ID to choose version
On Mon, Oct 04, 2021 at 02:43:39PM +0000, Brandon Wyman wrote:
> 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@...il.com>
Applied, after fixing continnuation line alignments.
Guenter
> ---
> 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;
Powered by blists - more mailing lists