Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5445124rwp; Mon, 17 Jul 2023 04:28:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlHHbtjspZKRQrYRkpvXzGixsXz3ItheVaVgOOgeaffBHfQcr2pcdt1V1FIE7lGy51vHoybu X-Received: by 2002:aa7:c698:0:b0:521:7779:d918 with SMTP id n24-20020aa7c698000000b005217779d918mr5644649edq.19.1689593327519; Mon, 17 Jul 2023 04:28:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689593327; cv=none; d=google.com; s=arc-20160816; b=MAw5ztwaCjiFLr19ecJp/j7gcRfIav8fIziPEINKUxFqg02YzCliOQxusFIjacz5Fo VgBw3LUWgwbk1DE9kcC4zz56Xs6NcfJh6hUynxhypKBPCygzGR6Zn/X2jfQIINeG2UDu 320axGLsIEKqBNJ5N7vOtABQF/pKzX56krWTiFJEmPzcCKcksN57xo4j10V+FZgxP3CD orZTivVjC9AQ9gOF43rFHFYTqxvI11dG94dwy+/2SbfAN5wbemYNYZLY+nD+Llb0LQsa Hj3k2NcFZIVCReYgtdHVaz62AuQyPPVretB3r1yalATC133KnWSdR2ES3t/be2qJO1JD pbdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eQuNLrwbJ2AdsFbKd9SBZgt7zHVZW51vp7qPZgcDweg=; fh=ev3cowH4G9PamOKB8+uoCrNZh+OQKbv74AaAlSV4Dyk=; b=sdVhltAdCx7j1BvBwSDgp0fMqY6BSW3rNin3D7rOBVcMJekWD/rxwxd/8H7wx+UsrK yNT5bksnXt4nXL4K9amHorB3SawPUxLGZfI+HLCg4DRD8E0bdewNy5yyiV0WMkmN6Aom napDXIaoSNMbSFtIx7sm0dBZxffYHFiiGmGbjw931DB1J1xmNFiSkxiKJR7mNTZ8yYZ5 nX8j0T9jHpUPhoVEHItoTij/o4X3f2wTQn2gWrghrdbldbEzz3uXAE0NapNkCqp7Q5Ps U9BiLrulAcnYBg8Uiwb2XFDC4dq0G+4Euq4KGxE6WbqklwWZa1L8DoS44pu/xGg+GMjL Pxfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="MtFO/Mvc"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u12-20020aa7d98c000000b005218b4af264si2009920eds.601.2023.07.17.04.28.20; Mon, 17 Jul 2023 04:28:47 -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=@linaro.org header.s=google header.b="MtFO/Mvc"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230037AbjGQLJC (ORCPT + 99 others); Mon, 17 Jul 2023 07:09:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbjGQLJA (ORCPT ); Mon, 17 Jul 2023 07:09:00 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1807FB9 for ; Mon, 17 Jul 2023 04:08:59 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2b70404a5a0so69040821fa.2 for ; Mon, 17 Jul 2023 04:08:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689592137; x=1692184137; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=eQuNLrwbJ2AdsFbKd9SBZgt7zHVZW51vp7qPZgcDweg=; b=MtFO/Mvc0xspnkoMEh5fsDNS+VVWirzNRAvB3fitk0Dm1zi/YTGv2jOL7Uk8ZI/7B1 Y6xasr3dN+h4JKJOdCQLyigRLxdVVZmSpRwZlVCIzZ4dh5hXKGqTmVkPzvKR0dJV2o6a EwepnhROHZ3tM6JAqt/PxVT3mwA4Ue+IjCJWFwI6spHEqNVvKTBiMdIvwTzydidas5Kc PNKkM8pVa+21nvblq8PkjAdVhSDpEWe6PwVA2Hsyd1jXaENlfmfekeWdHfLssfI0dNmd ROb5AZnYMr7mpnhw+TycOgiWldFHoWZpw8KGneC8ulwk8pm/gC2WYUJbbPnufoiIa4RC 85Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689592137; x=1692184137; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=eQuNLrwbJ2AdsFbKd9SBZgt7zHVZW51vp7qPZgcDweg=; b=AXipBPn3hNbECag0qJHpvMDZaMFFxPC0V2abOfDFxEOipDKD5EoqsfOhPi5y9SO9RR cggKBpVYgN08Moz8vpCCqxvdLZMdxEWP68y7+TtJOwySvtrXoJAtooVEfG33ZkYohomI xKYo5TGmtnjNUwipOTvtaKArDCiPXhH9aTG+lHax8ywZ+tilb3NNKxrk1GqkpmamSrs7 Y2zkw+4BMrF9gfGGzaS1JGfOHm3taMDt2ASZ92WJkmq4c4LeLvetUNd/dyVgFh6Rd6W2 RD3wBHcnc61g4y4JUoNIaolKNnzDVKpC1jlHRLknkAG6iweqG4VO019GW7OccgLA5SEP Jqtw== X-Gm-Message-State: ABy/qLZiHAPpl4HYsuEIygna52PPa3EpHGOm1cVhJrlXym2qvL6TiogU vioGVm4Zb3AyRH9c+amZKxsKlqm1wyCWP/3GQPs= X-Received: by 2002:a05:651c:20a:b0:2b6:d8d4:161 with SMTP id y10-20020a05651c020a00b002b6d8d40161mr10907844ljn.43.1689592137230; Mon, 17 Jul 2023 04:08:57 -0700 (PDT) Received: from linaro.org ([82.78.74.213]) by smtp.gmail.com with ESMTPSA id z3-20020a1709064e0300b00992afee724bsm8989196eju.76.2023.07.17.04.08.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 04:08:56 -0700 (PDT) Date: Mon, 17 Jul 2023 14:08:54 +0300 From: Abel Vesa To: Taniya Das Cc: Konrad Dybcio , "Rafael J . Wysocki" , Kevin Hilman , Ulf Hansson , avel Machek , Len Brown , Greg Kroah-Hartman , Bjorn Andersson , Andy Gross , Mike Turquette , Stephen Boyd , Taniya Das , linux-pm@vger.kernel.org, Linux Kernel Mailing List , linux-arm-msm@vger.kernel.org Subject: Re: [PATCH 2/2] clk: qcom: gdsc: Add support for set_hwmode_dev Message-ID: References: <20230628105652.1670316-1-abel.vesa@linaro.org> <20230628105652.1670316-3-abel.vesa@linaro.org> <42b1167d-da60-f6c3-67b6-3f6857327396@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 On 23-07-10 09:40:14, Taniya Das wrote: > Hi Abel, > > Thanks for the patch. > > On 6/28/2023 10:48 PM, Konrad Dybcio wrote: > > On 28.06.2023 12:56, Abel Vesa wrote: > > > Implement the GDSC specific genpd set_hwmode_dev callback in order to > > > switch the HW control on or off. For any GDSC that supports HW control > > > set this callback in order to allow its consumers to control it. > > > > > > Signed-off-by: Abel Vesa > > > --- > > This still does nothing to prevent the HW_CTRL state being changed in > > init, enable and disable functions. > > > > Konrad > > > drivers/clk/qcom/gdsc.c | 22 ++++++++++++++++++++++ > > > 1 file changed, 22 insertions(+) > > > > > > diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c > > > index 5358e28122ab..9a04bf2e4379 100644 > > > --- a/drivers/clk/qcom/gdsc.c > > > +++ b/drivers/clk/qcom/gdsc.c > > > @@ -314,6 +314,26 @@ static int gdsc_enable(struct generic_pm_domain *domain) > > > return 0; > > > } > > > +static int gdsc_set_hwmode_dev(struct generic_pm_domain *domain, > > > + struct device *dev, bool enable) > > > +{ > > > + int ret = gdsc_hwctrl(domain_to_gdsc(domain), enable); > > > + > > > + if (ret) > > > + goto out; > > > + > > > + /* > > > + * Wait for the GDSC to go through a power down and > > > + * up cycle. In case there is a status polling going on > > > + * before the power cycle is completed it might read an > > > + * wrong status value. > > > + */ > > > + udelay(1); > > > + > > > +out: > > > + return ret; > > > +} > > > + > > > static int gdsc_disable(struct generic_pm_domain *domain) > > > { > > > struct gdsc *sc = domain_to_gdsc(domain); > > > @@ -451,6 +471,8 @@ static int gdsc_init(struct gdsc *sc) > > > sc->pd.power_off = gdsc_disable; > > > if (!sc->pd.power_on) > > > sc->pd.power_on = gdsc_enable; > > > + if (sc->flags & HW_CTRL) > > > + sc->pd.set_hwmode_dev = gdsc_set_hwmode_dev; > We do not want to move to SW mode without consumers wanting to move to this > mode. > > We want a new flag for the consumers wanting to move to this mode. The mode > in which the GDSC would be enabled would be in SW mode only. > + if (sc->flags & HW_CTRL_TRIGGER) { > + sc->pd.set_hwmode_dev = gdsc_set_mode; > + } > + OK, maybe I'm missing something here. Do you suggest we have GDSCs that, even though they support HW ctrl, should not be controllable by the consumer? Why isn't dev_pm_genpd_set_hwmode good enough? If a consumer doesn't want to control it then the consumer can just skip calling the mentioned function. Or maybe you want this all hidden into the genpd provider? > > > > ret = pm_genpd_init(&sc->pd, NULL, !on); > > > if (ret) > > -- > Thanks & Regards, > Taniya Das.