Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions
max1363_core.c File Reference
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/sysfs.h>
#include <linux/list.h>
#include <linux/i2c.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/module.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>
#include <linux/iio/buffer.h>
#include <linux/iio/driver.h>
#include "max1363.h"

Go to the source code of this file.

Macros

#define MAX1363_MODE_SINGLE(_num, _mask)
 
#define MAX1363_MODE_SCAN_TO_CHANNEL(_num, _mask)
 
#define MAX1236_MODE_SCAN_MID_TO_CHANNEL(_mid, _num, _mask)
 
#define MAX1363_MODE_DIFF_SINGLE(_nump, _numm, _mask)
 
#define MAX1363_MODE_DIFF_SCAN_TO_CHANNEL(_num, _numvals, _mask)
 
#define MAX1236_MODE_DIFF_SCAN_MID_TO_CHANNEL(_num, _numvals, _mask)
 
#define MAX1363_EV_M
 
#define MAX1363_INFO_MASK
 
#define MAX1363_CHAN_U(num, addr, si, bits, evmask)
 
#define MAX1363_CHAN_B(num, num2, addr, si, bits, evmask)
 
#define MAX1363_4X_CHANS(bits, em)
 
#define MAX1363_12X_CHANS(bits)
 
#define MAX1363_8X_CHANS(bits)
 
#define MAX1363_2X_CHANS(bits)
 
#define MAX1363_EVENT_FUNCS
 

Enumerations

enum  {
  max1361, max1362, max1363, max1364,
  max1036, max1037, max1038, max1039,
  max1136, max1137, max1138, max1139,
  max1236, max1237, max1238, max1239,
  max11600, max11601, max11602, max11603,
  max11604, max11605, max11606, max11607,
  max11608, max11609, max11610, max11611,
  max11612, max11613, max11614, max11615,
  max11616, max11617, max11644, max11645,
  max11646, max11647
}
 

Functions

struct max1363_modemax1363_match_mode (const unsigned long *mask, const struct max1363_chip_info *ci)
 
int max1363_set_scan_mode (struct max1363_state *st)
 
 MODULE_DEVICE_TABLE (i2c, max1363_id)
 
 module_i2c_driver (max1363_driver)
 
 MODULE_AUTHOR ("Jonathan Cameron <[email protected]>")
 
 MODULE_DESCRIPTION ("Maxim 1363 ADC")
 
 MODULE_LICENSE ("GPL v2")
 

Macro Definition Documentation

#define MAX1236_MODE_DIFF_SCAN_MID_TO_CHANNEL (   _num,
  _numvals,
  _mask 
)
Value:
{ \
.conf = MAX1363_CHANNEL_SEL(_num) \
.modemask[0] = _mask \
}

Definition at line 81 of file max1363_core.c.

#define MAX1236_MODE_SCAN_MID_TO_CHANNEL (   _mid,
  _num,
  _mask 
)
Value:
{ \
.conf = MAX1363_CHANNEL_SEL(_num) \
.modemask[0] = _mask \
}

Definition at line 58 of file max1363_core.c.

#define MAX1363_12X_CHANS (   bits)
Value:
{ \
MAX1363_CHAN_U(0, _s0, 0, bits, 0), \
MAX1363_CHAN_U(1, _s1, 1, bits, 0), \
MAX1363_CHAN_U(2, _s2, 2, bits, 0), \
MAX1363_CHAN_U(3, _s3, 3, bits, 0), \
MAX1363_CHAN_U(4, _s4, 4, bits, 0), \
MAX1363_CHAN_U(5, _s5, 5, bits, 0), \
MAX1363_CHAN_U(6, _s6, 6, bits, 0), \
MAX1363_CHAN_U(7, _s7, 7, bits, 0), \
MAX1363_CHAN_U(8, _s8, 8, bits, 0), \
MAX1363_CHAN_U(9, _s9, 9, bits, 0), \
MAX1363_CHAN_U(10, _s10, 10, bits, 0), \
MAX1363_CHAN_U(11, _s11, 11, bits, 0), \
MAX1363_CHAN_B(0, 1, d0m1, 12, bits, 0), \
MAX1363_CHAN_B(2, 3, d2m3, 13, bits, 0), \
MAX1363_CHAN_B(4, 5, d4m5, 14, bits, 0), \
MAX1363_CHAN_B(6, 7, d6m7, 15, bits, 0), \
MAX1363_CHAN_B(8, 9, d8m9, 16, bits, 0), \
MAX1363_CHAN_B(10, 11, d10m11, 17, bits, 0), \
MAX1363_CHAN_B(1, 0, d1m0, 18, bits, 0), \
MAX1363_CHAN_B(3, 2, d3m2, 19, bits, 0), \
MAX1363_CHAN_B(5, 4, d5m4, 20, bits, 0), \
MAX1363_CHAN_B(7, 6, d7m6, 21, bits, 0), \
MAX1363_CHAN_B(9, 8, d9m8, 22, bits, 0), \
MAX1363_CHAN_B(11, 10, d11m10, 23, bits, 0), \
IIO_CHAN_SOFT_TIMESTAMP(24) \
}

Definition at line 368 of file max1363_core.c.

#define MAX1363_2X_CHANS (   bits)
Value:
{ \
MAX1363_CHAN_U(0, _s0, 0, bits, 0), \
MAX1363_CHAN_U(1, _s1, 1, bits, 0), \
MAX1363_CHAN_B(0, 1, d0m1, 2, bits, 0), \
MAX1363_CHAN_B(1, 0, d1m0, 3, bits, 0), \
IIO_CHAN_SOFT_TIMESTAMP(4) \
}

Definition at line 444 of file max1363_core.c.

#define MAX1363_4X_CHANS (   bits,
  em 
)
Value:
{ \
MAX1363_CHAN_U(0, _s0, 0, bits, em), \
MAX1363_CHAN_U(1, _s1, 1, bits, em), \
MAX1363_CHAN_U(2, _s2, 2, bits, em), \
MAX1363_CHAN_U(3, _s3, 3, bits, em), \
MAX1363_CHAN_B(0, 1, d0m1, 4, bits, em), \
MAX1363_CHAN_B(2, 3, d2m3, 5, bits, em), \
MAX1363_CHAN_B(1, 0, d1m0, 6, bits, em), \
MAX1363_CHAN_B(3, 2, d3m2, 7, bits, em), \
IIO_CHAN_SOFT_TIMESTAMP(8) \
}

Definition at line 326 of file max1363_core.c.

#define MAX1363_8X_CHANS (   bits)
Value:
{ \
MAX1363_CHAN_U(0, _s0, 0, bits, 0), \
MAX1363_CHAN_U(1, _s1, 1, bits, 0), \
MAX1363_CHAN_U(2, _s2, 2, bits, 0), \
MAX1363_CHAN_U(3, _s3, 3, bits, 0), \
MAX1363_CHAN_U(4, _s4, 4, bits, 0), \
MAX1363_CHAN_U(5, _s5, 5, bits, 0), \
MAX1363_CHAN_U(6, _s6, 6, bits, 0), \
MAX1363_CHAN_U(7, _s7, 7, bits, 0), \
MAX1363_CHAN_B(0, 1, d0m1, 8, bits, 0), \
MAX1363_CHAN_B(2, 3, d2m3, 9, bits, 0), \
MAX1363_CHAN_B(4, 5, d4m5, 10, bits, 0), \
MAX1363_CHAN_B(6, 7, d6m7, 11, bits, 0), \
MAX1363_CHAN_B(1, 0, d1m0, 12, bits, 0), \
MAX1363_CHAN_B(3, 2, d3m2, 13, bits, 0), \
MAX1363_CHAN_B(5, 4, d5m4, 14, bits, 0), \
MAX1363_CHAN_B(7, 6, d7m6, 15, bits, 0), \
IIO_CHAN_SOFT_TIMESTAMP(16) \
}

Definition at line 417 of file max1363_core.c.

#define MAX1363_CHAN_B (   num,
  num2,
  addr,
  si,
  bits,
  evmask 
)
Value:
{ \
.type = IIO_VOLTAGE, \
.differential = 1, \
.indexed = 1, \
.channel = num, \
.channel2 = num2, \
.address = addr, \
.info_mask = MAX1363_INFO_MASK, \
.datasheet_name = "AIN"#num"-AIN"#num2, \
.scan_type = { \
.sign = 's', \
.realbits = bits, \
.storagebits = (bits > 8) ? 16 : 8, \
}, \
.scan_index = si, \
.event_mask = evmask, \
}

Definition at line 306 of file max1363_core.c.

#define MAX1363_CHAN_U (   num,
  addr,
  si,
  bits,
  evmask 
)
Value:
{ \
.type = IIO_VOLTAGE, \
.indexed = 1, \
.channel = num, \
.address = addr, \
.info_mask = MAX1363_INFO_MASK, \
.datasheet_name = "AIN"#num, \
.scan_type = { \
.sign = 'u', \
.realbits = bits, \
.storagebits = (bits > 8) ? 16 : 8, \
}, \
.scan_index = si, \
.event_mask = evmask, \
}

Definition at line 287 of file max1363_core.c.

#define MAX1363_EV_M
#define MAX1363_EVENT_FUNCS

Definition at line 829 of file max1363_core.c.

#define MAX1363_INFO_MASK
Value:
IIO_CHAN_INFO_SCALE_SHARED_BIT)

Definition at line 285 of file max1363_core.c.

#define MAX1363_MODE_DIFF_SCAN_TO_CHANNEL (   _num,
  _numvals,
  _mask 
)
Value:
{ \
.conf = MAX1363_CHANNEL_SEL(_num) \
.modemask[0] = _mask \
}

Definition at line 73 of file max1363_core.c.

#define MAX1363_MODE_DIFF_SINGLE (   _nump,
  _numm,
  _mask 
)
Value:
{ \
.conf = MAX1363_CHANNEL_SEL(_nump) \
.modemask[0] = _mask \
}

Definition at line 65 of file max1363_core.c.

#define MAX1363_MODE_SCAN_TO_CHANNEL (   _num,
  _mask 
)
Value:
{ \
.conf = MAX1363_CHANNEL_SEL(_num) \
.modemask[0] = _mask, \
}

Definition at line 50 of file max1363_core.c.

#define MAX1363_MODE_SINGLE (   _num,
  _mask 
)
Value:
{ \
.conf = MAX1363_CHANNEL_SEL(_num) \
.modemask[0] = _mask, \
}

Definition at line 43 of file max1363_core.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
max1361 
max1362 
max1363 
max1364 
max1036 
max1037 
max1038 
max1039 
max1136 
max1137 
max1138 
max1139 
max1236 
max1237 
max1238 
max1239 
max11600 
max11601 
max11602 
max11603 
max11604 
max11605 
max11606 
max11607 
max11608 
max11609 
max11610 
max11611 
max11612 
max11613 
max11614 
max11615 
max11616 
max11617 
max11644 
max11645 
max11646 
max11647 

Definition at line 455 of file max1363_core.c.

Function Documentation

struct max1363_mode* max1363_match_mode ( const unsigned long mask,
const struct max1363_chip_info ci 
)
read

Definition at line 152 of file max1363_core.c.

int max1363_set_scan_mode ( struct max1363_state st)

Definition at line 175 of file max1363_core.c.

MODULE_AUTHOR ( "Jonathan Cameron <[email protected]>"  )
MODULE_DESCRIPTION ( "Maxim 1363 ADC )
MODULE_DEVICE_TABLE ( i2c  ,
max1363_id   
)
module_i2c_driver ( max1363_driver  )
MODULE_LICENSE ( "GPL v2 )