mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
iio: adc: add helpers for parsing ADC nodes
There are ADC ICs which may have some of the AIN pins usable for other functions. These ICs may have some of the AIN pins wired so that they should not be used for ADC. A common way of marking pins that can be used as ADC inputs is to add corresponding channel@N nodes in the device tree as described in the ADC binding yaml. Add couple of helper functions which can be used to retrieve the channel information from the device node. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://patch.msgid.link/f1d8b3e15237947738912c0d297b3e1e21d8b03e.1742560649.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
f243036314
commit
f3a8f870fa
27
include/linux/iio/adc-helpers.h
Normal file
27
include/linux/iio/adc-helpers.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
/*
|
||||
* The industrial I/O ADC firmware property parsing helpers
|
||||
*
|
||||
* Copyright (c) 2025 Matti Vaittinen <mazziesaccount@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef _INDUSTRIAL_IO_ADC_HELPERS_H_
|
||||
#define _INDUSTRIAL_IO_ADC_HELPERS_H_
|
||||
|
||||
#include <linux/property.h>
|
||||
|
||||
struct device;
|
||||
struct iio_chan_spec;
|
||||
|
||||
static inline int iio_adc_device_num_channels(struct device *dev)
|
||||
{
|
||||
return device_get_named_child_node_count(dev, "channel");
|
||||
}
|
||||
|
||||
int devm_iio_adc_device_alloc_chaninfo_se(struct device *dev,
|
||||
const struct iio_chan_spec *template,
|
||||
int max_chan_id,
|
||||
struct iio_chan_spec **cs);
|
||||
|
||||
#endif /* _INDUSTRIAL_IO_ADC_HELPERS_H_ */
|
||||
Reference in New Issue
Block a user