xref: /linux-6.15/include/linux/iio/driver.h (revision faf17860)
1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
206458e27SJonathan Cameron /*
306458e27SJonathan Cameron  * Industrial I/O in kernel access map interface.
406458e27SJonathan Cameron  *
506458e27SJonathan Cameron  * Copyright (c) 2011 Jonathan Cameron
606458e27SJonathan Cameron  */
706458e27SJonathan Cameron 
806458e27SJonathan Cameron #ifndef _IIO_INKERN_H_
906458e27SJonathan Cameron #define _IIO_INKERN_H_
1006458e27SJonathan Cameron 
1125c02edfSAlexandru Ardelean struct device;
1289c16919SAndy Shevchenko struct iio_dev;
1306458e27SJonathan Cameron struct iio_map;
1406458e27SJonathan Cameron 
1506458e27SJonathan Cameron /**
1606458e27SJonathan Cameron  * iio_map_array_register() - tell the core about inkernel consumers
1706458e27SJonathan Cameron  * @indio_dev:	provider device
1806458e27SJonathan Cameron  * @map:	array of mappings specifying association of channel with client
1906458e27SJonathan Cameron  */
2006458e27SJonathan Cameron int iio_map_array_register(struct iio_dev *indio_dev,
21*faf17860SChristophe JAILLET 			   const struct iio_map *map);
2206458e27SJonathan Cameron 
2306458e27SJonathan Cameron /**
246cb2afd7SGuenter Roeck  * iio_map_array_unregister() - tell the core to remove consumer mappings for
256cb2afd7SGuenter Roeck  *				the given provider device
2606458e27SJonathan Cameron  * @indio_dev:	provider device
2706458e27SJonathan Cameron  */
286cb2afd7SGuenter Roeck int iio_map_array_unregister(struct iio_dev *indio_dev);
2906458e27SJonathan Cameron 
3025c02edfSAlexandru Ardelean /**
3125c02edfSAlexandru Ardelean  * devm_iio_map_array_register - device-managed version of iio_map_array_register
3225c02edfSAlexandru Ardelean  * @dev:	Device object to which to bind the unwinding of this registration
3325c02edfSAlexandru Ardelean  * @indio_dev:	Pointer to the iio_dev structure
3425c02edfSAlexandru Ardelean  * @maps:	Pointer to an IIO map object which is to be registered to this IIO device
3525c02edfSAlexandru Ardelean  *
3625c02edfSAlexandru Ardelean  * This function will call iio_map_array_register() to register an IIO map object
3725c02edfSAlexandru Ardelean  * and will also hook a callback to the iio_map_array_unregister() function to
3825c02edfSAlexandru Ardelean  * handle de-registration of the IIO map object when the device's refcount goes to
3925c02edfSAlexandru Ardelean  * zero.
4025c02edfSAlexandru Ardelean  */
41*faf17860SChristophe JAILLET int devm_iio_map_array_register(struct device *dev, struct iio_dev *indio_dev,
42*faf17860SChristophe JAILLET 				const struct iio_map *maps);
4325c02edfSAlexandru Ardelean 
4406458e27SJonathan Cameron #endif
45