[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d9d8e86b-a499-49d1-90ad-6fae5b7dcbb7@linaro.org>
Date: Wed, 14 Feb 2024 22:18:33 +0100
From: Konrad Dybcio <konrad.dybcio@...aro.org>
To: Abel Vesa <abel.vesa@...aro.org>, Stephen Boyd <sboyd@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Bjorn Andersson <andersson@...nel.org>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Neil Armstrong <neil.armstrong@...aro.org>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
Cc: Srini Kandagatla <srinivas.kandagatla@...aro.org>,
Johan Hovold <johan@...nel.org>, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-arm-msm@...r.kernel.org,
linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH RFC v3 3/4] spmi: pmic-arb: Make core resources acquiring
a version operation
On 14.02.2024 22:13, Abel Vesa wrote:
> Rather than setting up the core, obsrv and chnls in probe by using
> version specific conditionals, add a dedicated "get_core_resources"
> version specific op and move the acquiring in there.
>
> Signed-off-by: Abel Vesa <abel.vesa@...aro.org>
> ---
> drivers/spmi/spmi-pmic-arb.c | 111 ++++++++++++++++++++++++++++++-------------
> 1 file changed, 78 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
> index 23939c0d225f..489556467a4c 100644
> --- a/drivers/spmi/spmi-pmic-arb.c
> +++ b/drivers/spmi/spmi-pmic-arb.c
> @@ -203,6 +203,7 @@ struct spmi_pmic_arb {
> */
> struct pmic_arb_ver_ops {
> const char *ver_str;
> + int (*get_core_resources)(struct platform_device *pdev, void __iomem *core);
> int (*init_apid)(struct spmi_pmic_arb *pmic_arb, int index);
> int (*ppid_to_apid)(struct spmi_pmic_arb *pmic_arb, u16 ppid);
> /* spmi commands (read_cmd, write_cmd, cmd) functionality */
> @@ -956,6 +957,19 @@ static int pmic_arb_init_apid_min_max(struct spmi_pmic_arb *pmic_arb)
> return 0;
> }
>
> +static int pmic_arb_get_core_resources_v1(struct platform_device *pdev,
> + void __iomem *core)
> +{
> + struct spmi_pmic_arb *pmic_arb = platform_get_drvdata(pdev);
> +
> + pmic_arb->wr_base = core;
> + pmic_arb->rd_base = core;
> +
> + pmic_arb->max_periphs = PMIC_ARB_MAX_PERIPHS;
> +
> + return 0;
> +}
> +
> static int pmic_arb_init_apid_v1(struct spmi_pmic_arb *pmic_arb, int index)
> {
> u32 *mapping_table;
> @@ -1063,6 +1077,41 @@ static u16 pmic_arb_find_apid(struct spmi_pmic_arb *pmic_arb, u16 ppid)
> return apid;
> }
>
> +static int pmic_arb_get_obsrvr_chnls_v2(struct platform_device *pdev)
> +{
> + struct spmi_pmic_arb *pmic_arb = platform_get_drvdata(pdev);
> + struct device *dev = &pdev->dev;
> + struct resource *res;
> +
> + res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
It's no longer indented to deep, no need to keep such aggressive wrapping
> + "obsrvr");
> + pmic_arb->rd_base = devm_ioremap(dev, res->start,
> + resource_size(res));
> + if (IS_ERR(pmic_arb->rd_base))
> + return PTR_ERR(pmic_arb->rd_base);
> +
> + res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> + "chnls");
> + pmic_arb->wr_base = devm_ioremap(dev, res->start,
> + resource_size(res));
> + if (IS_ERR(pmic_arb->wr_base))
> + return PTR_ERR(pmic_arb->wr_base);
Could probably make it "devm_platform_get_and_ioremap_resource "
Konrad
Powered by blists - more mailing lists