Skip to contentSkip to conversation

v4l: Document the practice of symmetrically calling s_power(dev, 0/1)

PATCH In review Sakari Ailus 2 participants 2 messages Mar 9, 2017 – Apr 17, 2017 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 v4l: Document the practice of symmetrically calling s_power(dev, 0/1)

The caller must always call the s_power() op symmetrically powering the device on and off. This is the practice albeit it was not documented. A lot of sub-device drivers rely on it, so document it accordingly.

---
 include/media/v4l2-subdev.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
include/media/v4l2-subdev.h +4 -2
index 0ab1c5d..b4e521d 100644
@@ -172,8 +172,10 @@ struct v4l2_subdev_io_pin_config {
  *
  * @s_register: callback for %VIDIOC_G_REGISTER ioctl handler code.
  *
- * @s_power: puts subdevice in power saving mode (on == 0) or normal operation
- *	mode (on == 1).
+ * @s_power: Puts subdevice in power saving mode (on == 0) or normal operation
+ *	mode (on == 1). The caller is responsible for calling the op
+ *	symmetrically, i.e. calling s_power(dev, 1) once requires later calling
+ *	s_power(dev, 0) once.
  *
  * @interrupt_service_routine: Called by the bridge chip's interrupt service
  *	handler, when an interrupt status has be raised due to this subdev,
Signature · 1 line
2.7.4
#1 lore raw

Em Thu, 9 Mar 2017 13:54:45 +0200
Sakari Ailus <[email protected]> escreveu:

Quoted 3 lines

The caller must always call the s_power() op symmetrically powering the device on and off. This is the practice albeit it was not documented. A lot of sub-device drivers rely on it, so document it accordingly.

Actually, there are several non-embedded drivers that don't call s_power() symmetrically, as they use it just put a sub-device in standby mode. I remember some widely used tuners that has this behavior. Such subdevs automatically awaken when a command is issued to them (for example, requesting the tuner to tune into a channel).

If you're willing to change the kABI, you need first to patch such drivers.

Regards,
Mauro

Quoted 13 lines
---
 include/media/v4l2-subdev.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
include/media/v4l2-subdev.h +0 -0
index 0ab1c5d..b4e521d 100644
@@ -172,8 +172,10 @@ struct v4l2_subdev_io_pin_config {
  *
  * @s_register: callback for %VIDIOC_G_REGISTER ioctl handler code.

include/media/v4l2-subdev.h struct v4l2_subdev_io_pin_config { · line 181

Quoted 10 lines
include/media/v4l2-subdev.h +4 -2
  *
- * @s_power: puts subdevice in power saving mode (on == 0) or normal operation
- *	mode (on == 1).
+ * @s_power: Puts subdevice in power saving mode (on == 0) or normal operation
+ *	mode (on == 1). The caller is responsible for calling the op
+ *	symmetrically, i.e. calling s_power(dev, 1) once requires later calling
+ *	s_power(dev, 0) once.
  *
  * @interrupt_service_routine: Called by the bridge chip's interrupt service
  *	handler, when an interrupt status has be raised due to this subdev,

Thanks,
Mauro