From patchwork Wed Jun 20 10:06:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 10476833 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ED66460383 for ; Wed, 20 Jun 2018 10:06:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD81828478 for ; Wed, 20 Jun 2018 10:06:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D254328E02; Wed, 20 Jun 2018 10:06:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6BAD628478 for ; Wed, 20 Jun 2018 10:06:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=t3mpQomNZS3QCm+rP+tRJt379/gB6yQBgSphbv365pE=; b=eEf0rsDNaivlr3z4GGRqj6VaM3 K1eRN6IedZOV2JAopZ446GiqC2crw+uF6+m+tzQ68Mrn3lrjKKuyuf1P48OFfErKIXegaj/+OV4on m24881NokrlT2a/HHsTTcRT21nXe2SkdjfSWXQAYOOqSzv35iSqqq0emKegyRMqfbnqlIb2fOQuq2 RMrQlCbQkBbBWkJ9MrTg0TG+yerAaUj4sNYd9WEfZxk+2R9Bu61cnSxDB9nS3+4PpDpOlV2qn8duE yMzISaNLTBRVxv1xU9HcAFi/ZxqU0Gu3/FgVHCUdn8VyB55BoBe0yrTrCLtmQGEZWjtUY+A3SkN1F s93P0cPQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVa0m-0007SS-3H; Wed, 20 Jun 2018 10:06:48 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVa0W-0007Mq-V5 for linux-amlogic@lists.infradead.org; Wed, 20 Jun 2018 10:06:42 +0000 Received: by mail-wm0-x243.google.com with SMTP id z6-v6so22138146wma.0 for ; Wed, 20 Jun 2018 03:06:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6q2toK54fEHCDkr1ddWCW+wwe2hAKOxiZQKeKjvFnL4=; b=PVZ8AytXaJJCJ2pzZ+kUWMfV7pySTfZDjxz7aqcA5D6Fk1pHX6jZO19iTrLMrzOdV/ rRontj4/rwGfuQ73+Tx/iwSJsO6Edb84w2+jLV6I2sDmQkDrpReEo17gac6mrhq/N1wN ijpxsWJyMV36rWg9KA0FAJ22bxItpLnoHb1BZCKnDx1i57h2q5Mjgf9gucNsr+TlCQBp ccnKncwByOBgaIjRmKi+UTi4jQ8AwIgs50T/e4yq6UXqRFn45fWQHDR3mgRAQt0nKicu L0WJGb24rGk4h8KiLQXiO9+EPHtB2+NX7yQfwKiBifQ+u6iPUOOcBxVdNmZGUACGJddC BDSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6q2toK54fEHCDkr1ddWCW+wwe2hAKOxiZQKeKjvFnL4=; b=IJZZQohCgGyKJ/t8UjKKsA+PILOeIK90UVAqiC/4AfboPe4aqnuau6E7h4U3TPM94A 9HzJSIlACJS/8hAYfd5VNFzIO19Uin5+pyv4Ej+BbjX3PxI7AnSy2Y3oIkUBuF3xlzqq /pWzxMMuOb2VBwQOUrKcRK/3BtsyS06tKhDw/RsgfKA7Zh1ndaIvDKZMK1R8p/DWnkt5 hFLbWB4DIOYtbxc8g+QcPm92NShBKx4BHBVxhc1Sj8DxQuoBiMD4K6wgK8Rqvx5G381Z UhqsDt9gMjRKQsGMb905eJQ6XdCXsJwfPzpFXz+S9yZS5A6h1Q0IdAm+RsInGsJ1Fl0q a1Ng== X-Gm-Message-State: APt69E1klAfCcrFMTqPRmh8tCLKPjf3b6KYqD3QhDcPhHXnaDRGlDA5r MLG0YfEJRwYHheCmrmoEgWlQzg== X-Google-Smtp-Source: ADUXVKK4f6LOrx+DpXao+bJJg4JiWSOR1foIIy385/sz0/ixxmTMIuCXtP9169uIP0GW3NhvtTJMVA== X-Received: by 2002:a1c:c208:: with SMTP id s8-v6mr1210383wmf.29.1529489181298; Wed, 20 Jun 2018 03:06:21 -0700 (PDT) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id m10-v6sm2685852wrq.56.2018.06.20.03.06.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Jun 2018 03:06:20 -0700 (PDT) From: Jerome Brunet To: Neil Armstrong , Kevin Hilman , Carlo Caione Subject: [PATCH 2/2] clk: meson: remove unused clk-audio-divider driver Date: Wed, 20 Jun 2018 12:06:10 +0200 Message-Id: <20180620100610.29010-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180620100610.29010-1-jbrunet@baylibre.com> References: <20180620100610.29010-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180620_030633_023988_5213AA77 X-CRM114-Status: GOOD ( 14.09 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP clk-audio-divider is no longer used, we can remove it. Signed-off-by: Jerome Brunet Acked-by: Neil Armstrong --- drivers/clk/meson/Makefile | 2 +- drivers/clk/meson/clk-audio-divider.c | 110 ---------------------------------- drivers/clk/meson/clkc.h | 7 --- 3 files changed, 1 insertion(+), 118 deletions(-) delete mode 100644 drivers/clk/meson/clk-audio-divider.c diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile index d0d13aeb369a..e40fea96069b 100644 --- a/drivers/clk/meson/Makefile +++ b/drivers/clk/meson/Makefile @@ -2,7 +2,7 @@ # Makefile for Meson specific clk # -obj-$(CONFIG_COMMON_CLK_AMLOGIC) += clk-pll.o clk-mpll.o clk-audio-divider.o +obj-$(CONFIG_COMMON_CLK_AMLOGIC) += clk-pll.o clk-mpll.o obj-$(CONFIG_COMMON_CLK_MESON_AO) += meson-aoclk.o obj-$(CONFIG_COMMON_CLK_MESON8B) += meson8b.o obj-$(CONFIG_COMMON_CLK_GXBB) += gxbb.o gxbb-aoclk.o gxbb-aoclk-32k.o diff --git a/drivers/clk/meson/clk-audio-divider.c b/drivers/clk/meson/clk-audio-divider.c deleted file mode 100644 index e4cf96ba704e..000000000000 --- a/drivers/clk/meson/clk-audio-divider.c +++ /dev/null @@ -1,110 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (c) 2017 AmLogic, Inc. - * Author: Jerome Brunet - */ - -/* - * i2s master clock divider: The algorithm of the generic clk-divider used with - * a very precise clock parent such as the mpll tends to select a low divider - * factor. This gives poor results with this particular divider, especially with - * high frequencies (> 100 MHz) - * - * This driver try to select the maximum possible divider with the rate the - * upstream clock can provide. - */ - -#include -#include "clkc.h" - -static inline struct meson_clk_audio_div_data * -meson_clk_audio_div_data(struct clk_regmap *clk) -{ - return (struct meson_clk_audio_div_data *)clk->data; -} - -static int _div_round(unsigned long parent_rate, unsigned long rate, - unsigned long flags) -{ - if (flags & CLK_DIVIDER_ROUND_CLOSEST) - return DIV_ROUND_CLOSEST_ULL((u64)parent_rate, rate); - - return DIV_ROUND_UP_ULL((u64)parent_rate, rate); -} - -static int _get_val(unsigned long parent_rate, unsigned long rate) -{ - return DIV_ROUND_UP_ULL((u64)parent_rate, rate) - 1; -} - -static int _valid_divider(unsigned int width, int divider) -{ - int max_divider = 1 << width; - - return clamp(divider, 1, max_divider); -} - -static unsigned long audio_divider_recalc_rate(struct clk_hw *hw, - unsigned long parent_rate) -{ - struct clk_regmap *clk = to_clk_regmap(hw); - struct meson_clk_audio_div_data *adiv = meson_clk_audio_div_data(clk); - unsigned long divider; - - divider = meson_parm_read(clk->map, &adiv->div) + 1; - - return DIV_ROUND_UP_ULL((u64)parent_rate, divider); -} - -static long audio_divider_round_rate(struct clk_hw *hw, - unsigned long rate, - unsigned long *parent_rate) -{ - struct clk_regmap *clk = to_clk_regmap(hw); - struct meson_clk_audio_div_data *adiv = meson_clk_audio_div_data(clk); - unsigned long max_prate; - int divider; - - if (!(clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT)) { - divider = _div_round(*parent_rate, rate, adiv->flags); - divider = _valid_divider(adiv->div.width, divider); - return DIV_ROUND_UP_ULL((u64)*parent_rate, divider); - } - - /* Get the maximum parent rate */ - max_prate = clk_hw_round_rate(clk_hw_get_parent(hw), ULONG_MAX); - - /* Get the corresponding rounded down divider */ - divider = max_prate / rate; - divider = _valid_divider(adiv->div.width, divider); - - /* Get actual rate of the parent */ - *parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw), - divider * rate); - - return DIV_ROUND_UP_ULL((u64)*parent_rate, divider); -} - -static int audio_divider_set_rate(struct clk_hw *hw, - unsigned long rate, - unsigned long parent_rate) -{ - struct clk_regmap *clk = to_clk_regmap(hw); - struct meson_clk_audio_div_data *adiv = meson_clk_audio_div_data(clk); - int val = _get_val(parent_rate, rate); - - meson_parm_write(clk->map, &adiv->div, val); - - return 0; -} - -const struct clk_ops meson_clk_audio_divider_ro_ops = { - .recalc_rate = audio_divider_recalc_rate, - .round_rate = audio_divider_round_rate, -}; - -const struct clk_ops meson_clk_audio_divider_ops = { - .recalc_rate = audio_divider_recalc_rate, - .round_rate = audio_divider_round_rate, - .set_rate = audio_divider_set_rate, -}; diff --git a/drivers/clk/meson/clkc.h b/drivers/clk/meson/clkc.h index 2fb084330ee9..48db02424f02 100644 --- a/drivers/clk/meson/clkc.h +++ b/drivers/clk/meson/clkc.h @@ -91,11 +91,6 @@ struct meson_clk_mpll_data { #define CLK_MESON_MPLL_ROUND_CLOSEST BIT(0) -struct meson_clk_audio_div_data { - struct parm div; - u8 flags; -}; - #define MESON_GATE(_name, _reg, _bit) \ struct clk_regmap _name = { \ .data = &(struct clk_regmap_gate_data){ \ @@ -117,7 +112,5 @@ extern const struct clk_ops meson_clk_pll_ops; extern const struct clk_ops meson_clk_cpu_ops; extern const struct clk_ops meson_clk_mpll_ro_ops; extern const struct clk_ops meson_clk_mpll_ops; -extern const struct clk_ops meson_clk_audio_divider_ro_ops; -extern const struct clk_ops meson_clk_audio_divider_ops; #endif /* __CLKC_H */