devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
To: Kewei Xu <kewei.xu@mediatek.com>, wsa@the-dreams.de
Cc: matthias.bgg@gmail.com, robh+dt@kernel.org,
	linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	srv_heupstream@mediatek.com, leilk.liu@mediatek.com,
	qii.wang@mediatek.com, liguo.zhang@mediatek.com,
	caiyu.chen@mediatek.com, housong.zhang@mediatek.com,
	yuhan.wei@mediatek.com, david-yh.chiu@mediatek.com,
	liju-clr.chen@mediatek.com
Subject: Re: [PATCH 2/2] i2c: mediatek: Add i2c compatible for Mediatek MT8188
Date: Thu, 7 Jul 2022 10:43:58 +0200	[thread overview]
Message-ID: <fae6c582-ec65-47d8-548f-934e8e829daf@collabora.com> (raw)
In-Reply-To: <20220707054617.13583-3-kewei.xu@mediatek.com>

Il 07/07/22 07:46, Kewei Xu ha scritto:
> Add i2c compatible for MT8188. Compare to MT8192 i2c controller,
> The MT8188 i2c OFFSET_SLAVE_ADDR register changed from 0x04 to 0x94.
> 
> Signed-off-by: Kewei Xu <kewei.xu@mediatek.com>
> ---
>   drivers/i2c/busses/i2c-mt65xx.c | 41 +++++++++++++++++++++++++++++++--
>   1 file changed, 39 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
> index 8e6985354fd5..aa2e1cb87420 100644
> --- a/drivers/i2c/busses/i2c-mt65xx.c
> +++ b/drivers/i2c/busses/i2c-mt65xx.c
> @@ -135,6 +135,7 @@ enum mtk_trans_op {
>   enum I2C_REGS_OFFSET {
>   	OFFSET_DATA_PORT,
>   	OFFSET_SLAVE_ADDR,
> +	OFFSET_SLAVE_ADDR1,
>   	OFFSET_INTR_MASK,
>   	OFFSET_INTR_STAT,
>   	OFFSET_CONTROL,
> @@ -203,6 +204,7 @@ static const u16 mt_i2c_regs_v1[] = {
>   static const u16 mt_i2c_regs_v2[] = {
>   	[OFFSET_DATA_PORT] = 0x0,
>   	[OFFSET_SLAVE_ADDR] = 0x4,
> +	[OFFSET_SLAVE_ADDR1] = 0x94,

Instead of adding a "slave addr version" entry... you can as well just define
a new array here with an appropriate name.

static const u16 mt_i2c_regs_v3[] = {

.......

}

This way, you don't have to change all of the platform data entries and you
also won't have to add checks in the do_transfer function, as that's one of
the actual points of having these arrays of register offsets in here.

Regards,
Angelo


  reply	other threads:[~2022-07-07  8:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07  5:46 [PATCH V1 0/2] add i2c support for mt8188 Kewei Xu
2022-07-07  5:46 ` [PATCH V1 1/2] dt-bindings: i2c: update bindings for MT8188 SoC Kewei Xu
2022-07-07  8:44   ` AngeloGioacchino Del Regno
2022-07-07  5:46 ` [PATCH 2/2] i2c: mediatek: Add i2c compatible for Mediatek MT8188 Kewei Xu
2022-07-07  8:43   ` AngeloGioacchino Del Regno [this message]
2022-07-08  1:24     ` Kewei Xu
  -- strict thread matches above, loose matches on Subject: below --
2022-07-08  2:18 [PATCH V2 0/2] add i2c support for mt8188 Kewei Xu
2022-07-08  2:18 ` [PATCH 2/2] i2c: mediatek: Add i2c compatible for Mediatek MT8188 Kewei Xu
2022-07-08  3:15 [PATCH 1/2] dt-bindings: i2c: update bindings for MT8188 SoC kewei.xu
2022-07-08  3:15 ` [PATCH 2/2] i2c: mediatek: Add i2c compatible for Mediatek MT8188 kewei.xu

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=fae6c582-ec65-47d8-548f-934e8e829daf@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=caiyu.chen@mediatek.com \
    --cc=david-yh.chiu@mediatek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=housong.zhang@mediatek.com \
    --cc=kewei.xu@mediatek.com \
    --cc=leilk.liu@mediatek.com \
    --cc=liguo.zhang@mediatek.com \
    --cc=liju-clr.chen@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=qii.wang@mediatek.com \
    --cc=robh+dt@kernel.org \
    --cc=srv_heupstream@mediatek.com \
    --cc=wsa@the-dreams.de \
    --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;
as well as URLs for NNTP newsgroup(s).