Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249830
b: refs/heads/master
c: 1e8fa5b
h: refs/heads/master
v: v3
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed May 19, 2011
1 parent e55aa5c commit 7427bdd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 01a99e182333cc3b885028eaec9fde158dde4f16
refs/heads/master: 1e8fa5b8631a0965065d621240c0eafe879ac5d0
29 changes: 29 additions & 0 deletions trunk/drivers/staging/iio/accel/lis3l02dq_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,34 @@ static int lis3l02dq_write_thresh(struct iio_dev *indio_dev,
value);
}

static int lis3l02dq_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val,
int val2,
long mask)
{
int ret = -EINVAL, reg;
u8 uval;
s8 sval;
switch (mask) {
case (1 << IIO_CHAN_INFO_CALIBBIAS_SEPARATE):
if (val > 255 || val < -256)
return -EINVAL;
sval = val;
reg = lis3l02dq_axis_map[LIS3L02DQ_BIAS][chan->address];
ret = lis3l02dq_spi_write_reg_8(indio_dev, reg, (u8 *)&sval);
break;
case (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):
if (val & ~0xFF)
return -EINVAL;
uval = val;
reg = lis3l02dq_axis_map[LIS3L02DQ_GAIN][chan->address];
ret = lis3l02dq_spi_write_reg_8(indio_dev, reg, &uval);
break;
}
return ret;
}

static int lis3l02dq_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
Expand Down Expand Up @@ -692,6 +720,7 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi)
st->help.indio_dev->channels = lis3l02dq_channels;
st->help.indio_dev->num_channels = ARRAY_SIZE(lis3l02dq_channels);
st->help.indio_dev->read_raw = &lis3l02dq_read_raw;
st->help.indio_dev->write_raw = &lis3l02dq_write_raw;
st->help.indio_dev->read_event_value = &lis3l02dq_read_thresh;
st->help.indio_dev->write_event_value = &lis3l02dq_write_thresh;
st->help.indio_dev->write_event_config = &lis3l02dq_write_event_config;
Expand Down

0 comments on commit 7427bdd

Please sign in to comment.