From patchwork Sun Dec 29 17:17:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 182541 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5447873ild; Sun, 29 Dec 2019 09:31:15 -0800 (PST) X-Google-Smtp-Source: APXvYqw3kk5HWbWzxHxcGcTd+nt+kAL/3MUzKRkauV+14VyE9VYu1mVmHbxh0d5Kp8NoU5tSWocp X-Received: by 2002:a05:6830:1b7b:: with SMTP id d27mr72479178ote.78.1577640675205; Sun, 29 Dec 2019 09:31:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577640675; cv=none; d=google.com; s=arc-20160816; b=Pt2qQrWWDP6POI1TcFBos2YlRnwsrMYeAi/lDdb9awwhGPKkRCsW0Us2TbIrZjuCLT Vw6EVkpOIObkWcg3yjqTvZpFG6KmSPKl2zEq5pQQHJ9fnY3rpj5V7FSdppU+2buhuFa0 1q3mDWjWXGgiYuan0h/HSahD8G8ceYiZDjlUbZ9bwBDzffJDXCIYymZkMPV0FgT4kZQE wdPmGIvZdNiOIq7nUxqKIa+j0OhzytTs6vRtw61I24zwQTRwpcWTp26wVDdaw6QQD3l/ lozC2B4TenuLOqhi+BHC/gxWkuhu912v28+Snkyg8QE8GmKuAl8+OJbhvajNPaFYqU1m Cq0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QmHfVVK8AjV5lIF6cY3SYjLlMC6Oh+Ib1JuGwMCp9Ng=; b=I1uHwPfWp6RT0L3VcViuL1krBAq7KOY7gh0vxmlxBYUefua9rCxKkO5DuinTNAqbex 4bIEeZL9YsdODVVjGhjlDklbmMpEB7GyTBNh3f7UxQHXvwnDQF9Z+IgSk3tj4fhmJ6Pu YWLtiRn2q9ZLWnYLqG4VuVc2yrQ2h28l2VH4WP57L2s64KR6V2sHqVCSSqNLRUIefDdM Sg0bVvosaYDOK8gF6biLtYZRENaMsuQcqfeCFP+jKL/lEz4vFdJfqhK8q7BBkBC5nXF1 aI8BiK3AlGwjOKUXH91TOQGWssOJSGYpr/C3ZYIOYWxORqMrwQO/TmQU4QNRu6rDu9ox xU9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YAc24KRs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d23si19965215oij.270.2019.12.29.09.31.14; Sun, 29 Dec 2019 09:31:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YAc24KRs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729122AbfL2RbO (ORCPT + 27 others); Sun, 29 Dec 2019 12:31:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:58078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729102AbfL2RbK (ORCPT ); Sun, 29 Dec 2019 12:31:10 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A150520409; Sun, 29 Dec 2019 17:31:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640670; bh=WHsWUyjkT6BtcW+ctw78vQlYzOCMH3wIY6zzM3e/Ubk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YAc24KRsGbBgdS6uIPt1PuyADBBuju5qVedlWe6wdij+1P8rk9VJ17d08BexqSyM9 OJB0ZgeRtE+cC31EOuj7aNqYyEcrTGs4kDKhi1ti1k4hFebBBjpRcc34pPhXWs1yf6 wteiBgCazhJZNZdHFo8GkmzT/Zjlaui7oXOrPGWQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 051/219] media: venus: Fix occasionally failures to suspend Date: Sun, 29 Dec 2019 18:17:33 +0100 Message-Id: <20191229162515.108617394@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stanimir Varbanov [ Upstream commit 8dbebb2bd01e6f36e9a215dcde99ace70408f2c8 ] Failure to suspend (venus_suspend_3xx) happens when the system is fresh booted and loading venus driver. This happens once and after reload the venus driver modules the problem disrepair. Fix the failure by skipping the check for WFI and IDLE bits if PC_READY is on in control status register. Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/qcom/venus/hfi_venus.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.20.1 diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index 124085556b94..fbcc67c10993 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -1484,6 +1484,7 @@ static int venus_suspend_3xx(struct venus_core *core) { struct venus_hfi_device *hdev = to_hfi_priv(core); struct device *dev = core->dev; + u32 ctrl_status; bool val; int ret; @@ -1499,6 +1500,10 @@ static int venus_suspend_3xx(struct venus_core *core) return -EINVAL; } + ctrl_status = venus_readl(hdev, CPU_CS_SCIACMDARG0); + if (ctrl_status & CPU_CS_SCIACMDARG0_PC_READY) + goto power_off; + /* * Power collapse sequence for Venus 3xx and 4xx versions: * 1. Check for ARM9 and video core to be idle by checking WFI bit @@ -1523,6 +1528,7 @@ static int venus_suspend_3xx(struct venus_core *core) if (ret) return ret; +power_off: mutex_lock(&hdev->lock); ret = venus_power_off(hdev);