Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13335596ybl; Sun, 29 Dec 2019 09:33:24 -0800 (PST) X-Google-Smtp-Source: APXvYqwHlPlq/ig3Dxth1t3NEVbZtza/052lrzbXUEFcgaebhAo0dk3wZzwzomICg97/hD9lU4fE X-Received: by 2002:a9d:768b:: with SMTP id j11mr69110696otl.116.1577640804248; Sun, 29 Dec 2019 09:33:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577640804; cv=none; d=google.com; s=arc-20160816; b=DT5OpqhByGprJSYZARvVUXbYlwIyJQ9TmQPYRSX6F6yDgS2QCawL2SSvatHBTdgZhZ wWnPtsKaKgbywuUL1u/nFdz29FjFXJJa7K9s0oAtKfzwna0iU3lg/joB6P6bXhozG0mR /nI/UNmPa6nkbAW1gZakHiBzsdZFCKpAgFJEMkGSKnI0D4o9sTzp8GV2MRw7Ncpe9F7B X6llK7vcsBRzUTjK9NJATw7iZJmoD5d7Ryzovclc0w2yQZghYgt70Ko82UneZOsPv/Um SEnvrIKDXXPLqB//8CmhDmX/fR0YnYFtmYp+W945o9nklMaIVJMgKa7QD07HsluwF5UV EWSQ== 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 i13si21299844otc.228.2019.12.29.09.33.13; Sun, 29 Dec 2019 09:33:24 -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 S1729119AbfL2RbN (ORCPT + 99 others); Sun, 29 Dec 2019 12:31:13 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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(+) 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); -- 2.20.1