From patchwork Tue Sep 8 08:51:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 66829 X-Patchwork-Delegate: sakari.ailus@iki.fi Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1kFZJ5-001JWq-8f; Tue, 08 Sep 2020 08:48:51 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729427AbgIHIyt (ORCPT + 1 other); Tue, 8 Sep 2020 04:54:49 -0400 Received: from retiisi.org.uk ([95.216.213.190]:60096 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729278AbgIHIyr (ORCPT ); Tue, 8 Sep 2020 04:54:47 -0400 Received: from lanttu.localdomain (lanttu-e.localdomain [192.168.1.64]) by hillosipuli.retiisi.org.uk (Postfix) with ESMTP id 9C10D634C8D; Tue, 8 Sep 2020 11:54:38 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com, niklas.soderlund@ragnatech.se, jacopo@jmondi.org Subject: [PATCH 1/3] v4l2-fwnode: Make number of data lanes a character Date: Tue, 8 Sep 2020 11:51:19 +0300 Message-Id: <20200908085121.864-2-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200908085121.864-1-sakari.ailus@linux.intel.com> References: <20200908085121.864-1-sakari.ailus@linux.intel.com> MIME-Version: 1.0 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 maximum is currently four (4). No short is needed. Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart --- include/media/v4l2-fwnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h index c47b70636e42..81e7eb123294 100644 --- a/include/media/v4l2-fwnode.h +++ b/include/media/v4l2-fwnode.h @@ -40,7 +40,7 @@ struct v4l2_fwnode_bus_mipi_csi2 { unsigned int flags; unsigned char data_lanes[V4L2_FWNODE_CSI2_MAX_DATA_LANES]; unsigned char clock_lane; - unsigned short num_data_lanes; + unsigned char num_data_lanes; bool lane_polarities[1 + V4L2_FWNODE_CSI2_MAX_DATA_LANES]; }; From patchwork Tue Sep 8 08:51:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 66830 X-Patchwork-Delegate: sakari.ailus@iki.fi Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1kFZJ7-001JWq-K9; Tue, 08 Sep 2020 08:48:54 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728917AbgIHIyy (ORCPT + 1 other); Tue, 8 Sep 2020 04:54:54 -0400 Received: from retiisi.org.uk ([95.216.213.190]:60106 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729305AbgIHIyr (ORCPT ); Tue, 8 Sep 2020 04:54:47 -0400 Received: from lanttu.localdomain (lanttu-e.localdomain [192.168.1.64]) by hillosipuli.retiisi.org.uk (Postfix) with ESMTP id B013F634C8E; Tue, 8 Sep 2020 11:54:38 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com, niklas.soderlund@ragnatech.se, jacopo@jmondi.org Subject: [PATCH 2/3] v4l2-fwnode: Make bus configuration a struct Date: Tue, 8 Sep 2020 11:51:20 +0300 Message-Id: <20200908085121.864-3-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200908085121.864-1-sakari.ailus@linux.intel.com> References: <20200908085121.864-1-sakari.ailus@linux.intel.com> MIME-Version: 1.0 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 bus specific parameters were an union. This made providing bus specific defaults impossible as the memory used to store the defaults for multiple different busses was the same. Make it struct instead. It's not large so the size isn't really an issue. Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart --- include/media/v4l2-fwnode.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h index 81e7eb123294..d04f39b60096 100644 --- a/include/media/v4l2-fwnode.h +++ b/include/media/v4l2-fwnode.h @@ -78,7 +78,7 @@ struct v4l2_fwnode_bus_mipi_csi1 { * struct v4l2_fwnode_endpoint - the endpoint data structure * @base: fwnode endpoint of the v4l2_fwnode * @bus_type: bus type - * @bus: union with bus configuration data structure + * @bus: bus configuration data structure * @bus.parallel: embedded &struct v4l2_fwnode_bus_parallel. * Used if the bus is parallel. * @bus.mipi_csi1: embedded &struct v4l2_fwnode_bus_mipi_csi1. @@ -99,7 +99,7 @@ struct v4l2_fwnode_endpoint { * v4l2_fwnode_endpoint_parse() */ enum v4l2_mbus_type bus_type; - union { + struct { struct v4l2_fwnode_bus_parallel parallel; struct v4l2_fwnode_bus_mipi_csi1 mipi_csi1; struct v4l2_fwnode_bus_mipi_csi2 mipi_csi2; From patchwork Tue Sep 8 08:51:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 66828 X-Patchwork-Delegate: sakari.ailus@iki.fi Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1kFZJ2-001JWd-Uo; Tue, 08 Sep 2020 08:48:49 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729378AbgIHIyt (ORCPT + 1 other); Tue, 8 Sep 2020 04:54:49 -0400 Received: from retiisi.org.uk ([95.216.213.190]:60116 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729351AbgIHIys (ORCPT ); Tue, 8 Sep 2020 04:54:48 -0400 Received: from lanttu.localdomain (lanttu-e.localdomain [192.168.1.64]) by hillosipuli.retiisi.org.uk (Postfix) with ESMTP id C0CAB634C8F; Tue, 8 Sep 2020 11:54:38 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com, niklas.soderlund@ragnatech.se, jacopo@jmondi.org Subject: [PATCH 3/3] v4l2-fwnode: Document changes usage patterns of v4l2_fwnode_endpoint_parse Date: Tue, 8 Sep 2020 11:51:21 +0300 Message-Id: <20200908085121.864-4-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200908085121.864-1-sakari.ailus@linux.intel.com> References: <20200908085121.864-1-sakari.ailus@linux.intel.com> MIME-Version: 1.0 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 Document that it is possible to provide defaults for multiple bus types to v4l2_fwnode_endpoint_parse and v4l2_fwnode_endpoint_alloc_parse. Also underline the fact that detecting the bus type without bus-type property is only for the old drivers. Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart --- include/media/v4l2-fwnode.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h index d04f39b60096..ccaa5693df14 100644 --- a/include/media/v4l2-fwnode.h +++ b/include/media/v4l2-fwnode.h @@ -226,11 +226,10 @@ struct v4l2_fwnode_connector { * call this function once the correct type is found --- with a default * configuration valid for that type. * - * As a compatibility means guessing the bus type is also supported by setting - * @vep.bus_type to V4L2_MBUS_UNKNOWN. The caller may not provide a default - * configuration in this case as the defaults are specific to a given bus type. - * This functionality is deprecated and should not be used in new drivers and it - * is only supported for CSI-2 D-PHY, parallel and Bt.656 buses. + * It is also allowed to set @vep.bus_type to V4L2_MBUS_UNKNOWN. USING THIS + * FEATURE REQUIRES "bus-type" PROPERTY IN DT BINDINGS. For old drivers, + * guessing @vep.bus_type between CSI-2 D-PHY, parallel and Bt.656 busses is + * supported. NEVER RELY ON GUESSING @vep.bus_type IN NEW DRIVERS! * * The function does not change the V4L2 fwnode endpoint state if it fails. * @@ -269,11 +268,10 @@ void v4l2_fwnode_endpoint_free(struct v4l2_fwnode_endpoint *vep); * call this function once the correct type is found --- with a default * configuration valid for that type. * - * As a compatibility means guessing the bus type is also supported by setting - * @vep.bus_type to V4L2_MBUS_UNKNOWN. The caller may not provide a default - * configuration in this case as the defaults are specific to a given bus type. - * This functionality is deprecated and should not be used in new drivers and it - * is only supported for CSI-2 D-PHY, parallel and Bt.656 buses. + * It is also allowed to set @vep.bus_type to V4L2_MBUS_UNKNOWN. USING THIS + * FEATURE REQUIRES "bus-type" PROPERTY IN DT BINDINGS. For old drivers, + * guessing @vep.bus_type between CSI-2 D-PHY, parallel and Bt.656 busses is + * supported. NEVER RELY ON GUESSING @vep.bus_type IN NEW DRIVERS! * * The function does not change the V4L2 fwnode endpoint state if it fails. *