Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3658827pxu; Mon, 19 Oct 2020 18:48:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxyBKcmYDDXsGJpZPS0vXHuSpjh2OZfJ+rozSN5UTDyaVAVpxxBjg5uI8FZr0IgEzlppTU X-Received: by 2002:a50:af21:: with SMTP id g30mr394139edd.46.1603158501328; Mon, 19 Oct 2020 18:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603158501; cv=none; d=google.com; s=arc-20160816; b=BU1MDXRbnGGqNwN+Y+2tD6e4y0z4Xo7pHtWievLNH4jh0sHO+y7dBK9yXTeW3grSSG niT6gjEfQqEHYhuTq3N3OwUe4rFHoVT0TzMN3BsvCEF7be3Gogpvb0L+W/f3pG6IAE6/ Qi61ejgrHvJithG4BdE8rah5DhcMaPSWH/mxJddw1VsYGr8wPj243V8UDZQMGnJ5bx3k 4YzHaiR4IfWbscUvmGOXadRxmAUfyLXwjmqeO7Q7YR+sKFW6lbhDgVQzAPZrpsIyIaVx nNvopsL9AAritmZtTTAFSL1iHHLS4+PB6iucKje2Lobgyf3NX60GL5XIuYrtZyhGQc90 0TFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=fPH7CQ4G9R2lqYFhSa3lSQ7unVSPvrV283E5Rfz2G+c=; b=lh90t0SBFgnJyoirxurMendmft4oXWKn/wy5leorztgmjDIzd2SwWCOAugA8frVNcY uGkvrUZmNVRSA5PFDbCBJNg1HZZ+XvLyi4CTigop4iXQF5ri3GN+V+RJjw0rD/VAt710 W5AVKo1wWqqIO7OGOX3HY99GuhkkhDGTer49lbb0Ha2+1w6TmWWw1WtLen2z7lC141xy RmUGpvKlZgotHYRU52yLG77zej0DriPf7JeVpFjbwDBvKXACnRJSJPuyf1KaKRxUlcSS eGHvB7lo26bhwrS948mJBTd4lNAHRGqExh27RTjtUFp9MyrIUVvPiJrfkQ3YuW/GPbNC IjbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NwHarqhT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h25si189917edt.103.2020.10.19.18.47.59; Mon, 19 Oct 2020 18:48:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NwHarqhT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729695AbgJSPDu (ORCPT + 99 others); Mon, 19 Oct 2020 11:03:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729546AbgJSPDu (ORCPT ); Mon, 19 Oct 2020 11:03:50 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 990EEC0613CE; Mon, 19 Oct 2020 08:03:49 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id c141so14595265lfg.5; 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=BYX+q4UyBOy9MAttySUQA/Y09fNHwBHmvXSbnjDCKVGDKIQe+ByU0AfogsxsuFD19S MXwTyAUXrkTfd0Mzbad3vYABybib6jwL+3q5h3ZrnFU/tXG26AXcj1PsZrfZmB33VDVp 62usyzMrxPSywG1gQlqjBLjGhJXnkksnJYhjenlljk+KLq+ol78x3d6M1EmDSB10IqbJ C3bAchE+K7eVoMQ/G4mhti8njB6kac1qGf5eu2BOASWZLDr4hxz4rGZ+1wF77L0zUTQc 7EXocf0xW7EokrJT/jI5+6ykq2s063E9uILYIaaooLE9TzzqyHn0VBm78+Sx42+eoKad VRZA== X-Gm-Message-State: AOAM533U8jc66TxgZcvE+Gq+uiODny0gSxPY3J07ixQccIVFOJaahGvY 9tsOWKRFaqW5+2oNRrVU9q4= 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 Cc: linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alexander Kochetkov 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- 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) { -- 2.17.1