Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1266603

[RFC 3/4] iio: ina2xx: add debugfs reg access

From Marc Titinger <mtitinger@baylibre.com>
Newsgroups linux.kernel
Subject [RFC 3/4] iio: ina2xx: add debugfs reg access
Date 2015-11-10 17:10 +0100
Message-ID <qtjEC-7hv-5@gated-at.bofh.it> (permalink)
References <qtjEC-7hv-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


     iio:device0: ina226
...
      3 device-specific attributes found:
                attr 0: in_calibscale value: 10000
                attr 1: in_mean_raw value: 4
                attr 2: in_sampling_frequency value: 455

Signed-off-by: Marc Titinger <mtitinger@baylibre.com>
---
 drivers/iio/adc/ina2xx-iio.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/iio/adc/ina2xx-iio.c b/drivers/iio/adc/ina2xx-iio.c
index 92169e1..3e4a4b0 100644
--- a/drivers/iio/adc/ina2xx-iio.c
+++ b/drivers/iio/adc/ina2xx-iio.c
@@ -321,7 +321,19 @@ static const struct iio_chan_spec ina2xx_channels[] = {
 	IIO_CHAN_SOFT_TIMESTAMP(4),
 };
 
+static int ina2xx_debug_reg(struct iio_dev *indio_dev,
+			    unsigned reg, unsigned writeval, unsigned *readval)
+{
+	struct ina2xx_chip_info *chip = iio_priv(indio_dev);
+
+	if (!readval)
+		return regmap_write(chip->regmap, reg, writeval);
+
+	return regmap_read(chip->regmap, reg, readval);
+}
+
 static const struct iio_info ina2xx_info = {
+	.debugfs_reg_access = &ina2xx_debug_reg,
 	.read_raw = &ina2xx_read_raw,
 	.write_raw = &ina2xx_write_raw,
 	.driver_module = THIS_MODULE,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[RFC 3/4] iio: ina2xx: add debugfs reg access Marc Titinger <mtitinger@baylibre.com> - 2015-11-10 17:10 +0100

csiph-web