From patchwork Thu Dec 21 13:58:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 757338 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C2F758236 for ; Thu, 21 Dec 2023 13:58:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="n/zdnTrB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703167109; x=1734703109; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cXkpUsjZkvgBmGXazNfWiLAgnaqd9mNI4wLKcTHVkZ4=; b=n/zdnTrBaiU7U5p/asKED+hN7bcYwb2CDgaoweQeiOmDlVyQhhb6flDL FjjO6Y1NO8zkhafP12U13zM46WQNLKHE7sr6fknuP5qlhSyBlmrYL6oDn 79kYlFeBwQ7lQisQk0YzRWX3FdLZK7KDLlkwjphIJf8+Y+THtwYJUYXz4 X5/eV0xRNxc9doRzTv0oRtXft2s7kfhPdLxPIV8lBn9GyCTJdrdvZpm3P jV9ocYBomI1fPpueEK7K+6uZnDEtssOVZ3+IE3sInLiSXe180tZ2MJZ+F dx4br2TCjEkNmOQ27Rbk9S2IkkPLAaBIxFzZskuWT7zMaxgLBZfIdjGqC A==; X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="460312126" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="460312126" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2023 05:58:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="1108108404" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="1108108404" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2023 05:58:26 -0800 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 84F571203EB; Thu, 21 Dec 2023 15:58:23 +0200 (EET) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: bingbu.cao@intel.com, laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH 1/3] media: ipu3-cio2: Further clean up async subdev link creation Date: Thu, 21 Dec 2023 15:58:20 +0200 Message-Id: <20231221135822.152448-2-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221135822.152448-1-sakari.ailus@linux.intel.com> References: <20231221135822.152448-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use v4l2_create_fwnode_links_to_pad() to create links from async sub-devices to the CSI-2 receiver subdevs. Signed-off-by: Sakari Ailus Tested-by: Lad Prabhakar # Renesas RZ/G2L SMARC Reviewed-by: Laurent Pinchart --- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c index ed08bf4178f0..83e29c56fe33 100644 --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -1407,7 +1408,6 @@ static void cio2_notifier_unbind(struct v4l2_async_notifier *notifier, static int cio2_notifier_complete(struct v4l2_async_notifier *notifier) { struct cio2_device *cio2 = to_cio2_device(notifier); - struct device *dev = &cio2->pci_dev->dev; struct sensor_async_subdev *s_asd; struct v4l2_async_connection *asd; struct cio2_queue *q; @@ -1417,23 +1417,10 @@ static int cio2_notifier_complete(struct v4l2_async_notifier *notifier) s_asd = to_sensor_asd(asd); q = &cio2->queue[s_asd->csi2.port]; - ret = media_entity_get_fwnode_pad(&q->sensor->entity, - s_asd->asd.match.fwnode, - MEDIA_PAD_FL_SOURCE); - if (ret < 0) { - dev_err(dev, "no pad for endpoint %pfw (%d)\n", - s_asd->asd.match.fwnode, ret); - return ret; - } - - ret = media_create_pad_link(&q->sensor->entity, ret, - &q->subdev.entity, CIO2_PAD_SINK, - 0); - if (ret) { - dev_err(dev, "failed to create link for %s (endpoint %pfw, error %d)\n", - q->sensor->name, s_asd->asd.match.fwnode, ret); + ret = v4l2_create_fwnode_links_to_pad(asd->sd, + &q->subdev_pads[CIO2_PAD_SINK], 0); + if (ret) return ret; - } } return v4l2_device_register_subdev_nodes(&cio2->v4l2_dev); @@ -1572,6 +1559,7 @@ static int cio2_queue_init(struct cio2_device *cio2, struct cio2_queue *q) v4l2_subdev_init(subdev, &cio2_subdev_ops); subdev->flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; subdev->owner = THIS_MODULE; + subdev->dev = dev; snprintf(subdev->name, sizeof(subdev->name), CIO2_ENTITY_NAME " %td", q - cio2->queue); subdev->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE; From patchwork Thu Dec 21 13:58:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 757740 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A8AB59900 for ; Thu, 21 Dec 2023 13:58:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YwIkxcYr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703167109; x=1734703109; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Sdk6AALaqYk7oRXoYdYEK9cQ0HfRJFpR8mZylE7WZBI=; b=YwIkxcYrQ+aLs/RxdyCxujwNmQshQCgN7WFxkXMif2UqCOYrol8DH833 iZ9qAvGlK6TCdVI13219S7ke4GB8bBJAtkV8UlZ59dcwbtgy2usOyA9II PbGmrU/YOAvfV/ENo83/gjNE+q1Ksnt/N2nbFJwLuy9mosJs7WGnd6FPa +sexDgy37/nqJzEjchMyrvvGPCjGm7tpDHWjedHUb5yWuGHS1Zeg3BVFk urYwTfoq9SCpVMDfkPDxs588AvL8PyrBjvWLNnZmMYAmHMbVx5fJ5a5X8 WNd20NkIaz70w05uA0nDMbHCP5oCu4fMTKqvON9qsZyVL+7ZxNDtxFuEm g==; X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="460312129" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="460312129" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2023 05:58:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="1108108408" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="1108108408" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2023 05:58:26 -0800 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 3256712068E; Thu, 21 Dec 2023 15:58:24 +0200 (EET) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: bingbu.cao@intel.com, laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH 2/3] media: v4l2-mc: Add debug prints for v4l2_fwnode_create_links_for_pad() Date: Thu, 21 Dec 2023 15:58:21 +0200 Message-Id: <20231221135822.152448-3-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221135822.152448-1-sakari.ailus@linux.intel.com> References: <20231221135822.152448-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add relevant debug prints for v4l2_fwnode_create_links_for_pad(). This should help debugging when things go wrong. Signed-off-by: Sakari Ailus Tested-by: Lad Prabhakar # Renesas RZ/G2L SMARC --- drivers/media/v4l2-core/v4l2-mc.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-mc.c b/drivers/media/v4l2-core/v4l2-mc.c index 52d349e72b8c..b1a6246580ec 100644 --- a/drivers/media/v4l2-core/v4l2-mc.c +++ b/drivers/media/v4l2-core/v4l2-mc.c @@ -337,12 +337,18 @@ int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd, src_idx = media_entity_get_fwnode_pad(&src_sd->entity, endpoint, MEDIA_PAD_FL_SOURCE); - if (src_idx < 0) + if (src_idx < 0) { + dev_dbg(src_sd->dev, "no pad found for %pfw\n", + endpoint); continue; + } remote_ep = fwnode_graph_get_remote_endpoint(endpoint); - if (!remote_ep) + if (!remote_ep) { + dev_dbg(src_sd->dev, "no remote ep found for %pfw\n", + endpoint); continue; + } /* * ask the sink to verify it owns the remote endpoint, @@ -353,8 +359,12 @@ int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd, MEDIA_PAD_FL_SINK); fwnode_handle_put(remote_ep); - if (sink_idx < 0 || sink_idx != sink->index) + if (sink_idx < 0 || sink_idx != sink->index) { + dev_dbg(src_sd->dev, + "sink pad index mismatch or error (was %d, expected %u)\n", + sink_idx, sink->index); continue; + } /* * the source endpoint corresponds to one of its source pads, @@ -367,8 +377,11 @@ int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd, src = &src_sd->entity.pads[src_idx]; /* skip if link already exists */ - if (media_entity_find_link(src, sink)) + if (media_entity_find_link(src, sink)) { + dev_dbg(src_sd->dev, "link from %pfw to %pfw exists\n", + endpoint, remote_ep); continue; + } dev_dbg(src_sd->dev, "creating link %s:%d -> %s:%d\n", src_sd->entity.name, src_idx, From patchwork Thu Dec 21 13:58:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 757337 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF47C59904 for ; Thu, 21 Dec 2023 13:58:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="k87a60cv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703167110; x=1734703110; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7sQm8GXsfgMjSQlquFKtXNWY4u/EA4nNdj1qVw0vs+M=; b=k87a60cvubes8d/O2TvY++p15sqpbZAlsB30b6giVmZ/SXM5ShlyQ0Uk HfeJvSBOJlXXBjuA7tOv/ItytTEL8CvECI2EFw2TEejPb0Ijq3tsU2gZB VgRzHoT29kvT8xtuqF4AfnqI2cDbMD9OZJdskUlaCJ+ByOfGwFfInzM9R XQ8WxnIrJ4EvEkBo7QjZpgeOfjhInBcH+rZe/vxAORn2TiloRYrJdjFAd /RDWpGHnwKLFO+91NJXvLEWroU7orXPsnwPngzlYE68vuV6QRHWkbqbBW Z5LISzhKRJcZOzHESm6xNcDPrvbpfoC7XcZHnEDtwqE5DsIjOSOG3E0ik g==; X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="460312132" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="460312132" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2023 05:58:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="1108108413" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="1108108413" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2023 05:58:27 -0800 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id D3BE3120A19; Thu, 21 Dec 2023 15:58:24 +0200 (EET) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: bingbu.cao@intel.com, laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Subject: [PATCH 3/3] media: mc: Drop useless debug print on file handle release Date: Thu, 21 Dec 2023 15:58:22 +0200 Message-Id: <20231221135822.152448-4-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221135822.152448-1-sakari.ailus@linux.intel.com> References: <20231221135822.152448-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Drop a debug print in media_release(), which is a release callback for a file handle. Printing a debug message here is simply not necessary. Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart --- drivers/media/mc/mc-devnode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/mc/mc-devnode.c b/drivers/media/mc/mc-devnode.c index 680fbb3a9340..9c8fe9335dc1 100644 --- a/drivers/media/mc/mc-devnode.c +++ b/drivers/media/mc/mc-devnode.c @@ -190,7 +190,6 @@ static int media_release(struct inode *inode, struct file *filp) return value is ignored. */ put_device(&devnode->dev); - pr_debug("%s: Media Release\n", __func__); return 0; }