#include "st_sensor_hub.h"

static const struct iio_chan_spec st_hub_step_detector_ch[] = {
	{
		.type = IIO_STEP_DETECTOR,
		.channel = 0,
		.modified = 0,
		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
		.scan_type = {
			.sign = 'u',
			.realbits = 16,
			.shift = 0,
			.storagebits = 16,
			.endianness = IIO_LE,
		},
		.event_mask = IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING),
	},
	IIO_CHAN_SOFT_TIMESTAMP(1)
};

static ST_HUB_BATCH_MAX_EVENT_COUNT();
static ST_HUB_BATCH_BUFFER_LENGTH();
static ST_HUB_BATCH_TIMEOUT();
static ST_HUB_BATCH_AVAIL();
static ST_HUB_BATCH();

static void st_hub_step_detector_push_data(struct platform_device *pdev,
						u8 *data, int64_t timestamp)
{
	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
	struct st_hub_sensor_data *sdata = iio_priv(indio_dev);
示例#2
0
文件: apds9300.c 项目: 03199618/linux
	.write_event_config	= apds9300_write_interrupt_config,
};

static const struct iio_chan_spec apds9300_channels[] = {
	{
		.type = IIO_LIGHT,
		.channel = 0,
		.indexed = true,
		.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
	}, {
		.type = IIO_INTENSITY,
		.channel = 0,
		.channel2 = IIO_MOD_LIGHT_BOTH,
		.indexed = true,
		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
		.event_mask = (IIO_EV_BIT(IIO_EV_TYPE_THRESH,
					  IIO_EV_DIR_RISING) |
			       IIO_EV_BIT(IIO_EV_TYPE_THRESH,
					  IIO_EV_DIR_FALLING)),
	}, {
		.type = IIO_INTENSITY,
		.channel = 1,
		.channel2 = IIO_MOD_LIGHT_IR,
		.indexed = true,
		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
	},
};

static irqreturn_t apds9300_interrupt_handler(int irq, void *private)
{
	struct iio_dev *dev_info = private;
	struct apds9300_data *data = iio_priv(dev_info);