{"id":3599,"url":"https://patchwork.libcamera.org/api/1.1/covers/3599/?format=json","web_url":"https://patchwork.libcamera.org/cover/3599/","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":"<20200428210609.6793-1-jacopo@jmondi.org>","date":"2020-04-28T21:06:03","name":"[libcamera-devel,v5,0/6] media: Register read-only sub-dev devnode","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"mbox":"https://patchwork.libcamera.org/cover/3599/mbox/","series":[{"id":846,"url":"https://patchwork.libcamera.org/api/1.1/series/846/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=846","date":"2020-04-28T21:06:03","name":"media: Register read-only sub-dev devnode","version":5,"mbox":"https://patchwork.libcamera.org/series/846/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/3599/comments/","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A03B860AF4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 23:03:04 +0200 (CEST)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id B972F200002;\n\tTue, 28 Apr 2020 21:03:01 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"linux-media@vger.kernel.org,\n\tlibcamera-devel@lists.libcamera.org","Cc":"Jacopo Mondi <jacopo@jmondi.org>, mchehab@kernel.org,\n\thverkuil-cisco@xs4all.nl, sakari.ailus@linux.intel.com,\n\tandrey.konovalov@linaro.org, laurent.pinchart@ideasonboard.com","Date":"Tue, 28 Apr 2020 23:06:03 +0200","Message-Id":"<20200428210609.6793-1-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.26.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 0/6] media: Register read-only sub-dev\n\tdevnode","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":"Tue, 28 Apr 2020 21:03:04 -0000"},"content":"v5 addresses a few comments from Sakari and Laurent on documentation and\nintroduces \"media: v4l2-subdev: Assume V4L2_SUBDEV_API is selected\"\nwhich removes checks for CONFIG_V4L2_SUBDEV_API from v4l2-subdev.c as\nthe subdevice device node is only registered if that option was selected in\nfirst place.\n\nCopy of v4 and v3 cover letter is below reported\n\n-------------------------------------------------------------------------------\nv4 is now rebased on top of latest media master which has moved documentation\naround quite a bit.\n\nv4 includes two patches originally from Hans to add support for SUBDEV_QUERYCAP\nioctl. Compared to its initial version only capabilities flags and version are\nreported.\nhttps://git.linuxtv.org/hverkuil/media_tree.git/log/?h=subdev-querycap\n\nI chose to report both the RO and RW capabilities flag to make it possible for\nuserspace to test on both cases, as RW was the 'standard' so far, the flag could\nbe removed if considered not necessary.\n\nCheckpatch reports:\nWARNING: LINUX_VERSION_CODE should be avoided, code should be for the version to which it is merged\n#44: FILE: drivers/media/v4l2-core/v4l2-subdev.c:344:\n+\t\tcap->version = LINUX_VERSION_CODE;\n\nbut I see LINUX_VERSION_CODE being used to version the media controller as well,\nso I assume it's a false positive.\n\n-------------------------------------------------------------------------------\nAdd new function v4l2_device_register_ro_subdev_nodes() to pair with\nv4l2_device_register_subdev_nodes() that allows a bridge driver to register the\ndevice node for its subdevices in read-only mode.\n\nDevnode-centric (aka non-MC) bridge drivers control their subdevices through\ndirect calls to v4l2 subdev operations and do not want userspace to be able\nto control the subdevice configuration by calling ioctls on the sub-device\ndevnode. For this reason, they usually refrain from registering any devnode at\nall for their subdevices.\n\nHowever it is sometimes required for userspace to access the sub-dev device\nnodes to collect information on the actual configuration, without changing\nthe one currently applied to the device.\n\nThis requirement became pressing while working on libcamera on devnode-centric\nplatforms that do not expose any sub-device for their camera sensor to prevent\nuserspace from changing their configuration. To allow them to register device\nnode and being guaranteed to retain control of the subdevice configuration this\nseries proposes a way to register device nodes in read-only to restrict\naccess to all ioctls that could potentially affect the sub-dev configuration.\n-------------------------------------------------------------------------------\n\nThanks\n   j\n\nv4->v5:\n- Add \"media: v4l2-subdev: Assume V4L2_SUBDEV_API is selected\"\n- Use BIT() instead of manual bitshifting\n- Use tabs in documentation in place of 8 spaces\n- minor documentation fixes\n\nv3->v4:\n- Rebase v3 on latest media master and new documentation layout\n- Add SUBDEV_QUERYCAP support\n\nv2->v3:\n- Add Sakari's ack to the series\n- Documentation:\n  - Address Sakari' and Hans suggestions\n- Implementation:\n  - Rename V4L2_FL_RO_DEVNODE to V4L2_FL_SUBDEV_RO_DEVNODE\n  - Limit the ability to register sub-device video device nodes to\n    driver claiming support for CONFIG_VIDEO_V4L2_SUBDEV_API\n\nv1->v2:\n- Documentation:\n  - Add a new patch using Laurent's suggestion to update the sub-device\n    userspace API introduction\n  - Take in some of Laurent's suggestions in v4l2-subdev.rst and add a new\n    section in dev-subdev.rst\n- Implementation:\n  - As noted by Andrey, V4L2_FL_* are meant to be used as bitmasks. Use\n    test_bit()/set_bit() as the rest of the v4l2 core does. It's a bit an\n    overkill compared to use plain BIT() as noted by Sakari but I preferred\n    consistency with the rest of the core\n  - Make v4l2_device_register_subdev_nodes() and\n    v4l2_device_register_ro_subdev_nodes() to v4l2-device.h and make them\n    inline functions. Documentation style has been copied from other functions\n    with similar implementations, such as __video_register_device() in\n    v4l2-dev.h\n\nHans Verkuil (2):\n  v4l2-subdev: add VIDIOC_SUBDEV_QUERYCAP ioctl\n  v4l: document VIDIOC_SUBDEV_QUERYCAP\n\nJacopo Mondi (4):\n  Documentation: media: Update sub-device API intro\n  Documentation: media: Document read-only subdevice\n  media: v4l2-dev: Add v4l2_device_register_ro_subdev_node()\n  media: v4l2-subdev: Assume V4L2_SUBDEV_API is selected\n\n .../driver-api/media/v4l2-subdev.rst          |  53 +++++++-\n .../userspace-api/media/v4l/dev-subdev.rst    |   5 +\n .../userspace-api/media/v4l/user-func.rst     |   1 +\n .../media/v4l/vidioc-g-dv-timings.rst         |   6 +\n .../userspace-api/media/v4l/vidioc-g-std.rst  |   6 +\n .../media/v4l/vidioc-subdev-g-crop.rst        |   9 ++\n .../media/v4l/vidioc-subdev-g-fmt.rst         |   8 ++\n .../v4l/vidioc-subdev-g-frame-interval.rst    |   8 ++\n .../media/v4l/vidioc-subdev-g-selection.rst   |   8 ++\n .../media/v4l/vidioc-subdev-querycap.rst      | 114 ++++++++++++++++++\n drivers/media/v4l2-core/v4l2-device.c         |   7 +-\n drivers/media/v4l2-core/v4l2-subdev.c         |  41 +++++--\n include/media/v4l2-dev.h                      |   7 ++\n include/media/v4l2-device.h                   |  50 +++++++-\n include/uapi/linux/v4l2-subdev.h              |  15 +++\n 15 files changed, 322 insertions(+), 16 deletions(-)\n create mode 100644 Documentation/userspace-api/media/v4l/vidioc-subdev-querycap.rst\n\n--\n2.26.1"}