Release 4.11 drivers/iio/imu/adis16400_buffer.c
#include <linux/interrupt.h>
#include <linux/mutex.h>
#include <linux/kernel.h>
#include <linux/spi/spi.h>
#include <linux/slab.h>
#include <linux/bitops.h>
#include <linux/export.h>
#include <linux/iio/iio.h>
#include <linux/iio/buffer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/trigger_consumer.h>
#include "adis16400.h"
int adis16400_update_scan_mode(struct iio_dev *indio_dev,
const unsigned long *scan_mask)
{
struct adis16400_state *st = iio_priv(indio_dev);
struct adis *adis = &st->adis;
unsigned int burst_length;
u8 *tx;
if (st->variant->flags & ADIS16400_NO_BURST)
return adis_update_scan_mode(indio_dev, scan_mask);
kfree(adis->xfer);
kfree(adis->buffer);
/* All but the timestamp channel */
burst_length = (indio_dev->num_channels - 1) * sizeof(u16);
if (st->variant->flags & ADIS16400_BURST_DIAG_STAT)
burst_length += sizeof(u16);
adis->xfer = kcalloc(2, sizeof(*adis->xfer), GFP_KERNEL);
if (!adis->xfer)
return -ENOMEM;
adis->buffer = kzalloc(burst_length + sizeof(u16), GFP_KERNEL);
if (!adis->buffer)
return -ENOMEM;
tx = adis->buffer + burst_length;
tx[0] = ADIS_READ_REG(ADIS16400_GLOB_CMD);
tx[1] = 0;
adis->xfer[0].tx_buf = tx;
adis->xfer[0].bits_per_word = 8;
adis->xfer[0].len = 2;
adis->xfer[1].rx_buf = adis->buffer;
adis->xfer[1].bits_per_word = 8;
adis->xfer[1].len = burst_length;
spi_message_init(&adis->msg);
spi_message_add_tail(&adis->xfer[0], &adis->msg);
spi_message_add_tail(&adis->xfer[1], &adis->msg);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Lars-Peter Clausen | 140 | 46.36% | 4 | 44.44% |
Jonathan Cameron | 86 | 28.48% | 3 | 33.33% |
Barry Song | 48 | 15.89% | 1 | 11.11% |
Paul Cercueil | 28 | 9.27% | 1 | 11.11% |
Total | 302 | 100.00% | 9 | 100.00% |
irqreturn_t adis16400_trigger_handler(int irq, void *p)
{
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->indio_dev;
struct adis16400_state *st = iio_priv(indio_dev);
struct adis *adis = &st->adis;
u32 old_speed_hz = st->adis.spi->max_speed_hz;
void *buffer;
int ret;
if (!adis->buffer)
return -ENOMEM;
if (!(st->variant->flags & ADIS16400_NO_BURST) &&
st->adis.spi->max_speed_hz > ADIS16400_SPI_BURST) {
st->adis.spi->max_speed_hz = ADIS16400_SPI_BURST;
spi_setup(st->adis.spi);
}
ret = spi_sync(adis->spi, &adis->msg);
if (ret)
dev_err(&adis->spi->dev, "Failed to read data: %d\n", ret);
if (!(st->variant->flags & ADIS16400_NO_BURST)) {
st->adis.spi->max_speed_hz = old_speed_hz;
spi_setup(st->adis.spi);
}
if (st->variant->flags & ADIS16400_BURST_DIAG_STAT)
buffer = adis->buffer + sizeof(u16);
else
buffer = adis->buffer;
iio_push_to_buffers_with_timestamp(indio_dev, buffer,
pf->timestamp);
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Lars-Peter Clausen | 136 | 57.63% | 5 | 35.71% |
Jonathan Cameron | 53 | 22.46% | 6 | 42.86% |
Barry Song | 35 | 14.83% | 1 | 7.14% |
Michael Hennerich | 7 | 2.97% | 1 | 7.14% |
Andre Bartke | 5 | 2.12% | 1 | 7.14% |
Total | 236 | 100.00% | 14 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Lars-Peter Clausen | 280 | 48.78% | 7 | 33.33% |
Jonathan Cameron | 144 | 25.09% | 7 | 33.33% |
Barry Song | 104 | 18.12% | 2 | 9.52% |
Paul Cercueil | 28 | 4.88% | 1 | 4.76% |
Michael Hennerich | 7 | 1.22% | 1 | 4.76% |
Andre Bartke | 5 | 0.87% | 1 | 4.76% |
Paul Gortmaker | 3 | 0.52% | 1 | 4.76% |
Mike Frysinger | 3 | 0.52% | 1 | 4.76% |
Total | 574 | 100.00% | 21 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.