diff options
author | Stijn Tintel <stijn@linux-ipv6.be> | 2016-08-22 19:05:45 +0200 |
---|---|---|
committer | Stijn Tintel <stijn@linux-ipv6.be> | 2016-08-23 10:51:17 +0300 |
commit | 8072264b96785184b76aa46bcd08b4f9cdfada42 (patch) | |
tree | 3a50dec26a5eb09091897a3ab98a4cfc1de170f4 /target/linux/apm821xx/patches-4.4/911-hwmon-lm90-split-set-and-show-temp-as-common-codes.patch | |
parent | 861f566e340dcf5fedd52c0ff3b31501fd3b3f1b (diff) | |
download | upstream-8072264b96785184b76aa46bcd08b4f9cdfada42.tar.gz upstream-8072264b96785184b76aa46bcd08b4f9cdfada42.tar.bz2 upstream-8072264b96785184b76aa46bcd08b4f9cdfada42.zip |
kernel: update kernel 4.4 to version 4.4.19
Refresh patches for all targets that support kernel 4.4.
Compile-tested on all targets that use kernel 4.4 and aren't marked broken.
Runtime-tested on ar71xx, octeon and x86/64.
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Diffstat (limited to 'target/linux/apm821xx/patches-4.4/911-hwmon-lm90-split-set-and-show-temp-as-common-codes.patch')
-rw-r--r-- | target/linux/apm821xx/patches-4.4/911-hwmon-lm90-split-set-and-show-temp-as-common-codes.patch | 142 |
1 files changed, 66 insertions, 76 deletions
diff --git a/target/linux/apm821xx/patches-4.4/911-hwmon-lm90-split-set-and-show-temp-as-common-codes.patch b/target/linux/apm821xx/patches-4.4/911-hwmon-lm90-split-set-and-show-temp-as-common-codes.patch index a2e38c5c74..e450f9045f 100644 --- a/target/linux/apm821xx/patches-4.4/911-hwmon-lm90-split-set-and-show-temp-as-common-codes.patch +++ b/target/linux/apm821xx/patches-4.4/911-hwmon-lm90-split-set-and-show-temp-as-common-codes.patch @@ -26,11 +26,9 @@ Reviewed-on: https://chromium-review.googlesource.com/212413 Reviewed-by: Olof Johansson <olofj@chromium.org> Commit-Queue: Olof Johansson <olofj@chromium.org> --- -diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c -index c9ff08d..fb9e224 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c -@@ -473,20 +473,29 @@ +@@ -473,20 +473,29 @@ static int lm90_read16(struct i2c_client * various registers have different meanings as a result of selecting a * non-default remote channel. */ @@ -65,7 +63,7 @@ index c9ff08d..fb9e224 100644 } /* -@@ -759,29 +768,34 @@ +@@ -759,29 +768,34 @@ static u16 temp_to_u16_adt7461(struct lm * Sysfs stuff */ @@ -110,7 +108,7 @@ index c9ff08d..fb9e224 100644 { static const u8 reg[TEMP8_REG_NUM] = { LM90_REG_W_LOCAL_LOW, -@@ -794,10 +808,37 @@ +@@ -794,60 +808,79 @@ static ssize_t set_temp8(struct device * MAX6659_REG_W_REMOTE_EMERG, }; @@ -118,26 +116,39 @@ index c9ff08d..fb9e224 100644 struct lm90_data *data = dev_get_drvdata(dev); struct i2c_client *client = data->client; - int nr = attr->index; -+ int err; -+ -+ /* +16 degrees offset for temp2 for the LM99 */ +- long val; + int err; + +- err = kstrtol(buf, 10, &val); +- if (err < 0) +- return err; +- + /* +16 degrees offset for temp2 for the LM99 */ +- if (data->kind == lm99 && attr->index == 3) + if (data->kind == lm99 && index == 3) -+ val -= 16000; -+ -+ mutex_lock(&data->update_lock); -+ if (data->kind == adt7461 || data->kind == tmp451) + val -= 16000; + + mutex_lock(&data->update_lock); + if (data->kind == adt7461 || data->kind == tmp451) +- data->temp8[nr] = temp_to_u8_adt7461(data, val); + data->temp8[index] = temp_to_u8_adt7461(data, val); -+ else if (data->kind == max6646) + else if (data->kind == max6646) +- data->temp8[nr] = temp_to_u8(val); + data->temp8[index] = temp_to_u8(val); -+ else + else +- data->temp8[nr] = temp_to_s8(val); +- +- lm90_select_remote_channel(client, data, nr >= 6); +- i2c_smbus_write_byte_data(client, reg[nr], data->temp8[nr]); +- lm90_select_remote_channel(client, data, 0); + data->temp8[index] = temp_to_s8(val); -+ + + if ((err = lm90_select_remote_channel(client, data, index >= 6)) || + (err = i2c_smbus_write_byte_data(client, reg[index], + data->temp8[index])) || + (err = lm90_select_remote_channel(client, data, 0))) + dev_err(dev, "write_temp8 failed, err %d\n", err); -+ mutex_unlock(&data->update_lock); + mutex_unlock(&data->update_lock); + + return err; +} @@ -147,84 +158,62 @@ index c9ff08d..fb9e224 100644 +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); + int index = attr->index; - long val; - int err; - -@@ -805,49 +846,41 @@ - if (err < 0) - return err; - -- /* +16 degrees offset for temp2 for the LM99 */ -- if (data->kind == lm99 && attr->index == 3) -- val -= 16000; -+ err = write_temp8(dev, index, val); ++ long val; ++ int err; ++ ++ err = kstrtol(buf, 10, &val); + if (err < 0) + return err; - -- mutex_lock(&data->update_lock); -- if (data->kind == adt7461 || data->kind == tmp451) -- data->temp8[nr] = temp_to_u8_adt7461(data, val); -- else if (data->kind == max6646) -- data->temp8[nr] = temp_to_u8(val); -- else -- data->temp8[nr] = temp_to_s8(val); -- -- lm90_select_remote_channel(client, data, nr >= 6); -- i2c_smbus_write_byte_data(client, reg[nr], data->temp8[nr]); -- lm90_select_remote_channel(client, data, 0); -- -- mutex_unlock(&data->update_lock); - return count; -+} -+ -+static int read_temp11(struct device *dev, int index) -+{ -+ struct lm90_data *data = lm90_update_device(dev); -+ int temp; + -+ if (data->kind == adt7461 || data->kind == tmp451) -+ temp = temp_from_u16_adt7461(data, data->temp11[index]); -+ else if (data->kind == max6646) -+ temp = temp_from_u16(data->temp11[index]); -+ else -+ temp = temp_from_s16(data->temp11[index]); -+ -+ /* +16 degrees offset for temp2 for the LM99 */ -+ if (data->kind == lm99 && index <= 2) -+ temp += 16000; ++ err = write_temp8(dev, index, val); ++ if (err < 0) ++ return err; + -+ return temp; + return count; } - static ssize_t show_temp11(struct device *dev, struct device_attribute *devattr, - char *buf) +-static ssize_t show_temp11(struct device *dev, struct device_attribute *devattr, +- char *buf) ++static int read_temp11(struct device *dev, int index) { - struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(devattr); -- struct lm90_data *data = lm90_update_device(dev); -- int temp; +- struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(devattr); + struct lm90_data *data = lm90_update_device(dev); + int temp; -- if (data->kind == adt7461 || data->kind == tmp451) + if (data->kind == adt7461 || data->kind == tmp451) - temp = temp_from_u16_adt7461(data, data->temp11[attr->index]); -- else if (data->kind == max6646) ++ temp = temp_from_u16_adt7461(data, data->temp11[index]); + else if (data->kind == max6646) - temp = temp_from_u16(data->temp11[attr->index]); -- else ++ temp = temp_from_u16(data->temp11[index]); + else - temp = temp_from_s16(data->temp11[attr->index]); -- -- /* +16 degrees offset for temp2 for the LM99 */ ++ temp = temp_from_s16(data->temp11[index]); + + /* +16 degrees offset for temp2 for the LM99 */ - if (data->kind == lm99 && attr->index <= 2) -- temp += 16000; -- ++ if (data->kind == lm99 && index <= 2) + temp += 16000; + - return sprintf(buf, "%d\n", temp); -+ return sprintf(buf, "%d\n", read_temp11(dev, attr->index)); ++ return temp; } -static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr, - const char *buf, size_t count) ++static ssize_t show_temp11(struct device *dev, struct device_attribute *devattr, ++ char *buf) ++{ ++ struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(devattr); ++ ++ return sprintf(buf, "%d\n", read_temp11(dev, attr->index)); ++} ++ +static int write_temp11(struct device *dev, int nr, int index, long val) { struct { u8 high; -@@ -861,17 +894,9 @@ +@@ -861,18 +894,10 @@ static ssize_t set_temp11(struct device { LM90_REG_W_REMOTE_HIGHH, LM90_REG_W_REMOTE_HIGHL, 1 } }; @@ -235,14 +224,15 @@ index c9ff08d..fb9e224 100644 - int index = attr->index; - long val; int err; -- + - err = kstrtol(buf, 10, &val); - if (err < 0) - return err; - +- /* +16 degrees offset for temp2 for the LM99 */ if (data->kind == lm99 && index <= 2) -@@ -887,15 +912,50 @@ + val -= 16000; +@@ -887,15 +912,50 @@ static ssize_t set_temp11(struct device else data->temp11[index] = temp_to_s8(val) << 8; |