Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4664662iob; Sun, 8 May 2022 21:08:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzW3AYZT2CvomOWWgWye1tmFW2bXweIcJZaQKlEnKbjf/bkX6+KakSQcp5R6pTWI6hbCYjU X-Received: by 2002:a05:6a00:1a89:b0:50d:fee4:cdb1 with SMTP id e9-20020a056a001a8900b0050dfee4cdb1mr14435799pfv.85.1652069313164; Sun, 08 May 2022 21:08:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652069313; cv=none; d=google.com; s=arc-20160816; b=ZhU3HzHNyyWJUu802eN1PyqPCMMzAkOMjOcn3KUslI0Ox7LBI9dwmDMXGMxS8v9mFS 5k5T0ZIpmvejufCaXB/KWoy8tXE326IcrL1xaa5shZlv1Dlr9GVtVrMaYrrefj6Qi6E4 Y18EOczkfciVA9OfVQKf82Dz4gCEeSUNvoNK+HDqE0+T2uK6EKQOet/xFaWVeUHSVnsf M/VDQ7jJxA2qx0vXtXTo555zVrubTgeXmSPAq5s10+JizJ4XzW/wlwyzDKcWBOfStBWm HEbWVs8NWtCLnGn1YUSnrF4Kgd1w++YCKGxkZAqEZ6Z38Sb4ts4AjB5v0Tzi5dDPCGvS TW8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8S2Ee/r4gdu8szylQWKNq1eYo0gsqwwKtcV/b5eUXQk=; b=ETLLn6YJ8PCQvopIfo7K1bdvUU5CRPNcGSBhwqtAhTmzAHJcyfxZkDEKlJgeJJMgmU 9iQCdgDqcngJqv2cMd31eUljquP2IqBBHRN8QP9fhoGFbBZfGkHKPNRStL5kzlIYeLwg +ZtmkZexY3UATfvzqwE71B0OT7Vumq4sCYmssXbTFcCAVO+mOokoYo1BoaGoqLCdT8i7 JDtf5a1l7EFMZLTsapykbqqUJywTQca42a76V0itHAJ5+KKsS05PtIhHm9soQ92q3irb qjvohrURcntLnBtupkOq/Gi1skFcm/2pliLhwyyCO9PM5oxpEUiDENS3ejgRwAUOFIbg YO4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WO2s8Nhi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c4-20020a056a000ac400b0050dd2797010si13616244pfl.321.2022.05.08.21.08.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 21:08:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WO2s8Nhi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6B4A5954BD; Sun, 8 May 2022 21:06:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446579AbiEGPGH (ORCPT + 99 others); Sat, 7 May 2022 11:06:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446582AbiEGPGC (ORCPT ); Sat, 7 May 2022 11:06:02 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E31345ADA; Sat, 7 May 2022 08:02:11 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id p12so8648583pfn.0; Sat, 07 May 2022 08:02:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8S2Ee/r4gdu8szylQWKNq1eYo0gsqwwKtcV/b5eUXQk=; b=WO2s8NhiV9YPSglSonwtbrQzbnmw2d1x+XbJXFiPdeEBcNXIdqqc/5eybtaqtUxVLb jjfenTFQuY0rRqyta56BStnCdEjYzasC3/C2LWYMNSo07kPjYlcUXHJJ6obqK0WvtSmL Jz/IqDoK8dZL07vEWaSHK6yFadd1vuT0dI1vYunMg5wEPItzyMEzuorlRF3KJdtwy7RM QUWmtRDQQZdX8+o/0Qc/dHOAqtVl5ub8PJ0NvRpSxk+HhJrEpltQIeRHKWR8Z60jFwLu I4Pq3yEshPLQ0IrWP/gwJ0gZOokfdhMU3nso4rkfQlELvVCAwq0mKgluwU47w1Izy89S fzJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8S2Ee/r4gdu8szylQWKNq1eYo0gsqwwKtcV/b5eUXQk=; b=KEw8hjML/2y9PZx+IFb8pJ934pydRDMljTH2l6w8refU28dlGFMY0fgvmXakIufl/q RBial7Jog9kUIc2CQ4ut1mLa/nYF3CXGQUMDmtFZn7E0OrqLNQqI9zkKr8Q4rB4tWTlQ oooDVTlF/zMtRBARZ6UiYY3leajih3l/VAMimrsQJ2YswWqGOBVyM+0DtU3QYYzx/vpF Jn9ghNaFXAwUpnMva1y1NJ1ARYQqWn8AI9RFovc0tKtIHdv6qakUSmVfdeg912gO3ghw wmMT9IpxPsDDmCwGYGQp9Drfmn+O8MSUEYy5qFFpTB0uwMHsjduqyD1mTdIrKwQ9XCWz qcmQ== X-Gm-Message-State: AOAM532NoYEQ7iJm+O7BcHIcKOEYAA6ptxBC8OaMkzAlYShT8vHEPnGD ThQuNAQ7TxjzgO4lm7xgIGm9bCTXp3+nAw== X-Received: by 2002:a05:6a00:b8b:b0:50d:6080:6be7 with SMTP id g11-20020a056a000b8b00b0050d60806be7mr8408789pfj.56.1651935730651; Sat, 07 May 2022 08:02:10 -0700 (PDT) Received: from localhost.localdomain ([14.32.163.5]) by smtp.gmail.com with ESMTPSA id v21-20020a170902ca9500b0015e8d4eb2a8sm3711007pld.242.2022.05.07.08.02.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 08:02:10 -0700 (PDT) From: Chanwoo Choi X-Google-Original-From: Chanwoo Choi To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: cw00.choi@samsung.com, myungjoo.ham@samsung.com, kyungmin.park@samsung.com, johnson.wang@mediatek.com, mka@chromium.org, jia-wei.chang@mediatek.com, andrew-sh.cheng@mediatek.com, hsinyi@chromium.org, sibis@codeaurora.org, saravanak@google.com Subject: [PATCH v2 5/5] PM / devfreq: passive: Update frequency when start governor Date: Sun, 8 May 2022 00:01:45 +0900 Message-Id: <20220507150145.531864-6-cw00.choi@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220507150145.531864-1-cw00.choi@samsung.com> References: <20220507150145.531864-1-cw00.choi@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the parent device changes the their frequency before registering the passive device, the passive device cannot receive the notification from parent device and then the passive device cannot be able to set the proper frequency according to the frequency of parent device. So, when start the passive governor, update the frequency according to the frequency of parent device. Signed-off-by: Chanwoo Choi --- drivers/devfreq/governor_passive.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_passive.c index b34dbe750c0a..74d26c193fdb 100644 --- a/drivers/devfreq/governor_passive.c +++ b/drivers/devfreq/governor_passive.c @@ -412,6 +412,23 @@ static int devfreq_passive_event_handler(struct devfreq *devfreq, if (!p_data->this) p_data->this = devfreq; + /* + * If the parent device changes the their frequency before + * registering the passive device, the passive device cannot + * receive the notification from parent device and then the + * passive device cannot be able to set the proper frequency + * according to the frequency of parent device. + * + * When start the passive governor, update the frequency + * according to the frequency of parent device. + */ + mutex_lock(&devfreq->lock); + ret = devfreq_update_target(devfreq, parent->previous_freq); + if (ret < 0) + dev_warn(&devfreq->dev, + "failed to update devfreq using passive governor\n"); + mutex_unlock(&devfreq->lock); + if (p_data->parent_type == DEVFREQ_PARENT_DEV) ret = devfreq_passive_register_notifier(devfreq); else if (p_data->parent_type == CPUFREQ_PARENT_DEV) -- 2.25.1