Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 330c6c57 authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman
Browse files

staging:iio:events - new 64 bit code structure and push out drivers.



This costs us nothing in event storage (as we are carrying a 64 bit
timestamp in the structure) and gives us lots more room to play with.

Also allows for more channels which some parts need.

V2: Cleanup some loose ends (such as the switch with only one option now).

Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 32b5eeca
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -200,14 +200,14 @@ static u8 lis3l02dq_axis_map[3][3] = {
};

static int lis3l02dq_read_thresh(struct iio_dev *indio_dev,
				 int e,
				 u64 e,
				 int *val)
{
	return lis3l02dq_read_reg_s16(indio_dev, LIS3L02DQ_REG_THS_L_ADDR, val);
}

static int lis3l02dq_write_thresh(struct iio_dev *indio_dev,
				  int event_code,
				  u64 event_code,
				  int val)
{
	u16 value = val;
@@ -534,7 +534,7 @@ static struct iio_chan_spec lis3l02dq_channels[] = {


static ssize_t lis3l02dq_read_event_config(struct iio_dev *indio_dev,
					   int event_code)
					   u64 event_code)
{

	u8 val;
@@ -586,7 +586,7 @@ int lis3l02dq_disable_all_events(struct iio_dev *indio_dev)
}

static int lis3l02dq_write_event_config(struct iio_dev *indio_dev,
					int event_code,
					u64 event_code,
					int state)
{
	int ret = 0;
+5 −5
Original line number Diff line number Diff line
@@ -695,7 +695,7 @@ static IIO_CONST_ATTR_TEMP_OFFSET("-214.6");
 * sca3000_read_thresh() - query of a threshold
 **/
static int sca3000_read_thresh(struct iio_dev *indio_dev,
			       int e,
			       u64 e,
			       int *val)
{
	int ret, i;
@@ -723,7 +723,7 @@ static int sca3000_read_thresh(struct iio_dev *indio_dev,
 * sca3000_write_thresh() control of threshold
 **/
static int sca3000_write_thresh(struct iio_dev *indio_dev,
				    int e,
				u64 e,
				int val)
{
	struct sca3000_state *st = iio_priv(indio_dev);
@@ -858,7 +858,7 @@ static irqreturn_t sca3000_event_handler(int irq, void *private)
 * sca3000_read_event_config() what events are enabled
 **/
static int sca3000_read_event_config(struct iio_dev *indio_dev,
				     int e)
				     u64 e)
{
	struct sca3000_state *st = iio_priv(indio_dev);
	int ret;
@@ -961,7 +961,7 @@ static ssize_t sca3000_set_free_fall_mode(struct device *dev,
 * this mode is disabled.  Currently normal mode is assumed.
 **/
static int sca3000_write_event_config(struct iio_dev *indio_dev,
				      int e,
				      u64 e,
				      int state)
{
	struct sca3000_state *st = iio_priv(indio_dev);
+5 −5
Original line number Diff line number Diff line
@@ -553,7 +553,7 @@ static IIO_CONST_ATTR(sampling_frequency_available,
		"133000 665000 33300 16600 8300 4200 2000 1000");

static int max1363_read_thresh(struct iio_dev *indio_dev,
			       int event_code,
			       u64 event_code,
			       int *val)
{
	struct max1363_state *st = iio_priv(indio_dev);
@@ -565,7 +565,7 @@ static int max1363_read_thresh(struct iio_dev *indio_dev,
}

static int max1363_write_thresh(struct iio_dev *indio_dev,
				int event_code,
				u64 event_code,
				int val)
{
	struct max1363_state *st = iio_priv(indio_dev);
@@ -593,7 +593,7 @@ static int max1363_write_thresh(struct iio_dev *indio_dev,
	return 0;
}

static const int max1363_event_codes[] = {
static const u64 max1363_event_codes[] = {
	IIO_UNMOD_EVENT_CODE(IIO_IN, 0, IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING),
	IIO_UNMOD_EVENT_CODE(IIO_IN, 1, IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING),
	IIO_UNMOD_EVENT_CODE(IIO_IN, 2, IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING),
@@ -624,7 +624,7 @@ static irqreturn_t max1363_event_handler(int irq, void *private)
}

static int max1363_read_event_config(struct iio_dev *indio_dev,
				     int event_code)
				     u64 event_code)
{
	struct max1363_state *st = iio_priv(indio_dev);

@@ -776,7 +776,7 @@ static inline int __max1363_check_event_mask(int thismask, int checkmask)
}

static int max1363_write_event_config(struct iio_dev *indio_dev,
				      int event_code,
				      u64 event_code,
				      int state)
{
	int ret = 0;
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
 *		the interrupt handler)
 */
struct iio_event_data {
	int	id;
	u64	id;
	s64	timestamp;
};

+21 −18
Original line number Diff line number Diff line
@@ -48,19 +48,22 @@ enum iio_chan_type {
#define	IIO_IN IIO_VOLTAGE
#define	IIO_IN_DIFF IIO_VOLTAGE_DIFF

#define IIO_MOD_X			0
#define IIO_MOD_LIGHT_BOTH		0
#define IIO_MOD_Y			1
#define IIO_MOD_LIGHT_IR		1
#define IIO_MOD_Z			2
#define IIO_MOD_X_AND_Y			3
#define IIO_MOD_X_ANX_Z			4
#define IIO_MOD_Y_AND_Z			5
#define IIO_MOD_X_AND_Y_AND_Z		6
#define IIO_MOD_X_OR_Y			7
#define IIO_MOD_X_OR_Z			8
#define IIO_MOD_Y_OR_Z			9
#define IIO_MOD_X_OR_Y_OR_Z		10
enum iio_modifier {
	IIO_NO_MOD,
	IIO_MOD_X,
	IIO_MOD_Y,
	IIO_MOD_Z,
	IIO_MOD_X_AND_Y,
	IIO_MOD_X_ANX_Z,
	IIO_MOD_Y_AND_Z,
	IIO_MOD_X_AND_Y_AND_Z,
	IIO_MOD_X_OR_Y,
	IIO_MOD_X_OR_Z,
	IIO_MOD_Y_OR_Z,
	IIO_MOD_X_OR_Y_OR_Z,
	IIO_MOD_LIGHT_BOTH,
	IIO_MOD_LIGHT_IR,
};

/* Could add the raw attributes as well - allowing buffer only devices */
enum iio_chan_info_enum {
@@ -243,17 +246,17 @@ struct iio_info {
			 long mask);

	int (*read_event_config)(struct iio_dev *indio_dev,
				 int event_code);
				 u64 event_code);

	int (*write_event_config)(struct iio_dev *indio_dev,
				  int event_code,
				  u64 event_code,
				  int state);

	int (*read_event_value)(struct iio_dev *indio_dev,
				int event_code,
				u64 event_code,
				int *val);
	int (*write_event_value)(struct iio_dev *indio_dev,
				 int event_code,
				 u64 event_code,
				 int val);
	int (*validate_trigger)(struct iio_dev *indio_dev,
				struct iio_trigger *trig);
@@ -328,7 +331,7 @@ void iio_device_unregister(struct iio_dev *dev_info);
 * @ev_code:		What event
 * @timestamp:		When the event occurred
 **/
int iio_push_event(struct iio_dev *dev_info, int ev_code, s64 timestamp);
int iio_push_event(struct iio_dev *dev_info, u64 ev_code, s64 timestamp);

extern struct bus_type iio_bus_type;

Loading