From patchwork Wed Sep 27 06:41:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 726936 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 D6B83E80A9E for ; Wed, 27 Sep 2023 06:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229668AbjI0G5z (ORCPT ); Wed, 27 Sep 2023 02:57:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbjI0G5x (ORCPT ); Wed, 27 Sep 2023 02:57:53 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D85C5A3 for ; Tue, 26 Sep 2023 23:57:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695797871; x=1727333871; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/5qfMiNZKaKzPMA2ot2UgTS9i5w3pBhS0BNps/Obmak=; b=Og7d5JQboopMyX8dLC4kWuNybE3pz+HENGWaRISvsy07NK5/CtqKTApm +fta/yEbsxxYFC+ibOJN1+J/h+GhDIGSso3yJJPlTPSzAKsUARBDnKPdH NdTuqzBgr2qxZ99UqIzUa4X0BWVyXEnDdMAEzHhNqHUpWm8ivqA9jPXT+ cQd7d28NY++j4grwP619yZU1aDMmkE+Pw+EyxP3X75UUZzprpm4K8b6ZF Z91zu+dSd5KMrLKvyl0RZTLgN3QTAAqI91LzKytN2GIXsP/pH8gqNYHo8 2sRMP7rsQ+DLpO/olcUYmvRBP+xoOztzQdoU3TznUFWbisevKtop5yyKj w==; X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="372083356" X-IronPort-AV: E=Sophos;i="6.03,179,1694761200"; d="scan'208";a="372083356" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2023 23:57:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="892489903" X-IronPort-AV: E=Sophos;i="6.03,179,1694761200"; d="scan'208";a="892489903" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2023 23:56:41 -0700 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 3946B120F09; Wed, 27 Sep 2023 09:41:39 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, Tianshu Qiu , Bingbu Cao , Tomi Valkeinen , Jacopo Mondi , Rui Miguel Silva , Martin Kepplinger Subject: [PATCH v6 11/13] media: v4l: subdev: Print debug information on frame descriptor Date: Wed, 27 Sep 2023 09:41:18 +0300 Message-Id: <20230927064120.367561-12-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230927064120.367561-1-sakari.ailus@linux.intel.com> References: <20230927064120.367561-1-sakari.ailus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Print debug level information on returned frame descriptors. Signed-off-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-subdev.c | 31 ++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 9cb04ace86ae..d295a4e87b66 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -309,9 +310,37 @@ static int call_set_selection(struct v4l2_subdev *sd, static int call_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, struct v4l2_mbus_frame_desc *fd) { + unsigned int i; + int ret; + memset(fd, 0, sizeof(*fd)); - return sd->ops->pad->get_frame_desc(sd, pad, fd); + ret = sd->ops->pad->get_frame_desc(sd, pad, fd); + if (ret) + return ret; + + dev_dbg(sd->dev, "Frame descriptor on pad %u, type %s\n", pad, + fd->type == V4L2_MBUS_FRAME_DESC_TYPE_PARALLEL ? "parallel" : + fd->type == V4L2_MBUS_FRAME_DESC_TYPE_CSI2 ? "CSI-2" : + "unknown"); + + for (i = 0; i < fd->num_entries; i++) { + struct v4l2_mbus_frame_desc_entry *entry = &fd->entry[i]; + char buf[20] = ""; + + if (fd->type == V4L2_MBUS_FRAME_DESC_TYPE_CSI2) + WARN_ON(snprintf(buf, sizeof(buf), + ", vc %u, dt 0x%02x", + entry->bus.csi2.vc, + entry->bus.csi2.dt) >= sizeof(buf)); + + dev_dbg(sd->dev, + "\tstream %u, code 0x%04x, length %u, flags 0x%04x%s\n", + entry->stream, entry->pixelcode, entry->length, + entry->flags, buf); + } + + return 0; } static inline int check_edid(struct v4l2_subdev *sd,