All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaud Pouliquen <arnaud.pouliquen@st.com>
To: Lars-Peter Clausen <lars@metafoo.de>, Mark Brown <broonie@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Olivier MOYSAN <olivier.moysan@st.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	Takashi Iwai <tiwai@suse.com>, Rob Herring <robh+dt@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Benjamin GAIGNARD <benjamin.gaignard@st.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Alexandre TORGUE <alexandre.torgue@st.com>
Subject: Re: [PATCH v3 01/11] iio: Add hardware consumer support
Date: Mon, 11 Sep 2017 11:01:34 +0200	[thread overview]
Message-ID: <eea6504a-314f-3d30-ec5a-e42e8a2e24f6@st.com> (raw)
In-Reply-To: <2f1ea8dc-ff6b-3526-bc9e-50dde1ae9a66@st.com>

Hello Lars,

New gentlemen Reminder.

I suppose that you have to treat a lot of subjects with more priority
than this one, but on my side I'm starting to have a lot of pressure
from project, as STM32 DFSDM upstream is blocked since close to 6 months.

As you proposed the interface, I would be fair you could push it for
upstream this month.

If you don't have time for this, another solution could be that I push
it for you.
Please tell me your preference.

Regards,
Arnaud


On 06/06/2017 12:15 PM, Arnaud Pouliquen wrote:
> Hello Lars,
> 
> Any news on the upstream of your HW consumer interface, prerequisite for
> my STM32 DFSDM upstream?
> Don't hesitate if i can help...
> 
> Regards
> Arnaud
> 
> 
> On 03/17/2017 03:08 PM, Arnaud POULIQUEN wrote:
>> From: Lars-Peter Clausen <lars@metafoo.de>
>>
>> Hardware consumer's can be used when one IIO device has a direct connection
>> to another device in hardware.
>>
>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
>> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
>> ---
>> V2 -> V3:
>> 	 Just Adding sign off.  No update but Jonathan comment.
>>          Need to be taken into account (in agreement with Lars)
>>          when transforming rfc in patch.
>> ---
>>  drivers/iio/Kconfig             |   6 ++
>>  drivers/iio/Makefile            |   1 +
>>  drivers/iio/hw_consumer.c       | 156 ++++++++++++++++++++++++++++++++++++++++
>>  include/linux/iio/hw_consumer.h |  12 ++++
>>  4 files changed, 175 insertions(+)
>>  create mode 100644 drivers/iio/hw_consumer.c
>>  create mode 100644 include/linux/iio/hw_consumer.h
>>
>> diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig
>> index 6743b18..956dd18 100644
>> --- a/drivers/iio/Kconfig
>> +++ b/drivers/iio/Kconfig
>> @@ -30,6 +30,12 @@ config IIO_CONFIGFS
>>  	  (e.g. software triggers). For more info see
>>  	  Documentation/iio/iio_configfs.txt.
>>  
>> +config IIO_HW_CONSUMER
>> +	tristate
>> +	help
>> +	  Hardware consumer buffer
>> +
>> +
>>  config IIO_TRIGGER
>>  	bool "Enable triggered sampling support"
>>  	help
>> diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile
>> index 87e4c43..8472b97 100644
>> --- a/drivers/iio/Makefile
>> +++ b/drivers/iio/Makefile
>> @@ -6,6 +6,7 @@ obj-$(CONFIG_IIO) += industrialio.o
>>  industrialio-y := industrialio-core.o industrialio-event.o inkern.o
>>  industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o
>>  industrialio-$(CONFIG_IIO_TRIGGER) += industrialio-trigger.o
>> +obj-$(CONFIG_IIO_HW_CONSUMER) += hw_consumer.o
>>  
>>  obj-$(CONFIG_IIO_CONFIGFS) += industrialio-configfs.o
>>  obj-$(CONFIG_IIO_SW_DEVICE) += industrialio-sw-device.o
>> diff --git a/drivers/iio/hw_consumer.c b/drivers/iio/hw_consumer.c
>> new file mode 100644
>> index 0000000..66f0732
>> --- /dev/null
>> +++ b/drivers/iio/hw_consumer.c
>> @@ -0,0 +1,156 @@
>> +#include <linux/err.h>
>> +#include <linux/export.h>
>> +#include <linux/slab.h>
>> +#include <linux/mutex.h>
>> +#include <linux/of.h>
>> +
>> +#include <linux/iio/iio.h>
>> +#include "iio_core.h"
>> +#include <linux/iio/machine.h>
>> +#include <linux/iio/driver.h>
>> +#include <linux/iio/consumer.h>
>> +#include <linux/iio/hw_consumer.h>
>> +#include <linux/iio/buffer.h>
>> +
>> +struct iio_hw_consumer {
>> +	struct list_head buffers;
>> +	struct iio_channel *channels;
>> +};
>> +
>> +struct hw_consumer_buffer {
>> +	struct list_head head;
>> +	struct iio_dev *indio_dev;
>> +	struct iio_buffer buffer;
>> +};
>> +
>> +static struct hw_consumer_buffer *iio_buffer_to_hw_consumer_buffer(
>> +	struct iio_buffer *buffer)
>> +{
>> +	return container_of(buffer, struct hw_consumer_buffer, buffer);
>> +}
>> +
>> +static void iio_hw_buf_release(struct iio_buffer *buffer)
>> +{
>> +	struct hw_consumer_buffer *hw_buf =
>> +		iio_buffer_to_hw_consumer_buffer(buffer);
>> +	kfree(hw_buf->buffer.scan_mask);
>> +	kfree(hw_buf);
>> +}
>> +
>> +static const struct iio_buffer_access_funcs iio_hw_buf_access = {
>> +	.release = &iio_hw_buf_release,
>> +	.modes = INDIO_BUFFER_HARDWARE,
>> +};
>> +
>> +static struct hw_consumer_buffer *iio_hw_consumer_get_buffer(
>> +	struct iio_hw_consumer *hwc, struct iio_dev *indio_dev)
>> +{
>> +	struct hw_consumer_buffer *buf;
>> +
>> +	list_for_each_entry(buf, &hwc->buffers, head) {
>> +		if (buf->indio_dev == indio_dev)
>> +			return buf;
>> +	}
>> +
>> +	buf = kzalloc(sizeof(*buf), GFP_KERNEL);
>> +	if (!buf)
>> +		return NULL;
>> +
>> +	buf->buffer.access = &iio_hw_buf_access;
>> +	buf->indio_dev = indio_dev;
>> +	buf->buffer.scan_mask = kcalloc(BITS_TO_LONGS(indio_dev->masklength),
>> +		sizeof(long), GFP_KERNEL);
>> +	if (!buf->buffer.scan_mask)
>> +		goto err_free_buf;
>> +
>> +	iio_buffer_init(&buf->buffer);
>> +	list_add_tail(&buf->head, &hwc->buffers);
>> +
>> +	return buf;
>> +
>> +err_free_buf:
>> +	kfree(buf);
>> +	return NULL;
>> +}
>> +
>> +struct iio_hw_consumer *iio_hw_consumer_alloc(struct device *dev)
>> +{
>> +	struct hw_consumer_buffer *buf;
>> +	struct iio_hw_consumer *hwc;
>> +	struct iio_channel *chan;
>> +	int ret;
>> +
>> +	hwc = kzalloc(sizeof(*hwc), GFP_KERNEL);
>> +	if (!hwc)
>> +		return ERR_PTR(-ENOMEM);
>> +
>> +	INIT_LIST_HEAD(&hwc->buffers);
>> +
>> +	hwc->channels = iio_channel_get_all(dev);
>> +	if (IS_ERR(hwc->channels)) {
>> +		ret = PTR_ERR(hwc->channels);
>> +		goto err_free_hwc;
>> +	}
>> +
>> +	chan = &hwc->channels[0];
>> +	while (chan->indio_dev) {
>> +		buf = iio_hw_consumer_get_buffer(hwc, chan->indio_dev);
>> +		if (buf == NULL) {
>> +			ret = -ENOMEM;
>> +			goto err_put_buffers;
>> +		}
>> +		set_bit(chan->channel->scan_index, buf->buffer.scan_mask);
>> +		chan++;
>> +	}
>> +
>> +	return hwc;
>> +
>> +err_put_buffers:
>> +	list_for_each_entry(buf, &hwc->buffers, head)
>> +		iio_buffer_put(&buf->buffer);
>> +	iio_channel_release_all(hwc->channels);
>> +err_free_hwc:
>> +	kfree(hwc);
>> +	return ERR_PTR(ret);
>> +}
>> +EXPORT_SYMBOL_GPL(iio_hw_consumer_alloc);
>> +
>> +void iio_hw_consumer_free(struct iio_hw_consumer *hwc)
>> +{
>> +	struct hw_consumer_buffer *buf;
>> +
>> +	iio_channel_release_all(hwc->channels);
>> +	list_for_each_entry(buf, &hwc->buffers, head)
>> +		iio_buffer_put(&buf->buffer);
>> +	kfree(hwc);
>> +}
>> +EXPORT_SYMBOL_GPL(iio_hw_consumer_free);
>> +
>> +int iio_hw_consumer_enable(struct iio_hw_consumer *hwc)
>> +{
>> +	struct hw_consumer_buffer *buf;
>> +	int ret;
>> +
>> +	list_for_each_entry(buf, &hwc->buffers, head) {
>> +		ret = iio_update_buffers(buf->indio_dev, &buf->buffer, NULL);
>> +		if (ret)
>> +			goto err_disable_buffers;
>> +	}
>> +
>> +	return 0;
>> +
>> +err_disable_buffers:
>> +	list_for_each_entry_continue_reverse(buf, &hwc->buffers, head)
>> +		iio_update_buffers(buf->indio_dev, NULL, &buf->buffer);
>> +	return ret;
>> +}
>> +EXPORT_SYMBOL_GPL(iio_hw_consumer_enable);
>> +
>> +void iio_hw_consumer_disable(struct iio_hw_consumer *hwc)
>> +{
>> +	struct hw_consumer_buffer *buf;
>> +
>> +	list_for_each_entry(buf, &hwc->buffers, head)
>> +		iio_update_buffers(buf->indio_dev, NULL, &buf->buffer);
>> +}
>> +EXPORT_SYMBOL_GPL(iio_hw_consumer_disable);
>> diff --git a/include/linux/iio/hw_consumer.h b/include/linux/iio/hw_consumer.h
>> new file mode 100644
>> index 0000000..f12653d
>> --- /dev/null
>> +++ b/include/linux/iio/hw_consumer.h
>> @@ -0,0 +1,12 @@
>> +#ifndef LINUX_IIO_HW_CONSUMER_BUFFER_H
>> +#define LINUX_IIO_HW_CONSUMER_BUFFER_H
>> +
>> +struct device;
>> +struct iio_hw_consumer;
>> +
>> +struct iio_hw_consumer *iio_hw_consumer_alloc(struct device *dev);
>> +void iio_hw_consumer_free(struct iio_hw_consumer *hwc);
>> +int iio_hw_consumer_enable(struct iio_hw_consumer *hwc);
>> +void iio_hw_consumer_disable(struct iio_hw_consumer *hwc);
>> +
>> +#endif
>>

WARNING: multiple messages have this Message-ID (diff)
From: Arnaud Pouliquen <arnaud.pouliquen@st.com>
To: Lars-Peter Clausen <lars@metafoo.de>, Mark Brown <broonie@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre TORGUE <alexandre.torgue@st.com>,
	Olivier MOYSAN <olivier.moysan@st.com>,
	Benjamin GAIGNARD <benjamin.gaignard@st.com>
Subject: Re: [PATCH v3 01/11] iio: Add hardware consumer support
Date: Mon, 11 Sep 2017 11:01:34 +0200	[thread overview]
Message-ID: <eea6504a-314f-3d30-ec5a-e42e8a2e24f6@st.com> (raw)
In-Reply-To: <2f1ea8dc-ff6b-3526-bc9e-50dde1ae9a66@st.com>

Hello Lars,

New gentlemen Reminder.

I suppose that you have to treat a lot of subjects with more priority
than this one, but on my side I'm starting to have a lot of pressure
from project, as STM32 DFSDM upstream is blocked since close to 6 months.

As you proposed the interface, I would be fair you could push it for
upstream this month.

If you don't have time for this, another solution could be that I push
it for you.
Please tell me your preference.

Regards,
Arnaud


On 06/06/2017 12:15 PM, Arnaud Pouliquen wrote:
> Hello Lars,
> 
> Any news on the upstream of your HW consumer interface, prerequisite for
> my STM32 DFSDM upstream?
> Don't hesitate if i can help...
> 
> Regards
> Arnaud
> 
> 
> On 03/17/2017 03:08 PM, Arnaud POULIQUEN wrote:
>> From: Lars-Peter Clausen <lars@metafoo.de>
>>
>> Hardware consumer's can be used when one IIO device has a direct connection
>> to another device in hardware.
>>
>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
>> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
>> ---
>> V2 -> V3:
>> 	 Just Adding sign off.  No update but Jonathan comment.
>>          Need to be taken into account (in agreement with Lars)
>>          when transforming rfc in patch.
>> ---
>>  drivers/iio/Kconfig             |   6 ++
>>  drivers/iio/Makefile            |   1 +
>>  drivers/iio/hw_consumer.c       | 156 ++++++++++++++++++++++++++++++++++++++++
>>  include/linux/iio/hw_consumer.h |  12 ++++
>>  4 files changed, 175 insertions(+)
>>  create mode 100644 drivers/iio/hw_consumer.c
>>  create mode 100644 include/linux/iio/hw_consumer.h
>>
>> diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig
>> index 6743b18..956dd18 100644
>> --- a/drivers/iio/Kconfig
>> +++ b/drivers/iio/Kconfig
>> @@ -30,6 +30,12 @@ config IIO_CONFIGFS
>>  	  (e.g. software triggers). For more info see
>>  	  Documentation/iio/iio_configfs.txt.
>>  
>> +config IIO_HW_CONSUMER
>> +	tristate
>> +	help
>> +	  Hardware consumer buffer
>> +
>> +
>>  config IIO_TRIGGER
>>  	bool "Enable triggered sampling support"
>>  	help
>> diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile
>> index 87e4c43..8472b97 100644
>> --- a/drivers/iio/Makefile
>> +++ b/drivers/iio/Makefile
>> @@ -6,6 +6,7 @@ obj-$(CONFIG_IIO) += industrialio.o
>>  industrialio-y := industrialio-core.o industrialio-event.o inkern.o
>>  industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o
>>  industrialio-$(CONFIG_IIO_TRIGGER) += industrialio-trigger.o
>> +obj-$(CONFIG_IIO_HW_CONSUMER) += hw_consumer.o
>>  
>>  obj-$(CONFIG_IIO_CONFIGFS) += industrialio-configfs.o
>>  obj-$(CONFIG_IIO_SW_DEVICE) += industrialio-sw-device.o
>> diff --git a/drivers/iio/hw_consumer.c b/drivers/iio/hw_consumer.c
>> new file mode 100644
>> index 0000000..66f0732
>> --- /dev/null
>> +++ b/drivers/iio/hw_consumer.c
>> @@ -0,0 +1,156 @@
>> +#include <linux/err.h>
>> +#include <linux/export.h>
>> +#include <linux/slab.h>
>> +#include <linux/mutex.h>
>> +#include <linux/of.h>
>> +
>> +#include <linux/iio/iio.h>
>> +#include "iio_core.h"
>> +#include <linux/iio/machine.h>
>> +#include <linux/iio/driver.h>
>> +#include <linux/iio/consumer.h>
>> +#include <linux/iio/hw_consumer.h>
>> +#include <linux/iio/buffer.h>
>> +
>> +struct iio_hw_consumer {
>> +	struct list_head buffers;
>> +	struct iio_channel *channels;
>> +};
>> +
>> +struct hw_consumer_buffer {
>> +	struct list_head head;
>> +	struct iio_dev *indio_dev;
>> +	struct iio_buffer buffer;
>> +};
>> +
>> +static struct hw_consumer_buffer *iio_buffer_to_hw_consumer_buffer(
>> +	struct iio_buffer *buffer)
>> +{
>> +	return container_of(buffer, struct hw_consumer_buffer, buffer);
>> +}
>> +
>> +static void iio_hw_buf_release(struct iio_buffer *buffer)
>> +{
>> +	struct hw_consumer_buffer *hw_buf =
>> +		iio_buffer_to_hw_consumer_buffer(buffer);
>> +	kfree(hw_buf->buffer.scan_mask);
>> +	kfree(hw_buf);
>> +}
>> +
>> +static const struct iio_buffer_access_funcs iio_hw_buf_access = {
>> +	.release = &iio_hw_buf_release,
>> +	.modes = INDIO_BUFFER_HARDWARE,
>> +};
>> +
>> +static struct hw_consumer_buffer *iio_hw_consumer_get_buffer(
>> +	struct iio_hw_consumer *hwc, struct iio_dev *indio_dev)
>> +{
>> +	struct hw_consumer_buffer *buf;
>> +
>> +	list_for_each_entry(buf, &hwc->buffers, head) {
>> +		if (buf->indio_dev == indio_dev)
>> +			return buf;
>> +	}
>> +
>> +	buf = kzalloc(sizeof(*buf), GFP_KERNEL);
>> +	if (!buf)
>> +		return NULL;
>> +
>> +	buf->buffer.access = &iio_hw_buf_access;
>> +	buf->indio_dev = indio_dev;
>> +	buf->buffer.scan_mask = kcalloc(BITS_TO_LONGS(indio_dev->masklength),
>> +		sizeof(long), GFP_KERNEL);
>> +	if (!buf->buffer.scan_mask)
>> +		goto err_free_buf;
>> +
>> +	iio_buffer_init(&buf->buffer);
>> +	list_add_tail(&buf->head, &hwc->buffers);
>> +
>> +	return buf;
>> +
>> +err_free_buf:
>> +	kfree(buf);
>> +	return NULL;
>> +}
>> +
>> +struct iio_hw_consumer *iio_hw_consumer_alloc(struct device *dev)
>> +{
>> +	struct hw_consumer_buffer *buf;
>> +	struct iio_hw_consumer *hwc;
>> +	struct iio_channel *chan;
>> +	int ret;
>> +
>> +	hwc = kzalloc(sizeof(*hwc), GFP_KERNEL);
>> +	if (!hwc)
>> +		return ERR_PTR(-ENOMEM);
>> +
>> +	INIT_LIST_HEAD(&hwc->buffers);
>> +
>> +	hwc->channels = iio_channel_get_all(dev);
>> +	if (IS_ERR(hwc->channels)) {
>> +		ret = PTR_ERR(hwc->channels);
>> +		goto err_free_hwc;
>> +	}
>> +
>> +	chan = &hwc->channels[0];
>> +	while (chan->indio_dev) {
>> +		buf = iio_hw_consumer_get_buffer(hwc, chan->indio_dev);
>> +		if (buf == NULL) {
>> +			ret = -ENOMEM;
>> +			goto err_put_buffers;
>> +		}
>> +		set_bit(chan->channel->scan_index, buf->buffer.scan_mask);
>> +		chan++;
>> +	}
>> +
>> +	return hwc;
>> +
>> +err_put_buffers:
>> +	list_for_each_entry(buf, &hwc->buffers, head)
>> +		iio_buffer_put(&buf->buffer);
>> +	iio_channel_release_all(hwc->channels);
>> +err_free_hwc:
>> +	kfree(hwc);
>> +	return ERR_PTR(ret);
>> +}
>> +EXPORT_SYMBOL_GPL(iio_hw_consumer_alloc);
>> +
>> +void iio_hw_consumer_free(struct iio_hw_consumer *hwc)
>> +{
>> +	struct hw_consumer_buffer *buf;
>> +
>> +	iio_channel_release_all(hwc->channels);
>> +	list_for_each_entry(buf, &hwc->buffers, head)
>> +		iio_buffer_put(&buf->buffer);
>> +	kfree(hwc);
>> +}
>> +EXPORT_SYMBOL_GPL(iio_hw_consumer_free);
>> +
>> +int iio_hw_consumer_enable(struct iio_hw_consumer *hwc)
>> +{
>> +	struct hw_consumer_buffer *buf;
>> +	int ret;
>> +
>> +	list_for_each_entry(buf, &hwc->buffers, head) {
>> +		ret = iio_update_buffers(buf->indio_dev, &buf->buffer, NULL);
>> +		if (ret)
>> +			goto err_disable_buffers;
>> +	}
>> +
>> +	return 0;
>> +
>> +err_disable_buffers:
>> +	list_for_each_entry_continue_reverse(buf, &hwc->buffers, head)
>> +		iio_update_buffers(buf->indio_dev, NULL, &buf->buffer);
>> +	return ret;
>> +}
>> +EXPORT_SYMBOL_GPL(iio_hw_consumer_enable);
>> +
>> +void iio_hw_consumer_disable(struct iio_hw_consumer *hwc)
>> +{
>> +	struct hw_consumer_buffer *buf;
>> +
>> +	list_for_each_entry(buf, &hwc->buffers, head)
>> +		iio_update_buffers(buf->indio_dev, NULL, &buf->buffer);
>> +}
>> +EXPORT_SYMBOL_GPL(iio_hw_consumer_disable);
>> diff --git a/include/linux/iio/hw_consumer.h b/include/linux/iio/hw_consumer.h
>> new file mode 100644
>> index 0000000..f12653d
>> --- /dev/null
>> +++ b/include/linux/iio/hw_consumer.h
>> @@ -0,0 +1,12 @@
>> +#ifndef LINUX_IIO_HW_CONSUMER_BUFFER_H
>> +#define LINUX_IIO_HW_CONSUMER_BUFFER_H
>> +
>> +struct device;
>> +struct iio_hw_consumer;
>> +
>> +struct iio_hw_consumer *iio_hw_consumer_alloc(struct device *dev);
>> +void iio_hw_consumer_free(struct iio_hw_consumer *hwc);
>> +int iio_hw_consumer_enable(struct iio_hw_consumer *hwc);
>> +void iio_hw_consumer_disable(struct iio_hw_consumer *hwc);
>> +
>> +#endif
>>

WARNING: multiple messages have this Message-ID (diff)
From: arnaud.pouliquen@st.com (Arnaud Pouliquen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 01/11] iio: Add hardware consumer support
Date: Mon, 11 Sep 2017 11:01:34 +0200	[thread overview]
Message-ID: <eea6504a-314f-3d30-ec5a-e42e8a2e24f6@st.com> (raw)
In-Reply-To: <2f1ea8dc-ff6b-3526-bc9e-50dde1ae9a66@st.com>

Hello Lars,

New gentlemen Reminder.

I suppose that you have to treat a lot of subjects with more priority
than this one, but on my side I'm starting to have a lot of pressure
from project, as STM32 DFSDM upstream is blocked since close to 6 months.

As you proposed the interface, I would be fair you could push it for
upstream this month.

If you don't have time for this, another solution could be that I push
it for you.
Please tell me your preference.

Regards,
Arnaud


On 06/06/2017 12:15 PM, Arnaud Pouliquen wrote:
> Hello Lars,
> 
> Any news on the upstream of your HW consumer interface, prerequisite for
> my STM32 DFSDM upstream?
> Don't hesitate if i can help...
> 
> Regards
> Arnaud
> 
> 
> On 03/17/2017 03:08 PM, Arnaud POULIQUEN wrote:
>> From: Lars-Peter Clausen <lars@metafoo.de>
>>
>> Hardware consumer's can be used when one IIO device has a direct connection
>> to another device in hardware.
>>
>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
>> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
>> ---
>> V2 -> V3:
>> 	 Just Adding sign off.  No update but Jonathan comment.
>>          Need to be taken into account (in agreement with Lars)
>>          when transforming rfc in patch.
>> ---
>>  drivers/iio/Kconfig             |   6 ++
>>  drivers/iio/Makefile            |   1 +
>>  drivers/iio/hw_consumer.c       | 156 ++++++++++++++++++++++++++++++++++++++++
>>  include/linux/iio/hw_consumer.h |  12 ++++
>>  4 files changed, 175 insertions(+)
>>  create mode 100644 drivers/iio/hw_consumer.c
>>  create mode 100644 include/linux/iio/hw_consumer.h
>>
>> diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig
>> index 6743b18..956dd18 100644
>> --- a/drivers/iio/Kconfig
>> +++ b/drivers/iio/Kconfig
>> @@ -30,6 +30,12 @@ config IIO_CONFIGFS
>>  	  (e.g. software triggers). For more info see
>>  	  Documentation/iio/iio_configfs.txt.
>>  
>> +config IIO_HW_CONSUMER
>> +	tristate
>> +	help
>> +	  Hardware consumer buffer
>> +
>> +
>>  config IIO_TRIGGER
>>  	bool "Enable triggered sampling support"
>>  	help
>> diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile
>> index 87e4c43..8472b97 100644
>> --- a/drivers/iio/Makefile
>> +++ b/drivers/iio/Makefile
>> @@ -6,6 +6,7 @@ obj-$(CONFIG_IIO) += industrialio.o
>>  industrialio-y := industrialio-core.o industrialio-event.o inkern.o
>>  industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o
>>  industrialio-$(CONFIG_IIO_TRIGGER) += industrialio-trigger.o
>> +obj-$(CONFIG_IIO_HW_CONSUMER) += hw_consumer.o
>>  
>>  obj-$(CONFIG_IIO_CONFIGFS) += industrialio-configfs.o
>>  obj-$(CONFIG_IIO_SW_DEVICE) += industrialio-sw-device.o
>> diff --git a/drivers/iio/hw_consumer.c b/drivers/iio/hw_consumer.c
>> new file mode 100644
>> index 0000000..66f0732
>> --- /dev/null
>> +++ b/drivers/iio/hw_consumer.c
>> @@ -0,0 +1,156 @@
>> +#include <linux/err.h>
>> +#include <linux/export.h>
>> +#include <linux/slab.h>
>> +#include <linux/mutex.h>
>> +#include <linux/of.h>
>> +
>> +#include <linux/iio/iio.h>
>> +#include "iio_core.h"
>> +#include <linux/iio/machine.h>
>> +#include <linux/iio/driver.h>
>> +#include <linux/iio/consumer.h>
>> +#include <linux/iio/hw_consumer.h>
>> +#include <linux/iio/buffer.h>
>> +
>> +struct iio_hw_consumer {
>> +	struct list_head buffers;
>> +	struct iio_channel *channels;
>> +};
>> +
>> +struct hw_consumer_buffer {
>> +	struct list_head head;
>> +	struct iio_dev *indio_dev;
>> +	struct iio_buffer buffer;
>> +};
>> +
>> +static struct hw_consumer_buffer *iio_buffer_to_hw_consumer_buffer(
>> +	struct iio_buffer *buffer)
>> +{
>> +	return container_of(buffer, struct hw_consumer_buffer, buffer);
>> +}
>> +
>> +static void iio_hw_buf_release(struct iio_buffer *buffer)
>> +{
>> +	struct hw_consumer_buffer *hw_buf =
>> +		iio_buffer_to_hw_consumer_buffer(buffer);
>> +	kfree(hw_buf->buffer.scan_mask);
>> +	kfree(hw_buf);
>> +}
>> +
>> +static const struct iio_buffer_access_funcs iio_hw_buf_access = {
>> +	.release = &iio_hw_buf_release,
>> +	.modes = INDIO_BUFFER_HARDWARE,
>> +};
>> +
>> +static struct hw_consumer_buffer *iio_hw_consumer_get_buffer(
>> +	struct iio_hw_consumer *hwc, struct iio_dev *indio_dev)
>> +{
>> +	struct hw_consumer_buffer *buf;
>> +
>> +	list_for_each_entry(buf, &hwc->buffers, head) {
>> +		if (buf->indio_dev == indio_dev)
>> +			return buf;
>> +	}
>> +
>> +	buf = kzalloc(sizeof(*buf), GFP_KERNEL);
>> +	if (!buf)
>> +		return NULL;
>> +
>> +	buf->buffer.access = &iio_hw_buf_access;
>> +	buf->indio_dev = indio_dev;
>> +	buf->buffer.scan_mask = kcalloc(BITS_TO_LONGS(indio_dev->masklength),
>> +		sizeof(long), GFP_KERNEL);
>> +	if (!buf->buffer.scan_mask)
>> +		goto err_free_buf;
>> +
>> +	iio_buffer_init(&buf->buffer);
>> +	list_add_tail(&buf->head, &hwc->buffers);
>> +
>> +	return buf;
>> +
>> +err_free_buf:
>> +	kfree(buf);
>> +	return NULL;
>> +}
>> +
>> +struct iio_hw_consumer *iio_hw_consumer_alloc(struct device *dev)
>> +{
>> +	struct hw_consumer_buffer *buf;
>> +	struct iio_hw_consumer *hwc;
>> +	struct iio_channel *chan;
>> +	int ret;
>> +
>> +	hwc = kzalloc(sizeof(*hwc), GFP_KERNEL);
>> +	if (!hwc)
>> +		return ERR_PTR(-ENOMEM);
>> +
>> +	INIT_LIST_HEAD(&hwc->buffers);
>> +
>> +	hwc->channels = iio_channel_get_all(dev);
>> +	if (IS_ERR(hwc->channels)) {
>> +		ret = PTR_ERR(hwc->channels);
>> +		goto err_free_hwc;
>> +	}
>> +
>> +	chan = &hwc->channels[0];
>> +	while (chan->indio_dev) {
>> +		buf = iio_hw_consumer_get_buffer(hwc, chan->indio_dev);
>> +		if (buf == NULL) {
>> +			ret = -ENOMEM;
>> +			goto err_put_buffers;
>> +		}
>> +		set_bit(chan->channel->scan_index, buf->buffer.scan_mask);
>> +		chan++;
>> +	}
>> +
>> +	return hwc;
>> +
>> +err_put_buffers:
>> +	list_for_each_entry(buf, &hwc->buffers, head)
>> +		iio_buffer_put(&buf->buffer);
>> +	iio_channel_release_all(hwc->channels);
>> +err_free_hwc:
>> +	kfree(hwc);
>> +	return ERR_PTR(ret);
>> +}
>> +EXPORT_SYMBOL_GPL(iio_hw_consumer_alloc);
>> +
>> +void iio_hw_consumer_free(struct iio_hw_consumer *hwc)
>> +{
>> +	struct hw_consumer_buffer *buf;
>> +
>> +	iio_channel_release_all(hwc->channels);
>> +	list_for_each_entry(buf, &hwc->buffers, head)
>> +		iio_buffer_put(&buf->buffer);
>> +	kfree(hwc);
>> +}
>> +EXPORT_SYMBOL_GPL(iio_hw_consumer_free);
>> +
>> +int iio_hw_consumer_enable(struct iio_hw_consumer *hwc)
>> +{
>> +	struct hw_consumer_buffer *buf;
>> +	int ret;
>> +
>> +	list_for_each_entry(buf, &hwc->buffers, head) {
>> +		ret = iio_update_buffers(buf->indio_dev, &buf->buffer, NULL);
>> +		if (ret)
>> +			goto err_disable_buffers;
>> +	}
>> +
>> +	return 0;
>> +
>> +err_disable_buffers:
>> +	list_for_each_entry_continue_reverse(buf, &hwc->buffers, head)
>> +		iio_update_buffers(buf->indio_dev, NULL, &buf->buffer);
>> +	return ret;
>> +}
>> +EXPORT_SYMBOL_GPL(iio_hw_consumer_enable);
>> +
>> +void iio_hw_consumer_disable(struct iio_hw_consumer *hwc)
>> +{
>> +	struct hw_consumer_buffer *buf;
>> +
>> +	list_for_each_entry(buf, &hwc->buffers, head)
>> +		iio_update_buffers(buf->indio_dev, NULL, &buf->buffer);
>> +}
>> +EXPORT_SYMBOL_GPL(iio_hw_consumer_disable);
>> diff --git a/include/linux/iio/hw_consumer.h b/include/linux/iio/hw_consumer.h
>> new file mode 100644
>> index 0000000..f12653d
>> --- /dev/null
>> +++ b/include/linux/iio/hw_consumer.h
>> @@ -0,0 +1,12 @@
>> +#ifndef LINUX_IIO_HW_CONSUMER_BUFFER_H
>> +#define LINUX_IIO_HW_CONSUMER_BUFFER_H
>> +
>> +struct device;
>> +struct iio_hw_consumer;
>> +
>> +struct iio_hw_consumer *iio_hw_consumer_alloc(struct device *dev);
>> +void iio_hw_consumer_free(struct iio_hw_consumer *hwc);
>> +int iio_hw_consumer_enable(struct iio_hw_consumer *hwc);
>> +void iio_hw_consumer_disable(struct iio_hw_consumer *hwc);
>> +
>> +#endif
>>

  reply	other threads:[~2017-09-11  9:01 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-17 14:08 [PATCH v3 00/11] Add STM32 DFSDM support Arnaud Pouliquen
2017-03-17 14:08 ` Arnaud Pouliquen
2017-03-17 14:08 ` Arnaud Pouliquen
2017-03-17 14:08 ` [PATCH v3 01/11] iio: Add hardware consumer support Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-20  7:48   ` Peter Meerwald-Stadler
2017-06-06 10:15   ` Arnaud Pouliquen
2017-06-06 10:15     ` Arnaud Pouliquen
2017-06-06 10:15     ` Arnaud Pouliquen
2017-09-11  9:01     ` Arnaud Pouliquen [this message]
2017-09-11  9:01       ` Arnaud Pouliquen
2017-09-11  9:01       ` Arnaud Pouliquen
2017-03-17 14:08 ` [PATCH v3 02/11] IIO: Add DT bindings for sigma delta adc modulator Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
     [not found]   ` <1489759704-30217-3-git-send-email-arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>
2017-03-24 14:21     ` Rob Herring
2017-03-24 14:21       ` Rob Herring
2017-03-24 14:21       ` Rob Herring
2017-03-17 14:08 ` [PATCH v3 03/11] IIO: ADC: add sigma delta modulator support Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-20  6:24   ` [alsa-devel] " kbuild test robot
2017-03-20  6:24     ` kbuild test robot
2017-03-20  6:24     ` kbuild test robot
2017-03-20  6:51   ` kbuild test robot
2017-03-20  6:51     ` kbuild test robot
2017-03-20  6:51     ` kbuild test robot
2017-03-17 14:08 ` [PATCH v3 04/11] IIO: add DT bindings for stm32 DFSDM filter Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-24 14:37   ` Rob Herring
2017-03-24 14:37     ` Rob Herring
2017-03-24 14:37     ` Rob Herring
2017-03-17 14:08 ` [PATCH v3 05/11] IIO: ADC: add stm32 DFSDM support for Sigma delta ADC Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
     [not found]   ` <1489759704-30217-6-git-send-email-arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>
2017-03-19 22:25     ` Jonathan Cameron
2017-03-19 22:25       ` Jonathan Cameron
2017-03-19 22:25       ` Jonathan Cameron
2017-03-20 11:24       ` Arnaud Pouliquen
2017-03-20 11:24         ` Arnaud Pouliquen
2017-03-20 11:24         ` Arnaud Pouliquen
2017-03-25 15:53         ` Jonathan Cameron
2017-03-25 15:53           ` Jonathan Cameron
2017-03-25 15:53           ` Jonathan Cameron
2017-03-20  7:22     ` [alsa-devel] " kbuild test robot
2017-03-20  7:22       ` kbuild test robot
2017-03-20  8:04     ` kbuild test robot
2017-03-20  8:04       ` kbuild test robot
2017-03-20  8:04       ` kbuild test robot
2017-03-17 14:08 ` [PATCH v3 06/11] IIO: ADC: add stm32 DFSDM support for PDM microphone Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
     [not found]   ` <1489759704-30217-7-git-send-email-arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>
2017-03-19 22:38     ` Jonathan Cameron
2017-03-19 22:38       ` Jonathan Cameron
2017-03-19 22:38       ` Jonathan Cameron
2017-03-20 11:29       ` Arnaud Pouliquen
2017-03-20 11:29         ` Arnaud Pouliquen
2017-03-20 11:29         ` Arnaud Pouliquen
2017-03-25 15:59         ` Jonathan Cameron
2017-03-25 15:59           ` Jonathan Cameron
2017-03-25 15:59           ` Jonathan Cameron
2017-03-28  7:45           ` Arnaud Pouliquen
2017-03-28  7:45             ` Arnaud Pouliquen
2017-03-28  7:45             ` Arnaud Pouliquen
2017-03-17 14:08 ` [PATCH v3 07/11] IIO: consumer: allow to set buffer sizes Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
     [not found]   ` <1489759704-30217-8-git-send-email-arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>
2017-03-19 22:44     ` Jonathan Cameron
2017-03-19 22:44       ` Jonathan Cameron
2017-03-19 22:44       ` Jonathan Cameron
2017-03-20 11:30       ` Arnaud Pouliquen
2017-03-20 11:30         ` Arnaud Pouliquen
2017-03-20 11:30         ` Arnaud Pouliquen
2017-03-25 16:01         ` Jonathan Cameron
2017-03-25 16:01           ` Jonathan Cameron
2017-03-25 16:01           ` Jonathan Cameron
2017-03-20  6:22     ` [alsa-devel] " kbuild test robot
2017-03-20  6:22       ` kbuild test robot
2017-03-20  6:22       ` kbuild test robot
2017-03-20  8:08   ` Peter Meerwald-Stadler
2017-03-17 14:08 ` [PATCH v3 08/11] ASoC: Add bindings for DMIC codec driver Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-24 14:46   ` Rob Herring
2017-03-24 14:46     ` Rob Herring
2017-03-24 14:46     ` Rob Herring
2017-03-27 11:59     ` Mark Brown
2017-03-27 11:59       ` Mark Brown
2017-03-27 11:59       ` Mark Brown
2017-03-17 14:08 ` [PATCH v3 09/11] ASoC: codec: add DT support in dmic codec Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-17 14:08 ` [PATCH v3 10/11] ASoC: add bindings for stm32 DFSDM filter Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-24 14:52   ` Rob Herring
2017-03-24 14:52     ` Rob Herring
2017-03-24 14:52     ` Rob Herring
2017-03-29 12:42     ` Arnaud Pouliquen
2017-03-29 12:42       ` Arnaud Pouliquen
2017-03-29 12:42       ` Arnaud Pouliquen
2017-03-17 14:08 ` [PATCH v3 11/11] ASoC: stm32: add DFSDM DAI support Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-17 14:08   ` Arnaud Pouliquen
2017-03-17 16:36 ` [PATCH v3 00/11] Add STM32 DFSDM support Arnaud Pouliquen
2017-03-17 16:36   ` Arnaud Pouliquen
2017-03-17 16:36   ` Arnaud Pouliquen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eea6504a-314f-3d30-ec5a-e42e8a2e24f6@st.com \
    --to=arnaud.pouliquen@st.com \
    --cc=alexandre.torgue@st.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=benjamin.gaignard@st.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=olivier.moysan@st.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.