From patchwork Fri Jan 25 13:54:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 156575 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp385472jaa; Fri, 25 Jan 2019 05:54:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN5L2U8Bhu/qYjxcaSiIeE605eI/4t6NtzHqaI4rhooLwPSDEBSQ1mTvEvoDo0S692R957Ix X-Received: by 2002:a17:902:e290:: with SMTP id cf16mr11316932plb.81.1548424459801; Fri, 25 Jan 2019 05:54:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548424459; cv=none; d=google.com; s=arc-20160816; b=z3deJzKSplmpF/H5SPAHSZu7DQuP1f7m8cIcsjV9cmqXXrmLhR1gf69s1TwhonPFCA C6ayv9MCawujuU4J7fqD/Fs/Of3bg2WLpKABEUCXM1+BZZ4yNwl7O+53OTy4DZ+Xvc6H 1MDpwjYZGcYqQE9U7LEGOKUw7d3iZElFDb7wEcgyk+o6TN0buIWXCybKjZFNgBBYDeXw zd6dqfyg5B1LOQ75+RNCJBvi0vcALBRM2lwxz2kTMHbZb7cUgoLuvKeSsmOukjafT/mI FtRLSnJd7TX0HZRDsvS8/NQTBIBrGHSYThsfQmeQuwMaxcokXE2CO3d31Ens5BSDJt7a ZHMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=jWw/l4QLnjeXzLowJnTJlB0lCENMN4uoWKH1dHHjzMA=; b=VujZErkZlDe8Vt/cEKJ320j8j87BD7ht6AEmRyW865ORNW9ptf23S3fGvsHEp+Fx2p vdWymSbBY93umby72fhfyB9cAG9c1Rzvm0tsRDS0EUWP63zvk1FJFJK55JLO6loeg3RR HlFrvD1n2w5P+LhDz2HHjqYUjaNURTc9Q666EUWdkPUGXV8gxrS6CdzP376OU7z7RP11 LA0YWJLx/O5QtLwAhEzbGd6fGCiAa8RpMabOGLSe+WDOPGp/3V48xRa6UhZKupFYqVs1 F0yfrOAKXtuY993bulwSdn+9EOWCKkzEL6pEEzWpYSDR3qzF+z00Kpm8NGsquljd/zQJ 20Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kToesyks; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si10419763pgm.154.2019.01.25.05.54.19; Fri, 25 Jan 2019 05:54:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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=@samsung.com header.s=mail20170921 header.b=kToesyks; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726216AbfAYNyT (ORCPT + 3 others); Fri, 25 Jan 2019 08:54:19 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:42157 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726108AbfAYNyS (ORCPT ); Fri, 25 Jan 2019 08:54:18 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190125135415euoutp0186c0e5aa1f44b307da90cf555ee7cd45~9G9as7hCM2639226392euoutp01x; Fri, 25 Jan 2019 13:54:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190125135415euoutp0186c0e5aa1f44b307da90cf555ee7cd45~9G9as7hCM2639226392euoutp01x DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1548424455; bh=jWw/l4QLnjeXzLowJnTJlB0lCENMN4uoWKH1dHHjzMA=; h=From:To:Cc:Subject:Date:References:From; b=kToesyksiQ+1G/7QohxpLcYOrYWYp0/zOqZhl2mu5DaAjZielVsBi9KlItYWePT7d VODLk14cNueazWe0iQ0kDNict+iM1MdNNwszcPS6jTvVspLPls0TfjshIke2AInV7J ohISyqeiOuQgZds2Cp1vFOdGSvZqIB39HOQP4JDc= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190125135414eucas1p15178f2d37fcb8650184986641374ac2d~9G9Z9d4sD0209302093eucas1p1i; Fri, 25 Jan 2019 13:54:14 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 1B.02.04441.6051B4C5; Fri, 25 Jan 2019 13:54:14 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190125135414eucas1p2ffc71c63f1a27f67d076dec889954b40~9G9ZSKu2o1260312603eucas1p2v; Fri, 25 Jan 2019 13:54:14 +0000 (GMT) X-AuditID: cbfec7f2-5c9ff70000001159-c0-5c4b150637c3 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 22.D0.04284.6051B4C5; Fri, 25 Jan 2019 13:54:14 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PLW00JUW3Y9R020@eusync3.samsung.com>; Fri, 25 Jan 2019 13:54:14 +0000 (GMT) From: Marek Szyprowski To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , MyungJoo Ham , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Lukasz Luba , Markus Reichl Subject: [PATCH] devfreq: Suspend all devices on system shutdown Date: Fri, 25 Jan 2019 14:54:03 +0100 Message-id: <20190125135403.10228-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAIsWRmVeSWpSXmKPExsWy7djP87psot4xBh+eqVhsnLGe1eL6l+es FufPb2C3uNUgY3F51xw2i8+9RxgtZpzfx2Tx8sgPRou1R+6yW9xuXMHmwOVx6069x6ZVnWwe B9/tYfLo27KK0ePzJrkA1igum5TUnMyy1CJ9uwSujCnd/xgLPnJX3L74kqWB8S9nFyMnh4SA icTGZx9Zuhi5OIQEVjBKTJywBsr5zCixctE2VpiqV13vmSASyxglbh5bywjhNDBJzLv+khmk ik3AUKLrbRcbiC0iEC9x/c8xsFHMAluZJLpb54AVCQs4SKz9sgTMZhFQlVjbd5MFxOYVsJXo XnWHGWKdvMTqDQeYQZolBBrZJOZeuMcIkXCRmDxpC5QtI9HZcZAJoqiZUaJ9xix2CKeHUWLr nB1sEFXWEoePXwT7glmAT2LStulAYzmA4rwSHW1CECUeEs83XwfbLCQQK/H7YhPzBEbxBYwM qxjFU0uLc9NTiw3zUsv1ihNzi0vz0vWS83M3MQLj7fS/4592MH69lHSIUYCDUYmHd4Ogd4wQ a2JZcWXuIUYJDmYlEV5OAaAQb0piZVVqUX58UWlOavEhRmkOFiVx3mqGB9FCAumJJanZqakF qUUwWSYOTqkGRslHgXdXWR3L3iWpm3FiYv80XpblWxvfr2a+84XBvoLrYfFtdmu59RlPPv7s WzZ7i5Jt29xJaW9DoxQONb1j+xt1cefXqHY14ZZLS9kV0wMvpArr+B/R/Wh0crbsBbuLrWl9 mo/k5b/Pjbfi0lkgo2D1dcqh8y2F6jNX/F3JX/nKft+dq0qq5UosxRmJhlrMRcWJAPA5+WWz AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDJMWRmVeSWpSXmKPExsVy+t/xq7psot4xBqtesVtsnLGe1eL6l+es FufPb2C3uNUgY3F51xw2i8+9RxgtZpzfx2Tx8sgPRou1R+6yW9xuXMHmwOVx6069x6ZVnWwe B9/tYfLo27KK0ePzJrkA1igum5TUnMyy1CJ9uwSujCnd/xgLPnJX3L74kqWB8S9nFyMnh4SA icSrrvdMXYxcHEICSxglnr9YxgLhNDFJrH9wiB2kik3AUKLrbRdbFyMHh4hAvMTJabUgNcwC 25kk9j79wARSIyzgILH2yxJmEJtFQFVibd9NFhCbV8BWonvVHWaIbfISqzccYJ7AyLWAkWEV o0hqaXFuem6xoV5xYm5xaV66XnJ+7iZGYJhsO/Zz8w7GSxuDDzEKcDAq8fBG8HvHCLEmlhVX 5h5ilOBgVhLh5RQACvGmJFZWpRblxxeV5qQWH2KU5mBREuc9b1AZJSSQnliSmp2aWpBaBJNl 4uCUamBU+/wxr9zt4uaiDQdDF5/0vL1YJiTW/4C062WJVWwfVL+eSU9fk+kluy5nKePO4HW/ Ob2KindEye98WHK04Jv1GZPb2sf/h6R+bbRlF4zoSA63eaX8Psz9cENb7N19rZlL/pssfv/T 3j65yuJf3AOhfL5Sl5Xl3+ZqsD7/kllx3JfpTTC71BklluKMREMt5qLiRABZLXIaDwIAAA== X-CMS-MailID: 20190125135414eucas1p2ffc71c63f1a27f67d076dec889954b40 CMS-TYPE: 201P X-CMS-RootMailID: 20190125135414eucas1p2ffc71c63f1a27f67d076dec889954b40 References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org This way devfreq core ensures that all its devices will be set to safe operation points before reboot operation. There are board on which some aggressive power saving operation points are behind the capabilities of the bootloader to properly reset the hardware and boot the board. This way one can avoid board crash early after reboot. Similar pattern is used in CPUfreq subsystem. Reported-by: Markus Reichl Signed-off-by: Marek Szyprowski --- drivers/devfreq/devfreq.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.17.1 diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 0ae3de76833b..f6aba8344c56 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -1422,6 +1423,10 @@ static struct attribute *devfreq_attrs[] = { }; ATTRIBUTE_GROUPS(devfreq); +static struct syscore_ops devfreq_syscore_ops = { + .shutdown = devfreq_suspend, +}; + static int __init devfreq_init(void) { devfreq_class = class_create(THIS_MODULE, "devfreq"); @@ -1438,6 +1443,8 @@ static int __init devfreq_init(void) } devfreq_class->dev_groups = devfreq_groups; + register_syscore_ops(&devfreq_syscore_ops); + return 0; } subsys_initcall(devfreq_init);