* [PATCH 01/12] iio:adc:ad5791: Use BIT() and GENMASK() macros
2014-06-07 15:42 [PATCH 00/12] misc IIO cleanup Peter Meerwald
@ 2014-06-07 15:42 ` Peter Meerwald
2014-06-09 11:58 ` Lars-Peter Clausen
2014-06-07 15:42 ` [PATCH 02/12] iio:adc:ad5504: " Peter Meerwald
` (11 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Peter Meerwald @ 2014-06-07 15:42 UTC (permalink / raw)
To: linux-iio; +Cc: jic23, Peter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
drivers/iio/dac/ad5791.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/drivers/iio/dac/ad5791.c b/drivers/iio/dac/ad5791.c
index ae49afe..5ba785f 100644
--- a/drivers/iio/dac/ad5791.c
+++ b/drivers/iio/dac/ad5791.c
@@ -16,17 +16,16 @@
#include <linux/sysfs.h>
#include <linux/regulator/consumer.h>
#include <linux/module.h>
+#include <linux/bitops.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/dac/ad5791.h>
-#define AD5791_RES_MASK(x) ((1 << (x)) - 1)
-#define AD5791_DAC_MASK AD5791_RES_MASK(20)
-#define AD5791_DAC_MSB (1 << 19)
+#define AD5791_DAC_MASK GENMASK(19, 0)
-#define AD5791_CMD_READ (1 << 23)
-#define AD5791_CMD_WRITE (0 << 23)
+#define AD5791_CMD_READ BIT(23)
+#define AD5791_CMD_WRITE 0
#define AD5791_ADDR(addr) ((addr) << 20)
/* Registers */
@@ -37,11 +36,11 @@
#define AD5791_ADDR_SW_CTRL 4
/* Control Register */
-#define AD5791_CTRL_RBUF (1 << 1)
-#define AD5791_CTRL_OPGND (1 << 2)
-#define AD5791_CTRL_DACTRI (1 << 3)
-#define AD5791_CTRL_BIN2SC (1 << 4)
-#define AD5791_CTRL_SDODIS (1 << 5)
+#define AD5791_CTRL_RBUF BIT(1)
+#define AD5791_CTRL_OPGND BIT(2)
+#define AD5791_CTRL_DACTRI BIT(3)
+#define AD5791_CTRL_BIN2SC BIT(4)
+#define AD5791_CTRL_SDODIS BIT(5)
#define AD5761_CTRL_LINCOMP(x) ((x) << 6)
#define AD5791_LINCOMP_0_10 0
@@ -54,9 +53,9 @@
#define AD5780_LINCOMP_10_20 12
/* Software Control Register */
-#define AD5791_SWCTRL_LDAC (1 << 0)
-#define AD5791_SWCTRL_CLR (1 << 1)
-#define AD5791_SWCTRL_RESET (1 << 2)
+#define AD5791_SWCTRL_LDAC BIT(0)
+#define AD5791_SWCTRL_CLR BIT(1)
+#define AD5791_SWCTRL_RESET BIT(2)
#define AD5791_DAC_PWRDN_6K 0
#define AD5791_DAC_PWRDN_3STATE 1
@@ -72,7 +71,7 @@ struct ad5791_chip_info {
/**
* struct ad5791_state - driver instance specific data
- * @us: spi_device
+ * @spi: spi_device
* @reg_vdd: positive supply regulator
* @reg_vss: negative supply regulator
* @chip_info: chip model specific constants
@@ -328,7 +327,7 @@ static int ad5791_write_raw(struct iio_dev *indio_dev,
switch (mask) {
case IIO_CHAN_INFO_RAW:
- val &= AD5791_RES_MASK(chan->scan_type.realbits);
+ val &= GENMASK(chan->scan_type.realbits - 1, 0);
val <<= chan->scan_type.shift;
return ad5791_spi_write(st, chan->address, val);
--
1.9.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 02/12] iio:adc:ad5504: Use BIT() and GENMASK() macros
2014-06-07 15:42 [PATCH 00/12] misc IIO cleanup Peter Meerwald
2014-06-07 15:42 ` [PATCH 01/12] iio:adc:ad5791: Use BIT() and GENMASK() macros Peter Meerwald
@ 2014-06-07 15:42 ` Peter Meerwald
2014-06-07 15:42 ` [PATCH 03/12] iio:adc:ad7887: " Peter Meerwald
` (10 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Peter Meerwald @ 2014-06-07 15:42 UTC (permalink / raw)
To: linux-iio; +Cc: jic23, Peter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
drivers/iio/dac/ad5504.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
index 1e64493..c917dd2 100644
--- a/drivers/iio/dac/ad5504.c
+++ b/drivers/iio/dac/ad5504.c
@@ -15,17 +15,16 @@
#include <linux/sysfs.h>
#include <linux/regulator/consumer.h>
#include <linux/module.h>
+#include <linux/bitops.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>
#include <linux/iio/dac/ad5504.h>
-#define AD5505_BITS 12
-#define AD5504_RES_MASK ((1 << (AD5505_BITS)) - 1)
-
-#define AD5504_CMD_READ (1 << 15)
-#define AD5504_CMD_WRITE (0 << 15)
+#define AD5504_RES_MASK GENMASK(11, 0)
+#define AD5504_CMD_READ BIT(15)
+#define AD5504_CMD_WRITE 0
#define AD5504_ADDR(addr) ((addr) << 12)
/* Registers */
@@ -42,7 +41,7 @@
/**
* struct ad5446_state - driver instance specific data
- * @us: spi_device
+ * @spi: spi_device
* @reg: supply regulator
* @vref_mv: actual reference voltage used
* @pwr_down_mask power down mask
--
1.9.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 03/12] iio:adc:ad7887: Use BIT() and GENMASK() macros
2014-06-07 15:42 [PATCH 00/12] misc IIO cleanup Peter Meerwald
2014-06-07 15:42 ` [PATCH 01/12] iio:adc:ad5791: Use BIT() and GENMASK() macros Peter Meerwald
2014-06-07 15:42 ` [PATCH 02/12] iio:adc:ad5504: " Peter Meerwald
@ 2014-06-07 15:42 ` Peter Meerwald
2014-06-09 11:59 ` Lars-Peter Clausen
2014-06-07 15:42 ` [PATCH 04/12] iio:adc:ad7476: Use GENMASK() macro Peter Meerwald
` (9 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Peter Meerwald @ 2014-06-07 15:42 UTC (permalink / raw)
To: linux-iio; +Cc: jic23, Peter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
drivers/iio/adc/ad7887.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c
index 749a6ca..2fd012e 100644
--- a/drivers/iio/adc/ad7887.c
+++ b/drivers/iio/adc/ad7887.c
@@ -15,6 +15,7 @@
#include <linux/err.h>
#include <linux/module.h>
#include <linux/interrupt.h>
+#include <linux/bitops.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
@@ -25,14 +26,14 @@
#include <linux/platform_data/ad7887.h>
-#define AD7887_REF_DIS (1 << 5) /* on-chip reference disable */
-#define AD7887_DUAL (1 << 4) /* dual-channel mode */
-#define AD7887_CH_AIN1 (1 << 3) /* convert on channel 1, DUAL=1 */
-#define AD7887_CH_AIN0 (0 << 3) /* convert on channel 0, DUAL=0,1 */
-#define AD7887_PM_MODE1 (0) /* CS based shutdown */
-#define AD7887_PM_MODE2 (1) /* full on */
-#define AD7887_PM_MODE3 (2) /* auto shutdown after conversion */
-#define AD7887_PM_MODE4 (3) /* standby mode */
+#define AD7887_REF_DIS BIT(5) /* on-chip reference disable */
+#define AD7887_DUAL BIT(4) /* dual-channel mode */
+#define AD7887_CH_AIN1 BIT(3) /* convert on channel 1, DUAL=1 */
+#define AD7887_CH_AIN0 0 /* convert on channel 0, DUAL=0,1 */
+#define AD7887_PM_MODE1 0 /* CS based shutdown */
+#define AD7887_PM_MODE2 1 /* full on */
+#define AD7887_PM_MODE3 2 /* auto shutdown after conversion */
+#define AD7887_PM_MODE4 3 /* standby mode */
enum ad7887_channels {
AD7887_CH0,
@@ -40,8 +41,6 @@ enum ad7887_channels {
AD7887_CH1,
};
-#define RES_MASK(bits) ((1 << (bits)) - 1)
-
/**
* struct ad7887_chip_info - chip specifc information
* @int_vref_mv: the internal reference voltage
@@ -167,7 +166,7 @@ static int ad7887_read_raw(struct iio_dev *indio_dev,
if (ret < 0)
return ret;
*val = ret >> chan->scan_type.shift;
- *val &= RES_MASK(chan->scan_type.realbits);
+ *val &= GENMASK(chan->scan_type.realbits - 1, 0);
return IIO_VAL_INT;
case IIO_CHAN_INFO_SCALE:
if (st->reg) {
--
1.9.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 04/12] iio:adc:ad7476: Use GENMASK() macro
2014-06-07 15:42 [PATCH 00/12] misc IIO cleanup Peter Meerwald
` (2 preceding siblings ...)
2014-06-07 15:42 ` [PATCH 03/12] iio:adc:ad7887: " Peter Meerwald
@ 2014-06-07 15:42 ` Peter Meerwald
2014-06-09 12:00 ` Lars-Peter Clausen
2014-06-07 15:42 ` [PATCH 05/12] iio:adc:ad7298: Use BIT() and GENMASK() macros Peter Meerwald
` (8 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Peter Meerwald @ 2014-06-07 15:42 UTC (permalink / raw)
To: linux-iio; +Cc: jic23, Peter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
drivers/iio/adc/ad7476.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
index d141d45..ce400ec 100644
--- a/drivers/iio/adc/ad7476.c
+++ b/drivers/iio/adc/ad7476.c
@@ -14,6 +14,7 @@
#include <linux/regulator/consumer.h>
#include <linux/err.h>
#include <linux/module.h>
+#include <linux/bitops.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
@@ -21,8 +22,6 @@
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
-#define RES_MASK(bits) ((1 << (bits)) - 1)
-
struct ad7476_state;
struct ad7476_chip_info {
@@ -117,7 +116,7 @@ static int ad7476_read_raw(struct iio_dev *indio_dev,
if (ret < 0)
return ret;
*val = (ret >> st->chip_info->channel[0].scan_type.shift) &
- RES_MASK(st->chip_info->channel[0].scan_type.realbits);
+ GENMASK(st->chip_info->channel[0].scan_type.realbits - 1, 0);
return IIO_VAL_INT;
case IIO_CHAN_INFO_SCALE:
if (!st->chip_info->int_vref_uv) {
--
1.9.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 05/12] iio:adc:ad7298: Use BIT() and GENMASK() macros
2014-06-07 15:42 [PATCH 00/12] misc IIO cleanup Peter Meerwald
` (3 preceding siblings ...)
2014-06-07 15:42 ` [PATCH 04/12] iio:adc:ad7476: Use GENMASK() macro Peter Meerwald
@ 2014-06-07 15:42 ` Peter Meerwald
2014-06-09 12:00 ` Lars-Peter Clausen
2014-06-07 15:42 ` [PATCH 06/12] iio: Move documentation of iio-trig-sysfs to ABI Peter Meerwald
` (7 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Peter Meerwald @ 2014-06-07 15:42 UTC (permalink / raw)
To: linux-iio; +Cc: jic23, Peter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
drivers/iio/adc/ad7298.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/drivers/iio/adc/ad7298.c b/drivers/iio/adc/ad7298.c
index 2a3b65c..4a8c0a2 100644
--- a/drivers/iio/adc/ad7298.c
+++ b/drivers/iio/adc/ad7298.c
@@ -16,6 +16,7 @@
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/interrupt.h>
+#include <linux/bitops.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
@@ -25,23 +26,19 @@
#include <linux/platform_data/ad7298.h>
-#define AD7298_WRITE (1 << 15) /* write to the control register */
-#define AD7298_REPEAT (1 << 14) /* repeated conversion enable */
-#define AD7298_CH(x) (1 << (13 - (x))) /* channel select */
-#define AD7298_TSENSE (1 << 5) /* temperature conversion enable */
-#define AD7298_EXTREF (1 << 2) /* external reference enable */
-#define AD7298_TAVG (1 << 1) /* temperature sensor averaging enable */
-#define AD7298_PDD (1 << 0) /* partial power down enable */
+#define AD7298_WRITE BIT(15) /* write to the control register */
+#define AD7298_REPEAT BIT(14) /* repeated conversion enable */
+#define AD7298_CH(x) BIT(13 - (x)) /* channel select */
+#define AD7298_TSENSE BIT(5) /* temperature conversion enable */
+#define AD7298_EXTREF BIT(2) /* external reference enable */
+#define AD7298_TAVG BIT(1) /* temperature sensor averaging enable */
+#define AD7298_PDD BIT(0) /* partial power down enable */
#define AD7298_MAX_CHAN 8
-#define AD7298_BITS 12
-#define AD7298_STORAGE_BITS 16
#define AD7298_INTREF_mV 2500
#define AD7298_CH_TEMP 9
-#define RES_MASK(bits) ((1 << (bits)) - 1)
-
struct ad7298_state {
struct spi_device *spi;
struct regulator *reg;
@@ -257,7 +254,7 @@ static int ad7298_read_raw(struct iio_dev *indio_dev,
return ret;
if (chan->address != AD7298_CH_TEMP)
- *val = ret & RES_MASK(AD7298_BITS);
+ *val = ret & GENMASK(chan->scan_type.realbits - 1, 0);
return IIO_VAL_INT;
case IIO_CHAN_INFO_SCALE:
--
1.9.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 06/12] iio: Move documentation of iio-trig-sysfs to ABI
2014-06-07 15:42 [PATCH 00/12] misc IIO cleanup Peter Meerwald
` (4 preceding siblings ...)
2014-06-07 15:42 ` [PATCH 05/12] iio:adc:ad7298: Use BIT() and GENMASK() macros Peter Meerwald
@ 2014-06-07 15:42 ` Peter Meerwald
2014-06-09 19:58 ` Jonathan Cameron
2014-06-07 15:42 ` [PATCH 07/12] staging:iio: Update iio_event_monitor program Peter Meerwald
` (6 subsequent siblings)
12 siblings, 1 reply; 22+ messages in thread
From: Peter Meerwald @ 2014-06-07 15:42 UTC (permalink / raw)
To: linux-iio; +Cc: jic23, Peter Meerwald
iio-trig-sysfs has left staging with commit e64e7d5c
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
Documentation/ABI/testing/sysfs-bus-iio | 12 ++++++++++++
.../staging/iio/Documentation/sysfs-bus-iio-trigger-sysfs | 11 -----------
2 files changed, 12 insertions(+), 11 deletions(-)
delete mode 100644 drivers/staging/iio/Documentation/sysfs-bus-iio-trigger-sysfs
diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
index ed202b3..5e86ee9 100644
--- a/Documentation/ABI/testing/sysfs-bus-iio
+++ b/Documentation/ABI/testing/sysfs-bus-iio
@@ -19,6 +19,18 @@ Description:
generalize well and hence are not documented in this file.
X is the IIO index of the trigger.
+What: /sys/bus/iio/devices/triggerX/trigger_now
+KernelVersion: 2.6.38
+Contact: linux-iio@vger.kernel.org
+Description:
+ This file is provided by the iio-trig-sysfs stand-alone trigger
+ driver. Writing this file with any value triggers an event
+ driven driver, associated with this trigger, to capture data
+ into an in kernel buffer. This approach can be valuable during
+ automated testing or in situations, where other trigger methods
+ are not applicable. For example no RTC or spare GPIOs.
+ X is the IIO index of the trigger.
+
What: /sys/bus/iio/devices/iio:deviceX/buffer
KernelVersion: 2.6.35
Contact: linux-iio@vger.kernel.org
diff --git a/drivers/staging/iio/Documentation/sysfs-bus-iio-trigger-sysfs b/drivers/staging/iio/Documentation/sysfs-bus-iio-trigger-sysfs
deleted file mode 100644
index 5235e6c..0000000
--- a/drivers/staging/iio/Documentation/sysfs-bus-iio-trigger-sysfs
+++ /dev/null
@@ -1,11 +0,0 @@
-What: /sys/bus/iio/devices/triggerX/trigger_now
-KernelVersion: 2.6.38
-Contact: linux-iio@vger.kernel.org
-Description:
- This file is provided by the iio-trig-sysfs stand-alone trigger
- driver. Writing this file with any value triggers an event
- driven driver, associated with this trigger, to capture data
- into an in kernel buffer. This approach can be valuable during
- automated testing or in situations, where other trigger methods
- are not applicable. For example no RTC or spare GPIOs.
- X is the IIO index of the trigger.
--
1.9.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH 06/12] iio: Move documentation of iio-trig-sysfs to ABI
2014-06-07 15:42 ` [PATCH 06/12] iio: Move documentation of iio-trig-sysfs to ABI Peter Meerwald
@ 2014-06-09 19:58 ` Jonathan Cameron
0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2014-06-09 19:58 UTC (permalink / raw)
To: Peter Meerwald, linux-iio
On 07/06/14 16:42, Peter Meerwald wrote:
> iio-trig-sysfs has left staging with commit e64e7d5c
>
> Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Hi Peter,
Good point, but this still wants to have it's own file
Documentation/ABI/testing/sysfs-bus-iio-trigger-sysfs as the attribute is specific
to only this device and not part of the more general iio sysfs abi.
Thanks,
> ---
> Documentation/ABI/testing/sysfs-bus-iio | 12 ++++++++++++
> .../staging/iio/Documentation/sysfs-bus-iio-trigger-sysfs | 11 -----------
> 2 files changed, 12 insertions(+), 11 deletions(-)
> delete mode 100644 drivers/staging/iio/Documentation/sysfs-bus-iio-trigger-sysfs
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> index ed202b3..5e86ee9 100644
> --- a/Documentation/ABI/testing/sysfs-bus-iio
> +++ b/Documentation/ABI/testing/sysfs-bus-iio
> @@ -19,6 +19,18 @@ Description:
> generalize well and hence are not documented in this file.
> X is the IIO index of the trigger.
>
> +What: /sys/bus/iio/devices/triggerX/trigger_now
> +KernelVersion: 2.6.38
> +Contact: linux-iio@vger.kernel.org
> +Description:
> + This file is provided by the iio-trig-sysfs stand-alone trigger
> + driver. Writing this file with any value triggers an event
> + driven driver, associated with this trigger, to capture data
> + into an in kernel buffer. This approach can be valuable during
> + automated testing or in situations, where other trigger methods
> + are not applicable. For example no RTC or spare GPIOs.
> + X is the IIO index of the trigger.
> +
> What: /sys/bus/iio/devices/iio:deviceX/buffer
> KernelVersion: 2.6.35
> Contact: linux-iio@vger.kernel.org
> diff --git a/drivers/staging/iio/Documentation/sysfs-bus-iio-trigger-sysfs b/drivers/staging/iio/Documentation/sysfs-bus-iio-trigger-sysfs
> deleted file mode 100644
> index 5235e6c..0000000
> --- a/drivers/staging/iio/Documentation/sysfs-bus-iio-trigger-sysfs
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -What: /sys/bus/iio/devices/triggerX/trigger_now
> -KernelVersion: 2.6.38
> -Contact: linux-iio@vger.kernel.org
> -Description:
> - This file is provided by the iio-trig-sysfs stand-alone trigger
> - driver. Writing this file with any value triggers an event
> - driven driver, associated with this trigger, to capture data
> - into an in kernel buffer. This approach can be valuable during
> - automated testing or in situations, where other trigger methods
> - are not applicable. For example no RTC or spare GPIOs.
> - X is the IIO index of the trigger.
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 07/12] staging:iio: Update iio_event_monitor program
2014-06-07 15:42 [PATCH 00/12] misc IIO cleanup Peter Meerwald
` (5 preceding siblings ...)
2014-06-07 15:42 ` [PATCH 06/12] iio: Move documentation of iio-trig-sysfs to ABI Peter Meerwald
@ 2014-06-07 15:42 ` Peter Meerwald
2014-06-07 15:42 ` [PATCH 08/12] staging:iio: Fix iio_utils.h function prototypes Peter Meerwald
` (5 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Peter Meerwald @ 2014-06-07 15:42 UTC (permalink / raw)
To: linux-iio; +Cc: jic23, Peter Meerwald
add types recently added
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
drivers/staging/iio/Documentation/iio_event_monitor.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/staging/iio/Documentation/iio_event_monitor.c b/drivers/staging/iio/Documentation/iio_event_monitor.c
index 3a9b000..cb35a97 100644
--- a/drivers/staging/iio/Documentation/iio_event_monitor.c
+++ b/drivers/staging/iio/Documentation/iio_event_monitor.c
@@ -46,6 +46,9 @@ static const char * const iio_chan_type_name_spec[] = {
[IIO_TIMESTAMP] = "timestamp",
[IIO_CAPACITANCE] = "capacitance",
[IIO_ALTVOLTAGE] = "altvoltage",
+ [IIO_CCT] = "cct",
+ [IIO_PRESSURE] = "pressure",
+ [IIO_HUMIDITYRELATIVE] = "humidityrelative",
};
static const char * const iio_ev_type_text[] = {
@@ -70,6 +73,8 @@ static const char * const iio_modifier_names[] = {
[IIO_MOD_LIGHT_IR] = "ir",
[IIO_MOD_ROOT_SUM_SQUARED_X_Y] = "sqrt(x^2+y^2)",
[IIO_MOD_SUM_SQUARED_X_Y_Z] = "x^2+y^2+z^2",
+ [IIO_MOD_LIGHT_BOTH] = "both",
+ [IIO_MOD_LIGHT_IR] = "ir",
[IIO_MOD_LIGHT_CLEAR] = "clear",
[IIO_MOD_LIGHT_RED] = "red",
[IIO_MOD_LIGHT_GREEN] = "green",
@@ -100,6 +105,9 @@ static bool event_is_known(struct iio_event_data *event)
case IIO_TIMESTAMP:
case IIO_CAPACITANCE:
case IIO_ALTVOLTAGE:
+ case IIO_CCT:
+ case IIO_PRESSURE:
+ case IIO_HUMIDITYRELATIVE:
break;
default:
return false;
@@ -114,6 +122,8 @@ static bool event_is_known(struct iio_event_data *event)
case IIO_MOD_LIGHT_IR:
case IIO_MOD_ROOT_SUM_SQUARED_X_Y:
case IIO_MOD_SUM_SQUARED_X_Y_Z:
+ case IIO_MOD_LIGHT_BOTH:
+ case IIO_MOD_LIGHT_IR:
case IIO_MOD_LIGHT_CLEAR:
case IIO_MOD_LIGHT_RED:
case IIO_MOD_LIGHT_GREEN:
--
1.9.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 08/12] staging:iio: Fix iio_utils.h function prototypes
2014-06-07 15:42 [PATCH 00/12] misc IIO cleanup Peter Meerwald
` (6 preceding siblings ...)
2014-06-07 15:42 ` [PATCH 07/12] staging:iio: Update iio_event_monitor program Peter Meerwald
@ 2014-06-07 15:42 ` Peter Meerwald
2014-06-07 15:42 ` [PATCH 09/12] staging:iio: Fix mention of INDIO_RING_TRIGGERED to INDIO_BUFFER_TRIGGERED Peter Meerwald
` (4 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Peter Meerwald @ 2014-06-07 15:42 UTC (permalink / raw)
To: linux-iio; +Cc: jic23, Peter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
drivers/staging/iio/Documentation/iio_utils.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h
index a9cfc06..0973a09 100644
--- a/drivers/staging/iio/Documentation/iio_utils.h
+++ b/drivers/staging/iio/Documentation/iio_utils.h
@@ -633,7 +633,7 @@ error_free:
int read_sysfs_float(char *filename, char *basedir, float *val)
{
- float ret = 0;
+ int ret = 0;
FILE *sysfsfp;
char *temp = malloc(strlen(basedir) + strlen(filename) + 2);
if (temp == NULL) {
@@ -653,9 +653,9 @@ error_free:
return ret;
}
-read_sysfs_string(const char *filename, const char *basedir, char *str)
+int read_sysfs_string(const char *filename, const char *basedir, char *str)
{
- float ret = 0;
+ int ret = 0;
FILE *sysfsfp;
char *temp = malloc(strlen(basedir) + strlen(filename) + 2);
if (temp == NULL) {
--
1.9.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 09/12] staging:iio: Fix mention of INDIO_RING_TRIGGERED to INDIO_BUFFER_TRIGGERED
2014-06-07 15:42 [PATCH 00/12] misc IIO cleanup Peter Meerwald
` (7 preceding siblings ...)
2014-06-07 15:42 ` [PATCH 08/12] staging:iio: Fix iio_utils.h function prototypes Peter Meerwald
@ 2014-06-07 15:42 ` Peter Meerwald
2014-06-07 15:42 ` [PATCH 10/12] staging:iio: Fix error handling in generic_buffer example Peter Meerwald
` (3 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Peter Meerwald @ 2014-06-07 15:42 UTC (permalink / raw)
To: linux-iio; +Cc: jic23, Peter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
drivers/staging/iio/Documentation/trigger.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/iio/Documentation/trigger.txt b/drivers/staging/iio/Documentation/trigger.txt
index 64e2e08..7c0e505 100644
--- a/drivers/staging/iio/Documentation/trigger.txt
+++ b/drivers/staging/iio/Documentation/trigger.txt
@@ -31,5 +31,5 @@ consumers.
Trigger Consumers
Currently triggers are only used for the filling of software
-buffers and as such any device supporting INDIO_RING_TRIGGERED has the
+buffers and as such any device supporting INDIO_BUFFER_TRIGGERED has the
consumer interface automatically created.
--
1.9.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 10/12] staging:iio: Fix error handling in generic_buffer example
2014-06-07 15:42 [PATCH 00/12] misc IIO cleanup Peter Meerwald
` (8 preceding siblings ...)
2014-06-07 15:42 ` [PATCH 09/12] staging:iio: Fix mention of INDIO_RING_TRIGGERED to INDIO_BUFFER_TRIGGERED Peter Meerwald
@ 2014-06-07 15:42 ` Peter Meerwald
2014-06-07 15:42 ` [PATCH 11/12] staging:iio-trig-periodic-rtc: Cleanup Peter Meerwald
` (2 subsequent siblings)
12 siblings, 0 replies; 22+ messages in thread
From: Peter Meerwald @ 2014-06-07 15:42 UTC (permalink / raw)
To: linux-iio; +Cc: jic23, Peter Meerwald
read() does not return -EAGAIN
read() returns -1 and the errno value needs to be checked for -EAGAIN
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
drivers/staging/iio/Documentation/generic_buffer.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c
index 40d0eca..044ea19 100644
--- a/drivers/staging/iio/Documentation/generic_buffer.c
+++ b/drivers/staging/iio/Documentation/generic_buffer.c
@@ -305,9 +305,12 @@ int main(int argc, char **argv)
read_size = read(fp,
data,
toread*scan_size);
- if (read_size == -EAGAIN) {
- printf("nothing available\n");
- continue;
+ if (read_size < 0) {
+ if (errno == -EAGAIN) {
+ printf("nothing available\n");
+ continue;
+ } else
+ break;
}
for (i = 0; i < read_size/scan_size; i++)
process_scan(data + scan_size*i,
--
1.9.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH 11/12] staging:iio-trig-periodic-rtc: Cleanup
2014-06-07 15:42 [PATCH 00/12] misc IIO cleanup Peter Meerwald
` (9 preceding siblings ...)
2014-06-07 15:42 ` [PATCH 10/12] staging:iio: Fix error handling in generic_buffer example Peter Meerwald
@ 2014-06-07 15:42 ` Peter Meerwald
2014-06-09 20:02 ` Jonathan Cameron
2014-06-07 15:42 ` [PATCH 12/12] staging:iio-trig-periodic-rtc: Allow to reset frequency to 0 Peter Meerwald
2014-06-09 20:05 ` [PATCH 00/12] misc IIO cleanup Jonathan Cameron
12 siblings, 1 reply; 22+ messages in thread
From: Peter Meerwald @ 2014-06-07 15:42 UTC (permalink / raw)
To: linux-iio; +Cc: jic23, Peter Meerwald
Fix extra space in module description
Silence output about trigger frequency when trigger gets enabled/disabled
Add dash to make trigger name look nicer (periodicrtc0 -> periodic-rtc0)
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
index 38ecb4b..7283e50 100644
--- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
+++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
@@ -33,7 +33,7 @@ static int iio_trig_periodic_rtc_set_state(struct iio_trigger *trig, bool state)
struct iio_prtc_trigger_info *trig_info = iio_trigger_get_drvdata(trig);
if (trig_info->frequency == 0)
return -EINVAL;
- dev_info(&trig_info->rtc->dev, "trigger frequency is %d\n",
+ dev_dbg(&trig_info->rtc->dev, "trigger frequency is %d\n",
trig_info->frequency);
return rtc_irq_set_state(trig_info->rtc, &trig_info->task, state);
}
@@ -113,7 +113,7 @@ static int iio_trig_periodic_rtc_probe(struct platform_device *dev)
for (i = 0;; i++) {
if (pdata[i] == NULL)
break;
- trig = iio_trigger_alloc("periodic%s", pdata[i]);
+ trig = iio_trigger_alloc("periodic-%s", pdata[i]);
if (!trig) {
ret = -ENOMEM;
goto error_free_completed_registrations;
@@ -128,8 +128,7 @@ static int iio_trig_periodic_rtc_probe(struct platform_device *dev)
iio_trigger_set_drvdata(trig, trig_info);
trig->ops = &iio_prtc_trigger_ops;
/* RTC access */
- trig_info->rtc
- = rtc_class_open(pdata[i]);
+ trig_info->rtc = rtc_class_open(pdata[i]);
if (trig_info->rtc == NULL) {
ret = -EINVAL;
goto error_free_trig_info;
@@ -199,5 +198,5 @@ static struct platform_driver iio_trig_periodic_rtc_driver = {
module_platform_driver(iio_trig_periodic_rtc_driver);
MODULE_AUTHOR("Jonathan Cameron <jic23@kernel.org>");
-MODULE_DESCRIPTION("Periodic realtime clock trigger for the iio subsystem");
+MODULE_DESCRIPTION("Periodic realtime clock trigger for the iio subsystem");
MODULE_LICENSE("GPL v2");
--
1.9.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH 11/12] staging:iio-trig-periodic-rtc: Cleanup
2014-06-07 15:42 ` [PATCH 11/12] staging:iio-trig-periodic-rtc: Cleanup Peter Meerwald
@ 2014-06-09 20:02 ` Jonathan Cameron
2014-06-09 20:04 ` Peter Meerwald
0 siblings, 1 reply; 22+ messages in thread
From: Jonathan Cameron @ 2014-06-09 20:02 UTC (permalink / raw)
To: Peter Meerwald, linux-iio
On 07/06/14 16:42, Peter Meerwald wrote:
> Fix extra space in module description
> Silence output about trigger frequency when trigger gets enabled/disabled
> Add dash to make trigger name look nicer (periodicrtc0 -> periodic-rtc0)
All good bar the last one. That's an ABI change unfortunately.
Whilst I agree the - would have been nice we are stuck with it for now.
(of course I'm aiming to drop this driver fairly soon anyway which I
guess is a rather larger ABI change, but lets be tidy until then!)
>
> Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
> ---
> drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> index 38ecb4b..7283e50 100644
> --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> @@ -33,7 +33,7 @@ static int iio_trig_periodic_rtc_set_state(struct iio_trigger *trig, bool state)
> struct iio_prtc_trigger_info *trig_info = iio_trigger_get_drvdata(trig);
> if (trig_info->frequency == 0)
> return -EINVAL;
> - dev_info(&trig_info->rtc->dev, "trigger frequency is %d\n",
> + dev_dbg(&trig_info->rtc->dev, "trigger frequency is %d\n",
> trig_info->frequency);
> return rtc_irq_set_state(trig_info->rtc, &trig_info->task, state);
> }
> @@ -113,7 +113,7 @@ static int iio_trig_periodic_rtc_probe(struct platform_device *dev)
> for (i = 0;; i++) {
> if (pdata[i] == NULL)
> break;
> - trig = iio_trigger_alloc("periodic%s", pdata[i]);
> + trig = iio_trigger_alloc("periodic-%s", pdata[i]);
> if (!trig) {
> ret = -ENOMEM;
> goto error_free_completed_registrations;
> @@ -128,8 +128,7 @@ static int iio_trig_periodic_rtc_probe(struct platform_device *dev)
> iio_trigger_set_drvdata(trig, trig_info);
> trig->ops = &iio_prtc_trigger_ops;
> /* RTC access */
> - trig_info->rtc
> - = rtc_class_open(pdata[i]);
> + trig_info->rtc = rtc_class_open(pdata[i]);
> if (trig_info->rtc == NULL) {
> ret = -EINVAL;
> goto error_free_trig_info;
> @@ -199,5 +198,5 @@ static struct platform_driver iio_trig_periodic_rtc_driver = {
> module_platform_driver(iio_trig_periodic_rtc_driver);
>
> MODULE_AUTHOR("Jonathan Cameron <jic23@kernel.org>");
> -MODULE_DESCRIPTION("Periodic realtime clock trigger for the iio subsystem");
> +MODULE_DESCRIPTION("Periodic realtime clock trigger for the iio subsystem");
> MODULE_LICENSE("GPL v2");
>
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH 11/12] staging:iio-trig-periodic-rtc: Cleanup
2014-06-09 20:02 ` Jonathan Cameron
@ 2014-06-09 20:04 ` Peter Meerwald
2014-06-09 20:14 ` Jonathan Cameron
0 siblings, 1 reply; 22+ messages in thread
From: Peter Meerwald @ 2014-06-09 20:04 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio
Hello Jonathan,
> > Fix extra space in module description
> > Silence output about trigger frequency when trigger gets enabled/disabled
> > Add dash to make trigger name look nicer (periodicrtc0 -> periodic-rtc0)
> All good bar the last one. That's an ABI change unfortunately.
> Whilst I agree the - would have been nice we are stuck with it for now.
> (of course I'm aiming to drop this driver fairly soon anyway which I
> guess is a rather larger ABI change, but lets be tidy until then!)
what's going to happen with periodic-rtc?
I noticed that the proposed hrtimer trigger hasn't been merged yet?
regards, p.
> > diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> > b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> > index 38ecb4b..7283e50 100644
> > --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> > +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> > @@ -33,7 +33,7 @@ static int iio_trig_periodic_rtc_set_state(struct
> > iio_trigger *trig, bool state)
> > struct iio_prtc_trigger_info *trig_info =
> > iio_trigger_get_drvdata(trig);
> > if (trig_info->frequency == 0)
> > return -EINVAL;
> > - dev_info(&trig_info->rtc->dev, "trigger frequency is %d\n",
> > + dev_dbg(&trig_info->rtc->dev, "trigger frequency is %d\n",
> > trig_info->frequency);
> > return rtc_irq_set_state(trig_info->rtc, &trig_info->task, state);
> > }
> > @@ -113,7 +113,7 @@ static int iio_trig_periodic_rtc_probe(struct
> > platform_device *dev)
> > for (i = 0;; i++) {
> > if (pdata[i] == NULL)
> > break;
> > - trig = iio_trigger_alloc("periodic%s", pdata[i]);
> > + trig = iio_trigger_alloc("periodic-%s", pdata[i]);
> > if (!trig) {
> > ret = -ENOMEM;
> > goto error_free_completed_registrations;
> > @@ -128,8 +128,7 @@ static int iio_trig_periodic_rtc_probe(struct
> > platform_device *dev)
> > iio_trigger_set_drvdata(trig, trig_info);
> > trig->ops = &iio_prtc_trigger_ops;
> > /* RTC access */
> > - trig_info->rtc
> > - = rtc_class_open(pdata[i]);
> > + trig_info->rtc = rtc_class_open(pdata[i]);
> > if (trig_info->rtc == NULL) {
> > ret = -EINVAL;
> > goto error_free_trig_info;
> > @@ -199,5 +198,5 @@ static struct platform_driver
> > iio_trig_periodic_rtc_driver = {
> > module_platform_driver(iio_trig_periodic_rtc_driver);
> >
> > MODULE_AUTHOR("Jonathan Cameron <jic23@kernel.org>");
> > -MODULE_DESCRIPTION("Periodic realtime clock trigger for the iio
> > subsystem");
> > +MODULE_DESCRIPTION("Periodic realtime clock trigger for the iio
> > subsystem");
> > MODULE_LICENSE("GPL v2");
> >
>
--
Peter Meerwald
+43-664-2444418 (mobile)
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH 11/12] staging:iio-trig-periodic-rtc: Cleanup
2014-06-09 20:04 ` Peter Meerwald
@ 2014-06-09 20:14 ` Jonathan Cameron
0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2014-06-09 20:14 UTC (permalink / raw)
To: Peter Meerwald; +Cc: linux-iio
On 09/06/14 21:04, Peter Meerwald wrote:
> Hello Jonathan,
>
>>> Fix extra space in module description
>>> Silence output about trigger frequency when trigger gets enabled/disabled
>>> Add dash to make trigger name look nicer (periodicrtc0 -> periodic-rtc0)
>> All good bar the last one. That's an ABI change unfortunately.
>> Whilst I agree the - would have been nice we are stuck with it for now.
>> (of course I'm aiming to drop this driver fairly soon anyway which I
>> guess is a rather larger ABI change, but lets be tidy until then!)
>
> what's going to happen with periodic-rtc?
> I noticed that the proposed hrtimer trigger hasn't been merged yet?
You hit the nail on the head. Hrtimer is more general purpose
and IIRC some periodic rtc stuff was implemented with hrtimers now
anyway.
So when hrtimer is in place I'd propose we officially deprecate
periodic-rtc and kill it off after a cycle or two. It was original
a dirty hack to allow me to use some spare timers on the pxa27x chips.
J
>
> regards, p.
>
>>> diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
>>> b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
>>> index 38ecb4b..7283e50 100644
>>> --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
>>> +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
>>> @@ -33,7 +33,7 @@ static int iio_trig_periodic_rtc_set_state(struct
>>> iio_trigger *trig, bool state)
>>> struct iio_prtc_trigger_info *trig_info =
>>> iio_trigger_get_drvdata(trig);
>>> if (trig_info->frequency == 0)
>>> return -EINVAL;
>>> - dev_info(&trig_info->rtc->dev, "trigger frequency is %d\n",
>>> + dev_dbg(&trig_info->rtc->dev, "trigger frequency is %d\n",
>>> trig_info->frequency);
>>> return rtc_irq_set_state(trig_info->rtc, &trig_info->task, state);
>>> }
>>> @@ -113,7 +113,7 @@ static int iio_trig_periodic_rtc_probe(struct
>>> platform_device *dev)
>>> for (i = 0;; i++) {
>>> if (pdata[i] == NULL)
>>> break;
>>> - trig = iio_trigger_alloc("periodic%s", pdata[i]);
>>> + trig = iio_trigger_alloc("periodic-%s", pdata[i]);
>>> if (!trig) {
>>> ret = -ENOMEM;
>>> goto error_free_completed_registrations;
>>> @@ -128,8 +128,7 @@ static int iio_trig_periodic_rtc_probe(struct
>>> platform_device *dev)
>>> iio_trigger_set_drvdata(trig, trig_info);
>>> trig->ops = &iio_prtc_trigger_ops;
>>> /* RTC access */
>>> - trig_info->rtc
>>> - = rtc_class_open(pdata[i]);
>>> + trig_info->rtc = rtc_class_open(pdata[i]);
>>> if (trig_info->rtc == NULL) {
>>> ret = -EINVAL;
>>> goto error_free_trig_info;
>>> @@ -199,5 +198,5 @@ static struct platform_driver
>>> iio_trig_periodic_rtc_driver = {
>>> module_platform_driver(iio_trig_periodic_rtc_driver);
>>>
>>> MODULE_AUTHOR("Jonathan Cameron <jic23@kernel.org>");
>>> -MODULE_DESCRIPTION("Periodic realtime clock trigger for the iio
>>> subsystem");
>>> +MODULE_DESCRIPTION("Periodic realtime clock trigger for the iio
>>> subsystem");
>>> MODULE_LICENSE("GPL v2");
>>>
>>
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 12/12] staging:iio-trig-periodic-rtc: Allow to reset frequency to 0
2014-06-07 15:42 [PATCH 00/12] misc IIO cleanup Peter Meerwald
` (10 preceding siblings ...)
2014-06-07 15:42 ` [PATCH 11/12] staging:iio-trig-periodic-rtc: Cleanup Peter Meerwald
@ 2014-06-07 15:42 ` Peter Meerwald
2014-06-09 20:05 ` [PATCH 00/12] misc IIO cleanup Jonathan Cameron
12 siblings, 0 replies; 22+ messages in thread
From: Peter Meerwald @ 2014-06-07 15:42 UTC (permalink / raw)
To: linux-iio; +Cc: jic23, Peter Meerwald
periodic rtc trigger initially has frequency 0
it is possible to change trigger frequency on-the-fly, but it is not
possible to set frequency back to 0
this patch allows to set trigger frequency to 0, thereby disabling
the rtc interrupt
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
index 7283e50..1abe18f 100644
--- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
+++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
@@ -26,16 +26,22 @@ struct iio_prtc_trigger_info {
struct rtc_device *rtc;
int frequency;
struct rtc_task task;
+ bool state;
};
static int iio_trig_periodic_rtc_set_state(struct iio_trigger *trig, bool state)
{
struct iio_prtc_trigger_info *trig_info = iio_trigger_get_drvdata(trig);
- if (trig_info->frequency == 0)
+ int ret;
+ if (trig_info->frequency == 0 && state)
return -EINVAL;
dev_dbg(&trig_info->rtc->dev, "trigger frequency is %d\n",
trig_info->frequency);
- return rtc_irq_set_state(trig_info->rtc, &trig_info->task, state);
+ ret = rtc_irq_set_state(trig_info->rtc, &trig_info->task, state);
+ if (ret == 0)
+ trig_info->state = state;
+
+ return ret;
}
static ssize_t iio_trig_periodic_read_freq(struct device *dev,
@@ -61,7 +67,14 @@ static ssize_t iio_trig_periodic_write_freq(struct device *dev,
if (ret)
goto error_ret;
- ret = rtc_irq_set_freq(trig_info->rtc, &trig_info->task, val);
+ if (val > 0) {
+ ret = rtc_irq_set_freq(trig_info->rtc, &trig_info->task, val);
+ if (ret == 0 && trig_info->state && trig_info->frequency == 0)
+ ret = rtc_irq_set_state(trig_info->rtc, &trig_info->task, 1);
+ } else if (val == 0) {
+ ret = rtc_irq_set_state(trig_info->rtc, &trig_info->task, 0);
+ } else
+ ret = -EINVAL;
if (ret)
goto error_ret;
--
1.9.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH 00/12] misc IIO cleanup
2014-06-07 15:42 [PATCH 00/12] misc IIO cleanup Peter Meerwald
` (11 preceding siblings ...)
2014-06-07 15:42 ` [PATCH 12/12] staging:iio-trig-periodic-rtc: Allow to reset frequency to 0 Peter Meerwald
@ 2014-06-09 20:05 ` Jonathan Cameron
12 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2014-06-09 20:05 UTC (permalink / raw)
To: Peter Meerwald, linux-iio
On 07/06/14 16:42, Peter Meerwald wrote:
> patches 1 to 5 aim to use the BIT() and GENMASK() macros in various AD ADC
> drivers; this gets rid of the RES_MASK() macro #defined in each driver
>
> patch 6 move documentation of /sys/bus/iio/devices/triggerX/trigger_now to
> Documentation/ABI/testing/sysfs-bus-iio as iio-trig-sysfs has left staging
> with commit e64e7d5c
>
> patches 7 to 10 are cleanup and bugfixse to iio/staging
>
> patch 11 is cleanup to iio-trig-periodic-rtc (which is important and I think
> should leave staging soon -- what is left to do?)
>
> patch 12 allows to set the frequency of the periodic rtc to 0, thereby temporarily
> disabling the trigger
>
All but 6 and 11 look good to me.
> Peter Meerwald (12):
> iio:adc:ad5791: Use BIT() and GENMASK() macros
> iio:adc:ad5504: Use BIT() and GENMASK() macros
> iio:adc:ad7887: Use BIT() and GENMASK() macros
> iio:adc:ad7476: Use GENMASK() macro
> iio:adc:ad7298: Use BIT() and GENMASK() macros
> iio: Move documentation of iio-trig-sysfs to ABI
> staging:iio: Update iio_event_monitor program
> staging:iio: Fix iio_utils.h function prototypes
> staging:iio: Fix mention of INDIO_RING_TRIGGERED to
> INDIO_BUFFER_TRIGGERED
> staging:iio: Fix error handling in generic_buffer example
> staging:iio-trig-periodic-rtc: Cleanup
> staging:iio-trig-periodic-rtc: Allow to reset frequency to 0
>
> Documentation/ABI/testing/sysfs-bus-iio | 12 +++++++++
> drivers/iio/adc/ad7298.c | 21 +++++++---------
> drivers/iio/adc/ad7476.c | 5 ++--
> drivers/iio/adc/ad7887.c | 21 ++++++++--------
> drivers/iio/dac/ad5504.c | 11 ++++----
> drivers/iio/dac/ad5791.c | 29 +++++++++++-----------
> drivers/staging/iio/Documentation/generic_buffer.c | 9 ++++---
> .../staging/iio/Documentation/iio_event_monitor.c | 10 ++++++++
> drivers/staging/iio/Documentation/iio_utils.h | 6 ++---
> .../iio/Documentation/sysfs-bus-iio-trigger-sysfs | 11 --------
> drivers/staging/iio/Documentation/trigger.txt | 2 +-
> .../staging/iio/trigger/iio-trig-periodic-rtc.c | 28 +++++++++++++++------
> 12 files changed, 92 insertions(+), 73 deletions(-)
> delete mode 100644 drivers/staging/iio/Documentation/sysfs-bus-iio-trigger-sysfs
>
^ permalink raw reply [flat|nested] 22+ messages in thread