Skip to contentSkip to conversation

staging:iio: inkern pull interfaces for staging tree.

PATCH In review Jonathan Cameron 5 participants 16 messages Dec 5, 2011 – Dec 22, 2011

Subsystems (3)
lore
Share & tools
lore

Jonathan Cameron

author maintainer
#0 lore raw

cover staging:iio: inkern pull interfaces for staging tree.

Hi Greg,

This set is a little bit of a novelty. It's actually a direct lift of a series that has been proposed and reviewed against the set of patches for the core of IIO outside of the staging tree. We need it here in staging for two reasons.

1) To allow for drivers using this to exist in the staging tree with all the stuff that is there but not yet ready to go out of staging.

2) To allow development of the push in kernel interface stuff (triggered capture) to procede. We have no where near enough of the core ready to go out of staging yet to be able to do that work there.

Anyhow, very little review here because it was all in the other thread.

For reference:
https://lkml.org/lkml/2011/11/7/258

I haven't lifted the acks across because they were obviously not able to consider any issues of interaction with the rest of IIO given they were only looking at a subset. (Not that I think there are any!).

Lars-Peter pointed out a silly mess up to do with two patches getting weirdly split up so that is fixed here wrt to the version I posted to linux-iio.

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.4
author maintainer
#1 lore raw

PATCH 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
index c225542..11c2f25 100644
@@ -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.4
author maintainer
#2 lore raw

PATCH 2/5 staging:iio:adc:max1363 add datasheet_name entries.

In reply to Jonathan Cameron

From: 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
index 9febd1b..0b97123 100644
@@ -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.4
author maintainer
#3 lore raw

PATCH 3/5 staging:iio:core add in kernel interface mapping and getting IIO channels.

In reply to Jonathan Cameron

From: 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
index 6e615b6..f59ab89 100644
@@ -34,7 +34,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
index 1340aea..04d6ad2 100644
@@ -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
index 11c2f25..4650a2b 100644
@@ -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
new file mode 100644
index 0000000..3e86093
@@ -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.4
#4 lore raw

Re: [PATCH 3/5] staging:iio:core add in kernel interface mapping and getting IIO channels.

Quoted 25 lines · Jonathan Cameron

From: 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 +0 -0
index 6e615b6..f59ab89 100644

drivers/staging/Makefile obj-$(CONFIG_VT6656) += vt6656/ · line 37

Quoted 5 lines
drivers/staging/Makefile +1 -1
@@ -34,7 +34,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/

Hm, not good.

drivers/staging/iio/Makefile line 4

Quoted 13 lines
drivers/staging/Makefile +0 -0
 obj-$(CONFIG_ZRAM)		+= zram/
 obj-$(CONFIG_XVMALLOC)		+= zram/
 obj-$(CONFIG_ZCACHE)		+= zcache/
drivers/staging/iio/Makefile +1 -1
index 1340aea..04d6ad2 100644
@@ -1,7 +1,7 @@
 #
 # Makefile for the industrial I/O core.
 #
-
+obj-y = inkern.o

Doubly not good. You just always build this now, even if someone doesn't want any staging drivers, or iio, right?

I can't accept this, sorry.

Quoted 14 lines
drivers/staging/iio/inkern.c new file +11 -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>

drivers/staging/iio/inkern.c line 21

Quoted 10 lines
drivers/staging/iio/inkern.c new file +10 -0
+
+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);

No _GPL here?

If you have a register function, why do you need to export the list symbol as well? Shouldn't you have accessor functions for the whole list? And what is this list for?

What exactly are you trying to do here with the "inkern.c" file?

Quoted 79 lines
drivers/staging/iio/inkern.h new file +76 -0
@@ -0,0 +1,86 @@
+#include <linux/device.h>
+#include <linux/list.h>
+#include "types.h"
+
+#ifndef _IIO_INKERN_H_
+#define _IIO_INKERN_H_
+
+struct iio_dev;
+struct iio_chan_spec;
+
+struct iio_channel {
+	struct iio_dev *indio_dev;
+	const struct iio_chan_spec *channel;
+};
+
+extern struct list_head iio_map_list;
+
+struct iio_map {
+	/* iio device side */
+	struct device *adc_dev;
+	const char *adc_dev_name;
+	const char *adc_channel_label;
+	int channel_number; /*naughty starting point */
+
+	/* consumer side */
+	struct device *consumer_dev;
+	const char *consumer_dev_name;
+	const char *consumer_channel;
+	/* management - probably neater ways of doing this */
+	struct list_head l;
+};
+
+void iio_map_array_register(struct iio_map *map, int nummaps);
+/**
+ * iio_channel_get() - get an opaque reference to a specified device.
+ */
+struct iio_channel *iio_st_channel_get(const struct device *dev,
+				    const char *name,
+				    const char *consumer_channel);
+void iio_st_channel_release(struct iio_channel *chan);
+
+/**
+ * iio_st_channel_get_all() - get all channels associated with a client
+ *
+ * returns a null terminated array of pointers to iio_channel structures.
+ */
+struct iio_channel **iio_st_channel_get_all(const struct device *dev,
+					const char *name);
+
+void iio_st_channel_release_all(struct iio_channel **chan);
+
+/**
+ * iio_st_read_channel_raw() - read from a given channel
+ * @channel:	the channel being queried.
+ * @val:	value read back.
+ *
+ * Note raw reads from iio channels are in adc counts and hence
+ * scale will need to be applied if standard units required.
+ *
+ * Maybe want to pass the type as a sanity check.
+ */
+int iio_st_read_channel_raw(struct iio_channel *chan,
+			    int *val);
+
+/**
+ * iio_st_get_channel_type() - get the type of a channel
+ * @channel:	the channel being queried.
+ *
+ * returns the enum iio_chan_type of the channel
+ */
+enum iio_chan_type iio_st_get_channel_type(struct iio_channel *channel);
+
+/**
+ * iio_st_read_channel_scale() - read the scale value for a channel
+ * @channel:	the channel being queried.
+ * @val:	first part of value read back.

drivers/staging/iio/inkern.h line 86

Quoted 10 lines
drivers/staging/iio/inkern.h new file +10 -0
+ * @val2:	second part of value read back.
+ *
+ * Note returns a description of what is in val and val2, such
+ * as IIO_VAL_INT_PLUS_MICRO telling us we have a value of val
+ * + val2/1e6
+ */
+int iio_st_read_channel_scale(struct iio_channel *chan, int *val,
+			      int *val2);
+
+#endif

You have a bunch of functions and structures here that are not used in the .c file, which doesn't seem to match up.

Sorry, I can't accept this.

greg k-h

author maintainer
#5 lore raw

Re: [PATCH 3/5] staging:iio:core add in kernel interface mapping and getting IIO channels.

Quoted 35 lines · Greg KH
Quoted 25 lines · Jonathan Cameron

From: 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 +0 -0
index 6e615b6..f59ab89 100644

drivers/staging/Makefile obj-$(CONFIG_VT6656) += vt6656/ · line 37

Quoted 5 lines
drivers/staging/Makefile +1 -1
@@ -34,7 +34,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/

Hm, not good.

Quoted 16 lines

drivers/staging/iio/Makefile line 4

Quoted 13 lines
drivers/staging/Makefile +0 -0
 obj-$(CONFIG_ZRAM)		+= zram/
 obj-$(CONFIG_XVMALLOC)		+= zram/
 obj-$(CONFIG_ZCACHE)		+= zcache/
drivers/staging/iio/Makefile +1 -1
index 1340aea..04d6ad2 100644
@@ -1,7 +1,7 @@
 #
 # Makefile for the industrial I/O core.
 #
-
+obj-y = inkern.o

Doubly not good. You just always build this now, even if someone doesn't want any staging drivers, or iio, right?

Agreed. That one is definitely wrong and needs a selectable symbol.

Quoted 120 lines

I can't accept this, sorry.

Quoted 14 lines
drivers/staging/iio/inkern.c new file +11 -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>

drivers/staging/iio/inkern.c line 21

Quoted 10 lines
drivers/staging/iio/inkern.c new file +10 -0
+
+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);

No _GPL here?

If you have a register function, why do you need to export the list symbol as well? Shouldn't you have accessor functions for the whole list? And what is this list for?

What exactly are you trying to do here with the "inkern.c" file?

Quoted 84 lines
drivers/staging/iio/inkern.h new file +81 -0
@@ -0,0 +1,86 @@
+#include <linux/device.h>
+#include <linux/list.h>
+#include "types.h"
+
+#ifndef _IIO_INKERN_H_
+#define _IIO_INKERN_H_
+
+struct iio_dev;
+struct iio_chan_spec;
+
+struct iio_channel {
+	struct iio_dev *indio_dev;
+	const struct iio_chan_spec *channel;
+};
+
+extern struct list_head iio_map_list;
+
+struct iio_map {
+	/* iio device side */
+	struct device *adc_dev;
+	const char *adc_dev_name;
+	const char *adc_channel_label;
+	int channel_number; /*naughty starting point */
+
+	/* consumer side */
+	struct device *consumer_dev;
+	const char *consumer_dev_name;
+	const char *consumer_channel;
+	/* management - probably neater ways of doing this */
+	struct list_head l;
+};
+
+void iio_map_array_register(struct iio_map *map, int nummaps);
+/**
+ * iio_channel_get() - get an opaque reference to a specified device.
+ */
+struct iio_channel *iio_st_channel_get(const struct device *dev,
+				    const char *name,
+				    const char *consumer_channel);
+void iio_st_channel_release(struct iio_channel *chan);
+
+/**
+ * iio_st_channel_get_all() - get all channels associated with a client
+ *
+ * returns a null terminated array of pointers to iio_channel structures.
+ */
+struct iio_channel **iio_st_channel_get_all(const struct device *dev,
+					const char *name);
+
+void iio_st_channel_release_all(struct iio_channel **chan);
+
+/**
+ * iio_st_read_channel_raw() - read from a given channel
+ * @channel:	the channel being queried.
+ * @val:	value read back.
+ *
+ * Note raw reads from iio channels are in adc counts and hence
+ * scale will need to be applied if standard units required.
+ *
+ * Maybe want to pass the type as a sanity check.
+ */
+int iio_st_read_channel_raw(struct iio_channel *chan,
+			    int *val);
+
+/**
+ * iio_st_get_channel_type() - get the type of a channel
+ * @channel:	the channel being queried.
+ *
+ * returns the enum iio_chan_type of the channel
+ */
+enum iio_chan_type iio_st_get_channel_type(struct iio_channel *channel);
+
+/**
+ * iio_st_read_channel_scale() - read the scale value for a channel
+ * @channel:	the channel being queried.
+ * @val:	first part of value read back.
+ * @val2:	second part of value read back.
+ *
+ * Note returns a description of what is in val and val2, such
+ * as IIO_VAL_INT_PLUS_MICRO telling us we have a value of val
+ * + val2/1e6
Quoted 8 lines

drivers/staging/iio/inkern.h line 86

Quoted 5 lines
drivers/staging/iio/inkern.h new file +5 -0
+ */
+int iio_st_read_channel_scale(struct iio_channel *chan, int *val,
+			      int *val2);
+
+#endif

You have a bunch of functions and structures here that are not used in the .c file, which doesn't seem to match up.

Will rework this and get back to you.

Sorry for the waste of your time. I clearly dropped the ball here.

author maintainer
#6 lore raw

Re: [PATCH 3/5] staging:iio:core add in kernel interface mapping and getting IIO channels.

In reply to Greg KH

...

Quoted 19 lines
Quoted 19 lines
drivers/staging/iio/inkern.c new file +15 -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)
Quoted 8 lines

drivers/staging/iio/inkern.c line 21

Quoted 6 lines
drivers/staging/iio/inkern.c new file +6 -0
+{
+	int i;
+	for (i = 0; i < nummaps; i++)
+		list_add(&map[i].l, &iio_map_list);
+}
+EXPORT_SYMBOL(iio_map_array_register);

No _GPL here?

oops

Quoted 4 lines

If you have a register function, why do you need to export the list symbol as well? Shouldn't you have accessor functions for the whole list? And what is this list for?

The issue here is where the access functions reside.

The list registration stuff has to be built in (now optionally!) so that it can be filled from board files if appropriate.

The list is then used by the iio-core in response to requests from client drivers that want to get data from iio devices. Short of supplying access functions that are effectively the equivalent of the standard list access functions I can't really see how else to avoid exporting this.

I'd welcome any suggestions on this!

As for the other issues. I've added another kernel symbol (boolean) as a top level for iio with the core underneath. That means that
this bit is no longer always built in. An additional header and
source file now contain the elements that were defined in inkern.h and implemented in industrialio-core.c (inkern-consumer.h/.c). Will repost for review once we've addressed this exported list question!

Jonathan

#7 lore raw

Re: [PATCH 3/5] staging:iio:core add in kernel interface mapping and getting IIO channels.

Quoted 36 lines · Jonathan Cameron

...

Quoted 19 lines
Quoted 19 lines
drivers/staging/iio/inkern.c new file +15 -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)
Quoted 8 lines

drivers/staging/iio/inkern.c line 21

Quoted 6 lines
drivers/staging/iio/inkern.c new file +6 -0
+{
+	int i;
+	for (i = 0; i < nummaps; i++)
+		list_add(&map[i].l, &iio_map_list);
+}
+EXPORT_SYMBOL(iio_map_array_register);

No _GPL here?

oops

Quoted 4 lines

If you have a register function, why do you need to export the list symbol as well? Shouldn't you have accessor functions for the whole list? And what is this list for?

The issue here is where the access functions reside.

Quoted 8 lines

The list registration stuff has to be built in (now optionally!) so that it can be filled from board files if appropriate.

The list is then used by the iio-core in response to requests from client drivers that want to get data from iio devices. Short of supplying access functions that are effectively the equivalent of the standard list access functions I can't really see how else to avoid exporting this.

So why is this separate from the iio-core code?

And how are you guaranteing that anyone walking the list is doing so in a "safe" manner? What's to keep an entry from being removed while some random kernel code is walking it?

Hint, don't allow direct access to this list, if you do so, you are in for a world of hurt...

Quoted 8 lines

I'd welcome any suggestions on this!

As for the other issues. I've added another kernel symbol (boolean) as a top level for iio with the core underneath. That means that
this bit is no longer always built in. An additional header and
source file now contain the elements that were defined in inkern.h and implemented in industrialio-core.c (inkern-consumer.h/.c). Will repost for review once we've addressed this exported list question!

Thanks for changing this.

greg k-h

#8 lore raw

Re: [PATCH 3/5] staging:iio:core add in kernel interface mapping and getting IIO channels.

Quoted 46 lines · Greg KH
Quoted 36 lines · Jonathan Cameron

...

Quoted 19 lines
Quoted 19 lines
drivers/staging/iio/inkern.c new file +15 -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)
Quoted 8 lines

drivers/staging/iio/inkern.c line 21

Quoted 6 lines
drivers/staging/iio/inkern.c new file +6 -0
+{
+	int i;
+	for (i = 0; i < nummaps; i++)
+		list_add(&map[i].l, &iio_map_list);
+}
+EXPORT_SYMBOL(iio_map_array_register);

No _GPL here?

oops

Quoted 4 lines

If you have a register function, why do you need to export the list symbol as well? Shouldn't you have accessor functions for the whole list? And what is this list for?

The issue here is where the access functions reside.

Quoted 8 lines

The list registration stuff has to be built in (now optionally!) so that it can be filled from board files if appropriate.

The list is then used by the iio-core in response to requests from client drivers that want to get data from iio devices. Short of supplying access functions that are effectively the equivalent of the standard list access functions I can't really see how else to avoid exporting this.

Quoted 8 lines

So why is this separate from the iio-core code?

And how are you guaranteing that anyone walking the list is doing so in a "safe" manner? What's to keep an entry from being removed while some random kernel code is walking it?

Hint, don't allow direct access to this list, if you do so, you are in for a world of hurt...

The entire purpose of this list is to allow a small built in chunk of code to fill it up (typically from board files) whilst the rest of IIO can still be built as a module. All but one function that touches this are in the IIO core modules. I can wrap this up but only at considerable cost (the wrappers will basically be the various list functions with a lock taken
- I'll add one of those). I can write extreme warnings around it saying that it strictly for use by the IIO core. Would that be acceptable? Clearly this element should stay in the IIO directory once the rest of the header has gone into include/linux/iio/. I can do that division now so the separation is more apparent.

So in summary two options exist.

1) Leave as is with a suitable warning and maybe rename to make it appear less friendly.
2) Wrap it so we end up with accessors that are pretty much the standard list accessors just with one parameter fixed and trivial locking. This isn't too painful but seems conceptually wrong to me.
3) Move everything that uses it into the bit that gets built in even if IIO is a module.

This last one will lead to an explosion in what is exported from IIO as we will still need to have the divide between the bit that can be modular and that which cannot somewhere! (which is why I didn't suggest it before).

Conceptually this list is part of the core - I only have it separate to avoid having to have the whole IIO core built-in if this functionality is enabled.

If list wrappers are the only acceptable option then I guess it will only be a little bit unpleasant...

Quoted 13 lines
Quoted 9 lines

I'd welcome any suggestions on this!

As for the other issues. I've added another kernel symbol (boolean) as a top level for iio with the core underneath. That means that
this bit is no longer always built in. An additional header and
source file now contain the elements that were defined in inkern.h and implemented in industrialio-core.c (inkern-consumer.h/.c). Will repost for review once we've addressed this exported list question!

Thanks for changing this.

greg k-h

#9 lore raw

Re: [PATCH 3/5] staging:iio:core add in kernel interface mapping and getting IIO channels.

Quoted 9 lines · On Fri, Dec 16, 2011 at 08:50:57AM +0000, [email protected] wrote:
Quoted 6 lines

And how are you guaranteing that anyone walking the list is doing so in a "safe" manner? What's to keep an entry from being removed while some random kernel code is walking it?

Hint, don't allow direct access to this list, if you do so, you are in for a world of hurt...

The entire purpose of this list is to allow a small built in chunk of code to fill it up (typically from board files) whilst the rest of IIO can still be built as a module.

Why are you trying to do that?

Quoted 5 lines

All but one function that touches this are in
the IIO core modules. I can wrap this up but only at considerable cost (the wrappers will basically be the various list functions with a lock taken
- I'll add one of those). I can write extreme warnings around it saying that it strictly for use by the IIO core. Would that be acceptable?

I still don't understand the point of the list. Why is this somehow different from any other bus in the kernel in that the only way to "register" a device is to actually register the device.

Quoted 6 lines

Clearly this element should stay in the IIO directory once the rest of the header has gone into include/linux/iio/. I can do that division now so the separation is more apparent.

So in summary two options exist.

Quoted 7 lines

1) Leave as is with a suitable warning and maybe rename to make it appear less friendly.
2) Wrap it so we end up with accessors that are pretty much the standard list accessors just with one parameter fixed and trivial locking. This isn't too painful but seems conceptually wrong to me.
3) Move everything that uses it into the bit that gets built in even if IIO is a module.

There should never be a "bit that is always built in if IIO is a module", sorry.

Quoted 4 lines

This last one will lead to an explosion in what is exported from IIO as we will still need to have the divide between the bit that can be modular and that which cannot somewhere! (which is why I didn't suggest it before).

Why are you trying to make such a strange distinction here? If a device uses IIO, then you need to have the IIO core. It can be built as a module or not, again, just like any other bus in the kernel.

greg k-h

#10 lore raw

Re: [PATCH 3/5] staging:iio:core add in kernel interface mapping and getting IIO channels.

Hi Greg,

I've cc'd a few more people who have an interest it this support and have mostly been involved in the discussion for the non staging patch set.

For those I've added a quick summary.

Greg is unhappy with the fact that the inkernel support in IIO relies on a small chunck of code that must be built in. That code just provides a list and a function to fill it. Everything else is in the IIO core modules. There were some other issues to do with which files code was in etc all of which have been resolved. (Thanks to Greg for looking at this code as clearly there are still controversial bits in here!) For reference it's a direct copy of what was proposed for the out of staging tree).

Quoted 9 lines · Greg KH
Quoted 1 line · On Fri, Dec 16, 2011 at 08:50:57AM +0000, [email protected] wrote:
Quoted 1 line

And how are you guaranteing that anyone walking the list is doing so

in

Quoted 1 line
Quoted 1 line

a "safe" manner? What's to keep an entry from being removed while

some

Quoted 3 lines
Quoted 3 lines

random kernel code is walking it?

Hint, don't allow direct access to this list, if you do so, you are

Quoted 8 lines

in

Quoted 3 lines
Quoted 1 line

for a world of hurt...

The entire purpose of this list is to allow a small built in chunk of code to fill it up (typically from board files) whilst the rest of

IIO can

Quoted 1 line

still be built as a module.

Why are you trying to do that?

Because I don't see any other remotely elegant way of doing it. We need a mapping from this output channel on this device to this input for this device that is using it as a service on a channel by channel basis with a single output able to be used by many inputs. This look up table (which is just a list to allow the more complex boards to fill it from various places) serves that purpose.

Quoted 5 lines
Quoted 3 lines

All but one function that touches this are in
the IIO core modules. I can wrap this up but only at considerable

cost

Quoted 1 line

(the wrappers will basically be the various list functions with a

Quoted 8 lines

lock taken

Quoted 1 line

- I'll add one of those). I can write extreme warnings around it

saying

Quoted 1 line

that it strictly for use by the IIO core. Would that be acceptable?

I still don't understand the point of the list. Why is this somehow different from any other bus in the kernel in that the only way to "register" a device is to actually register the device.

It is not for registering a device. It is for associations between devices. Similar to the regulator API. That provides a means to request a voltage from another device, this provides a means of reading from a device.

Ultimately it's a convenient way of passing platform data. We could pass it into every single supplier device (in a similar way to regulators) as platform data. Thus every iio device would have to handle platform data and pass it on to the core, or, as here, we can separate it out.

Quoted 14 lines
Quoted 2 lines

Clearly this element should stay in the IIO directory once the rest

of

Quoted 1 line

the header has gone into include/linux/iio/. I can do that division

now

Quoted 5 lines

so the separation is more apparent.

So in summary two options exist.

1) Leave as is with a suitable warning and maybe rename to make it

appear

Quoted 2 lines

less friendly.
2) Wrap it so we end up with accessors that are pretty much the

standard

Quoted 8 lines
Quoted 1 line

list accessors just with one parameter fixed and trivial locking.

This isn't

Quoted 3 lines

too painful but seems conceptually wrong to me.
3) Move everything that uses it into the bit that gets built in even if IIO is a module.

There should never be a "bit that is always built in if IIO is a module", sorry.

The only alternative is to make ever single IIO driver take platform data to specify it's consumers and immediately pass it into the core. It is only the core that cares.

Quoted 11 lines
Quoted 2 lines

This last one will lead to an explosion in what is exported from IIO

as we

Quoted 1 line

will still need to have the divide between the bit that can be

modular and

Quoted 2 lines

that which cannot somewhere! (which is why I didn't suggest it before).

Why are you trying to make such a strange distinction here? If a device
uses IIO, then you need to have the IIO core.

When that driver is loaded, not when the board file sets up it's association with IIO. It will not be dependent on the driver supplying the channel anyway so we will need the backoff and try again stuff to make this work.

Why have I done it like this?

Because this way we get a fairly clean addition to the subsystem without having to rewrite every single driver's probe routine which is the only other way making the data available that I can see.

Quoted 2 lines

It can be built as a
module or not, again, just like any other bus in the kernel.

Bus maybe, but other subsystems providing a 'service' like we have here for iio such as regulators, pinmux etc cannot be built as modules. There the arguement was they were core to the board; that is not typically true of IIO.

Note that if this feels like a bolt on to IIO that is because inkernel support is exactly that. We are happy to have it only if enhances what IIO already offers.

Jonathan

#11 lore raw

Re: [PATCH 3/5] staging:iio:core add in kernel interface mapping and getting IIO channels.

Quoted 4 lines · Jonathan Cameron
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

for a world of hurt...

The entire purpose of this list is to allow a small built in chunk of code to fill it up (typically from board files) whilst the rest of

IIO can

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

still be built as a module.

Why are you trying to do that?

Because I don't see any other remotely elegant way of doing it. We need a mapping from this output channel on this device to this input for this device that is using it as a service on a channel by channel basis with a single output able to be used by many inputs.

Who needs that mapping?

Quoted 2 lines

This look up table (which is just a list to allow the more complex boards to fill it from various places) serves that purpose.

And how is that shown by just a "bare" list being exported? If you need to provide such a mapping, then by all means do so, but do so in a documented way with the proper locking for any data structures (which again, was the most obvious bug you had with this patch.)

Quoted 9 lines
Quoted 9 lines
Quoted 2 lines

All but one function that touches this are in
the IIO core modules. I can wrap this up but only at considerable

cost

Quoted 1 line

(the wrappers will basically be the various list functions with a

lock taken

Quoted 1 line

- I'll add one of those). I can write extreme warnings around it

saying

Quoted 1 line

that it strictly for use by the IIO core. Would that be acceptable?

Quoted 7 lines
Quoted 3 lines

I still don't understand the point of the list. Why is this somehow different from any other bus in the kernel in that the only way to "register" a device is to actually register the device.

It is not for registering a device. It is for associations between devices. Similar to the regulator API. That provides a means to request a voltage from another device, this provides a means of reading from a device.

Ok, then show how that works somehow? Again, a list doesn't show that to me.

Quoted 5 lines

Ultimately it's a convenient way of passing platform data. We could pass it into every single supplier device (in a similar way to regulators) as platform data. Thus every iio device would have to handle platform data and pass it on to the core, or, as here, we can separate it out.

Having a function for all of the drivers to call to provide this information seems like the most obvious way to do this in a proper way, why not do that?

Quoted 19 lines
Quoted 19 lines
Quoted 1 line

Clearly this element should stay in the IIO directory once the rest

of

Quoted 1 line

the header has gone into include/linux/iio/. I can do that division

now

Quoted 5 lines

so the separation is more apparent.

So in summary two options exist.

1) Leave as is with a suitable warning and maybe rename to make it

appear

Quoted 2 lines

less friendly.
2) Wrap it so we end up with accessors that are pretty much the

standard

Quoted 1 line

list accessors just with one parameter fixed and trivial locking.

This isn't

Quoted 3 lines

too painful but seems conceptually wrong to me.
3) Move everything that uses it into the bit that gets built in even if IIO is a module.

Quoted 5 lines
Quoted 2 lines

There should never be a "bit that is always built in if IIO is a module", sorry.

The only alternative is to make ever single IIO driver take platform data to specify it's consumers and immediately pass it into the core. It is only the core that cares.

What's wrong with a function call to the IIO core by the drivers?

Quoted 15 lines
Quoted 10 lines
Quoted 1 line

This last one will lead to an explosion in what is exported from IIO

as we

Quoted 1 line

will still need to have the divide between the bit that can be

modular and

Quoted 2 lines

that which cannot somewhere! (which is why I didn't suggest it before).

Why are you trying to make such a strange distinction here? If a device
uses IIO, then you need to have the IIO core.

When that driver is loaded, not when the board file sets up it's association with IIO. It will not be dependent on the driver supplying the channel anyway so we will need the backoff and try again stuff to make this work.

Quoted 6 lines

Why have I done it like this?

Because this way we get a fairly clean addition to the subsystem without having to rewrite every single driver's probe routine which is the only other way making the data available that I can see.

Rewriting all probe functions really shouldn't be hard as you have to just change from manipulating this list by-hand, to making a function call. That sounds like an easy thing to do, and something that should be done, right?

Quoted 6 lines
Quoted 2 lines

It can be built as a
module or not, again, just like any other bus in the kernel.

Bus maybe, but other subsystems providing a 'service' like we have here for iio such as regulators, pinmux etc cannot be built as modules. There the arguement was they were core to the board; that is not typically true of IIO.

Then keep the IIO core from being built as a module if that is the requirement here.

Or, just be sure to initialize it early enough in the boot process that it happens before the drivers are, and then, it can be a module, as long as any driver that uses it is also a module, right?

Again, just like all other busses :)

thanks,

greg k-h

author maintainer
#12 lore raw

Re: [PATCH 3/5] staging:iio:core add in kernel interface mapping and getting IIO channels.

Quoted 7 lines · Greg KH
Quoted 6 lines · Jonathan Cameron
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

for a world of hurt...

The entire purpose of this list is to allow a small built in chunk of code to fill it up (typically from board files) whilst the rest of

IIO can

Quoted 1 line

still be built as a module.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Why are you trying to do that?

Because I don't see any other remotely elegant way of doing it. We need a mapping from this output channel on this device to this input for this device that is using it as a service on a channel by channel basis with a single output able to be used by many inputs.

Who needs that mapping?

Any driver that needs to read/write (via a dac rather than
a regulator - and yes there is clearly a blurred line there) a voltage (or other channel type) and doesn't have the support on chip. Currently we have hwmon and input bridge drivers for iio
supported parts. Some channels are mapped to hwmon and some to input on the same underlying adc. The main interest is from the SoC side of thing where this sort of sharing is common. That's why Mark, Linus are Arnd are cc'd on this. I've also added Maxime given the at91 adc driver is a clasic example.

Quoted 5 lines
Quoted 3 lines

This look up table (which is just a list to allow the more complex boards to fill it from various places) serves that purpose.

And how is that shown by just a "bare" list being exported?

A bare is list only exported purely to allow to core parts of IIO to comunicate. Nothing else should ever touch that list. Yes it should have had some locking (I fully except that). It was a means of allowing IIO to remain buildable as a module. To my mind that is a good thing, you evidently disagree. Some input from the SoC guys here would be good.
If you need

Quoted 3 lines

to provide such a mapping, then by all means do so, but do so in a documented way with the proper locking for any data structures (which again, was the most obvious bug you had with this patch.)

I accept the locking and documentation points and will add those.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 3 lines

All but one function that touches this are in
the IIO core modules. I can wrap this up but only at considerable

cost

Quoted 1 line

(the wrappers will basically be the various list functions with a

lock taken

Quoted 1 line

- I'll add one of those). I can write extreme warnings around it

saying

Quoted 1 line

that it strictly for use by the IIO core. Would that be acceptable?

I still don't understand the point of the list. Why is this somehow different from any other bus in the kernel in that the only way to "register" a device is to actually register the device.

Quoted 7 lines
Quoted 4 lines

It is not for registering a device. It is for associations between devices. Similar to the regulator API. That provides a means to request a voltage from another device, this provides a means of reading from a device.

Ok, then show how that works somehow? Again, a list doesn't show that to me.

Read the functions using the list and you'll have your answer. You are focusing on the list when that really isn't the interface at all. I will happily write extremely dire warnings around that list if that helps.

Quoted 10 lines
Quoted 6 lines

Ultimately it's a convenient way of passing platform data. We could pass it into every single supplier device (in a similar way to regulators) as platform data. Thus every iio device would have to handle platform data and pass it on to the core, or, as here, we can separate it out.

Having a function for all of the drivers to call to provide this information seems like the most obvious way to do this in a proper way, why not do that?

Because that means replacing the current platform data of ever single driver. We can do this, but its messy and painful and breaks every current user (yes they are out of tree given we are in staging and hence can't have platform dat in tree - still I dislike pissing our users off.) The driver it self has no interest whatsoever in this data.

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 2 lines

Clearly this element should stay in the IIO directory once the rest

of

Quoted 1 line

the header has gone into include/linux/iio/. I can do that division

now

Quoted 5 lines

so the separation is more apparent.

So in summary two options exist.

1) Leave as is with a suitable warning and maybe rename to make it

appear

Quoted 2 lines

less friendly.
2) Wrap it so we end up with accessors that are pretty much the

standard

Quoted 1 line

list accessors just with one parameter fixed and trivial locking.

This isn't

Quoted 3 lines

too painful but seems conceptually wrong to me.
3) Move everything that uses it into the bit that gets built in even if IIO is a module.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

There should never be a "bit that is always built in if IIO is a module", sorry.

The only alternative is to make ever single IIO driver take platform data to specify it's consumers and immediately pass it into the core. It is only the core that cares.

What's wrong with a function call to the IIO core by the drivers?

Why pass data through them that they don't care about and won't touch?

Quoted 23 lines
Quoted 16 lines
Quoted 11 lines
Quoted 2 lines

This last one will lead to an explosion in what is exported from IIO

as we

Quoted 1 line

will still need to have the divide between the bit that can be

modular and

Quoted 2 lines

that which cannot somewhere! (which is why I didn't suggest it before).

Why are you trying to make such a strange distinction here? If a device
uses IIO, then you need to have the IIO core.

When that driver is loaded, not when the board file sets up it's association with IIO. It will not be dependent on the driver supplying the channel anyway so we will need the backoff and try again stuff to make this work.

Quoted 6 lines

Why have I done it like this?

Because this way we get a fairly clean addition to the subsystem without having to rewrite every single driver's probe routine which is the only other way making the data available that I can see.

Quoted 4 lines

Rewriting all probe functions really shouldn't be hard as you have to just change from manipulating this list by-hand, to making a function call. That sounds like an easy thing to do, and something that should be done, right?

That plus add a level of indirection to every driver that currently has any platform data (which covers the vast majority). Either the array of consumers has to be added to their existing pd which is clunky and driver specific or we have another structure with optional consumer data and another level of platform data to pass in what the driver actually cares about. Note throughout that we are passing data that is completely irrelevant to the driver. We are doing all this to support a usecase that isn't even relevant to many IIO drivers.

Quoted 10 lines
Quoted 7 lines
Quoted 3 lines

It can be built as a
module or not, again, just like any other bus in the kernel.

Bus maybe, but other subsystems providing a 'service' like we have here for iio such as regulators, pinmux etc cannot be built as modules. There the arguement was they were core to the board; that is not typically true of IIO.

Then keep the IIO core from being built as a module if that is the requirement here.

A painful cost just to avoid having this one list (with locking added). Not huge, but I really don't understand why this trivial list export such a problem. (though there were clearly elements that could be improved around it).
Note in the multiboard kernels that people are working for on for arm etc we would just have added this to all configurations if only one actually needs it.

Quoted 4 lines

Or, just be sure to initialize it early enough in the boot process that it happens before the drivers are, and then, it can be a module, as long as any driver that uses it is also a module, right?

There is a whole back off and try again infrastructure for module loading. Why not use that? (once/if it merges). There is no reason to get into the whole game of messing around with load orders.

Quoted 4 lines

Again, just like all other busses :)

thanks,

Glad this came up before I tried to push the non staging version as clearly there are questions to be addressed.

Jonathan

#13 lore raw

Re: [PATCH 3/5] staging:iio:core add in kernel interface mapping and getting IIO channels.

Quoted 7 lines · Jonathan Cameron
Quoted 4 lines · Greg KH

Rewriting all probe functions really shouldn't be hard as you have to just change from manipulating this list by-hand, to making a function call. That sounds like an easy thing to do, and something that should be done, right?

Quoted 8 lines

That plus add a level of indirection to every driver that currently has any platform data (which covers the vast majority). Either the array of consumers has to be added to their existing pd which is clunky and driver specific or we have another structure with optional consumer data and another level of platform data to pass in what the driver actually cares about. Note throughout that we are passing data that is completely irrelevant to the driver. We are doing all this to support a usecase that isn't even relevant to many IIO drivers.

FWIW the generic platform data embed thing is what the regulator API is currently doing, though of course we've got a bunch more data going in there in the constraints. This is actually a bit limiting as it means we need to know how things are glued together at registeration time, it'd be nice if we were able to add links in separately.

author maintainer
#14 lore raw

PATCH 4/5 staging:iio: move iio data return types into types.h for use by inkern

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

In kernel interfaces need these, so make them available.

---
 drivers/staging/iio/iio.h   |    6 ------
 drivers/staging/iio/types.h |    4 ++++
 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/staging/iio/iio.h +0 -6
index 4650a2b..e30d33d 100644
@@ -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;
 
drivers/staging/iio/types.h +4 -0
index f1f5ca2..b2ab217 100644
@@ -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.4
author maintainer
#15 lore raw

PATCH 5/5 staging:iio::hwmon interface client driver.

In reply to Jonathan Cameron

From: 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 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 235 insertions(+), 0 deletions(-)
drivers/staging/iio/Kconfig +8 -0
index 90162aa..f2c5db6 100644
@@ -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
index 04d6ad2..d5ca5cf 100644
@@ -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

Signature · 1 line
1.7.7.4