From patchwork Mon Dec 19 02:16:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Jakobi X-Patchwork-Id: 9479587 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 828F960836 for ; Mon, 19 Dec 2016 02:17:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7290C2845B for ; Mon, 19 Dec 2016 02:17:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67BDC28468; Mon, 19 Dec 2016 02:17:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 013082845B for ; Mon, 19 Dec 2016 02:17:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762092AbcLSCQ5 (ORCPT ); Sun, 18 Dec 2016 21:16:57 -0500 Received: from smtp.math.uni-bielefeld.de ([129.70.45.10]:43811 "EHLO smtp.math.uni-bielefeld.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760159AbcLSCQu (ORCPT ); Sun, 18 Dec 2016 21:16:50 -0500 Received: from chidori.lan (unknown [5.146.177.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by smtp.math.uni-bielefeld.de (Postfix) with ESMTPSA id 668CD5F85C; Mon, 19 Dec 2016 03:16:46 +0100 (CET) From: Tobias Jakobi To: linux-samsung-soc@vger.kernel.org Cc: linux-pm@vger.kernel.org, m.reichl@fivetechno.de, myungjoo.ham@gmail.com, cw00.choi@samsung.com, Tobias Jakobi Subject: [RFC v2 2/7] PM / devfreq: Track suspend state of DevFreq devices Date: Mon, 19 Dec 2016 03:16:22 +0100 Message-Id: <1482113787-28422-3-git-send-email-tjakobi@math.uni-bielefeld.de> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1482113787-28422-1-git-send-email-tjakobi@math.uni-bielefeld.de> References: <1482113787-28422-1-git-send-email-tjakobi@math.uni-bielefeld.de> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In preparation to suspend the whole DevFreq subsystem. Signed-off-by: Tobias Jakobi --- drivers/devfreq/devfreq.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 82d8052..3904ebc 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -30,6 +30,8 @@ enum devfreq_flag_bits { DEVFREQ_BIT_STOP_POLLING, + /* Bit set if DevFreq device was suspended in devfreq_suspend_device(). */ + DEVFREQ_BIT_SUSPENDED, }; static struct class *devfreq_class; @@ -822,14 +824,21 @@ EXPORT_SYMBOL(devfreq_turbo_put); */ int devfreq_suspend_device(struct devfreq *devfreq) { + int ret; + if (!devfreq) return -EINVAL; if (!devfreq->governor) return 0; - return devfreq->governor->event_handler(devfreq, + ret = devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_SUSPEND, NULL); + + if (ret == 0) + __set_bit(DEVFREQ_BIT_SUSPENDED, &devfreq->flags); + + return ret; } EXPORT_SYMBOL(devfreq_suspend_device); @@ -843,14 +852,21 @@ EXPORT_SYMBOL(devfreq_suspend_device); */ int devfreq_resume_device(struct devfreq *devfreq) { + int ret; + if (!devfreq) return -EINVAL; if (!devfreq->governor) return 0; - return devfreq->governor->event_handler(devfreq, + ret = devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_RESUME, NULL); + + if (ret == 0) + __clear_bit(DEVFREQ_BIT_SUSPENDED, &devfreq->flags); + + return ret; } EXPORT_SYMBOL(devfreq_resume_device);