From patchwork Fri Oct 16 08:50:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kochetkov X-Patchwork-Id: 11841049 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F1201752 for ; Fri, 16 Oct 2020 08:50:38 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0528920848 for ; Fri, 16 Oct 2020 08:50:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="s8G1X2xO"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JA1GNd8+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0528920848 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=eiZE6GW5FC7mIjecYo4fHdwbck/75NvHJKMvF5Pemgs=; b=s8G1X2xOLgp30wqsiMOF47Pg30 il3ckkvjtgLVjOFsLSjjTeN3RRrOBbkLqiRgPVD6CRUY1XfrB+QBgRWS6jlDalNmpWgox9SAEMr2C qsHHKH33pTKM6gc94/tCb2EtEw11XHUGMSONzKmcmOz5f/t5YtduSrLwWnrt05Fa4AzGC7/AXaMPA anCO7AYBiZdblkxxDk+5URio/6JAcKfgitGBJHBMrFbwYf53DmhKJnSVgXRFBmrlhp+ICUTUVR2fh AzZFsqB6GpB21Mh8TkiE9ZAGiXkoqFh4qWoXPG3fzxbb7ppg9Ko53AQRgfbzs16efJMD+rqTlXHO0 RRIyjuRQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kTLRW-00056y-S4; Fri, 16 Oct 2020 08:50:30 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kTLRS-000563-H0; Fri, 16 Oct 2020 08:50:27 +0000 Received: by mail-lj1-x243.google.com with SMTP id c21so1560773ljn.13; Fri, 16 Oct 2020 01:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=l2g0WanDfq/KDOh+/VcHyYkZcE8dM9/DlazBWuJO0Zw=; b=JA1GNd8+HG69mXKrInW+0dljGSbVqvNVsQIb2Q4Wl6dfWRYeempCQLpYb9LCCx0tF/ M//4FdO2QES7EtI0dmhPQ5LSEOjx95yO8c8ekXQETgalMH9LDJJYMryKl7NQY+wTG5P3 Z3pwCjpROLpJoK87+6xDJczYQvv1oZgEbOt5G8VxPFs45ijMGsNewG+SUAGA2oWWhOEg 92Jl18IA1nE773vlSc40rcMiXogokilNW+h5C0A2yh2aFVlfYIbztIhTmG8aiZO7rErV tpHdPSoVBgF27FnMYuUMLviVlfDXNiiunM4jihEFO01voqCV2NAZ4zeKCMGegQKSYFTL fx8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=l2g0WanDfq/KDOh+/VcHyYkZcE8dM9/DlazBWuJO0Zw=; b=kMJCk6QnCkkDFZMpUpaCtwr/45lKijklCKtjoAJeWCqgm8F9HCaGAXERFw8pO8f+s6 wx7zCa3mkQhK+/d4Vyp8TcoWYWW1OXtsxPG8I7b7dTQb4Nlf+3TprVJrUOtf4X4TA1D6 Ge69bGZ0UETQFzKXeatol1nhmolNL4YTEx78LBC8NR4ELhBtLLLclx/rdy8I/Rlahx4q 6N/MHojMrh545y1US5xeWWFdezrtQr/FVGOdi9hABove0i3GqCXCV4zXzbwxUGwdj27s GYgZi4/f5WBNTqR7H4z9rLFociA/f5qaMwBh2aHqrR6isgKHVtS8NU42olHAAXQz1/Rw fI4g== X-Gm-Message-State: AOAM532UT8bwY41GM7YBdoTMAJ8ma40WnSuC/L2KnRQvzirCINI49ThC GtnjTgZBm6nlCqv5SzG3DeY= X-Google-Smtp-Source: ABdhPJwdW1Qe4VdACE8m9bGNR8Vib87O4M73lJOUO9VrfM5U5CqccUuVSr6SJSEuRzCSoN2I39zj2g== X-Received: by 2002:a2e:b5c1:: with SMTP id g1mr1014660ljn.305.1602838224050; Fri, 16 Oct 2020 01:50:24 -0700 (PDT) Received: from ubuntu-18.lintech.local ([80.87.144.137]) by smtp.gmail.com with ESMTPSA id 62sm607435lfk.47.2020.10.16.01.50.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Oct 2020 01:50:23 -0700 (PDT) From: Alexander Kochetkov To: Mark Brown , Heiko Stuebner Subject: [PATCH] spi: rockchip: enable autosuspend feature Date: Fri, 16 Oct 2020 11:50:14 +0300 Message-Id: <20201016085014.31667-1-al.kochet@gmail.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201016_045026_674888_46471DD3 X-CRM114-Status: GOOD ( 11.67 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:243 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [al.kochet[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, Alexander Kochetkov , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org If SPI is used for periodic polling any sensor, significant delays sometimes appear. Switching on module clocks during resume lead to delays. Enabling autosuspend mode causes the controller to not suspend between SPI transfers and the delays disappear. Signed-off-by: Alexander Kochetkov --- drivers/spi/spi-rockchip.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 2cc6d9951b52..3e77b1a79bc8 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -157,6 +157,8 @@ #define ROCKCHIP_SPI_MAX_CS_NUM 2 +#define ROCKCHIP_AUTOSUSPEND_TIMEOUT 2000 + struct rockchip_spi { struct device *dev; @@ -670,6 +672,8 @@ static int rockchip_spi_probe(struct platform_device *pdev) goto err_disable_spiclk; } + pm_runtime_set_autosuspend_delay(&pdev->dev, ROCKCHIP_AUTOSUSPEND_TIMEOUT); + pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev);