From patchwork Tue Jul 5 20:30:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12907041 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03740CCA483 for ; Tue, 5 Jul 2022 20:57:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231445AbiGEU5p (ORCPT ); Tue, 5 Jul 2022 16:57:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232620AbiGEU5c (ORCPT ); Tue, 5 Jul 2022 16:57:32 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94C2E13FBB; Tue, 5 Jul 2022 13:57:31 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id n4so4435834ejz.10; Tue, 05 Jul 2022 13:57:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=e4tUb5C67DiBxz7NqEEQ7OjQvrD/Rs9OTZXUbtaDEJU=; b=ewJadcZCfCX01AQ0rRjcHbNo/r57oGwLEXsaG+Le9z52O+3+9etstDAwj1chvKgVKq snZ72Au8LWJsBzUpanZitiYFJMYRPI0TF07e81e0QUl020cTWqzF4AWmzV4NA1XzSeW1 FXheeKRPyvjezVOhGAPVYvQMaGMYAeNCStniqQFVQjdailGy6JVaz5M6wVmz3o0QaOLo 6i3shKAZu2TyyXvAxQ3Ki81POUq+IQSEBGqd0tgDJRQhGduBWyP9mfSJ31b6zXiwT/4I CF08flvCnea1RzVglDWSZ+Epfubu6j1I2kyyKwuBZhpSG/lfOr1IR/9LxzkdH3IR+G4V nySQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=e4tUb5C67DiBxz7NqEEQ7OjQvrD/Rs9OTZXUbtaDEJU=; b=ePQqgpwH0wfnx4IrGGtO3M+4fARtKUgwIq489J57BS294pt98qBMaUkXLM2LZ+apHu tzzLeClYE8A8RuACi9+mFC2Cud1tkvK93oCam3aLI1g+mklbTg78Q8M9eUASbyHXyglR +Ztgs73KrkUIRlBQ+57W/GzGC2M6NPzhkim8f0yNwi4SCTgGkQaV9fQcFnblZvot+H3t hXKHdTMeo2M+SkFxqbCDZOBOBDeS0mDLhqhkRWJafjg9JV9O2vG8dCp8QZgQJv2NJyym o8JfqATG5b0VVvomS5f9WUi4mcEdENXFvj4QRQ4Ov1wcDByPcJWasFzo2KbpAmF7HNvE OkxQ== X-Gm-Message-State: AJIora/sUECDDPJBF0GnNbCWAeu4GXEO2VaIcx5MKjpqNXkW1YNOyYrb 4mGEaXSYSboO+nGv/jU14iqW5zeU7UE= X-Google-Smtp-Source: AGRyM1us3X7z2uO7g2uvxLgYU68CekTEp9kWFADT51smYEelq2csD7N35H38cz8m8UsMU0jBDpouEA== X-Received: by 2002:a17:907:3f1d:b0:726:c927:769b with SMTP id hq29-20020a1709073f1d00b00726c927769bmr35983967ejc.754.1657054650098; Tue, 05 Jul 2022 13:57:30 -0700 (PDT) Received: from localhost.localdomain (93-42-70-190.ip85.fastwebnet.it. [93.42.70.190]) by smtp.googlemail.com with ESMTPSA id s6-20020a1709062ec600b00711d88ae162sm16249037eji.24.2022.07.05.13.57.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jul 2022 13:57:29 -0700 (PDT) From: Christian Marangi To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Michael Turquette , Stephen Boyd , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [PATCH 1/2] clk: introduce (devm_)hw_register_mux_parent_data_table API Date: Tue, 5 Jul 2022 22:30:32 +0200 Message-Id: <20220705203033.1862-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Introduce (devm_)hw_register_mux_parent_data_table new API. We have basic support for clk_register_mux using parent_data but we lack any API to provide a custom parent_map. Add these 2 new API to correctly handle these special configuration instead of using the generic __(devm_)clk_hw_register_mux API. Signed-off-by: Christian Marangi --- include/linux/clk-provider.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 72d937c03a3e..0e9aceaf87a1 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -955,12 +955,26 @@ struct clk *clk_register_mux_table(struct device *dev, const char *name, __clk_hw_register_mux((dev), NULL, (name), (num_parents), NULL, NULL, \ (parent_data), (flags), (reg), (shift), \ BIT((width)) - 1, (clk_mux_flags), NULL, (lock)) +#define clk_hw_register_mux_parent_data_table(dev, name, parent_data, \ + num_parents, flags, reg, shift, \ + width, clk_mux_flags, table, \ + lock) \ + __clk_hw_register_mux((dev), NULL, (name), (num_parents), NULL, NULL, \ + (parent_data), (flags), (reg), (shift), \ + BIT((width)) - 1, (clk_mux_flags), table, (lock)) #define devm_clk_hw_register_mux(dev, name, parent_names, num_parents, flags, reg, \ shift, width, clk_mux_flags, lock) \ __devm_clk_hw_register_mux((dev), NULL, (name), (num_parents), \ (parent_names), NULL, NULL, (flags), (reg), \ (shift), BIT((width)) - 1, (clk_mux_flags), \ NULL, (lock)) +#define devm_clk_hw_register_mux_parent_data_table(dev, name, parent_data, \ + num_parents, flags, reg, shift, \ + width, clk_mux_flags, table, \ + lock) \ + __devm_clk_hw_register_mux((dev), NULL, (name), (num_parents), NULL, \ + NULL, (parent_data), (flags), (reg), (shift), \ + BIT((width)) - 1, (clk_mux_flags), table, (lock)) int clk_mux_val_to_index(struct clk_hw *hw, const u32 *table, unsigned int flags, unsigned int val); From patchwork Tue Jul 5 20:30:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12907040 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38320CCA47C for ; Tue, 5 Jul 2022 20:57:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229494AbiGEU5o (ORCPT ); Tue, 5 Jul 2022 16:57:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232671AbiGEU5d (ORCPT ); Tue, 5 Jul 2022 16:57:33 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6632140AA; Tue, 5 Jul 2022 13:57:32 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id fd6so16842789edb.5; Tue, 05 Jul 2022 13:57:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YzeSfz6dKxC0YWd2Gn+465VZcjebb0Kt+/rRxTIo9ME=; b=C8Zmcobf7OdZhkR+lwcMLPSDf8wfeuIbsbSl/ayiMXqOzKJvy6t5qCxGW/eR+qSZQN z7EwCFgfBgd8pVzU4/PO9BpS9o+IipT1L3jCbGV81GusGpTx3vIsmE7M3XP+GMN8GVCl ImlkHPCm6812/XFyDjuvzOdT1mkHgAvYkfKjMditUmIzyWLKMk9L4HDNfv1LjdpM9HPD ZzH/wBV4oHCTafi//2rBeWoC/K0qLTNXV4MZfjwpiJ7wCIe6xwx/IHAunvpeAF832ifI D85EMHkWPrF0tECCeaT8JLkHQv2eFG4sJknYUzovId9wCItFtdJlNh5OtJIyQESjbNk+ pyyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YzeSfz6dKxC0YWd2Gn+465VZcjebb0Kt+/rRxTIo9ME=; b=QRQfgGUfY19IfXzUP/bbHi6CZg470rTa9rkP8RrbnMkIREObLFYSCIKxumc7oFIgwo meRoewBI1UdhOQEgdmTE12V5gbe1y5mCrpFShIYbA02W6Iq1E7WtG+umYb+AA4cI/hRl mLE3gKDsp26XuDRWyiKu4GOz3Yt+pSElEbKu+XQqSs1U3TjaIxof6OG4BbScTHiJY5IY hN1oCkoM2w7WC0zUx/mu0F0F9iWq61z0MfPHnUaO+ZMtLxTmkJPIpNcI0/leBmDZm8xE IVooKwhuK1txTISfdFFDduAz7InI6h2ho8AUhXdaaZn5Dkl6OPavjzrLRtOnki/ueBzS Z/KA== X-Gm-Message-State: AJIora9bU6Z6+yr6xZKW1D7U4QxcHSwLojZmd7JJRf5Zuu9JFt1WpFPL 0r2DkcGc/q5UIASwkcc+Wcc= X-Google-Smtp-Source: AGRyM1vPjW9CIqm1k+DoMFEPeeyiYyc+BoO3VRXbbGctsaTtnrI1wvbh8j+f6oMXewkCZE5bcq/nqQ== X-Received: by 2002:a05:6402:34c8:b0:437:74d5:f8df with SMTP id w8-20020a05640234c800b0043774d5f8dfmr48652572edc.274.1657054651193; Tue, 05 Jul 2022 13:57:31 -0700 (PDT) Received: from localhost.localdomain (93-42-70-190.ip85.fastwebnet.it. [93.42.70.190]) by smtp.googlemail.com with ESMTPSA id s6-20020a1709062ec600b00711d88ae162sm16249037eji.24.2022.07.05.13.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jul 2022 13:57:30 -0700 (PDT) From: Christian Marangi To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Michael Turquette , Stephen Boyd , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [PATCH 2/2] clk: qcom: kpss-xcc: convert to parent data API Date: Tue, 5 Jul 2022 22:30:33 +0200 Message-Id: <20220705203033.1862-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220705203033.1862-1-ansuelsmth@gmail.com> References: <20220705203033.1862-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Convert the driver to parent data API. From the Documentation pll8_vote and pxo should be declared in the DTS so fw_name can be used instead of parent_names. Name is still used to save regression on old definition. Signed-off-by: Christian Marangi --- drivers/clk/qcom/kpss-xcc.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/clk/qcom/kpss-xcc.c b/drivers/clk/qcom/kpss-xcc.c index 88d4b33ac0cc..625f02696eff 100644 --- a/drivers/clk/qcom/kpss-xcc.c +++ b/drivers/clk/qcom/kpss-xcc.c @@ -12,9 +12,9 @@ #include #include -static const char *aux_parents[] = { - "pll8_vote", - "pxo", +static const struct clk_parent_data aux_parents[] = { + { .name = "pll8_vote", .fw_name = "pll8_vote" }, + { .name = "pxo", .fw_name = "pxo" }, }; static const u32 aux_parent_map[] = { @@ -32,8 +32,8 @@ MODULE_DEVICE_TABLE(of, kpss_xcc_match_table); static int kpss_xcc_driver_probe(struct platform_device *pdev) { const struct of_device_id *id; - struct clk *clk; void __iomem *base; + struct clk_hw *hw; const char *name; id = of_match_device(kpss_xcc_match_table, &pdev->dev); @@ -55,24 +55,16 @@ static int kpss_xcc_driver_probe(struct platform_device *pdev) base += 0x28; } - clk = clk_register_mux_table(&pdev->dev, name, aux_parents, - ARRAY_SIZE(aux_parents), 0, base, 0, 0x3, - 0, aux_parent_map, NULL); + hw = devm_clk_hw_register_mux_parent_data_table(&pdev->dev, name, aux_parents, + ARRAY_SIZE(aux_parents), 0, + base, 0, 0x3, + 0, aux_parent_map, NULL); - platform_set_drvdata(pdev, clk); - - return PTR_ERR_OR_ZERO(clk); -} - -static int kpss_xcc_driver_remove(struct platform_device *pdev) -{ - clk_unregister_mux(platform_get_drvdata(pdev)); - return 0; + return PTR_ERR_OR_ZERO(hw); } static struct platform_driver kpss_xcc_driver = { .probe = kpss_xcc_driver_probe, - .remove = kpss_xcc_driver_remove, .driver = { .name = "kpss-xcc", .of_match_table = kpss_xcc_match_table,