From patchwork Tue May 10 11:51:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 15854 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 253B6C3256 for ; Tue, 10 May 2022 11:52:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A5F6D65660; Tue, 10 May 2022 13:52:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1652183535; bh=VV3eplvYk/sJft+X1ditSjuXp/Rm1i02+4x1EUzfKII=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ny8yUBQErI5Pa3UVjeImhEpkCC4VcNg7Wrcr1svOrOhP0ax0nlI5s8wyFIk44aYWu bIaV3IBeuXf4RovoOG+mr+rgjahqHhJ/irP4M+QD4RBiYxoqv/H9G6JXNiRR8cJDzg Z2TX4fm5Jze9wpPgvAszj+Bu9lNpHUYLUB23piGvEob7JqMsZIJGVXnqQJvdf75LDL TlP/zSoLWGH/D33KkSJRbAaN9ljXrbEVL8PbX2HuDKgtM3N0LCAsHgPgdgnvIBl77D EL0s9N4ifnNq1zXkARqTM5LhioX6CHq7tlsJvYJWxrvkxubuvLkDMPCC065UqsJPMN oItAxw9XcKofg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 273AF65667 for ; Tue, 10 May 2022 13:52:09 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="f4lQBRJX"; dkim-atps=neutral Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4B24FBA9; Tue, 10 May 2022 13:52:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1652183528; bh=VV3eplvYk/sJft+X1ditSjuXp/Rm1i02+4x1EUzfKII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f4lQBRJXyL8L/g1QX9TJGNogUL/qN2UWmnx1I5KSRorjjzYYiAj15S+ZuDXPt4AfL jAAs4K2G6b7xwCsR3U7/1XsekDe+QmO2tiObIluxDyzO9u4OM/poNfJnlx5g31ZAty JV6Tiepe4fH5sv2NKCWbklnqha6hclrJwEDueEHA= To: libcamera-devel@lists.libcamera.org Date: Tue, 10 May 2022 14:51:11 +0300 Message-Id: <20220510115147.19360-15-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220510115147.19360-1-laurent.pinchart@ideasonboard.com> References: <20220510115147.19360-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 14/50] staging: media: imx: imx7-media-csi: Reorganize imx7_csi structure X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Cc: Martin Kepplinger , kernel@pengutronix.de, Dorota Czaplejewicz , Alexander Stein , Rui Miguel Silva , Philipp Zabel , Steve Longerbeam Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The struct imx7_csi fields are in a random order, reorganize them logically to prepare for adding new fields. Signed-off-by: Laurent Pinchart --- drivers/staging/media/imx/imx7-media-csi.c | 36 ++++++++++++---------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index 499bb74ad6f3..ad69c2e8dbc2 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -169,37 +169,41 @@ enum imx_csi_model { struct imx7_csi { struct device *dev; - struct v4l2_subdev sd; + + /* Resources and locks */ + void __iomem *regbase; + int irq; + struct clk *mclk; + + struct mutex lock; /* Protects is_streaming, format_mbus, cc */ + spinlock_t irqlock; /* Protects last_eof */ + + /* Media and V4L2 device */ + struct imx_media_dev *imxmd; struct v4l2_async_notifier notifier; - struct imx_media_video_dev *vdev; - struct imx_media_dev *imxmd; - struct media_pad pad[IMX7_CSI_PADS_NUM]; - - /* lock to protect members below */ - struct mutex lock; - /* lock to protect irq handler when stop streaming */ - spinlock_t irqlock; struct v4l2_subdev *src_sd; + bool is_csi2; + + /* V4L2 subdev */ + struct v4l2_subdev sd; + struct media_pad pad[IMX7_CSI_PADS_NUM]; struct v4l2_mbus_framefmt format_mbus[IMX7_CSI_PADS_NUM]; const struct imx_media_pixfmt *cc[IMX7_CSI_PADS_NUM]; - void __iomem *regbase; - int irq; - struct clk *mclk; + /* Video device */ + struct imx_media_video_dev *vdev; - /* active vb2 buffers to send to video dev sink */ + /* Buffers and streaming state */ struct imx_media_buffer *active_vb2_buf[2]; struct imx_media_dma_buf underrun_buf; + bool is_streaming; int buf_num; u32 frame_sequence; bool last_eof; - bool is_streaming; - bool is_csi2; - struct completion last_eof_completion; enum imx_csi_model model;