From patchwork Fri Sep 4 21:51:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 66816 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1kEJXG-00EgyO-Pf; Fri, 04 Sep 2020 21:46:19 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728164AbgIDVv7 (ORCPT + 1 other); Fri, 4 Sep 2020 17:51:59 -0400 Received: from hostingweb31-40.netsons.net ([89.40.174.40]:51484 "EHLO hostingweb31-40.netsons.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727057AbgIDVv5 (ORCPT ); Fri, 4 Sep 2020 17:51:57 -0400 Received: from [78.134.95.246] (port=33500 helo=melee.fritz.box) by hostingweb31.netsons.net with esmtpa (Exim 4.93) (envelope-from ) id 1kEJcg-0004Q2-GZ; Fri, 04 Sep 2020 23:51:54 +0200 From: Luca Ceresoli To: linux-media@vger.kernel.org Cc: Luca Ceresoli , linux-kernel@vger.kernel.org, Mauro Carvalho Chehab Subject: [PATCH 1/3] media: docs: v4l2-subdev: fix typo Date: Fri, 4 Sep 2020 23:51:39 +0200 Message-Id: <20200904215141.20862-1-luca@lucaceresoli.net> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hostingweb31.netsons.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lucaceresoli.net X-Get-Message-Sender-Via: hostingweb31.netsons.net: authenticated_id: luca+lucaceresoli.net/only user confirmed/virtual account not confirmed X-Authenticated-Sender: hostingweb31.netsons.net: luca@lucaceresoli.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.4 (--) X-LSpam-Report: No, score=-2.4 required=5.0 tests=BAYES_00=-1.9,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no Fix "will to" -> "will do". Signed-off-by: Luca Ceresoli Reviewed-by: Jacopo Mondi --- Documentation/driver-api/media/v4l2-subdev.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/driver-api/media/v4l2-subdev.rst b/Documentation/driver-api/media/v4l2-subdev.rst index bc7e1fc40a9d..9a7dddd97f5a 100644 --- a/Documentation/driver-api/media/v4l2-subdev.rst +++ b/Documentation/driver-api/media/v4l2-subdev.rst @@ -191,7 +191,7 @@ but it is better and easier to use this macro: err = v4l2_subdev_call(sd, core, g_std, &norm); -The macro will to the right ``NULL`` pointer checks and returns ``-ENODEV`` +The macro will do the right ``NULL`` pointer checks and returns ``-ENODEV`` if :c:type:`sd ` is ``NULL``, ``-ENOIOCTLCMD`` if either :c:type:`sd `->core or :c:type:`sd `->core->g_std is ``NULL``, or the actual result of the :c:type:`sd `->ops->core->g_std ops. From patchwork Fri Sep 4 21:51:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 66814 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1kEJXD-00EgyO-Nb; Fri, 04 Sep 2020 21:46:16 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728197AbgIDVv7 (ORCPT + 1 other); Fri, 4 Sep 2020 17:51:59 -0400 Received: from hostingweb31-40.netsons.net ([89.40.174.40]:36022 "EHLO hostingweb31-40.netsons.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727020AbgIDVv5 (ORCPT ); Fri, 4 Sep 2020 17:51:57 -0400 Received: from [78.134.95.246] (port=33500 helo=melee.fritz.box) by hostingweb31.netsons.net with esmtpa (Exim 4.93) (envelope-from ) id 1kEJcg-0004Q2-Qs; Fri, 04 Sep 2020 23:51:54 +0200 From: Luca Ceresoli To: linux-media@vger.kernel.org Cc: Luca Ceresoli , linux-kernel@vger.kernel.org, Mauro Carvalho Chehab Subject: [PATCH 2/3] media: docs: v4l2-subdev: move "Subdev registration" to a subsection Date: Fri, 4 Sep 2020 23:51:40 +0200 Message-Id: <20200904215141.20862-2-luca@lucaceresoli.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200904215141.20862-1-luca@lucaceresoli.net> References: <20200904215141.20862-1-luca@lucaceresoli.net> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hostingweb31.netsons.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lucaceresoli.net X-Get-Message-Sender-Via: hostingweb31.netsons.net: authenticated_id: luca+lucaceresoli.net/only user confirmed/virtual account not confirmed X-Authenticated-Sender: hostingweb31.netsons.net: luca@lucaceresoli.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.4 (--) X-LSpam-Report: No, score=-2.4 required=5.0 tests=BAYES_00=-1.9,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no The subdev registration topic is pretty lengthy, and takes more than half of the "V4L2 sub-devices" section. Help readers in finding their way through the document by dedicating a subsection to "Subdev registration". Each of the two registration methods takes many paragraphs, but since adding a subsubsection would be overkill, just emphasize them in bold. Signed-off-by: Luca Ceresoli Reviewed-by: Jacopo Mondi --- Documentation/driver-api/media/v4l2-subdev.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Documentation/driver-api/media/v4l2-subdev.rst b/Documentation/driver-api/media/v4l2-subdev.rst index 9a7dddd97f5a..fb66163deb38 100644 --- a/Documentation/driver-api/media/v4l2-subdev.rst +++ b/Documentation/driver-api/media/v4l2-subdev.rst @@ -138,6 +138,9 @@ ensures that width, height and the media bus pixel code are equal on both source and sink of the link. Subdev drivers are also free to use this function to perform the checks mentioned above in addition to their own checks. +Subdev registration +~~~~~~~~~~~~~~~~~~~ + There are currently two ways to register subdevices with the V4L2 core. The first (traditional) possibility is to have subdevices registered by bridge drivers. This can be done when the bridge driver has the complete information @@ -157,7 +160,7 @@ below. Using one or the other registration method only affects the probing process, the run-time bridge-subdevice interaction is in both cases the same. -In the synchronous case a device (bridge) driver needs to register the +In the **synchronous** case a device (bridge) driver needs to register the :c:type:`v4l2_subdev` with the v4l2_device: :c:func:`v4l2_device_register_subdev ` @@ -238,9 +241,9 @@ contain several subdevs that use an I2C bus, but also a subdev that is controlled through GPIO pins. This distinction is only relevant when setting up the device, but once the subdev is registered it is completely transparent. -In the asynchronous case subdevice probing can be invoked independently of the -bridge driver availability. The subdevice driver then has to verify whether all -the requirements for a successful probing are satisfied. This can include a +In the **asynchronous** case subdevice probing can be invoked independently of +the bridge driver availability. The subdevice driver then has to verify whether +all the requirements for a successful probing are satisfied. This can include a check for a master clock availability. If any of the conditions aren't satisfied the driver might decide to return ``-EPROBE_DEFER`` to request further reprobing attempts. Once all conditions are met the subdevice shall be registered using From patchwork Fri Sep 4 21:51:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 66815 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1kEJXF-00EgyO-Hc; Fri, 04 Sep 2020 21:46:18 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728181AbgIDVv7 (ORCPT + 1 other); Fri, 4 Sep 2020 17:51:59 -0400 Received: from hostingweb31-40.netsons.net ([89.40.174.40]:50934 "EHLO hostingweb31-40.netsons.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728161AbgIDVv5 (ORCPT ); Fri, 4 Sep 2020 17:51:57 -0400 Received: from [78.134.95.246] (port=33500 helo=melee.fritz.box) by hostingweb31.netsons.net with esmtpa (Exim 4.93) (envelope-from ) id 1kEJch-0004Q2-3K; Fri, 04 Sep 2020 23:51:55 +0200 From: Luca Ceresoli To: linux-media@vger.kernel.org Cc: Luca Ceresoli , linux-kernel@vger.kernel.org, Mauro Carvalho Chehab Subject: [PATCH 3/3] media: docs: v4l2-subdev: move generic paragraph to the introduction Date: Fri, 4 Sep 2020 23:51:41 +0200 Message-Id: <20200904215141.20862-3-luca@lucaceresoli.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200904215141.20862-1-luca@lucaceresoli.net> References: <20200904215141.20862-1-luca@lucaceresoli.net> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hostingweb31.netsons.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lucaceresoli.net X-Get-Message-Sender-Via: hostingweb31.netsons.net: authenticated_id: luca+lucaceresoli.net/only user confirmed/virtual account not confirmed X-Authenticated-Sender: hostingweb31.netsons.net: luca@lucaceresoli.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.4 (--) X-LSpam-Report: No, score=-2.4 required=5.0 tests=BAYES_00=-1.9,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no This paragraph provides generic information to explain what v4l2_subdev is useful for. Placing it in the middle of paragraphs describing the details of subdev registration does not make much sense. Move it near the beginning of the section when the v4l2_subdev idea has just been introduced and before going into its details. Signed-off-by: Luca Ceresoli --- Documentation/driver-api/media/v4l2-subdev.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation/driver-api/media/v4l2-subdev.rst b/Documentation/driver-api/media/v4l2-subdev.rst index fb66163deb38..1c1e3f9da142 100644 --- a/Documentation/driver-api/media/v4l2-subdev.rst +++ b/Documentation/driver-api/media/v4l2-subdev.rst @@ -12,6 +12,12 @@ Usually these are I2C devices, but not necessarily. In order to provide the driver with a consistent interface to these sub-devices the :c:type:`v4l2_subdev` struct (v4l2-subdev.h) was created. +The advantage of using :c:type:`v4l2_subdev` is that it is a generic struct and +does not contain any knowledge about the underlying hardware. So a driver might +contain several subdevs that use an I2C bus, but also a subdev that is +controlled through GPIO pins. This distinction is only relevant when setting +up the device, but once the subdev is registered it is completely transparent. + Each sub-device driver must have a :c:type:`v4l2_subdev` struct. This struct can be stand-alone for simple sub-devices or it might be embedded in a larger struct if more state information needs to be stored. Usually there is a @@ -235,12 +241,6 @@ it can call ``v4l2_subdev_notify(sd, notification, arg)``. This macro checks whether there is a ``notify()`` callback defined and returns ``-ENODEV`` if not. Otherwise the result of the ``notify()`` call is returned. -The advantage of using :c:type:`v4l2_subdev` is that it is a generic struct and -does not contain any knowledge about the underlying hardware. So a driver might -contain several subdevs that use an I2C bus, but also a subdev that is -controlled through GPIO pins. This distinction is only relevant when setting -up the device, but once the subdev is registered it is completely transparent. - In the **asynchronous** case subdevice probing can be invoked independently of the bridge driver availability. The subdevice driver then has to verify whether all the requirements for a successful probing are satisfied. This can include a