From patchwork Mon Dec 6 13:12:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 12694889 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9653C433F5 for ; Mon, 6 Dec 2021 13:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=al+57vdnLngwmkCBQGHji/CK/dZG36RekX2sKNoe0vE=; b=N4cG34CcO+GN74 Xbk6fIBUYr4u5ejWUVoDf1AmfJHKTULaz1J23OeJ2ors1ZqH+LJBeDB/EfoZU3zj8yh3QvashR7/I riE7PLEBze9vAXUcJkSVCNB6lz0BZGG5nIaybkgzH1pQbn51pMwL2W+kJDRJ0kykAOk6MKXUzltKz VhB5kXftA69hSCDEuxfJ7fUgPSO6VnTt2OKVPA7BcyQnrHb9mnSjrKT1Lk8S4CrFBccNAfLKbAfOQ mf/xajWLOgaTWf799UZys+9jVgc5K7csrm34NQRcz2QSHn3MB78RQ4ei7/75AQmZ7gCA6CmG6mOi4 uw+oUX7yuwQgXJJb2pXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1muDoI-003wyO-1g; Mon, 06 Dec 2021 13:13:38 +0000 Received: from comms.puri.sm ([159.203.221.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1muDnz-003wr9-8J for linux-arm-kernel@lists.infradead.org; Mon, 06 Dec 2021 13:13:23 +0000 Received: from localhost (localhost [127.0.0.1]) by comms.puri.sm (Postfix) with ESMTP id 97658DF539; Mon, 6 Dec 2021 05:13:18 -0800 (PST) Received: from comms.puri.sm ([127.0.0.1]) by localhost (comms.puri.sm [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QP9B0PAlJ5sC; Mon, 6 Dec 2021 05:13:18 -0800 (PST) From: Martin Kepplinger To: slongerbeam@gmail.com, p.zabel@pengutronix.de, mchehab@kernel.org, laurent.pinchart@ideasonboard.com Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kepplinger Subject: [PATCH v1 1/2] media: imx: imx8mq-mipi-csi2: fix system resume issue Date: Mon, 6 Dec 2021 14:12:41 +0100 Message-Id: <20211206131242.2697464-2-martin.kepplinger@puri.sm> In-Reply-To: <20211206131242.2697464-1-martin.kepplinger@puri.sm> References: <20211206131242.2697464-1-martin.kepplinger@puri.sm> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211206_051319_337006_0ADEA4B7 X-CRM114-Status: UNSURE ( 8.40 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org during system resume, interconnect bandwidth would be requested even though the device is runtime suspended. This leaves the system in an unbalanced state. Fix that by checking the state before. Signed-off-by: Martin Kepplinger --- drivers/staging/media/imx/imx8mq-mipi-csi2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/media/imx/imx8mq-mipi-csi2.c b/drivers/staging/media/imx/imx8mq-mipi-csi2.c index 7adbdd14daa9..31a1e43733a0 100644 --- a/drivers/staging/media/imx/imx8mq-mipi-csi2.c +++ b/drivers/staging/media/imx/imx8mq-mipi-csi2.c @@ -714,6 +714,9 @@ static int imx8mq_mipi_csi_pm_suspend(struct device *dev, bool runtime) mutex_unlock(&state->lock); + if (!runtime && pm_runtime_suspended(state->dev)) + return 0; + ret = icc_set_bw(state->icc_path, 0, 0); if (ret) dev_err(dev, "icc_set_bw failed with %d\n", ret); @@ -727,6 +730,9 @@ static int imx8mq_mipi_csi_pm_resume(struct device *dev, bool runtime) struct csi_state *state = mipi_sd_to_csi2_state(sd); int ret = 0; + if (!runtime && pm_runtime_suspended(state->dev)) + return 0; + ret = icc_set_bw(state->icc_path, 0, state->icc_path_bw); if (ret) { dev_err(dev, "icc_set_bw failed with %d\n", ret); From patchwork Mon Dec 6 13:12:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 12694891 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9B704C433F5 for ; Mon, 6 Dec 2021 13:15:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Hc390FkNyNcf5ZXQ8ZrmdiaHM23/ZcFBj6r9DMg4ZOY=; b=XCdcmsVwKuX2qC 8wIYQQ5WJ2BsZx5s+mBNePU3Rkal3XSqrZqbJqRzlNHxbwiozyMXRKJJxf9frS0hPnYuuPSmFP6V7 v1d0c552Qe6h2ZyO1qky6azeMQclc67WOGhmsWBdcqaJg5D5Bmsx15AQCBFGZqFBLAr5wUzoS+WoN r/e74TlYkYYPYYURxs2myw3Bs+OX8Kos/rA1txGJaR5zvUgkOGa4OboInWLTNSJfPxkWQV3fsi5lN auipuwBDHnyI0i9tGzYZI70PwKw83IH2PXgx+ugdhG+1rG11Cdq/Ii349bTnfRlcPdUl6SVqrvGOg xAqM3COTMUcRIbbqAtcw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1muDoo-003x9n-0X; Mon, 06 Dec 2021 13:14:10 +0000 Received: from comms.puri.sm ([159.203.221.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1muDoV-003x33-S6 for linux-arm-kernel@lists.infradead.org; Mon, 06 Dec 2021 13:13:56 +0000 Received: from localhost (localhost [127.0.0.1]) by comms.puri.sm (Postfix) with ESMTP id 9982FDFF4B; Mon, 6 Dec 2021 05:13:21 -0800 (PST) Received: from comms.puri.sm ([127.0.0.1]) by localhost (comms.puri.sm [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3Y2dsPfrnCov; Mon, 6 Dec 2021 05:13:21 -0800 (PST) From: Martin Kepplinger To: slongerbeam@gmail.com, p.zabel@pengutronix.de, mchehab@kernel.org, laurent.pinchart@ideasonboard.com Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kepplinger Subject: [PATCH v1 2/2] media: imx: imx8mq-mipi-csi2: remove wrong irq config write operation Date: Mon, 6 Dec 2021 14:12:42 +0100 Message-Id: <20211206131242.2697464-3-martin.kepplinger@puri.sm> In-Reply-To: <20211206131242.2697464-1-martin.kepplinger@puri.sm> References: <20211206131242.2697464-1-martin.kepplinger@puri.sm> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211206_051351_933379_FA5A24F1 X-CRM114-Status: UNSURE ( 9.95 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The place where this register writel() that masks one interrupt is placed does not guarantee that the device is powered so that's not allowed. Moreover imx8mq_mipi_csi_start_stream() masks the interrupt anyway so the write is not even needed. Remove it as this is a mistake that slipped in with the driver. Fixes: f33fd8d77dd0 ("media: imx: add a driver for i.MX8MQ mipi csi rx phy and controller") Signed-off-by: Martin Kepplinger --- drivers/staging/media/imx/imx8mq-mipi-csi2.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/media/imx/imx8mq-mipi-csi2.c b/drivers/staging/media/imx/imx8mq-mipi-csi2.c index 31a1e43733a0..776a00eed550 100644 --- a/drivers/staging/media/imx/imx8mq-mipi-csi2.c +++ b/drivers/staging/media/imx/imx8mq-mipi-csi2.c @@ -398,9 +398,6 @@ static int imx8mq_mipi_csi_s_stream(struct v4l2_subdev *sd, int enable) struct csi_state *state = mipi_sd_to_csi2_state(sd); int ret = 0; - imx8mq_mipi_csi_write(state, CSI2RX_IRQ_MASK, - CSI2RX_IRQ_MASK_ULPS_STATUS_CHANGE); - if (enable) { ret = pm_runtime_resume_and_get(state->dev); if (ret < 0)