Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7019785imu; Mon, 3 Dec 2018 06:34:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/XzLJvjq1/gELV6rQFVviIFgGg+9I7SfM19PyptBPNFzIBtgUaNyNvytw0zrgrDL+uWeTTj X-Received: by 2002:a62:3603:: with SMTP id d3mr16757425pfa.146.1543847644704; Mon, 03 Dec 2018 06:34:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543847644; cv=none; d=google.com; s=arc-20160816; b=GOBJTgNCWZWZIXuu8m0giJPYrVM99Ovffqd8d9h3LCtN1P4U7WQzZ00gnLp0xUG3uG ekIh+rSf8j3SvHgAZRFbEKjLITP1FZZWZpcaI0xfDl37JMDO0IYZ7VC6KQreApGQR6Ka br+Vx7L74ohhB+tymHS9rrJsWKbks+W8WPNLjoYaW/PQd1HRSkzz87qKiyb2ICV2FrKh A4HGzdZaDgBvSrpmV8V3nsAp3XbNcaUtHTDsGOxH6VuOA+yjPXOsT/dni+XHeI7mX4p8 prPLTT084A8bBNNmRHQdHfExY4CEShlykUClep4VaQmAUtCkssRCtSDN8bbTRaqXtFcS Z9PQ== 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:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=0I7yOkjnylKsWD3hf1wE4Adwd3h2KU4vdxpPqXXSlbk=; b=u982ReNmYkYmquYdvPRcLsQk34iogu3zHQ28apSx1oz5SLL28lrUAfzxLRnfyPgg6r 5Zp/kvJ/KZ7xVzGJ/n5tqw5ELvbXST0acS0dYuLXIH/PTGqHwPX8xmQ6iHHlXeFWGEab RDWI+/G4w1nF3MuKjqgNsdmXb3VNJudNjl9mVqw0pF+fBnqGGDmI0AJrlkEbx+r+L8e4 /GVqLVjkAZRvvcEKFpd5bkXVOqcChCB8j9udFd0oLLW1HNxnJuMm5cNv+z7Rgp9iJjaM BZyrJNW4smsB15q/fn7Wc5rzwIyATU5BPzOmiHkss0mUcUdXGiWHZ7icBg+1Fknb3TaV 22sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=gBw7ripb; 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=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 d1si12728516pgg.301.2018.12.03.06.33.50; Mon, 03 Dec 2018 06:34:04 -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=@samsung.com header.s=mail20170921 header.b=gBw7ripb; 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=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726683AbeLCOcu (ORCPT + 99 others); Mon, 3 Dec 2018 09:32:50 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:60128 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726670AbeLCOct (ORCPT ); Mon, 3 Dec 2018 09:32:49 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181203143134euoutp01a00fa7bd1d7481f216dfe7f251d55d94~s2R3zSEqj1381713817euoutp01Y for ; Mon, 3 Dec 2018 14:31:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181203143134euoutp01a00fa7bd1d7481f216dfe7f251d55d94~s2R3zSEqj1381713817euoutp01Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1543847494; bh=0I7yOkjnylKsWD3hf1wE4Adwd3h2KU4vdxpPqXXSlbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gBw7ripbkIJX7mONdqguBPTuhGNS5dMbc+FmRh6cMu7JNtAL2SP7vKHj6trlwaNZ/ 0ZK2Q1zCDgf3YofUdIb64sfS3yqZxDYa86nAFWm/Bi3SsBJnKdHL6jFTqiIw+McD+C bUt8/AdqM3uy3MlIwDNc/zkIrTJ8zCRKIKQU62xU= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181203143133eucas1p25f169b6fbd4bf3b2925e6fa6f17c7cbf~s2R2po8KE0427504275eucas1p2k; Mon, 3 Dec 2018 14:31:33 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 1E.CA.04441.54E350C5; Mon, 3 Dec 2018 14:31:33 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181203143132eucas1p128c029a7c7461e1127924a08e4a71811~s2R14QSqb1910119101eucas1p1-; Mon, 3 Dec 2018 14:31:32 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181203143132eusmtrp141134970a039111c121a4698eb845a61~s2R1iRyhb1676416764eusmtrp1A; Mon, 3 Dec 2018 14:31:32 +0000 (GMT) X-AuditID: cbfec7f2-5c9ff70000001159-b2-5c053e45d853 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id A2.43.04284.44E350C5; Mon, 3 Dec 2018 14:31:32 +0000 (GMT) Received: from AMDC3778.DIGITAL.local (unknown [106.120.51.20]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181203143131eusmtip282e19bf102766be513b751a76b8cc1af~s2R0mXo4L0581705817eusmtip28; Mon, 3 Dec 2018 14:31:31 +0000 (GMT) From: Lukasz Luba To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org Cc: tjakobi@math.uni-bielefeld.de, myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, rjw@rjwysocki.net, len.brown@intel.com, pavel@ucw.cz, gregkh@linuxfoundation.org, keescook@chromium.org, anton@enomsg.org, ccross@android.com, tony.luck@intel.com, robh+dt@kernel.org, mark.rutland@arm.com, kgene@kernel.org, krzk@kernel.org, m.szyprowski@samsung.com, b.zolnierkie@samsung.com, Lukasz Luba Subject: [PATCH v2 3/5] devfreq: add devfreq_suspend/resume() functions Date: Mon, 3 Dec 2018 15:31:13 +0100 Message-Id: <1543847475-7600-4-git-send-email-l.luba@partner.samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543847475-7600-1-git-send-email-l.luba@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSe1BMYRjGfedeWk5bo9d97AxThtSMxjcYt3E5+MNlDDNkWHWmol21RxFm bEwh1RrXwqJC2ZbV2tZOipFNEXZbl5BcBtMQosg9djvhv9/7vM/zPjPffByp7KQHcAnadaJO q05UMf6U/do31+gZk+joiM4awFfKw3BZnoXGF8o6adz4qYXGx5y3abytyMLgm7s02PCilcQu 1zkW39r6lsWP9IPwoX1VBLa+uE/jOxVHGNyR40Q4z3WJwGeczSw+2dhA4Kb0EgY336jx3qj3 0DijysnizNIPNH7rfkJNAcF+0U4L5qNmJBzWN1DCbkM7EooqXxOC1bSTES4bzaxw/sQWoesa K1x5X0kItnvbKSHXZkJCSekXVuiwDpnfZ6n/xFgxMSFV1I2ZtNI//nDxD5RUG7LB3vSd1qPH QVnIjwN+L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vYzZy38zFhwXr9h2+xdrA+Md4S5GTg4JAROJqVPXsHQx cnEICSxllLi+oZ8dIiEmMWnfdihbWOLPtS42iKJPjBKv/u4B6uDgYBPQk9ixqhAkLiKwnFHi /s/Z7CAOs8ADZomO55tYQbqFBdwl9v69zQhiswioSszsW88I0swr4Clx81c4xAI5iZvnOplB bE4BL4kpK+aD2UJAJS17VzBPYORbwMiwilEktbQ4Nz232FCvODG3uDQvXS85P3cTIzBetx37 uXkH46WNwYcYBTgYlXh4HeJZYoRYE8uKK3MPMUpwMCuJ8BYUAoV4UxIrq1KL8uOLSnNSiw8x mgLdNJFZSjQ5H5hK8kriDU0NzS0sDc2NzY3NLJTEec8bVEYJCaQnlqRmp6YWpBbB9DFxcEo1 ME55XuO+U+lnUdG11852XUf5JR6fVbRjOnfh8z/hl4/SJlU/nJCRKHFm380Xls3PVa/evuCk 89miyP76x0jNWPXPpw9nXakUuSw/6bJLUM6tZZ0TN5k7eRY71rSc/rJW+ADP/SOdJ+zV/x4+ zN8xKUn9susRPuFlm0QZJnY1873q+t+e1lH0rkmJpTgj0VCLuag4EQC1+Oc57QIAAA== X-CMS-MailID: 20181203143132eucas1p128c029a7c7461e1127924a08e4a71811 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20181203143132eucas1p128c029a7c7461e1127924a08e4a71811 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181203143132eucas1p128c029a7c7461e1127924a08e4a71811 References: <1543847475-7600-1-git-send-email-l.luba@partner.samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds implementation for global suspend/resume for devfreq framework. System suspend will next use these functions. The patch is based on earlier work by Tobias Jakobi. Suggested-by: Tobias Jakobi Suggested-by: Chanwoo Choi Signed-off-by: Lukasz Luba --- drivers/devfreq/devfreq.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/linux/devfreq.h | 6 ++++++ 2 files changed, 48 insertions(+) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 36bed24..7d60423 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -935,6 +935,48 @@ int devfreq_resume_device(struct devfreq *devfreq) EXPORT_SYMBOL(devfreq_resume_device); /** + * devfreq_suspend() - Suspend devfreq governors and devices + * + * Called during system wide Suspend/Hibernate cycles for suspending governors + * and devices preserving the state for resume. On some platforms the devfreq + * device must have precise state (frequency) after resume in order to provide + * fully operating setup. + */ +void devfreq_suspend(void) +{ + struct devfreq *devfreq; + int ret; + + mutex_lock(&devfreq_list_lock); + list_for_each_entry(devfreq, &devfreq_list, node) { + ret = devfreq_suspend_device(devfreq); + if (ret) + dev_warn(&devfreq->dev, "device suspend failed\n"); + } + mutex_unlock(&devfreq_list_lock); +} + +/** + * devfreq_resume() - Resume devfreq governors and devices + * + * Called during system wide Suspend/Hibernate cycle for resuming governors and + * devices that are suspended with devfreq_suspend(). + */ +void devfreq_resume(void) +{ + struct devfreq *devfreq; + int ret; + + mutex_lock(&devfreq_list_lock); + list_for_each_entry(devfreq, &devfreq_list, node) { + ret = devfreq_resume_device(devfreq); + if (ret) + dev_warn(&devfreq->dev, "device resume failed\n"); + } + mutex_unlock(&devfreq_list_lock); +} + +/** * devfreq_add_governor() - Add devfreq governor * @governor: the devfreq governor to be added */ diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index d985199..fbffa74 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -205,6 +205,9 @@ extern void devm_devfreq_remove_device(struct device *dev, extern int devfreq_suspend_device(struct devfreq *devfreq); extern int devfreq_resume_device(struct devfreq *devfreq); +extern void devfreq_suspend(void); +extern void devfreq_resume(void); + /** * update_devfreq() - Reevaluate the device and configure frequency * @devfreq: the devfreq device @@ -331,6 +334,9 @@ static inline int devfreq_resume_device(struct devfreq *devfreq) return 0; } +static inline void devfreq_suspend(void) {} +static inline void devfreq_resume(void) {} + static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq, u32 flags) { -- 2.7.4