From patchwork Wed May 20 10:03:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 3825 Return-Path: Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CC795603F3 for ; Wed, 20 May 2020 12:00:04 +0200 (CEST) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 3D159C0010; Wed, 20 May 2020 10:00:03 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 20 May 2020 12:03:19 +0200 Message-Id: <20200520100320.436430-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/2] include: linux: Update v4l2 ctrls for properties X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 May 2020 10:00:05 -0000 The version of the v4l2-controls.h header file shipped by libcamera had slightly deviated from the upstream one, as it included definitions for v4l2 controls that report camera properties, which were not acceppted upstream at the time the header file was updated. Now that the controls definition has been accepted in the master branch of the linux-media kernel tree, update include/linux/v4l2-controls.h with the upstream-accepted definition of the control ids that describe camera properties. The control definition has been imported from the Linux kernel header files generated from the most recent linux-media master branch, at revision ad3a44cbd1b2e ("media: i2c: imx219: Parse and register properties") Instead of updating the whole header, just update the definition of V4L2 controls that describe camera properties. A full header update will be performed at the next available linux-media release candidate. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- include/linux/v4l2-controls.h | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h index 171351aee6fc..24eea2b69a86 100644 --- a/include/linux/v4l2-controls.h +++ b/include/linux/v4l2-controls.h @@ -914,22 +914,10 @@ enum v4l2_auto_focus_range { #define V4L2_CID_PAN_SPEED (V4L2_CID_CAMERA_CLASS_BASE+32) #define V4L2_CID_TILT_SPEED (V4L2_CID_CAMERA_CLASS_BASE+33) -/* - * This version of the v4l2-controls.h header part of the libcamera sources has - * deviated from the version distributed by the mainline Linux kernel. - * - * Specifically, this version includes temporary definitions of a few custom - * controls (V4L2_CID_CAMERA_SENSOR_ROTATION and - * V4L2_CID_CAMERA_SENSOR_LOCATION) which have not yet made their way to - * upstream Linux. - * - * When updating this header with a more recent version, make sure the new - * version has those additional controls defined. - */ -#define V4L2_CID_CAMERA_SENSOR_LOCATION (V4L2_CID_CAMERA_CLASS_BASE+34) -#define V4L2_LOCATION_FRONT 0 -#define V4L2_LOCATION_BACK 1 -#define V4L2_LOCATION_EXTERNAL 2 +#define V4L2_CID_CAMERA_ORIENTATION (V4L2_CID_CAMERA_CLASS_BASE+34) +#define V4L2_CAMERA_ORIENTATION_FRONT 0 +#define V4L2_CAMERA_ORIENTATION_BACK 1 +#define V4L2_CAMERA_ORIENTATION_EXTERNAL 2 #define V4L2_CID_CAMERA_SENSOR_ROTATION (V4L2_CID_CAMERA_CLASS_BASE+35) From patchwork Wed May 20 10:03:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 3826 Return-Path: Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 882C860DF9 for ; Wed, 20 May 2020 12:00:05 +0200 (CEST) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id E516FC001C; Wed, 20 May 2020 10:00:04 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 20 May 2020 12:03:20 +0200 Message-Id: <20200520100320.436430-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200520100320.436430-1-jacopo@jmondi.org> References: <20200520100320.436430-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/2] libcamera: properties: Re-name location to orientation X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 May 2020 10:00:06 -0000 Adapt the libcamera property name to match the V4L2 control name in the properties definition and in the property collection routine. Signed-off-by: Jacopo Mondi --- src/libcamera/camera_sensor.cpp | 32 ++++++++++++++++---------------- src/libcamera/property_ids.yaml | 10 +++++----- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 174df17cfaef..db65e154f985 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -209,32 +209,32 @@ int CameraSensor::init() const ControlInfoMap &controls = subdev_->controls(); int32_t propertyValue; - /* Camera Location: default is front location. */ - const auto &locationControl = controls.find(V4L2_CID_CAMERA_SENSOR_LOCATION); - if (locationControl != controls.end()) { - int32_t v4l2Location = - locationControl->second.def().get(); + /* Camera Orientation: default is front orientation. */ + const auto &orientationControl = controls.find(V4L2_CID_CAMERA_ORIENTATION); + if (orientationControl != controls.end()) { + int32_t v4l2Orientation = + orientationControl->second.def().get(); - switch (v4l2Location) { + switch (v4l2Orientation) { default: LOG(CameraSensor, Warning) - << "Unsupported camera location " - << v4l2Location << ", setting to Front"; + << "Unsupported camera orientation " + << v4l2Orientation << ", setting to Front"; /* Fall-through */ - case V4L2_LOCATION_FRONT: - propertyValue = properties::CameraLocationFront; + case V4L2_CAMERA_ORIENTATION_FRONT: + propertyValue = properties::CameraOrientationFront; break; - case V4L2_LOCATION_BACK: - propertyValue = properties::CameraLocationBack; + case V4L2_CAMERA_ORIENTATION_BACK: + propertyValue = properties::CameraOrientationBack; break; - case V4L2_LOCATION_EXTERNAL: - propertyValue = properties::CameraLocationExternal; + case V4L2_CAMERA_ORIENTATION_EXTERNAL: + propertyValue = properties::CameraOrientationExternal; break; } } else { - propertyValue = properties::CameraLocationFront; + propertyValue = properties::CameraOrientationFront; } - properties_.set(properties::Location, propertyValue); + properties_.set(properties::Orientation, propertyValue); /* Camera Rotation: default is 0 degrees. */ const auto &rotationControl = controls.find(V4L2_CID_CAMERA_SENSOR_ROTATION); diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml index ce627fa042ba..9cce8b2c9552 100644 --- a/src/libcamera/property_ids.yaml +++ b/src/libcamera/property_ids.yaml @@ -5,22 +5,22 @@ %YAML 1.2 --- controls: - - Location: + - Orientation: type: int32_t description: | - Camera mounting location + The camera orientation, defined by the camera mounting position. enum: - - name: CameraLocationFront + - name: CameraOrientationFront value: 0 description: | The camera is mounted on the front side of the device, facing the user - - name: CameraLocationBack + - name: CameraOrientationBack value: 1 description: | The camera is mounted on the back side of the device, facing away from the user - - name: CameraLocationExternal + - name: CameraOrientationExternal value: 2 description: | The camera is attached to the device in a way that allows it to