Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp850083pxb; Thu, 17 Feb 2022 16:33:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJw3+8jhsJp9ApguJp4CYEDbS35cisSMecE+rBHEwUY/3ozEY6Q3gGb0NBl9WYT2oycpkjdg X-Received: by 2002:a17:903:245:b0:14d:57b2:8c76 with SMTP id j5-20020a170903024500b0014d57b28c76mr5129108plh.32.1645144380704; Thu, 17 Feb 2022 16:33:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645144380; cv=none; d=google.com; s=arc-20160816; b=vUfQ4rwT+7tpL9v5Aj72o+oFbinpY9+dOAMcDAONTPIevAp8IwwzAEAdl10Q1GtAZb t+owZvManOCeODOr3lZ784j6kHeQJzYtH4Lq8PV9z89lxD9pFJKtQ2vzPZL1rsDAG6sF oTyVK1SI81QwjRZ8dfFwMn2R26varG+dzxgSM+lOXvxUJGIsLOtfVyFb3MUKMyPxOqR5 kWaDb9zCZzIqZr88lxUNIhWara2p9oCJeeQAAk31gKgVz8X3IKCZ2gcUmD2XIMQZR+8Q LeSy2+VM3djkVFNZKON3Oaa9qO+Cr6ITmgG+0GTog7Zk1Sl0vJ9Gd307NItE26czHZlF gBnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=BZu919Ht8qcY64r+yFTBDeFPrzAizwLZFgHrPpz3SME=; b=jHxlVFYxY+xL9HW3AZEnqDhBrC8T4n62E9PazrBLHJhq8FhGT1p3Ai1T74XFxIp1M1 /DTZTTjTYDPh1hBKwsmIYdMV0rReo5flSJPG4V19hOlTpqP3uOB8Oj0Ji6pB2ZLihLOW RvH/mMJV1d9F9kLv045eI6YQHpUnYGg7vaRWyHraFkgXc7MVGM4ZTB//7f2Lqra9I/1J G9FcApNZT6XBa36KgjaFQsoJsHrrv0U4vb3y70454OBPqK+iZuiWIwfE3Btpxc2Xvb5r AlO/IDjDtW/XCHg5ZdVKAinQTdmKfewy8JDmhg4l7ef5nlMT5JAcxxisy8Xi0uTdY/sB vNvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=N2LHTsH2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id bb2si6975419plb.293.2022.02.17.16.33.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 16:33:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=N2LHTsH2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 07C9A33368; Thu, 17 Feb 2022 15:59:03 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229883AbiBQX6N (ORCPT + 99 others); Thu, 17 Feb 2022 18:58:13 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:53392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbiBQX6F (ORCPT ); Thu, 17 Feb 2022 18:58:05 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 801F83E5EC; Thu, 17 Feb 2022 15:57:35 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id l67-20020a1c2546000000b00353951c3f62so5176785wml.5; Thu, 17 Feb 2022 15:57:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=BZu919Ht8qcY64r+yFTBDeFPrzAizwLZFgHrPpz3SME=; b=N2LHTsH2M0bumRGjP4bIJ6/lUhLMOfzcqcDNUOx9zvJ8J0DW9LuHi2m40C2tx2V1xV CSL95dcnRN13NcLiXmE7d0oalvp4Ibnt74Qctre0VdZbn1AQIXHllCfEOEMT0juD21D3 cV7Y0696Wj3VAJl0H9mGj5ccOq0eID7Ic1gWrOYHEIyI84k81ejIzPVpCr08xBvQnsMW qldntm6dZrEZG0ubS2xHBPyP3q+g+ImZM+D+NzYTnqSUrcf029K6mllwUo8JCYWXX5WA 4uqOifV2WI56ZnlgjPF4H8b33iepzAuYL6g7LAdW4XNgx4GcZRl5nLS06RKEImy8thSD TcvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BZu919Ht8qcY64r+yFTBDeFPrzAizwLZFgHrPpz3SME=; b=uhb3HQCHpF97orc15jP23cOqqJGKIjjhFOpDu3+laAu6UgVtTC7ZEOEEz6ynlhH5Mb +SAMds+3nKBW7DK7317h3j/+9hnBd58wNaD1ItV6xbu0BP0LjDYnM6mBUxL99xGs63Bz +w0yOHgr6nhPmv8zJ7sd5FTVqtgBk3+F5wpqQt4AcdUsM+f8UcVp0Re0pGueNLy32/qA 5pbylUO02l3wFJhENfEDwA/ByzS9xYuY3SuelWDUx6QY/RDRyYbeaUreq3/HOOuP+Zos QvBTptz6jMY3IwgutStPmzVLH4pxzo7F+DHhJlzrpv3d2QRVdbTSnYSgBpkqoVuSyrZ4 HALw== X-Gm-Message-State: AOAM531HxmnB6pFinSyWHXQhSwSibp2OxfYjnZGUVp3V18L+IhIBa2gr rSV6DrK8sXMoZAMhF+/cKnUKLH/jsS8= X-Received: by 2002:a05:600c:2552:b0:37b:c7dd:d376 with SMTP id e18-20020a05600c255200b0037bc7ddd376mr8045462wma.113.1645142234305; Thu, 17 Feb 2022 15:57:14 -0800 (PST) Received: from Ansuel-xps.localdomain (93-42-71-246.ip85.fastwebnet.it. [93.42.71.246]) by smtp.googlemail.com with ESMTPSA id r2sm3691694wmq.24.2022.02.17.15.57.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 15:57:13 -0800 (PST) From: Ansuel Smith To: Andy Gross , Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Philipp Zabel , Taniya Das , Ansuel Smith , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 10/16] clk: qcom: clk-rcg: add clk_rcg_floor_ops ops Date: Fri, 18 Feb 2022 00:56:57 +0100 Message-Id: <20220217235703.26641-11-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220217235703.26641-1-ansuelsmth@gmail.com> References: <20220217235703.26641-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Add clk_rcg_floor_ops for clock that can't provide a stable freq and require to use a floor freq to provide the requested frequency. Signed-off-by: Ansuel Smith --- drivers/clk/qcom/clk-rcg.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/clk/qcom/clk-rcg.c b/drivers/clk/qcom/clk-rcg.c index a9d181d6be21..88845baa7f84 100644 --- a/drivers/clk/qcom/clk-rcg.c +++ b/drivers/clk/qcom/clk-rcg.c @@ -526,6 +526,19 @@ static int clk_rcg_set_rate(struct clk_hw *hw, unsigned long rate, return __clk_rcg_set_rate(rcg, f); } +static int clk_rcg_set_floor_rate(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) +{ + struct clk_rcg *rcg = to_clk_rcg(hw); + const struct freq_tbl *f; + + f = qcom_find_freq_floor(rcg->freq_tbl, rate); + if (!f) + return -EINVAL; + + return __clk_rcg_set_rate(rcg, f); +} + static int clk_rcg_bypass_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { @@ -816,6 +829,17 @@ const struct clk_ops clk_rcg_ops = { }; EXPORT_SYMBOL_GPL(clk_rcg_ops); +const struct clk_ops clk_rcg_floor_ops = { + .enable = clk_enable_regmap, + .disable = clk_disable_regmap, + .get_parent = clk_rcg_get_parent, + .set_parent = clk_rcg_set_parent, + .recalc_rate = clk_rcg_recalc_rate, + .determine_rate = clk_rcg_determine_rate, + .set_rate = clk_rcg_set_floor_rate, +}; +EXPORT_SYMBOL_GPL(clk_rcg_floor_ops); + const struct clk_ops clk_rcg_bypass_ops = { .enable = clk_enable_regmap, .disable = clk_disable_regmap, -- 2.34.1