From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FE72CCA47C for ; Tue, 12 Jul 2022 12:26:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233046AbiGLM0G (ORCPT ); Tue, 12 Jul 2022 08:26:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233072AbiGLMZx (ORCPT ); Tue, 12 Jul 2022 08:25:53 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3814DAF77C for ; Tue, 12 Jul 2022 05:25:52 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id b2so7112393plx.7 for ; Tue, 12 Jul 2022 05:25:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=P7Kkdpw0CXoEWIErTCFA3Qrrlf9LnDXlc1tDM9FQEkM=; b=KuK+XxEAiZqgqYpARe+Ajp5+Xdwyu7FklH95kCtVjkvgG+1uPVQMUhmdejypzwsmBf Mo2dlK8V3ZWr/GxLdSczjCIlGFxuf+SqP2UzOA52DGrUp6dLD+xeFAsYTL7PgJ9kPAcC mtW+6fqF7M412Pj8YOHBXLLFEqiOasGTHcx72eZTsMfr0dyK5VfHFh4gXRbcW1fCUoIE ttT5O3cTky3v+47P0Y/IlYrTawdf8t75/PedOHBBnreEgIdlJw5oqHKarJN4588BL/XE cXPVJCIqGBTASqn3khqMiRBtsFwDl2IZaS8yUbgvRmdVE4+r+UWADTpcbBUaaXatoyu0 Ih+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=P7Kkdpw0CXoEWIErTCFA3Qrrlf9LnDXlc1tDM9FQEkM=; b=2lKmGTPaWNO8dABEWDCkkt0Qa2DcZOuBZhOsNWp+o7vFfizaC0xd2jx0q/tGA+kx/B LLDzaePxY6PmD8ppJvIWjJbVz03Rb/xiGeQRixOMdxoQCnLeCaj7FJTmizDjMO348hnJ DI8yj5aW1BP3taElgOc/pwpNvbnSjU1UrFRsiavS3xVkSbFWyQeiRmURei6UWvW8+CTF 0en5qCUZU81Q6nji2CGk0KTkgqt0RG4YyV/MMbHI6sOX5MWuZsbrVrY1NbtNJFEPtmAU WVEPMK92K6cqDNk8PuzcEyHENdPBoLzG0sKmEMCfW4t75DqvCuLGOUjggWw5DgP7Pgxd gnBQ== X-Gm-Message-State: AJIora8T8kvViIZGSfOJgrT9st8ZYH58ItiS6Ocu1sd18df6riOUmNIJ kBDa0zqGGRXGw8ioCoB1uQ46 X-Google-Smtp-Source: AGRyM1uKDhZojzscbBh0F9qg+DTu0azBDT/jsX0vJ6G1yxcsnu7T8U/Es7XsMpSg8z41cXpj/4V+GQ== X-Received: by 2002:a17:902:be16:b0:16c:151d:3e21 with SMTP id r22-20020a170902be1600b0016c151d3e21mr24149386pls.49.1657628751649; Tue, 12 Jul 2022 05:25:51 -0700 (PDT) Received: from workstation ([117.207.31.14]) by smtp.gmail.com with ESMTPSA id f12-20020a170902860c00b0016191b843e2sm6698327plo.235.2022.07.12.05.25.44 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jul 2022 05:25:51 -0700 (PDT) Date: Tue, 12 Jul 2022 17:55:41 +0530 From: Manivannan Sadhasivam To: Viresh Kumar Cc: Johan Hovold , Bjorn Andersson , Chanwoo Choi , Dmitry Osipenko , Jonathan Hunter , Kyungmin Park , MyungJoo Ham , Nishanth Menon , "Rafael J. Wysocki" , Stephen Boyd , Thierry Reding , Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Krzysztof Kozlowski , devicetree@vger.kernel.org, Dmitry Osipenko , linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, Rob Herring Subject: Re: [PATCH V2 00/13] OPP: Add support for multiple clocks* Message-ID: <20220712122541.GA21746@workstation> References: <20220712075240.lsjd42yhcskqlzrh@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220712075240.lsjd42yhcskqlzrh@vireshk-i7> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Tue, Jul 12, 2022 at 01:22:40PM +0530, Viresh Kumar wrote: > On 11-07-22, 18:40, Johan Hovold wrote: > > This break OPP parsing on SC8280XP and hence cpufreq and other things: > > > > [ +0.010890] cpu cpu0: _opp_add_static_v2: opp key field not found > > [ +0.000019] cpu cpu0: _of_add_opp_table_v2: Failed to add OPP, -19 > > [ +0.000060] cpu cpu0: _opp_is_duplicate: duplicate OPPs detected. Existing: freq: 300000000, volt: 576000, enabled: 1. New: freq: 403200000, volt: 576000, enabled: 1 > > [ +0.000030] cpu cpu0: _opp_is_duplicate: duplicate OPPs detected. Existing: freq: 300000000, volt: 576000, enabled: 1. New: freq: 499200000, volt: 576000, enabled: 1 > > ... > > > > I just did a rebase on next-20220708 and hit this. > > > > I've narrowed it down to _read_rate() now returning -ENODEV since > > opp_table->clk_count is zero. > > > > Similar to what was reported for tegra for v1: > > > > https://lore.kernel.org/all/58cc8e3c-74d4-e432-8502-299312a1f15e@collabora.com/ > > > > I don't have time to look at this any more today, but it would we nice > > if you could unbreak linux-next. > > > > Perhaps Bjorn or Mani can help with further details, but this doesn't > > look like something that is specific to SC8280XP. > > It is actually. This is yet another corner case, Tegra had one as > well. > > I have tried to understand the Qcom code / setup to best of my > abilities, and the problem as per me is that qcom-cpufreq-hw doesn't > provide a clk to the OPP core, which breaks it after the new updates > to the OPP core. I believe following will solve it. Can someone please > try this ? I will then merge it with the right commit. > I gave it a shot on Lenovo X13s based on SC8280 SoC and it fixes the OPP issue. So you can add, Tested-by: Manivannan Sadhasivam Thanks, Mani > diff --git a/drivers/opp/core.c b/drivers/opp/core.c > index 666e1ebf91d1..4f4a285886fa 100644 > --- a/drivers/opp/core.c > +++ b/drivers/opp/core.c > @@ -1384,6 +1384,20 @@ static struct opp_table *_update_opp_table_clk(struct device *dev, > } > > if (ret == -ENOENT) { > + /* > + * There are few platforms which don't want the OPP core to > + * manage device's clock settings. In such cases neither the > + * platform provides the clks explicitly to us, nor the DT > + * contains a valid clk entry. The OPP nodes in DT may still > + * contain "opp-hz" property though, which we need to parse and > + * allow the platform to find an OPP based on freq later on. > + * > + * This is a simple solution to take care of such corner cases, > + * i.e. make the clk_count 1, which lets us allocate space for > + * frequency in opp->rates and also parse the entries in DT. > + */ > + opp_table->clk_count = 1; > + > dev_dbg(dev, "%s: Couldn't find clock: %d\n", __func__, ret); > return opp_table; > } > > -- > viresh