* [PATCH 1/6] IIO-work: meter: ade7758: Update trigger to the new API
@ 2011-05-11 14:26 michael.hennerich
2011-05-11 14:26 ` [PATCH 2/6] IIO-work: meter: ade7758: Fix timing on SPI read accessor functions michael.hennerich
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: michael.hennerich @ 2011-05-11 14:26 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, drivers, device-drivers-devel, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Update trigger to the new API.
Add file comment/license header.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/staging/iio/meter/ade7758_trigger.c | 43 ++++++++++----------------
1 files changed, 17 insertions(+), 26 deletions(-)
diff --git a/drivers/staging/iio/meter/ade7758_trigger.c b/drivers/staging/iio/meter/ade7758_trigger.c
index 0adfcc6..f792ccd 100644
--- a/drivers/staging/iio/meter/ade7758_trigger.c
+++ b/drivers/staging/iio/meter/ade7758_trigger.c
@@ -1,3 +1,11 @@
+/*
+ * ADE7758 Poly Phase Multifunction Energy Metering IC driver
+ *
+ * Copyright 2010-2011 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2.
+ */
+
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/mutex.h>
@@ -19,20 +27,10 @@ static irqreturn_t ade7758_data_rdy_trig_poll(int irq, void *private)
{
disable_irq_nosync(irq);
iio_trigger_poll(private, iio_get_time_ns());
+
return IRQ_HANDLED;
}
-static DEVICE_ATTR(name, S_IRUGO, iio_trigger_read_name, NULL);
-
-static struct attribute *ade7758_trigger_attrs[] = {
- &dev_attr_name.attr,
- NULL,
-};
-
-static const struct attribute_group ade7758_trigger_attr_group = {
- .attrs = ade7758_trigger_attrs,
-};
-
/**
* ade7758_data_rdy_trigger_set_state() set datardy interrupt state
**/
@@ -53,6 +51,7 @@ static int ade7758_data_rdy_trigger_set_state(struct iio_trigger *trig,
static int ade7758_trig_try_reen(struct iio_trigger *trig)
{
struct ade7758_state *st = trig->private_data;
+
enable_irq(st->us->irq);
/* irq reenabled so success! */
return 0;
@@ -63,43 +62,36 @@ int ade7758_probe_trigger(struct iio_dev *indio_dev)
int ret;
struct ade7758_state *st = indio_dev->dev_data;
-
- st->trig = iio_allocate_trigger();
+ st->trig = iio_allocate_trigger("%s-dev%d",
+ spi_get_device_id(st->us)->name,
+ indio_dev->id);
if (st->trig == NULL) {
ret = -ENOMEM;
goto error_ret;
}
+
ret = request_irq(st->us->irq,
ade7758_data_rdy_trig_poll,
- IRQF_TRIGGER_FALLING, "ade7758",
+ IRQF_TRIGGER_LOW,
+ spi_get_device_id(st->us)->name,
st->trig);
if (ret)
goto error_free_trig;
- st->trig->name = kasprintf(GFP_KERNEL,
- "ade7758-dev%d",
- indio_dev->id);
- if (!st->trig->name) {
- ret = -ENOMEM;
- goto error_free_irq;
- }
st->trig->dev.parent = &st->us->dev;
st->trig->owner = THIS_MODULE;
st->trig->private_data = st;
st->trig->set_trigger_state = &ade7758_data_rdy_trigger_set_state;
st->trig->try_reenable = &ade7758_trig_try_reen;
- st->trig->control_attrs = &ade7758_trigger_attr_group;
ret = iio_trigger_register(st->trig);
/* select default trigger */
indio_dev->trig = st->trig;
if (ret)
- goto error_free_trig_name;
+ goto error_free_irq;
return 0;
-error_free_trig_name:
- kfree(st->trig->name);
error_free_irq:
free_irq(st->us->irq, st->trig);
error_free_trig:
@@ -113,7 +105,6 @@ void ade7758_remove_trigger(struct iio_dev *indio_dev)
struct ade7758_state *state = indio_dev->dev_data;
iio_trigger_unregister(state->trig);
- kfree(state->trig->name);
free_irq(state->us->irq, state->trig);
iio_free_trigger(state->trig);
}
--
1.6.0.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/6] IIO-work: meter: ade7758: Fix timing on SPI read accessor functions.
2011-05-11 14:26 [PATCH 1/6] IIO-work: meter: ade7758: Update trigger to the new API michael.hennerich
@ 2011-05-11 14:26 ` michael.hennerich
2011-05-11 14:26 ` [PATCH 3/6] IIO-work: meter: ade7758: Fix return value of ade7758_write_reset michael.hennerich
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: michael.hennerich @ 2011-05-11 14:26 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, drivers, device-drivers-devel, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
According to the ADE7758 datasheet the minimum time between read command
(that is, a write to communication register) and data read must not be
less than 4us.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/staging/iio/meter/ade7758_core.c | 43 +++++++++++++++++++++++-------
1 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
index c9956c4..8cfb617 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -100,7 +100,7 @@ static int ade7758_spi_write_reg_24(struct device *dev,
return ret;
}
-static int ade7758_spi_read_reg_8(struct device *dev,
+int ade7758_spi_read_reg_8(struct device *dev,
u8 reg_address,
u8 *val)
{
@@ -111,9 +111,15 @@ static int ade7758_spi_read_reg_8(struct device *dev,
struct spi_transfer xfers[] = {
{
.tx_buf = st->tx,
+ .bits_per_word = 8,
+ .len = 1,
+ .delay_usecs = 4,
+ },
+ {
+ .tx_buf = &st->tx[1],
.rx_buf = st->rx,
.bits_per_word = 8,
- .len = 2,
+ .len = 1,
},
};
@@ -122,14 +128,15 @@ static int ade7758_spi_read_reg_8(struct device *dev,
st->tx[1] = 0;
spi_message_init(&msg);
- spi_message_add_tail(xfers, &msg);
+ spi_message_add_tail(&xfers[0], &msg);
+ spi_message_add_tail(&xfers[1], &msg);
ret = spi_sync(st->us, &msg);
if (ret) {
dev_err(&st->us->dev, "problem when reading 8 bit register 0x%02X",
reg_address);
goto error_ret;
}
- *val = st->rx[1];
+ *val = st->rx[0];
error_ret:
mutex_unlock(&st->buf_lock);
@@ -147,26 +154,35 @@ static int ade7758_spi_read_reg_16(struct device *dev,
struct spi_transfer xfers[] = {
{
.tx_buf = st->tx,
+ .bits_per_word = 8,
+ .len = 1,
+ .delay_usecs = 4,
+ },
+ {
+ .tx_buf = &st->tx[1],
.rx_buf = st->rx,
.bits_per_word = 8,
- .len = 3,
+ .len = 2,
},
};
+
mutex_lock(&st->buf_lock);
st->tx[0] = ADE7758_READ_REG(reg_address);
st->tx[1] = 0;
st->tx[2] = 0;
spi_message_init(&msg);
- spi_message_add_tail(xfers, &msg);
+ spi_message_add_tail(&xfers[0], &msg);
+ spi_message_add_tail(&xfers[1], &msg);
ret = spi_sync(st->us, &msg);
if (ret) {
dev_err(&st->us->dev, "problem when reading 16 bit register 0x%02X",
reg_address);
goto error_ret;
}
- *val = (st->rx[1] << 8) | st->rx[2];
+
+ *val = (st->rx[0] << 8) | st->rx[1];
error_ret:
mutex_unlock(&st->buf_lock);
@@ -184,9 +200,15 @@ static int ade7758_spi_read_reg_24(struct device *dev,
struct spi_transfer xfers[] = {
{
.tx_buf = st->tx,
+ .bits_per_word = 8,
+ .len = 1,
+ .delay_usecs = 4,
+ },
+ {
+ .tx_buf = &st->tx[1],
.rx_buf = st->rx,
.bits_per_word = 8,
- .len = 4,
+ .len = 3,
},
};
@@ -197,14 +219,15 @@ static int ade7758_spi_read_reg_24(struct device *dev,
st->tx[3] = 0;
spi_message_init(&msg);
- spi_message_add_tail(xfers, &msg);
+ spi_message_add_tail(&xfers[0], &msg);
+ spi_message_add_tail(&xfers[1], &msg);
ret = spi_sync(st->us, &msg);
if (ret) {
dev_err(&st->us->dev, "problem when reading 24 bit register 0x%02X",
reg_address);
goto error_ret;
}
- *val = (st->rx[1] << 16) | (st->rx[2] << 8) | st->rx[3];
+ *val = (st->rx[0] << 16) | (st->rx[1] << 8) | st->rx[2];
error_ret:
mutex_unlock(&st->buf_lock);
--
1.6.0.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/6] IIO-work: meter: ade7758: Fix return value of ade7758_write_reset
2011-05-11 14:26 [PATCH 1/6] IIO-work: meter: ade7758: Update trigger to the new API michael.hennerich
2011-05-11 14:26 ` [PATCH 2/6] IIO-work: meter: ade7758: Fix timing on SPI read accessor functions michael.hennerich
@ 2011-05-11 14:26 ` michael.hennerich
2011-05-11 14:26 ` [PATCH 4/6] IIO-work: meter: ade7758: Fix list and set of available sample frequencies michael.hennerich
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: michael.hennerich @ 2011-05-11 14:26 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, drivers, device-drivers-devel, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Update file comment/license header.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/staging/iio/meter/ade7758_core.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
index 8cfb617..971b247 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -1,9 +1,9 @@
/*
- * ADE7758 Polyphase Multifunction Energy Metering IC Driver
+ * ADE7758 Poly Phase Multifunction Energy Metering IC driver
*
- * Copyright 2010 Analog Devices Inc.
+ * Copyright 2010-2011 Analog Devices Inc.
*
- * Licensed under the GPL-2 or later.
+ * Licensed under the GPL-2.
*/
#include <linux/interrupt.h>
@@ -342,7 +342,7 @@ static ssize_t ade7758_write_reset(struct device *dev,
case 'Y':
return ade7758_reset(dev);
}
- return -1;
+ return len;
}
static IIO_DEV_ATTR_VPEAK(S_IWUSR | S_IRUGO,
--
1.6.0.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/6] IIO-work: meter: ade7758: Fix list and set of available sample frequencies.
2011-05-11 14:26 [PATCH 1/6] IIO-work: meter: ade7758: Update trigger to the new API michael.hennerich
2011-05-11 14:26 ` [PATCH 2/6] IIO-work: meter: ade7758: Fix timing on SPI read accessor functions michael.hennerich
2011-05-11 14:26 ` [PATCH 3/6] IIO-work: meter: ade7758: Fix return value of ade7758_write_reset michael.hennerich
@ 2011-05-11 14:26 ` michael.hennerich
2011-05-11 14:26 ` [PATCH 5/6] IIO-work: meter: ade7758: Use iio channel spec and miscellaneous other changes michael.hennerich
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: michael.hennerich @ 2011-05-11 14:26 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, drivers, device-drivers-devel, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Fix list of available sample frequencies.
Fix ade7758_write_frequency().
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/staging/iio/meter/ade7758_core.c | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
index 971b247..b2d7345 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -533,7 +533,6 @@ static ssize_t ade7758_write_frequency(struct device *dev,
size_t len)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct ade7758_state *st = iio_dev_get_devdata(indio_dev);
unsigned long val;
int ret;
u8 reg, t;
@@ -544,14 +543,23 @@ static ssize_t ade7758_write_frequency(struct device *dev,
mutex_lock(&indio_dev->mlock);
- t = (26040 / val);
- if (t > 0)
- t >>= 1;
-
- if (t > 1)
- st->us->max_speed_hz = ADE7758_SPI_SLOW;
- else
- st->us->max_speed_hz = ADE7758_SPI_FAST;
+ switch (val) {
+ case 26040:
+ t = 0;
+ break;
+ case 13020:
+ t = 1;
+ break;
+ case 6510:
+ t = 2;
+ break;
+ case 3255:
+ t = 3;
+ break;
+ default:
+ ret = -EINVAL;
+ goto out;
+ }
ret = ade7758_spi_read_reg_8(dev,
ADE7758_WAVMODE,
@@ -671,7 +679,7 @@ static IIO_DEV_ATTR_WAVEFORM_TYPE(S_IWUSR | S_IRUGO,
static IIO_DEV_ATTR_RESET(ade7758_write_reset);
-static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("26000 13000 65000 33000");
+static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("26040 13020 6510 3255");
static struct attribute *ade7758_attributes[] = {
&iio_dev_attr_temp_raw.dev_attr.attr,
--
1.6.0.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/6] IIO-work: meter: ade7758: Use iio channel spec and miscellaneous other changes.
2011-05-11 14:26 [PATCH 1/6] IIO-work: meter: ade7758: Update trigger to the new API michael.hennerich
` (2 preceding siblings ...)
2011-05-11 14:26 ` [PATCH 4/6] IIO-work: meter: ade7758: Fix list and set of available sample frequencies michael.hennerich
@ 2011-05-11 14:26 ` michael.hennerich
2011-05-11 14:27 ` [PATCH 6/6] IIO-work: meter: ade7758: Use private data space from iio_allocate_device michael.hennerich
2011-05-11 15:48 ` [PATCH 1/6] IIO-work: meter: ade7758: Update trigger to the new API Jonathan Cameron
5 siblings, 0 replies; 8+ messages in thread
From: michael.hennerich @ 2011-05-11 14:26 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, drivers, device-drivers-devel, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Use iio channel spec for the ring buffer channels.
Add/update file comment/license headers.
Use available_scan_masks to prevent that multiple channels are enabled.
Remove wavefrom type attributes. (no handled directly by the scan_elements)
Use SPI_MODE_1.
Move ade7758_initial_setup() before ade7758_probe_trigger() to ensure the
ADE7758 interrupt is disabled when the host interrupt get's enabled.
Add spi_device_id.
Update ring buffer setup.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/staging/iio/meter/ade7758.h | 66 ++++++---
drivers/staging/iio/meter/ade7758_core.c | 173 +++++++++++-----------
drivers/staging/iio/meter/ade7758_ring.c | 235 ++++++++++++++++--------------
3 files changed, 262 insertions(+), 212 deletions(-)
diff --git a/drivers/staging/iio/meter/ade7758.h b/drivers/staging/iio/meter/ade7758.h
index 169982b..a516527 100644
--- a/drivers/staging/iio/meter/ade7758.h
+++ b/drivers/staging/iio/meter/ade7758.h
@@ -1,3 +1,11 @@
+/*
+ * ADE7758 Poly Phase Multifunction Energy Metering IC driver
+ *
+ * Copyright 2010-2011 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2.
+ */
+
#ifndef _ADE7758_H
#define _ADE7758_H
@@ -83,12 +91,23 @@
#define ADE7758_MAX_RX 4
#define ADE7758_STARTUP_DELAY 1
-#define ADE7758_SPI_SLOW (u32)(300 * 1000)
-#define ADE7758_SPI_BURST (u32)(1000 * 1000)
-#define ADE7758_SPI_FAST (u32)(2000 * 1000)
+#define AD7758_NUM_WAVSEL 5
+#define AD7758_NUM_PHSEL 3
+#define AD7758_NUM_WAVESRC (AD7758_NUM_WAVSEL * AD7758_NUM_PHSEL)
+
+#define AD7758_PHASE_A 0
+#define AD7758_PHASE_B 1
+#define AD7758_PHASE_C 2
+#define AD7758_CURRENT 0
+#define AD7758_VOLTAGE 1
+#define AD7758_ACT_PWR 2
+#define AD7758_REACT_PWR 3
+#define AD7758_APP_PWR 4
+#define AD7758_WT(p, w) (((w) << 2) | (p))
#define DRIVER_NAME "ade7758"
+
/**
* struct ade7758_state - device instance specific data
* @us: actual spi_device
@@ -99,22 +118,29 @@
* @buf_lock: mutex to protect tx and rx
**/
struct ade7758_state {
- struct spi_device *us;
- struct iio_dev *indio_dev;
- struct iio_trigger *trig;
- u8 *tx;
- u8 *rx;
- struct mutex buf_lock;
+ struct spi_device *us;
+ struct iio_dev *indio_dev;
+ struct iio_trigger *trig;
+ u8 *tx;
+ u8 *rx;
+ struct mutex buf_lock;
+ u32 available_scan_masks[AD7758_NUM_WAVESRC];
+ struct iio_chan_spec *ade7758_ring_channels;
+ struct spi_transfer ring_xfer[4];
+ struct spi_message ring_msg;
+ /*
+ * DMA (thus cache coherency maintenance) requires the
+ * transfer buffers to live in their own cache lines.
+ */
+ unsigned char rx_buf[8] ____cacheline_aligned;
+ unsigned char tx_buf[8];
+
};
#ifdef CONFIG_IIO_RING_BUFFER
/* At the moment triggers are only used for ring buffer
* filling. This may change!
*/
-enum ade7758_scan {
- ADE7758_SCAN_WFORM,
-};
-
void ade7758_remove_trigger(struct iio_dev *indio_dev);
int ade7758_probe_trigger(struct iio_dev *indio_dev);
@@ -129,6 +155,12 @@ void ade7758_unconfigure_ring(struct iio_dev *indio_dev);
int ade7758_initialize_ring(struct iio_ring_buffer *ring);
void ade7758_uninitialize_ring(struct iio_ring_buffer *ring);
int ade7758_set_irq(struct device *dev, bool enable);
+
+int ade7758_spi_write_reg_8(struct device *dev,
+ u8 reg_address, u8 val);
+int ade7758_spi_read_reg_8(struct device *dev,
+ u8 reg_address, u8 *val);
+
#else /* CONFIG_IIO_RING_BUFFER */
static inline void ade7758_remove_trigger(struct iio_dev *indio_dev)
@@ -139,14 +171,6 @@ static inline int ade7758_probe_trigger(struct iio_dev *indio_dev)
return 0;
}
-static inline ssize_t
-ade7758_read_data_from_ring(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- return 0;
-}
-
static int ade7758_configure_ring(struct iio_dev *indio_dev)
{
return 0;
diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
index b2d7345..31bb5e1 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -20,10 +20,11 @@
#include "../iio.h"
#include "../sysfs.h"
+#include "../ring_generic.h"
#include "meter.h"
#include "ade7758.h"
-static int ade7758_spi_write_reg_8(struct device *dev,
+int ade7758_spi_write_reg_8(struct device *dev,
u8 reg_address,
u8 val)
{
@@ -490,7 +491,7 @@ static int ade7758_initial_setup(struct ade7758_state *st)
struct device *dev = &st->indio_dev->dev;
/* use low spi speed for init */
- st->us->mode = SPI_MODE_3;
+ st->us->mode = SPI_MODE_1;
spi_setup(st->us);
/* Disable IRQ */
@@ -580,63 +581,6 @@ out:
return ret ? ret : len;
}
-static ssize_t ade7758_read_waveform_type(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- int ret, len = 0;
- u8 t;
- ret = ade7758_spi_read_reg_8(dev,
- ADE7758_WAVMODE,
- &t);
- if (ret)
- return ret;
-
- t = (t >> 2) & 0x7;
-
- len = sprintf(buf, "%d\n", t);
-
- return len;
-}
-
-static ssize_t ade7758_write_waveform_type(struct device *dev,
- struct device_attribute *attr,
- const char *buf,
- size_t len)
-{
- struct iio_dev *indio_dev = dev_get_drvdata(dev);
- unsigned long val;
- int ret;
- u8 reg;
-
- ret = strict_strtol(buf, 10, &val);
- if (ret)
- return ret;
-
- if (val > 4)
- return -EINVAL;
-
- mutex_lock(&indio_dev->mlock);
-
- ret = ade7758_spi_read_reg_8(dev,
- ADE7758_WAVMODE,
- ®);
- if (ret)
- goto out;
-
- reg &= ~(7 << 2);
- reg |= val << 2;
-
- ret = ade7758_spi_write_reg_8(dev,
- ADE7758_WAVMODE,
- reg);
-
-out:
- mutex_unlock(&indio_dev->mlock);
-
- return ret ? ret : len;
-}
-
static IIO_DEV_ATTR_TEMP_RAW(ade7758_read_8bit);
static IIO_CONST_ATTR(temp_offset, "129 C");
static IIO_CONST_ATTR(temp_scale, "4 C");
@@ -664,19 +608,6 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
ade7758_read_frequency,
ade7758_write_frequency);
-/**
- * IIO_DEV_ATTR_WAVEFORM_TYPE - set the type of waveform.
- * @_mode: sysfs file mode/permissions
- * @_show: output method for the attribute
- * @_store: input method for the attribute
- **/
-#define IIO_DEV_ATTR_WAVEFORM_TYPE(_mode, _show, _store) \
- IIO_DEVICE_ATTR(waveform_type, _mode, _show, _store, 0)
-
-static IIO_DEV_ATTR_WAVEFORM_TYPE(S_IWUSR | S_IRUGO,
- ade7758_read_waveform_type,
- ade7758_write_waveform_type);
-
static IIO_DEV_ATTR_RESET(ade7758_write_reset);
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("26040 13020 6510 3255");
@@ -686,7 +617,6 @@ static struct attribute *ade7758_attributes[] = {
&iio_const_attr_temp_offset.dev_attr.attr,
&iio_const_attr_temp_scale.dev_attr.attr,
&iio_dev_attr_sampling_frequency.dev_attr.attr,
- &iio_dev_attr_waveform_type.dev_attr.attr,
&iio_const_attr_sampling_frequency_available.dev_attr.attr,
&iio_dev_attr_reset.dev_attr.attr,
&iio_dev_attr_awatthr.dev_attr.attr,
@@ -730,11 +660,73 @@ static const struct attribute_group ade7758_attribute_group = {
.attrs = ade7758_attributes,
};
-
+static struct iio_chan_spec ade7758_channels[] = {
+ IIO_CHAN(IIO_IN, 0, 1, 0, "raw", 0, 0,
+ (1 << IIO_CHAN_INFO_SCALE_SHARED),
+ AD7758_WT(AD7758_PHASE_A, AD7758_VOLTAGE),
+ 0, IIO_ST('s', 24, 32, 0), 0),
+ IIO_CHAN(IIO_CURRENT, 0, 1, 0, "raw", 0, 0,
+ (1 << IIO_CHAN_INFO_SCALE_SHARED),
+ AD7758_WT(AD7758_PHASE_A, AD7758_CURRENT),
+ 1, IIO_ST('s', 24, 32, 0), 0),
+ IIO_CHAN(IIO_POWER, 0, 1, 0, "apparent_raw", 0, 0,
+ (1 << IIO_CHAN_INFO_SCALE_SHARED),
+ AD7758_WT(AD7758_PHASE_A, AD7758_APP_PWR),
+ 2, IIO_ST('s', 24, 32, 0), 0),
+ IIO_CHAN(IIO_POWER, 0, 1, 0, "active_raw", 0, 0,
+ (1 << IIO_CHAN_INFO_SCALE_SHARED),
+ AD7758_WT(AD7758_PHASE_A, AD7758_ACT_PWR),
+ 3, IIO_ST('s', 24, 32, 0), 0),
+ IIO_CHAN(IIO_POWER, 0, 1, 0, "reactive_raw", 0, 0,
+ (1 << IIO_CHAN_INFO_SCALE_SHARED),
+ AD7758_WT(AD7758_PHASE_A, AD7758_REACT_PWR),
+ 4, IIO_ST('s', 24, 32, 0), 0),
+ IIO_CHAN(IIO_IN, 0, 1, 0, "raw", 1, 0,
+ (1 << IIO_CHAN_INFO_SCALE_SHARED),
+ AD7758_WT(AD7758_PHASE_B, AD7758_VOLTAGE),
+ 5, IIO_ST('s', 24, 32, 0), 0),
+ IIO_CHAN(IIO_CURRENT, 0, 1, 0, "raw", 1, 0,
+ (1 << IIO_CHAN_INFO_SCALE_SHARED),
+ AD7758_WT(AD7758_PHASE_B, AD7758_CURRENT),
+ 6, IIO_ST('s', 24, 32, 0), 0),
+ IIO_CHAN(IIO_POWER, 0, 1, 0, "apparent_raw", 1, 0,
+ (1 << IIO_CHAN_INFO_SCALE_SHARED),
+ AD7758_WT(AD7758_PHASE_B, AD7758_APP_PWR),
+ 7, IIO_ST('s', 24, 32, 0), 0),
+ IIO_CHAN(IIO_POWER, 0, 1, 0, "active_raw", 1, 0,
+ (1 << IIO_CHAN_INFO_SCALE_SHARED),
+ AD7758_WT(AD7758_PHASE_B, AD7758_ACT_PWR),
+ 8, IIO_ST('s', 24, 32, 0), 0),
+ IIO_CHAN(IIO_POWER, 0, 1, 0, "reactive_raw", 1, 0,
+ (1 << IIO_CHAN_INFO_SCALE_SHARED),
+ AD7758_WT(AD7758_PHASE_B, AD7758_REACT_PWR),
+ 9, IIO_ST('s', 24, 32, 0), 0),
+ IIO_CHAN(IIO_IN, 0, 1, 0, "raw", 2, 0,
+ (1 << IIO_CHAN_INFO_SCALE_SHARED),
+ AD7758_WT(AD7758_PHASE_C, AD7758_VOLTAGE),
+ 10, IIO_ST('s', 24, 32, 0), 0),
+ IIO_CHAN(IIO_CURRENT, 0, 1, 0, "raw", 2, 0,
+ (1 << IIO_CHAN_INFO_SCALE_SHARED),
+ AD7758_WT(AD7758_PHASE_C, AD7758_CURRENT),
+ 11, IIO_ST('s', 24, 32, 0), 0),
+ IIO_CHAN(IIO_POWER, 0, 1, 0, "apparent_raw", 2, 0,
+ (1 << IIO_CHAN_INFO_SCALE_SHARED),
+ AD7758_WT(AD7758_PHASE_C, AD7758_APP_PWR),
+ 12, IIO_ST('s', 24, 32, 0), 0),
+ IIO_CHAN(IIO_POWER, 0, 1, 0, "active_raw", 2, 0,
+ (1 << IIO_CHAN_INFO_SCALE_SHARED),
+ AD7758_WT(AD7758_PHASE_C, AD7758_ACT_PWR),
+ 13, IIO_ST('s', 24, 32, 0), 0),
+ IIO_CHAN(IIO_POWER, 0, 1, 0, "reactive_raw", 2, 0,
+ (1 << IIO_CHAN_INFO_SCALE_SHARED),
+ AD7758_WT(AD7758_PHASE_C, AD7758_REACT_PWR),
+ 14, IIO_ST('s', 24, 32, 0), 0),
+ IIO_CHAN_SOFT_TIMESTAMP(15),
+};
static int __devinit ade7758_probe(struct spi_device *spi)
{
- int ret, regdone = 0;
+ int i, ret, regdone = 0;
struct ade7758_state *st = kzalloc(sizeof *st, GFP_KERNEL);
if (!st) {
ret = -ENOMEM;
@@ -755,6 +747,7 @@ static int __devinit ade7758_probe(struct spi_device *spi)
goto error_free_rx;
}
st->us = spi;
+ st->ade7758_ring_channels = &ade7758_channels[0];
mutex_init(&st->buf_lock);
/* setup the industrialio driver allocated elements */
st->indio_dev = iio_allocate_device(0);
@@ -770,6 +763,11 @@ static int __devinit ade7758_probe(struct spi_device *spi)
st->indio_dev->driver_module = THIS_MODULE;
st->indio_dev->modes = INDIO_DIRECT_MODE;
+ for (i = 0; i < AD7758_NUM_WAVESRC; i++)
+ st->available_scan_masks[i] = 1 << i;
+
+ st->indio_dev->available_scan_masks = st->available_scan_masks;
+
ret = ade7758_configure_ring(st->indio_dev);
if (ret)
goto error_free_dev;
@@ -779,22 +777,25 @@ static int __devinit ade7758_probe(struct spi_device *spi)
goto error_unreg_ring_funcs;
regdone = 1;
- ret = ade7758_initialize_ring(st->indio_dev->ring);
+ ret = iio_ring_buffer_register_ex(st->indio_dev->ring, 0,
+ &ade7758_channels[0],
+ ARRAY_SIZE(ade7758_channels));
if (ret) {
- printk(KERN_ERR "failed to initialize the ring\n");
+ dev_err(&spi->dev, "failed to initialize the ring\n");
goto error_unreg_ring_funcs;
}
+ /* Get the device into a sane initial state */
+ ret = ade7758_initial_setup(st);
+ if (ret)
+ goto error_uninitialize_ring;
+
if (spi->irq) {
ret = ade7758_probe_trigger(st->indio_dev);
if (ret)
- goto error_uninitialize_ring;
+ goto error_remove_trigger;
}
- /* Get the device into a sane initial state */
- ret = ade7758_initial_setup(st);
- if (ret)
- goto error_remove_trigger;
return 0;
error_remove_trigger:
@@ -829,8 +830,6 @@ static int ade7758_remove(struct spi_device *spi)
if (ret)
goto err_ret;
- flush_scheduled_work();
-
ade7758_remove_trigger(indio_dev);
ade7758_uninitialize_ring(indio_dev->ring);
iio_device_unregister(indio_dev);
@@ -845,6 +844,11 @@ err_ret:
return ret;
}
+static const struct spi_device_id ade7758_id[] = {
+ {"ade7758", 0},
+ {}
+};
+
static struct spi_driver ade7758_driver = {
.driver = {
.name = "ade7758",
@@ -852,6 +856,7 @@ static struct spi_driver ade7758_driver = {
},
.probe = ade7758_probe,
.remove = __devexit_p(ade7758_remove),
+ .id_table = ade7758_id,
};
static __init int ade7758_init(void)
diff --git a/drivers/staging/iio/meter/ade7758_ring.c b/drivers/staging/iio/meter/ade7758_ring.c
index 2c9865d..8f47d2a 100644
--- a/drivers/staging/iio/meter/ade7758_ring.c
+++ b/drivers/staging/iio/meter/ade7758_ring.c
@@ -1,3 +1,10 @@
+/*
+ * ADE7758 Poly Phase Multifunction Energy Metering IC driver
+ *
+ * Copyright 2010-2011 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2.
+ */
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/gpio.h>
@@ -9,6 +16,7 @@
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/list.h>
+#include <asm/unaligned.h>
#include "../iio.h"
#include "../sysfs.h"
@@ -18,82 +26,40 @@
#include "ade7758.h"
/**
- * combine_8_to_32() utility function to munge to u8s into u32
- **/
-static inline u32 combine_8_to_32(u8 lower, u8 mid, u8 upper)
-{
- u32 _lower = lower;
- u32 _mid = mid;
- u32 _upper = upper;
-
- return _lower | (_mid << 8) | (_upper << 16);
-}
-
-static IIO_SCAN_EL_C(wform, ADE7758_SCAN_WFORM, ADE7758_WFORM, NULL);
-static IIO_CONST_ATTR_SCAN_EL_TYPE(wform, s, 24, 32);
-static IIO_SCAN_EL_TIMESTAMP(1);
-static IIO_CONST_ATTR_SCAN_EL_TYPE(timestamp, s, 64, 64);
-
-static struct attribute *ade7758_scan_el_attrs[] = {
- &iio_scan_el_wform.dev_attr.attr,
- &iio_const_attr_wform_index.dev_attr.attr,
- &iio_const_attr_wform_type.dev_attr.attr,
- &iio_scan_el_timestamp.dev_attr.attr,
- &iio_const_attr_timestamp_index.dev_attr.attr,
- &iio_const_attr_timestamp_type.dev_attr.attr,
- NULL,
-};
-
-static struct attribute_group ade7758_scan_el_group = {
- .attrs = ade7758_scan_el_attrs,
- .name = "scan_elements",
-};
-
-/**
- * ade7758_spi_read_burst() - read all data registers
+ * ade7758_spi_read_burst() - read data registers
* @dev: device associated with child of actual device (iio_dev or iio_trig)
- * @rx: somewhere to pass back the value read (min size is 24 bytes)
**/
-static int ade7758_spi_read_burst(struct device *dev, u8 *rx)
+static int ade7758_spi_read_burst(struct device *dev)
{
- struct spi_message msg;
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ade7758_state *st = iio_dev_get_devdata(indio_dev);
int ret;
- struct spi_transfer xfers[] = {
- {
- .tx_buf = st->tx,
- .rx_buf = rx,
- .bits_per_word = 8,
- .len = 4,
- }, {
- .tx_buf = st->tx + 4,
- .rx_buf = rx,
- .bits_per_word = 8,
- .len = 4,
- },
- };
-
- mutex_lock(&st->buf_lock);
- st->tx[0] = ADE7758_READ_REG(ADE7758_RSTATUS);
- st->tx[1] = 0;
- st->tx[2] = 0;
- st->tx[3] = 0;
- st->tx[4] = ADE7758_READ_REG(ADE7758_WFORM);
- st->tx[5] = 0;
- st->tx[6] = 0;
- st->tx[7] = 0;
-
- spi_message_init(&msg);
- spi_message_add_tail(&xfers[0], &msg);
- spi_message_add_tail(&xfers[1], &msg);
- ret = spi_sync(st->us, &msg);
+ ret = spi_sync(st->us, &st->ring_msg);
if (ret)
dev_err(&st->us->dev, "problem when reading WFORM value\n");
- mutex_unlock(&st->buf_lock);
+ return ret;
+}
+
+static int ade7758_write_waveform_type(struct device *dev, unsigned type)
+{
+ int ret;
+ u8 reg;
+ ret = ade7758_spi_read_reg_8(dev,
+ ADE7758_WAVMODE,
+ ®);
+ if (ret)
+ goto out;
+
+ reg &= ~0x1F;
+ reg |= type & 0x1F;
+
+ ret = ade7758_spi_write_reg_8(dev,
+ ADE7758_WAVMODE,
+ reg);
+out:
return ret;
}
@@ -106,76 +72,103 @@ static irqreturn_t ade7758_trigger_handler(int irq, void *p)
struct iio_dev *indio_dev = pf->private_data;
struct iio_ring_buffer *ring = indio_dev->ring;
struct ade7758_state *st = iio_dev_get_devdata(indio_dev);
- int i = 0;
- s32 *data;
- size_t datasize = ring->access.get_bytes_per_datum(ring);
-
- data = kmalloc(datasize, GFP_KERNEL);
- if (data == NULL) {
- dev_err(&st->us->dev, "memory alloc failed in ring bh");
- return -ENOMEM;
- }
+ s64 dat64[2];
+ u32 *dat32 = (u32 *)dat64;
if (ring->scan_count)
- if (ade7758_spi_read_burst(&st->indio_dev->dev, st->rx) >= 0)
- for (; i < ring->scan_count; i++)
- data[i] = combine_8_to_32(st->rx[i*2+2],
- st->rx[i*2+1],
- st->rx[i*2]);
+ if (ade7758_spi_read_burst(&st->indio_dev->dev) >= 0)
+ *dat32 = get_unaligned_be32(&st->rx_buf[5]) & 0xFFFFFF;
/* Guaranteed to be aligned with 8 byte boundary */
if (ring->scan_timestamp)
- *((s64 *)
- (((u32)data + 4 * ring->scan_count + 4) & ~0x7)) =
- pf->timestamp;
+ dat64[1] = pf->timestamp;
- ring->access.store_to(ring,
- (u8 *)data,
- pf->timestamp);
+ ring->access->store_to(ring, (u8 *)dat64, pf->timestamp);
iio_trigger_notify_done(st->indio_dev->trig);
- kfree(data);
return IRQ_HANDLED;
}
+/**
+ * ade7758_ring_preenable() setup the parameters of the ring before enabling
+ *
+ * The complex nature of the setting of the nuber of bytes per datum is due
+ * to this driver currently ensuring that the timestamp is stored at an 8
+ * byte boundary.
+ **/
+static int ade7758_ring_preenable(struct iio_dev *indio_dev)
+{
+ struct ade7758_state *st = indio_dev->dev_data;
+ struct iio_ring_buffer *ring = indio_dev->ring;
+ size_t d_size;
+ unsigned channel;
+
+ if (!ring->scan_count)
+ return -EINVAL;
+
+ channel = __ffs(ring->scan_mask);
+
+ d_size = st->ade7758_ring_channels[channel].scan_type.storagebits / 8;
+
+ if (ring->scan_timestamp) {
+ d_size += sizeof(s64);
+
+ if (d_size % sizeof(s64))
+ d_size += sizeof(s64) - (d_size % sizeof(s64));
+ }
+
+ if (indio_dev->ring->access->set_bytes_per_datum)
+ indio_dev->ring->access->set_bytes_per_datum(indio_dev->ring,
+ d_size);
+
+ ade7758_write_waveform_type(&indio_dev->dev,
+ st->ade7758_ring_channels[channel].address);
+
+ return 0;
+}
+
void ade7758_unconfigure_ring(struct iio_dev *indio_dev)
{
+ /* ensure that the trigger has been detached */
+ if (indio_dev->trig) {
+ iio_put_trigger(indio_dev->trig);
+ iio_trigger_dettach_poll_func(indio_dev->trig,
+ indio_dev->pollfunc);
+ }
kfree(indio_dev->pollfunc->name);
kfree(indio_dev->pollfunc);
iio_sw_rb_free(indio_dev->ring);
}
+static const struct iio_ring_setup_ops ade7758_ring_setup_ops = {
+ .preenable = &ade7758_ring_preenable,
+ .postenable = &iio_triggered_ring_postenable,
+ .predisable = &iio_triggered_ring_predisable,
+};
+
int ade7758_configure_ring(struct iio_dev *indio_dev)
{
+ struct ade7758_state *st = indio_dev->dev_data;
int ret = 0;
- struct iio_ring_buffer *ring;
- ring = iio_sw_rb_allocate(indio_dev);
- if (!ring) {
+ indio_dev->ring = iio_sw_rb_allocate(indio_dev);
+ if (!indio_dev->ring) {
ret = -ENOMEM;
return ret;
}
- indio_dev->ring = ring;
+
/* Effectively select the ring buffer implementation */
- iio_ring_sw_register_funcs(&ring->access);
- ring->bpe = 4;
- ring->scan_el_attrs = &ade7758_scan_el_group;
- ring->scan_timestamp = true;
- ring->preenable = &iio_sw_ring_preenable;
- ring->postenable = &iio_triggered_ring_postenable;
- ring->predisable = &iio_triggered_ring_predisable;
- ring->owner = THIS_MODULE;
-
- /* Set default scan mode */
- iio_scan_mask_set(ring, iio_scan_el_wform.number);
+ indio_dev->ring->access = &ring_sw_access_funcs;
+ indio_dev->ring->setup_ops = &ade7758_ring_setup_ops;
+ indio_dev->ring->owner = THIS_MODULE;
indio_dev->pollfunc = kzalloc(sizeof(*indio_dev->pollfunc), GFP_KERNEL);
if (indio_dev->pollfunc == NULL) {
ret = -ENOMEM;
goto error_iio_sw_rb_free;
}
- indio_dev->pollfunc->private_data = indio_dev->ring;
+ indio_dev->pollfunc->private_data = indio_dev;
indio_dev->pollfunc->h = &iio_pollfunc_store_time;
indio_dev->pollfunc->thread = &ade7758_trigger_handler;
indio_dev->pollfunc->name
@@ -186,6 +179,39 @@ int ade7758_configure_ring(struct iio_dev *indio_dev)
}
indio_dev->modes |= INDIO_RING_TRIGGERED;
+ st->tx_buf[0] = ADE7758_READ_REG(ADE7758_RSTATUS);
+ st->tx_buf[1] = 0;
+ st->tx_buf[2] = 0;
+ st->tx_buf[3] = 0;
+ st->tx_buf[4] = ADE7758_READ_REG(ADE7758_WFORM);
+ st->tx_buf[5] = 0;
+ st->tx_buf[6] = 0;
+ st->tx_buf[7] = 0;
+
+ /* build spi ring message */
+ st->ring_xfer[0].tx_buf = &st->tx_buf[0];
+ st->ring_xfer[0].len = 1;
+ st->ring_xfer[0].bits_per_word = 8;
+ st->ring_xfer[0].delay_usecs = 4;
+ st->ring_xfer[1].rx_buf = &st->rx_buf[1];
+ st->ring_xfer[1].len = 3;
+ st->ring_xfer[1].bits_per_word = 8;
+ st->ring_xfer[1].cs_change = 1;
+
+ st->ring_xfer[2].tx_buf = &st->tx_buf[4];
+ st->ring_xfer[2].len = 1;
+ st->ring_xfer[2].bits_per_word = 8;
+ st->ring_xfer[2].delay_usecs = 1;
+ st->ring_xfer[3].rx_buf = &st->rx_buf[5];
+ st->ring_xfer[3].len = 3;
+ st->ring_xfer[3].bits_per_word = 8;
+
+ spi_message_init(&st->ring_msg);
+ spi_message_add_tail(&st->ring_xfer[0], &st->ring_msg);
+ spi_message_add_tail(&st->ring_xfer[1], &st->ring_msg);
+ spi_message_add_tail(&st->ring_xfer[2], &st->ring_msg);
+ spi_message_add_tail(&st->ring_xfer[3], &st->ring_msg);
+
return 0;
error_free_pollfunc:
@@ -195,11 +221,6 @@ error_iio_sw_rb_free:
return ret;
}
-int ade7758_initialize_ring(struct iio_ring_buffer *ring)
-{
- return iio_ring_buffer_register(ring, 0);
-}
-
void ade7758_uninitialize_ring(struct iio_ring_buffer *ring)
{
iio_ring_buffer_unregister(ring);
--
1.6.0.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 6/6] IIO-work: meter: ade7758: Use private data space from iio_allocate_device
2011-05-11 14:26 [PATCH 1/6] IIO-work: meter: ade7758: Update trigger to the new API michael.hennerich
` (3 preceding siblings ...)
2011-05-11 14:26 ` [PATCH 5/6] IIO-work: meter: ade7758: Use iio channel spec and miscellaneous other changes michael.hennerich
@ 2011-05-11 14:27 ` michael.hennerich
2011-05-11 15:48 ` [PATCH 1/6] IIO-work: meter: ade7758: Update trigger to the new API Jonathan Cameron
5 siblings, 0 replies; 8+ messages in thread
From: michael.hennerich @ 2011-05-11 14:27 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, drivers, device-drivers-devel, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Use private data space from iio_allocate_device.
Drop dev_data in favor of iio_priv().
Fix indention issues from previous patches.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/staging/iio/meter/ade7758.h | 12 ++--
drivers/staging/iio/meter/ade7758_core.c | 94 +++++++++++++--------------
drivers/staging/iio/meter/ade7758_ring.c | 12 ++--
drivers/staging/iio/meter/ade7758_trigger.c | 18 +++---
4 files changed, 64 insertions(+), 72 deletions(-)
diff --git a/drivers/staging/iio/meter/ade7758.h b/drivers/staging/iio/meter/ade7758.h
index a516527..fd74e15 100644
--- a/drivers/staging/iio/meter/ade7758.h
+++ b/drivers/staging/iio/meter/ade7758.h
@@ -111,7 +111,6 @@
/**
* struct ade7758_state - device instance specific data
* @us: actual spi_device
- * @indio_dev: industrial I/O device structure
* @trig: data ready trigger registered with iio
* @tx: transmit buffer
* @rx: receive buffer
@@ -119,21 +118,20 @@
**/
struct ade7758_state {
struct spi_device *us;
- struct iio_dev *indio_dev;
struct iio_trigger *trig;
u8 *tx;
u8 *rx;
struct mutex buf_lock;
u32 available_scan_masks[AD7758_NUM_WAVESRC];
- struct iio_chan_spec *ade7758_ring_channels;
- struct spi_transfer ring_xfer[4];
- struct spi_message ring_msg;
+ struct iio_chan_spec *ade7758_ring_channels;
+ struct spi_transfer ring_xfer[4];
+ struct spi_message ring_msg;
/*
* DMA (thus cache coherency maintenance) requires the
* transfer buffers to live in their own cache lines.
*/
- unsigned char rx_buf[8] ____cacheline_aligned;
- unsigned char tx_buf[8];
+ unsigned char rx_buf[8] ____cacheline_aligned;
+ unsigned char tx_buf[8];
};
#ifdef CONFIG_IIO_RING_BUFFER
diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
index 31bb5e1..d9dfd83 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -30,7 +30,7 @@ int ade7758_spi_write_reg_8(struct device *dev,
{
int ret;
struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct ade7758_state *st = iio_dev_get_devdata(indio_dev);
+ struct ade7758_state *st = iio_priv(indio_dev);
mutex_lock(&st->buf_lock);
st->tx[0] = ADE7758_WRITE_REG(reg_address);
@@ -49,7 +49,7 @@ static int ade7758_spi_write_reg_16(struct device *dev,
int ret;
struct spi_message msg;
struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct ade7758_state *st = iio_dev_get_devdata(indio_dev);
+ struct ade7758_state *st = iio_priv(indio_dev);
struct spi_transfer xfers[] = {
{
.tx_buf = st->tx,
@@ -78,7 +78,7 @@ static int ade7758_spi_write_reg_24(struct device *dev,
int ret;
struct spi_message msg;
struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct ade7758_state *st = iio_dev_get_devdata(indio_dev);
+ struct ade7758_state *st = iio_priv(indio_dev);
struct spi_transfer xfers[] = {
{
.tx_buf = st->tx,
@@ -107,7 +107,7 @@ int ade7758_spi_read_reg_8(struct device *dev,
{
struct spi_message msg;
struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct ade7758_state *st = iio_dev_get_devdata(indio_dev);
+ struct ade7758_state *st = iio_priv(indio_dev);
int ret;
struct spi_transfer xfers[] = {
{
@@ -150,7 +150,7 @@ static int ade7758_spi_read_reg_16(struct device *dev,
{
struct spi_message msg;
struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct ade7758_state *st = iio_dev_get_devdata(indio_dev);
+ struct ade7758_state *st = iio_priv(indio_dev);
int ret;
struct spi_transfer xfers[] = {
{
@@ -196,7 +196,7 @@ static int ade7758_spi_read_reg_24(struct device *dev,
{
struct spi_message msg;
struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct ade7758_state *st = iio_dev_get_devdata(indio_dev);
+ struct ade7758_state *st = iio_priv(indio_dev);
int ret;
struct spi_transfer xfers[] = {
{
@@ -485,10 +485,11 @@ static int ade7758_stop_device(struct device *dev)
return ret;
}
-static int ade7758_initial_setup(struct ade7758_state *st)
+static int ade7758_initial_setup(struct iio_dev *indio_dev)
{
+ struct ade7758_state *st = iio_priv(indio_dev);
+ struct device *dev = &indio_dev->dev;
int ret;
- struct device *dev = &st->indio_dev->dev;
/* use low spi speed for init */
st->us->mode = SPI_MODE_1;
@@ -559,7 +560,7 @@ static ssize_t ade7758_write_frequency(struct device *dev,
break;
default:
ret = -EINVAL;
- goto out;
+ goto out;
}
ret = ade7758_spi_read_reg_8(dev,
@@ -727,19 +728,23 @@ static struct iio_chan_spec ade7758_channels[] = {
static int __devinit ade7758_probe(struct spi_device *spi)
{
int i, ret, regdone = 0;
- struct ade7758_state *st = kzalloc(sizeof *st, GFP_KERNEL);
- if (!st) {
- ret = -ENOMEM;
+ struct ade7758_state *st;
+ struct iio_dev *indio_dev = iio_allocate_device(sizeof(*st));
+
+ if (indio_dev == NULL) {
+ ret = -ENOMEM;
goto error_ret;
}
+
+ st = iio_priv(indio_dev);
/* this is only used for removal purposes */
- spi_set_drvdata(spi, st);
+ spi_set_drvdata(spi, indio_dev);
/* Allocate the comms buffers */
st->rx = kzalloc(sizeof(*st->rx)*ADE7758_MAX_RX, GFP_KERNEL);
if (st->rx == NULL) {
ret = -ENOMEM;
- goto error_free_st;
+ goto error_free_dev;
}
st->tx = kzalloc(sizeof(*st->tx)*ADE7758_MAX_TX, GFP_KERNEL);
if (st->tx == NULL) {
@@ -749,35 +754,28 @@ static int __devinit ade7758_probe(struct spi_device *spi)
st->us = spi;
st->ade7758_ring_channels = &ade7758_channels[0];
mutex_init(&st->buf_lock);
- /* setup the industrialio driver allocated elements */
- st->indio_dev = iio_allocate_device(0);
- if (st->indio_dev == NULL) {
- ret = -ENOMEM;
- goto error_free_tx;
- }
- st->indio_dev->name = spi->dev.driver->name;
- st->indio_dev->dev.parent = &spi->dev;
- st->indio_dev->attrs = &ade7758_attribute_group;
- st->indio_dev->dev_data = (void *)(st);
- st->indio_dev->driver_module = THIS_MODULE;
- st->indio_dev->modes = INDIO_DIRECT_MODE;
+ indio_dev->name = spi->dev.driver->name;
+ indio_dev->dev.parent = &spi->dev;
+ indio_dev->attrs = &ade7758_attribute_group;
+ indio_dev->driver_module = THIS_MODULE;
+ indio_dev->modes = INDIO_DIRECT_MODE;
for (i = 0; i < AD7758_NUM_WAVESRC; i++)
st->available_scan_masks[i] = 1 << i;
- st->indio_dev->available_scan_masks = st->available_scan_masks;
+ indio_dev->available_scan_masks = st->available_scan_masks;
- ret = ade7758_configure_ring(st->indio_dev);
+ ret = ade7758_configure_ring(indio_dev);
if (ret)
- goto error_free_dev;
+ goto error_free_tx;
- ret = iio_device_register(st->indio_dev);
+ ret = iio_device_register(indio_dev);
if (ret)
goto error_unreg_ring_funcs;
regdone = 1;
- ret = iio_ring_buffer_register_ex(st->indio_dev->ring, 0,
+ ret = iio_ring_buffer_register_ex(indio_dev->ring, 0,
&ade7758_channels[0],
ARRAY_SIZE(ade7758_channels));
if (ret) {
@@ -786,12 +784,12 @@ static int __devinit ade7758_probe(struct spi_device *spi)
}
/* Get the device into a sane initial state */
- ret = ade7758_initial_setup(st);
+ ret = ade7758_initial_setup(indio_dev);
if (ret)
goto error_uninitialize_ring;
if (spi->irq) {
- ret = ade7758_probe_trigger(st->indio_dev);
+ ret = ade7758_probe_trigger(indio_dev);
if (ret)
goto error_remove_trigger;
}
@@ -799,47 +797,43 @@ static int __devinit ade7758_probe(struct spi_device *spi)
return 0;
error_remove_trigger:
- if (st->indio_dev->modes & INDIO_RING_TRIGGERED)
- ade7758_remove_trigger(st->indio_dev);
+ if (indio_dev->modes & INDIO_RING_TRIGGERED)
+ ade7758_remove_trigger(indio_dev);
error_uninitialize_ring:
- ade7758_uninitialize_ring(st->indio_dev->ring);
+ ade7758_uninitialize_ring(indio_dev->ring);
error_unreg_ring_funcs:
- ade7758_unconfigure_ring(st->indio_dev);
-error_free_dev:
- if (regdone)
- iio_device_unregister(st->indio_dev);
- else
- iio_free_device(st->indio_dev);
+ ade7758_unconfigure_ring(indio_dev);
error_free_tx:
kfree(st->tx);
error_free_rx:
kfree(st->rx);
-error_free_st:
- kfree(st);
+error_free_dev:
+ if (regdone)
+ iio_device_unregister(indio_dev);
+ else
+ iio_free_device(indio_dev);
error_ret:
return ret;
}
static int ade7758_remove(struct spi_device *spi)
{
+ struct iio_dev *indio_dev = spi_get_drvdata(spi);
+ struct ade7758_state *st = iio_priv(indio_dev);
int ret;
- struct ade7758_state *st = spi_get_drvdata(spi);
- struct iio_dev *indio_dev = st->indio_dev;
- ret = ade7758_stop_device(&(indio_dev->dev));
+ ret = ade7758_stop_device(&indio_dev->dev);
if (ret)
goto err_ret;
ade7758_remove_trigger(indio_dev);
ade7758_uninitialize_ring(indio_dev->ring);
- iio_device_unregister(indio_dev);
ade7758_unconfigure_ring(indio_dev);
kfree(st->tx);
kfree(st->rx);
- kfree(st);
+ iio_device_unregister(indio_dev);
return 0;
-
err_ret:
return ret;
}
diff --git a/drivers/staging/iio/meter/ade7758_ring.c b/drivers/staging/iio/meter/ade7758_ring.c
index 8f47d2a..4c58e4f 100644
--- a/drivers/staging/iio/meter/ade7758_ring.c
+++ b/drivers/staging/iio/meter/ade7758_ring.c
@@ -32,7 +32,7 @@
static int ade7758_spi_read_burst(struct device *dev)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct ade7758_state *st = iio_dev_get_devdata(indio_dev);
+ struct ade7758_state *st = iio_priv(indio_dev);
int ret;
ret = spi_sync(st->us, &st->ring_msg);
@@ -71,12 +71,12 @@ static irqreturn_t ade7758_trigger_handler(int irq, void *p)
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->private_data;
struct iio_ring_buffer *ring = indio_dev->ring;
- struct ade7758_state *st = iio_dev_get_devdata(indio_dev);
+ struct ade7758_state *st = iio_priv(indio_dev);
s64 dat64[2];
u32 *dat32 = (u32 *)dat64;
if (ring->scan_count)
- if (ade7758_spi_read_burst(&st->indio_dev->dev) >= 0)
+ if (ade7758_spi_read_burst(&indio_dev->dev) >= 0)
*dat32 = get_unaligned_be32(&st->rx_buf[5]) & 0xFFFFFF;
/* Guaranteed to be aligned with 8 byte boundary */
@@ -85,7 +85,7 @@ static irqreturn_t ade7758_trigger_handler(int irq, void *p)
ring->access->store_to(ring, (u8 *)dat64, pf->timestamp);
- iio_trigger_notify_done(st->indio_dev->trig);
+ iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
}
@@ -99,7 +99,7 @@ static irqreturn_t ade7758_trigger_handler(int irq, void *p)
**/
static int ade7758_ring_preenable(struct iio_dev *indio_dev)
{
- struct ade7758_state *st = indio_dev->dev_data;
+ struct ade7758_state *st = iio_priv(indio_dev);
struct iio_ring_buffer *ring = indio_dev->ring;
size_t d_size;
unsigned channel;
@@ -149,7 +149,7 @@ static const struct iio_ring_setup_ops ade7758_ring_setup_ops = {
int ade7758_configure_ring(struct iio_dev *indio_dev)
{
- struct ade7758_state *st = indio_dev->dev_data;
+ struct ade7758_state *st = iio_priv(indio_dev);
int ret = 0;
indio_dev->ring = iio_sw_rb_allocate(indio_dev);
diff --git a/drivers/staging/iio/meter/ade7758_trigger.c b/drivers/staging/iio/meter/ade7758_trigger.c
index f792ccd..798938e 100644
--- a/drivers/staging/iio/meter/ade7758_trigger.c
+++ b/drivers/staging/iio/meter/ade7758_trigger.c
@@ -37,8 +37,7 @@ static irqreturn_t ade7758_data_rdy_trig_poll(int irq, void *private)
static int ade7758_data_rdy_trigger_set_state(struct iio_trigger *trig,
bool state)
{
- struct ade7758_state *st = trig->private_data;
- struct iio_dev *indio_dev = st->indio_dev;
+ struct iio_dev *indio_dev = trig->private_data;
dev_dbg(&indio_dev->dev, "%s (%d)\n", __func__, state);
return ade7758_set_irq(&indio_dev->dev, state);
@@ -50,7 +49,8 @@ static int ade7758_data_rdy_trigger_set_state(struct iio_trigger *trig,
**/
static int ade7758_trig_try_reen(struct iio_trigger *trig)
{
- struct ade7758_state *st = trig->private_data;
+ struct iio_dev *indio_dev = trig->private_data;
+ struct ade7758_state *st = iio_priv(indio_dev);
enable_irq(st->us->irq);
/* irq reenabled so success! */
@@ -59,8 +59,8 @@ static int ade7758_trig_try_reen(struct iio_trigger *trig)
int ade7758_probe_trigger(struct iio_dev *indio_dev)
{
+ struct ade7758_state *st = iio_priv(indio_dev);
int ret;
- struct ade7758_state *st = indio_dev->dev_data;
st->trig = iio_allocate_trigger("%s-dev%d",
spi_get_device_id(st->us)->name,
@@ -80,7 +80,7 @@ int ade7758_probe_trigger(struct iio_dev *indio_dev)
st->trig->dev.parent = &st->us->dev;
st->trig->owner = THIS_MODULE;
- st->trig->private_data = st;
+ st->trig->private_data = indio_dev;
st->trig->set_trigger_state = &ade7758_data_rdy_trigger_set_state;
st->trig->try_reenable = &ade7758_trig_try_reen;
ret = iio_trigger_register(st->trig);
@@ -102,9 +102,9 @@ error_ret:
void ade7758_remove_trigger(struct iio_dev *indio_dev)
{
- struct ade7758_state *state = indio_dev->dev_data;
+ struct ade7758_state *st = iio_priv(indio_dev);
- iio_trigger_unregister(state->trig);
- free_irq(state->us->irq, state->trig);
- iio_free_trigger(state->trig);
+ iio_trigger_unregister(st->trig);
+ free_irq(st->us->irq, st->trig);
+ iio_free_trigger(st->trig);
}
--
1.6.0.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/6] IIO-work: meter: ade7758: Update trigger to the new API
2011-05-11 14:26 [PATCH 1/6] IIO-work: meter: ade7758: Update trigger to the new API michael.hennerich
` (4 preceding siblings ...)
2011-05-11 14:27 ` [PATCH 6/6] IIO-work: meter: ade7758: Use private data space from iio_allocate_device michael.hennerich
@ 2011-05-11 15:48 ` Jonathan Cameron
2011-05-12 12:04 ` Michael Hennerich
5 siblings, 1 reply; 8+ messages in thread
From: Jonathan Cameron @ 2011-05-11 15:48 UTC (permalink / raw)
To: michael.hennerich; +Cc: linux-iio, drivers, device-drivers-devel
Hi Michael,
Thanks for doing this so quickly.
I've bashed the various patches into the iio-onwards master branch.
It required a few trivial back ports the forward ports again to maintain
building all the way through the core changes. Nothing significant, but
you may want to take a quick look to make sure the result is right!
(I've just pushed so usual delay before it hits the front end machines).
Now all I need to do is persuade someone to pick up the irq exports
that are needed for the second half of the tree... I'd like to push it
in one go because the main benefits of the chan spec stuff only make sense
once the irq related changes and buffer simplifications are there as well.
(of course I'm still open to reviews / acks, particularly wrt to the core
changes).
Thanks,
Jonathan
I've acked / signed off on all of these depending on whether I did any
significant munging on them...
> Update trigger to the new API.
> Add file comment/license header.
>
> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
> ---
> drivers/staging/iio/meter/ade7758_trigger.c | 43 ++++++++++----------------
> 1 files changed, 17 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/staging/iio/meter/ade7758_trigger.c b/drivers/staging/iio/meter/ade7758_trigger.c
> index 0adfcc6..f792ccd 100644
> --- a/drivers/staging/iio/meter/ade7758_trigger.c
> +++ b/drivers/staging/iio/meter/ade7758_trigger.c
> @@ -1,3 +1,11 @@
> +/*
> + * ADE7758 Poly Phase Multifunction Energy Metering IC driver
> + *
> + * Copyright 2010-2011 Analog Devices Inc.
> + *
> + * Licensed under the GPL-2.
> + */
> +
> #include <linux/interrupt.h>
> #include <linux/irq.h>
> #include <linux/mutex.h>
> @@ -19,20 +27,10 @@ static irqreturn_t ade7758_data_rdy_trig_poll(int irq, void *private)
> {
> disable_irq_nosync(irq);
> iio_trigger_poll(private, iio_get_time_ns());
> +
> return IRQ_HANDLED;
> }
>
> -static DEVICE_ATTR(name, S_IRUGO, iio_trigger_read_name, NULL);
> -
> -static struct attribute *ade7758_trigger_attrs[] = {
> - &dev_attr_name.attr,
> - NULL,
> -};
> -
> -static const struct attribute_group ade7758_trigger_attr_group = {
> - .attrs = ade7758_trigger_attrs,
> -};
> -
> /**
> * ade7758_data_rdy_trigger_set_state() set datardy interrupt state
> **/
> @@ -53,6 +51,7 @@ static int ade7758_data_rdy_trigger_set_state(struct iio_trigger *trig,
> static int ade7758_trig_try_reen(struct iio_trigger *trig)
> {
> struct ade7758_state *st = trig->private_data;
> +
> enable_irq(st->us->irq);
> /* irq reenabled so success! */
> return 0;
> @@ -63,43 +62,36 @@ int ade7758_probe_trigger(struct iio_dev *indio_dev)
> int ret;
> struct ade7758_state *st = indio_dev->dev_data;
>
> -
> - st->trig = iio_allocate_trigger();
> + st->trig = iio_allocate_trigger("%s-dev%d",
> + spi_get_device_id(st->us)->name,
> + indio_dev->id);
> if (st->trig == NULL) {
> ret = -ENOMEM;
> goto error_ret;
> }
> +
> ret = request_irq(st->us->irq,
> ade7758_data_rdy_trig_poll,
> - IRQF_TRIGGER_FALLING, "ade7758",
> + IRQF_TRIGGER_LOW,
> + spi_get_device_id(st->us)->name,
> st->trig);
> if (ret)
> goto error_free_trig;
>
> - st->trig->name = kasprintf(GFP_KERNEL,
> - "ade7758-dev%d",
> - indio_dev->id);
> - if (!st->trig->name) {
> - ret = -ENOMEM;
> - goto error_free_irq;
> - }
> st->trig->dev.parent = &st->us->dev;
> st->trig->owner = THIS_MODULE;
> st->trig->private_data = st;
> st->trig->set_trigger_state = &ade7758_data_rdy_trigger_set_state;
> st->trig->try_reenable = &ade7758_trig_try_reen;
> - st->trig->control_attrs = &ade7758_trigger_attr_group;
> ret = iio_trigger_register(st->trig);
>
> /* select default trigger */
> indio_dev->trig = st->trig;
> if (ret)
> - goto error_free_trig_name;
> + goto error_free_irq;
>
> return 0;
>
> -error_free_trig_name:
> - kfree(st->trig->name);
> error_free_irq:
> free_irq(st->us->irq, st->trig);
> error_free_trig:
> @@ -113,7 +105,6 @@ void ade7758_remove_trigger(struct iio_dev *indio_dev)
> struct ade7758_state *state = indio_dev->dev_data;
>
> iio_trigger_unregister(state->trig);
> - kfree(state->trig->name);
> free_irq(state->us->irq, state->trig);
> iio_free_trigger(state->trig);
> }
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/6] IIO-work: meter: ade7758: Update trigger to the new API
2011-05-11 15:48 ` [PATCH 1/6] IIO-work: meter: ade7758: Update trigger to the new API Jonathan Cameron
@ 2011-05-12 12:04 ` Michael Hennerich
0 siblings, 0 replies; 8+ messages in thread
From: Michael Hennerich @ 2011-05-12 12:04 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-iio@vger.kernel.org, Drivers,
device-drivers-devel@blackfin.uclinux.org
On 05/11/2011 05:48 PM, Jonathan Cameron wrote:
> Hi Michael,
>
> Thanks for doing this so quickly.
>
> I've bashed the various patches into the iio-onwards master branch.
> It required a few trivial back ports the forward ports again to maintain
> building all the way through the core changes. Nothing significant, but
> you may want to take a quick look to make sure the result is right!
> (I've just pushed so usual delay before it hits the front end machines).
>
Hi Jonathan,
Builds and works fine. Great job!
> Now all I need to do is persuade someone to pick up the irq exports
> that are needed for the second half of the tree... I'd like to push it
> in one go because the main benefits of the chan spec stuff only make sense
> once the irq related changes and buffer simplifications are there as well.
>
> (of course I'm still open to reviews / acks, particularly wrt to the core
> changes).
>
> Thanks,
>
> Jonathan
>
> I've acked / signed off on all of these depending on whether I did any
> significant munging on them...
>
>
>> Update trigger to the new API.
>> Add file comment/license header.
>>
>> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
>> ---
>> drivers/staging/iio/meter/ade7758_trigger.c | 43 ++++++++++----------------
>> 1 files changed, 17 insertions(+), 26 deletions(-)
>>
>> diff --git a/drivers/staging/iio/meter/ade7758_trigger.c b/drivers/staging/iio/meter/ade7758_trigger.c
>> index 0adfcc6..f792ccd 100644
>> --- a/drivers/staging/iio/meter/ade7758_trigger.c
>> +++ b/drivers/staging/iio/meter/ade7758_trigger.c
>> @@ -1,3 +1,11 @@
>> +/*
>> + * ADE7758 Poly Phase Multifunction Energy Metering IC driver
>> + *
>> + * Copyright 2010-2011 Analog Devices Inc.
>> + *
>> + * Licensed under the GPL-2.
>> + */
>> +
>> #include <linux/interrupt.h>
>> #include <linux/irq.h>
>> #include <linux/mutex.h>
>> @@ -19,20 +27,10 @@ static irqreturn_t ade7758_data_rdy_trig_poll(int irq, void *private)
>> {
>> disable_irq_nosync(irq);
>> iio_trigger_poll(private, iio_get_time_ns());
>> +
>> return IRQ_HANDLED;
>> }
>>
>> -static DEVICE_ATTR(name, S_IRUGO, iio_trigger_read_name, NULL);
>> -
>> -static struct attribute *ade7758_trigger_attrs[] = {
>> - &dev_attr_name.attr,
>> - NULL,
>> -};
>> -
>> -static const struct attribute_group ade7758_trigger_attr_group = {
>> - .attrs = ade7758_trigger_attrs,
>> -};
>> -
>> /**
>> * ade7758_data_rdy_trigger_set_state() set datardy interrupt state
>> **/
>> @@ -53,6 +51,7 @@ static int ade7758_data_rdy_trigger_set_state(struct iio_trigger *trig,
>> static int ade7758_trig_try_reen(struct iio_trigger *trig)
>> {
>> struct ade7758_state *st = trig->private_data;
>> +
>> enable_irq(st->us->irq);
>> /* irq reenabled so success! */
>> return 0;
>> @@ -63,43 +62,36 @@ int ade7758_probe_trigger(struct iio_dev *indio_dev)
>> int ret;
>> struct ade7758_state *st = indio_dev->dev_data;
>>
>> -
>> - st->trig = iio_allocate_trigger();
>> + st->trig = iio_allocate_trigger("%s-dev%d",
>> + spi_get_device_id(st->us)->name,
>> + indio_dev->id);
>> if (st->trig == NULL) {
>> ret = -ENOMEM;
>> goto error_ret;
>> }
>> +
>> ret = request_irq(st->us->irq,
>> ade7758_data_rdy_trig_poll,
>> - IRQF_TRIGGER_FALLING, "ade7758",
>> + IRQF_TRIGGER_LOW,
>> + spi_get_device_id(st->us)->name,
>> st->trig);
>> if (ret)
>> goto error_free_trig;
>>
>> - st->trig->name = kasprintf(GFP_KERNEL,
>> - "ade7758-dev%d",
>> - indio_dev->id);
>> - if (!st->trig->name) {
>> - ret = -ENOMEM;
>> - goto error_free_irq;
>> - }
>> st->trig->dev.parent = &st->us->dev;
>> st->trig->owner = THIS_MODULE;
>> st->trig->private_data = st;
>> st->trig->set_trigger_state = &ade7758_data_rdy_trigger_set_state;
>> st->trig->try_reenable = &ade7758_trig_try_reen;
>> - st->trig->control_attrs = &ade7758_trigger_attr_group;
>> ret = iio_trigger_register(st->trig);
>>
>> /* select default trigger */
>> indio_dev->trig = st->trig;
>> if (ret)
>> - goto error_free_trig_name;
>> + goto error_free_irq;
>>
>> return 0;
>>
>> -error_free_trig_name:
>> - kfree(st->trig->name);
>> error_free_irq:
>> free_irq(st->us->irq, st->trig);
>> error_free_trig:
>> @@ -113,7 +105,6 @@ void ade7758_remove_trigger(struct iio_dev *indio_dev)
>> struct ade7758_state *state = indio_dev->dev_data;
>>
>> iio_trigger_unregister(state->trig);
>> - kfree(state->trig->name);
>> free_irq(state->us->irq, state->trig);
>> iio_free_trigger(state->trig);
>> }
>>
>
>
--
Greetings,
Michael
--
Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-05-12 12:04 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-11 14:26 [PATCH 1/6] IIO-work: meter: ade7758: Update trigger to the new API michael.hennerich
2011-05-11 14:26 ` [PATCH 2/6] IIO-work: meter: ade7758: Fix timing on SPI read accessor functions michael.hennerich
2011-05-11 14:26 ` [PATCH 3/6] IIO-work: meter: ade7758: Fix return value of ade7758_write_reset michael.hennerich
2011-05-11 14:26 ` [PATCH 4/6] IIO-work: meter: ade7758: Fix list and set of available sample frequencies michael.hennerich
2011-05-11 14:26 ` [PATCH 5/6] IIO-work: meter: ade7758: Use iio channel spec and miscellaneous other changes michael.hennerich
2011-05-11 14:27 ` [PATCH 6/6] IIO-work: meter: ade7758: Use private data space from iio_allocate_device michael.hennerich
2011-05-11 15:48 ` [PATCH 1/6] IIO-work: meter: ade7758: Update trigger to the new API Jonathan Cameron
2011-05-12 12:04 ` Michael Hennerich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox