linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/5] media/v4l2-ctrls: volatiles should not generate CH_VALUE
@ 2015-03-20 13:30 Ricardo Ribalda Delgado
  2015-03-20 13:30 ` [PATCH v2 4/5] media/v4l2-ctrls: Always execute EXECUTE_ON_WRITE ctrls Ricardo Ribalda Delgado
  2015-04-21 17:44 ` [PATCH v2 1/5] media/v4l2-ctrls: volatiles should not generate CH_VALUE Laurent Pinchart
  0 siblings, 2 replies; 4+ messages in thread
From: Ricardo Ribalda Delgado @ 2015-03-20 13:30 UTC (permalink / raw)
  To: Ricardo Ribalda Delgado, Hans Verkuil, Mauro Carvalho Chehab,
	Arun Kumar K, Sylwester Nawrocki, Antti Palosaari, linux-media,
	linux-kernel, Laurent Pinchart, Sakari Ailus

Volatile controls should not generate CH_VALUE events.

Set has_changed to false to prevent this happening.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
v2: By Sakari Ailus <sakari.ailus@linux.intel.com>

Fix CodeStyle (sorry :S)
 drivers/media/v4l2-core/v4l2-ctrls.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 45c5b47..2ebc33e 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -1609,6 +1609,15 @@ static int cluster_changed(struct v4l2_ctrl *master)
 
 		if (ctrl == NULL)
 			continue;
+		/*
+		 * Set has_changed to false to avoid generating
+		 * the event V4L2_EVENT_CTRL_CH_VALUE
+		 */
+		if (ctrl->flags & V4L2_CTRL_FLAG_VOLATILE) {
+			ctrl->has_changed = false;
+			continue;
+		}
+
 		for (idx = 0; !ctrl_changed && idx < ctrl->elems; idx++)
 			ctrl_changed = !ctrl->type_ops->equal(ctrl, idx,
 				ctrl->p_cur, ctrl->p_new);
-- 
2.1.4


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

* [PATCH v2 4/5] media/v4l2-ctrls: Always execute EXECUTE_ON_WRITE ctrls
  2015-03-20 13:30 [PATCH v2 1/5] media/v4l2-ctrls: volatiles should not generate CH_VALUE Ricardo Ribalda Delgado
@ 2015-03-20 13:30 ` Ricardo Ribalda Delgado
  2015-04-21 17:44 ` [PATCH v2 1/5] media/v4l2-ctrls: volatiles should not generate CH_VALUE Laurent Pinchart
  1 sibling, 0 replies; 4+ messages in thread
From: Ricardo Ribalda Delgado @ 2015-03-20 13:30 UTC (permalink / raw)
  To: Ricardo Ribalda Delgado, Hans Verkuil, Mauro Carvalho Chehab,
	Arun Kumar K, Sylwester Nawrocki, Antti Palosaari, linux-media,
	linux-kernel, Laurent Pinchart, Sakari Ailus

Any control with V4L2_CTRL_FLAG_EXECUTE_ON_WRITE set should return
changed == true in cluster_changed.

This forces the value to be passed to the driver even if it has not
changed.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
v2: By Sakari Ailus <sakari.ailus@linux.intel.com>

Fix CodeStyle (sorry :S)
 drivers/media/v4l2-core/v4l2-ctrls.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index bacaed6..04d7407 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -1611,6 +1611,10 @@ static int cluster_changed(struct v4l2_ctrl *master)
 
 		if (ctrl == NULL)
 			continue;
+
+		if (ctrl->flags & V4L2_CTRL_FLAG_EXECUTE_ON_WRITE)
+			changed = true;
+
 		/*
 		 * Set has_changed to false to avoid generating
 		 * the event V4L2_EVENT_CTRL_CH_VALUE
-- 
2.1.4


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

* Re: [PATCH v2 1/5] media/v4l2-ctrls: volatiles should not generate CH_VALUE
  2015-03-20 13:30 [PATCH v2 1/5] media/v4l2-ctrls: volatiles should not generate CH_VALUE Ricardo Ribalda Delgado
  2015-03-20 13:30 ` [PATCH v2 4/5] media/v4l2-ctrls: Always execute EXECUTE_ON_WRITE ctrls Ricardo Ribalda Delgado
@ 2015-04-21 17:44 ` Laurent Pinchart
  2015-04-21 21:32   ` Ricardo Ribalda Delgado
  1 sibling, 1 reply; 4+ messages in thread
From: Laurent Pinchart @ 2015-04-21 17:44 UTC (permalink / raw)
  To: Ricardo Ribalda Delgado
  Cc: Hans Verkuil, Mauro Carvalho Chehab, Arun Kumar K,
	Sylwester Nawrocki, Antti Palosaari, linux-media, linux-kernel,
	Sakari Ailus

Hi Ricardo,

Thank you for the patch, and sorry for the late review (so late that the patch 
has already been merged).

On Friday 20 March 2015 14:30:46 Ricardo Ribalda Delgado wrote:
> Volatile controls should not generate CH_VALUE events.

What's the rationale for that ? I would actually expect the value change 
events to be more useful for volatile controls than non-volatile controls. 
Volatile controls can have their value changed by the hardware without 
software intervention, and it makes sense to me to report that to userspace.

> Set has_changed to false to prevent this happening.
> 
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> ---
> v2: By Sakari Ailus <sakari.ailus@linux.intel.com>
> 
> Fix CodeStyle (sorry :S)
>  drivers/media/v4l2-core/v4l2-ctrls.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c
> b/drivers/media/v4l2-core/v4l2-ctrls.c index 45c5b47..2ebc33e 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -1609,6 +1609,15 @@ static int cluster_changed(struct v4l2_ctrl *master)
> 
>  		if (ctrl == NULL)
>  			continue;
> +		/*
> +		 * Set has_changed to false to avoid generating
> +		 * the event V4L2_EVENT_CTRL_CH_VALUE
> +		 */
> +		if (ctrl->flags & V4L2_CTRL_FLAG_VOLATILE) {
> +			ctrl->has_changed = false;
> +			continue;
> +		}
> +
>  		for (idx = 0; !ctrl_changed && idx < ctrl->elems; idx++)
>  			ctrl_changed = !ctrl->type_ops->equal(ctrl, idx,
>  				ctrl->p_cur, ctrl->p_new);

-- 
Regards,

Laurent Pinchart


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

* Re: [PATCH v2 1/5] media/v4l2-ctrls: volatiles should not generate CH_VALUE
  2015-04-21 17:44 ` [PATCH v2 1/5] media/v4l2-ctrls: volatiles should not generate CH_VALUE Laurent Pinchart
@ 2015-04-21 21:32   ` Ricardo Ribalda Delgado
  0 siblings, 0 replies; 4+ messages in thread
From: Ricardo Ribalda Delgado @ 2015-04-21 21:32 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Hans Verkuil, Mauro Carvalho Chehab, Arun Kumar K,
	Sylwester Nawrocki, Antti Palosaari, linux-media, LKML,
	Sakari Ailus

Hello Laurent

On Tue, Apr 21, 2015 at 7:44 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> Hi Ricardo,
>
> Thank you for the patch, and sorry for the late review (so late that the patch
> has already been merged).

No worries.

>
> On Friday 20 March 2015 14:30:46 Ricardo Ribalda Delgado wrote:
>> Volatile controls should not generate CH_VALUE events.
>
> What's the rationale for that ? I would actually expect the value change
> events to be more useful for volatile controls than non-volatile controls.
> Volatile controls can have their value changed by the hardware without
> software intervention, and it makes sense to me to report that to userspace.

Imagine a temperature register on the sensor. It is changing
constantly, resolution 10 milidegrees:

Do you want to get an event for every change? Who will poll the
temperature? The driver? The hardware will irq the driver....?

So I guess the less wrong solution is not throwing the ch_value event.

This is just my two cents, probably Hans has a much better global view :)

Regards.

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

end of thread, other threads:[~2015-04-21 21:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-20 13:30 [PATCH v2 1/5] media/v4l2-ctrls: volatiles should not generate CH_VALUE Ricardo Ribalda Delgado
2015-03-20 13:30 ` [PATCH v2 4/5] media/v4l2-ctrls: Always execute EXECUTE_ON_WRITE ctrls Ricardo Ribalda Delgado
2015-04-21 17:44 ` [PATCH v2 1/5] media/v4l2-ctrls: volatiles should not generate CH_VALUE Laurent Pinchart
2015-04-21 21:32   ` Ricardo Ribalda Delgado

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).