Skip to contentSkip to conversation

S_CTRL must be called twice to set volatile controls

DISCUSSION Jacek Anaszewski 3 participants 5 messages Apr 29, 2015 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hi,

After testing my v4l2-flash helpers patch [1] with the recent patches for v4l2-ctrl.c ([2] and [3]) s_ctrl op isn't called despite setting the value that should be aligned to the other step than default one.

This happens for V4L2_CID_FLASH_TORCH_INTENSITY control with V4L2_CTRL_FLAG_VOLATILE flag.

The situation improves after setting V4L2_CTRL_FLAG_EXECUTE_ON_WRITE flag for the control. Is this flag required now for volatile controls to be writable?

[1] http://www.spinics.net/lists/linux-media/msg89004.html
[2] 45f014c5 [media] media/v4l2-ctrls: Always execute EXECUTE_ON_WRITE ctrls
[3] b08d8d26 [media] media/v4l2-ctrls: volatiles should not generate CH_VALUE

Signature · 2 lines
Best Regards,
Jacek Anaszewski
#1 lore raw

Hi Jacek,

Quoted 6 lines · Jacek Anaszewski

Hi,

After testing my v4l2-flash helpers patch [1] with the recent patches for v4l2-ctrl.c ([2] and [3]) s_ctrl op isn't called despite setting the value that should be aligned to the other step than default one.

Quoted 6 lines

This happens for V4L2_CID_FLASH_TORCH_INTENSITY control with V4L2_CTRL_FLAG_VOLATILE flag.

The situation improves after setting V4L2_CTRL_FLAG_EXECUTE_ON_WRITE flag for the control. Is this flag required now for volatile controls to be writable?

Yes, you need that if you want to be able to write to a volatile control.

It was added for exactly that purpose.

Why is V4L2_CID_FLASH_TORCH_INTENSITY volatile? Volatile typically only makes sense if the hardware itself is modifying the value without the software knowing about it.

Regards,

Hans

Quoted 4 lines

[1] http://www.spinics.net/lists/linux-media/msg89004.html
[2] 45f014c5 [media] media/v4l2-ctrls: Always execute EXECUTE_ON_WRITE ctrls
[3] b08d8d26 [media] media/v4l2-ctrls: volatiles should not generate CH_VALUE

#2 lore raw

Hi Hans,

Quoted 12 lines · Hans Verkuil

Hi Jacek,

Quoted 9 lines · Jacek Anaszewski

Hi,

After testing my v4l2-flash helpers patch [1] with the recent patches for v4l2-ctrl.c ([2] and [3]) s_ctrl op isn't called despite setting the value that should be aligned to the other step than default one.

This happens for V4L2_CID_FLASH_TORCH_INTENSITY control with V4L2_CTRL_FLAG_VOLATILE flag.

Quoted 7 lines
Quoted 3 lines

The situation improves after setting V4L2_CTRL_FLAG_EXECUTE_ON_WRITE flag for the control. Is this flag required now for volatile controls to be writable?

Yes, you need that if you want to be able to write to a volatile control.

It was added for exactly that purpose.

Thanks for the explanation.

Quoted 3 lines

Why is V4L2_CID_FLASH_TORCH_INTENSITY volatile? Volatile typically only makes sense if the hardware itself is modifying the value without the software knowing about it.

This can be the case for the flash LED devices that can reduce torch current when battery voltage level falls below predefined threshold.

Signature · 2 lines
Best Regards,
Jacek Anaszewski
#3 lore raw

Hi Jacek,

Quoted 23 lines · Jacek Anaszewski

Hi Hans,

Quoted 12 lines · Hans Verkuil

Hi Jacek,

Quoted 9 lines · Jacek Anaszewski

Hi,

After testing my v4l2-flash helpers patch [1] with the recent patches for v4l2-ctrl.c ([2] and [3]) s_ctrl op isn't called despite setting the value that should be aligned to the other step than default one.

This happens for V4L2_CID_FLASH_TORCH_INTENSITY control with V4L2_CTRL_FLAG_VOLATILE flag.

Quoted 7 lines
Quoted 3 lines

The situation improves after setting V4L2_CTRL_FLAG_EXECUTE_ON_WRITE flag for the control. Is this flag required now for volatile controls to be writable?

Yes, you need that if you want to be able to write to a volatile control.

It was added for exactly that purpose.

Quoted 8 lines

Thanks for the explanation.

Quoted 3 lines

Why is V4L2_CID_FLASH_TORCH_INTENSITY volatile? Volatile typically only makes sense if the hardware itself is modifying the value without the software knowing about it.

This can be the case for the flash LED devices that can reduce torch current when battery voltage level falls below predefined threshold.

Can the LED flash actually tell about this, other than reading this through the faults? I don't know of a LED flash that could do this, so I wonder if we could make these controls non-volatile, as the reason I originally though why they were volatile (the V4L2 control framework being more or less just a front-end) was not a valid one.

I guess this could be done later on on top of the patch you currently have.

Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#4 lore raw

Hi Sakari,

Quoted 32 lines · Sakari Ailus

Hi Jacek,

Quoted 29 lines · Jacek Anaszewski

Hi Hans,

Quoted 12 lines · Hans Verkuil

Hi Jacek,

Quoted 9 lines · Jacek Anaszewski

Hi,

After testing my v4l2-flash helpers patch [1] with the recent patches for v4l2-ctrl.c ([2] and [3]) s_ctrl op isn't called despite setting the value that should be aligned to the other step than default one.

This happens for V4L2_CID_FLASH_TORCH_INTENSITY control with V4L2_CTRL_FLAG_VOLATILE flag.

Quoted 7 lines
Quoted 3 lines

The situation improves after setting V4L2_CTRL_FLAG_EXECUTE_ON_WRITE flag for the control. Is this flag required now for volatile controls to be writable?

Yes, you need that if you want to be able to write to a volatile control.

It was added for exactly that purpose.

Thanks for the explanation.

Quoted 3 lines

Why is V4L2_CID_FLASH_TORCH_INTENSITY volatile? Volatile typically only makes sense if the hardware itself is modifying the value without the software knowing about it.

Quoted 5 lines
Quoted 2 lines

This can be the case for the flash LED devices that can reduce torch current when battery voltage level falls below predefined threshold.

Can the LED flash actually tell about this, other than reading this through the faults?

MAX77693-flash device supports this.

Quoted 4 lines

I don't know of a LED flash that could do this, so I wonder if we could make these controls non-volatile, as the reason I originally though why they were volatile (the V4L2 control framework being more or less just a front-end) was not a valid one.

The other reason for keeping the controls volatile is the fact that LED subsystem has brightness_get op, which can be implemented by drivers to report the current level actually set.

Quoted 2 lines

I guess this could be done later on on top of the patch you currently have.

Signature · 2 lines
Best Regards,
Jacek Anaszewski