From patchwork Thu Jun 30 23:06:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12902450 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 2E022CCA473 for ; Fri, 1 Jul 2022 00:16:15 +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=NaoqABc3qHnDBvYEW8hR5T8Pq89Nih5YOQWhQGL/2Jw=; b=3INBUGzn+/bV/w 67VzIED8R22OzOYAytLfmtHCmRhebhkSUuooXIYF5kcqS0t58iMSjeDakWbiLTK8CVOLAKGD43CcX EVuBVN/CIozm8JjJuJ2YWkoNkAoYGI6mtHI2NkPxztXD5paon6QeA6VawZOvZp6H2uWrAInKAlJ5y ZOVX9HPuXZCjO1qytff+1AAMhhWNsnEzF7AkU4rFYcaBL5cPd+Qd5IK6wmPKB30AK6j49PjxkI0Dq rFEIfJyFR5zkqL1dDNe9qsF85eWnIAQBENZqgDZWuBsbzzaaeXnUsFmQfTZVEfSJxXNS5qGqzYg46 7L06pvhEqBU5RJ1poA+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o74KC-0028IP-4O; Fri, 01 Jul 2022 00:15:56 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o73GG-0020C7-8T for linux-rockchip@lists.infradead.org; Thu, 30 Jun 2022 23:07:53 +0000 Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id ABB4CBAC; Fri, 1 Jul 2022 01:07:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1656630462; bh=UUFr6ppXKpSbgray6PQpODUt7V4kfkMjn2RxEeHh+7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=noG/FfVu+25XfCuJV2LHVLS81Pb2l+nprckfiiD9OKj+6WkteE/ZjqbH7HOTdIqsM rFE3nf1R9nFDdh9XUPt2KuANnTDYzXhShQ1yau/lUxKV0YZPo3l0P4EejEok/RO9rU FFvDUTF7MGbbhqJzQQ34JvThs0RLPGNP7qeq41Do= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: linux-rockchip@lists.infradead.org, Dafna Hirschfeld , Heiko Stuebner , Helen Koike , Paul Elder Subject: [PATCH v2 07/55] media: rkisp1: Read the ID register at probe time instead of streamon Date: Fri, 1 Jul 2022 02:06:25 +0300 Message-Id: <20220630230713.10580-8-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220630230713.10580-1-laurent.pinchart@ideasonboard.com> References: <20220630230713.10580-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220630_160748_540920_F05D69C5 X-CRM114-Status: GOOD ( 10.69 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org There's no need to read the ID register every time streaming is started. Do it once, at probe time. Signed-off-by: Laurent Pinchart Reviewed-by: Dafna Hirschfeld Reviewed-by: Paul Elder --- drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 10 ++++++++++ drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c | 4 ---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c index 248f0172ca62..ba773c0784fb 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c @@ -467,6 +467,7 @@ static int rkisp1_probe(struct platform_device *pdev) struct v4l2_device *v4l2_dev; unsigned int i; int ret, irq; + u32 cif_id; match_data = of_device_get_match_data(&pdev->dev); if (!match_data) @@ -509,6 +510,15 @@ static int rkisp1_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); + ret = pm_runtime_resume_and_get(&pdev->dev); + if (ret) + goto err_pm_runtime_disable; + + cif_id = rkisp1_read(rkisp1, RKISP1_CIF_VI_ID); + dev_dbg(rkisp1->dev, "CIF_ID 0x%08x\n", cif_id); + + pm_runtime_put(&pdev->dev); + rkisp1->media_dev.hw_revision = match_data->isp_ver; strscpy(rkisp1->media_dev.model, RKISP1_DRIVER_NAME, sizeof(rkisp1->media_dev.model)); diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c index a97c145bad98..bc94a51124b0 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c @@ -473,12 +473,8 @@ static int rkisp1_config_path(struct rkisp1_device *rkisp1) /* Hardware configure Entry */ static int rkisp1_config_cif(struct rkisp1_device *rkisp1) { - u32 cif_id; int ret; - cif_id = rkisp1_read(rkisp1, RKISP1_CIF_VI_ID); - dev_dbg(rkisp1->dev, "CIF_ID 0x%08x\n", cif_id); - ret = rkisp1_config_isp(rkisp1); if (ret) return ret;