/* SPDX-License-Identifier: GPL-2.0 */ /* * AD7606 ADC driver * * Copyright 2011 Analog Devices Inc. */ #ifndef IIO_ADC_AD7606_H_ #define IIO_ADC_AD7606_H_ #define AD760X_CHANNEL(num, mask_sep, mask_type, mask_all) … #define AD7605_CHANNEL(num) … #define AD7606_CHANNEL(num) … #define AD7616_CHANNEL(num) … /** * struct ad7606_chip_info - chip specific information * @channels: channel specification * @num_channels: number of channels * @oversampling_avail pointer to the array which stores the available * oversampling ratios. * @oversampling_num number of elements stored in oversampling_avail array * @os_req_reset some devices require a reset to update oversampling * @init_delay_ms required delay in miliseconds for initialization * after a restart */ struct ad7606_chip_info { … }; /** * struct ad7606_state - driver instance specific data * @dev pointer to kernel device * @chip_info entry in the table of chips that describes this device * @bops bus operations (SPI or parallel) * @range voltage range selection, selects which scale to apply * @oversampling oversampling selection * @base_address address from where to read data in parallel operation * @sw_mode_en software mode enabled * @scale_avail pointer to the array which stores the available scales * @num_scales number of elements stored in the scale_avail array * @oversampling_avail pointer to the array which stores the available * oversampling ratios. * @num_os_ratios number of elements stored in oversampling_avail array * @write_scale pointer to the function which writes the scale * @write_os pointer to the function which writes the os * @lock protect sensor state from concurrent accesses to GPIOs * @gpio_convst GPIO descriptor for conversion start signal (CONVST) * @gpio_reset GPIO descriptor for device hard-reset * @gpio_range GPIO descriptor for range selection * @gpio_standby GPIO descriptor for stand-by signal (STBY), * controls power-down mode of device * @gpio_frstdata GPIO descriptor for reading from device when data * is being read on the first channel * @gpio_os GPIO descriptors to control oversampling on the device * @complete completion to indicate end of conversion * @trig The IIO trigger associated with the device. * @data buffer for reading data from the device * @d16 be16 buffer for reading data from the device */ struct ad7606_state { … }; /** * struct ad7606_bus_ops - driver bus operations * @read_block function pointer for reading blocks of data * @sw_mode_config: pointer to a function which configured the device * for software mode * @reg_read function pointer for reading spi register * @reg_write function pointer for writing spi register * @write_mask function pointer for write spi register with mask * @rd_wr_cmd pointer to the function which calculates the spi address */ struct ad7606_bus_ops { … }; int ad7606_probe(struct device *dev, int irq, void __iomem *base_address, const char *name, unsigned int id, const struct ad7606_bus_ops *bops); int ad7606_reset(struct ad7606_state *st); enum ad7606_supported_device_ids { … }; #ifdef CONFIG_PM_SLEEP extern const struct dev_pm_ops ad7606_pm_ops; #define AD7606_PM_OPS … #else #define AD7606_PM_OPS … #endif #endif /* IIO_ADC_AD7606_H_ */