summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/adc/max1363.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/iio/adc/max1363.h')
-rw-r--r--drivers/staging/iio/adc/max1363.h93
1 files changed, 9 insertions, 84 deletions
diff --git a/drivers/staging/iio/adc/max1363.h b/drivers/staging/iio/adc/max1363.h
index 8f0fe1ced2ce..360bfc5398fc 100644
--- a/drivers/staging/iio/adc/max1363.h
+++ b/drivers/staging/iio/adc/max1363.h
@@ -67,70 +67,6 @@ struct max1363_mode {
long modemask;
};
-#define MAX1363_MODE_SINGLE(_num, _mask) { \
- .conf = MAX1363_CHANNEL_SEL(_num) \
- | MAX1363_CONFIG_SCAN_SINGLE_1 \
- | MAX1363_CONFIG_SE, \
- .modemask = _mask, \
- }
-
-#define MAX1363_MODE_SCAN_TO_CHANNEL(_num, _mask) { \
- .conf = MAX1363_CHANNEL_SEL(_num) \
- | MAX1363_CONFIG_SCAN_TO_CS \
- | MAX1363_CONFIG_SE, \
- .modemask = _mask, \
- }
-
-
-/* note not available for max1363 hence naming */
-#define MAX1236_MODE_SCAN_MID_TO_CHANNEL(_mid, _num, _mask) { \
- .conf = MAX1363_CHANNEL_SEL(_num) \
- | MAX1236_SCAN_MID_TO_CHANNEL \
- | MAX1363_CONFIG_SE, \
- .modemask = _mask \
-}
-
-#define MAX1363_MODE_DIFF_SINGLE(_nump, _numm, _mask) { \
- .conf = MAX1363_CHANNEL_SEL(_nump) \
- | MAX1363_CONFIG_SCAN_SINGLE_1 \
- | MAX1363_CONFIG_DE, \
- .modemask = _mask \
- }
-
-/* Can't think how to automate naming so specify for now */
-#define MAX1363_MODE_DIFF_SCAN_TO_CHANNEL(_num, _numvals, _mask) { \
- .conf = MAX1363_CHANNEL_SEL(_num) \
- | MAX1363_CONFIG_SCAN_TO_CS \
- | MAX1363_CONFIG_DE, \
- .modemask = _mask \
- }
-
-/* note only available for max1363 hence naming */
-#define MAX1236_MODE_DIFF_SCAN_MID_TO_CHANNEL(_num, _numvals, _mask) { \
- .conf = MAX1363_CHANNEL_SEL(_num) \
- | MAX1236_SCAN_MID_TO_CHANNEL \
- | MAX1363_CONFIG_SE, \
- .modemask = _mask \
-}
-
-/* This may seem an overly long winded way to do this, but at least it makes
- * clear what all the various options actually do. Alternative suggestions
- * that don't require user to have intimate knowledge of the chip welcomed.
- */
-enum max1363_channels {
- max1363_in0, max1363_in1, max1363_in2, max1363_in3,
- max1363_in4, max1363_in5, max1363_in6, max1363_in7,
- max1363_in8, max1363_in9, max1363_in10, max1363_in11,
-
- max1363_in0min1, max1363_in2min3,
- max1363_in4min5, max1363_in6min7,
- max1363_in8min9, max1363_in10min11,
-
- max1363_in1min0, max1363_in3min2,
- max1363_in5min4, max1363_in7min6,
- max1363_in9min8, max1363_in11min10,
-};
-
/* This must be maintained along side the max1363_mode_table in max1363_core */
enum max1363_modes {
/* Single read of a single channel */
@@ -152,37 +88,34 @@ enum max1363_modes {
/**
* struct max1363_chip_info - chip specifc information
* @name: indentification string for chip
- * @num_inputs: number of physical inputs on chip
* @bits: accuracy of the adc in bits
* @int_vref_mv: the internal reference voltage
- * @monitor_mode: whether the chip supports monitor interrupts
+ * @info: iio core function callbacks structure
* @mode_list: array of available scan modes
* @num_modes: the number of scan modes available
* @default_mode: the scan mode in which the chip starts up
+ * @channel: channel specification
+ * @num_channels: number of channels
*/
struct max1363_chip_info {
- u8 num_inputs;
- u8 bits;
- u16 int_vref_mv;
- bool monitor_mode;
+ const struct iio_info *info;
+ struct iio_chan_spec *channels;
+ int num_channels;
const enum max1363_modes *mode_list;
- int num_modes;
enum max1363_modes default_mode;
- struct attribute_group *dev_attrs;
- struct attribute_group *scan_attrs;
+ u16 int_vref_mv;
+ u8 num_modes;
+ u8 bits;
};
/**
* struct max1363_state - driver instance specific data
- * @indio_dev: the industrial I/O device
* @client: i2c_client
* @setupbyte: cache of current device setup byte
* @configbyte: cache of current device config byte
* @chip_info: chip model specific constants, available modes etc
* @current_mode: the scan mode of this chip
* @requestedmask: a valid requested set of channels
- * @poll_work: bottom half of polling interrupt handler
- * @protect_ring: used to ensure only one polling bh running at a time
* @reg: supply regulator
* @monitor_on: whether monitor mode is enabled
* @monitor_speed: parameter corresponding to device monitor speed setting
@@ -190,20 +123,14 @@ struct max1363_chip_info {
* @mask_low: bitmask for enabled low thresholds
* @thresh_high: high threshold values
* @thresh_low: low threshold values
- * @last_timestamp: timestamp of last event interrupt
- * @thresh_work: bh work structure for event handling
*/
struct max1363_state {
- struct iio_dev *indio_dev;
struct i2c_client *client;
u8 setupbyte;
u8 configbyte;
const struct max1363_chip_info *chip_info;
const struct max1363_mode *current_mode;
u32 requestedmask;
- struct work_struct poll_work;
- atomic_t protect_ring;
- struct iio_trigger *trig;
struct regulator *reg;
/* Using monitor modes and buffer at the same time is
@@ -215,8 +142,6 @@ struct max1363_state {
/* 4x unipolar first then the fours bipolar ones */
s16 thresh_high[8];
s16 thresh_low[8];
- s64 last_timestamp;
- struct work_struct thresh_work;
};
const struct max1363_mode