Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2977944pxb; Fri, 12 Feb 2021 06:24:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJw3KloXk6pGVNxAZrtBPH3czd62VYhEmByThmzkJC0tHralGNpc2Srv6s3I4nNSCmXVUe7e X-Received: by 2002:a17:906:2747:: with SMTP id a7mr3399786ejd.250.1613139886585; Fri, 12 Feb 2021 06:24:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613139886; cv=none; d=google.com; s=arc-20160816; b=w4YIOwo8LuYs9XAyRDv9GU87KX939EiXxJamxBxEHNTVE7oNEFtNkxz6w2ootxU0ND 6zcVSIiEG5F1cZqhDcz6eCX80MXvLjhrWrsdCcTm5Wf1piIzpEpPE6MdrISkV5BGet0R 0tDioEBW0YhLFNKn9nsRYEX4E6Yh1adZNqSsTImbZVPqr/tAw8wCuxi7g54O0qmIi0Ff 3FBZCsBUNG/zINRTegx9lQ0ICmlbIWoYKF3dZrpAwEszQHr9LoXslpZFLbgSVbdMloUf dKXdY2jbdUHWiTaPs0oLlM9OfQyKoxSFIrf5xrsQbkQFU9reD364yBt8TCDkTio8/Sad G6eQ== 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 :message-id:date:subject:cc:to:from; bh=bhdsq2Hz8XIMKYxBsyZViN5XC0qpWtgbRBa5j9agCXc=; b=MGXU6JY0h4i5uUvoylHqsz073yIXNqHKQgBBSGuZLXaZVCLQ34q589ZBB43QwkHWVh E2tn9rCK1aZqHhtgO+BuyAgTcbVjGUfRCM7KqfmnKKXq4OOREmt2A8UE4Hs5YvDIvw6l PkyHzZtZwPaOv31XBARkM621UhNeUSRAfLU/YYH3YKesFTEW19hBcuwCtHG5xZUmaymo k5mMbKYvlEsaJQlOLlLADZh2u2TvB6SLe4w7xJJfvnYhJrwOYjEx0qCENk1XLARpqshq rOXa7wWmTJRqo7FiGso3XgMycZ9uPGCza+LAnJj30IqobY6KY7VBQcSVsqqge0w4gLNe vnEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk7si6806052ejb.570.2021.02.12.06.24.23; Fri, 12 Feb 2021 06:24:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231959AbhBLOVN (ORCPT + 99 others); Fri, 12 Feb 2021 09:21:13 -0500 Received: from mail.manjaro.org ([176.9.38.148]:46288 "EHLO mail.manjaro.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232160AbhBLOVC (ORCPT ); Fri, 12 Feb 2021 09:21:02 -0500 X-Greylist: delayed 1328 seconds by postgrey-1.27 at vger.kernel.org; Fri, 12 Feb 2021 09:20:59 EST Received: from localhost (localhost [127.0.0.1]) by mail.manjaro.org (Postfix) with ESMTP id 4B55C182DEA; Fri, 12 Feb 2021 14:57:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at manjaro.org Received: from mail.manjaro.org ([127.0.0.1]) by localhost (manjaro.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WqVgog2iWyQB; Fri, 12 Feb 2021 14:57:53 +0100 (CET) From: Tobias Schramm To: Michael Turquette , Stephen Boyd , Icenowy Zheng Cc: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Tobias Schramm Subject: [PATCH] clk: sunxi-ng: v3s: add support for variable rate audio pll output Date: Fri, 12 Feb 2021 14:57:25 +0100 Message-Id: <20210212135725.283877-1-t.schramm@manjaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Previously the variable rate audio pll output was fixed to a divider of four. This is unfortunately incompatible with generating commonly used I2S core clock rates like 24.576MHz from the 24MHz parent clock. This commit adds support for arbitrary audio pll output dividers to fix that. Signed-off-by: Tobias Schramm --- drivers/clk/sunxi-ng/ccu-sun8i-v3s.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c index 0e36ca3bf3d5..c6cf590b235a 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c @@ -36,12 +36,9 @@ static SUNXI_CCU_NKMP_WITH_GATE_LOCK(pll_cpu_clk, "pll-cpu", 0); /* - * The Audio PLL is supposed to have 4 outputs: 3 fixed factors from - * the base (2x, 4x and 8x), and one variable divider (the one true - * pll audio). - * - * We don't have any need for the variable divider for now, so we just - * hardcode it to match with the clock names + * The Audio PLL has 4 outputs: 3 fixed factors from the base (2x, 4x and 8x), + * and one variable divider (the one true pll audio). + * The variable rate output is supported via a a separate divider below. */ #define SUN8I_V3S_PLL_AUDIO_REG 0x008 @@ -53,6 +50,11 @@ static SUNXI_CCU_NM_WITH_GATE_LOCK(pll_audio_base_clk, "pll-audio-base", BIT(28), /* lock */ 0); +static SUNXI_CCU_M(pll_audio_clk, "pll-audio", + "pll-audio-base", 0x008, + 16, 4, /* P from audio pll */ + CLK_SET_RATE_PARENT); + static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_video_clk, "pll-video", "osc24M", 0x0010, 8, 7, /* N */ @@ -377,6 +379,7 @@ static SUNXI_CCU_M_WITH_MUX_GATE(mipi_csi_clk, "mipi-csi", mipi_csi_parents, static struct ccu_common *sun8i_v3s_ccu_clks[] = { &pll_cpu_clk.common, &pll_audio_base_clk.common, + &pll_audio_clk.common, &pll_video_clk.common, &pll_ve_clk.common, &pll_ddr0_clk.common, @@ -453,6 +456,7 @@ static const struct clk_hw *clk_parent_pll_audio[] = { static struct ccu_common *sun8i_v3_ccu_clks[] = { &pll_cpu_clk.common, &pll_audio_base_clk.common, + &pll_audio_clk.common, &pll_video_clk.common, &pll_ve_clk.common, &pll_ddr0_clk.common, @@ -524,10 +528,6 @@ static struct ccu_common *sun8i_v3_ccu_clks[] = { &mipi_csi_clk.common, }; -/* We hardcode the divider to 4 for now */ -static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", - clk_parent_pll_audio, - 4, 1, CLK_SET_RATE_PARENT); static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", clk_parent_pll_audio, 2, 1, CLK_SET_RATE_PARENT); @@ -545,7 +545,7 @@ static struct clk_hw_onecell_data sun8i_v3s_hw_clks = { .hws = { [CLK_PLL_CPU] = &pll_cpu_clk.common.hw, [CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw, - [CLK_PLL_AUDIO] = &pll_audio_clk.hw, + [CLK_PLL_AUDIO] = &pll_audio_clk.common.hw, [CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw, [CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw, [CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw, @@ -625,7 +625,7 @@ static struct clk_hw_onecell_data sun8i_v3_hw_clks = { .hws = { [CLK_PLL_CPU] = &pll_cpu_clk.common.hw, [CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw, - [CLK_PLL_AUDIO] = &pll_audio_clk.hw, + [CLK_PLL_AUDIO] = &pll_audio_clk.common.hw, [CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw, [CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw, [CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw, -- 2.30.0