From patchwork Fri Oct 16 08:38:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kochetkov X-Patchwork-Id: 11841043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39793C433E7 for ; Fri, 16 Oct 2020 08:39:58 +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 B5B9420848 for ; Fri, 16 Oct 2020 08:39:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KOC7B4Ms"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uLaZ/4iI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B5B9420848 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-arm-kernel-bounces+linux-arm-kernel=archiver.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=9k0soep6BW3y8ZKa7vH5l9kfHkXvxBzwcJAEgasRLNM=; b=KOC7B4MsW44vr7pO51I5o+/mAq xQfELAwl/kXzJ4IaK8CSAIwZhONSViDbR/VDg4WNFXqvZ30FQ/1E7l1ZPkMgDN0VlPq4/iCfsVldg f6Db/dIVDZu+05Sc4P+TOvwzmS0Y3E6qQaKKg4TCY5B2dipv187lRL0+c6+eJ4Pjf8z0se0OIuaRv MdfEFWkDtWnC13u61AVvXVvBT8GqnzVHbbvvw6HAtP6FraQmW48lgZd5Oaf/cRtYsTATKpLBe9PVr PJWnnTEiN6gmSQI6UIRni0QGk5BIDh75Lt6WCE6FYxGfVRef5kpGAFiFKUUk8ZLtwTcACaD53cfmX iEfCwGXQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kTLFy-00046Y-JX; Fri, 16 Oct 2020 08:38:34 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kTLFv-00045u-QR for linux-arm-kernel@lists.infradead.org; Fri, 16 Oct 2020 08:38:32 +0000 Received: by mail-lf1-x144.google.com with SMTP id h6so1894427lfj.3 for ; Fri, 16 Oct 2020 01:38:31 -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=JrC55YtJFDYrn45XFti7KxwVjhoqHpQqb1ddz4w9X2c=; b=uLaZ/4iIbz9TSCM0OsbC9qOnEu/FIeHIxcA/0VyIAmh1A8stvCaio02HjswXMttKCk 6R3C8v/0Std5ifBed6KicTrUO8aMvRCNdTH/ioOGSYCkMv5m46xE32AimkKY+w4Ost9c eCuCKOx+kkOSnJorNlMvxTsrDC0J8ACvEgvVh1DKjKrDM6IAeWVbvUvRefR1HzFQuOua jE6V8hmKcsS8iYUdxtJj++JhI5Qubr42H/9OHQcCJMZsA+P1P3HbsQup1mHffLgKpWnb pCnOmkn65Uf4t4TbK9h1S6vyvPPv2/rBy21+Ql0fUD6NlK0p53nEubrbb30qAKjM6ehH ACCQ== 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=JrC55YtJFDYrn45XFti7KxwVjhoqHpQqb1ddz4w9X2c=; b=nPCNcsAzxIdkAGYdDmQsp4IsrkVc4m5uGR35OS70JgZwBdHGA2Cfs7v3UBvwJkTBWh orRSFc+Sqrmm8S66WVsEnQpqS8MqjIjUL5fxoneqtxIxLK4tzM6cotLjR20mZXO8ftt9 JiPmXiDwpqROghEKlLGVI1OquD5Ou8Gyg2Cf75UCR1uEzikkyuiuo9TA3MMpsgun6iC1 Ric68Z3a96xQ+6gQo5gTlIhzBLKKicOqICjrhj86Fb//iG28NaWZGEbCHA0rFY12noRv vDEPPR/Mhg9uv/O8ymzaxo0yQqfZWrfcfEAu5+ruvuia4plaQKxwQX+YAKu/Nf2keCsd pp2w== X-Gm-Message-State: AOAM532M8duYXimzdgAxkuokxds/NRJdwQXFIFWBsijZ17Gf10008uFf vzX6Lnu3Vtxp9K0mUTzNntE= X-Google-Smtp-Source: ABdhPJynBDxy+HU3G1YknTMgr9tBL5cUt/WLrT5Cw+x6v0+HB4D5CqTr4OYdueFfjZSmLQTjPMdYOA== X-Received: by 2002:a19:8654:: with SMTP id i81mr1016041lfd.250.1602837510050; Fri, 16 Oct 2020 01:38:30 -0700 (PDT) Received: from ubuntu-18.lintech.local ([80.87.144.137]) by smtp.gmail.com with ESMTPSA id q25sm596257lfa.234.2020.10.16.01.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Oct 2020 01:38:29 -0700 (PDT) From: Alexander Kochetkov To: Mark Brown , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH] spi: spi-sun6i: enable autosuspend feature Date: Fri, 16 Oct 2020 11:38:26 +0300 Message-Id: <20201016083826.31427-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_043831_866325_EE5DCBDD X-CRM114-Status: GOOD ( 11.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Kochetkov , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.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-sun6i.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c index 38e5b8af7da6..4cc0280e934c 100644 --- a/drivers/spi/spi-sun6i.c +++ b/drivers/spi/spi-sun6i.c @@ -22,6 +22,8 @@ #include +#define SUN6I_AUTOSUSPEND_TIMEOUT 2000 + #define SUN6I_FIFO_DEPTH 128 #define SUN8I_FIFO_DEPTH 64 @@ -639,9 +641,10 @@ static int sun6i_spi_probe(struct platform_device *pdev) goto err_free_dma_rx; } + pm_runtime_set_autosuspend_delay(&pdev->dev, SUN6I_AUTOSUSPEND_TIMEOUT); + pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); - pm_runtime_idle(&pdev->dev); ret = devm_spi_register_master(&pdev->dev, master); if (ret) {