* Patch "hwmon: (ads7828) Enable internal reference" has been added to the 4.6-stable tree
@ 2016-06-04 19:30 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-06-04 19:30 UTC (permalink / raw)
To: akshay.bhat, gregkh, linux; +Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
hwmon: (ads7828) Enable internal reference
to the 4.6-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
hwmon-ads7828-enable-internal-reference.patch
and it can be found in the queue-4.6 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From 7a18afe8097731b8ffb6cb5b2b3b418ded77c105 Mon Sep 17 00:00:00 2001
From: Akshay Bhat <akshay.bhat@timesys.com>
Date: Mon, 18 Apr 2016 15:47:53 -0400
Subject: hwmon: (ads7828) Enable internal reference
From: Akshay Bhat <akshay.bhat@timesys.com>
commit 7a18afe8097731b8ffb6cb5b2b3b418ded77c105 upstream.
On ads7828 the internal reference defaults to off upon power up. When
using internal reference, it needs to be turned on and the voltage needs
to settle before normal conversion cycle can be started. Hence perform a
dummy read in the probe to enable the internal reference allowing the
voltage to settle before performing a normal read.
Without this fix, the first read from the ADC when using internal
reference always returns incorrect data.
Signed-off-by: Akshay Bhat <akshay.bhat@timesys.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/ads7828.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/drivers/hwmon/ads7828.c
+++ b/drivers/hwmon/ads7828.c
@@ -120,6 +120,7 @@ static int ads7828_probe(struct i2c_clie
unsigned int vref_mv = ADS7828_INT_VREF_MV;
bool diff_input = false;
bool ext_vref = false;
+ unsigned int regval;
data = devm_kzalloc(dev, sizeof(struct ads7828_data), GFP_KERNEL);
if (!data)
@@ -154,6 +155,15 @@ static int ads7828_probe(struct i2c_clie
if (!diff_input)
data->cmd_byte |= ADS7828_CMD_SD_SE;
+ /*
+ * Datasheet specifies internal reference voltage is disabled by
+ * default. The internal reference voltage needs to be enabled and
+ * voltage needs to settle before getting valid ADC data. So perform a
+ * dummy read to enable the internal reference voltage.
+ */
+ if (!ext_vref)
+ regmap_read(data->regmap, data->cmd_byte, ®val);
+
hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
data,
ads7828_groups);
Patches currently in stable-queue which might be from akshay.bhat@timesys.com are
queue-4.6/hwmon-ads7828-enable-internal-reference.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-06-04 19:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-04 19:30 Patch "hwmon: (ads7828) Enable internal reference" has been added to the 4.6-stable tree gregkh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.