From patchwork Thu Oct 26 08:13:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 738860 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09F28C25B6F for ; Thu, 26 Oct 2023 08:13:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344494AbjJZIN6 (ORCPT ); Thu, 26 Oct 2023 04:13:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344496AbjJZINy (ORCPT ); Thu, 26 Oct 2023 04:13:54 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 215F6189 for ; Thu, 26 Oct 2023 01:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698308033; x=1729844033; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PEqccq7BOtbAP23kZNHwqnowmLlBiTnqM4Wvl3JwW8g=; b=dj7nwOeb8DR1hh1XWWMJp2vzMVtYL5J4n07Ak+M/W+0wzGgQVcY2MS+u 90ONrr23lSyBbBSokBQayR7yQal/nz7Z6h18r6QJixcE+5R4rzyStvVpJ mBFCFHWcA9jgA6AbDHUcNkdGg9TUaBRPG3y6Fy57VPJbGtFqA84uQs00h ozWcuEEYhcoB9wwKLbQuPmXCoyH7w93XzlQtTFKYOJoQQBZb784IA8mYY c7b6PTzyFlHA5hdQAAj75Rj5Z/m2V7FHhbdqFAqU+yyQGzpRu9mdt2aJu kiNMBR0ohgHkFSKqXNPZYz9vg+crzGrZiTG4MHAuTj+5i32xdF5G718si A==; X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="372530597" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="372530597" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 01:13:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="829539009" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="829539009" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 01:13:49 -0700 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 1FC9111FB81; Thu, 26 Oct 2023 11:13:47 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: wentong.wu@intel.com, bingbu.cao@intel.com Subject: [PATCH 1/6] media: ivsc: csi: Don't parse remote endpoints Date: Thu, 26 Oct 2023 11:13:41 +0300 Message-Id: <20231026081346.958238-2-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231026081346.958238-1-sakari.ailus@linux.intel.com> References: <20231026081346.958238-1-sakari.ailus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The driver parsed, besides its own endpoint on the sink, the remote upstream endpoint that most likely is a sensor, and took the number of lanes from that. Instead obtain the number of lanes from the local endpoint. Signed-off-by: Sakari Ailus Tested-by: Wentong Wu --- drivers/media/pci/intel/ivsc/mei_csi.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/media/pci/intel/ivsc/mei_csi.c b/drivers/media/pci/intel/ivsc/mei_csi.c index b2b9d1669a82..b04847e30213 100644 --- a/drivers/media/pci/intel/ivsc/mei_csi.c +++ b/drivers/media/pci/intel/ivsc/mei_csi.c @@ -662,6 +662,8 @@ static int mei_csi_parse_firmware(struct mei_csi *csi) return -EINVAL; } + csi->nr_of_lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes; + fwnode = fwnode_graph_get_remote_endpoint(ep); fwnode_handle_put(ep); @@ -675,18 +677,12 @@ static int mei_csi_parse_firmware(struct mei_csi *csi) return PTR_ERR(asd); } - ret = v4l2_fwnode_endpoint_alloc_parse(fwnode, &v4l2_ep); fwnode_handle_put(fwnode); - if (ret) - return ret; - csi->nr_of_lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes; ret = v4l2_async_nf_register(&csi->notifier); if (ret) v4l2_async_nf_cleanup(&csi->notifier); - v4l2_fwnode_endpoint_free(&v4l2_ep); - return ret; } From patchwork Thu Oct 26 08:13:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 738580 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57385C25B6B for ; Thu, 26 Oct 2023 08:13:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344474AbjJZIN5 (ORCPT ); Thu, 26 Oct 2023 04:13:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344502AbjJZINz (ORCPT ); Thu, 26 Oct 2023 04:13:55 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D21418D for ; Thu, 26 Oct 2023 01:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698308033; x=1729844033; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vJLY/1L5v56XUJvnaiHx6jyXcY8wRIXV+M2kIO+DwEg=; b=n3CDscVzh7HbNQ5933Mgg06FuJFBwVipjFblI07HKZBIzG/mphvqOtRL 1BmXzxtI98C1EBqNbEf6H6lbPCNZ5Geps4KeZ+R9msQUsY7GMsmMl8kvu lQRC7Wn+D7AHhAV2BzLir8p3eNZTAjpafENX4ZC3oOeTrUqKDFYGrJlhL 790cMDWrndcnOLEFiGrUavV0QOpKI5d/k7saa7NClHSJBH9eA/llMtRkS VnOGoC9sFJgcv/EpLsX7U+A4i2UOr6v4QkcVN4aLPZQNe0kIkIpyX8IUu 23wdDBoXV3/pRl08gf5XIcJDLSTPHD9bbIxiW9pTkj1jgoloultiFJYjp g==; X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="372530599" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="372530599" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 01:13:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="829539028" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="829539028" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 01:13:50 -0700 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id AA54111FB9B; Thu, 26 Oct 2023 11:13:47 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: wentong.wu@intel.com, bingbu.cao@intel.com Subject: [PATCH 2/6] media: ivsc: csi: Clean up V4L2 async notifier on error Date: Thu, 26 Oct 2023 11:13:42 +0300 Message-Id: <20231026081346.958238-3-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231026081346.958238-1-sakari.ailus@linux.intel.com> References: <20231026081346.958238-1-sakari.ailus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Clean up the V4L2 async notifier in error handling path, and add label to unify handling. Signed-off-by: Sakari Ailus Tested-by: Wentong Wu --- drivers/media/pci/intel/ivsc/mei_csi.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/media/pci/intel/ivsc/mei_csi.c b/drivers/media/pci/intel/ivsc/mei_csi.c index b04847e30213..281d7f5e18f9 100644 --- a/drivers/media/pci/intel/ivsc/mei_csi.c +++ b/drivers/media/pci/intel/ivsc/mei_csi.c @@ -672,16 +672,20 @@ static int mei_csi_parse_firmware(struct mei_csi *csi) asd = v4l2_async_nf_add_fwnode(&csi->notifier, fwnode, struct v4l2_async_connection); + fwnode_handle_put(fwnode); if (IS_ERR(asd)) { - fwnode_handle_put(fwnode); - return PTR_ERR(asd); + ret = PTR_ERR(asd); + goto out_nf_cleanup; } - fwnode_handle_put(fwnode); - ret = v4l2_async_nf_register(&csi->notifier); if (ret) - v4l2_async_nf_cleanup(&csi->notifier); + goto out_nf_cleanup; + + return 0; + +out_nf_cleanup: + v4l2_async_nf_cleanup(&csi->notifier); return ret; } From patchwork Thu Oct 26 08:13:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 738859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1379DC25B48 for ; Thu, 26 Oct 2023 08:13:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344502AbjJZIN7 (ORCPT ); Thu, 26 Oct 2023 04:13:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344532AbjJZINz (ORCPT ); Thu, 26 Oct 2023 04:13:55 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07461198 for ; Thu, 26 Oct 2023 01:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698308034; x=1729844034; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fnbEorG/+xU/61eDBv7EgvddkE/K7koZv2WwGYZWPDo=; b=VZbRMK3GxNINhl7405bzVROAJ3MYj/eWl67HrwtO5k5MzQsr8vQfO/mn EEwM5JSlVRAD53u9lD3l3FLfuKOfCjNxo7b9Cm5/QdbzgeMfyxUgXw4xe 0Hy/nDhirzEO9nl+UCyQDJl8mjNhaidEyu9WEHlSh1WkgfZJ2Hq4qO/0x mkn/rKRj8jppaRLad1Sxn4g3tD8akheVT6qG/Gjgt2JpM/nAHs43ubyhH rW2XlG3O6QXbLrRq+vaiQE+uPbim1+77O7kCjxs7RHSDwnCpEpxCf0VXm 2wrIELOX8lpnM9YUFFvK/gkOOp2blb5qTq7Wwp9pCK8AxT2kEU3O7JjHa Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="372530604" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="372530604" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 01:13:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="829539044" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="829539044" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 01:13:51 -0700 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 7EED11202BB; Thu, 26 Oct 2023 11:13:48 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: wentong.wu@intel.com, bingbu.cao@intel.com Subject: [PATCH 3/6] media: ivsc: csi: Clean up notifier set-up Date: Thu, 26 Oct 2023 11:13:43 +0300 Message-Id: <20231026081346.958238-4-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231026081346.958238-1-sakari.ailus@linux.intel.com> References: <20231026081346.958238-1-sakari.ailus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Use v4l2_async_nf_add_fwnode_remote() to add an async fwnode remote sub-device sub-device to the notifier. This avoids dealing with remote endpoints. Signed-off-by: Sakari Ailus Tested-by: Wentong Wu --- drivers/media/pci/intel/ivsc/mei_csi.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/media/pci/intel/ivsc/mei_csi.c b/drivers/media/pci/intel/ivsc/mei_csi.c index 281d7f5e18f9..cd0dcbbb35df 100644 --- a/drivers/media/pci/intel/ivsc/mei_csi.c +++ b/drivers/media/pci/intel/ivsc/mei_csi.c @@ -645,7 +645,6 @@ static int mei_csi_parse_firmware(struct mei_csi *csi) }; struct device *dev = &csi->cldev->dev; struct v4l2_async_connection *asd; - struct fwnode_handle *fwnode; struct fwnode_handle *ep; int ret; @@ -664,15 +663,12 @@ static int mei_csi_parse_firmware(struct mei_csi *csi) csi->nr_of_lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes; - fwnode = fwnode_graph_get_remote_endpoint(ep); - fwnode_handle_put(ep); - v4l2_async_subdev_nf_init(&csi->notifier, &csi->subdev); csi->notifier.ops = &mei_csi_notify_ops; - asd = v4l2_async_nf_add_fwnode(&csi->notifier, fwnode, - struct v4l2_async_connection); - fwnode_handle_put(fwnode); + asd = v4l2_async_nf_add_fwnode_remote(&csi->notifier, ep, + struct v4l2_async_connection); + fwnode_handle_put(ep); if (IS_ERR(asd)) { ret = PTR_ERR(asd); goto out_nf_cleanup; From patchwork Thu Oct 26 08:13:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 738579 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2A16C25B70 for ; Thu, 26 Oct 2023 08:13:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344475AbjJZIN7 (ORCPT ); Thu, 26 Oct 2023 04:13:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344531AbjJZINz (ORCPT ); Thu, 26 Oct 2023 04:13:55 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2928C182 for ; Thu, 26 Oct 2023 01:13:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698308034; x=1729844034; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/IlwYqokZg2+HeuK4aRjzzBMO2gmFSGlpgYwhbzzl4E=; b=PuiKBp4Jn5aXfncYTeup8TGqdmO8P3blp/kO1dGYX2uVpZS8y31ep56L ZfaRfbYVx5vv/ODnkq9e2UJkcioqwi35L4qlojTpP4t0sQvfSetLRJFIh MaZadAUxrzTqTXUmrfRo1sX7M0fPSq3Y7Lmi5FvdFKGUif2Pd07VUYucZ FT3u592hiHrX4PF95I77HnnJQHiYFR7MU7PearA4zVbiHCVILQ6b+ZUp1 FU34rXxreZHh+C8n3XUACGNqmvQtaOXhG/8s/Wa0npdbVpNr3f6RuvF+3 UyFZD9PF91+glu3aeiIF2BBm5JDDETH8IPZ1HsHJLDXB6kpOTO/TALspn g==; X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="372530611" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="372530611" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 01:13:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="829539062" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="829539062" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 01:13:51 -0700 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 2043B120A90; Thu, 26 Oct 2023 11:13:49 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: wentong.wu@intel.com, bingbu.cao@intel.com Subject: [PATCH 4/6] media: ivsc: csi: Clean up parsing firmware and setting up async notifier Date: Thu, 26 Oct 2023 11:13:44 +0300 Message-Id: <20231026081346.958238-5-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231026081346.958238-1-sakari.ailus@linux.intel.com> References: <20231026081346.958238-1-sakari.ailus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Set up async notifier right after obtaining the local endpoint. This makes error handling straightforward. Signed-off-by: Sakari Ailus Tested-by: Wentong Wu --- drivers/media/pci/intel/ivsc/mei_csi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/media/pci/intel/ivsc/mei_csi.c b/drivers/media/pci/intel/ivsc/mei_csi.c index cd0dcbbb35df..c19c944f613b 100644 --- a/drivers/media/pci/intel/ivsc/mei_csi.c +++ b/drivers/media/pci/intel/ivsc/mei_csi.c @@ -654,21 +654,20 @@ static int mei_csi_parse_firmware(struct mei_csi *csi) return -EINVAL; } + v4l2_async_subdev_nf_init(&csi->notifier, &csi->subdev); + csi->notifier.ops = &mei_csi_notify_ops; + ret = v4l2_fwnode_endpoint_parse(ep, &v4l2_ep); if (ret) { dev_err(dev, "could not parse v4l2 endpoint\n"); - fwnode_handle_put(ep); - return -EINVAL; + ret = -EINVAL; + goto out_nf_cleanup; } csi->nr_of_lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes; - v4l2_async_subdev_nf_init(&csi->notifier, &csi->subdev); - csi->notifier.ops = &mei_csi_notify_ops; - asd = v4l2_async_nf_add_fwnode_remote(&csi->notifier, ep, struct v4l2_async_connection); - fwnode_handle_put(ep); if (IS_ERR(asd)) { ret = PTR_ERR(asd); goto out_nf_cleanup; @@ -678,10 +677,13 @@ static int mei_csi_parse_firmware(struct mei_csi *csi) if (ret) goto out_nf_cleanup; + fwnode_handle_put(ep); + return 0; out_nf_cleanup: v4l2_async_nf_cleanup(&csi->notifier); + fwnode_handle_put(ep); return ret; } From patchwork Thu Oct 26 08:13:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 738578 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FDCCC25B6B for ; Thu, 26 Oct 2023 08:14:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344513AbjJZIOA (ORCPT ); Thu, 26 Oct 2023 04:14:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344543AbjJZIN4 (ORCPT ); Thu, 26 Oct 2023 04:13:56 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 150BAB8 for ; Thu, 26 Oct 2023 01:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698308035; x=1729844035; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZiAxTeInixzod+aYp0uEmRKocOFn93NEgCj62HEtyPU=; b=GsRVNtgttmkpARB6NUMyzdECWVkOJknDbsb4n8mWKpo/q+LTMyce/EGz Y2I7lbprFI909jsNeezJ9XI9AvdWv07Yy9B6yY8u9K/wRwSNJucEIm3YT aN7qnimesmLLimM3Yo8st8M/e/lu1qGBsJWi7ypLR2Q394yoXjgQrYKsD MkmLABg9spVNzphwVRWk4dnPauoUNzra4nW1nB7UbdUloOkxcWACs+RwD Qsft5c9b0YWDzGgCW4W0c+7fuyb9Fo6lAo1DU63TbjfArFhZjra/PyLiY hnGGIhHpbkuCpp98hivjkc7BUR7CKs0GexeEhXe2hx5wYwyC7qP/7oY8M g==; X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="372530619" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="372530619" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 01:13:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="829539092" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="829539092" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 01:13:53 -0700 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id BE8D9120EC5; Thu, 26 Oct 2023 11:13:49 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: wentong.wu@intel.com, bingbu.cao@intel.com Subject: [PATCH 5/6] media: ivsc: csi: Don't mask v4l2_fwnode_endpoint_parse return value Date: Thu, 26 Oct 2023 11:13:45 +0300 Message-Id: <20231026081346.958238-6-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231026081346.958238-1-sakari.ailus@linux.intel.com> References: <20231026081346.958238-1-sakari.ailus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org v4l2_fwnode_endpoint_parse already returns an error value, don't set return value to -EINVAL. Signed-off-by: Sakari Ailus Tested-by: Wentong Wu --- drivers/media/pci/intel/ivsc/mei_csi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/pci/intel/ivsc/mei_csi.c b/drivers/media/pci/intel/ivsc/mei_csi.c index c19c944f613b..07d8c7f82306 100644 --- a/drivers/media/pci/intel/ivsc/mei_csi.c +++ b/drivers/media/pci/intel/ivsc/mei_csi.c @@ -660,7 +660,6 @@ static int mei_csi_parse_firmware(struct mei_csi *csi) ret = v4l2_fwnode_endpoint_parse(ep, &v4l2_ep); if (ret) { dev_err(dev, "could not parse v4l2 endpoint\n"); - ret = -EINVAL; goto out_nf_cleanup; } From patchwork Thu Oct 26 08:13:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 738858 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FFD5C25B70 for ; Thu, 26 Oct 2023 08:14:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344511AbjJZIOB (ORCPT ); Thu, 26 Oct 2023 04:14:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344479AbjJZIN5 (ORCPT ); Thu, 26 Oct 2023 04:13:57 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8253CE for ; Thu, 26 Oct 2023 01:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698308035; x=1729844035; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=czV4o5JPVxUr5fT18s7d8RG407lZTaD0tG5xfIjAMfI=; b=cIM7ZaJNoQtfAVLB3NVG5yzJ/GfN1odzeQAoo6jL3YOjBpVpPeeLWI+3 eaca2X0fysjPNjIrV5nBES8PQmOyocsn5t8/vLthdxdfHcdYzwkmm1ddl 0lQZSj7xmXsdBtg04nHI59KO3wRXHIxubagtyYpnJ8SCd/7zWBI3Ym6V+ 8jaS5z4+5fhSoQKT3ae/7iku1viDduY4TS8VeZSPK6mTanA7MjrhGCE1R Uvhtn8lSJKSSCq1BVsE17LNSO6CXXi1Ts8WGsba4AIrKsfIEupurnJvSa jibCIB+9nzQymsmJky2VFJnR0TOWqF34lFOet9vFTEibHe3cyHkSOECPx Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="372530624" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="372530624" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 01:13:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="829539095" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="829539095" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 01:13:53 -0700 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 7DC1F120F14; Thu, 26 Oct 2023 11:13:50 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: wentong.wu@intel.com, bingbu.cao@intel.com Subject: [PATCH 6/6] media: ivsc: csi: Check number of lanes on source, too Date: Thu, 26 Oct 2023 11:13:46 +0300 Message-Id: <20231026081346.958238-7-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231026081346.958238-1-sakari.ailus@linux.intel.com> References: <20231026081346.958238-1-sakari.ailus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The IVSC has two CSI-2 ports, one receiver and one transmitter, for passing through the CSI-2 image data. Both have the same number of lanes and this information should be also present in firmware. Check this. Signed-off-by: Sakari Ailus Tested-by: Wentong Wu --- drivers/media/pci/intel/ivsc/mei_csi.c | 38 ++++++++++++++++++++------ 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/drivers/media/pci/intel/ivsc/mei_csi.c b/drivers/media/pci/intel/ivsc/mei_csi.c index 07d8c7f82306..99f2e312a1df 100644 --- a/drivers/media/pci/intel/ivsc/mei_csi.c +++ b/drivers/media/pci/intel/ivsc/mei_csi.c @@ -645,27 +645,47 @@ static int mei_csi_parse_firmware(struct mei_csi *csi) }; struct device *dev = &csi->cldev->dev; struct v4l2_async_connection *asd; - struct fwnode_handle *ep; + struct fwnode_handle *sink_ep, *source_ep; int ret; - ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), 0, 0, 0); - if (!ep) { - dev_err(dev, "not connected to subdevice\n"); + sink_ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), 0, 0, 0); + if (!sink_ep) { + dev_err(dev, "can't obtain sink endpoint\n"); return -EINVAL; } v4l2_async_subdev_nf_init(&csi->notifier, &csi->subdev); csi->notifier.ops = &mei_csi_notify_ops; - ret = v4l2_fwnode_endpoint_parse(ep, &v4l2_ep); + ret = v4l2_fwnode_endpoint_parse(sink_ep, &v4l2_ep); if (ret) { - dev_err(dev, "could not parse v4l2 endpoint\n"); + dev_err(dev, "could not parse v4l2 sink endpoint\n"); goto out_nf_cleanup; } csi->nr_of_lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes; - asd = v4l2_async_nf_add_fwnode_remote(&csi->notifier, ep, + source_ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), 1, 0, 0); + if (!source_ep) { + dev_err(dev, "can't obtain source endpoint\n"); + return -EINVAL; + } + + ret = v4l2_fwnode_endpoint_parse(source_ep, &v4l2_ep); + fwnode_handle_put(source_ep); + if (ret) { + dev_err(dev, "could not parse v4l2 source endpoint\n"); + goto out_nf_cleanup; + } + + if (csi->nr_of_lanes != v4l2_ep.bus.mipi_csi2.num_data_lanes) { + dev_err(dev, + "the number of lanes does not match (%u vs. %u)\n", + csi->nr_of_lanes, v4l2_ep.bus.mipi_csi2.num_data_lanes); + goto out_nf_cleanup; + } + + asd = v4l2_async_nf_add_fwnode_remote(&csi->notifier, sink_ep, struct v4l2_async_connection); if (IS_ERR(asd)) { ret = PTR_ERR(asd); @@ -676,13 +696,13 @@ static int mei_csi_parse_firmware(struct mei_csi *csi) if (ret) goto out_nf_cleanup; - fwnode_handle_put(ep); + fwnode_handle_put(sink_ep); return 0; out_nf_cleanup: v4l2_async_nf_cleanup(&csi->notifier); - fwnode_handle_put(ep); + fwnode_handle_put(sink_ep); return ret; }