From: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
To: Defa Li <defa.li@mediatek.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>
Cc: <linux-i3c@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>, <wsd_upstream@mediatek.com>,
<mingchang.jia@mediatek.com>, <yuhan.wei@mediatek.com>,
<hao.lin@mediatek.com>
Subject: Re: [PATCH] i3c: master: Improve initialization of numbered I2C adapters
Date: Mon, 9 Dec 2024 23:46:31 +0530 [thread overview]
Message-ID: <54ac6a4f-5ae0-409f-8401-d6e1326d4358@quicinc.com> (raw)
In-Reply-To: <20241205132934.12110-1-defa.li@mediatek.com>
On 12/5/2024 6:59 PM, Defa Li wrote:
> Add logic to initialize I2C adapters with a specific ID if available,
> improving device identification and configuration.
>
Could you also provide how exactly to define this into DT to have
numbering while registering the adapter ? Kind of sample to which can be
defined in DTSI.
> Signed-off-by: Defa Li <defa.li@mediatek.com>
> ---
> drivers/i3c/master.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index 42310c9a00c2..a838cdbb897b 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -2486,7 +2486,7 @@ static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master)
> struct i2c_adapter *adap = i3c_master_to_i2c_adapter(master);
> struct i2c_dev_desc *i2cdev;
> struct i2c_dev_boardinfo *i2cboardinfo;
> - int ret;
> + int ret, id = -ENODEV;
>
> adap->dev.parent = master->dev.parent;
> adap->owner = master->dev.parent->driver->owner;
> @@ -2497,7 +2497,14 @@ static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master)
> adap->timeout = 1000;
> adap->retries = 3;
>
> - ret = i2c_add_adapter(adap);
> + if (master->dev.of_node)
> + id = of_alias_get_id(master->dev.of_node, "i2c");
> +
> + if (id >= 0) {
> + adap->nr = id;
> + ret = i2c_add_numbered_adapter(adap);
> + } else
> + ret = i2c_add_adapter(adap);
Please provide braces for else too.
> if (ret)
> return ret;
>
prev parent reply other threads:[~2024-12-09 18:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 13:29 Defa Li
2024-12-09 18:16 ` Mukesh Kumar Savaliya [this message]
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=54ac6a4f-5ae0-409f-8401-d6e1326d4358@quicinc.com \
--to=quic_msavaliy@quicinc.com \
--cc=alexandre.belloni@bootlin.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=defa.li@mediatek.com \
--cc=hao.lin@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i3c@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mingchang.jia@mediatek.com \
--cc=wsd_upstream@mediatek.com \
--cc=yuhan.wei@mediatek.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
all inboxes | Powered by JetHome®