Linux IIO development
 help / color / mirror / Atom feed
* [PATCH 0/6] IIO cleanups
@ 2010-05-05 22:25 Jonathan Cameron
  2010-05-05 22:25 ` [PATCH 1/6] staging:iio:Documentation fixes Jonathan Cameron
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Jonathan Cameron @ 2010-05-05 22:25 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

Dear all these are mostly the promised incremental patches to move
the adis16400 and adis16300 drivers to the new abi.  Also in here
are some dead code removal.  Usual principal that code that isn't
used should not be there until it is needed.  Both the drivers
were in very good condition, so I've only touched them in superficial
ways.  Thanks Barry.

I do not think there is anything controversial in these so if I
don't hear any shouts I'll send them to Greg tomorrow.

Note I know there are plenty of other bit not meeting the abi
(and probably some more typos in the abi itself) but these were
the low hanging fruit today.

Jonathan

---

Jonathan Cameron (6):
  staging:iio:Documentation fixes
  staging:iio  Break up gyro.h and move to new abi
  staging:iio:adis16300 clean out some unused code
  staging:iio:Documentation update to add incli and switch to magn
  staging:iio:adis16400 clean out some unused code
  staging:iio:imu remove unecessary empty defs for event attributes.

 drivers/staging/iio/Documentation/sysfs-class-iio |   17 +++-
 drivers/staging/iio/accel/inclinometer.h          |   23 +++++
 drivers/staging/iio/gyro/gyro.h                   |   43 +---------
 drivers/staging/iio/imu/adis16300.h               |    9 --
 drivers/staging/iio/imu/adis16300_core.c          |   91 ++-------------------
 drivers/staging/iio/imu/adis16400.h               |    9 --
 drivers/staging/iio/imu/adis16400_core.c          |   75 ++---------------
 drivers/staging/iio/magnetometer/magnet.h         |   12 ++--
 8 files changed, 62 insertions(+), 217 deletions(-)
 create mode 100644 drivers/staging/iio/accel/inclinometer.h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/6] staging:iio:Documentation fixes
  2010-05-05 22:25 [PATCH 0/6] IIO cleanups Jonathan Cameron
@ 2010-05-05 22:25 ` Jonathan Cameron
  2010-05-05 22:25 ` [PATCH 2/6] staging:iio Break up gyro.h and move to new abi Jonathan Cameron
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2010-05-05 22:25 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/Documentation/sysfs-class-iio |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/Documentation/sysfs-class-iio b/drivers/staging/iio/Documentation/sysfs-class-iio
index 7238582..ff19f6e 100644
--- a/drivers/staging/iio/Documentation/sysfs-class-iio
+++ b/drivers/staging/iio/Documentation/sysfs-class-iio
@@ -66,7 +66,7 @@ KernelVersion:	2.6.35
 Contact:	linux-iio@vger.kernel.org
 Description:
 		If known for a device, offset to be added to in[m]_raw prior
-		to scaling by volt[m]_scale in order to obtain voltage in
+		to scaling by in[_name][m]_scale in order to obtain voltage in
 		millivolts.  Not present if the offset is always 0 or unknown.
 		If m is not present, then voltage offset applies to all in
 		channels. May be writable if a variable offset is controlled
@@ -111,8 +111,8 @@ KernelVersion:	2.6.35
 Contact:	linux-iio@vger.kernel.org
 Description:
 		If known for a device, scale to be applied to volt[m]_raw post
-		addition of volt[m]_offset in order to obtain the measured voltage
-		in millivolts.  If shared across all in channels then m is not present.
+		addition of in[_name][m]_offset in order to obtain the measured
+		voltage	in millivolts.  If shared across all in channels then			m is not present.
 
 What:		/sys/.../device[n]/in[m]-in[o]_raw
 KernelVersion:	2.6.35
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/6] staging:iio  Break up gyro.h and move to new abi
  2010-05-05 22:25 [PATCH 0/6] IIO cleanups Jonathan Cameron
  2010-05-05 22:25 ` [PATCH 1/6] staging:iio:Documentation fixes Jonathan Cameron
@ 2010-05-05 22:25 ` Jonathan Cameron
  2010-05-05 22:25 ` [PATCH 3/6] staging:iio:adis16300 clean out some unused code Jonathan Cameron
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2010-05-05 22:25 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/accel/inclinometer.h  |   23 +++++++++++++++
 drivers/staging/iio/gyro/gyro.h           |   43 +++--------------------------
 drivers/staging/iio/imu/adis16300_core.c  |   11 ++++---
 drivers/staging/iio/imu/adis16400_core.c  |   16 +++++-----
 drivers/staging/iio/magnetometer/magnet.h |   12 ++++----
 5 files changed, 47 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/iio/accel/inclinometer.h b/drivers/staging/iio/accel/inclinometer.h
new file mode 100644
index 0000000..5b49f83
--- /dev/null
+++ b/drivers/staging/iio/accel/inclinometer.h
@@ -0,0 +1,23 @@
+/*
+ * Inclinometer related attributes
+ */
+#include "../sysfs.h"
+
+#define IIO_DEV_ATTR_INCLI_X(_show, _addr)			\
+	IIO_DEVICE_ATTR(incli_x_raw, S_IRUGO, _show, NULL, _addr)
+
+#define IIO_DEV_ATTR_INCLI_Y(_show, _addr)			\
+	IIO_DEVICE_ATTR(incli_y_raw, S_IRUGO, _show, NULL, _addr)
+
+#define IIO_DEV_ATTR_INCLI_Z(_show, _addr)			\
+	IIO_DEVICE_ATTR(incli_z_raw, S_IRUGO, _show, NULL, _addr)
+
+#define IIO_DEV_ATTR_INCLI_X_OFFSET(_mode, _show, _store, _addr) \
+	IIO_DEVICE_ATTR(incli_x_offset, _mode, _show, _store, _addr)
+
+#define IIO_DEV_ATTR_INCLI_Y_OFFSET(_mode, _show, _store, _addr) \
+	IIO_DEVICE_ATTR(incli_y_offset, _mode, _show, _store, _addr)
+
+#define IIO_DEV_ATTR_INCLI_Z_OFFSET(_mode, _show, _store, _addr) \
+	IIO_DEVICE_ATTR(incli_z_offset, _mode, _show, _store, _addr)
+
diff --git a/drivers/staging/iio/gyro/gyro.h b/drivers/staging/iio/gyro/gyro.h
index 7c4dcf2..16f6ffa 100644
--- a/drivers/staging/iio/gyro/gyro.h
+++ b/drivers/staging/iio/gyro/gyro.h
@@ -28,49 +28,14 @@
 	IIO_DEVICE_ATTR(gyro_scale, S_IRUGO, _show, _store, _addr)
 
 #define IIO_DEV_ATTR_GYRO(_show, _addr)			\
-	IIO_DEVICE_ATTR(gyro, S_IRUGO, _show, NULL, _addr)
+	IIO_DEVICE_ATTR(gyro_raw, S_IRUGO, _show, NULL, _addr)
 
 #define IIO_DEV_ATTR_GYRO_X(_show, _addr)			\
-	IIO_DEVICE_ATTR(gyro_x, S_IRUGO, _show, NULL, _addr)
+	IIO_DEVICE_ATTR(gyro_x_raw, S_IRUGO, _show, NULL, _addr)
 
 #define IIO_DEV_ATTR_GYRO_Y(_show, _addr)			\
-	IIO_DEVICE_ATTR(gyro_y, S_IRUGO, _show, NULL, _addr)
+	IIO_DEVICE_ATTR(gyro_y_raw, S_IRUGO, _show, NULL, _addr)
 
 #define IIO_DEV_ATTR_GYRO_Z(_show, _addr)			\
-	IIO_DEVICE_ATTR(gyro_z, S_IRUGO, _show, NULL, _addr)
+	IIO_DEVICE_ATTR(gyro_z_raw, S_IRUGO, _show, NULL, _addr)
 
-#define IIO_DEV_ATTR_TEMP_X(_show, _addr)			\
-	IIO_DEVICE_ATTR(temp_x, S_IRUGO, _show, NULL, _addr)
-
-#define IIO_DEV_ATTR_TEMP_Y(_show, _addr)			\
-	IIO_DEVICE_ATTR(temp_y, S_IRUGO, _show, NULL, _addr)
-
-#define IIO_DEV_ATTR_TEMP_Z(_show, _addr)			\
-	IIO_DEVICE_ATTR(temp_z, S_IRUGO, _show, NULL, _addr)
-
-#define IIO_DEV_ATTR_INCLI_X(_show, _addr)			\
-	IIO_DEVICE_ATTR(incli_x, S_IRUGO, _show, NULL, _addr)
-
-#define IIO_DEV_ATTR_INCLI_Y(_show, _addr)			\
-	IIO_DEVICE_ATTR(incli_y, S_IRUGO, _show, NULL, _addr)
-
-#define IIO_DEV_ATTR_INCLI_Z(_show, _addr)			\
-	IIO_DEVICE_ATTR(incli_z, S_IRUGO, _show, NULL, _addr)
-
-#define IIO_DEV_ATTR_INCLI_X_OFFSET(_mode, _show, _store, _addr) \
-	IIO_DEVICE_ATTR(incli_x_offset, _mode, _show, _store, _addr)
-
-#define IIO_DEV_ATTR_INCLI_Y_OFFSET(_mode, _show, _store, _addr) \
-	IIO_DEVICE_ATTR(incli_y_offset, _mode, _show, _store, _addr)
-
-#define IIO_DEV_ATTR_INCLI_Z_OFFSET(_mode, _show, _store, _addr) \
-	IIO_DEVICE_ATTR(incli_z_offset, _mode, _show, _store, _addr)
-
-#define IIO_DEV_ATTR_ROT(_show, _addr)                    \
-	IIO_DEVICE_ATTR(rot, S_IRUGO, _show, NULL, _addr)
-
-#define IIO_DEV_ATTR_ROT_OFFSET(_mode, _show, _store, _addr) \
-	IIO_DEVICE_ATTR(rot_offset, _mode, _show, _store, _addr)
-
-#define IIO_DEV_ATTR_ANGL(_show, _addr)                         \
-	IIO_DEVICE_ATTR(angl, S_IRUGO, _show, NULL, _addr)
diff --git a/drivers/staging/iio/imu/adis16300_core.c b/drivers/staging/iio/imu/adis16300_core.c
index 9f5f8cb..b923ecc 100644
--- a/drivers/staging/iio/imu/adis16300_core.c
+++ b/drivers/staging/iio/imu/adis16300_core.c
@@ -21,6 +21,7 @@
 #include "../iio.h"
 #include "../sysfs.h"
 #include "../accel/accel.h"
+#include "../accel/inclinometer.h"
 #include "../gyro/gyro.h"
 #include "../adc/adc.h"
 
@@ -613,7 +614,7 @@ static IIO_DEV_ATTR_INCLI_Y(adis16300_read_13bit_signed,
 		ADIS16300_YINCLI_OUT);
 static IIO_CONST_ATTR(incli_scale, "0.044 d");
 
-static IIO_DEV_ATTR_TEMP(adis16300_read_12bit_signed);
+static IIO_DEV_ATTR_TEMP_RAW(adis16300_read_12bit_signed);
 static IIO_CONST_ATTR(temp_offset, "198.16 K");
 static IIO_CONST_ATTR(temp_scale, "0.14 K");
 
@@ -645,16 +646,16 @@ static struct attribute *adis16300_attributes[] = {
 	&iio_dev_attr_accel_z_offset.dev_attr.attr,
 	&iio_dev_attr_in_supply_raw.dev_attr.attr,
 	&iio_const_attr_in_supply_scale.dev_attr.attr,
-	&iio_dev_attr_gyro_x.dev_attr.attr,
+	&iio_dev_attr_gyro_x_raw.dev_attr.attr,
 	&iio_const_attr_gyro_scale.dev_attr.attr,
 	&iio_dev_attr_accel_x_raw.dev_attr.attr,
 	&iio_dev_attr_accel_y_raw.dev_attr.attr,
 	&iio_dev_attr_accel_z_raw.dev_attr.attr,
 	&iio_const_attr_accel_scale.dev_attr.attr,
-	&iio_dev_attr_incli_x.dev_attr.attr,
-	&iio_dev_attr_incli_y.dev_attr.attr,
+	&iio_dev_attr_incli_x_raw.dev_attr.attr,
+	&iio_dev_attr_incli_y_raw.dev_attr.attr,
 	&iio_const_attr_incli_scale.dev_attr.attr,
-	&iio_dev_attr_temp.dev_attr.attr,
+	&iio_dev_attr_temp_raw.dev_attr.attr,
 	&iio_const_attr_temp_offset.dev_attr.attr,
 	&iio_const_attr_temp_scale.dev_attr.attr,
 	&iio_dev_attr_in0_raw.dev_attr.attr,
diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c
index 27e4a73..868c526 100644
--- a/drivers/staging/iio/imu/adis16400_core.c
+++ b/drivers/staging/iio/imu/adis16400_core.c
@@ -626,7 +626,7 @@ static IIO_DEV_ATTR_MAGN_Z(adis16400_read_14bit_signed,
 static IIO_CONST_ATTR(magn_scale, "0.0005 Gs");
 
 
-static IIO_DEV_ATTR_TEMP(adis16400_read_12bit_signed);
+static IIO_DEV_ATTR_TEMP_RAW(adis16400_read_12bit_signed);
 static IIO_CONST_ATTR(temp_offset, "198.16 K");
 static IIO_CONST_ATTR(temp_scale, "0.14 K");
 
@@ -658,19 +658,19 @@ static struct attribute *adis16400_attributes[] = {
 	&iio_dev_attr_accel_z_offset.dev_attr.attr,
 	&iio_dev_attr_in_supply_raw.dev_attr.attr,
 	&iio_const_attr_in_supply_scale.dev_attr.attr,
-	&iio_dev_attr_gyro_x.dev_attr.attr,
-	&iio_dev_attr_gyro_y.dev_attr.attr,
-	&iio_dev_attr_gyro_z.dev_attr.attr,
+	&iio_dev_attr_gyro_x_raw.dev_attr.attr,
+	&iio_dev_attr_gyro_y_raw.dev_attr.attr,
+	&iio_dev_attr_gyro_z_raw.dev_attr.attr,
 	&iio_const_attr_gyro_scale.dev_attr.attr,
 	&iio_dev_attr_accel_x_raw.dev_attr.attr,
 	&iio_dev_attr_accel_y_raw.dev_attr.attr,
 	&iio_dev_attr_accel_z_raw.dev_attr.attr,
 	&iio_const_attr_accel_scale.dev_attr.attr,
-	&iio_dev_attr_magn_x.dev_attr.attr,
-	&iio_dev_attr_magn_y.dev_attr.attr,
-	&iio_dev_attr_magn_z.dev_attr.attr,
+	&iio_dev_attr_magn_x_raw.dev_attr.attr,
+	&iio_dev_attr_magn_y_raw.dev_attr.attr,
+	&iio_dev_attr_magn_z_raw.dev_attr.attr,
 	&iio_const_attr_magn_scale.dev_attr.attr,
-	&iio_dev_attr_temp.dev_attr.attr,
+	&iio_dev_attr_temp_raw.dev_attr.attr,
 	&iio_const_attr_temp_offset.dev_attr.attr,
 	&iio_const_attr_temp_scale.dev_attr.attr,
 	&iio_dev_attr_in0_raw.dev_attr.attr,
diff --git a/drivers/staging/iio/magnetometer/magnet.h b/drivers/staging/iio/magnetometer/magnet.h
index 6f6c6ed..6433830 100644
--- a/drivers/staging/iio/magnetometer/magnet.h
+++ b/drivers/staging/iio/magnetometer/magnet.h
@@ -21,11 +21,11 @@
 #define IIO_DEV_ATTR_MAGN_Z_GAIN(_mode, _show, _store, _addr)		\
 	IIO_DEVICE_ATTR(magn_z_gain, _mode, _show, _store, _addr)
 
-#define IIO_DEV_ATTR_MAGN_X(_show, _addr)			\
-	IIO_DEVICE_ATTR(magn_x, S_IRUGO, _show, NULL, _addr)
+#define IIO_DEV_ATTR_MAGN_X(_show, _addr)				\
+	IIO_DEVICE_ATTR(magn_x_raw, S_IRUGO, _show, NULL, _addr)
 
-#define IIO_DEV_ATTR_MAGN_Y(_show, _addr)			\
-	IIO_DEVICE_ATTR(magn_y, S_IRUGO, _show, NULL, _addr)
+#define IIO_DEV_ATTR_MAGN_Y(_show, _addr)				\
+	IIO_DEVICE_ATTR(magn_y_raw, S_IRUGO, _show, NULL, _addr)
 
-#define IIO_DEV_ATTR_MAGN_Z(_show, _addr)			\
-	IIO_DEVICE_ATTR(magn_z, S_IRUGO, _show, NULL, _addr)
+#define IIO_DEV_ATTR_MAGN_Z(_show, _addr)				\
+	IIO_DEVICE_ATTR(magn_z_raw, S_IRUGO, _show, NULL, _addr)
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/6] staging:iio:adis16300 clean out some unused code
  2010-05-05 22:25 [PATCH 0/6] IIO cleanups Jonathan Cameron
  2010-05-05 22:25 ` [PATCH 1/6] staging:iio:Documentation fixes Jonathan Cameron
  2010-05-05 22:25 ` [PATCH 2/6] staging:iio Break up gyro.h and move to new abi Jonathan Cameron
@ 2010-05-05 22:25 ` Jonathan Cameron
  2010-05-05 22:25 ` [PATCH 4/6] staging:iio:Documentation update to add incli and switch to magn Jonathan Cameron
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2010-05-05 22:25 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/imu/adis16300.h      |    9 ----
 drivers/staging/iio/imu/adis16300_core.c |   70 +-----------------------------
 2 files changed, 2 insertions(+), 77 deletions(-)

diff --git a/drivers/staging/iio/imu/adis16300.h b/drivers/staging/iio/imu/adis16300.h
index 77d890d..1c7ea5c 100644
--- a/drivers/staging/iio/imu/adis16300.h
+++ b/drivers/staging/iio/imu/adis16300.h
@@ -115,21 +115,12 @@ struct adis16300_state {
 	struct mutex			buf_lock;
 };
 
-int adis16300_spi_write_reg_8(struct device *dev,
-			      u8 reg_address,
-			      u8 val);
-
 int adis16300_spi_read_burst(struct device *dev, u8 *rx);
 
-int adis16300_spi_read_sequence(struct device *dev,
-				      u8 *tx, u8 *rx, int num);
-
 int adis16300_set_irq(struct device *dev, bool enable);
 
 int adis16300_reset(struct device *dev);
 
-int adis16300_stop_device(struct device *dev);
-
 int adis16300_check_status(struct device *dev);
 
 #ifdef CONFIG_IIO_RING_BUFFER
diff --git a/drivers/staging/iio/imu/adis16300_core.c b/drivers/staging/iio/imu/adis16300_core.c
index b923ecc..5a7e5ef 100644
--- a/drivers/staging/iio/imu/adis16300_core.c
+++ b/drivers/staging/iio/imu/adis16300_core.c
@@ -40,7 +40,7 @@
  * @reg_address: the address of the register to be written
  * @val: the value to write
  **/
-int adis16300_spi_write_reg_8(struct device *dev,
+static int adis16300_spi_write_reg_8(struct device *dev,
 		u8 reg_address,
 		u8 val)
 {
@@ -202,55 +202,6 @@ int adis16300_spi_read_burst(struct device *dev, u8 *rx)
 	return ret;
 }
 
-/**
- * adis16300_spi_read_sequence() - read a sequence of 16-bit registers
- * @dev: device associated with child of actual device (iio_dev or iio_trig)
- * @tx: register addresses in bytes 0,2,4,6... (min size is 2*num bytes)
- * @rx: somewhere to pass back the value read (min size is 2*num bytes)
- **/
-int adis16300_spi_read_sequence(struct device *dev,
-		u8 *tx, u8 *rx, int num)
-{
-	struct spi_message msg;
-	struct spi_transfer *xfers;
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
-	struct adis16300_state *st = iio_dev_get_devdata(indio_dev);
-	int ret, i;
-
-	xfers = kzalloc(num + 1, GFP_KERNEL);
-	if (xfers == NULL) {
-		dev_err(&st->us->dev, "memory alloc failed");
-		ret = -ENOMEM;
-		goto error_ret;
-	}
-
-	/* tx: |add1|addr2|addr3|...|addrN |zero|
-	 * rx: |zero|res1 |res2 |...|resN-1|resN| */
-	spi_message_init(&msg);
-	for (i = 0; i < num + 1; i++) {
-		if (i > 0)
-			xfers[i].rx_buf = st->rx + 2*(i - 1);
-		if (i < num)
-			xfers[i].tx_buf = st->tx + 2*i;
-		xfers[i].bits_per_word = 8;
-		xfers[i].len = 2;
-		xfers[i].cs_change = 1;
-		spi_message_add_tail(&xfers[i], &msg);
-	}
-
-	mutex_lock(&st->buf_lock);
-
-	ret = spi_sync(st->us, &msg);
-	if (ret)
-		dev_err(&st->us->dev, "problem when reading sequence");
-
-	mutex_unlock(&st->buf_lock);
-	kfree(xfers);
-
-error_ret:
-	return ret;
-}
-
 static ssize_t adis16300_spi_read_signed(struct device *dev,
 		struct device_attribute *attr,
 		char *buf,
@@ -458,7 +409,7 @@ int adis16300_reset(struct device *dev)
 }
 
 /* Power down the device */
-int adis16300_stop_device(struct device *dev)
+static int adis16300_stop_device(struct device *dev)
 {
 	int ret;
 	u16 val = ADIS16300_SLP_CNT_POWER_OFF;
@@ -470,23 +421,6 @@ int adis16300_stop_device(struct device *dev)
 	return ret;
 }
 
-int adis16300_self_test(struct device *dev)
-{
-	int ret;
-	ret = adis16300_spi_write_reg_16(dev,
-			ADIS16300_MSC_CTRL,
-			ADIS16300_MSC_CTRL_MEM_TEST);
-	if (ret) {
-		dev_err(dev, "problem starting self test");
-		goto err_ret;
-	}
-
-	adis16300_check_status(dev);
-
-err_ret:
-	return ret;
-}
-
 int adis16300_check_status(struct device *dev)
 {
 	u16 status;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/6] staging:iio:Documentation update to add incli and switch to magn
  2010-05-05 22:25 [PATCH 0/6] IIO cleanups Jonathan Cameron
                   ` (2 preceding siblings ...)
  2010-05-05 22:25 ` [PATCH 3/6] staging:iio:adis16300 clean out some unused code Jonathan Cameron
@ 2010-05-05 22:25 ` Jonathan Cameron
  2010-05-05 22:25 ` [PATCH 5/6] staging:iio:adis16400 clean out some unused code Jonathan Cameron
  2010-05-05 22:25 ` [PATCH 6/6] staging:iio:imu remove unecessary empty defs for event attributes Jonathan Cameron
  5 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2010-05-05 22:25 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/Documentation/sysfs-class-iio |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/iio/Documentation/sysfs-class-iio b/drivers/staging/iio/Documentation/sysfs-class-iio
index ff19f6e..714b4c5 100644
--- a/drivers/staging/iio/Documentation/sysfs-class-iio
+++ b/drivers/staging/iio/Documentation/sysfs-class-iio
@@ -143,7 +143,16 @@ Description:
 		Data converted by application of offset then scale to
 		radians per second. Has all the equivalent parameters as per in[m].
 
-What:		/sys/.../device[n]/mag[_x|_y|_z][m]_raw
+What:		/sys/.../device[n]/incli[_x|_y|_z][m]_raw
+KernelVersion:	2.6.35
+Contact:	linux-iio@vger.kernel.org
+Description:
+		Inclination raw reading about axis x, y or z (may be arbitarily
+		assigned) channel m (not present if only one inclinometer at
+		this orientation).  Data converted by application of offset
+		and scale to Degrees.
+
+What:		/sys/.../device[n]/magn[_x|_y|_z][m]_raw
 KernelVersion:	2.6.35
 Contact:	linux-iio@vger.kernel.org
 Description:
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/6] staging:iio:adis16400 clean out some unused code
  2010-05-05 22:25 [PATCH 0/6] IIO cleanups Jonathan Cameron
                   ` (3 preceding siblings ...)
  2010-05-05 22:25 ` [PATCH 4/6] staging:iio:Documentation update to add incli and switch to magn Jonathan Cameron
@ 2010-05-05 22:25 ` Jonathan Cameron
  2010-05-05 22:25 ` [PATCH 6/6] staging:iio:imu remove unecessary empty defs for event attributes Jonathan Cameron
  5 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2010-05-05 22:25 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/imu/adis16400.h      |    9 -----
 drivers/staging/iio/imu/adis16400_core.c |   49 ------------------------------
 2 files changed, 0 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/iio/imu/adis16400.h b/drivers/staging/iio/imu/adis16400.h
index a8062f6..5a69a7a 100644
--- a/drivers/staging/iio/imu/adis16400.h
+++ b/drivers/staging/iio/imu/adis16400.h
@@ -147,21 +147,12 @@ struct adis16400_state {
 	struct mutex			buf_lock;
 };
 
-int adis16400_spi_write_reg_8(struct device *dev,
-			      u8 reg_address,
-			      u8 val);
-
 int adis16400_spi_read_burst(struct device *dev, u8 *rx);
 
-int adis16400_spi_read_sequence(struct device *dev,
-				      u8 *tx, u8 *rx, int num);
-
 int adis16400_set_irq(struct device *dev, bool enable);
 
 int adis16400_reset(struct device *dev);
 
-int adis16400_stop_device(struct device *dev);
-
 int adis16400_check_status(struct device *dev);
 
 #ifdef CONFIG_IIO_RING_BUFFER
diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c
index 868c526..2c10072 100644
--- a/drivers/staging/iio/imu/adis16400_core.c
+++ b/drivers/staging/iio/imu/adis16400_core.c
@@ -209,55 +209,6 @@ int adis16400_spi_read_burst(struct device *dev, u8 *rx)
 	return ret;
 }
 
-/**
- * adis16400_spi_read_sequence() - read a sequence of 16-bit registers
- * @dev: device associated with child of actual device (iio_dev or iio_trig)
- * @tx: register addresses in bytes 0,2,4,6... (min size is 2*num bytes)
- * @rx: somewhere to pass back the value read (min size is 2*num bytes)
- **/
-int adis16400_spi_read_sequence(struct device *dev,
-		u8 *tx, u8 *rx, int num)
-{
-	struct spi_message msg;
-	struct spi_transfer *xfers;
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
-	struct adis16400_state *st = iio_dev_get_devdata(indio_dev);
-	int ret, i;
-
-	xfers = kzalloc(num + 1, GFP_KERNEL);
-	if (xfers == NULL) {
-		dev_err(&st->us->dev, "memory alloc failed");
-		ret = -ENOMEM;
-		goto error_ret;
-	}
-
-	/* tx: |add1|addr2|addr3|...|addrN |zero|
-	 * rx: |zero|res1 |res2 |...|resN-1|resN| */
-	spi_message_init(&msg);
-	for (i = 0; i < num + 1; i++) {
-		if (i > 0)
-			xfers[i].rx_buf = st->rx + 2*(i - 1);
-		if (i < num)
-			xfers[i].tx_buf = st->tx + 2*i;
-		xfers[i].bits_per_word = 8;
-		xfers[i].len = 2;
-		xfers[i].cs_change = 1;
-		spi_message_add_tail(&xfers[i], &msg);
-	}
-
-	mutex_lock(&st->buf_lock);
-
-	ret = spi_sync(st->us, &msg);
-	if (ret)
-		dev_err(&st->us->dev, "problem when reading sequence");
-
-	mutex_unlock(&st->buf_lock);
-	kfree(xfers);
-
-error_ret:
-	return ret;
-}
-
 static ssize_t adis16400_spi_read_signed(struct device *dev,
 		struct device_attribute *attr,
 		char *buf,
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/6] staging:iio:imu remove unecessary empty defs for event attributes.
  2010-05-05 22:25 [PATCH 0/6] IIO cleanups Jonathan Cameron
                   ` (4 preceding siblings ...)
  2010-05-05 22:25 ` [PATCH 5/6] staging:iio:adis16400 clean out some unused code Jonathan Cameron
@ 2010-05-05 22:25 ` Jonathan Cameron
  2010-05-06  3:27   ` Barry Song
  5 siblings, 1 reply; 9+ messages in thread
From: Jonathan Cameron @ 2010-05-05 22:25 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/imu/adis16300_core.c |   10 ----------
 drivers/staging/iio/imu/adis16400_core.c |   10 ----------
 2 files changed, 0 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/iio/imu/adis16300_core.c b/drivers/staging/iio/imu/adis16300_core.c
index 5a7e5ef..54e3e51 100644
--- a/drivers/staging/iio/imu/adis16300_core.c
+++ b/drivers/staging/iio/imu/adis16300_core.c
@@ -566,14 +566,6 @@ static IIO_CONST_ATTR_AVAIL_SAMP_FREQ("409 546 819 1638");
 
 static IIO_CONST_ATTR(name, "adis16300");
 
-static struct attribute *adis16300_event_attributes[] = {
-	NULL
-};
-
-static struct attribute_group adis16300_event_attribute_group = {
-	.attrs = adis16300_event_attributes,
-};
-
 static struct attribute *adis16300_attributes[] = {
 	&iio_dev_attr_accel_x_offset.dev_attr.attr,
 	&iio_dev_attr_accel_y_offset.dev_attr.attr,
@@ -637,8 +629,6 @@ static int __devinit adis16300_probe(struct spi_device *spi)
 	}
 
 	st->indio_dev->dev.parent = &spi->dev;
-	st->indio_dev->num_interrupt_lines = 1;
-	st->indio_dev->event_attrs = &adis16300_event_attribute_group;
 	st->indio_dev->attrs = &adis16300_attribute_group;
 	st->indio_dev->dev_data = (void *)(st);
 	st->indio_dev->driver_module = THIS_MODULE;
diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c
index 2c10072..34c0ee5 100644
--- a/drivers/staging/iio/imu/adis16400_core.c
+++ b/drivers/staging/iio/imu/adis16400_core.c
@@ -595,14 +595,6 @@ static IIO_CONST_ATTR_AVAIL_SAMP_FREQ("409 546 819 1638");
 
 static IIO_CONST_ATTR(name, "adis16400");
 
-static struct attribute *adis16400_event_attributes[] = {
-	NULL
-};
-
-static struct attribute_group adis16400_event_attribute_group = {
-	.attrs = adis16400_event_attributes,
-};
-
 static struct attribute *adis16400_attributes[] = {
 	&iio_dev_attr_accel_x_offset.dev_attr.attr,
 	&iio_dev_attr_accel_y_offset.dev_attr.attr,
@@ -669,8 +661,6 @@ static int __devinit adis16400_probe(struct spi_device *spi)
 	}
 
 	st->indio_dev->dev.parent = &spi->dev;
-	st->indio_dev->num_interrupt_lines = 1;
-	st->indio_dev->event_attrs = &adis16400_event_attribute_group;
 	st->indio_dev->attrs = &adis16400_attribute_group;
 	st->indio_dev->dev_data = (void *)(st);
 	st->indio_dev->driver_module = THIS_MODULE;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 6/6] staging:iio:imu remove unecessary empty defs for event attributes.
  2010-05-05 22:25 ` [PATCH 6/6] staging:iio:imu remove unecessary empty defs for event attributes Jonathan Cameron
@ 2010-05-06  3:27   ` Barry Song
  2010-05-06 10:14     ` Jonathan Cameron
  0 siblings, 1 reply; 9+ messages in thread
From: Barry Song @ 2010-05-06  3:27 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio

Does this patch work in the newest tree? In our current tree, it will
cause kernel panic in iio_register_interrupt_line() due to NULL
pointer.
-barry

On Thu, May 6, 2010 at 6:25 AM, Jonathan Cameron <jic23@cam.ac.uk> wrote:
>
> Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
> ---
> =C2=A0drivers/staging/iio/imu/adis16300_core.c | =C2=A0 10 ----------
> =C2=A0drivers/staging/iio/imu/adis16400_core.c | =C2=A0 10 ----------
> =C2=A02 files changed, 0 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/staging/iio/imu/adis16300_core.c b/drivers/staging/i=
io/imu/adis16300_core.c
> index 5a7e5ef..54e3e51 100644
> --- a/drivers/staging/iio/imu/adis16300_core.c
> +++ b/drivers/staging/iio/imu/adis16300_core.c
> @@ -566,14 +566,6 @@ static IIO_CONST_ATTR_AVAIL_SAMP_FREQ("409 546 819 1=
638");
>
> =C2=A0static IIO_CONST_ATTR(name, "adis16300");
>
> -static struct attribute *adis16300_event_attributes[] =3D {
> - =C2=A0 =C2=A0 =C2=A0 NULL
> -};
> -
> -static struct attribute_group adis16300_event_attribute_group =3D {
> - =C2=A0 =C2=A0 =C2=A0 .attrs =3D adis16300_event_attributes,
> -};
> -
> =C2=A0static struct attribute *adis16300_attributes[] =3D {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0&iio_dev_attr_accel_x_offset.dev_attr.attr,
> =C2=A0 =C2=A0 =C2=A0 =C2=A0&iio_dev_attr_accel_y_offset.dev_attr.attr,
> @@ -637,8 +629,6 @@ static int __devinit adis16300_probe(struct spi_devic=
e *spi)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0st->indio_dev->dev.parent =3D &spi->dev;
> - =C2=A0 =C2=A0 =C2=A0 st->indio_dev->num_interrupt_lines =3D 1;
> - =C2=A0 =C2=A0 =C2=A0 st->indio_dev->event_attrs =3D &adis16300_event_at=
tribute_group;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0st->indio_dev->attrs =3D &adis16300_attribute_=
group;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0st->indio_dev->dev_data =3D (void *)(st);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0st->indio_dev->driver_module =3D THIS_MODULE;
> diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/i=
io/imu/adis16400_core.c
> index 2c10072..34c0ee5 100644
> --- a/drivers/staging/iio/imu/adis16400_core.c
> +++ b/drivers/staging/iio/imu/adis16400_core.c
> @@ -595,14 +595,6 @@ static IIO_CONST_ATTR_AVAIL_SAMP_FREQ("409 546 819 1=
638");
>
> =C2=A0static IIO_CONST_ATTR(name, "adis16400");
>
> -static struct attribute *adis16400_event_attributes[] =3D {
> - =C2=A0 =C2=A0 =C2=A0 NULL
> -};
> -
> -static struct attribute_group adis16400_event_attribute_group =3D {
> - =C2=A0 =C2=A0 =C2=A0 .attrs =3D adis16400_event_attributes,
> -};
> -
> =C2=A0static struct attribute *adis16400_attributes[] =3D {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0&iio_dev_attr_accel_x_offset.dev_attr.attr,
> =C2=A0 =C2=A0 =C2=A0 =C2=A0&iio_dev_attr_accel_y_offset.dev_attr.attr,
> @@ -669,8 +661,6 @@ static int __devinit adis16400_probe(struct spi_devic=
e *spi)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0st->indio_dev->dev.parent =3D &spi->dev;
> - =C2=A0 =C2=A0 =C2=A0 st->indio_dev->num_interrupt_lines =3D 1;
> - =C2=A0 =C2=A0 =C2=A0 st->indio_dev->event_attrs =3D &adis16400_event_at=
tribute_group;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0st->indio_dev->attrs =3D &adis16400_attribute_=
group;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0st->indio_dev->dev_data =3D (void *)(st);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0st->indio_dev->driver_module =3D THIS_MODULE;
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at =C2=A0http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 6/6] staging:iio:imu remove unecessary empty defs for event attributes.
  2010-05-06  3:27   ` Barry Song
@ 2010-05-06 10:14     ` Jonathan Cameron
  0 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2010-05-06 10:14 UTC (permalink / raw)
  To: Barry Song; +Cc: linux-iio

On 05/06/10 04:27, Barry Song wrote:
> Does this patch work in the newest tree? In our current tree, it will
> cause kernel panic in iio_register_interrupt_line() due to NULL
> pointer.
Yikes.  That's a bug if it does. If nothing else it should kick out an error
rather than a kernel panic as it is clearly something that might be the case
in half developed drivers.

Ah, I missed the fact you were calling iio_register_interrupt_line, which to
my mind makes no sense in this driver.  Here, you aren't actually using the
interrupt for any events.  I think some confusion has occured in the interaction
between the trigger and the event lines (due to some decidedly dubious function
names on my part!).

A trigger irq can be handled separately (as per iio-trig-gpio).
That would mean you weren't calling the iio_register_interrupt_line function
at all and is what I'd tend to expect for a line without additional events.

As it doesn't make sense to have an 'interrupt line' (which is actually an event line)
available unless there are actual events that might come down it, I didn't allow for
this in the code.

The question on these devices is whether to support the trigger and events sharing
a line, or whether we just assume that several of the available interrupt lines are
connected and the event comes down one of them?

The approach used in the lis3l02dq (where I think the approach used here probably
started) is necessary as it only has one interrupt line.  IIRC it is a mutually
exclusive line at that, you either get events or data rdy according to the settings.

Thanks for spotting this one.  Goes to show that even seemingly inocuous patches
can cause trouble!

Jonathan
> -barry
> 
> On Thu, May 6, 2010 at 6:25 AM, Jonathan Cameron <jic23@cam.ac.uk> wrote:
>>
>> Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
>> ---
>>  drivers/staging/iio/imu/adis16300_core.c |   10 ----------
>>  drivers/staging/iio/imu/adis16400_core.c |   10 ----------
>>  2 files changed, 0 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/staging/iio/imu/adis16300_core.c b/drivers/staging/iio/imu/adis16300_core.c
>> index 5a7e5ef..54e3e51 100644
>> --- a/drivers/staging/iio/imu/adis16300_core.c
>> +++ b/drivers/staging/iio/imu/adis16300_core.c
>> @@ -566,14 +566,6 @@ static IIO_CONST_ATTR_AVAIL_SAMP_FREQ("409 546 819 1638");
>>
>>  static IIO_CONST_ATTR(name, "adis16300");
>>
>> -static struct attribute *adis16300_event_attributes[] = {
>> -       NULL
>> -};
>> -
>> -static struct attribute_group adis16300_event_attribute_group = {
>> -       .attrs = adis16300_event_attributes,
>> -};
>> -
>>  static struct attribute *adis16300_attributes[] = {
>>        &iio_dev_attr_accel_x_offset.dev_attr.attr,
>>        &iio_dev_attr_accel_y_offset.dev_attr.attr,
>> @@ -637,8 +629,6 @@ static int __devinit adis16300_probe(struct spi_device *spi)
>>        }
>>
>>        st->indio_dev->dev.parent = &spi->dev;
>> -       st->indio_dev->num_interrupt_lines = 1;
>> -       st->indio_dev->event_attrs = &adis16300_event_attribute_group;
>>        st->indio_dev->attrs = &adis16300_attribute_group;
>>        st->indio_dev->dev_data = (void *)(st);
>>        st->indio_dev->driver_module = THIS_MODULE;
>> diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c
>> index 2c10072..34c0ee5 100644
>> --- a/drivers/staging/iio/imu/adis16400_core.c
>> +++ b/drivers/staging/iio/imu/adis16400_core.c
>> @@ -595,14 +595,6 @@ static IIO_CONST_ATTR_AVAIL_SAMP_FREQ("409 546 819 1638");
>>
>>  static IIO_CONST_ATTR(name, "adis16400");
>>
>> -static struct attribute *adis16400_event_attributes[] = {
>> -       NULL
>> -};
>> -
>> -static struct attribute_group adis16400_event_attribute_group = {
>> -       .attrs = adis16400_event_attributes,
>> -};
>> -
>>  static struct attribute *adis16400_attributes[] = {
>>        &iio_dev_attr_accel_x_offset.dev_attr.attr,
>>        &iio_dev_attr_accel_y_offset.dev_attr.attr,
>> @@ -669,8 +661,6 @@ static int __devinit adis16400_probe(struct spi_device *spi)
>>        }
>>
>>        st->indio_dev->dev.parent = &spi->dev;
>> -       st->indio_dev->num_interrupt_lines = 1;
>> -       st->indio_dev->event_attrs = &adis16400_event_attribute_group;
>>        st->indio_dev->attrs = &adis16400_attribute_group;
>>        st->indio_dev->dev_data = (void *)(st);
>>        st->indio_dev->driver_module = THIS_MODULE;
>> --
>> 1.7.0.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-05-06 10:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-05 22:25 [PATCH 0/6] IIO cleanups Jonathan Cameron
2010-05-05 22:25 ` [PATCH 1/6] staging:iio:Documentation fixes Jonathan Cameron
2010-05-05 22:25 ` [PATCH 2/6] staging:iio Break up gyro.h and move to new abi Jonathan Cameron
2010-05-05 22:25 ` [PATCH 3/6] staging:iio:adis16300 clean out some unused code Jonathan Cameron
2010-05-05 22:25 ` [PATCH 4/6] staging:iio:Documentation update to add incli and switch to magn Jonathan Cameron
2010-05-05 22:25 ` [PATCH 5/6] staging:iio:adis16400 clean out some unused code Jonathan Cameron
2010-05-05 22:25 ` [PATCH 6/6] staging:iio:imu remove unecessary empty defs for event attributes Jonathan Cameron
2010-05-06  3:27   ` Barry Song
2010-05-06 10:14     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox