Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1927772ybd; Sun, 23 Jun 2019 20:17:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjAIYzpXhVuaxXJVTKKpBUerLR2QeEhRRuOxdefiN8JpGOJ9B6v8OPCYx/DDAp6okIGECv X-Received: by 2002:a17:902:20c8:: with SMTP id v8mr9989541plg.284.1561346263979; Sun, 23 Jun 2019 20:17:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561346263; cv=none; d=google.com; s=arc-20160816; b=zsa0/Vn6pIJRHGuE6SHhl3CRbZ8nPHM7sJNDSzZlBXQLhP8xzEGWWN2iIMPVPb9QhQ ygWjQ+HrB2UhK8vgJ3tLtyKk3uIU1FQU3kp5kO19ad18VBBdnB0Yk4ESr8vFegwyKMCo S3BmjswSiCnYBD+Y+CbcBKhJg3VDjqpeaRY3JVkprpmz0xa6TJzcuF4Ckw0O5TXeS35v rFQn9oBwEV6QJkqZrS+tvG0SItDmMrZ3KwWQLnKSM5auyWqS3p3VgrE7ohaESUBWR6RR y+OYgygrkpPhg1oj0CPP7Vn79UeS/gR0oepyN4cf6R4mTowPczlfeRj6zi4niA2zdzra wE+g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KuK/HJBB+sabov/uStjAYnZLIz/87lFFGThs8FI3mQo=; b=b3bqcWkosHeXoIKfDxEW6/44NQVef2w86fU/UUaePcLIujRIJZBJweEmeDxNsDuRBm Gqyuo1E7I5FJTkR7SlqElhLW3MRq8QBNZ6U0SYSlqKaH4qWYUYPSZeecgAgunIScWVGt VBDs1ExZ5QqBuUdB716EJ97rOHNRED6iVrr0+SNKDnZQc/7vo3EfCpJZTYfNdfHgW5Rb eYxgzo8hYD+IgcKwy4DuWGRgZRNsBUlz1VPAdhb0eusAqWvxo7gJLdXK42GiuAADKSXH TD3nKePeCAUzJ3shi6mtVN9BWzEAfQRTNW9zPMpgoES6Wqdjr+P83pQK/dekXHynvbUC senA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ADKaGoys; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s15si6467917plr.115.2019.06.23.20.17.28; Sun, 23 Jun 2019 20:17:43 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=ADKaGoys; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727433AbfFXDRE (ORCPT + 99 others); Sun, 23 Jun 2019 23:17:04 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:45665 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726307AbfFXDRE (ORCPT ); Sun, 23 Jun 2019 23:17:04 -0400 Received: by mail-lj1-f196.google.com with SMTP id m23so11009176lje.12; Sun, 23 Jun 2019 20:17:02 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=KuK/HJBB+sabov/uStjAYnZLIz/87lFFGThs8FI3mQo=; b=ADKaGoys8uZe39G6vzOfMQxp52ANy6A8hq08yILdHzRwsJVTh+iQef/bZ0c7nOSR2g AGya6G9fkSdH5RxY+V2hNNkAWm6Wz7mQSGtpYlh6K6DcKTipdnO24viU0h37W5p/GZoo G+Xa3l7M30vhz8jLJBsgDfLfXZ1Vd74dhbSODGuaEYXX/XYe0ZyQ8fe96Mj8XozKbzL9 brIlGizU9frPWEfQ6XONvPJ5UFx8t0dOJ9sp/QktoVRpc9M1P5gghU45p1kAplBoUxng 48iancZgoiCC2wH8EBvGh5ln1UnY1Ld4ynmRtCFmmF4bpddAsss6Pn8dZ5VeakjnnKXY aFeQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=KuK/HJBB+sabov/uStjAYnZLIz/87lFFGThs8FI3mQo=; b=QX/X5Y6hAf4mNd+OAT9F5NFxcQH1bdwgEr35Rwnqcmx+dKbE6SapsPvyFXiLzR/6IP RSZDvKUncIRK3MQKqoc7ABeX4vleUtW9vgDh3kMe9oE9Oci66gCIm5T460gX3dquVEUC pNxFOXOp0dIGo9beU2qJnkq29YamrEBWuTwazT8pCP7EGwj19BCdrHkZYMkjYWff5rlw l9gxawyBfXz/buInfe8sF35xcCuww4KwQvYPJcfjD1vu+Won/yip09AdKVnWCzkLseNn V7p5RvM8UdcOr5P2N+Q8SpTyQUNjTRYm0OBAU95DVHc8SsDs2J8RYmrAYuV7leW6HQoU v+zg== X-Gm-Message-State: APjAAAUUqmXpIl0s4JDyN7AkVCjLgvezuRZwY530mIsWcN/8Ot1GNRfY FwQ8TP6VUwpwKGgn39gahw/tyXBa X-Received: by 2002:a2e:959a:: with SMTP id w26mr33411080ljh.150.1561326522191; Sun, 23 Jun 2019 14:48:42 -0700 (PDT) Received: from localhost.localdomain (ppp91-79-162-197.pppoe.mtu-net.ru. [91.79.162.197]) by smtp.gmail.com with ESMTPSA id m17sm1460029lfb.9.2019.06.23.14.48.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Jun 2019 14:48:41 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jonathan Hunter , Tomeu Vizoso Cc: linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 07/11] PM / devfreq: tegra30: Reset boosting if clock rate changed Date: Mon, 24 Jun 2019 00:46:54 +0300 Message-Id: <20190623214658.11680-8-digetx@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190623214658.11680-1-digetx@gmail.com> References: <20190623214658.11680-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is a situation when memory activity is going up, hence boosting up starts to happen, and then governor ramps memory clock rate up. In this case consecutive events may be stopped if new "COUNT" is within watermarks range, meanwhile old boosting value remains, which is plainly wrong and results in unneeded "go down" events after ramping up. In a result of this change unnecessary interrupts activity goes even lower. Signed-off-by: Dmitry Osipenko --- drivers/devfreq/tegra30-devfreq.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c index fc278f2f1b62..6fb3ca125438 100644 --- a/drivers/devfreq/tegra30-devfreq.c +++ b/drivers/devfreq/tegra30-devfreq.c @@ -631,6 +631,24 @@ static void tegra_actmon_stop(struct tegra_devfreq *tegra) tegra_actmon_stop_device(&tegra->devices[i]); } +static void tegra_actmon_stop_boosting(struct tegra_devfreq *tegra) +{ + struct tegra_devfreq_device *dev = tegra->devices; + unsigned int i; + u32 dev_ctrl; + + for (i = 0; i < ARRAY_SIZE(tegra->devices); i++, dev++) { + if (!dev->boost_freq) + continue; + + dev_ctrl = device_readl(dev, ACTMON_DEV_CTRL); + dev_ctrl &= ~ACTMON_DEV_CTRL_CONSECUTIVE_BELOW_WMARK_EN; + device_writel(dev, dev_ctrl, ACTMON_DEV_CTRL); + + dev->boost_freq = 0; + } +} + static int tegra_devfreq_target(struct device *dev, unsigned long *freq, u32 flags) { @@ -656,6 +674,16 @@ static int tegra_devfreq_target(struct device *dev, unsigned long *freq, if (err) goto restore_min_rate; + /* + * Hence boosting-up could be active at the moment of the rate-change + * and in this case boosting should be reset because it doesn't relate + * to the new state. If average won't follow shortly in a case of going + * UP, then clock rate will drop back on next update due to the missed + * boosting. + */ + if (rate != devfreq->previous_freq) + tegra_actmon_stop_boosting(tegra); + return 0; restore_min_rate: -- 2.22.0