Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1156668pxb; Wed, 27 Oct 2021 20:58:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNNW39kE4Lz/N+XZqz6iiUZlcKdIOJbS1XebzgdyrjTtMiApRUnyb7d7Scw02stitQD6AK X-Received: by 2002:a17:903:285:b0:140:582d:d510 with SMTP id j5-20020a170903028500b00140582dd510mr1489788plr.53.1635393520422; Wed, 27 Oct 2021 20:58:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635393520; cv=none; d=google.com; s=arc-20160816; b=za6s/uboGYNm1C+khgMBOrAMMouFnqvcbg/VcxTdl8tP7d8QHrq3bPMlwYJVclrR00 qP8E5Rn8vneayKucdlh0bEPeFzxMmfFdW/3I7Hmd4LjN2PJCIsTdlpOAtfdfQNbkCnOY DzHTc9lwuXQbrScj4FrSk7g3vZ4sXyTLnye66fm4f0un4ouc5pezF8ZZxcSK8dUWtMf9 xYk7Qjci917K7+EAGR1mebrEQR9wgRK60Zm7Ok0Qeb7S3kVWYmfxWVSjlNy3GbF62lpH xiqiPXzNupBLc49P8WpHVG3eITxyiSYPx7zENN/ygh7Ar4J4x4L6lCOzEXCPLFogXt88 0dDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dmarc-filter:sender:dkim-signature; bh=m+tIbxcshou06MTQ58i8f/rhVixWQJgIxK9i9z23/4k=; b=iPhSZFDbOBLU1rBrHYJslsNli27pOQ1MOZFy7ozSMZncWX2O0UNWtz8vsKdmxV22Zm 2j26Ksj2rYk9jU6eY2AZTqEcS3d0BM9aUr2RaEgdcm1vscFG3eiUXAMMTZNVqCp6cE+J Qrmr0AIEKLChyIxfvnocY039oWg3cv+vKNEN8Jmq14xq+ufOjqsNkK8tsV4FfkhZkCMq 3ULrZMvrAVQP0gN9HVMtD+Juy/5FLc/jbXZeLGoGpxIRqKOp/34szHVYsOuoKIWGBbsh lw8uTpDnLU0mkzP0oLeUak9dDYwZCY469VfH+4ldSBeJh99Kndb0bmZTM6/LV5LwF2f1 /aPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=ttp+E4jf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i16si2409545pla.365.2021.10.27.20.58.25; Wed, 27 Oct 2021 20:58:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=ttp+E4jf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229784AbhJ1D7l (ORCPT + 99 others); Wed, 27 Oct 2021 23:59:41 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:31566 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229705AbhJ1D7i (ORCPT ); Wed, 27 Oct 2021 23:59:38 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1635393432; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=m+tIbxcshou06MTQ58i8f/rhVixWQJgIxK9i9z23/4k=; b=ttp+E4jfakf/+Pxc/v2AvmGDp8Vm7MytNuXTlR3FysRXc2BJvb6r9IOEWn4nwd6v1EiVfnWX 1fUrvyPt+k54JawsrJvaiB/w6OE8pDPnntvfrxrkSo0QOvHt+ducZNADnNqWPO2zZhr2wrUG sJFIKBaOovPycSrSGET96sk4nzU= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-east-1.postgun.com with SMTP id 617a1f93545d7d365f27c2a7 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 28 Oct 2021 03:57:07 GMT Sender: rnayak=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 20798C4360D; Thu, 28 Oct 2021 03:57:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [192.168.0.118] (unknown [49.207.214.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rnayak) by smtp.codeaurora.org (Postfix) with ESMTPSA id 0CE52C4338F; Thu, 28 Oct 2021 03:57:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 0CE52C4338F Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org Subject: Re: [PATCH v2 1/3] dt-bindings: usb: qcom,dwc3: Add multi-pd bindings for dwc3 qcom To: Ulf Hansson , Bjorn Andersson , Stephen Boyd Cc: Viresh Kumar , Sandeep Maheswaram , Rob Herring , Andy Gross , Greg Kroah-Hartman , Felipe Balbi , Doug Anderson , Matthias Kaehlcke , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, quic_pkondeti@quicinc.com, quic_ppratap@quicinc.com References: <1635152851-23660-1-git-send-email-quic_c_sanm@quicinc.com> <1635152851-23660-2-git-send-email-quic_c_sanm@quicinc.com> From: Rajendra Nayak Message-ID: Date: Thu, 28 Oct 2021 09:26:58 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/27/2021 7:54 PM, Ulf Hansson wrote: > On Wed, 27 Oct 2021 at 06:55, Bjorn Andersson > wrote: >> >> On Tue 26 Oct 19:48 CDT 2021, Stephen Boyd wrote: >> >>> +Rajendra >>> >>> Quoting Bjorn Andersson (2021-10-25 19:48:02) >>>> On Mon 25 Oct 15:41 PDT 2021, Stephen Boyd wrote: >>>> >>>>> >>>>> When the binding was introduced I recall we punted on the parent child >>>>> conversion stuff. One problem at a time. There's also the possibility >>>>> for a power domain to be parented by multiple power domains so >>>>> translation tables need to account for that. >>>>> >>>> >>>> But for this case - and below display case - the subdomain (the device's >>>> power-domain) is just a dumb gate. So there is no translation, the given >>>> performance_state applies to the parent. Or perhaps such implicitness >>>> will come back and bite us? >>> >>> In the gate case I don't see how the implicitness will ever be a >>> problem. >>> >>>> >>>> I don't think we allow a power-domain to be a subdomain of two >>>> power-domains - and again it's not applicable to USB or display afaict. >>> >>> Ah maybe. I always confuse power domains and genpd. >>> >>>> >>>>>> >>>>>>> Or we may need to make another part of the OPP binding to indicate the >>>>>>> relationship between the power domain and the OPP and the parent of >>>>>>> the power domain. >>>>>> >>>>>> I suspect this would be useful if a power-domain provider needs to >>>>>> translate a performance_state into a different supply-performance_state. >>>>>> Not sure if we have such case currently; these examples are all an >>>>>> adjustable power-domain with "gating" subdomains. >>>>> >>>>> Even for this case, we should be able to have the GDSC map the on state >>>>> to some performance state in the parent domain. Maybe we need to add >>>>> some code to the gdsc.c file to set a performance state on the parent >>>>> domain when it is turned on. I'm not sure where the value for that perf >>>>> state comes from. I guess we can hardcode it in the driver for now and >>>>> if it needs to be multiple values based on the clk frequency we can push >>>>> it out to an OPP table or something like that. >>>>> >>>> >>>> For the GDSC I believe we only have 1:1 mapping, so implementing >>>> set_performance_state to just pass that on to the parent might do the >>>> trick (although I haven't thought this through). >>>> >>>> Conceptually I guess this would be like calling clk_set_rate() on a >>>> clock gate, relying on it being propagated upwards. The problem here is >>>> that the performance_state is just a "random" integer without a well >>>> defined unit. >>>> >>> >>> Right. Ideally it would be in the core code somehow so that if there >>> isn't a set_performance_state function we go to the parent or some >>> special return value from the function says "call it on my parent". The >>> translation scheme could come later so we can translate the "random" >>> integer between parent-child domains. >> >> As a proof of concept it should be sufficient to just add an >> implementation of sc->pd.set_performance_state in gdsc.c. But I agree >> that it would be nice to push this into some framework code, perhaps >> made opt-in by some GENPD_FLAG_xyz. >> >>> At the end of the day the device >>> driver wants to set a frequency or runtime pm get the device and let the >>> OPP table or power domain code figure out what the level is supposed to >>> be. >>> >> >> Yes and this is already working for the non-nested case - where the >> single power-domain jumps between performance states as the opp code >> switches from one opp to another. >> >> So if we can list only the child power-domain (i.e. the GDSC) and have >> the performance_stat requests propagate up to the parent rpmhpd resource >> I think we're good. >> >> >> Let's give this a spin and confirm that this is the case... >> >>>> >>>> >>>> The one case where I believe we talked about having different mapping >>>> between the performance_state levels was in the relationship between CX >>>> and MX. But I don't think we ever did anything about that... >>> >>> Hmm alright. I think there's a constraint but otherwise nobody really >>> wants to change both at the same time. >>> >>>>> >>>>> Yes, a GDSC is really a gate on a parent power domain like CX or MMCX, >>>>> etc. Is the display subsystem an example of different clk frequencies >>>>> wanting to change the perf state of CX? If so it's a good place to work >>>>> out the translation scheme for devices that aren't listing the CX power >>>>> domain in DT. >>>> >>>> Yes, the various display components sits in MDSS_GDSC but the opp-tables >>>> needs to change the performance_state of MDSS_GDSC->parent (i.e. CX or >>>> MMCX, depending on platform). >>>> >>>> As I said, today we hack this by trusting that the base drm/msm driver >>>> will keep MDSS_GDSC on and listing MMCX (or CX) as power-domain for each >>>> of these components. >>>> >>>> >>>> So if we solve this, then that seems to directly map to the static case >>>> for USB as well. >>>> >>> >>> Got it. So in this case we could have the various display components >>> that are in the mdss gdsc domain set their frequency via OPP and then >>> have that translate to a level in CX or MMCX. How do we parent the power >>> domains outside of DT? I'm thinking that we'll need to do that if MMCX >>> is parented by CX or something like that and the drivers for those two >>> power domains are different. Is it basic string matching? >> >> In one way or another we need to invoke pm_genpd_add_subdomain() to link >> the two power-domains (actually genpds) together, like what was done in >> 3652265514f5 ("clk: qcom: gdsc: enable optional power domain support"). >> >> In the case of MMCX and CX, my impression of the documentation is that >> they are independent - but if we need to express that CX is parent of >> MMCX, they are both provided by rpmhpd which already supports this by >> just specifying .parent on mmcx to point to cx. > > I was trying to follow the discussion, but it turned out to be a bit > complicated to catch up and answer all things. In any case, let me > just add a few overall comments, perhaps that can help to move things > forward. > > First, one domain can have two parent domains. Both from DT and from > genpd point of view, just to make this clear. > > Although, it certainly looks questionable to me, to hook up the USB > device to two separate power domains, one to control power and one to > control performance. Especially, if it's really the same piece of HW > that is managing both things. [].. > Additionally, if it's correct to model > the USB GDSC power domain as a child to the CX power domain from HW > point of view, we should likely do that. I think this would still require a few things in genpd, since CX and USB GDSC are power domains from different providers. Perhaps a pm_genpd_add_subdomain_by_name()? -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation