Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp538874iog; Thu, 30 Jun 2022 05:48:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vuBQML6KH5CRBupcXK8UVOdDGGY5FyBAESjqy4igkqEto/rIn6FMqzC78K/FLabf0kn8SN X-Received: by 2002:a05:6402:329a:b0:435:8935:e95d with SMTP id f26-20020a056402329a00b004358935e95dmr11213345eda.257.1656593309302; Thu, 30 Jun 2022 05:48:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656593309; cv=none; d=google.com; s=arc-20160816; b=iZexBgF+FeMfI/540L29xBR83KRMeq5ALhil3PsxXN2SSDiX+dB3zDPRI9TDzGtv9I TXwItr1a53jzRg7i9NIgH659Ruk7BPtUUu6iqCKCBkM5sZ5BSJ9/rWwahOmVUpM3qFTo QevLRmTyAuP/BuSms1jj9iTG0x31JjUQbhByXPyKnMuYtqnDZvNfUJj5BHSTMG8xKh1o XhEQtmwQAXxCNvqzdjRlidGzAuN4QwqzAyf834J7sGk95RO1rjTGI+2TzQXAalEl4ggG u1OcGPk1uEr//QjKAtgBfZA96WbYBxHM4d8w3697efk0Wgq99KTsDsrH7bOPtKYBSi49 RwsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=FH1dmQ709R2VSf2mvnu7DYhWX6Oar21XDZg9aQoTr74=; b=abtwPl+BPnvdObK10A8tMrZEngnaoa6q0gRtNHIa5vZqRz4WxUXK2gjOG0lc6JDp+B Vu337U/Cx5snnj2iYkzfMB8we/clPPXJsps9FAEFM86PRXCT/+2u4F9xLfQKFyPGH7vB ky0Ooiy0znp9ExR4Nv7O2r90mYdrT8U9AdR/fioHlObKhVN9U/Fs/qqxAODfnAvXpUld j+pVdge+idEfshPHQTJeJ/pZi8hHADhZyB39jbmhidUZZgz0KTff8po/jpeybvDmAqoi 4MPYyTAaIyjjOjKST29zICxEASxg65fa7frLdml8Z7O6QedgLZak1QKhusGTAXW0oXnF 6Xaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XGrUAX67; 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 qf17-20020a1709077f1100b007157c821ab7si1432341ejc.996.2022.06.30.05.48.02; Thu, 30 Jun 2022 05:48:29 -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=XGrUAX67; 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 S234318AbiF3McS (ORCPT + 99 others); Thu, 30 Jun 2022 08:32:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233647AbiF3McQ (ORCPT ); Thu, 30 Jun 2022 08:32:16 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48D652E6A6 for ; Thu, 30 Jun 2022 05:32:15 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id fd6so26327437edb.5 for ; Thu, 30 Jun 2022 05:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=FH1dmQ709R2VSf2mvnu7DYhWX6Oar21XDZg9aQoTr74=; b=XGrUAX67r0UekoSEO8au/eqLvUD7116WgXJVOJ68fosqgMpw22F5WEvWujyUwVN76i r41E5mZbTh6Ly2NtxN3pa0EjX2s3IRU+CYPTfZN7+YvG30gCIDXi691JoM3WRr366fhP uQxcGSvPjZjA5Cn3JO/w/SBP9iQQbAafTUPswmv6se7LIBkXse7V+EOcguioNkaVhvh5 PWhM6s8uXVkAxjSeWGdB+xMXhhElLPvc+l7B+YVz3FI4zJ7+WxxUND5Pyohuj347bkpj gwSNSMpQsDVPomGT2KrbI/RdtSyN52op5rv+OitgD8BuHXWKzV3hMhQoE3seTCQ/mNoh 1OnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=FH1dmQ709R2VSf2mvnu7DYhWX6Oar21XDZg9aQoTr74=; b=nSxMYNmCuiUrOUOi+ufesS7a+LGPMMOPm2P+MIa4/bOsy/W3KeDBtDuH7JAqhpJdEv iVKGvqBfcsgnQmupEK8VynpWS7fmKRSFBGa6lUrgfGkHVPhlC+k3H6EeYQdFB7+lMCxg BU9VoFltLP9rv0R3TTfv2POtEmPg+sSXeTc+q/zz+lwdLPe5OlQB+AVkF52LkU31nSnC u1WL3dmQxhFfsOtOB9Smwm1qrQKNI2fyiylY6vx2cZipjgUVpDm/i/mGTPkZrUDsfz6K jQrXSwFxnaWmY+gD0aISfYoOHOIaU4eL+qI5OT+MAdEphcp6470/74Cstd9f0GQ2s5fG wBAA== X-Gm-Message-State: AJIora+yrJJV14BauTxzH8vlFpwPLsMzsJblyQKmAQFQEgShKhllJ6HO pg/ARXEWZtdc2T2MR9SlKm8p3Q== X-Received: by 2002:a05:6402:84a:b0:423:fe99:8c53 with SMTP id b10-20020a056402084a00b00423fe998c53mr11596963edz.195.1656592333868; Thu, 30 Jun 2022 05:32:13 -0700 (PDT) Received: from [192.168.0.189] (xdsl-188-155-176-92.adslplus.ch. [188.155.176.92]) by smtp.gmail.com with ESMTPSA id ch25-20020a0564021bd900b00437e027fad9sm1984174edb.48.2022.06.30.05.32.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Jun 2022 05:32:13 -0700 (PDT) Message-ID: Date: Thu, 30 Jun 2022 14:32:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 5/8] OPP: Allow multiple clocks for a device Content-Language: en-US To: Viresh Kumar , Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org References: <8b29fa207024dc295639f9ba52c28e45782e3baa.1654849214.git.viresh.kumar@linaro.org> From: Krzysztof Kozlowski In-Reply-To: <8b29fa207024dc295639f9ba52c28e45782e3baa.1654849214.git.viresh.kumar@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 On 10/06/2022 10:20, Viresh Kumar wrote: > This patch adds support to allow multiple clocks for a device. > > The design is pretty much similar to how this is done for regulators, > and platforms can supply their own version of the config_clks() callback > if they have multiple clocks for their device. The core manages the > calls via opp_table->config_clks() eventually. > > We have kept both "clk" and "clks" fields in the OPP table structure and > the reason is provided as a comment in _opp_set_clknames(). The same > isn't done for "rates" though and we use rates[0] at most of the places > now. > > Co-developed-by: Krzysztof Kozlowski > Signed-off-by: Krzysztof Kozlowski > Signed-off-by: Viresh Kumar (...) > + rates = kmalloc_array(count, sizeof(*rates), GFP_KERNEL); > + if (!rates) > + return -ENOMEM; > + > + ret = of_property_read_u64_array(np, "opp-hz", rates, count); > + if (ret) { > + pr_err("%s: Error parsing opp-hz: %d\n", __func__, ret); > + } else { > + /* > + * Rate is defined as an unsigned long in clk API, and so > + * casting explicitly to its type. Must be fixed once rate is 64 > + * bit guaranteed in clk API. > + */ > + for (i = 0; i < count; i++) { > + new_opp->rates[i] = (unsigned long)rates[i]; > + > + /* This will happen for frequencies > 4.29 GHz */ > + WARN_ON(new_opp->rates[i] != rates[i]); > + } > + } > + > + kfree(rates); > + > + return ret; > +} > + > static int _read_bw(struct dev_pm_opp *new_opp, struct opp_table *opp_table, > struct device_node *np, bool peak) > { > @@ -812,19 +859,13 @@ static int _read_opp_key(struct dev_pm_opp *new_opp, > struct opp_table *opp_table, struct device_node *np) > { > bool found = false; > - u64 rate; > int ret; > > - ret = of_property_read_u64(np, "opp-hz", &rate); > - if (!ret) { > - /* > - * Rate is defined as an unsigned long in clk API, and so > - * casting explicitly to its type. Must be fixed once rate is 64 > - * bit guaranteed in clk API. > - */ > - new_opp->rate = (unsigned long)rate; > + ret = _read_rate(new_opp, opp_table, np); > + if (ret) > + return ret; > + else if (opp_table->clk_count == 1) Shouldn't this be >=1? I got several clocks and this one fails. Best regards, Krzysztof