* [PATCH v2 0/2] counter: push event on every pulse
@ 2022-02-03 13:57 Oleksij Rempel
2022-02-03 13:57 ` [PATCH v2 1/2] counter: add new COUNTER_EVENT_CHANGE_OF_STATE Oleksij Rempel
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Oleksij Rempel @ 2022-02-03 13:57 UTC (permalink / raw)
To: William Breathitt Gray
Cc: Oleksij Rempel, linux-kernel, Pengutronix Kernel Team,
David Jander, Robin van der Gracht, linux-iio, Jonathan Cameron
changes v2
- rebase against latest kernel and fix some regressions
- add COUNTER_EVENT_CHANGE_OF_STATE event
Add support of push even on every pulse.
Oleksij Rempel (2):
counter: add new COUNTER_EVENT_CHANGE_OF_STATE
counter: interrupt-cnt: add counter_push_event()
drivers/counter/interrupt-cnt.c | 7 +++++--
include/uapi/linux/counter.h | 2 ++
2 files changed, 7 insertions(+), 2 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] counter: add new COUNTER_EVENT_CHANGE_OF_STATE
2022-02-03 13:57 [PATCH v2 0/2] counter: push event on every pulse Oleksij Rempel
@ 2022-02-03 13:57 ` Oleksij Rempel
2022-02-03 13:57 ` [PATCH v2 2/2] counter: interrupt-cnt: add counter_push_event() Oleksij Rempel
2022-02-11 9:41 ` [PATCH v2 0/2] counter: push event on every pulse William Breathitt Gray
2 siblings, 0 replies; 5+ messages in thread
From: Oleksij Rempel @ 2022-02-03 13:57 UTC (permalink / raw)
To: William Breathitt Gray
Cc: Oleksij Rempel, linux-kernel, Pengutronix Kernel Team,
David Jander, Robin van der Gracht, linux-iio, Jonathan Cameron
Add new counter event to notify user space about every new counter
pulse.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
include/uapi/linux/counter.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/uapi/linux/counter.h b/include/uapi/linux/counter.h
index d0aa95aeff7b..96c5ffd368ad 100644
--- a/include/uapi/linux/counter.h
+++ b/include/uapi/linux/counter.h
@@ -61,6 +61,8 @@ enum counter_event_type {
COUNTER_EVENT_THRESHOLD,
/* Index signal detected */
COUNTER_EVENT_INDEX,
+ /* State of counter is changed */
+ COUNTER_EVENT_CHANGE_OF_STATE,
};
/**
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] counter: interrupt-cnt: add counter_push_event()
2022-02-03 13:57 [PATCH v2 0/2] counter: push event on every pulse Oleksij Rempel
2022-02-03 13:57 ` [PATCH v2 1/2] counter: add new COUNTER_EVENT_CHANGE_OF_STATE Oleksij Rempel
@ 2022-02-03 13:57 ` Oleksij Rempel
2022-02-04 7:35 ` William Breathitt Gray
2022-02-11 9:41 ` [PATCH v2 0/2] counter: push event on every pulse William Breathitt Gray
2 siblings, 1 reply; 5+ messages in thread
From: Oleksij Rempel @ 2022-02-03 13:57 UTC (permalink / raw)
To: William Breathitt Gray
Cc: Oleksij Rempel, linux-kernel, Pengutronix Kernel Team,
David Jander, Robin van der Gracht, linux-iio, Jonathan Cameron
Add counter_push_event() to notify user space about new pulses
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/counter/interrupt-cnt.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/counter/interrupt-cnt.c b/drivers/counter/interrupt-cnt.c
index 9e99702470c2..3b13f56bbb11 100644
--- a/drivers/counter/interrupt-cnt.c
+++ b/drivers/counter/interrupt-cnt.c
@@ -26,10 +26,13 @@ struct interrupt_cnt_priv {
static irqreturn_t interrupt_cnt_isr(int irq, void *dev_id)
{
- struct interrupt_cnt_priv *priv = dev_id;
+ struct counter_device *counter = dev_id;
+ struct interrupt_cnt_priv *priv = counter_priv(counter);
atomic_inc(&priv->count);
+ counter_push_event(counter, COUNTER_EVENT_CHANGE_OF_STATE, 0);
+
return IRQ_HANDLED;
}
@@ -209,7 +212,7 @@ static int interrupt_cnt_probe(struct platform_device *pdev)
irq_set_status_flags(priv->irq, IRQ_NOAUTOEN);
ret = devm_request_irq(dev, priv->irq, interrupt_cnt_isr,
IRQF_TRIGGER_RISING | IRQF_NO_THREAD,
- dev_name(dev), priv);
+ dev_name(dev), counter);
if (ret)
return ret;
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] counter: interrupt-cnt: add counter_push_event()
2022-02-03 13:57 ` [PATCH v2 2/2] counter: interrupt-cnt: add counter_push_event() Oleksij Rempel
@ 2022-02-04 7:35 ` William Breathitt Gray
0 siblings, 0 replies; 5+ messages in thread
From: William Breathitt Gray @ 2022-02-04 7:35 UTC (permalink / raw)
To: Oleksij Rempel
Cc: linux-kernel, Pengutronix Kernel Team, David Jander,
Robin van der Gracht, linux-iio, Jonathan Cameron
[-- Attachment #1: Type: text/plain, Size: 1699 bytes --]
On Thu, Feb 03, 2022 at 02:57:27PM +0100, Oleksij Rempel wrote:
> Add counter_push_event() to notify user space about new pulses
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
This is a simple solution so if it works for your use-case I'm okay with
it; I think future counter devices could make use of this new
COUNTER_EVENT_CHANGE_OF_STATE event type too, so that's a plus.
I'm going to wait a week to give others time to chime in if they want.
Otherwise I'll give a proper approval for this series next week.
William Breathitt Gray
> ---
> drivers/counter/interrupt-cnt.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/counter/interrupt-cnt.c b/drivers/counter/interrupt-cnt.c
> index 9e99702470c2..3b13f56bbb11 100644
> --- a/drivers/counter/interrupt-cnt.c
> +++ b/drivers/counter/interrupt-cnt.c
> @@ -26,10 +26,13 @@ struct interrupt_cnt_priv {
>
> static irqreturn_t interrupt_cnt_isr(int irq, void *dev_id)
> {
> - struct interrupt_cnt_priv *priv = dev_id;
> + struct counter_device *counter = dev_id;
> + struct interrupt_cnt_priv *priv = counter_priv(counter);
>
> atomic_inc(&priv->count);
>
> + counter_push_event(counter, COUNTER_EVENT_CHANGE_OF_STATE, 0);
> +
> return IRQ_HANDLED;
> }
>
> @@ -209,7 +212,7 @@ static int interrupt_cnt_probe(struct platform_device *pdev)
> irq_set_status_flags(priv->irq, IRQ_NOAUTOEN);
> ret = devm_request_irq(dev, priv->irq, interrupt_cnt_isr,
> IRQF_TRIGGER_RISING | IRQF_NO_THREAD,
> - dev_name(dev), priv);
> + dev_name(dev), counter);
> if (ret)
> return ret;
>
> --
> 2.30.2
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/2] counter: push event on every pulse
2022-02-03 13:57 [PATCH v2 0/2] counter: push event on every pulse Oleksij Rempel
2022-02-03 13:57 ` [PATCH v2 1/2] counter: add new COUNTER_EVENT_CHANGE_OF_STATE Oleksij Rempel
2022-02-03 13:57 ` [PATCH v2 2/2] counter: interrupt-cnt: add counter_push_event() Oleksij Rempel
@ 2022-02-11 9:41 ` William Breathitt Gray
2 siblings, 0 replies; 5+ messages in thread
From: William Breathitt Gray @ 2022-02-11 9:41 UTC (permalink / raw)
To: Oleksij Rempel
Cc: linux-kernel, Pengutronix Kernel Team, David Jander,
Robin van der Gracht, linux-iio, Jonathan Cameron
[-- Attachment #1: Type: text/plain, Size: 678 bytes --]
On Thu, Feb 03, 2022 at 02:57:25PM +0100, Oleksij Rempel wrote:
> changes v2
> - rebase against latest kernel and fix some regressions
> - add COUNTER_EVENT_CHANGE_OF_STATE event
>
> Add support of push even on every pulse.
>
> Oleksij Rempel (2):
> counter: add new COUNTER_EVENT_CHANGE_OF_STATE
> counter: interrupt-cnt: add counter_push_event()
>
> drivers/counter/interrupt-cnt.c | 7 +++++--
> include/uapi/linux/counter.h | 2 ++
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> --
> 2.30.2
Thank you Oleksij, I'm picking this up now and I'll submit it with the
rest of the Counter patches for this cycle.
William Breathitt Gray
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-11 9:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 13:57 [PATCH v2 0/2] counter: push event on every pulse Oleksij Rempel
2022-02-03 13:57 ` [PATCH v2 1/2] counter: add new COUNTER_EVENT_CHANGE_OF_STATE Oleksij Rempel
2022-02-03 13:57 ` [PATCH v2 2/2] counter: interrupt-cnt: add counter_push_event() Oleksij Rempel
2022-02-04 7:35 ` William Breathitt Gray
2022-02-11 9:41 ` [PATCH v2 0/2] counter: push event on every pulse William Breathitt Gray
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).