From patchwork Mon Oct 19 15:03:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kochetkov X-Patchwork-Id: 11844607 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 B9E23C433E7 for ; Mon, 19 Oct 2020 15:05:14 +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 2F9952231B for ; Mon, 19 Oct 2020 15:05:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cAxqNiqj"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NwHarqhT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F9952231B 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=1pshwU5iwpbADQe94i6HEsfjaZ0ML4qQvoxXtsaGI7w=; b=cAxqNiqjHc+uVmzC/cbd2+FlEm 4oXJWveSNhBur9sW191Z3OckMJJxEE9yU4LbaHnStYgOyr405zBJBDAONLWrbIqLRtgO2Wf9TzumF 9ib17q/t394srq9u3W9d0SZjLn4akT1yNoPi/nNZmm5GASBRSInZuQLWNaJ0uxKQGT+0pyDBC7fWM Vpfd55bKAN/iCLaMRZ8lWuZtG6/pfmaR3IFAdfiXI1Z8K8bC26ctSgDEwrfE7IjGmnYGWcXiwfLTW FvbzaQaCAfOa9G3bJVnX55ePeei+r0BtTB7Gezmigqo6MS682j/Dwjdr9MAs3zjbROLPKDC0CPeVH vjiNgZGQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUWhU-0000Uw-Ar; Mon, 19 Oct 2020 15:03:52 +0000 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUWhR-0000Tr-NN for linux-arm-kernel@lists.infradead.org; Mon, 19 Oct 2020 15:03:50 +0000 Received: by mail-lf1-x141.google.com with SMTP id z2so14621352lfr.1 for ; Mon, 19 Oct 2020 08:03:49 -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=fPH7CQ4G9R2lqYFhSa3lSQ7unVSPvrV283E5Rfz2G+c=; b=NwHarqhTQAshl//hLm4teAywrDUZ/D+WdI/zrBmozgDJPKZQTriM/AFtTPraeDP1UD zp5mb7XClNpnGsOvXoA1z6mQkCr5l1LrxC4zdolqpy4TRMopmflRH0DjPIFlNno3bZ6T syvNUFF3/YTkIbXTtbjNesUQ0hrYa9eT782eCjwre/Hd8u8vsTBpk9EYo44QxFWtuxZf Lbxz19zFoVhamdlq37H7bEFIbtr9vX3k3eDA/K6NKXj1Ya4uBUEGiZOjfFBe/jX6bafP O3U+hcTP7owCDU5UyEXA2c9fAkMoco68b/1kAsZ/u0UPYgvasvVngKzWBzvrp7gJb80g 0Vhg== 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=fPH7CQ4G9R2lqYFhSa3lSQ7unVSPvrV283E5Rfz2G+c=; b=b61EdKzOmdE/RXH73Z0dltwjWrvFjCKDZ0opobcwf3Q7mK4qdtl+sgW6u1fTjZFPF4 pMfWVhjDTY16FlsHaqem/tfHQNnY1pOhJAGkQgwAvNz9EcTMWhQXec71LIQLGVHKICJi N7eqR2/WvcmZGvJP+wmaRsgRGvETmLrrv9scMDa+BDHFleu75hpauhjABY0+F5yXTjvK 48mpuj+59oVVsC6jEqC+fgfDEt3TfloSA5fK7G3zpOU501Kre4kogRCNEFBDqPsuEmCW MHSdDW72/CzVEM9QV1ebAqOQzI/YWejn62qjOYpbiAhCKy8jvvyQTKoCO1AINPar9n23 m8wg== X-Gm-Message-State: AOAM533TLcoXVpFiMHbzeyAqW9no4pg4q0/z679FqE3zbx1pB30VnpXb uKaBzuJ8+xZxNCPq7I1nzSY5HMm4hIpP8A== X-Google-Smtp-Source: ABdhPJzrrhrlwnzF8epGNUQ+/Zp3xt3luXBSviL5vDbuFR3e+LzxXD3Yh8X1TF4ljD75bY2oyiSGBw== X-Received: by 2002:a19:c68a:: with SMTP id w132mr42433lff.106.1603119828142; Mon, 19 Oct 2020 08:03:48 -0700 (PDT) Received: from ubuntu-18.lintech.local ([80.87.144.137]) by smtp.gmail.com with ESMTPSA id l9sm13343ljc.86.2020.10.19.08.03.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2020 08:03:47 -0700 (PDT) From: Alexander Kochetkov X-Google-Original-From: Alexander Kochetkov To: Mark Brown , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v2] spi: spi-sun6i: enable autosuspend feature Date: Mon, 19 Oct 2020 18:03:43 +0300 Message-Id: <20201019150343.2520-1-akochetkov@lintech.ru> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_110349_860059_0683FBFE X-CRM114-Status: GOOD ( 13.70 ) 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 From: Alexander Kochetkov 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. The commit also remove unnecessary call to pm_runtime_idle() used to explicit put device to suspended state. Without pm_runtime_idle() PM core will put device in the suspended state just after probe() returns. Signed-off-by: Alexander Kochetkov Acked-by: Maxime Ripard --- Changes in v2: - Extend commit description with explanation about removal of pm_runtime_idle() 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 29ea1e87ce7e..86f29c3e335a 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 @@ -652,9 +654,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) {