Quanta patch to recognize emerson power supplied. I'd prefer this to be done more generically.

This commit is contained in:
Jeffrey Townsend
2017-01-07 18:09:24 +00:00
parent 6db6880d48
commit 439028f14d
2 changed files with 47 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
diff -urpN a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
--- a/drivers/hwmon/pmbus/pmbus_core.c 2017-01-07 00:56:44.908974275 +0000
+++ b/drivers/hwmon/pmbus/pmbus_core.c 2017-01-07 01:02:17.176981485 +0000
@@ -1680,6 +1680,21 @@ static int pmbus_identify_common(struct
return 0;
}
+static int pmbus_emer_detect(struct i2c_client *client)
+{
+ struct device *dev = &client->dev;
+ u8 value[4];
+
+ if(i2c_smbus_read_block_data(client, PMBUS_MFR_ID, value) > 0
+ && memcmp(value, "EMER", 4) == 0) {
+ dev_info(dev, "EMER detected\n");
+ return 0;
+ }
+
+ return -ENODEV;
+}
+
+
static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
struct pmbus_driver_info *info)
{
@@ -1697,8 +1712,18 @@ static int pmbus_init_common(struct i2c_
data->status_register = PMBUS_STATUS_WORD;
ret = i2c_smbus_read_word_data(client, PMBUS_STATUS_WORD);
if (ret < 0 || ret == 0xffff) {
- dev_err(dev, "PMBus status register not found\n");
- return -ENODEV;
+ if(pmbus_emer_detect(client) == 0) {
+ data->status_register = PMBUS_STATUS_MFR_SPECIFIC;
+ ret = i2c_smbus_read_byte_data(client, PMBUS_STATUS_MFR_SPECIFIC);
+ if (ret < 0 || ret == 0xff) {
+ dev_err(dev, "PMBus status register not found\n");
+ return -ENODEV;
+ }
+ }
+ else {
+ dev_err(dev, "PMBus status register not found\n");
+ return -ENODEV;
+ }
}
}

View File

@@ -19,3 +19,4 @@ drivers-i2c-muxes-pca954x-deselect-on-exit.patch
driver-early-dma-allocator.patch
driver-esdhc-p2020-broken-timeout.patch
drivers-gpio-config-arch-nr-gpios.patch
driver-hwmon-emerson-update-pmbus-core.patch