Received: by 2002:a05:6a10:87d6:0:0:0:0 with SMTP id g22csp443167pxr; Sun, 10 Apr 2022 20:29:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3C0KP2OpCxvpnYHmIBaLwKRJn7vpo4bV0lnRk+0isLm7f4qaRPHPzjn/Yf3nCziySg0fz X-Received: by 2002:a17:902:a581:b0:154:8c7d:736a with SMTP id az1-20020a170902a58100b001548c7d736amr30628729plb.74.1649647785007; Sun, 10 Apr 2022 20:29:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649647785; cv=none; d=google.com; s=arc-20160816; b=wVCQvPX3KlTLeCVXRMtpURykJK5vFAGfw4p+eUHF7BxBUPC/kAsEgFc6qCwHGL+plO ZNQhND7wg2PbGCOBxzirU2nGqw1yiTt31NGu3mGOogmM85HsGbBqmeuR63u0wmO1bt1/ popJ7vl7R7T2C86j7FudHSrjpUDEGG3SKJJirLTbUc/l1du3IgyZRgCI/oQXI/5AfKKR +IDs6DWLm+n2czcuWNzYEydxD8svTT8h6Qm+5LD9JSvYF8+TjV5lVhYUOCred9qIko2E nu0cYoHDiFJMoVkvICl2aEZARJEblUukJDZgtAqiaNRtUoA02lqDCtuXiS3gIj/jwWmC z3Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=HD9KWxYgHovL4d+swYpmuaTcGaPIaYm36t/rSV4RSvg=; b=B4hXAH/ncSIKYO7lClvkf4FyHhI0/rk6WEqRTslgxwI4T28d0tqd9E31DtDPZpqOlv eBjC/WsHdYTxdEonhAXuFNZ7osywCBgt89ZGkKE2k3nbuFT8Amscnbui9w7h4LpWWb1P 4a6Zl7K+BWJBj673aZb5ueU+kLhhVWkT0D86oM+VAPwDGWwsYg/BggZcvsECcWhbX5Et zJY/yVBl+WMdz903gSQse3dWaFcdP3t6hqawC8Dk+9vcd2Y2EafY/ILbwnLltitlWYYk S2c1t62NRPFMVhoR3Os0KrlJoLn93HXUmPj5kXGoiVECr0asap574EMxV0TuenO5bGA5 CmaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=Q0KeoqDn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p18-20020a056a000b5200b00505a180d869si5485944pfo.19.2022.04.10.20.29.30; Sun, 10 Apr 2022 20:29:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=Q0KeoqDn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239476AbiDHUbS (ORCPT + 99 others); Fri, 8 Apr 2022 16:31:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234377AbiDHUbQ (ORCPT ); Fri, 8 Apr 2022 16:31:16 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30DD51DA8C2 for ; Fri, 8 Apr 2022 13:29:12 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id q36-20020a17090a17a700b001cb57a8da1cso1008110pja.0 for ; Fri, 08 Apr 2022 13:29:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=HD9KWxYgHovL4d+swYpmuaTcGaPIaYm36t/rSV4RSvg=; b=Q0KeoqDnCa8t9t7sVZPbYG3qKLWKWSwjPdVPsqLNyYAIkNInfvFrnib1WBJF0cFwPV cS88dBGtsAWScifpLSaO+kVpUGO8xGswNZgPNdhGOFmClE5dE1T/mSRm+cmRZvX03LET vP9besdhVUGIMppcb/yOkqKHoE8YUfnOTbgL48zbFm+MKrKJlL59Z62zG0lP5qZKbd8C P8ZQUoDvx7UGRpcUIa7VokvDC02Y2wGLGOTj7/BGPLKFLWg/j4a4j3DqqtljU//u7sps iKvkuYkzerCCmTAseaxt4wrz8EffCcexE6DaU0McLwY4AdgJaXXMFUzw3XUhZEHLN3IZ sYwQ== 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:in-reply-to:references:date :message-id:mime-version; bh=HD9KWxYgHovL4d+swYpmuaTcGaPIaYm36t/rSV4RSvg=; b=jCqcMlbyiVA/0/QIpHcvjsnG0OICjUQhTFkO9dkslYkCF9NNu8XQEtxZ5PrNCL7gm1 NLyf7UorHQE780c01KKGiUysLDgiiM6Se1JiDGXF0OFqND+PvhV4miHo470Du2G3TJvf 33V+y83oNzSu6AOnPQcZAyR7ROV97Gz5KfyUEkXX2TAHRlcB4uwfiUEkTBuqGm4Cpn5h C/+HTOAuUiy60mt91c4W0yGn7w3VrRVMC3PEhogPE4LMUoFFXC5HsdrGWl7cdJrFTHiO 1LLFl5Iyh+noRt/zxU3xl/XGLykzXiJNBOBAHPsD49uzVuevzgTQE9zky66vvsrIud1M NJAg== X-Gm-Message-State: AOAM533sFV2mD4F2CmwT5APYrTm2hKIK6KF96rSpa+w2iIPLUUWfn/II x2C5SVwQQJtzVSywAV2YQv+NHQ== X-Received: by 2002:a17:90b:4f8e:b0:1c7:3652:21bc with SMTP id qe14-20020a17090b4f8e00b001c7365221bcmr23626082pjb.38.1649449751645; Fri, 08 Apr 2022 13:29:11 -0700 (PDT) Received: from localhost (c-71-197-186-152.hsd1.wa.comcast.net. [71.197.186.152]) by smtp.gmail.com with ESMTPSA id x8-20020aa784c8000000b0050577c51d38sm3849034pfn.20.2022.04.08.13.29.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 13:29:11 -0700 (PDT) From: Kevin Hilman To: Rex-BC Chen , rafael@kernel.org, viresh.kumar@linaro.org, robh+dt@kernel.org, krzk+dt@kernel.org Cc: matthias.bgg@gmail.com, jia-wei.chang@mediatek.com, roger.lu@mediatek.com, hsinyi@google.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Project_Global_Chrome_Upstream_Group@mediatek.com, "Andrew-sh.Cheng" , Rex-BC Chen Subject: Re: [PATCH V2 07/15] cpufreq: mediatek: Add opp notification for SVS support In-Reply-To: <20220408045908.21671-8-rex-bc.chen@mediatek.com> References: <20220408045908.21671-1-rex-bc.chen@mediatek.com> <20220408045908.21671-8-rex-bc.chen@mediatek.com> Date: Fri, 08 Apr 2022 13:29:10 -0700 Message-ID: <7hsfqn5nft.fsf@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 Rex-BC Chen writes: > From: "Andrew-sh.Cheng" > > The Smart Voltage Scaling (SVS) is a hardware which calculates suitable > SVS bank voltages to OPP voltage table. > > When the SVS is enabled, cpufreq should listen to opp notification and do > proper actions when receiving events of disable and voltage adjustment. So listenting for OPP notifications should be done only when SVS is enabled... [...] > static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) > { > struct device *cpu_dev; > @@ -392,6 +455,17 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) > info->intermediate_voltage = dev_pm_opp_get_voltage(opp); > dev_pm_opp_put(opp); > > + info->opp_cpu = cpu; > + info->opp_nb.notifier_call = mtk_cpufreq_opp_notifier; > + ret = dev_pm_opp_register_notifier(cpu_dev, &info->opp_nb); ...but here youlisten to OPP notifications unconditionally. Seems there should be a check whether SVS is enabled before deciding to register. Kevin