]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 May 2019 07:46:41 +0000 (09:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 May 2019 07:46:41 +0000 (09:46 +0200)
added patches:
staging-iio-adt7316-allow-adt751x-to-use-internal-vref-for-all-dacs.patch
staging-iio-adt7316-fix-the-dac-read-calculation.patch
staging-iio-adt7316-fix-the-dac-write-calculation.patch

queue-4.4/series
queue-4.4/staging-iio-adt7316-allow-adt751x-to-use-internal-vref-for-all-dacs.patch [new file with mode: 0644]
queue-4.4/staging-iio-adt7316-fix-the-dac-read-calculation.patch [new file with mode: 0644]
queue-4.4/staging-iio-adt7316-fix-the-dac-write-calculation.patch [new file with mode: 0644]

index 3900793ab8951f0025fdad69058af6d9fd565706..7e452ce8d2cc216407a46bd78d80c2f79d1f3c7f 100644 (file)
@@ -133,3 +133,6 @@ xsysace-fix-error-handling-in-ace_setup.patch
 arm-orion-don-t-use-using-64-bit-dma-masks.patch
 arm-iop-don-t-use-using-64-bit-dma-masks.patch
 usb-usbip-fix-isoc-packet-num-validation-in-get_pipe.patch
+staging-iio-adt7316-allow-adt751x-to-use-internal-vref-for-all-dacs.patch
+staging-iio-adt7316-fix-the-dac-read-calculation.patch
+staging-iio-adt7316-fix-the-dac-write-calculation.patch
diff --git a/queue-4.4/staging-iio-adt7316-allow-adt751x-to-use-internal-vref-for-all-dacs.patch b/queue-4.4/staging-iio-adt7316-allow-adt751x-to-use-internal-vref-for-all-dacs.patch
new file mode 100644 (file)
index 0000000..de6d2df
--- /dev/null
@@ -0,0 +1,34 @@
+From 10bfe7cc1739c22f0aa296b39e53f61e9e3f4d99 Mon Sep 17 00:00:00 2001
+From: Jeremy Fertic <jeremyfertic@gmail.com>
+Date: Tue, 11 Dec 2018 17:55:00 -0700
+Subject: staging: iio: adt7316: allow adt751x to use internal vref for all dacs
+
+From: Jeremy Fertic <jeremyfertic@gmail.com>
+
+commit 10bfe7cc1739c22f0aa296b39e53f61e9e3f4d99 upstream.
+
+With adt7516/7/9, internal vref is available for dacs a and b, dacs c and
+d, or all dacs. The driver doesn't currently support internal vref for all
+dacs. Change the else if to an if so both bits are checked rather than
+just one or the other.
+
+Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
+Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/iio/addac/adt7316.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/staging/iio/addac/adt7316.c
++++ b/drivers/staging/iio/addac/adt7316.c
+@@ -1092,7 +1092,7 @@ static ssize_t adt7316_store_DAC_interna
+               ldac_config = chip->ldac_config & (~ADT7516_DAC_IN_VREF_MASK);
+               if (data & 0x1)
+                       ldac_config |= ADT7516_DAC_AB_IN_VREF;
+-              else if (data & 0x2)
++              if (data & 0x2)
+                       ldac_config |= ADT7516_DAC_CD_IN_VREF;
+       } else {
+               ret = kstrtou8(buf, 16, &data);
diff --git a/queue-4.4/staging-iio-adt7316-fix-the-dac-read-calculation.patch b/queue-4.4/staging-iio-adt7316-fix-the-dac-read-calculation.patch
new file mode 100644 (file)
index 0000000..22db4d6
--- /dev/null
@@ -0,0 +1,57 @@
+From 45130fb030aec26ac28b4bb23344901df3ec3b7f Mon Sep 17 00:00:00 2001
+From: Jeremy Fertic <jeremyfertic@gmail.com>
+Date: Sat, 22 Dec 2018 21:57:42 -0700
+Subject: staging: iio: adt7316: fix the dac read calculation
+
+From: Jeremy Fertic <jeremyfertic@gmail.com>
+
+commit 45130fb030aec26ac28b4bb23344901df3ec3b7f upstream.
+
+The calculation of the current dac value is using the wrong bits of the
+dac lsb register. Create two macros to shift the lsb register value into
+lsb position, depending on whether the dac is 10 or 12 bit. Initialize
+data to 0 so, with an 8 bit dac, the msb register value can be bitwise
+ORed with data.
+
+Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
+Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/iio/addac/adt7316.c |   10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+--- a/drivers/staging/iio/addac/adt7316.c
++++ b/drivers/staging/iio/addac/adt7316.c
+@@ -47,6 +47,8 @@
+ #define ADT7516_MSB_AIN3              0xA
+ #define ADT7516_MSB_AIN4              0xB
+ #define ADT7316_DA_DATA_BASE          0x10
++#define ADT7316_DA_10_BIT_LSB_SHIFT   6
++#define ADT7316_DA_12_BIT_LSB_SHIFT   4
+ #define ADT7316_DA_MSB_DATA_REGS      4
+ #define ADT7316_LSB_DAC_A             0x10
+ #define ADT7316_MSB_DAC_A             0x11
+@@ -1414,7 +1416,7 @@ static IIO_DEVICE_ATTR(ex_analog_temp_of
+ static ssize_t adt7316_show_DAC(struct adt7316_chip_info *chip,
+               int channel, char *buf)
+ {
+-      u16 data;
++      u16 data = 0;
+       u8 msb, lsb, offset;
+       int ret;
+@@ -1439,7 +1441,11 @@ static ssize_t adt7316_show_DAC(struct a
+       if (ret)
+               return -EIO;
+-      data = (msb << offset) + (lsb & ((1 << offset) - 1));
++      if (chip->dac_bits == 12)
++              data = lsb >> ADT7316_DA_12_BIT_LSB_SHIFT;
++      else if (chip->dac_bits == 10)
++              data = lsb >> ADT7316_DA_10_BIT_LSB_SHIFT;
++      data |= msb << offset;
+       return sprintf(buf, "%d\n", data);
+ }
diff --git a/queue-4.4/staging-iio-adt7316-fix-the-dac-write-calculation.patch b/queue-4.4/staging-iio-adt7316-fix-the-dac-write-calculation.patch
new file mode 100644 (file)
index 0000000..fcfe8ad
--- /dev/null
@@ -0,0 +1,54 @@
+From 78accaea117c1ae878774974fab91ac4a0b0e2b0 Mon Sep 17 00:00:00 2001
+From: Jeremy Fertic <jeremyfertic@gmail.com>
+Date: Sat, 22 Dec 2018 21:57:43 -0700
+Subject: staging: iio: adt7316: fix the dac write calculation
+
+From: Jeremy Fertic <jeremyfertic@gmail.com>
+
+commit 78accaea117c1ae878774974fab91ac4a0b0e2b0 upstream.
+
+The lsb calculation is not masking the correct bits from the user input.
+Subtract 1 from (1 << offset) to correctly set up the mask to be applied
+to user input.
+
+The lsb register stores its value starting at the bit 7 position.
+adt7316_store_DAC() currently assumes the value is at the other end of the
+register. Shift the lsb value before storing it in a new variable lsb_reg,
+and write this variable to the lsb register.
+
+Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
+Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/iio/addac/adt7316.c |   10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+--- a/drivers/staging/iio/addac/adt7316.c
++++ b/drivers/staging/iio/addac/adt7316.c
+@@ -1453,7 +1453,7 @@ static ssize_t adt7316_show_DAC(struct a
+ static ssize_t adt7316_store_DAC(struct adt7316_chip_info *chip,
+               int channel, const char *buf, size_t len)
+ {
+-      u8 msb, lsb, offset;
++      u8 msb, lsb, lsb_reg, offset;
+       u16 data;
+       int ret;
+@@ -1471,9 +1471,13 @@ static ssize_t adt7316_store_DAC(struct
+               return -EINVAL;
+       if (chip->dac_bits > 8) {
+-              lsb = data & (1 << offset);
++              lsb = data & ((1 << offset) - 1);
++              if (chip->dac_bits == 12)
++                      lsb_reg = lsb << ADT7316_DA_12_BIT_LSB_SHIFT;
++              else
++                      lsb_reg = lsb << ADT7316_DA_10_BIT_LSB_SHIFT;
+               ret = chip->bus.write(chip->bus.client,
+-                      ADT7316_DA_DATA_BASE + channel * 2, lsb);
++                      ADT7316_DA_DATA_BASE + channel * 2, lsb_reg);
+               if (ret)
+                       return -EIO;
+       }