linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@somainline.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Georgi Djakov <djakov@kernel.org>
Cc: Shawn Guo <shawn.guo@linaro.org>,
	Yassine Oudjana <y.oudjana@protonmail.com>,
	linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH v2 01/11] interconnect: icc-rpm: move bus clocks handling into qnoc_probe
Date: Sat, 4 Sep 2021 12:58:22 +0200	[thread overview]
Message-ID: <b3f9dbc7-8426-1ce6-b0ea-4342c51ff56a@somainline.org> (raw)
In-Reply-To: <20210903232421.1384199-2-dmitry.baryshkov@linaro.org>

Il 04/09/21 01:24, Dmitry Baryshkov ha scritto:
> All icc-rpm drivers use the same set of bus clocks. Move handling of bus
> clocks to qnoc_probe. This both simplifies the code and allows using
> qnoc_probe as device's probe funcion.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

Tested on Sony Xperia XA2 (sdm630-pioneer)



Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

> ---
>   drivers/interconnect/qcom/icc-rpm.c | 22 ++++++++++++++--------
>   drivers/interconnect/qcom/icc-rpm.h |  5 ++---
>   drivers/interconnect/qcom/msm8916.c | 13 +------------
>   drivers/interconnect/qcom/msm8939.c | 13 +------------
>   drivers/interconnect/qcom/qcs404.c  | 13 +------------
>   5 files changed, 19 insertions(+), 47 deletions(-)
> 
> diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c
> index 54de49ca7808..394f515cc88d 100644
> --- a/drivers/interconnect/qcom/icc-rpm.c
> +++ b/drivers/interconnect/qcom/icc-rpm.c
> @@ -86,8 +86,11 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst)
>   	return 0;
>   }
>   
> -int qnoc_probe(struct platform_device *pdev, size_t cd_size, int cd_num,
> -	       const struct clk_bulk_data *cd)
> +static const char * const bus_clocks[] = {
> +	"bus", "bus_a",
> +};
> +
> +int qnoc_probe(struct platform_device *pdev)
>   {
>   	struct device *dev = &pdev->dev;
>   	const struct qcom_icc_desc *desc;
> @@ -97,6 +100,8 @@ int qnoc_probe(struct platform_device *pdev, size_t cd_size, int cd_num,
>   	struct qcom_icc_provider *qp;
>   	struct icc_node *node;
>   	size_t num_nodes, i;
> +	const char * const * cds;
> +	int cd_num;
>   	int ret;
>   
>   	/* wait for the RPM proxy */
> @@ -110,7 +115,10 @@ int qnoc_probe(struct platform_device *pdev, size_t cd_size, int cd_num,
>   	qnodes = desc->nodes;
>   	num_nodes = desc->num_nodes;
>   
> -	qp = devm_kzalloc(dev, sizeof(*qp), GFP_KERNEL);
> +	cds = bus_clocks;
> +	cd_num = ARRAY_SIZE(bus_clocks);
> +
> +	qp = devm_kzalloc(dev, struct_size(qp, bus_clks, cd_num), GFP_KERNEL);
>   	if (!qp)
>   		return -ENOMEM;
>   
> @@ -119,12 +127,10 @@ int qnoc_probe(struct platform_device *pdev, size_t cd_size, int cd_num,
>   	if (!data)
>   		return -ENOMEM;
>   
> -	qp->bus_clks = devm_kmemdup(dev, cd, cd_size,
> -				    GFP_KERNEL);
> -	if (!qp->bus_clks)
> -		return -ENOMEM;
> -
> +	for (i = 0; i < cd_num; i++)
> +		qp->bus_clks[i].id = cds[i];
>   	qp->num_clks = cd_num;
> +
>   	ret = devm_clk_bulk_get(dev, qp->num_clks, qp->bus_clks);
>   	if (ret)
>   		return ret;
> diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h
> index 79a6f68249c1..f4b05c20c097 100644
> --- a/drivers/interconnect/qcom/icc-rpm.h
> +++ b/drivers/interconnect/qcom/icc-rpm.h
> @@ -22,8 +22,8 @@
>    */
>   struct qcom_icc_provider {
>   	struct icc_provider provider;
> -	struct clk_bulk_data *bus_clks;
>   	int num_clks;
> +	struct clk_bulk_data bus_clks[];
>   };
>   
>   /**
> @@ -66,8 +66,7 @@ struct qcom_icc_desc {
>   	}
>   
>   
> -int qnoc_probe(struct platform_device *pdev, size_t cd_size, int cd_num,
> -	       const struct clk_bulk_data *cd);
> +int qnoc_probe(struct platform_device *pdev);
>   int qnoc_remove(struct platform_device *pdev);
>   
>   #endif
> diff --git a/drivers/interconnect/qcom/msm8916.c b/drivers/interconnect/qcom/msm8916.c
> index fc3689c8947a..fc0d48d2997a 100644
> --- a/drivers/interconnect/qcom/msm8916.c
> +++ b/drivers/interconnect/qcom/msm8916.c
> @@ -105,11 +105,6 @@ enum {
>   	MSM8916_SNOC_PNOC_SLV,
>   };
>   
> -static const struct clk_bulk_data msm8916_bus_clocks[] = {
> -	{ .id = "bus" },
> -	{ .id = "bus_a" },
> -};
> -
>   DEFINE_QNODE(bimc_snoc_mas, MSM8916_BIMC_SNOC_MAS, 8, -1, -1, MSM8916_BIMC_SNOC_SLV);
>   DEFINE_QNODE(bimc_snoc_slv, MSM8916_BIMC_SNOC_SLV, 8, -1, -1, MSM8916_SNOC_INT_0, MSM8916_SNOC_INT_1);
>   DEFINE_QNODE(mas_apss, MSM8916_MASTER_AMPSS_M0, 8, -1, -1, MSM8916_SLAVE_EBI_CH0, MSM8916_BIMC_SNOC_MAS, MSM8916_SLAVE_AMPSS_L2);
> @@ -305,12 +300,6 @@ static struct qcom_icc_desc msm8916_pcnoc = {
>   	.num_nodes = ARRAY_SIZE(msm8916_pcnoc_nodes),
>   };
>   
> -static int msm8916_qnoc_probe(struct platform_device *pdev)
> -{
> -	return qnoc_probe(pdev, sizeof(msm8916_bus_clocks),
> -			  ARRAY_SIZE(msm8916_bus_clocks), msm8916_bus_clocks);
> -}
> -
>   static const struct of_device_id msm8916_noc_of_match[] = {
>   	{ .compatible = "qcom,msm8916-bimc", .data = &msm8916_bimc },
>   	{ .compatible = "qcom,msm8916-pcnoc", .data = &msm8916_pcnoc },
> @@ -320,7 +309,7 @@ static const struct of_device_id msm8916_noc_of_match[] = {
>   MODULE_DEVICE_TABLE(of, msm8916_noc_of_match);
>   
>   static struct platform_driver msm8916_noc_driver = {
> -	.probe = msm8916_qnoc_probe,
> +	.probe = qnoc_probe,
>   	.remove = qnoc_remove,
>   	.driver = {
>   		.name = "qnoc-msm8916",
> diff --git a/drivers/interconnect/qcom/msm8939.c b/drivers/interconnect/qcom/msm8939.c
> index 20f31a1b4192..4a5a2ec64960 100644
> --- a/drivers/interconnect/qcom/msm8939.c
> +++ b/drivers/interconnect/qcom/msm8939.c
> @@ -110,11 +110,6 @@ enum {
>   	MSM8939_SNOC_PNOC_SLV,
>   };
>   
> -static const struct clk_bulk_data msm8939_bus_clocks[] = {
> -	{ .id = "bus" },
> -	{ .id = "bus_a" },
> -};
> -
>   DEFINE_QNODE(bimc_snoc_mas, MSM8939_BIMC_SNOC_MAS, 8, -1, -1, MSM8939_BIMC_SNOC_SLV);
>   DEFINE_QNODE(bimc_snoc_slv, MSM8939_BIMC_SNOC_SLV, 16, -1, 2, MSM8939_SNOC_INT_0, MSM8939_SNOC_INT_1);
>   DEFINE_QNODE(mas_apss, MSM8939_MASTER_AMPSS_M0, 16, -1, -1, MSM8939_SLAVE_EBI_CH0, MSM8939_BIMC_SNOC_MAS, MSM8939_SLAVE_AMPSS_L2);
> @@ -326,12 +321,6 @@ static struct qcom_icc_desc msm8939_pcnoc = {
>   	.num_nodes = ARRAY_SIZE(msm8939_pcnoc_nodes),
>   };
>   
> -static int msm8939_qnoc_probe(struct platform_device *pdev)
> -{
> -	return qnoc_probe(pdev, sizeof(msm8939_bus_clocks),
> -			  ARRAY_SIZE(msm8939_bus_clocks), msm8939_bus_clocks);
> -}
> -
>   static const struct of_device_id msm8939_noc_of_match[] = {
>   	{ .compatible = "qcom,msm8939-bimc", .data = &msm8939_bimc },
>   	{ .compatible = "qcom,msm8939-pcnoc", .data = &msm8939_pcnoc },
> @@ -342,7 +331,7 @@ static const struct of_device_id msm8939_noc_of_match[] = {
>   MODULE_DEVICE_TABLE(of, msm8939_noc_of_match);
>   
>   static struct platform_driver msm8939_noc_driver = {
> -	.probe = msm8939_qnoc_probe,
> +	.probe = qnoc_probe,
>   	.remove = qnoc_remove,
>   	.driver = {
>   		.name = "qnoc-msm8939",
> diff --git a/drivers/interconnect/qcom/qcs404.c b/drivers/interconnect/qcom/qcs404.c
> index 36a7e30a00be..0f2fff230b13 100644
> --- a/drivers/interconnect/qcom/qcs404.c
> +++ b/drivers/interconnect/qcom/qcs404.c
> @@ -92,11 +92,6 @@ enum {
>   	QCS404_SLAVE_LPASS,
>   };
>   
> -static const struct clk_bulk_data qcs404_bus_clocks[] = {
> -	{ .id = "bus" },
> -	{ .id = "bus_a" },
> -};
> -
>   DEFINE_QNODE(mas_apps_proc, QCS404_MASTER_AMPSS_M0, 8, 0, -1, QCS404_SLAVE_EBI_CH0, QCS404_BIMC_SNOC_SLV);
>   DEFINE_QNODE(mas_oxili, QCS404_MASTER_GRAPHICS_3D, 8, -1, -1, QCS404_SLAVE_EBI_CH0, QCS404_BIMC_SNOC_SLV);
>   DEFINE_QNODE(mas_mdp, QCS404_MASTER_MDP_PORT0, 8, -1, -1, QCS404_SLAVE_EBI_CH0, QCS404_BIMC_SNOC_SLV);
> @@ -269,12 +264,6 @@ static struct qcom_icc_desc qcs404_snoc = {
>   };
>   
>   
> -static int qcs404_qnoc_probe(struct platform_device *pdev)
> -{
> -	return qnoc_probe(pdev, sizeof(qcs404_bus_clocks),
> -			  ARRAY_SIZE(qcs404_bus_clocks), qcs404_bus_clocks);
> -}
> -
>   static const struct of_device_id qcs404_noc_of_match[] = {
>   	{ .compatible = "qcom,qcs404-bimc", .data = &qcs404_bimc },
>   	{ .compatible = "qcom,qcs404-pcnoc", .data = &qcs404_pcnoc },
> @@ -284,7 +273,7 @@ static const struct of_device_id qcs404_noc_of_match[] = {
>   MODULE_DEVICE_TABLE(of, qcs404_noc_of_match);
>   
>   static struct platform_driver qcs404_noc_driver = {
> -	.probe = qcs404_qnoc_probe,
> +	.probe = qnoc_probe,
>   	.remove = qnoc_remove,
>   	.driver = {
>   		.name = "qnoc-qcs404",
> 


  reply	other threads:[~2021-09-04 10:59 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 23:24 [PATCH v2 0/11] interconnect: merge AP-owned support into icc-rpm Dmitry Baryshkov
2021-09-03 23:24 ` [PATCH v2 01/11] interconnect: icc-rpm: move bus clocks handling into qnoc_probe Dmitry Baryshkov
2021-09-04 10:58   ` AngeloGioacchino Del Regno [this message]
2021-09-04 11:04   ` Marijn Suijten
2021-10-04 11:49   ` Georgi Djakov
2021-09-03 23:24 ` [PATCH v2 02/11] interconnect: sdm660: expand DEFINE_QNODE macros Dmitry Baryshkov
2021-09-04 10:58   ` AngeloGioacchino Del Regno
2021-09-04 10:58   ` AngeloGioacchino Del Regno
2021-09-04 11:05   ` Marijn Suijten
2021-09-03 23:24 ` [PATCH v2 03/11] interconnect: sdm660: drop default/unused values Dmitry Baryshkov
2021-09-04 10:59   ` AngeloGioacchino Del Regno
2021-09-04 11:05   ` Marijn Suijten
2021-09-03 23:24 ` [PATCH v2 04/11] interconnect: sdm660: merge common code into icc-rpm Dmitry Baryshkov
2021-09-04 10:59   ` AngeloGioacchino Del Regno
2021-09-04 11:05   ` Marijn Suijten
2021-10-04 11:54   ` Georgi Djakov
2021-09-03 23:24 ` [PATCH v2 05/11] interconnect: icc-rpm: add support for QoS reg offset Dmitry Baryshkov
2021-09-04 10:59   ` AngeloGioacchino Del Regno
2021-09-03 23:24 ` [PATCH v2 06/11] interconnect: msm8916: expand DEFINE_QNODE macros Dmitry Baryshkov
2021-09-04 10:59   ` AngeloGioacchino Del Regno
2021-09-03 23:24 ` [PATCH v2 07/11] interconnect: msm8916: add support for AP-owned nodes Dmitry Baryshkov
2021-09-04 11:00   ` AngeloGioacchino Del Regno
2021-09-03 23:24 ` [PATCH v2 08/11] interconnect: msm8939: expand DEFINE_QNODE macros Dmitry Baryshkov
2021-09-04 11:00   ` AngeloGioacchino Del Regno
2021-09-03 23:24 ` [PATCH v2 09/11] interconnect: msm8939: add support for AP-owned nodes Dmitry Baryshkov
2021-09-04 11:00   ` AngeloGioacchino Del Regno
2021-09-03 23:24 ` [PATCH v2 10/11] interconnect: qcs404: expand DEFINE_QNODE macros Dmitry Baryshkov
2021-09-04 11:00   ` AngeloGioacchino Del Regno
2021-09-03 23:24 ` [PATCH v2 11/11] interconnect: qcom: drop DEFINE_QNODE macro Dmitry Baryshkov
2021-09-04 11:00   ` AngeloGioacchino Del Regno
2021-09-04 11:05   ` Marijn Suijten
2021-09-06  5:42 ` [PATCH v2 0/11] interconnect: merge AP-owned support into icc-rpm Shawn Guo
2021-09-25 19:40 ` Dmitry Baryshkov
2021-10-04 11:56   ` Georgi Djakov
2021-10-04 12:37     ` Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b3f9dbc7-8426-1ce6-b0ea-4342c51ff56a@somainline.org \
    --to=angelogioacchino.delregno@somainline.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=djakov@kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=shawn.guo@linaro.org \
    --cc=y.oudjana@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).