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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



     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@xxxxxxxxxxxx>
---
 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-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux