]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
hwmon: (pmbus/lm25066) Ignore byte writes to non-zero pages
authorGuenter Roeck <guenter.roeck@ericsson.com>
Sat, 30 Jul 2011 06:05:25 +0000 (23:05 -0700)
committerGuenter Roeck <guenter.roeck@ericsson.com>
Thu, 11 Aug 2011 17:14:12 +0000 (10:14 -0700)
pmbus_clear_faults() attempts to clear faults on non-existing real pages.
As a result, the command error bit in the status register is set, and faults
are not really cleared.

All byte writes to non-zero pages are requests to clear the status register
on that page. Since non-zero pages are virtual and do not exist on the chip,
there is nothing to do, and such requests have to be ignored. This fixes
above problem.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
drivers/hwmon/pmbus/lm25066.c

index d4bc114572de2d8232497d394204c1cfc0e28d10..ac254fba551b21cc30b4a8276683cb85ab57ea67 100644 (file)
@@ -161,6 +161,17 @@ static int lm25066_write_word_data(struct i2c_client *client, int page, int reg,
        return ret;
 }
 
+static int lm25066_write_byte(struct i2c_client *client, int page, u8 value)
+{
+       if (page > 1)
+               return -EINVAL;
+
+       if (page == 0)
+               return pmbus_write_byte(client, 0, value);
+
+       return 0;
+}
+
 static int lm25066_probe(struct i2c_client *client,
                          const struct i2c_device_id *id)
 {
@@ -204,6 +215,7 @@ static int lm25066_probe(struct i2c_client *client,
 
        info->read_word_data = lm25066_read_word_data;
        info->write_word_data = lm25066_write_word_data;
+       info->write_byte = lm25066_write_byte;
 
        switch (id->driver_data) {
        case lm25066: