{"id":3730,"url":"https://patchwork.libcamera.org/api/1.1/patches/3730/?format=json","web_url":"https://patchwork.libcamera.org/patch/3730/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200509090456.3496481-6-jacopo@jmondi.org>","date":"2020-05-09T09:04:48","name":"[libcamera-devel,v11,05/13] media: v4l2-ctrls: Add camera orientation and rotation","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"4d0dd78ebdde8e5b1184fe607b73ac61abc60317","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":{"id":15,"url":"https://patchwork.libcamera.org/api/1.1/users/15/?format=json","username":"jmondi","first_name":"Jacopo","last_name":"Mondi","email":"jacopo@jmondi.org"},"mbox":"https://patchwork.libcamera.org/patch/3730/mbox/","series":[{"id":889,"url":"https://patchwork.libcamera.org/api/1.1/series/889/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=889","date":"2020-05-09T09:04:43","name":"media: report camera properties","version":11,"mbox":"https://patchwork.libcamera.org/series/889/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3730/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3730/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 42726603E2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  9 May 2020 11:02:09 +0200 (CEST)","from uno.homenet.telecomitalia.it (a-ur1-85.tin.it\n\t[212.216.150.148]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 2C65F1C0004;\n\tSat,  9 May 2020 09:02:06 +0000 (UTC)"],"X-Originating-IP":"212.216.150.148","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE\n\t(V4L/DVB)), libcamera-devel@lists.libcamera.org,\n\tMauro Carvalho Chehab <mchehab@kernel.org>,\n\tHans Verkuil <hverkuil-cisco@xs4all.nl>,\n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo@jmondi.org>,\n\ttfiga@google.com,\n\tpavel@ucw.cz","Date":"Sat,  9 May 2020 11:04:48 +0200","Message-Id":"<20200509090456.3496481-6-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.26.1","In-Reply-To":"<20200509090456.3496481-1-jacopo@jmondi.org>","References":"<20200509090456.3496481-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v11 05/13] media: v4l2-ctrls: Add camera\n\torientation and rotation","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Sat, 09 May 2020 09:02:09 -0000"},"content":"Add support for the newly defined V4L2_CID_CAMERA_ORIENTATION\nand V4L2_CID_CAMERA_SENSOR_ROTATION read-only controls used to report\nthe camera device mounting position and orientation respectively.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n drivers/media/v4l2-core/v4l2-ctrls.c | 13 +++++++++++++\n include/uapi/linux/v4l2-controls.h   |  7 +++++++\n 2 files changed, 20 insertions(+)","diff":"diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c\nindex 1c617b42a944d..92c3e39efc28f 100644\n--- a/drivers/media/v4l2-core/v4l2-ctrls.c\n+++ b/drivers/media/v4l2-core/v4l2-ctrls.c\n@@ -583,6 +583,12 @@ const char * const *v4l2_ctrl_get_menu(u32 id)\n \t\t\"Annex B Start Code\",\n \t\tNULL,\n \t};\n+\tstatic const char * const camera_orientation[] = {\n+\t\t\"Front\",\n+\t\t\"Back\",\n+\t\t\"External\",\n+\t\tNULL,\n+\t};\n \n \tswitch (id) {\n \tcase V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:\n@@ -708,6 +714,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)\n \t\treturn hevc_decode_mode;\n \tcase V4L2_CID_MPEG_VIDEO_HEVC_START_CODE:\n \t\treturn hevc_start_code;\n+\tcase V4L2_CID_CAMERA_ORIENTATION:\n+\t\treturn camera_orientation;\n \tdefault:\n \t\treturn NULL;\n \t}\n@@ -1020,6 +1028,8 @@ const char *v4l2_ctrl_get_name(u32 id)\n \tcase V4L2_CID_PAN_SPEED:\t\treturn \"Pan, Speed\";\n \tcase V4L2_CID_TILT_SPEED:\t\treturn \"Tilt, Speed\";\n \tcase V4L2_CID_UNIT_CELL_SIZE:\t\treturn \"Unit Cell Size\";\n+\tcase V4L2_CID_CAMERA_ORIENTATION:\treturn \"Camera Orientation\";\n+\tcase V4L2_CID_CAMERA_SENSOR_ROTATION:\treturn \"Camera Sensor Rotation\";\n \n \t/* FM Radio Modulator controls */\n \t/* Keep the order of the 'case's the same as in v4l2-controls.h! */\n@@ -1293,6 +1303,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,\n \tcase V4L2_CID_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE:\n \tcase V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE:\n \tcase V4L2_CID_MPEG_VIDEO_HEVC_START_CODE:\n+\tcase V4L2_CID_CAMERA_ORIENTATION:\n \t\t*type = V4L2_CTRL_TYPE_MENU;\n \t\tbreak;\n \tcase V4L2_CID_LINK_FREQ:\n@@ -1482,6 +1493,8 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,\n \tcase V4L2_CID_RDS_RX_TRAFFIC_ANNOUNCEMENT:\n \tcase V4L2_CID_RDS_RX_TRAFFIC_PROGRAM:\n \tcase V4L2_CID_RDS_RX_MUSIC_SPEECH:\n+\tcase V4L2_CID_CAMERA_ORIENTATION:\n+\tcase V4L2_CID_CAMERA_SENSOR_ROTATION:\n \t\t*flags |= V4L2_CTRL_FLAG_READ_ONLY;\n \t\tbreak;\n \tcase V4L2_CID_RF_TUNER_PLL_LOCK:\ndiff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h\nindex 0ba1005c96519..62271418c1bea 100644\n--- a/include/uapi/linux/v4l2-controls.h\n+++ b/include/uapi/linux/v4l2-controls.h\n@@ -923,6 +923,13 @@ enum v4l2_auto_focus_range {\n #define V4L2_CID_PAN_SPEED\t\t\t(V4L2_CID_CAMERA_CLASS_BASE+32)\n #define V4L2_CID_TILT_SPEED\t\t\t(V4L2_CID_CAMERA_CLASS_BASE+33)\n \n+#define V4L2_CID_CAMERA_ORIENTATION\t\t(V4L2_CID_CAMERA_CLASS_BASE+34)\n+#define V4L2_CAMERA_ORIENTATION_FRONT\t\t0\n+#define V4L2_CAMERA_ORIENTATION_BACK\t\t1\n+#define V4L2_CAMERA_ORIENTATION_EXTERNAL\t2\n+\n+#define V4L2_CID_CAMERA_SENSOR_ROTATION\t\t(V4L2_CID_CAMERA_CLASS_BASE+35)\n+\n /* FM Modulator class control IDs */\n \n #define V4L2_CID_FM_TX_CLASS_BASE\t\t(V4L2_CTRL_CLASS_FM_TX | 0x900)\n","prefixes":["libcamera-devel","v11","05/13"]}