Release 4.8 drivers/iio/common/st_sensors/st_sensors_buffer.c
/*
* STMicroelectronics sensors buffer library driver
*
* Copyright 2012-2013 STMicroelectronics Inc.
*
* Denis Ciocca <denis.ciocca@st.com>
*
* Licensed under the GPL-2.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/iio/iio.h>
#include <linux/iio/trigger.h>
#include <linux/interrupt.h>
#include <linux/iio/buffer.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/irqreturn.h>
#include <linux/iio/common/st_sensors.h>
static int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf)
{
int i;
struct st_sensor_data *sdata = iio_priv(indio_dev);
unsigned int num_data_channels = sdata->num_data_channels;
for_each_set_bit(i, indio_dev->active_scan_mask, num_data_channels) {
const struct iio_chan_spec *channel = &indio_dev->channels[i];
unsigned int bytes_to_read = channel->scan_type.realbits >> 3;
unsigned int storage_bytes =
channel->scan_type.storagebits >> 3;
buf = PTR_ALIGN(buf, storage_bytes);
if (sdata->tf->read_multiple_byte(&sdata->tb, sdata->dev,
channel->address,
bytes_to_read, buf,
sdata->multiread_bit) <
bytes_to_read)
return -EIO;
/* Advance the buffer pointer */
buf += storage_bytes;
}
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
denis ciocca | denis ciocca | 76 | 55.47% | 2 | 33.33% |
gregor boirie | gregor boirie | 46 | 33.58% | 2 | 33.33% |
linus walleij | linus walleij | 15 | 10.95% | 2 | 33.33% |
| Total | 137 | 100.00% | 6 | 100.00% |
irqreturn_t st_sensors_trigger_handler(int irq, void *p)
{
int len;
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->indio_dev;
struct st_sensor_data *sdata = iio_priv(indio_dev);
s64 timestamp;
/*
* If we do timetamping here, do it before reading the values, because
* once we've read the values, new interrupts can occur (when using
* the hardware trigger) and the hw_timestamp may get updated.
* By storing it in a local variable first, we are safe.
*/
if (sdata->hw_irq_trigger)
timestamp = sdata->hw_timestamp;
else
timestamp = iio_get_time_ns(indio_dev);
len = st_sensors_get_buffer_element(indio_dev, sdata->buffer_data);
if (len < 0)
goto st_sensors_get_buffer_element_error;
iio_push_to_buffers_with_timestamp(indio_dev, sdata->buffer_data,
timestamp);
st_sensors_get_buffer_element_error:
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
denis ciocca | denis ciocca | 81 | 75.00% | 1 | 16.67% |
linus walleij | linus walleij | 21 | 19.44% | 3 | 50.00% |
lars-peter clausen | lars-peter clausen | 3 | 2.78% | 1 | 16.67% |
gregor boirie | gregor boirie | 3 | 2.78% | 1 | 16.67% |
| Total | 108 | 100.00% | 6 | 100.00% |
EXPORT_SYMBOL(st_sensors_trigger_handler);
MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
MODULE_DESCRIPTION("STMicroelectronics ST-sensors buffer");
MODULE_LICENSE("GPL v2");
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
denis ciocca | denis ciocca | 211 | 70.57% | 2 | 18.18% |
gregor boirie | gregor boirie | 49 | 16.39% | 3 | 27.27% |
linus walleij | linus walleij | 36 | 12.04% | 5 | 45.45% |
lars-peter clausen | lars-peter clausen | 3 | 1.00% | 1 | 9.09% |
| Total | 299 | 100.00% | 11 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.