Signed-off-by: Tim Harvey <[email protected]>
---
.../generic/patches-3.10/880-gateworks_system_controller.patch | 7 +++++--
.../generic/patches-3.12/880-gateworks_system_controller.patch | 7 +++++--
.../generic/patches-3.13/880-gateworks_system_controller.patch | 7 +++++--
.../generic/patches-3.3/880-gateworks_system_controller.patch | 7 +++++--
.../generic/patches-3.6/880-gateworks_system_controller.patch | 7 +++++--
.../generic/patches-3.8/880-gateworks_system_controller.patch | 7 +++++--
.../generic/patches-3.9/880-gateworks_system_controller.patch | 7 +++++--
7 files changed, 35 insertions(+), 14 deletions(-)
diff --git
a/target/linux/generic/patches-3.10/880-gateworks_system_controller.patch
b/target/linux/generic/patches-3.10/880-gateworks_system_controller.patch
index d923485..450551a 100644
--- a/target/linux/generic/patches-3.10/880-gateworks_system_controller.patch
+++ b/target/linux/generic/patches-3.10/880-gateworks_system_controller.patch
@@ -28,7 +28,7 @@
--- /dev/null
+++ b/drivers/hwmon/gsc.c
-@@ -0,0 +1,308 @@
+@@ -0,0 +1,311 @@
+/*
+ * A hwmon driver for the Gateworks System Controller
+ * Copyright (C) 2009 Gateworks Corporation
@@ -132,11 +132,14 @@
+ */
+static inline int gsp_read(struct i2c_client *client, u8 reg)
+{
-+ unsigned int adc = 0;
++ int adc = 0;
+ if (reg == GSP_REG_TEMP_IN || reg > GSP_REG_CURRENT)
+ {
+ adc |= i2c_smbus_read_byte_data(client, reg);
+ adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
++ if (adc > 0x8000) { /* neg temps from two's-complement */
++ adc = adc - 0xffff;
++ }
+ return adc;
+ }
+ else
diff --git
a/target/linux/generic/patches-3.12/880-gateworks_system_controller.patch
b/target/linux/generic/patches-3.12/880-gateworks_system_controller.patch
index 6e4ae30..bf521f5 100644
--- a/target/linux/generic/patches-3.12/880-gateworks_system_controller.patch
+++ b/target/linux/generic/patches-3.12/880-gateworks_system_controller.patch
@@ -28,7 +28,7 @@
--- /dev/null
+++ b/drivers/hwmon/gsc.c
-@@ -0,0 +1,308 @@
+@@ -0,0 +1,311 @@
+/*
+ * A hwmon driver for the Gateworks System Controller
+ * Copyright (C) 2009 Gateworks Corporation
@@ -132,11 +132,14 @@
+ */
+static inline int gsp_read(struct i2c_client *client, u8 reg)
+{
-+ unsigned int adc = 0;
++ int adc = 0;
+ if (reg == GSP_REG_TEMP_IN || reg > GSP_REG_CURRENT)
+ {
+ adc |= i2c_smbus_read_byte_data(client, reg);
+ adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
++ if (adc > 0x8000) { /* neg temps from two's-complement */
++ adc = adc - 0xffff;
++ }
+ return adc;
+ }
+ else
diff --git
a/target/linux/generic/patches-3.13/880-gateworks_system_controller.patch
b/target/linux/generic/patches-3.13/880-gateworks_system_controller.patch
index 6e4ae30..bf521f5 100644
--- a/target/linux/generic/patches-3.13/880-gateworks_system_controller.patch
+++ b/target/linux/generic/patches-3.13/880-gateworks_system_controller.patch
@@ -28,7 +28,7 @@
--- /dev/null
+++ b/drivers/hwmon/gsc.c
-@@ -0,0 +1,308 @@
+@@ -0,0 +1,311 @@
+/*
+ * A hwmon driver for the Gateworks System Controller
+ * Copyright (C) 2009 Gateworks Corporation
@@ -132,11 +132,14 @@
+ */
+static inline int gsp_read(struct i2c_client *client, u8 reg)
+{
-+ unsigned int adc = 0;
++ int adc = 0;
+ if (reg == GSP_REG_TEMP_IN || reg > GSP_REG_CURRENT)
+ {
+ adc |= i2c_smbus_read_byte_data(client, reg);
+ adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
++ if (adc > 0x8000) { /* neg temps from two's-complement */
++ adc = adc - 0xffff;
++ }
+ return adc;
+ }
+ else
diff --git
a/target/linux/generic/patches-3.3/880-gateworks_system_controller.patch
b/target/linux/generic/patches-3.3/880-gateworks_system_controller.patch
index d9a6481..82fa617 100644
--- a/target/linux/generic/patches-3.3/880-gateworks_system_controller.patch
+++ b/target/linux/generic/patches-3.3/880-gateworks_system_controller.patch
@@ -28,7 +28,7 @@
--- /dev/null
+++ b/drivers/hwmon/gsc.c
-@@ -0,0 +1,308 @@
+@@ -0,0 +1,311 @@
+/*
+ * A hwmon driver for the Gateworks System Controller
+ * Copyright (C) 2009 Gateworks Corporation
@@ -132,11 +132,14 @@
+ */
+static inline int gsp_read(struct i2c_client *client, u8 reg)
+{
-+ unsigned int adc = 0;
++ int adc = 0;
+ if (reg == GSP_REG_TEMP_IN || reg > GSP_REG_CURRENT)
+ {
+ adc |= i2c_smbus_read_byte_data(client, reg);
+ adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
++ if (adc > 0x8000) { /* neg temps from two's-complement */
++ adc = adc - 0xffff;
++ }
+ return adc;
+ }
+ else
diff --git
a/target/linux/generic/patches-3.6/880-gateworks_system_controller.patch
b/target/linux/generic/patches-3.6/880-gateworks_system_controller.patch
index c9690d7..59d3326 100644
--- a/target/linux/generic/patches-3.6/880-gateworks_system_controller.patch
+++ b/target/linux/generic/patches-3.6/880-gateworks_system_controller.patch
@@ -28,7 +28,7 @@
--- /dev/null
+++ b/drivers/hwmon/gsc.c
-@@ -0,0 +1,308 @@
+@@ -0,0 +1,311 @@
+/*
+ * A hwmon driver for the Gateworks System Controller
+ * Copyright (C) 2009 Gateworks Corporation
@@ -132,11 +132,14 @@
+ */
+static inline int gsp_read(struct i2c_client *client, u8 reg)
+{
-+ unsigned int adc = 0;
++ int adc = 0;
+ if (reg == GSP_REG_TEMP_IN || reg > GSP_REG_CURRENT)
+ {
+ adc |= i2c_smbus_read_byte_data(client, reg);
+ adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
++ if (adc > 0x8000) { /* neg temps from two's-complement */
++ adc = adc - 0xffff;
++ }
+ return adc;
+ }
+ else
diff --git
a/target/linux/generic/patches-3.8/880-gateworks_system_controller.patch
b/target/linux/generic/patches-3.8/880-gateworks_system_controller.patch
index 1ec0960..0417189 100644
--- a/target/linux/generic/patches-3.8/880-gateworks_system_controller.patch
+++ b/target/linux/generic/patches-3.8/880-gateworks_system_controller.patch
@@ -28,7 +28,7 @@
--- /dev/null
+++ b/drivers/hwmon/gsc.c
-@@ -0,0 +1,308 @@
+@@ -0,0 +1,311 @@
+/*
+ * A hwmon driver for the Gateworks System Controller
+ * Copyright (C) 2009 Gateworks Corporation
@@ -132,11 +132,14 @@
+ */
+static inline int gsp_read(struct i2c_client *client, u8 reg)
+{
-+ unsigned int adc = 0;
++ int adc = 0;
+ if (reg == GSP_REG_TEMP_IN || reg > GSP_REG_CURRENT)
+ {
+ adc |= i2c_smbus_read_byte_data(client, reg);
+ adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
++ if (adc > 0x8000) { /* neg temps from two's-complement */
++ adc = adc - 0xffff;
++ }
+ return adc;
+ }
+ else
diff --git
a/target/linux/generic/patches-3.9/880-gateworks_system_controller.patch
b/target/linux/generic/patches-3.9/880-gateworks_system_controller.patch
index 3bcca9c..03d39b9 100644
--- a/target/linux/generic/patches-3.9/880-gateworks_system_controller.patch
+++ b/target/linux/generic/patches-3.9/880-gateworks_system_controller.patch
@@ -28,7 +28,7 @@
--- /dev/null
+++ b/drivers/hwmon/gsc.c
-@@ -0,0 +1,308 @@
+@@ -0,0 +1,311 @@
+/*
+ * A hwmon driver for the Gateworks System Controller
+ * Copyright (C) 2009 Gateworks Corporation
@@ -132,11 +132,14 @@
+ */
+static inline int gsp_read(struct i2c_client *client, u8 reg)
+{
-+ unsigned int adc = 0;
++ int adc = 0;
+ if (reg == GSP_REG_TEMP_IN || reg > GSP_REG_CURRENT)
+ {
+ adc |= i2c_smbus_read_byte_data(client, reg);
+ adc |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
++ if (adc > 0x8000) { /* neg temps from two's-complement */
++ adc = adc - 0xffff;
++ }
+ return adc;
+ }
+ else
--
1.8.3.2
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel