mirror of https://gitee.com/openkylin/linux.git
IIO fixes for v3.6-rc1
These mostly consist of fixes from Lars-Peter Clausen that were the first part of a large series reworking the drivers concerned. Turns out these drivers had quite a wealth of minor bugs. Also here are some build warning fixes for lm3533-als and adjd_s111 (both new drives in this cycle). Final elements are a a div factor overflow and a warning related fix in a couple of Analog Devices drivers. All in all nothing major, but a worthwhile bunch of short fixes. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIcBAABAgAGBQJQLUxMAAoJEFSFNJnE9BaI1PgQALfDZXRXLaR3zxp+ZJMZsY6e LkGbi0PioGXyJG0/a5KYTTntFGrWTR6RDhofG1AAMiUCvfmR68a5E4dS3C+huHx4 5yvoiFo2W70Cuavne34C15ObmCX2sBQx9T0i1xMCbqizjN7hfwCsM2gyieMJ3/so xhxV1wvztqJOfLY93fGZUe7sz9vZa34fdZ5cgAQqF1GpO9awDY/fvMb6ecAJjPqV qxgsmdXhYJ0v41ukjnvZbebeHZKcbf6Ffo1DGLCvjw8w8h1JMdg8/gXuwmj3RLcY Y/oUvfUFGOx0RRkbGamgxhwo2STQ9SDwUohzblIufY38HFAEfiBFueJ7IctxXy6K HPdm0UL4nDgs751rOh5on3lbiv4wX0RHsXwkoKIXlueK0rptQ+uA+Uq/irCnEfJy xxn0X03kaNMgNtI3EK3/PbEsPpDEoVpeNHFW+ikVl6FBCjRpraoxnNGMg6ajV9kH U0Wigwj0vVZdVwpUQAXZoz1so/i00mC5pHOt+3znReEdgJkV63AnlY69IbjvxoLi 3eq50EMZUsxbCQdDdIIADPtabwxKRN2rphRMb/eAG/6ZAJCYZWrhrli/OTUmqzXs 4MaYEPyAjpUiyABVtKzONtSccP640kz3YSIg6ZKwGGYoI0/jXTlrXTlsKQUeNOtn ll/kwhqy1mXYW+Q7kpj3 =+LMV -----END PGP SIGNATURE----- Merge tag 'v3.6-rc1-iio-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus IIO fixes for v3.6-rc1 These mostly consist of fixes from Lars-Peter Clausen that were the first part of a large series reworking the drivers concerned. Turns out these drivers had quite a wealth of minor bugs. Also here are some build warning fixes for lm3533-als and adjd_s111 (both new drives in this cycle). Final elements are a a div factor overflow and a warning related fix in a couple of Analog Devices drivers. All in all nothing major, but a worthwhile bunch of short fixes.
This commit is contained in:
commit
3a491aeae8
|
@ -129,7 +129,7 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq)
|
||||||
{
|
{
|
||||||
struct adf4350_platform_data *pdata = st->pdata;
|
struct adf4350_platform_data *pdata = st->pdata;
|
||||||
u64 tmp;
|
u64 tmp;
|
||||||
u32 div_gcd, prescaler;
|
u32 div_gcd, prescaler, chspc;
|
||||||
u16 mdiv, r_cnt = 0;
|
u16 mdiv, r_cnt = 0;
|
||||||
u8 band_sel_div;
|
u8 band_sel_div;
|
||||||
|
|
||||||
|
@ -158,14 +158,20 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq)
|
||||||
if (pdata->ref_div_factor)
|
if (pdata->ref_div_factor)
|
||||||
r_cnt = pdata->ref_div_factor - 1;
|
r_cnt = pdata->ref_div_factor - 1;
|
||||||
|
|
||||||
do {
|
chspc = st->chspc;
|
||||||
r_cnt = adf4350_tune_r_cnt(st, r_cnt);
|
|
||||||
|
|
||||||
st->r1_mod = st->fpfd / st->chspc;
|
do {
|
||||||
while (st->r1_mod > ADF4350_MAX_MODULUS) {
|
do {
|
||||||
r_cnt = adf4350_tune_r_cnt(st, r_cnt);
|
do {
|
||||||
st->r1_mod = st->fpfd / st->chspc;
|
r_cnt = adf4350_tune_r_cnt(st, r_cnt);
|
||||||
}
|
st->r1_mod = st->fpfd / chspc;
|
||||||
|
if (r_cnt > ADF4350_MAX_R_CNT) {
|
||||||
|
/* try higher spacing values */
|
||||||
|
chspc++;
|
||||||
|
r_cnt = 0;
|
||||||
|
}
|
||||||
|
} while ((st->r1_mod > ADF4350_MAX_MODULUS) && r_cnt);
|
||||||
|
} while (r_cnt == 0);
|
||||||
|
|
||||||
tmp = freq * (u64)st->r1_mod + (st->fpfd > 1);
|
tmp = freq * (u64)st->r1_mod + (st->fpfd > 1);
|
||||||
do_div(tmp, st->fpfd); /* Div round closest (n + d/2)/d */
|
do_div(tmp, st->fpfd); /* Div round closest (n + d/2)/d */
|
||||||
|
@ -194,7 +200,7 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq)
|
||||||
st->regs[ADF4350_REG0] = ADF4350_REG0_INT(st->r0_int) |
|
st->regs[ADF4350_REG0] = ADF4350_REG0_INT(st->r0_int) |
|
||||||
ADF4350_REG0_FRACT(st->r0_fract);
|
ADF4350_REG0_FRACT(st->r0_fract);
|
||||||
|
|
||||||
st->regs[ADF4350_REG1] = ADF4350_REG1_PHASE(0) |
|
st->regs[ADF4350_REG1] = ADF4350_REG1_PHASE(1) |
|
||||||
ADF4350_REG1_MOD(st->r1_mod) |
|
ADF4350_REG1_MOD(st->r1_mod) |
|
||||||
prescaler;
|
prescaler;
|
||||||
|
|
||||||
|
|
|
@ -271,9 +271,10 @@ static int adjd_s311_update_scan_mode(struct iio_dev *indio_dev,
|
||||||
const unsigned long *scan_mask)
|
const unsigned long *scan_mask)
|
||||||
{
|
{
|
||||||
struct adjd_s311_data *data = iio_priv(indio_dev);
|
struct adjd_s311_data *data = iio_priv(indio_dev);
|
||||||
data->buffer = krealloc(data->buffer, indio_dev->scan_bytes,
|
|
||||||
GFP_KERNEL);
|
kfree(data->buffer);
|
||||||
if (!data->buffer)
|
data->buffer = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
|
||||||
|
if (data->buffer == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -404,7 +404,7 @@ static int lm3533_als_get_hysteresis(struct iio_dev *indio_dev, unsigned nr,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int show_thresh_either_en(struct device *dev,
|
static ssize_t show_thresh_either_en(struct device *dev,
|
||||||
struct device_attribute *attr,
|
struct device_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
|
@ -424,7 +424,7 @@ static int show_thresh_either_en(struct device *dev,
|
||||||
return scnprintf(buf, PAGE_SIZE, "%u\n", enable);
|
return scnprintf(buf, PAGE_SIZE, "%u\n", enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int store_thresh_either_en(struct device *dev,
|
static ssize_t store_thresh_either_en(struct device *dev,
|
||||||
struct device_attribute *attr,
|
struct device_attribute *attr,
|
||||||
const char *buf, size_t len)
|
const char *buf, size_t len)
|
||||||
{
|
{
|
||||||
|
|
|
@ -754,7 +754,7 @@ static ssize_t ad7192_set(struct device *dev,
|
||||||
else
|
else
|
||||||
st->mode &= ~AD7192_MODE_ACX;
|
st->mode &= ~AD7192_MODE_ACX;
|
||||||
|
|
||||||
ad7192_write_reg(st, AD7192_REG_GPOCON, 3, st->mode);
|
ad7192_write_reg(st, AD7192_REG_MODE, 3, st->mode);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
@ -798,6 +798,11 @@ static const struct attribute_group ad7195_attribute_group = {
|
||||||
.attrs = ad7195_attributes,
|
.attrs = ad7195_attributes,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static unsigned int ad7192_get_temp_scale(bool unipolar)
|
||||||
|
{
|
||||||
|
return unipolar ? 2815 * 2 : 2815;
|
||||||
|
}
|
||||||
|
|
||||||
static int ad7192_read_raw(struct iio_dev *indio_dev,
|
static int ad7192_read_raw(struct iio_dev *indio_dev,
|
||||||
struct iio_chan_spec const *chan,
|
struct iio_chan_spec const *chan,
|
||||||
int *val,
|
int *val,
|
||||||
|
@ -824,19 +829,6 @@ static int ad7192_read_raw(struct iio_dev *indio_dev,
|
||||||
*val = (smpl >> chan->scan_type.shift) &
|
*val = (smpl >> chan->scan_type.shift) &
|
||||||
((1 << (chan->scan_type.realbits)) - 1);
|
((1 << (chan->scan_type.realbits)) - 1);
|
||||||
|
|
||||||
switch (chan->type) {
|
|
||||||
case IIO_VOLTAGE:
|
|
||||||
if (!unipolar)
|
|
||||||
*val -= (1 << (chan->scan_type.realbits - 1));
|
|
||||||
break;
|
|
||||||
case IIO_TEMP:
|
|
||||||
*val -= 0x800000;
|
|
||||||
*val /= 2815; /* temp Kelvin */
|
|
||||||
*val -= 273; /* temp Celsius */
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
return IIO_VAL_INT;
|
return IIO_VAL_INT;
|
||||||
|
|
||||||
case IIO_CHAN_INFO_SCALE:
|
case IIO_CHAN_INFO_SCALE:
|
||||||
|
@ -848,11 +840,21 @@ static int ad7192_read_raw(struct iio_dev *indio_dev,
|
||||||
mutex_unlock(&indio_dev->mlock);
|
mutex_unlock(&indio_dev->mlock);
|
||||||
return IIO_VAL_INT_PLUS_NANO;
|
return IIO_VAL_INT_PLUS_NANO;
|
||||||
case IIO_TEMP:
|
case IIO_TEMP:
|
||||||
*val = 1000;
|
*val = 0;
|
||||||
return IIO_VAL_INT;
|
*val2 = 1000000000 / ad7192_get_temp_scale(unipolar);
|
||||||
|
return IIO_VAL_INT_PLUS_NANO;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
case IIO_CHAN_INFO_OFFSET:
|
||||||
|
if (!unipolar)
|
||||||
|
*val = -(1 << (chan->scan_type.realbits - 1));
|
||||||
|
else
|
||||||
|
*val = 0;
|
||||||
|
/* Kelvin to Celsius */
|
||||||
|
if (chan->type == IIO_TEMP)
|
||||||
|
*val -= 273 * ad7192_get_temp_scale(unipolar);
|
||||||
|
return IIO_VAL_INT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -890,7 +892,7 @@ static int ad7192_write_raw(struct iio_dev *indio_dev,
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -942,20 +944,22 @@ static const struct iio_info ad7195_info = {
|
||||||
.channel = _chan, \
|
.channel = _chan, \
|
||||||
.channel2 = _chan2, \
|
.channel2 = _chan2, \
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
|
||||||
IIO_CHAN_INFO_SCALE_SHARED_BIT, \
|
IIO_CHAN_INFO_SCALE_SHARED_BIT | \
|
||||||
|
IIO_CHAN_INFO_OFFSET_SHARED_BIT, \
|
||||||
.address = _address, \
|
.address = _address, \
|
||||||
.scan_index = _si, \
|
.scan_index = _si, \
|
||||||
.scan_type = IIO_ST('s', 24, 32, 0)}
|
.scan_type = IIO_ST('u', 24, 32, 0)}
|
||||||
|
|
||||||
#define AD7192_CHAN(_chan, _address, _si) \
|
#define AD7192_CHAN(_chan, _address, _si) \
|
||||||
{ .type = IIO_VOLTAGE, \
|
{ .type = IIO_VOLTAGE, \
|
||||||
.indexed = 1, \
|
.indexed = 1, \
|
||||||
.channel = _chan, \
|
.channel = _chan, \
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
|
||||||
IIO_CHAN_INFO_SCALE_SHARED_BIT, \
|
IIO_CHAN_INFO_SCALE_SHARED_BIT | \
|
||||||
|
IIO_CHAN_INFO_OFFSET_SHARED_BIT, \
|
||||||
.address = _address, \
|
.address = _address, \
|
||||||
.scan_index = _si, \
|
.scan_index = _si, \
|
||||||
.scan_type = IIO_ST('s', 24, 32, 0)}
|
.scan_type = IIO_ST('u', 24, 32, 0)}
|
||||||
|
|
||||||
#define AD7192_CHAN_TEMP(_chan, _address, _si) \
|
#define AD7192_CHAN_TEMP(_chan, _address, _si) \
|
||||||
{ .type = IIO_TEMP, \
|
{ .type = IIO_TEMP, \
|
||||||
|
@ -965,7 +969,7 @@ static const struct iio_info ad7195_info = {
|
||||||
IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \
|
IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \
|
||||||
.address = _address, \
|
.address = _address, \
|
||||||
.scan_index = _si, \
|
.scan_index = _si, \
|
||||||
.scan_type = IIO_ST('s', 24, 32, 0)}
|
.scan_type = IIO_ST('u', 24, 32, 0)}
|
||||||
|
|
||||||
static struct iio_chan_spec ad7192_channels[] = {
|
static struct iio_chan_spec ad7192_channels[] = {
|
||||||
AD7192_CHAN_DIFF(1, 2, NULL, AD7192_CH_AIN1P_AIN2M, 0),
|
AD7192_CHAN_DIFF(1, 2, NULL, AD7192_CH_AIN1P_AIN2M, 0),
|
||||||
|
|
|
@ -76,7 +76,7 @@ static irqreturn_t ad7298_trigger_handler(int irq, void *p)
|
||||||
struct iio_dev *indio_dev = pf->indio_dev;
|
struct iio_dev *indio_dev = pf->indio_dev;
|
||||||
struct ad7298_state *st = iio_priv(indio_dev);
|
struct ad7298_state *st = iio_priv(indio_dev);
|
||||||
struct iio_buffer *ring = indio_dev->buffer;
|
struct iio_buffer *ring = indio_dev->buffer;
|
||||||
s64 time_ns;
|
s64 time_ns = 0;
|
||||||
__u16 buf[16];
|
__u16 buf[16];
|
||||||
int b_sent, i;
|
int b_sent, i;
|
||||||
|
|
||||||
|
|
|
@ -131,9 +131,10 @@ static const struct ad7780_chip_info ad7780_chip_info_tbl[] = {
|
||||||
.indexed = 1,
|
.indexed = 1,
|
||||||
.channel = 0,
|
.channel = 0,
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||||
IIO_CHAN_INFO_SCALE_SHARED_BIT,
|
IIO_CHAN_INFO_SCALE_SHARED_BIT |
|
||||||
|
IIO_CHAN_INFO_OFFSET_SHARED_BIT,
|
||||||
.scan_type = {
|
.scan_type = {
|
||||||
.sign = 's',
|
.sign = 'u',
|
||||||
.realbits = 24,
|
.realbits = 24,
|
||||||
.storagebits = 32,
|
.storagebits = 32,
|
||||||
.shift = 8,
|
.shift = 8,
|
||||||
|
@ -146,9 +147,10 @@ static const struct ad7780_chip_info ad7780_chip_info_tbl[] = {
|
||||||
.indexed = 1,
|
.indexed = 1,
|
||||||
.channel = 0,
|
.channel = 0,
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||||
IIO_CHAN_INFO_SCALE_SHARED_BIT,
|
IIO_CHAN_INFO_SCALE_SHARED_BIT |
|
||||||
|
IIO_CHAN_INFO_OFFSET_SHARED_BIT,
|
||||||
.scan_type = {
|
.scan_type = {
|
||||||
.sign = 's',
|
.sign = 'u',
|
||||||
.realbits = 20,
|
.realbits = 20,
|
||||||
.storagebits = 32,
|
.storagebits = 32,
|
||||||
.shift = 12,
|
.shift = 12,
|
||||||
|
|
|
@ -563,8 +563,9 @@ static ssize_t ad7793_show_scale_available(struct device *dev,
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IIO_DEVICE_ATTR_NAMED(in_m_in_scale_available, in-in_scale_available,
|
static IIO_DEVICE_ATTR_NAMED(in_m_in_scale_available,
|
||||||
S_IRUGO, ad7793_show_scale_available, NULL, 0);
|
in_voltage-voltage_scale_available, S_IRUGO,
|
||||||
|
ad7793_show_scale_available, NULL, 0);
|
||||||
|
|
||||||
static struct attribute *ad7793_attributes[] = {
|
static struct attribute *ad7793_attributes[] = {
|
||||||
&iio_dev_attr_sampling_frequency.dev_attr.attr,
|
&iio_dev_attr_sampling_frequency.dev_attr.attr,
|
||||||
|
@ -604,9 +605,6 @@ static int ad7793_read_raw(struct iio_dev *indio_dev,
|
||||||
*val = (smpl >> chan->scan_type.shift) &
|
*val = (smpl >> chan->scan_type.shift) &
|
||||||
((1 << (chan->scan_type.realbits)) - 1);
|
((1 << (chan->scan_type.realbits)) - 1);
|
||||||
|
|
||||||
if (!unipolar)
|
|
||||||
*val -= (1 << (chan->scan_type.realbits - 1));
|
|
||||||
|
|
||||||
return IIO_VAL_INT;
|
return IIO_VAL_INT;
|
||||||
|
|
||||||
case IIO_CHAN_INFO_SCALE:
|
case IIO_CHAN_INFO_SCALE:
|
||||||
|
@ -620,25 +618,38 @@ static int ad7793_read_raw(struct iio_dev *indio_dev,
|
||||||
return IIO_VAL_INT_PLUS_NANO;
|
return IIO_VAL_INT_PLUS_NANO;
|
||||||
} else {
|
} else {
|
||||||
/* 1170mV / 2^23 * 6 */
|
/* 1170mV / 2^23 * 6 */
|
||||||
scale_uv = (1170ULL * 100000000ULL * 6ULL)
|
scale_uv = (1170ULL * 100000000ULL * 6ULL);
|
||||||
>> (chan->scan_type.realbits -
|
|
||||||
(unipolar ? 0 : 1));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IIO_TEMP:
|
case IIO_TEMP:
|
||||||
/* Always uses unity gain and internal ref */
|
/* 1170mV / 0.81 mV/C / 2^23 */
|
||||||
scale_uv = (2500ULL * 100000000ULL)
|
scale_uv = 1444444444444ULL;
|
||||||
>> (chan->scan_type.realbits -
|
|
||||||
(unipolar ? 0 : 1));
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
*val2 = do_div(scale_uv, 100000000) * 10;
|
scale_uv >>= (chan->scan_type.realbits - (unipolar ? 0 : 1));
|
||||||
*val = scale_uv;
|
*val = 0;
|
||||||
|
*val2 = scale_uv;
|
||||||
return IIO_VAL_INT_PLUS_NANO;
|
return IIO_VAL_INT_PLUS_NANO;
|
||||||
|
case IIO_CHAN_INFO_OFFSET:
|
||||||
|
if (!unipolar)
|
||||||
|
*val = -(1 << (chan->scan_type.realbits - 1));
|
||||||
|
else
|
||||||
|
*val = 0;
|
||||||
|
|
||||||
|
/* Kelvin to Celsius */
|
||||||
|
if (chan->type == IIO_TEMP) {
|
||||||
|
unsigned long long offset;
|
||||||
|
unsigned int shift;
|
||||||
|
|
||||||
|
shift = chan->scan_type.realbits - (unipolar ? 0 : 1);
|
||||||
|
offset = 273ULL << shift;
|
||||||
|
do_div(offset, 1444);
|
||||||
|
*val -= offset;
|
||||||
|
}
|
||||||
|
return IIO_VAL_INT;
|
||||||
}
|
}
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -676,7 +687,7 @@ static int ad7793_write_raw(struct iio_dev *indio_dev,
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -720,9 +731,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
|
||||||
.channel2 = 0,
|
.channel2 = 0,
|
||||||
.address = AD7793_CH_AIN1P_AIN1M,
|
.address = AD7793_CH_AIN1P_AIN1M,
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||||
IIO_CHAN_INFO_SCALE_SHARED_BIT,
|
IIO_CHAN_INFO_SCALE_SHARED_BIT |
|
||||||
|
IIO_CHAN_INFO_OFFSET_SHARED_BIT,
|
||||||
.scan_index = 0,
|
.scan_index = 0,
|
||||||
.scan_type = IIO_ST('s', 24, 32, 0)
|
.scan_type = IIO_ST('u', 24, 32, 0)
|
||||||
},
|
},
|
||||||
.channel[1] = {
|
.channel[1] = {
|
||||||
.type = IIO_VOLTAGE,
|
.type = IIO_VOLTAGE,
|
||||||
|
@ -732,9 +744,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
|
||||||
.channel2 = 1,
|
.channel2 = 1,
|
||||||
.address = AD7793_CH_AIN2P_AIN2M,
|
.address = AD7793_CH_AIN2P_AIN2M,
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||||
IIO_CHAN_INFO_SCALE_SHARED_BIT,
|
IIO_CHAN_INFO_SCALE_SHARED_BIT |
|
||||||
|
IIO_CHAN_INFO_OFFSET_SHARED_BIT,
|
||||||
.scan_index = 1,
|
.scan_index = 1,
|
||||||
.scan_type = IIO_ST('s', 24, 32, 0)
|
.scan_type = IIO_ST('u', 24, 32, 0)
|
||||||
},
|
},
|
||||||
.channel[2] = {
|
.channel[2] = {
|
||||||
.type = IIO_VOLTAGE,
|
.type = IIO_VOLTAGE,
|
||||||
|
@ -744,9 +757,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
|
||||||
.channel2 = 2,
|
.channel2 = 2,
|
||||||
.address = AD7793_CH_AIN3P_AIN3M,
|
.address = AD7793_CH_AIN3P_AIN3M,
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||||
IIO_CHAN_INFO_SCALE_SHARED_BIT,
|
IIO_CHAN_INFO_SCALE_SHARED_BIT |
|
||||||
|
IIO_CHAN_INFO_OFFSET_SHARED_BIT,
|
||||||
.scan_index = 2,
|
.scan_index = 2,
|
||||||
.scan_type = IIO_ST('s', 24, 32, 0)
|
.scan_type = IIO_ST('u', 24, 32, 0)
|
||||||
},
|
},
|
||||||
.channel[3] = {
|
.channel[3] = {
|
||||||
.type = IIO_VOLTAGE,
|
.type = IIO_VOLTAGE,
|
||||||
|
@ -757,9 +771,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
|
||||||
.channel2 = 2,
|
.channel2 = 2,
|
||||||
.address = AD7793_CH_AIN1M_AIN1M,
|
.address = AD7793_CH_AIN1M_AIN1M,
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||||
IIO_CHAN_INFO_SCALE_SHARED_BIT,
|
IIO_CHAN_INFO_SCALE_SHARED_BIT |
|
||||||
|
IIO_CHAN_INFO_OFFSET_SHARED_BIT,
|
||||||
.scan_index = 3,
|
.scan_index = 3,
|
||||||
.scan_type = IIO_ST('s', 24, 32, 0)
|
.scan_type = IIO_ST('u', 24, 32, 0)
|
||||||
},
|
},
|
||||||
.channel[4] = {
|
.channel[4] = {
|
||||||
.type = IIO_TEMP,
|
.type = IIO_TEMP,
|
||||||
|
@ -769,7 +784,7 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||||
IIO_CHAN_INFO_SCALE_SEPARATE_BIT,
|
IIO_CHAN_INFO_SCALE_SEPARATE_BIT,
|
||||||
.scan_index = 4,
|
.scan_index = 4,
|
||||||
.scan_type = IIO_ST('s', 24, 32, 0),
|
.scan_type = IIO_ST('u', 24, 32, 0),
|
||||||
},
|
},
|
||||||
.channel[5] = {
|
.channel[5] = {
|
||||||
.type = IIO_VOLTAGE,
|
.type = IIO_VOLTAGE,
|
||||||
|
@ -778,9 +793,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
|
||||||
.channel = 4,
|
.channel = 4,
|
||||||
.address = AD7793_CH_AVDD_MONITOR,
|
.address = AD7793_CH_AVDD_MONITOR,
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||||
IIO_CHAN_INFO_SCALE_SEPARATE_BIT,
|
IIO_CHAN_INFO_SCALE_SEPARATE_BIT |
|
||||||
|
IIO_CHAN_INFO_OFFSET_SHARED_BIT,
|
||||||
.scan_index = 5,
|
.scan_index = 5,
|
||||||
.scan_type = IIO_ST('s', 24, 32, 0),
|
.scan_type = IIO_ST('u', 24, 32, 0),
|
||||||
},
|
},
|
||||||
.channel[6] = IIO_CHAN_SOFT_TIMESTAMP(6),
|
.channel[6] = IIO_CHAN_SOFT_TIMESTAMP(6),
|
||||||
},
|
},
|
||||||
|
@ -793,9 +809,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
|
||||||
.channel2 = 0,
|
.channel2 = 0,
|
||||||
.address = AD7793_CH_AIN1P_AIN1M,
|
.address = AD7793_CH_AIN1P_AIN1M,
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||||
IIO_CHAN_INFO_SCALE_SHARED_BIT,
|
IIO_CHAN_INFO_SCALE_SHARED_BIT |
|
||||||
|
IIO_CHAN_INFO_OFFSET_SHARED_BIT,
|
||||||
.scan_index = 0,
|
.scan_index = 0,
|
||||||
.scan_type = IIO_ST('s', 16, 32, 0)
|
.scan_type = IIO_ST('u', 16, 32, 0)
|
||||||
},
|
},
|
||||||
.channel[1] = {
|
.channel[1] = {
|
||||||
.type = IIO_VOLTAGE,
|
.type = IIO_VOLTAGE,
|
||||||
|
@ -805,9 +822,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
|
||||||
.channel2 = 1,
|
.channel2 = 1,
|
||||||
.address = AD7793_CH_AIN2P_AIN2M,
|
.address = AD7793_CH_AIN2P_AIN2M,
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||||
IIO_CHAN_INFO_SCALE_SHARED_BIT,
|
IIO_CHAN_INFO_SCALE_SHARED_BIT |
|
||||||
|
IIO_CHAN_INFO_OFFSET_SHARED_BIT,
|
||||||
.scan_index = 1,
|
.scan_index = 1,
|
||||||
.scan_type = IIO_ST('s', 16, 32, 0)
|
.scan_type = IIO_ST('u', 16, 32, 0)
|
||||||
},
|
},
|
||||||
.channel[2] = {
|
.channel[2] = {
|
||||||
.type = IIO_VOLTAGE,
|
.type = IIO_VOLTAGE,
|
||||||
|
@ -817,9 +835,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
|
||||||
.channel2 = 2,
|
.channel2 = 2,
|
||||||
.address = AD7793_CH_AIN3P_AIN3M,
|
.address = AD7793_CH_AIN3P_AIN3M,
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||||
IIO_CHAN_INFO_SCALE_SHARED_BIT,
|
IIO_CHAN_INFO_SCALE_SHARED_BIT |
|
||||||
|
IIO_CHAN_INFO_OFFSET_SHARED_BIT,
|
||||||
.scan_index = 2,
|
.scan_index = 2,
|
||||||
.scan_type = IIO_ST('s', 16, 32, 0)
|
.scan_type = IIO_ST('u', 16, 32, 0)
|
||||||
},
|
},
|
||||||
.channel[3] = {
|
.channel[3] = {
|
||||||
.type = IIO_VOLTAGE,
|
.type = IIO_VOLTAGE,
|
||||||
|
@ -830,9 +849,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
|
||||||
.channel2 = 2,
|
.channel2 = 2,
|
||||||
.address = AD7793_CH_AIN1M_AIN1M,
|
.address = AD7793_CH_AIN1M_AIN1M,
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||||
IIO_CHAN_INFO_SCALE_SHARED_BIT,
|
IIO_CHAN_INFO_SCALE_SHARED_BIT |
|
||||||
|
IIO_CHAN_INFO_OFFSET_SHARED_BIT,
|
||||||
.scan_index = 3,
|
.scan_index = 3,
|
||||||
.scan_type = IIO_ST('s', 16, 32, 0)
|
.scan_type = IIO_ST('u', 16, 32, 0)
|
||||||
},
|
},
|
||||||
.channel[4] = {
|
.channel[4] = {
|
||||||
.type = IIO_TEMP,
|
.type = IIO_TEMP,
|
||||||
|
@ -842,7 +862,7 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||||
IIO_CHAN_INFO_SCALE_SEPARATE_BIT,
|
IIO_CHAN_INFO_SCALE_SEPARATE_BIT,
|
||||||
.scan_index = 4,
|
.scan_index = 4,
|
||||||
.scan_type = IIO_ST('s', 16, 32, 0),
|
.scan_type = IIO_ST('u', 16, 32, 0),
|
||||||
},
|
},
|
||||||
.channel[5] = {
|
.channel[5] = {
|
||||||
.type = IIO_VOLTAGE,
|
.type = IIO_VOLTAGE,
|
||||||
|
@ -851,9 +871,10 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
|
||||||
.channel = 4,
|
.channel = 4,
|
||||||
.address = AD7793_CH_AVDD_MONITOR,
|
.address = AD7793_CH_AVDD_MONITOR,
|
||||||
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
|
||||||
IIO_CHAN_INFO_SCALE_SEPARATE_BIT,
|
IIO_CHAN_INFO_SCALE_SEPARATE_BIT |
|
||||||
|
IIO_CHAN_INFO_OFFSET_SHARED_BIT,
|
||||||
.scan_index = 5,
|
.scan_index = 5,
|
||||||
.scan_type = IIO_ST('s', 16, 32, 0),
|
.scan_type = IIO_ST('u', 16, 32, 0),
|
||||||
},
|
},
|
||||||
.channel[6] = IIO_CHAN_SOFT_TIMESTAMP(6),
|
.channel[6] = IIO_CHAN_SOFT_TIMESTAMP(6),
|
||||||
},
|
},
|
||||||
|
@ -901,7 +922,7 @@ static int __devinit ad7793_probe(struct spi_device *spi)
|
||||||
else if (voltage_uv)
|
else if (voltage_uv)
|
||||||
st->int_vref_mv = voltage_uv / 1000;
|
st->int_vref_mv = voltage_uv / 1000;
|
||||||
else
|
else
|
||||||
st->int_vref_mv = 2500; /* Build-in ref */
|
st->int_vref_mv = 1170; /* Build-in ref */
|
||||||
|
|
||||||
spi_set_drvdata(spi, indio_dev);
|
spi_set_drvdata(spi, indio_dev);
|
||||||
st->spi = spi;
|
st->spi = spi;
|
||||||
|
|
|
@ -87,6 +87,8 @@
|
||||||
#define ADF4350_MAX_BANDSEL_CLK 125000 /* Hz */
|
#define ADF4350_MAX_BANDSEL_CLK 125000 /* Hz */
|
||||||
#define ADF4350_MAX_FREQ_REFIN 250000000 /* Hz */
|
#define ADF4350_MAX_FREQ_REFIN 250000000 /* Hz */
|
||||||
#define ADF4350_MAX_MODULUS 4095
|
#define ADF4350_MAX_MODULUS 4095
|
||||||
|
#define ADF4350_MAX_R_CNT 1023
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct adf4350_platform_data - platform specific information
|
* struct adf4350_platform_data - platform specific information
|
||||||
|
|
Loading…
Reference in New Issue