From patchwork Thu Jul 27 05:31:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13328746 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 3AF9DC001DC for ; Thu, 27 Jul 2023 05:33:54 +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=wdZMPFsNlvi9DriSdbSMhrpBNLA6azPLgeCIctOVuC4=; b=h0drY7m8CuXaaP 81sLUgWgDoyreFm/KVKDCWqj0DmUi04KRK0Qr3z5FSURy4nAyRQ+O+4V46iZuGsRB8JgiA5QStl8J yd65Cvh2McuQwW/X70CFvuC8EkdhyBK1aAq6kGkAUQhKbUvv8GDlZpzr9fAd1/TVdoKSAqtO5XDpi odtSjD2o9JOy8bwK/sAlhoHu8xlAjq08CoINjAndFWvZjfrVrtToJ0jzu6Rq7MD8r7j3KfdXFjDgG P4kmbpHHJJVocT+jReSa3fYLn2Q2iF3Kis/T7YG1ekm0Ux6QmZBD+FEwzYEkEmSC/sUuYgohBczZi B/3lidJXIyuaGxXdaLWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qOtcw-00CBrk-0T; Thu, 27 Jul 2023 05:33:30 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qOtce-00CBk5-2v for linux-arm-kernel@lists.infradead.org; Thu, 27 Jul 2023 05:33:14 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1bbdc05a93bso2187475ad.0 for ; Wed, 26 Jul 2023 22:33:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1690435992; x=1691040792; 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=p47IEHM+JZSsAANQ/kyvjM6x0oAWT/q0JwErNba07sU=; b=Jwa33zZJtyHQ6H92mgUKLxpuKwc455YJUiTrkI7z8K56ZNWLnw5UeW6SLUP+rNVRni IDIcwsZlCQLAQI/L8464HY/WPdd3RN4xbPZDGno3r3bdbezUcvwy+/pT17jiv3DW26Uk JYP9beEDushkyrKuTpEJaIBFNjnWn7q0ZRvV4hNcQX9wMPeavBy0K9hTbfXWnA8iosxR i3xQDBNBm6nMBkpozyoQJ0vRdI2KG68b1O2rX8lMxQej1bpkg95TAwAoCbeBPX17WXQI vrUYqrjnbTqwD0gCqWNILBwWsmF27jlAcQpSe23WxY7NRlxU6c9hx6ZEHQhPAZSI4eVW WVmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690435992; x=1691040792; 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=p47IEHM+JZSsAANQ/kyvjM6x0oAWT/q0JwErNba07sU=; b=Aj3Wqyd2vflm17MKovW33mGIgYsnsUq7rwI64scZ4tvkXIYF5jG/NPMKnKG1OSyy0h dgwR8oMf2LgtGE6GetV6gnUc7eejnr5ZdDi99l/zmAPLSLlGUzzMIiHEokIQJ2tcLfnH Orm4v1+9n8/H0jQfC7nxxoutJ0Ad1PqYoaQKu95t6Paa6lvpWu6Vhvey/9gQUxnbvsFA Js8/JFwEZxzhzP7oHW8rwqfvGiNsWcReBVfOyDeFA1J/oXQ9Qd2118Ja+8p+ZbQ+vnJW KSC5IjfFabsUGMUbtWezubb0Q4tWUoQj0vviLjEDO39B/jiY1gzEnMIE43vpGeMHisgN XR/Q== X-Gm-Message-State: ABy/qLaEKfmzZAYykB5BmUIrxBsQpXTbcfKsML0XLHeP+P8fhPMxdapg tcW2wki6tsNo3MmWPfxBI675TA== X-Google-Smtp-Source: APBJJlEpXgAf/SMRf0Z3BXR+DOQC2gQ41hjdzkvIn6yKyCoC8D2FLzqGxSICSduADERyliEuCcZ1sg== X-Received: by 2002:a17:902:7795:b0:1b8:b827:aa8e with SMTP id o21-20020a170902779500b001b8b827aa8emr3089993pll.11.1690435992455; Wed, 26 Jul 2023 22:33:12 -0700 (PDT) Received: from localhost.localdomain ([82.78.167.79]) by smtp.gmail.com with ESMTPSA id 21-20020a170902c11500b001bb889530adsm319059pli.217.2023.07.26.22.33.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 22:33:12 -0700 (PDT) From: Claudiu Beznea To: mturquette@baylibre.com, sboyd@kernel.org, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, mripard@kernel.org Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, varshini.rajendran@microchip.com, Claudiu Beznea Subject: [PATCH 06/42] clk: at91: clk-audio-pll: add support for parent_hw Date: Thu, 27 Jul 2023 08:31:20 +0300 Message-Id: <20230727053156.13587-7-claudiu.beznea@tuxon.dev> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230727053156.13587-1-claudiu.beznea@tuxon.dev> References: <20230727053156.13587-1-claudiu.beznea@tuxon.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230726_223312_975271_1563857B X-CRM114-Status: GOOD ( 16.84 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add support for parent_hw in audio pll clock drivers. With this parent-child relation is described with pointers rather than strings making registration a bit faster. All the SoC based drivers that rely on clk-audio-pll were adapted to the new API change. The switch itself for SoCs will be done in subsequent patches. Signed-off-by: Claudiu Beznea --- drivers/clk/at91/clk-audio-pll.c | 25 +++++++++++++++++-------- drivers/clk/at91/dt-compat.c | 6 +++--- drivers/clk/at91/pmc.h | 6 +++--- drivers/clk/at91/sama5d2.c | 6 +++--- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/drivers/clk/at91/clk-audio-pll.c b/drivers/clk/at91/clk-audio-pll.c index a92da64c12e1..7a13af95d628 100644 --- a/drivers/clk/at91/clk-audio-pll.c +++ b/drivers/clk/at91/clk-audio-pll.c @@ -450,7 +450,7 @@ static const struct clk_ops audio_pll_pmc_ops = { struct clk_hw * __init at91_clk_register_audio_pll_frac(struct regmap *regmap, const char *name, - const char *parent_name) + const char *parent_name, struct clk_hw *parent_hw) { struct clk_audio_frac *frac_ck; struct clk_init_data init = {}; @@ -462,7 +462,10 @@ at91_clk_register_audio_pll_frac(struct regmap *regmap, const char *name, init.name = name; init.ops = &audio_pll_frac_ops; - init.parent_names = &parent_name; + if (parent_hw) + init.parent_hws = (const struct clk_hw **)&parent_hw; + else + init.parent_names = &parent_name; init.num_parents = 1; init.flags = CLK_SET_RATE_GATE; @@ -480,10 +483,10 @@ at91_clk_register_audio_pll_frac(struct regmap *regmap, const char *name, struct clk_hw * __init at91_clk_register_audio_pll_pad(struct regmap *regmap, const char *name, - const char *parent_name) + const char *parent_name, struct clk_hw *parent_hw) { struct clk_audio_pad *apad_ck; - struct clk_init_data init; + struct clk_init_data init = {}; int ret; apad_ck = kzalloc(sizeof(*apad_ck), GFP_KERNEL); @@ -492,7 +495,10 @@ at91_clk_register_audio_pll_pad(struct regmap *regmap, const char *name, init.name = name; init.ops = &audio_pll_pad_ops; - init.parent_names = &parent_name; + if (parent_hw) + init.parent_hws = (const struct clk_hw **)&parent_hw; + else + init.parent_names = &parent_name; init.num_parents = 1; init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE | CLK_SET_RATE_PARENT; @@ -511,10 +517,10 @@ at91_clk_register_audio_pll_pad(struct regmap *regmap, const char *name, struct clk_hw * __init at91_clk_register_audio_pll_pmc(struct regmap *regmap, const char *name, - const char *parent_name) + const char *parent_name, struct clk_hw *parent_hw) { struct clk_audio_pmc *apmc_ck; - struct clk_init_data init; + struct clk_init_data init = {}; int ret; apmc_ck = kzalloc(sizeof(*apmc_ck), GFP_KERNEL); @@ -523,7 +529,10 @@ at91_clk_register_audio_pll_pmc(struct regmap *regmap, const char *name, init.name = name; init.ops = &audio_pll_pmc_ops; - init.parent_names = &parent_name; + if (parent_hw) + init.parent_hws = (const struct clk_hw **)&parent_hw; + else + init.parent_names = &parent_name; init.num_parents = 1; init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE | CLK_SET_RATE_PARENT; diff --git a/drivers/clk/at91/dt-compat.c b/drivers/clk/at91/dt-compat.c index d8e520e509d8..6698a770d45a 100644 --- a/drivers/clk/at91/dt-compat.c +++ b/drivers/clk/at91/dt-compat.c @@ -43,7 +43,7 @@ static void __init of_sama5d2_clk_audio_pll_frac_setup(struct device_node *np) parent_name = of_clk_get_parent_name(np, 0); - hw = at91_clk_register_audio_pll_frac(regmap, name, parent_name); + hw = at91_clk_register_audio_pll_frac(regmap, name, parent_name, NULL); if (IS_ERR(hw)) return; @@ -69,7 +69,7 @@ static void __init of_sama5d2_clk_audio_pll_pad_setup(struct device_node *np) parent_name = of_clk_get_parent_name(np, 0); - hw = at91_clk_register_audio_pll_pad(regmap, name, parent_name); + hw = at91_clk_register_audio_pll_pad(regmap, name, parent_name, NULL); if (IS_ERR(hw)) return; @@ -95,7 +95,7 @@ static void __init of_sama5d2_clk_audio_pll_pmc_setup(struct device_node *np) parent_name = of_clk_get_parent_name(np, 0); - hw = at91_clk_register_audio_pll_pmc(regmap, name, parent_name); + hw = at91_clk_register_audio_pll_pmc(regmap, name, parent_name, NULL); if (IS_ERR(hw)) return; diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index ce68c1b1fb70..6d541b4d3f50 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h @@ -130,15 +130,15 @@ struct clk_hw *of_clk_hw_pmc_get(struct of_phandle_args *clkspec, void *data); struct clk_hw * __init at91_clk_register_audio_pll_frac(struct regmap *regmap, const char *name, - const char *parent_name); + const char *parent_name, struct clk_hw *parent_hw); struct clk_hw * __init at91_clk_register_audio_pll_pad(struct regmap *regmap, const char *name, - const char *parent_name); + const char *parent_name, struct clk_hw *parent_hw); struct clk_hw * __init at91_clk_register_audio_pll_pmc(struct regmap *regmap, const char *name, - const char *parent_name); + const char *parent_name, struct clk_hw *parent_hw); struct clk_hw * __init at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock, diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index bc62b9ed4ea0..d2af421abddc 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c @@ -227,19 +227,19 @@ static void __init sama5d2_pmc_setup(struct device_node *np) sama5d2_pmc->chws[PMC_PLLACK] = hw; hw = at91_clk_register_audio_pll_frac(regmap, "audiopll_fracck", - "mainck"); + "mainck", NULL); if (IS_ERR(hw)) goto err_free; hw = at91_clk_register_audio_pll_pad(regmap, "audiopll_padck", - "audiopll_fracck"); + "audiopll_fracck", NULL); if (IS_ERR(hw)) goto err_free; sama5d2_pmc->chws[PMC_AUDIOPINCK] = hw; hw = at91_clk_register_audio_pll_pmc(regmap, "audiopll_pmcck", - "audiopll_fracck"); + "audiopll_fracck", NULL); if (IS_ERR(hw)) goto err_free;