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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6E34EC001DE for ; Sun, 6 Aug 2023 13:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=amhIU3iGbs603Cef/pEBq7g/Y/a4dj6EwgOieyha/mM=; b=IPiIFVkZsP4TtV jDYc+lqTGFbMFP6lIr+Kr+LszSiYTzD/hCmM45N3tPAa5FVCDWVX7zZp6BBJrQ//K0Wqa5IQnewrZ 79LBb98AEZ11vb7lP//fYW5sFFKAr3jt959SqeF0wrSeejw/r0tf/MEXe80p8k0evciV6trNQyGco vt26J7/xRncPMTYhFJMuy+YzwwJdLVDjssFQGSTUKXEXBNZrbnxo8SFLkbp68L0sVe3rn5HCy9fsR vRWGoLkaSWrMftcbuca+HJANJo9FgkpK7M5XZT70CyxAHV6RhURde0dRJCMGII0HNKY6HEdMUGUWq deJtWDqmf/apDuW/nJ8Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qSe1g-00FT01-2h; Sun, 06 Aug 2023 13:42:32 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qSe1d-00FSxb-1Z for linux-arm-kernel@lists.infradead.org; Sun, 06 Aug 2023 13:42:30 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-997c4107d62so508284566b.0 for ; Sun, 06 Aug 2023 06:42:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691329347; x=1691934147; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w3hZ38/+Ms3F1EqmzJCLkF+L8JHXcF7YJ7LY4cDwFEg=; b=SPzBm1YdBbtvTEIV1JOBdfR6CA0fgKzXZBB3wpp0DTUZhu9WgsbenYO9PqwDRLMJ+r jUk0+YHw+cvFBmxegiMNcXHMYOF0LhZdlj6PZMaO4b+GigEkBr/CTDrEdhkFkMIXspFH Ip1Loq5vDqKtT3Ze61BeOgsI1D43+YqY24LuqlLCs8Ovyp6p0DUE82gIDFRkDVCQyKaD PXV33GqvZvHkcbEzFA76iGfYKNP5/0TrzUXLyH9s1B2LkUdwYsenlOCyMqsdTg1C/3eS 50Dwcfc8SbUpIPHleSHvIrasQoEzn/daEwOdElNh7dh8eAFugS7Z0Vrb1uve3j4xwfvA kGJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691329347; x=1691934147; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w3hZ38/+Ms3F1EqmzJCLkF+L8JHXcF7YJ7LY4cDwFEg=; b=hJ06eU+35OEsVYbZM5d3PlHX79cv+wrgIJEl8vkqZq6PW0zqjDXKA1W11YfqFDDMha 9seEsoAPM3ZSsz2ehtmOIGEdCbfCYIcSv8W/3S7YJ3oZDk3Wrhv8CnU4g5/2qDqFgP/O AgTspLJTpxdxwO88o/Ds/EKxG5FSitcjU1z3eIDW3oQ6tEE6lPuaeRy1Sy/ysvF30eCZ HuL5h9vQY8ULJVyHPrz72XENhvSRgDA4jsiqymzVnZELF7/IN80St5OaNVRnEGzfWYVv wY9sumb0YYZcr2tUicwDv0ePvAYbRLKx5MrtyAweLhteo/JW7ZbsxHnlEp11rdR4cuC6 pyiw== X-Gm-Message-State: AOJu0YwGkLQkkwxoe12TP81WW00Nwqi4+iRB/aAKRLn002wueozsV2qS A/HeU98EQ6NpRjI55Y7bCjY= X-Google-Smtp-Source: AGHT+IFW16CLtR9BgIINux3nrolh4qCbKVx72XAqj9WGF2HfXwD3FMUWnvNuC60k/R3N18kMvhM8Qg== X-Received: by 2002:a17:906:9bdb:b0:987:5761:2868 with SMTP id de27-20020a1709069bdb00b0098757612868mr5498868ejc.11.1691329346257; Sun, 06 Aug 2023 06:42:26 -0700 (PDT) Received: from jernej-laptop.localnet (82-149-1-233.dynamic.telemach.net. [82.149.1.233]) by smtp.gmail.com with ESMTPSA id oz13-20020a170906cd0d00b00992b71d8f19sm1357934ejb.133.2023.08.06.06.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Aug 2023 06:42:25 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Maxime Ripard , Michael Turquette , Stephen Boyd , Chen-Yu Tsai , Samuel Holland , Andre Przywara , Roman Beranek , Frank Oltmanns Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Frank Oltmanns Subject: Re: [PATCH v5 08/11] clk: sunxi-ng: mux: Support finding closest rate Date: Sun, 06 Aug 2023 15:42:24 +0200 Message-ID: <4283806.ejJDZkT8p0@jernej-laptop> In-Reply-To: <20230806-pll-mipi_set_rate_parent-v5-8-db4f5ca33fc3@oltmanns.dev> References: <20230806-pll-mipi_set_rate_parent-v5-0-db4f5ca33fc3@oltmanns.dev> <20230806-pll-mipi_set_rate_parent-v5-8-db4f5ca33fc3@oltmanns.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230806_064229_526799_7450F0AE X-CRM114-Status: GOOD ( 19.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Dne nedelja, 06. avgust 2023 ob 15:06:53 CEST je Frank Oltmanns napisal(a): > When finding the best rate for a mux clock, consider rates that are > higher than the requested rate when CCU_FEATURE_ROUND_CLOSEST is used. > Furthermore, introduce an initialization macro that sets this flag. > > Acked-by: Maxime Ripard > Signed-off-by: Frank Oltmanns Reviewed-by: Jernej Skrabec Best regards, Jernej > --- > drivers/clk/sunxi-ng/ccu_mux.c | 13 ++++++++++++- > drivers/clk/sunxi-ng/ccu_mux.h | 38 +++++++++++++++++++++++++++----------- > 2 files changed, 39 insertions(+), 12 deletions(-) > > diff --git a/drivers/clk/sunxi-ng/ccu_mux.c b/drivers/clk/sunxi-ng/ccu_mux.c > index 3ca695439620..5edc63b46651 100644 > --- a/drivers/clk/sunxi-ng/ccu_mux.c > +++ b/drivers/clk/sunxi-ng/ccu_mux.c > @@ -242,6 +242,17 @@ static int ccu_mux_set_parent(struct clk_hw *hw, u8 > index) return ccu_mux_helper_set_parent(&cm->common, &cm->mux, index); > } > > +static int ccu_mux_determine_rate(struct clk_hw *hw, > + struct clk_rate_request *req) > +{ > + struct ccu_mux *cm = hw_to_ccu_mux(hw); > + > + if (cm->common.features & CCU_FEATURE_CLOSEST_RATE) > + return clk_mux_determine_rate_flags(hw, req, CLK_MUX_ROUND_CLOSEST); > + > + return clk_mux_determine_rate_flags(hw, req, 0); > +} > + > static unsigned long ccu_mux_recalc_rate(struct clk_hw *hw, > unsigned long parent_rate) > { > @@ -259,7 +270,7 @@ const struct clk_ops ccu_mux_ops = { > .get_parent = ccu_mux_get_parent, > .set_parent = ccu_mux_set_parent, > > - .determine_rate = __clk_mux_determine_rate, > + .determine_rate = ccu_mux_determine_rate, > .recalc_rate = ccu_mux_recalc_rate, > }; > EXPORT_SYMBOL_NS_GPL(ccu_mux_ops, SUNXI_CCU); > diff --git a/drivers/clk/sunxi-ng/ccu_mux.h b/drivers/clk/sunxi-ng/ccu_mux.h > index 2c1811a445b0..eb1172ebbd94 100644 > --- a/drivers/clk/sunxi-ng/ccu_mux.h > +++ b/drivers/clk/sunxi-ng/ccu_mux.h > @@ -46,20 +46,36 @@ struct ccu_mux { > struct ccu_common common; > }; > > +#define SUNXI_CCU_MUX_TABLE_WITH_GATE_FEAT(_struct, _name, _parents, > _table, \ + _reg, _shift, _width, _gate, \ > + _flags, _features) \ > + struct ccu_mux _struct = { \ > + .enable = _gate, \ > + .mux = _SUNXI_CCU_MUX_TABLE(_shift, _width, _table), \ > + .common = { \ > + .reg = _reg, \ > + .hw.init = CLK_HW_INIT_PARENTS(_name, \ > + _parents, \ > + &ccu_mux_ops, \ > + _flags), \ > + .features = _features, \ > + } \ > + } > + > +#define SUNXI_CCU_MUX_TABLE_WITH_GATE_CLOSEST(_struct, _name, _parents, \ > + _table, _reg, _shift, \ > + _width, _gate, _flags) \ > + SUNXI_CCU_MUX_TABLE_WITH_GATE_FEAT(_struct, _name, _parents, \ > + _table, _reg, _shift, \ > + _width, _gate, _flags, \ > + CCU_FEATURE_CLOSEST_RATE) > + > #define SUNXI_CCU_MUX_TABLE_WITH_GATE(_struct, _name, _parents, _table, \ > _reg, _shift, _width, _gate, \ > _flags) \ > - struct ccu_mux _struct = { \ > - .enable = _gate, \ > - .mux = _SUNXI_CCU_MUX_TABLE(_shift, _width, _table), \ > - .common = { \ > - .reg = _reg, \ > - .hw.init = CLK_HW_INIT_PARENTS(_name, \ > - _parents, \ > - &ccu_mux_ops, \ > - _flags), \ > - } \ > - } > + SUNXI_CCU_MUX_TABLE_WITH_GATE_FEAT(_struct, _name, _parents, \ > + _table, _reg, _shift, \ > + _width, _gate, _flags, 0) > > #define SUNXI_CCU_MUX_WITH_GATE(_struct, _name, _parents, _reg, \ > _shift, _width, _gate, _flags) \ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel