Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78026a6f authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Jonathan Cameron
Browse files

iio:imu:adis: Add debugfs register access support



Provide a IIO debugfs register access function for the ADIS library. This
function can be used by individual drivers to allow raw register access via
debugfs.

Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 709ab36e
Loading
Loading
Loading
Loading
+23 −0
Original line number Original line Diff line number Diff line
@@ -135,6 +135,29 @@ int adis_read_reg_16(struct adis *adis, unsigned int reg, uint16_t *val)
}
}
EXPORT_SYMBOL_GPL(adis_read_reg_16);
EXPORT_SYMBOL_GPL(adis_read_reg_16);


#ifdef CONFIG_DEBUG_FS

int adis_debugfs_reg_access(struct iio_dev *indio_dev,
	unsigned int reg, unsigned int writeval, unsigned int *readval)
{
	struct adis *adis = iio_device_get_drvdata(indio_dev);

	if (readval) {
		uint16_t val16;
		int ret;

		ret = adis_read_reg_16(adis, reg, &val16);
		*readval = val16;

		return ret;
	} else {
		return adis_write_reg_16(adis, reg, writeval);
	}
}
EXPORT_SYMBOL(adis_debugfs_reg_access);

#endif

/**
/**
 * adis_enable_irq() - Enable or disable data ready IRQ
 * adis_enable_irq() - Enable or disable data ready IRQ
 * @adis: The adis device
 * @adis: The adis device
+11 −0
Original line number Original line Diff line number Diff line
@@ -183,4 +183,15 @@ static inline void adis_remove_trigger(struct adis *adis)


#endif /* CONFIG_IIO_BUFFER */
#endif /* CONFIG_IIO_BUFFER */


#ifdef CONFIG_DEBUG_FS

int adis_debugfs_reg_access(struct iio_dev *indio_dev,
	unsigned int reg, unsigned int writeval, unsigned int *readval);

#else

#define adis_debugfs_reg_access NULL

#endif

#endif
#endif