linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/4] iio: correct documentation for IIO_CONST_ATTR_SAMP_FREQ_AVAIL, match name of #define
  2012-06-17 17:03 [PATCH RESEND] iio staging: fix tsl2x7x file mode Peter Meerwald
@ 2012-06-17 17:03 ` Peter Meerwald
  2012-06-18  7:38   ` Jonathan Cameron
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Meerwald @ 2012-06-17 17:03 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, Peter Meerwald

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
 include/linux/iio/sysfs.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
index bfedb73..b7a934b 100644
--- a/include/linux/iio/sysfs.h
+++ b/include/linux/iio/sysfs.h
@@ -97,7 +97,7 @@ struct iio_const_attr {
 #define IIO_DEV_ATTR_SAMP_FREQ_AVAIL(_show)				\
 	IIO_DEVICE_ATTR(sampling_frequency_available, S_IRUGO, _show, NULL, 0)
 /**
- * IIO_CONST_ATTR_AVAIL_SAMP_FREQ - list available sampling frequencies
+ * IIO_CONST_ATTR_SAMP_FREQ_AVAIL - list available sampling frequencies
  * @_string: frequency string for the attribute
  *
  * Constant version
-- 
1.7.9.5

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

* Re: [PATCH 2/4] iio: correct documentation for IIO_CONST_ATTR_SAMP_FREQ_AVAIL, match name of #define
  2012-06-17 17:03 ` [PATCH 2/4] iio: correct documentation for IIO_CONST_ATTR_SAMP_FREQ_AVAIL, match name of #define Peter Meerwald
@ 2012-06-18  7:38   ` Jonathan Cameron
  0 siblings, 0 replies; 12+ messages in thread
From: Jonathan Cameron @ 2012-06-18  7:38 UTC (permalink / raw)
  To: Peter Meerwald; +Cc: linux-iio

On 6/17/2012 6:03 PM, Peter Meerwald wrote:
> Signed-off-by: Peter Meerwald<pmeerw@pmeerw.net>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
>   include/linux/iio/sysfs.h |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
> index bfedb73..b7a934b 100644
> --- a/include/linux/iio/sysfs.h
> +++ b/include/linux/iio/sysfs.h
> @@ -97,7 +97,7 @@ struct iio_const_attr {
>   #define IIO_DEV_ATTR_SAMP_FREQ_AVAIL(_show)				\
>   	IIO_DEVICE_ATTR(sampling_frequency_available, S_IRUGO, _show, NULL, 0)
>   /**
> - * IIO_CONST_ATTR_AVAIL_SAMP_FREQ - list available sampling frequencies
> + * IIO_CONST_ATTR_SAMP_FREQ_AVAIL - list available sampling frequencies
>    * @_string: frequency string for the attribute
>    *
>    * Constant version


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

* [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor
@ 2012-06-18 18:33 Peter Meerwald
  2012-06-18 18:33 ` [PATCH 1/4] iio: typo in iio_chan_spec.ext_info comment Peter Meerwald
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Peter Meerwald @ 2012-06-18 18:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-iio, Peter Meerwald

minimal driver, no IR current control and proximity/event handling
yet

v4 (address comments by Jonathan Cameron)
* remove SENSORS_ prefix in Kconfig
* change from IIO_INTENSITY to IIO_LIGHT
* move from staging

v3 (address comments by Shubhrajyoti Datta)
* cleanup Kconfig entry
* call I2C read/write functions directly

v2 (address comments by Lars-Peter Clausen and Jonathan Cameron)
* unify code for reading PS and AL data into
  parameterized _measure() function
* limit wait for data to become ready within 20 tries
* drop IIO_LIGHT channel, add SCALE to IIO_INTENSITY
* drop extra string arguments used for logging purpose only

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Jonathan Cameron <jic23@kernel.org>

---
 drivers/iio/light/Kconfig    |   11 +++
 drivers/iio/light/Makefile   |    1 +
 drivers/iio/light/vcnl4000.c |  216 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 228 insertions(+)
 create mode 100644 drivers/iio/light/vcnl4000.c

diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig
index db5618e..f3ea90d 100644
--- a/drivers/iio/light/Kconfig
+++ b/drivers/iio/light/Kconfig
@@ -19,4 +19,15 @@ config SENSORS_LM3533
 	  light zone through sysfs. A threshold event can be generated on zone
 	  changes. The ALS-control output values can be set per zone for the
 	  three current output channels.
+
+config VCNL4000
+	tristate "VCNL4000 combined ALS and proximity sensor"
+	depends on I2C
+	help
+	 Say Y here if you want to build a driver for the Vishay VCNL4000
+	 combined ambient light and proximity sensor.
+
+	 To compile this driver as a module, choose M here: the
+	 module will be called vcnl4000.
+
 endmenu
diff --git a/drivers/iio/light/Makefile b/drivers/iio/light/Makefile
index c1c23a0..06fa4d3 100644
--- a/drivers/iio/light/Makefile
+++ b/drivers/iio/light/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_SENSORS_LM3533)	+= lm3533-als.o
+obj-$(CONFIG_VCNL4000)		+= vcnl4000.o
diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
new file mode 100644
index 0000000..c278495
--- /dev/null
+++ b/drivers/iio/light/vcnl4000.c
@@ -0,0 +1,216 @@
+/*
+ * vcnl4000.c - Support for Vishay VCNL4000 combined ambient light and
+ * proximity sensor
+ *
+ * Copyright 2012 Peter Meerwald <pmeerw@pmeerw.net>
+ *
+ * This file is subject to the terms and conditions of version 2 of
+ * the GNU General Public License.  See the file COPYING in the main
+ * directory of this archive for more details.
+ *
+ * IIO driver for VCNL4000 (7-bit I2C slave address 0x13)
+ *
+ * TODO:
+ *   allow to adjust IR current
+ *   proximity threshold and event handling
+ */
+
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/err.h>
+#include <linux/delay.h>
+
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+
+#define VCNL4000_DRV_NAME "vcnl4000"
+
+#define VCNL4000_COMMAND	0x80 /* Command register */
+#define VCNL4000_PROD_REV	0x81 /* Product ID and Revision ID */
+#define VCNL4000_LED_CURRENT	0x83 /* IR LED current for proximity mode */
+#define VCNL4000_AL_PARAM	0x84 /* Ambient light parameter register */
+#define VCNL4000_AL_RESULT_HI	0x85 /* Ambient light result register, MSB */
+#define VCNL4000_AL_RESULT_LO	0x86 /* Ambient light result register, LSB */
+#define VCNL4000_PS_RESULT_HI	0x87 /* Proximity result register, MSB */
+#define VCNL4000_PS_RESULT_LO	0x88 /* Proximity result register, LSB */
+#define VCNL4000_PS_MEAS_FREQ	0x89 /* Proximity measurement signal frequency */
+#define VCNL4000_PS_MOD_ADJ	0x8a /* Proximity modulator timing adjustment */
+
+/* Bit masks for COMMAND register */
+#define VCNL4000_AL_RDY		0x40 /* ALS data ready? */
+#define VCNL4000_PS_RDY		0x20 /* proximity data ready? */
+#define VCNL4000_AL_OD		0x10 /* start on-demand ALS measurement */
+#define VCNL4000_PS_OD		0x08 /* start on-demand proximity measurement */
+
+struct vcnl4000_data {
+	struct i2c_client *client;
+};
+
+static const struct i2c_device_id vcnl4000_id[] = {
+	{ "vcnl4000", 0 },
+	{ }
+};
+MODULE_DEVICE_TABLE(i2c, vcnl4000_id);
+
+static int vcnl4000_measure(struct vcnl4000_data *data, u8 req_mask,
+				u8 rdy_mask, u8 data_reg, int *val)
+{
+	int tries = 20;
+	u16 buf;
+	int ret;
+
+	ret = i2c_smbus_write_byte_data(data->client, VCNL4000_COMMAND, req_mask);
+	if (ret < 0)
+		return ret;
+
+	/* wait for data to become ready */
+	while (tries--) {
+		ret = i2c_smbus_read_byte_data(data->client, VCNL4000_COMMAND);
+		if (ret < 0)
+			return ret;
+		if (ret & rdy_mask)
+			break;
+		msleep(1);
+	}
+
+	if (tries < 0) {
+		dev_err(&data->client->dev,
+			"vcnl4000_measure() failed, data not ready\n");
+		return -EIO;
+	}
+
+	ret = i2c_smbus_read_i2c_block_data(data->client,
+		data_reg, sizeof(buf), (u8 *) &buf);
+	if (ret < 0)
+		return ret;
+
+	*val = be16_to_cpu(buf);
+
+	return 0;
+}
+
+static const struct iio_chan_spec vcnl4000_channels[] = {
+	{
+		.type = IIO_LIGHT,
+		.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
+			IIO_CHAN_INFO_SCALE_SEPARATE_BIT,
+	}, {
+		.type = IIO_PROXIMITY,
+		.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT,
+	}
+};
+
+static int vcnl4000_read_raw(struct iio_dev *indio_dev,
+				struct iio_chan_spec const *chan,
+				int *val, int *val2, long mask)
+{
+	int ret = -EINVAL;
+	struct vcnl4000_data *data = iio_priv(indio_dev);
+
+	switch (mask) {
+	case IIO_CHAN_INFO_RAW:
+		switch (chan->type) {
+		case IIO_LIGHT:
+			ret = vcnl4000_measure(data,
+				VCNL4000_AL_OD, VCNL4000_AL_RDY,
+				VCNL4000_AL_RESULT_HI, val);
+			if (ret < 0)
+				return ret;
+			ret = IIO_VAL_INT;
+			break;
+		case IIO_PROXIMITY:
+			ret = vcnl4000_measure(data,
+				VCNL4000_PS_OD, VCNL4000_PS_RDY,
+				VCNL4000_PS_RESULT_HI, val);
+			if (ret < 0)
+				return ret;
+			ret = IIO_VAL_INT;
+			break;
+		default:
+			break;
+		}
+		break;
+	case IIO_CHAN_INFO_SCALE:
+		if (chan->type == IIO_LIGHT) {
+			*val = 0;
+			*val2 = 250000;
+			ret = IIO_VAL_INT_PLUS_MICRO;
+		}
+		break;
+	default:
+		break;
+	}
+
+	return ret;
+}
+
+static const struct iio_info vcnl4000_info = {
+	.read_raw = vcnl4000_read_raw,
+	.driver_module = THIS_MODULE,
+};
+
+static int __devinit vcnl4000_probe(struct i2c_client *client,
+					const struct i2c_device_id *id)
+{
+	struct vcnl4000_data *data;
+	struct iio_dev *indio_dev;
+	int ret;
+
+	indio_dev = iio_device_alloc(sizeof(*data));
+	if (!indio_dev)
+		return -ENOMEM;
+
+	data = iio_priv(indio_dev);
+	i2c_set_clientdata(client, indio_dev);
+	data->client = client;
+
+	ret = i2c_smbus_read_byte_data(data->client, VCNL4000_PROD_REV);
+	if (ret < 0)
+		goto error_free_dev;
+
+	dev_info(&client->dev, "VCNL4000 Ambient light/proximity sensor, "
+		"Prod %02x, Rev: %02x\n", ret >> 4, ret & 0xf);
+
+	indio_dev->dev.parent = &client->dev;
+	indio_dev->info = &vcnl4000_info;
+	indio_dev->channels = vcnl4000_channels;
+	indio_dev->num_channels = ARRAY_SIZE(vcnl4000_channels);
+	indio_dev->name = VCNL4000_DRV_NAME;
+	indio_dev->modes = INDIO_DIRECT_MODE;
+
+	ret = iio_device_register(indio_dev);
+	if (ret < 0)
+		goto error_free_dev;
+
+	return 0;
+
+error_free_dev:
+	iio_device_free(indio_dev);
+	return ret;
+}
+
+static int __devexit vcnl4000_remove(struct i2c_client *client)
+{
+	struct iio_dev *indio_dev = i2c_get_clientdata(client);
+
+	iio_device_unregister(indio_dev);
+	iio_device_free(indio_dev);
+
+	return 0;
+}
+
+static struct i2c_driver vcnl4000_driver = {
+	.driver = {
+		.name   = VCNL4000_DRV_NAME,
+		.owner  = THIS_MODULE,
+	},
+	.probe  = vcnl4000_probe,
+	.remove = __devexit_p(vcnl4000_remove),
+	.id_table = vcnl4000_id,
+};
+
+module_i2c_driver(vcnl4000_driver);
+
+MODULE_AUTHOR("Peter Meerwald <pmeerw@pmeerw.net>");
+MODULE_DESCRIPTION("Vishay VCNL4000 proximity/ambient light sensor driver");
+MODULE_LICENSE("GPL");
-- 
1.7.9.5


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

* [PATCH 1/4] iio: typo in iio_chan_spec.ext_info comment
  2012-06-18 18:33 [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor Peter Meerwald
@ 2012-06-18 18:33 ` Peter Meerwald
  2012-06-18 18:33 ` [PATCH 2/4] iio: correct documentation for IIO_CONST_ATTR_SAMP_FREQ_AVAIL, match name of #define Peter Meerwald
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Peter Meerwald @ 2012-06-18 18:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-iio, Peter Meerwald

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Jonathan Cameron <jic23@kernel.org>

---
 include/linux/iio/iio.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index ae0cad9..2afbb6f 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -214,7 +214,7 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
  * @event_mask:		What events can this channel produce.
  * @ext_info:		Array of extended info attributes for this channel.
  *			The array is NULL terminated, the last element should
- *			have it's name field set to NULL.
+ *			have its name field set to NULL.
  * @extend_name:	Allows labeling of channel attributes with an
  *			informative name. Note this has no effect codes etc,
  *			unlike modifiers.
-- 
1.7.9.5


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

* [PATCH 2/4] iio: correct documentation for IIO_CONST_ATTR_SAMP_FREQ_AVAIL, match name of #define
  2012-06-18 18:33 [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor Peter Meerwald
  2012-06-18 18:33 ` [PATCH 1/4] iio: typo in iio_chan_spec.ext_info comment Peter Meerwald
@ 2012-06-18 18:33 ` Peter Meerwald
  2012-06-18 18:33 ` [PATCH 3/4] iio: remove extra ; after function definition Peter Meerwald
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Peter Meerwald @ 2012-06-18 18:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-iio, Peter Meerwald

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Jonathan Cameron <jic23@kernel.org>

---
 include/linux/iio/sysfs.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
index bfedb73..b7a934b 100644
--- a/include/linux/iio/sysfs.h
+++ b/include/linux/iio/sysfs.h
@@ -97,7 +97,7 @@ struct iio_const_attr {
 #define IIO_DEV_ATTR_SAMP_FREQ_AVAIL(_show)				\
 	IIO_DEVICE_ATTR(sampling_frequency_available, S_IRUGO, _show, NULL, 0)
 /**
- * IIO_CONST_ATTR_AVAIL_SAMP_FREQ - list available sampling frequencies
+ * IIO_CONST_ATTR_SAMP_FREQ_AVAIL - list available sampling frequencies
  * @_string: frequency string for the attribute
  *
  * Constant version
-- 
1.7.9.5


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

* [PATCH 3/4] iio: remove extra ; after function definition
  2012-06-18 18:33 [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor Peter Meerwald
  2012-06-18 18:33 ` [PATCH 1/4] iio: typo in iio_chan_spec.ext_info comment Peter Meerwald
  2012-06-18 18:33 ` [PATCH 2/4] iio: correct documentation for IIO_CONST_ATTR_SAMP_FREQ_AVAIL, match name of #define Peter Meerwald
@ 2012-06-18 18:33 ` Peter Meerwald
  2012-06-18 18:33 ` [PATCH 4/4] iio staging: another typo in iio_simple_dummy_buffer Peter Meerwald
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Peter Meerwald @ 2012-06-18 18:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-iio, Peter Meerwald

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Jonathan Cameron <jic23@kernel.org>

---
 include/linux/iio/buffer.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index fb0fe46..ad4fb1a 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -184,7 +184,7 @@ static inline int iio_buffer_register(struct iio_dev *indio_dev,
 }
 
 static inline void iio_buffer_unregister(struct iio_dev *indio_dev)
-{};
+{}
 
 #endif /* CONFIG_IIO_BUFFER */
 
-- 
1.7.9.5


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

* [PATCH 4/4] iio staging: another typo in iio_simple_dummy_buffer
  2012-06-18 18:33 [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor Peter Meerwald
                   ` (2 preceding siblings ...)
  2012-06-18 18:33 ` [PATCH 3/4] iio: remove extra ; after function definition Peter Meerwald
@ 2012-06-18 18:33 ` Peter Meerwald
  2012-06-18 18:33 ` [PATCH RESEND] iio staging: fix tsl2x7x file mode Peter Meerwald
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Peter Meerwald @ 2012-06-18 18:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-iio, Peter Meerwald

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Jonathan Cameron <jic23@kernel.org>

---
 drivers/staging/iio/iio_simple_dummy_buffer.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c b/drivers/staging/iio/iio_simple_dummy_buffer.c
index 3e43025..fa4939c 100644
--- a/drivers/staging/iio/iio_simple_dummy_buffer.c
+++ b/drivers/staging/iio/iio_simple_dummy_buffer.c
@@ -78,7 +78,7 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p)
 		     i++) {
 			j = find_next_bit(buffer->scan_mask,
 					  indio_dev->masklength, j + 1);
-			/* random access read form the 'device' */
+			/* random access read from the 'device' */
 			data[i] = fakedata[j];
 			len += 2;
 		}
-- 
1.7.9.5


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

* [PATCH RESEND] iio staging: fix tsl2x7x file mode
  2012-06-18 18:33 [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor Peter Meerwald
                   ` (3 preceding siblings ...)
  2012-06-18 18:33 ` [PATCH 4/4] iio staging: another typo in iio_simple_dummy_buffer Peter Meerwald
@ 2012-06-18 18:33 ` Peter Meerwald
  2012-06-18 18:33 ` [PATCH] iio staging: fix typos in tsl*: register Peter Meerwald
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Peter Meerwald @ 2012-06-18 18:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-iio, Peter Meerwald

just drop execute permission

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Jonathan Cameron <jic23@kernel.org>

---
 0 files changed
 mode change 100755 => 100644 drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2583
 mode change 100755 => 100644 drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2x7x
 mode change 100755 => 100644 drivers/staging/iio/light/tsl2x7x.h
 mode change 100755 => 100644 drivers/staging/iio/light/tsl2x7x_core.c

diff --git a/drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2583 b/drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2583
old mode 100755
new mode 100644
diff --git a/drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2x7x b/drivers/staging/iio/Documentation/light/sysfs-bus-iio-light-tsl2x7x
old mode 100755
new mode 100644
diff --git a/drivers/staging/iio/light/tsl2x7x.h b/drivers/staging/iio/light/tsl2x7x.h
old mode 100755
new mode 100644
diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c
old mode 100755
new mode 100644
-- 
1.7.9.5


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

* [PATCH] iio staging: fix typos in tsl*: register
  2012-06-18 18:33 [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor Peter Meerwald
                   ` (4 preceding siblings ...)
  2012-06-18 18:33 ` [PATCH RESEND] iio staging: fix tsl2x7x file mode Peter Meerwald
@ 2012-06-18 18:33 ` Peter Meerwald
  2012-06-18 18:33 ` [PATCH RESEND] iio staging: fix spelling of suppression in isl29018 Peter Meerwald
  2012-06-19  0:32 ` [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor Greg Kroah-Hartman
  7 siblings, 0 replies; 12+ messages in thread
From: Peter Meerwald @ 2012-06-18 18:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-iio, Peter Meerwald

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Jonathan Cameron <jic23@kernel.org>

---
 drivers/staging/iio/light/tsl2583.c      |    2 +-
 drivers/staging/iio/light/tsl2x7x_core.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
index 5e23ad5..6d2f4c6 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -410,7 +410,7 @@ static int taos_chip_on(struct iio_dev *indio_dev)
 		return -EINVAL;
 	}
 
-	/* determine als integration regster */
+	/* determine als integration register */
 	als_count = (chip->taos_settings.als_time * 100 + 135) / 270;
 	if (als_count == 0)
 		als_count = 1; /* ensure at least one cycle */
diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c
index 040da4a..fdf75e4 100644
--- a/drivers/staging/iio/light/tsl2x7x_core.c
+++ b/drivers/staging/iio/light/tsl2x7x_core.c
@@ -736,7 +736,7 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev)
 		return -EINVAL;
 	}
 
-	/* determine als integration regster */
+	/* determine als integration register */
 	als_count = (chip->tsl2x7x_settings.als_time * 100 + 135) / 270;
 	if (als_count == 0)
 		als_count = 1; /* ensure at least one cycle */
-- 
1.7.9.5


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

* [PATCH RESEND] iio staging: fix spelling of suppression in isl29018
  2012-06-18 18:33 [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor Peter Meerwald
                   ` (5 preceding siblings ...)
  2012-06-18 18:33 ` [PATCH] iio staging: fix typos in tsl*: register Peter Meerwald
@ 2012-06-18 18:33 ` Peter Meerwald
  2012-06-19  0:32 ` [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor Greg Kroah-Hartman
  7 siblings, 0 replies; 12+ messages in thread
From: Peter Meerwald @ 2012-06-18 18:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-iio, Peter Meerwald

beware, does change the ABI as proximity_on_chip_ambient_infrared_supression
is changed to proximity_on_chip_ambient_infrared_suppression

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>

---
 .../staging/iio/Documentation/sysfs-bus-iio-light  |    2 +-
 drivers/staging/iio/light/isl29018.c               |   16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/iio/Documentation/sysfs-bus-iio-light b/drivers/staging/iio/Documentation/sysfs-bus-iio-light
index 715c74d..d52be03 100644
--- a/drivers/staging/iio/Documentation/sysfs-bus-iio-light
+++ b/drivers/staging/iio/Documentation/sysfs-bus-iio-light
@@ -34,7 +34,7 @@ Description:
 		it comes back in SI units, it should also include _input else it
 		should include _raw to signify it is not in SI units.
 
-What:		/sys/.../device[n]/proximity_on_chip_ambient_infrared_supression
+What:		/sys/.../device[n]/proximity_on_chip_ambient_infrared_suppression
 KernelVersion:	2.6.37
 Contact:	linux-iio@vger.kernel.org
 Description:
diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c
index 0abbf18..31d22f5 100644
--- a/drivers/staging/iio/light/isl29018.c
+++ b/drivers/staging/iio/light/isl29018.c
@@ -292,18 +292,18 @@ static ssize_t store_resolution(struct device *dev,
 }
 
 /* proximity scheme */
-static ssize_t show_prox_infrared_supression(struct device *dev,
+static ssize_t show_prox_infrared_suppression(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct isl29018_chip *chip = iio_priv(indio_dev);
 
 	/* return the "proximity scheme" i.e. if the chip does on chip
-	infrared supression (1 means perform on chip supression) */
+	infrared suppression (1 means perform on chip suppression) */
 	return sprintf(buf, "%d\n", chip->prox_scheme);
 }
 
-static ssize_t store_prox_infrared_supression(struct device *dev,
+static ssize_t store_prox_infrared_suppression(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
@@ -318,7 +318,7 @@ static ssize_t store_prox_infrared_supression(struct device *dev,
 	}
 
 	/* get the  "proximity scheme" i.e. if the chip does on chip
-	infrared supression (1 means perform on chip supression) */
+	infrared suppression (1 means perform on chip suppression) */
 	mutex_lock(&chip->lock);
 	chip->prox_scheme = (int)lval;
 	mutex_unlock(&chip->lock);
@@ -413,10 +413,10 @@ static IIO_CONST_ATTR(range_available, "1000 4000 16000 64000");
 static IIO_CONST_ATTR(adc_resolution_available, "4 8 12 16");
 static IIO_DEVICE_ATTR(adc_resolution, S_IRUGO | S_IWUSR,
 					show_resolution, store_resolution, 0);
-static IIO_DEVICE_ATTR(proximity_on_chip_ambient_infrared_supression,
+static IIO_DEVICE_ATTR(proximity_on_chip_ambient_infrared_suppression,
 					S_IRUGO | S_IWUSR,
-					show_prox_infrared_supression,
-					store_prox_infrared_supression, 0);
+					show_prox_infrared_suppression,
+					store_prox_infrared_suppression, 0);
 
 #define ISL29018_DEV_ATTR(name) (&iio_dev_attr_##name.dev_attr.attr)
 #define ISL29018_CONST_ATTR(name) (&iio_const_attr_##name.dev_attr.attr)
@@ -425,7 +425,7 @@ static struct attribute *isl29018_attributes[] = {
 	ISL29018_CONST_ATTR(range_available),
 	ISL29018_DEV_ATTR(adc_resolution),
 	ISL29018_CONST_ATTR(adc_resolution_available),
-	ISL29018_DEV_ATTR(proximity_on_chip_ambient_infrared_supression),
+	ISL29018_DEV_ATTR(proximity_on_chip_ambient_infrared_suppression),
 	NULL
 };
 
-- 
1.7.9.5


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

* Re: [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor
  2012-06-18 18:33 [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor Peter Meerwald
                   ` (6 preceding siblings ...)
  2012-06-18 18:33 ` [PATCH RESEND] iio staging: fix spelling of suppression in isl29018 Peter Meerwald
@ 2012-06-19  0:32 ` Greg Kroah-Hartman
  2012-06-19  7:57   ` Peter Meerwald
  7 siblings, 1 reply; 12+ messages in thread
From: Greg Kroah-Hartman @ 2012-06-19  0:32 UTC (permalink / raw)
  To: Peter Meerwald; +Cc: linux-iio

On Mon, Jun 18, 2012 at 08:33:00PM +0200, Peter Meerwald wrote:
> minimal driver, no IR current control and proximity/event handling
> yet

Care to fix up the basic checkpatch.pl warnings and errors it produces?

(I shouldn't have to ask this...)

greg k-h

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

* Re: [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor
  2012-06-19  0:32 ` [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor Greg Kroah-Hartman
@ 2012-06-19  7:57   ` Peter Meerwald
  0 siblings, 0 replies; 12+ messages in thread
From: Peter Meerwald @ 2012-06-19  7:57 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-iio

Hello Greg,

> On Mon, Jun 18, 2012 at 08:33:00PM +0200, Peter Meerwald wrote:
> > minimal driver, no IR current control and proximity/event handling
> 
> Care to fix up the basic checkpatch.pl warnings and errors it produces?

it gives me 4 warning, but no errors:

WARNING: line over 80 characters
+#define VCNL4000_PS_MEAS_FREQ	0x89 /* Proximity measurement signal frequency */
WARNING: line over 80 characters
+	ret = i2c_smbus_write_byte_data(data->client, VCNL4000_COMMAND, req_mask);

ok

WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt
+		msleep(1);

this is indeed interesting; a sensor measurement/conversion can take up to 
100 ms and the data ready loop with msleep(1) and 20 retries is depending on the 
behaviour that msleep(1) actually takes >= 20 ms 

checkpatch is happy with msleep(20)

I wonder how often this warning is worked around with something like 
msleep(SOME_DELAY) with #define SOME_DELAY 1...

WARNING: quoted string split across lines
#241: FILE: drivers/iio/light/vcnl4000.c:172:
+	dev_info(&client->dev, "VCNL4000 Ambient light/proximity sensor, "
+		"Prod %02x, Rev: %02x\n", ret >> 4, ret & 0xf);

ok, I thought a split line would be more readable; checkpatch is happy 
with the long line

thanks, p.

-- 

Peter Meerwald
+43-664-2444418 (mobile)

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

end of thread, other threads:[~2012-06-19  7:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-18 18:33 [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor Peter Meerwald
2012-06-18 18:33 ` [PATCH 1/4] iio: typo in iio_chan_spec.ext_info comment Peter Meerwald
2012-06-18 18:33 ` [PATCH 2/4] iio: correct documentation for IIO_CONST_ATTR_SAMP_FREQ_AVAIL, match name of #define Peter Meerwald
2012-06-18 18:33 ` [PATCH 3/4] iio: remove extra ; after function definition Peter Meerwald
2012-06-18 18:33 ` [PATCH 4/4] iio staging: another typo in iio_simple_dummy_buffer Peter Meerwald
2012-06-18 18:33 ` [PATCH RESEND] iio staging: fix tsl2x7x file mode Peter Meerwald
2012-06-18 18:33 ` [PATCH] iio staging: fix typos in tsl*: register Peter Meerwald
2012-06-18 18:33 ` [PATCH RESEND] iio staging: fix spelling of suppression in isl29018 Peter Meerwald
2012-06-19  0:32 ` [PATCH v4] iio: add vcnl4000 combined ALS and proximity sensor Greg Kroah-Hartman
2012-06-19  7:57   ` Peter Meerwald
  -- strict thread matches above, loose matches on Subject: below --
2012-06-17 17:03 [PATCH RESEND] iio staging: fix tsl2x7x file mode Peter Meerwald
2012-06-17 17:03 ` [PATCH 2/4] iio: correct documentation for IIO_CONST_ATTR_SAMP_FREQ_AVAIL, match name of #define Peter Meerwald
2012-06-18  7:38   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).