[PATCH 2/2] i2c: mediatek: Add i2c compatible for Mediatek MT8188

Kewei Xu kewei.xu at mediatek.com
Thu Jul 7 18:24:38 PDT 2022


On Thu, 2022-07-07 at 10:43 +0200, AngeloGioacchino Del Regno wrote:
> 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 at 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
> 

Hi Angelo,

Thank you very much for your suggestion, I will update the patch as
soon as possible.

Regards,
Kewei


More information about the linux-arm-kernel mailing list