From patchwork Fri Oct 11 22:57:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Larumbe?= X-Patchwork-Id: 13833231 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 55FF3D0EE3F for ; Fri, 11 Oct 2024 22:59:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D2E8010EB35; Fri, 11 Oct 2024 22:59:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b="Emtr4hgR"; dkim-atps=neutral Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0148110EB30 for ; Fri, 11 Oct 2024 22:59:28 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1728687561; cv=none; d=zohomail.com; s=zohoarc; b=d6lOPDDbsXYajpqnWAEGCYjrycH1l1qhEpNvqkoVWLmToca0BxO5VFf6fqV/mzNhgej9vHJ8949vm40IpNZDiSCBBeFA69CBWf7X76N2yct8EKZUJQw9vcYUMbJOGiXIQUkidF/81CvlJ/Y8iy7tKLw1Vgd32oHuGjdjIPCvDZk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728687561; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=sHHKPfHgZRs5gMzNFp3u//pQRXS+IebqOoINdKrWbgo=; b=ZNx4EaDIwYEQ3GeKyohIpzX/18QeBuMnr4jh4hTHyl00kXnMx7XM74OQhPlFNYxviO6Ubu+dhbDVXzrknIy5kgrXIMmBptpOpL/11Hg5jLSc2LM3AbjIISs3EOq0T9wlj/eZq0fq9tYd1/L5QU17hRNUzoR5+eXt/GUjp+zO6p4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=adrian.larumbe@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1728687561; s=zohomail; d=collabora.com; i=adrian.larumbe@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=sHHKPfHgZRs5gMzNFp3u//pQRXS+IebqOoINdKrWbgo=; b=Emtr4hgRDMBCc0t7YaHcTnOylDr2tk60m9iWlDz//DIHiwOp1F+akQeOUkj3j6HI PIFM1CXDMG+D1GbKkRI12ew4CyEvSSx1+nAFQLoLRAfgpQisNZPp1YviDuISAX1JZ9I iy9HUm2QRo6SpccAtZ3wUEFBg/xZXhkq+cj1z988= Received: by mx.zohomail.com with SMTPS id 1728687560568724.2057795814977; Fri, 11 Oct 2024 15:59:20 -0700 (PDT) From: =?utf-8?q?Adri=C3=A1n_Larumbe?= To: Boris Brezillon , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: kernel@collabora.com, =?utf-8?q?Adri=C3=A1n_Larumbe?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] drm/panthor: Retry OPP transition to suspension state a few times Date: Fri, 11 Oct 2024 23:57:00 +0100 Message-ID: <20241011225906.3789965-2-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241011225906.3789965-1-adrian.larumbe@collabora.com> References: <20241011225906.3789965-1-adrian.larumbe@collabora.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When the device's runtime PM suspend callback is invoked, the switch to a suspension OPP might sometimes fail. Although this is beyond the control of the Panthor driver, we can attempt suspending it more than once as a defensive strategy. Signed-off-by: Adrián Larumbe --- drivers/gpu/drm/panthor/panthor_device.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c index cedd3cbcb47d..5430557bd0b8 100644 --- a/drivers/gpu/drm/panthor/panthor_device.c +++ b/drivers/gpu/drm/panthor/panthor_device.c @@ -490,6 +490,7 @@ int panthor_device_resume(struct device *dev) int panthor_device_suspend(struct device *dev) { struct panthor_device *ptdev = dev_get_drvdata(dev); + unsigned int susp_retries; int ret, cookie; if (atomic_read(&ptdev->pm.state) != PANTHOR_DEVICE_PM_STATE_ACTIVE) @@ -522,7 +523,12 @@ int panthor_device_suspend(struct device *dev) drm_dev_exit(cookie); } - ret = panthor_devfreq_suspend(ptdev); + for (susp_retries = 0; susp_retries < 5; susp_retries++) { + ret = panthor_devfreq_suspend(ptdev); + if (!ret) + break; + } + if (ret) { if (panthor_device_is_initialized(ptdev) && drm_dev_enter(&ptdev->base, &cookie)) {