Hi Sakari On Wed, Apr 05, 2023 at 01:16:46PM +0300, Sakari Ailus wrote: > Document how rotation and orientation should be taken into account in > writing camera sensor drivers. > > Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> > --- > since v1: > > - Simplify language (Laurent's suggestion) and add note on flipping > controls (Jacopo). > > - Improve the last paragraph, say this is about rotation and orientation. > > Documentation/driver-api/media/camera-sensor.rst | 16 ++++++++++++++++ > .../userspace-api/media/v4l/ext-ctrls-camera.rst | 1 + > 2 files changed, 17 insertions(+) > > diff --git a/Documentation/driver-api/media/camera-sensor.rst b/Documentation/driver-api/media/camera-sensor.rst > index c7d4891bd24e..61caa7901c51 100644 > --- a/Documentation/driver-api/media/camera-sensor.rst > +++ b/Documentation/driver-api/media/camera-sensor.rst > @@ -151,3 +151,19 @@ used to obtain device's power state after the power state transition: > The function returns a non-zero value if it succeeded getting the power count or > runtime PM was disabled, in either of which cases the driver may proceed to > access the device. > + > +Rotation and orientation > +------------------------ > + > +Some systems have the camera sensor mounted upside down compared to its natural > +mounting rotation. In such cases, drivers shall expose the information to > +userspace with the :ref:`V4L2_CID_CAMERA_SENSOR_ROTATION > +<v4l2-camera-sensor-rotation>` control. > + > +Sensor drivers that have any vertical or horizontal flips embedded in the > +register programming sequences shall initialize the V4L2_CID_HFLIP and > +V4L2_CID_VFLIP controls with the values programmed by the register sequences. > + Just a note about the paragraph about ORIENTATION I suggested on the previous version. If it was left out intentionally: Reviewed-by: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx> Thanks j > +Use ``v4l2_fwnode_device_parse()`` to obtain rotation and orientation > +information from system firmware and ``v4l2_ctrl_new_fwnode_properties()`` to > +register the appropriate controls. > diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst > index daa4f40869f8..29fe22da52a2 100644 > --- a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst > +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst > @@ -536,6 +536,7 @@ enum v4l2_scene_mode - > - The camera is not directly attached to the device and is freely movable. > > > +.. _v4l2-camera-sensor-rotation: > > ``V4L2_CID_CAMERA_SENSOR_ROTATION (integer)`` > This read-only control describes the rotation correction in degrees in the > -- > 2.30.2 >