Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation: v4l: Document rotation and orientation for sensor drivers

Document how rotation and orientation should be taken into account in
writing camera sensor drivers.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Sakari Ailus and committed by
Hans Verkuil
71511a24 a73206f3

+25
+22
Documentation/driver-api/media/camera-sensor.rst
··· 151 151 The function returns a non-zero value if it succeeded getting the power count or 152 152 runtime PM was disabled, in either of which cases the driver may proceed to 153 153 access the device. 154 + 155 + Rotation, orientation and flipping 156 + ---------------------------------- 157 + 158 + Some systems have the camera sensor mounted upside down compared to its natural 159 + mounting rotation. In such cases, drivers shall expose the information to 160 + userspace with the :ref:`V4L2_CID_CAMERA_SENSOR_ROTATION 161 + <v4l2-camera-sensor-rotation>` control. 162 + 163 + Sensor drivers shall also report the sensor's mounting orientation with the 164 + :ref:`V4L2_CID_CAMERA_SENSOR_ORIENTATION <v4l2-camera-sensor-orientation>`. 165 + 166 + Use ``v4l2_fwnode_device_parse()`` to obtain rotation and orientation 167 + information from system firmware and ``v4l2_ctrl_new_fwnode_properties()`` to 168 + register the appropriate controls. 169 + 170 + Sensor drivers that have any vertical or horizontal flips embedded in the 171 + register programming sequences shall initialize the V4L2_CID_HFLIP and 172 + V4L2_CID_VFLIP controls with the values programmed by the register sequences. 173 + The default values of these controls shall be 0 (disabled). Especially these 174 + controls shall not be inverted, independently of the sensor's mounting 175 + rotation.
+3
Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst
··· 506 506 value down. A value of zero stops the motion if one is in progress 507 507 and has no effect otherwise. 508 508 509 + .. _v4l2-camera-sensor-orientation: 510 + 509 511 ``V4L2_CID_CAMERA_ORIENTATION (menu)`` 510 512 This read-only control describes the camera orientation by reporting its 511 513 mounting position on the device where the camera is installed. The control ··· 538 536 - The camera is not directly attached to the device and is freely movable. 539 537 540 538 539 + .. _v4l2-camera-sensor-rotation: 541 540 542 541 ``V4L2_CID_CAMERA_SENSOR_ROTATION (integer)`` 543 542 This read-only control describes the rotation correction in degrees in the