IIO/staging inkernel pull interface
Subsystems (3)
Jonathan Cameron
maintainercover IIO/staging inkernel pull interface
This is a direct lift across from the out of staging tree of the proposed in kernel pull interface. We need this here to allow work on having both push and pull interfaces.
This may get tweaked in response to futher feedback on the other patches.
Thanks,
Jonathan
Jonathan Cameron (5):
staging:iio: core: add datasheet_name to chan_spec staging:iio:adc:max1363 add datasheet_name entries. staging:iio:core add in kernel interface mapping and getting IIO
channels.
staging;iio: move iio data return types into types.h for use by
inkern
staging:iio::hwmon interface client driver.
drivers/staging/Makefile | 2 +- drivers/staging/iio/Kconfig | 8 + drivers/staging/iio/Makefile | 4 +- drivers/staging/iio/adc/max1363_core.c | 2 + drivers/staging/iio/iio.h | 17 ++- drivers/staging/iio/iio_hwmon.c | 225 ++++++++++++++++++++++++++ drivers/staging/iio/industrialio-core.c | 268 ++++++++++++++++++++++++++++++- drivers/staging/iio/inkern.c | 21 +++ drivers/staging/iio/inkern.h | 86 ++++++++++ drivers/staging/iio/types.h | 4 + 10 files changed, 623 insertions(+), 14 deletions(-) create mode 100644 drivers/staging/iio/iio_hwmon.c create mode 100644 drivers/staging/iio/inkern.c create mode 100644 drivers/staging/iio/inkern.h
Signature · 1 line
1.7.7.3
Jonathan Cameron
maintainerPATCH 1/5 staging:iio: core: add datasheet_name to chan_spec
From: Jonathan Cameron <[email protected]>
This allows for matching against the name given on a datasheet, however silly/inconsistent it might be.
Useful for in kernel interfaces.
--- drivers/staging/iio/iio.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/staging/iio/iio.h +5 -0
@@ -110,6 +110,10 @@ enum iio_endian {* @extend_name: Allows labeling of channel attributes with an * informative name. Note this has no effect codes etc, * unlike modifiers. +* @datasheet_name: A name used in in kernel mapping of channels. It should +* corrspond to the first name that the channel is referred +* to by in the datasheet (e.g. IND), or the nearest +* possible compound name (e.g. IND-INC). * @processed_val: Flag to specify the data access attribute should be * *_input rather than *_raw. * @modified: Does a modifier apply to this channel. What these are
@@ -138,6 +142,7 @@ struct iio_chan_spec {long info_mask;long event_mask;char *extend_name; +const char *datasheet_name; unsigned processed_val:1; unsigned modified:1; unsigned indexed:1;
Signature · 1 line
1.7.7.3
Jonathan Cameron
maintainerPATCH 2/5 staging:iio:adc:max1363 add datasheet_name entries.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Kind of obvious for this device but useful
for testing purposes.
--- drivers/staging/iio/adc/max1363_core.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/staging/iio/adc/max1363_core.c +2 -0
@@ -298,6 +298,7 @@ static const enum max1363_modes max1363_mode_list[] = { .channel = num, \ .address = addr, \ .info_mask = MAX1363_INFO_MASK, \ + .datasheet_name = "AIN"#num, \ .scan_type = { \ .sign = 'u', \ .realbits = bits, \
@@ -318,6 +319,7 @@ static const enum max1363_modes max1363_mode_list[] = { .channel2 = num2, \ .address = addr, \ .info_mask = MAX1363_INFO_MASK, \ + .datasheet_name = "AIN"#num"-AIN"#num2, \ .scan_type = { \ .sign = 's', \ .realbits = bits, \
Signature · 1 line
1.7.7.3
Jonathan Cameron
maintainerPATCH 3/5 staging:iio:core add in kernel interface mapping and getting IIO channels.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Lifted from proposal for in kernel interface built on the out of staging branch.
Two elements here:
* Map as defined in "inkern.h"
* Matching code to actually get the iio_dev and channel that we want from the global list of IIO devices.
--- drivers/staging/Makefile | 2 +- drivers/staging/iio/Makefile | 2 +- drivers/staging/iio/iio.h | 6 +- drivers/staging/iio/industrialio-core.c | 268 ++++++++++++++++++++++++++++++- drivers/staging/iio/inkern.c | 21 +++ drivers/staging/iio/inkern.h | 86 ++++++++++ 6 files changed, 377 insertions(+), 8 deletions(-)
drivers/staging/Makefile +1 -1
@@ -33,7 +33,7 @@ obj-$(CONFIG_VT6656) += vt6656/ obj-$(CONFIG_HYPERV) += hv/ obj-$(CONFIG_VME_BUS) += vme/ obj-$(CONFIG_DX_SEP) += sep/ -obj-$(CONFIG_IIO) += iio/ +obj-y += iio/ obj-$(CONFIG_ZRAM) += zram/ obj-$(CONFIG_XVMALLOC) += zram/ obj-$(CONFIG_ZCACHE) += zcache/
drivers/staging/iio/Makefile +1 -1
@@ -1,7 +1,7 @@ # # Makefile for the industrial I/O core. # - +obj-y = inkern.o obj-$(CONFIG_IIO) += industrialio.o industrialio-y := industrialio-core.o industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o
drivers/staging/iio/iio.h +5 -1
@@ -230,7 +230,9 @@ struct iio_dev;* Meaning is event dependent. * @validate_trigger: function to validate the trigger when the * current trigger gets changed. -**/ +* @ the parent device (actual hardware). Note that if +* not specified then iio_dev.dev->parent is used. +*/ struct iio_info {struct module *driver_module;struct attribute_group *event_attrs;
@@ -267,8 +269,10 @@ struct iio_info { int val);int (*validate_trigger)(struct iio_dev *indio_dev,struct iio_trigger *trig); +int (*update_scan_mode)(struct iio_dev *indio_dev,const unsigned long *scan_mask); +struct device *(*get_hardware_id)(struct iio_dev *indio_dev); };/**
drivers/staging/iio/industrialio-core.c +263 -5
291 lines not on this page · raw message
drivers/staging/iio/inkern.c new file +21 -0
@@ -0,0 +1,21 @@ +/* The industrial I/O core in kernel channel mapping +* +* Copyright (c) 2011 Jonathan Cameron +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 as published by +* the Free Software Foundation. +*/ +#include "inkern.h" +#include <linux/err.h> +#include <linux/export.h> + +LIST_HEAD (iio_map_list); +EXPORT_SYMBOL_GPL (iio_map_list); +void iio_map_array_register (struct iio_map *map,int nummaps) +{ +int i; +for (i =0 ; i < nummaps; i++) +list_add (&map[i].l, &iio_map_list); +} +EXPORT_SYMBOL (iio_map_array_register);
drivers/staging/iio/inkern.h new file +86 -0
86 lines not on this page · raw message
Signature · 1 line
1.7.7.3
Jonathan Cameron
maintainerPATCH 4/5 staging;iio: move iio data return types into types.h for use by inkern
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
In kernel interfaces need these, so make them available.
--- drivers/staging/iio/iio.h | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
drivers/staging/iio/iio.h +0 -6
@@ -197,12 +197,6 @@ static inline s64 iio_get_time_ns(void)#define INDIO_ALL_BUFFER_MODES \ (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE) -/* Vast majority of this is set by the industrialio subsystem on a -* call to iio_device_register. */ -#define IIO_VAL_INT 1 -#define IIO_VAL_INT_PLUS_MICRO 2 -#define IIO_VAL_INT_PLUS_NANO 3 -struct iio_trigger ;/* forward declaration */ struct iio_dev ;
Signature · 1 line
1.7.7.3
Re: [PATCH 4/5] staging;iio: move iio data return types into types.h for use by inkern
Quoted 16 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
In kernel interfaces need these, so make them available.
Signed-off-by Jonathan Cameron <[email protected]>--- drivers/staging/iio/iio.h | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)drivers/staging/iio/iio.h +0
-0@@ -197,12 +197,6 @@ static inline s64 iio_get_time_ns(void)#define INDIO_ALL_BUFFER_MODES \ (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE)
drivers/staging/iio/iio.h static inline s64 iio_get_time_ns(void) · line 202
Quoted 10 lines
drivers/staging/iio/iio.h +0
-6-/* Vast majority of this is set by the industrialio subsystem on a -* call to iio_device_register. */ -#define IIO_VAL_INT 1 -#define IIO_VAL_INT_PLUS_MICRO 2 -#define IIO_VAL_INT_PLUS_NANO 3 -struct iio_trigger ;/* forward declaration */ struct iio_dev ;
The second part of this patch which adds the here removed defines to types.h seems to have slipped into patch 5.
Jonathan Cameron
maintainerRe: [PATCH 4/5] staging;iio: move iio data return types into types.h for use by inkern
Quoted 18 lines · Lars-Peter Clausen
Quoted 17 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
In kernel interfaces need these, so make them available.
Signed-off-by Jonathan Cameron <[email protected]>--- drivers/staging/iio/iio.h | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)drivers/staging/iio/iio.h +0
-0@@ -197,12 +197,6 @@ static inline s64 iio_get_time_ns(void)#define INDIO_ALL_BUFFER_MODES \ (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE)
Quoted 12 lines
drivers/staging/iio/iio.h static inline s64 iio_get_time_ns(void) · line 202
Quoted 9 lines
drivers/staging/iio/iio.h +0
-6-/* Vast majority of this is set by the industrialio subsystem on a -* call to iio_device_register. */ -#define IIO_VAL_INT 1 -#define IIO_VAL_INT_PLUS_MICRO 2 -#define IIO_VAL_INT_PLUS_NANO 3 -struct iio_trigger ;/* forward declaration */ struct iio_dev ;The second part of this patch which adds the here removed defines to
types.hseems to have slipped into patch 5.
Excellent catch of an idiot mistake! Thanks. They are now in this patch.
Thanks for looking at all of these.
Jonathan
Jonathan Cameron
maintainerPATCH 5/5 staging:iio::hwmon interface client driver.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Direct copy of version proposed for the non staging branch. Needed here to allow testing of more advanced inkernel interface code.
Minimal support of simple in, curr and temp attributes so far.
--- drivers/staging/iio/Kconfig | 8 ++ drivers/staging/iio/Makefile | 2 + drivers/staging/iio/iio_hwmon.c | 225 +++++++++++++++++++++++++++++++++++++++ drivers/staging/iio/types.h | 4 + 4 files changed, 239 insertions(+), 0 deletions(-)
drivers/staging/iio/Kconfig +8 -0
@@ -12,6 +12,14 @@ menuconfig IIO drivers/staging/iio/Documentation for more information. if IIO +config IIO_ST_HWMON + tristate "Hwmon driver that uses channels specified via iio maps" + depends on HWMON + help + This is a platform driver that in combination with a suitable + map allows IIO devices to provide basic hwmon functionality + for those channels specified in the map. + config IIO_BUFFER bool "Enable buffer support within IIO" help
drivers/staging/iio/Makefile +2 -0
@@ -17,6 +17,8 @@ iio_dummy-$(CONFIG_IIO_SIMPLE_DUMMY_BUFFER) += iio_simple_dummy_buffer.o obj-$(CONFIG_IIO_DUMMY_EVGEN) += iio_dummy_evgen.o +obj-$(CONFIG_IIO_ST_HWMON) += iio_hwmon.o + obj-y += accel/ obj-y += adc/ obj-y += addac/
drivers/staging/iio/iio_hwmon.c new file +225 -0
225 lines not on this page · raw message
drivers/staging/iio/types.h +4 -0
@@ -46,4 +46,8 @@ enum iio_modifier { IIO_MOD_LIGHT_IR, }; +#define IIO_VAL_INT 1 +#define IIO_VAL_INT_PLUS_MICRO 2 +#define IIO_VAL_INT_PLUS_NANO 3 +#endif /* _IIO_TYPES_H_ */
Signature · 1 line
1.7.7.3