From: Abel Vesa <abel.vesa@linaro.org>
To: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Stephen Boyd <sboyd@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Srini Kandagatla <srinivas.kandagatla@linaro.org>,
Johan Hovold <johan@kernel.org>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org,
linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org
Subject: Re: [PATCH RESEND v6 3/5] spmi: pmic-arb: Make the APID init a version operation
Date: Fri, 29 Mar 2024 18:32:40 +0200 [thread overview]
Message-ID: <ZgbtKNEJS/m8OQzt@linaro.org> (raw)
In-Reply-To: <9af9cfd1-38c7-4f38-a652-fd046f427f98@linaro.org>
On 24-03-28 09:51:49, Neil Armstrong wrote:
> On 26/03/2024 17:28, Abel Vesa wrote:
> > Rather than using conditionals in probe function, add the APID init
> > as a version specific operation. Due to v7, which supports multiple
> > buses, pass on the bus index to be used for sorting out the apid base
> > and count.
> >
> > Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
> > ---
> > drivers/spmi/spmi-pmic-arb.c | 199 +++++++++++++++++++++++++++----------------
> > 1 file changed, 124 insertions(+), 75 deletions(-)
> >
> > diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
> > index 9ed1180fe31f..38fed8a585fe 100644
> > --- a/drivers/spmi/spmi-pmic-arb.c
> > +++ b/drivers/spmi/spmi-pmic-arb.c
> > @@ -183,6 +183,7 @@ struct spmi_pmic_arb {
> > * struct pmic_arb_ver_ops - version dependent functionality.
> > *
> > * @ver_str: version string.
> > + * @init_apid: finds the apid base and count
> > * @ppid_to_apid: finds the apid for a given ppid.
> > * @non_data_cmd: on v1 issues an spmi non-data command.
> > * on v2 no HW support, returns -EOPNOTSUPP.
> > @@ -202,6 +203,7 @@ struct spmi_pmic_arb {
> > */
> > struct pmic_arb_ver_ops {
> > const char *ver_str;
> > + 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 */
> > int (*offset)(struct spmi_pmic_arb *pmic_arb, u8 sid, u16 addr,
> > @@ -942,6 +944,38 @@ static int qpnpint_irq_domain_alloc(struct irq_domain *domain,
> > return 0;
> > }
> > +static int pmic_arb_init_apid_min_max(struct spmi_pmic_arb *pmic_arb)
> > +{
> > + /*
> > + * Initialize max_apid/min_apid to the opposite bounds, during
> > + * the irq domain translation, we are sure to update these
> > + */
> > + pmic_arb->max_apid = 0;
> > + pmic_arb->min_apid = pmic_arb->max_periphs - 1;
> > +
> > + return 0;
> > +}
> > +
> > +static int pmic_arb_init_apid_v1(struct spmi_pmic_arb *pmic_arb, int index)
> > +{
> > + u32 *mapping_table;
> > +
> > + if (index) {
> > + dev_err(&pmic_arb->spmic->dev, "Unsupported buses count %d detected\n",
> > + index);
> > + return -EINVAL;
> > + }
> > +
> > + mapping_table = devm_kcalloc(&pmic_arb->spmic->dev, pmic_arb->max_periphs,
> > + sizeof(*mapping_table), GFP_KERNEL);
> > + if (!mapping_table)
> > + return -ENOMEM;
> > +
> > + pmic_arb->mapping_table = mapping_table;
>
> Can you specify in the spmi_pmic_arb->mapping_table struct documentation the mapping_table
> is only used in v1 ? or even better rename it to mapping_table_v1
>
Actually the mapping_table is used on version 1 through 3.
next prev parent reply other threads:[~2024-03-29 16:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-26 16:28 [PATCH RESEND v6 0/5] spmi: pmic-arb: Add support for multiple buses Abel Vesa
2024-03-26 16:28 ` [PATCH RESEND v6 1/5] dt-bindings: spmi: Add X1E80100 SPMI PMIC ARB schema Abel Vesa
2024-03-27 18:40 ` Krzysztof Kozlowski
2024-03-26 16:28 ` [PATCH RESEND v6 2/5] dt-bindings: spmi: Deprecate qcom,bus-id Abel Vesa
2024-03-26 16:28 ` [PATCH RESEND v6 3/5] spmi: pmic-arb: Make the APID init a version operation Abel Vesa
2024-03-28 8:51 ` Neil Armstrong
2024-03-29 16:32 ` Abel Vesa [this message]
2024-03-26 16:28 ` [PATCH RESEND v6 4/5] spmi: pmic-arb: Make core resources acquiring " Abel Vesa
2024-03-28 8:54 ` Neil Armstrong
2024-03-26 16:28 ` [PATCH RESEND v6 5/5] spmi: pmic-arb: Add multi bus support Abel Vesa
2024-03-28 9:05 ` Neil Armstrong
2024-03-26 19:32 ` [PATCH RESEND v6 0/5] spmi: pmic-arb: Add support for multiple buses Rob Herring
2024-03-26 19:57 ` Abel Vesa
2024-03-27 9:23 ` Krzysztof Kozlowski
2024-03-27 10:37 ` Abel Vesa
2024-03-27 10:44 ` Krzysztof Kozlowski
2024-03-28 9:07 ` Neil Armstrong
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=ZgbtKNEJS/m8OQzt@linaro.org \
--to=abel.vesa@linaro.org \
--cc=andersson@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=johan@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=neil.armstrong@linaro.org \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=srinivas.kandagatla@linaro.org \
/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).