From patchwork Mon Aug 29 12:32:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrice CHOTARD X-Patchwork-Id: 12957721 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 D613BECAAD4 for ; Mon, 29 Aug 2022 12:35:06 +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: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:In-Reply-To:References: List-Owner; bh=+A5ag7slp+fzW3jzW2uJoo0TeawvquJDzt0bwIXR6Gc=; b=ORBDr1mG8XbWH5 NhH62nOQd/ghQ6IN7k0Tqk2OsMnOtK6Ze5W0SOxt1mgsaI9VZdaKZW3uRhjMk5MFjngEo5q5ZgZDK CAh/0BzU9nr0duLBcPnuyrQwdwUtQW2h0STPSYNIgCcB1IQKJmA/1vnSZVwdIAoaP5Z7kv1l378nl iBcYuIf4Hok6R6Cd6C+TeJ71CUM76Mv1TgeyzT7R3BWNxeC31/JNzzkp+BkBKoxb1kP8Ndc/m3nMP ZZv5WS7qC7S68jJU7DFlvRPmfByrvNX+7j5EJdePryMB0wYQTLAI79Nq38gfW8WCgk0emEGyviBjA LA+mfc8ynIr9m37zwNfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSdxI-009OLQ-3L; Mon, 29 Aug 2022 12:33:28 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSdxE-009O31-8f for linux-arm-kernel@lists.infradead.org; Mon, 29 Aug 2022 12:33:26 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27T7lCJ8005664; Mon, 29 Aug 2022 14:33:09 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=selector1; bh=SS0hLQPrAPBMabF9dirIJRH0zBiCY+0ym1TnTQn0oCI=; b=2ZPUD6SR8RXeCDoNaZB2DXDLd+zcQmjcIwo5PulbFaV/omXwBd/C+kjwDO5RzSnGZwmN oYMB7Y44dR01CS+Fta3MOweUjR9D72nv9suWcvfuJk9coUJ8ya4LX2/On7L8HJgmKNfn EC0NxGBtZ2SYD0AJ6eVX7OdaSoj+jj5FwboKKyHVSrOJhkcLx9Q3mjAHtd8yGlfZl58L C8r3/iAIvJrHxhXrj8MIOMTDNowEc82g3XN3FoED+GtGC7m/UVSOGnn87fkUb70Ok2Vr hUYfNg45BhMucEZTRs+jDpzP2idS3yiTPENV2xvBva/gXR40i+1SURAmNl7UINWi6mvW zA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3j7a5hsn30-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 29 Aug 2022 14:33:09 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A3EE410002A; Mon, 29 Aug 2022 14:33:07 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 9A6C2229A77; Mon, 29 Aug 2022 14:33:07 +0200 (CEST) Received: from localhost (10.75.127.47) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.7; Mon, 29 Aug 2022 14:33:07 +0200 From: To: Mark Brown CC: , , , , , Subject: [PATCH] spi: stm32-qspi: Fix pm_runtime management in stm32_qspi_transfer_one_message() Date: Mon, 29 Aug 2022 14:32:50 +0200 Message-ID: <20220829123250.2170562-1-patrice.chotard@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-29_07,2022-08-25_01,2022-06-22_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220829_053324_808835_294FB1AB X-CRM114-Status: GOOD ( 16.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Patrice Chotard ctrl->auto_runtime_pm was wrongly set to true when adding transfer_one_message() callback. As explained in commit 6e6ccb3d4cdc ("spi: stm32-qspi: Add pm_runtime support") the expected behavior is to prevent runtime suspends between each transfer. Add needed pm_runtime API calls in stm32_qspi_transfer_one_message(). Fixes: a557fca630cc ("spi: stm32_qspi: Add transfer_one_message() spi callback") Signed-off-by: Patrice Chotard --- drivers/spi/spi-stm32-qspi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c index 679fd1c34f7e..227f450aa5f0 100644 --- a/drivers/spi/spi-stm32-qspi.c +++ b/drivers/spi/spi-stm32-qspi.c @@ -567,6 +567,10 @@ static int stm32_qspi_transfer_one_message(struct spi_controller *ctrl, if (!spi->cs_gpiod) return -EOPNOTSUPP; + ret = pm_runtime_resume_and_get(qspi->dev); + if (ret < 0) + return ret; + mutex_lock(&qspi->lock); gpiod_set_value_cansleep(spi->cs_gpiod, true); @@ -629,6 +633,9 @@ static int stm32_qspi_transfer_one_message(struct spi_controller *ctrl, msg->status = ret; spi_finalize_current_message(ctrl); + pm_runtime_mark_last_busy(qspi->dev); + pm_runtime_put_autosuspend(qspi->dev); + return ret; } @@ -847,7 +854,6 @@ static int stm32_qspi_probe(struct platform_device *pdev) ctrl->mem_ops = &stm32_qspi_mem_ops; ctrl->use_gpio_descriptors = true; ctrl->transfer_one_message = stm32_qspi_transfer_one_message; - ctrl->auto_runtime_pm = true; ctrl->num_chipselect = STM32_QSPI_MAX_NORCHIP; ctrl->dev.of_node = dev->of_node;