* [RFC PATCH 0/2] staging:iio: add name_extend to allow for named channels
@ 2011-04-28 14:24 Jonathan Cameron
2011-04-28 14:24 ` [PATCH 1/2] RFC add naming to channels Jonathan Cameron
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jonathan Cameron @ 2011-04-28 14:24 UTC (permalink / raw)
To: linux-iio; +Cc: Michael.Hennerich, Jonathan Cameron
This is needed for the light sensors where we indicate what a given sensor
is measuring. It also came up in Michael's questions in the the thread
Oddities and how to handle them. Also for that matter allows us to put
back the in0_supply_raw convention that got squashed in moving to
iio_chan_spec registration.
What do people think?
(this is rather rough and ready, but then it is an RFC ;)
Jonathan Cameron (2):
RFC add naming to channels
Example of naming usage
drivers/staging/iio/iio.h | 26 +++-
drivers/staging/iio/industrialio-core.c | 34 +++-
drivers/staging/iio/light/tsl2563.c | 323 +++++++++++--------------------
3 files changed, 165 insertions(+), 218 deletions(-)
--
1.7.3.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] RFC add naming to channels
2011-04-28 14:24 [RFC PATCH 0/2] staging:iio: add name_extend to allow for named channels Jonathan Cameron
@ 2011-04-28 14:24 ` Jonathan Cameron
2011-04-28 14:24 ` [PATCH 2/2] Example of naming usage Jonathan Cameron
2011-05-02 13:05 ` [RFC PATCH 0/2] staging:iio: add name_extend to allow for named channels Hennerich, Michael
2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2011-04-28 14:24 UTC (permalink / raw)
To: linux-iio; +Cc: Michael.Hennerich, Jonathan Cameron
---
drivers/staging/iio/iio.h | 26 ++++++++++++++++++++++-
drivers/staging/iio/industrialio-core.c | 34 +++++++++++++++++++++---------
2 files changed, 49 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/iio/iio.h b/drivers/staging/iio/iio.h
index 7f94197..210577e 100644
--- a/drivers/staging/iio/iio.h
+++ b/drivers/staging/iio/iio.h
@@ -35,6 +35,7 @@ enum iio_chan_type {
IIO_GYRO,
IIO_MAGN,
IIO_LIGHT,
+ IIO_INTENSITY,
IIO_PROXIMITY,
IIO_TEMP,
IIO_INCLI,
@@ -91,6 +92,8 @@ struct iio_chan_spec {
} scan_type;
const long info_mask;
const long event_mask;
+ const char *extend_name;
+ unsigned processed_val:1;
};
/* Meant for internal use only */
void __iio_device_attr_deinit(struct device_attribute *dev_attr);
@@ -113,12 +116,33 @@ int __iio_device_attr_init(struct device_attribute *dev_attr,
.address = _address, \
.scan_index = _si, .scan_type = _stype }
-#define IIO_CHAN_EV(_type, _chan, _inf_mask, _address, _si, \
+#define IIO_CHAN_EV(_type, _chan, _inf_mask, _address, _si, \
_stype, _event_mask) \
{ .type = _type, \
.channel = _chan, \
.info_mask = _inf_mask, \
.address = _address, \
+ .scan_type = _stype, \
+ .event_mask = _event_mask }
+
+#define IIO_CHAN_UNPROC_EV(_type, _name, _chan, _inf_mask, _address, _si, \
+ _stype, _event_mask) \
+ { .type = _type, \
+ .extend_name = _name, \
+ .channel = _chan, \
+ .info_mask = _inf_mask, \
+ .address = _address, \
+ .scan_index = _si, .scan_type = _stype, \
+ .event_mask = _event_mask }
+
+#define IIO_CHAN_PROC_EV(_type, _name, _chan, _inf_mask, _address, _si, \
+ _stype, _event_mask) \
+ { .type = _type, \
+ .extend_name = _name, \
+ .processed_val = 1, \
+ .channel = _chan, \
+ .info_mask = _inf_mask, \
+ .address = _address, \
.scan_index = _si, .scan_type = _stype, \
.event_mask = _event_mask }
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index b9776de..c7edb12 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -67,6 +67,8 @@ static const char * const iio_chan_type_name_spec[] = {
[IIO_INCLI] = "incli_%c",
[IIO_ROT] = "rot_%c",
[IIO_ANGL] = "angl_%c",
+ [IIO_INTENSITY] = "intensity%d",
+ [IIO_LIGHT] = "illuminance%d",
};
/* relies on pairs of these shared then separate */
@@ -468,6 +470,11 @@ int __iio_device_attr_init(struct device_attribute *dev_attr,
= kasprintf(GFP_KERNEL, "%s_%s",
iio_chan_type_name_spec_shared[chan->type],
postfix);
+ else if (chan->extend_name)
+ name_format = kasprintf(GFP_KERNEL, "%s_%s_%s",
+ iio_chan_type_name_spec[chan->type],
+ chan->extend_name,
+ postfix);
else
name_format = kasprintf(GFP_KERNEL, "%s_%s",
iio_chan_type_name_spec[chan->type],
@@ -476,7 +483,6 @@ int __iio_device_attr_init(struct device_attribute *dev_attr,
ret = -ENOMEM;
goto error_ret;
}
-
dev_attr->attr.name = kasprintf(GFP_KERNEL,
name_format,
chan->channel,
@@ -572,17 +578,24 @@ static int iio_device_add_channel_sysfs(struct iio_dev *dev_info,
{
int ret, i;
-
if (chan->channel < 0)
return 0;
-
- ret = __iio_add_chan_devattr("raw", NULL, chan,
- &iio_read_channel_info,
- NULL,
- 0,
- 0,
- &dev_info->dev,
- &dev_info->channel_attr_list);
+ if (chan->processed_val)
+ ret = __iio_add_chan_devattr("input", NULL, chan,
+ &iio_read_channel_info,
+ NULL,
+ 0,
+ 0,
+ &dev_info->dev,
+ &dev_info->channel_attr_list);
+ else
+ ret = __iio_add_chan_devattr("raw", NULL, chan,
+ &iio_read_channel_info,
+ NULL,
+ 0,
+ 0,
+ &dev_info->dev,
+ &dev_info->channel_attr_list);
if (ret)
goto error_ret;
@@ -824,6 +837,7 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
switch (chan->type) {
/* Switch this to a table at some point */
case IIO_IN:
+ case IIO_INTENSITY:
mask = IIO_UNMOD_EVENT_CODE(chan->type, chan->channel,
i/IIO_EV_TYPE_MAX,
i%IIO_EV_TYPE_MAX);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] Example of naming usage
2011-04-28 14:24 [RFC PATCH 0/2] staging:iio: add name_extend to allow for named channels Jonathan Cameron
2011-04-28 14:24 ` [PATCH 1/2] RFC add naming to channels Jonathan Cameron
@ 2011-04-28 14:24 ` Jonathan Cameron
2011-05-02 13:05 ` [RFC PATCH 0/2] staging:iio: add name_extend to allow for named channels Hennerich, Michael
2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2011-04-28 14:24 UTC (permalink / raw)
To: linux-iio; +Cc: Michael.Hennerich, Jonathan Cameron
---
drivers/staging/iio/light/tsl2563.c | 323 +++++++++++++----------------------
1 files changed, 116 insertions(+), 207 deletions(-)
diff --git a/drivers/staging/iio/light/tsl2563.c b/drivers/staging/iio/light/tsl2563.c
index d613086..9ee9494 100644
--- a/drivers/staging/iio/light/tsl2563.c
+++ b/drivers/staging/iio/light/tsl2563.c
@@ -464,31 +464,6 @@ static unsigned int adc_to_lux(u32 adc0, u32 adc1)
/* Sysfs interface */
/*--------------------------------------------------------------*/
-static ssize_t tsl2563_adc_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct tsl2563_chip *chip = iio_priv(dev_get_drvdata(dev));
- struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
- int ret;
-
- mutex_lock(&chip->lock);
-
- ret = tsl2563_get_adc(chip);
- if (ret)
- goto out;
-
- switch (this_attr->address) {
- case 0:
- ret = snprintf(buf, PAGE_SIZE, "%d\n", chip->data0);
- break;
- case 1:
- ret = snprintf(buf, PAGE_SIZE, "%d\n", chip->data1);
- break;
- }
-out:
- mutex_unlock(&chip->lock);
- return ret;
-}
/* Apply calibration coefficient to ADC count. */
static u32 calib_adc(u32 adc, u32 calib)
@@ -501,180 +476,136 @@ static u32 calib_adc(u32 adc, u32 calib)
return (u32) scaled;
}
-static ssize_t tsl2563_lux_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+static int tsl2563_write_raw(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan,
+ int val,
+ int val2,
+ long mask)
{
- struct tsl2563_chip *chip = iio_priv(dev_get_drvdata(dev));
- u32 calib0, calib1;
- int ret;
-
- mutex_lock(&chip->lock);
-
- ret = tsl2563_get_adc(chip);
- if (ret)
- goto out;
-
- calib0 = calib_adc(chip->data0, chip->calib0) * chip->cover_comp_gain;
- calib1 = calib_adc(chip->data1, chip->calib1) * chip->cover_comp_gain;
-
- ret = snprintf(buf, PAGE_SIZE, "%d\n", adc_to_lux(calib0, calib1));
-
-out:
- mutex_unlock(&chip->lock);
- return ret;
-}
+ struct tsl2563_chip *chip = iio_priv(indio_dev);
+
+ if (chan->channel == 0)
+ chip->calib0 = calib_from_sysfs(val);
+ else
+ chip->calib1 = calib_from_sysfs(val);
-static ssize_t format_calib(char *buf, int len, u32 calib)
-{
- return snprintf(buf, PAGE_SIZE, "%d\n", calib_to_sysfs(calib));
+ return 0;
}
-static ssize_t tsl2563_calib_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+static int tsl2563_read_raw(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan,
+ int *val,
+ int *val2,
+ long m)
{
- struct tsl2563_chip *chip = iio_priv(dev_get_drvdata(dev));
- struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
- int ret;
+ int ret = -EINVAL;
+ u32 calib0, calib1;
+ struct tsl2563_chip *chip = iio_priv(indio_dev);
mutex_lock(&chip->lock);
- switch (this_attr->address) {
+ switch (m) {
case 0:
- ret = format_calib(buf, PAGE_SIZE, chip->calib0);
+ switch (chan->type) {
+ case IIO_LIGHT:
+ ret = tsl2563_get_adc(chip);
+ if (ret)
+ goto error_ret;
+ calib0 = calib_adc(chip->data0, chip->calib0) * chip->cover_comp_gain;
+ calib1 = calib_adc(chip->data1, chip->calib1) * chip->cover_comp_gain;
+ *val = adc_to_lux(calib0, calib1);
+ ret = IIO_VAL_INT;
+ break;
+ case IIO_INTENSITY:
+ ret = tsl2563_get_adc(chip);
+ if (ret)
+ goto error_ret;
+ if (chan->channel == 0)
+ *val = chip->data0;
+ else
+ *val = chip->data1;
+ ret = IIO_VAL_INT;
+ break;
+ default:
+ break;
+ }
break;
- case 1:
- ret = format_calib(buf, PAGE_SIZE, chip->calib1);
+
+ case (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):
+ if (chan->channel == 0)
+ *val = calib_to_sysfs(chip->calib0);
+ else
+ *val = calib_to_sysfs(chip->calib1);
+ ret = IIO_VAL_INT;
break;
default:
- ret = -ENODEV;
- }
- mutex_unlock(&chip->lock);
- return ret;
-}
-
-static ssize_t tsl2563_calib_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t len)
-{
- struct tsl2563_chip *chip = iio_priv(dev_get_drvdata(dev));
- struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
- int value;
- u32 calib;
-
- if (1 != sscanf(buf, "%d", &value))
return -EINVAL;
-
- calib = calib_from_sysfs(value);
-
- switch (this_attr->address) {
- case 0:
- chip->calib0 = calib;
- break;
- case 1:
- chip->calib1 = calib;
- break;
}
- return len;
-}
-
-static IIO_DEVICE_ATTR(intensity0_both_raw, S_IRUGO,
- tsl2563_adc_show, NULL, 0);
-static IIO_DEVICE_ATTR(intensity1_ir_raw, S_IRUGO,
- tsl2563_adc_show, NULL, 1);
-static DEVICE_ATTR(illuminance0_input, S_IRUGO, tsl2563_lux_show, NULL);
-static IIO_DEVICE_ATTR(intensity0_both_calibgain, S_IRUGO | S_IWUSR,
- tsl2563_calib_show, tsl2563_calib_store, 0);
-static IIO_DEVICE_ATTR(intensity1_ir_calibgain, S_IRUGO | S_IWUSR,
- tsl2563_calib_show, tsl2563_calib_store, 1);
-
-static ssize_t tsl2563_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct tsl2563_chip *chip = iio_priv(dev_get_drvdata(dev));
- return sprintf(buf, "%s\n", chip->client->name);
+error_ret:
+ mutex_unlock(&chip->lock);
+ return ret;
}
-static DEVICE_ATTR(name, S_IRUGO, tsl2563_show_name, NULL);
-
-static struct attribute *tsl2563_attributes[] = {
- &iio_dev_attr_intensity0_both_raw.dev_attr.attr,
- &iio_dev_attr_intensity1_ir_raw.dev_attr.attr,
- &dev_attr_illuminance0_input.attr,
- &iio_dev_attr_intensity0_both_calibgain.dev_attr.attr,
- &iio_dev_attr_intensity1_ir_calibgain.dev_attr.attr,
- &dev_attr_name.attr,
- NULL
+static const struct iio_chan_spec tsl2563_channels[] = {
+ IIO_CHAN_PROC_EV(IIO_LIGHT, NULL, 0, 0, 0, 0, {}, 0),
+ IIO_CHAN_UNPROC_EV(IIO_INTENSITY, "both", 0,
+ (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE), 0, 0, {},
+ IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_RISING) |
+ IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_FALLING)),
+ IIO_CHAN_UNPROC_EV(IIO_INTENSITY, "ir", 1,
+ (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE), 0, 0, {},
+ 0)
};
-static const struct attribute_group tsl2563_group = {
- .attrs = tsl2563_attributes,
-};
-
-static ssize_t tsl2563_read_thresh(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static int tsl2563_read_thresh(struct iio_dev *indio_dev,
+ int event_code,
+ int *val)
{
- struct tsl2563_chip *chip = iio_priv(dev_get_drvdata(dev));
- struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
- u16 val = 0;
- switch (this_attr->address) {
- case TSL2563_REG_HIGHLOW:
- val = chip->high_thres;
+ struct tsl2563_chip *chip = iio_priv(indio_dev);
+
+ switch (IIO_EVENT_CODE_EXTRACT_DIR(event_code)) {
+ case IIO_EV_DIR_RISING:
+ *val = chip->high_thres;
break;
- case TSL2563_REG_LOWLOW:
- val = chip->low_thres;
+ case IIO_EV_DIR_FALLING:
+ *val = chip->low_thres;
break;
+ default:
+ return -EINVAL;
}
- return snprintf(buf, PAGE_SIZE, "%d\n", val);
+
+ return 0;
}
-static ssize_t tsl2563_write_thresh(struct device *dev,
- struct device_attribute *attr,
- const char *buf,
- size_t len)
+static ssize_t tsl2563_write_thresh(struct iio_dev *indio_dev,
+ int event_code,
+ int val)
{
- struct tsl2563_chip *chip = iio_priv(dev_get_drvdata(dev));
- struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
- unsigned long val;
+ struct tsl2563_chip *chip = iio_priv(indio_dev);
int ret;
+ u8 address;
- ret = strict_strtoul(buf, 10, &val);
- if (ret)
- return ret;
+ if (IIO_EVENT_CODE_EXTRACT_DIR(event_code) == IIO_EV_DIR_RISING)
+ address = TSL2563_REG_HIGHLOW;
+ else
+ address = TSL2563_REG_LOWLOW;
mutex_lock(&chip->lock);
- ret = tsl2563_write(chip->client, this_attr->address, val & 0xFF);
+ ret = tsl2563_write(chip->client, address, val & 0xFF);
if (ret)
goto error_ret;
- ret = tsl2563_write(chip->client, this_attr->address + 1,
+ ret = tsl2563_write(chip->client, address + 1,
(val >> 8) & 0xFF);
- switch (this_attr->address) {
- case TSL2563_REG_HIGHLOW:
+ if (IIO_EVENT_CODE_EXTRACT_DIR(event_code) == IIO_EV_DIR_RISING)
chip->high_thres = val;
- break;
- case TSL2563_REG_LOWLOW:
+ else
chip->low_thres = val;
- break;
- }
error_ret:
mutex_unlock(&chip->lock);
- return ret < 0 ? ret : len;
+ return ret;
}
-static IIO_DEVICE_ATTR(intensity0_both_raw_thresh_rising_value,
- S_IRUGO | S_IWUSR,
- tsl2563_read_thresh,
- tsl2563_write_thresh,
- TSL2563_REG_HIGHLOW);
-
-static IIO_DEVICE_ATTR(intensity0_both_raw_thresh_falling_value,
- S_IRUGO | S_IWUSR,
- tsl2563_read_thresh,
- tsl2563_write_thresh,
- TSL2563_REG_LOWLOW);
-
static irqreturn_t tsl2563_event_handler(int irq, void *private)
{
struct iio_dev *dev_info = private;
@@ -693,20 +624,15 @@ static irqreturn_t tsl2563_event_handler(int irq, void *private)
return IRQ_HANDLED;
}
-static ssize_t tsl2563_write_interrupt_config(struct device *dev,
- struct device_attribute *attr,
- const char *buf,
- size_t len)
+static int tsl2563_write_interrupt_config(struct iio_dev *indio_dev,
+ int event_code,
+ int state)
{
- struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct tsl2563_chip *chip = iio_priv(indio_dev);
- int input, ret = 0;
+ int ret = 0;
- ret = sscanf(buf, "%d", &input);
- if (ret != 1)
- return -EINVAL;
mutex_lock(&chip->lock);
- if (input && !(chip->intr & 0x30)) {
+ if (state && !(chip->intr & 0x30)) {
chip->intr &= ~0x30;
chip->intr |= 0x10;
/* ensure the chip is actually on */
@@ -723,7 +649,7 @@ static ssize_t tsl2563_write_interrupt_config(struct device *dev,
chip->int_enabled = true;
}
- if (!input && (chip->intr & 0x30)) {
+ if (!state && (chip->intr & 0x30)) {
chip->intr |= ~0x30;
ret = tsl2563_write(chip->client, TSL2563_REG_INT, chip->intr);
chip->int_enabled = false;
@@ -733,47 +659,27 @@ static ssize_t tsl2563_write_interrupt_config(struct device *dev,
out:
mutex_unlock(&chip->lock);
- return (ret < 0) ? ret : len;
+ return ret;
}
-static ssize_t tsl2563_read_interrupt_config(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static int tsl2563_read_interrupt_config(struct iio_dev *indio_dev,
+ int event_code)
{
- struct tsl2563_chip *chip = iio_priv(dev_get_drvdata(dev));
- int ret;
+ struct tsl2563_chip *chip = iio_priv(indio_dev);
u8 rxbuf;
- ssize_t len;
+ int ret;
mutex_lock(&chip->lock);
- ret = tsl2563_read(chip->client,
- TSL2563_REG_INT,
- &rxbuf,
- sizeof(rxbuf));
+ ret = tsl2563_read(chip->client, TSL2563_REG_INT,
+ &rxbuf, sizeof(rxbuf));
mutex_unlock(&chip->lock);
if (ret < 0)
goto error_ret;
- len = snprintf(buf, PAGE_SIZE, "%d\n", !!(rxbuf & 0x30));
+ ret = !!(rxbuf & 0x30);
error_ret:
- return (ret < 0) ? ret : len;
+ return ret;
}
-static IIO_DEVICE_ATTR(intensity0_both_thresh_en,
- S_IRUGO | S_IWUSR,
- tsl2563_read_interrupt_config,
- tsl2563_write_interrupt_config,
- 0);
-
-static struct attribute *tsl2563_event_attributes[] = {
- &iio_dev_attr_intensity0_both_thresh_en.dev_attr.attr,
- &iio_dev_attr_intensity0_both_raw_thresh_rising_value.dev_attr.attr,
- &iio_dev_attr_intensity0_both_raw_thresh_falling_value.dev_attr.attr,
- NULL,
-};
-
-static struct attribute_group tsl2563_event_attribute_group = {
- .attrs = tsl2563_event_attributes,
-};
/*--------------------------------------------------------------*/
/* Probe, Attach, Remove */
@@ -825,20 +731,23 @@ static int __devinit tsl2563_probe(struct i2c_client *client,
chip->cover_comp_gain = 1;
dev_info(&client->dev, "model %d, rev. %d\n", id >> 4, id & 0x0f);
-
- indio_dev->attrs = &tsl2563_group;
+ indio_dev->name = client->name;
+ indio_dev->channels = tsl2563_channels;
+ indio_dev->num_channels = ARRAY_SIZE(tsl2563_channels);
+ indio_dev->read_raw = &tsl2563_read_raw;
+ indio_dev->write_raw = &tsl2563_write_raw;
+ indio_dev->read_event_value = &tsl2563_read_thresh;
+ indio_dev->write_event_value = &tsl2563_write_thresh;
+ indio_dev->read_event_config = &tsl2563_read_interrupt_config;
+ indio_dev->write_event_config = &tsl2563_write_interrupt_config;
indio_dev->dev.parent = &client->dev;
indio_dev->driver_module = THIS_MODULE;
indio_dev->modes = INDIO_DIRECT_MODE;
- if (client->irq) {
+ if (client->irq)
indio_dev->num_interrupt_lines = 1;
- indio_dev->event_attrs
- = &tsl2563_event_attribute_group;
- }
ret = iio_device_register(indio_dev);
if (ret)
goto fail1;
-
if (client->irq) {
ret = request_threaded_irq(client->irq,
NULL,
--
1.7.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [RFC PATCH 0/2] staging:iio: add name_extend to allow for named channels
2011-04-28 14:24 [RFC PATCH 0/2] staging:iio: add name_extend to allow for named channels Jonathan Cameron
2011-04-28 14:24 ` [PATCH 1/2] RFC add naming to channels Jonathan Cameron
2011-04-28 14:24 ` [PATCH 2/2] Example of naming usage Jonathan Cameron
@ 2011-05-02 13:05 ` Hennerich, Michael
2011-05-02 14:23 ` Jonathan Cameron
2 siblings, 1 reply; 6+ messages in thread
From: Hennerich, Michael @ 2011-05-02 13:05 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio@vger.kernel.org
Cc: device-drivers-devel@blackfin.uclinux.org, Drivers
Jonathan Cameron wrote on 2011-04-28:
> This is needed for the light sensors where we indicate what a given
> sensor is measuring. It also came up in Michael's questions in the the
> thread Oddities and how to handle them. Also for that matter allows
> us to put back the in0_supply_raw convention that got squashed in
> moving to iio_chan_spec registration.
>
> What do people think?
Looks good to me... And actually needed for the ADE7758 driver cleanup.
So it would be good if you could get this into your iio-onwards tree.
> (this is rather rough and ready, but then it is an RFC ;)
>
> Jonathan Cameron (2):
> RFC add naming to channels
> Example of naming usage
> drivers/staging/iio/iio.h | 26 +++-
> drivers/staging/iio/industrialio-core.c | 34 +++-
> drivers/staging/iio/light/tsl2563.c | 323 +++++++++++------------
> -------- 3 files changed, 165 insertions(+), 218 deletions(-)
Greetings,
Michael
--
Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368; Gesch=
aeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin, Margaret=
Seif
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH 0/2] staging:iio: add name_extend to allow for named channels
2011-05-02 13:05 ` [RFC PATCH 0/2] staging:iio: add name_extend to allow for named channels Hennerich, Michael
@ 2011-05-02 14:23 ` Jonathan Cameron
2011-05-02 17:11 ` Jonathan Cameron
0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2011-05-02 14:23 UTC (permalink / raw)
To: Hennerich, Michael
Cc: linux-iio@vger.kernel.org,
device-drivers-devel@blackfin.uclinux.org, Drivers
On 05/02/11 14:05, Hennerich, Michael wrote:
> Jonathan Cameron wrote on 2011-04-28:
>> This is needed for the light sensors where we indicate what a given
>> sensor is measuring. It also came up in Michael's questions in the the
>> thread Oddities and how to handle them. Also for that matter allows
>> us to put back the in0_supply_raw convention that got squashed in
>> moving to iio_chan_spec registration.
>>
>> What do people think?
>
> Looks good to me... And actually needed for the ADE7758 driver cleanup.
> So it would be good if you could get this into your iio-onwards tree.
Will put it right after patch that introduces iio_chan_spec.
Need to run the interface changes in tsl2563 past the original
submitters before pushing the tsl2563 driver out.
>
>> (this is rather rough and ready, but then it is an RFC ;)
>>
>> Jonathan Cameron (2):
>> RFC add naming to channels
>> Example of naming usage
>> drivers/staging/iio/iio.h | 26 +++-
>> drivers/staging/iio/industrialio-core.c | 34 +++-
>> drivers/staging/iio/light/tsl2563.c | 323 +++++++++++------------
>> -------- 3 files changed, 165 insertions(+), 218 deletions(-)
>
> 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] 6+ messages in thread
* Re: [RFC PATCH 0/2] staging:iio: add name_extend to allow for named channels
2011-05-02 14:23 ` Jonathan Cameron
@ 2011-05-02 17:11 ` Jonathan Cameron
0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2011-05-02 17:11 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Hennerich, Michael, linux-iio@vger.kernel.org,
device-drivers-devel@blackfin.uclinux.org, Drivers
On 05/02/11 15:23, Jonathan Cameron wrote:
> On 05/02/11 14:05, Hennerich, Michael wrote:
>> Jonathan Cameron wrote on 2011-04-28:
>>> This is needed for the light sensors where we indicate what a given
>>> sensor is measuring. It also came up in Michael's questions in the the
>>> thread Oddities and how to handle them. Also for that matter allows
>>> us to put back the in0_supply_raw convention that got squashed in
>>> moving to iio_chan_spec registration.
>>>
>>> What do people think?
>>
>> Looks good to me... And actually needed for the ADE7758 driver cleanup.
>> So it would be good if you could get this into your iio-onwards tree.
> Will put it right after patch that introduces iio_chan_spec.
> Need to run the interface changes in tsl2563 past the original
> submitters before pushing the tsl2563 driver out.
Hi Michael,
I'm rethinking a couple of things related to this patch.
Firstly, as Arnd warned, we have a steadily growing set of macros for defining
channels that have become nasty to maintain. I have redefined IIO_CHAN()
to do pretty much everything. As a result I'm going to remove all the
other variants. There may be call for cover of the case where it is only a sysfs
attribute, but we can add that later if it looks useful.
Secondly, I have added a flag to chan spec for 'modified' so it is easy
to do the name formatting in the core. This is alongside the 'extend_name'
in this patch. Modified should almost always be what is used. Extend name
is for convenience stuff only. There is a 'magic' michex branch on
iio-onwards which is an extremely dirty push from the top of my local tree
so you can see what I have done.
I have shown how I would like to see all modifiers registered (including
the implicit ones we already have).
I think this works for everything we have. May need further tweaking.
If you are happy, I'll push it into the original iio-onwards chan_spec
patch and work all the way up the tree doing the drivers as and when
they are currently converted over to chan_spec registration.
Thanks,
Jonathan.
>
>>
>>> (this is rather rough and ready, but then it is an RFC ;)
>>>
>>> Jonathan Cameron (2):
>>> RFC add naming to channels
>>> Example of naming usage
>>> drivers/staging/iio/iio.h | 26 +++-
>>> drivers/staging/iio/industrialio-core.c | 34 +++-
>>> drivers/staging/iio/light/tsl2563.c | 323 +++++++++++------------
>>> -------- 3 files changed, 165 insertions(+), 218 deletions(-)
>>
>> 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
>>
>>
>>
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-05-02 17:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-28 14:24 [RFC PATCH 0/2] staging:iio: add name_extend to allow for named channels Jonathan Cameron
2011-04-28 14:24 ` [PATCH 1/2] RFC add naming to channels Jonathan Cameron
2011-04-28 14:24 ` [PATCH 2/2] Example of naming usage Jonathan Cameron
2011-05-02 13:05 ` [RFC PATCH 0/2] staging:iio: add name_extend to allow for named channels Hennerich, Michael
2011-05-02 14:23 ` Jonathan Cameron
2011-05-02 17:11 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox