diff options
author | David Lechner <dlechner@baylibre.com> | 2023-09-29 20:23:16 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2023-09-30 17:52:04 +0300 |
commit | 569dc8054e702f504bd8d07e2c4e315b2097d746 (patch) | |
tree | c7deae7ac3f5563abbd4673118c5024f7321e4d6 /drivers/staging/iio | |
parent | b3689e14415a874630f0894d8c3ac7ea01603d57 (diff) | |
download | linux-569dc8054e702f504bd8d07e2c4e315b2097d746.tar.xz |
staging: iio: resolver: ad2s1210: add debugfs reg access
This add an implementation of debugfs_reg_access for the AD2S1210
driver.
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20230929-ad2s1210-mainline-v3-11-fa4364281745@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r-- | drivers/staging/iio/resolver/ad2s1210.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c index 0663a51d04ad..31415fbb6384 100644 --- a/drivers/staging/iio/resolver/ad2s1210.c +++ b/drivers/staging/iio/resolver/ad2s1210.c @@ -614,9 +614,29 @@ error_ret: return ret; } +static int ad2s1210_debugfs_reg_access(struct iio_dev *indio_dev, + unsigned int reg, unsigned int writeval, + unsigned int *readval) +{ + struct ad2s1210_state *st = iio_priv(indio_dev); + int ret; + + mutex_lock(&st->lock); + + if (readval) + ret = regmap_read(st->regmap, reg, readval); + else + ret = regmap_write(st->regmap, reg, writeval); + + mutex_unlock(&st->lock); + + return ret; +} + static const struct iio_info ad2s1210_info = { .read_raw = ad2s1210_read_raw, .attrs = &ad2s1210_attribute_group, + .debugfs_reg_access = &ad2s1210_debugfs_reg_access, }; static int ad2s1210_setup_clocks(struct ad2s1210_state *st) |