[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vfgu0eXXJ_FTgMC-VUzTRSo7zoA4C9j3WsevPzhajpDSA@mail.gmail.com>
Date: Tue, 4 Jun 2024 12:15:33 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Mark Brown <broonie@...nel.org>
Cc: Jim Wylder <jwylder@...gle.com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>, kernel-team@...roid.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] regmap-i2c: Subtract reg size from max_write
On Mon, Jun 3, 2024 at 3:08 PM Mark Brown <broonie@...nel.org> wrote:
>
> On Sun, Jun 02, 2024 at 10:29:07AM +0300, Andy Shevchenko wrote:
>
> > > (bus->max_raw_write == 0 || bus->max_raw_write > quirks->max_write_len))
> > > - max_write = quirks->max_write_len;
> > > + max_write = quirks->max_write_len -
> > > + (config->reg_bits + config->pad_bits) / BITS_PER_BYTE;
>
> > Interesting. regmap-spi does this slightly differently, i.e. reg/8 + pad/8.
> > I'm wondering which one is more correct (potential off-by-one I suppose).
>
> The above seems more correct if we have less than a full byte of padding.
Hmm... So, if we have
bits pad x/8+y/8 (x+y)/8
4..7 0..3 0 0 // x + y from 4 up to 7
4..7 4..7 0 1 // x + y from 8 up to 11
4..7 8..11 1 1 // x + y from 12 up to 15
8..15 0..7 1 1 // x + y from 8 up to 15
8..15 8..15 2 2 // x + y from 16 up to 23
The only difference AFAICS is the case 2.
Do we need to patch regmap SPI for that?
I think SPI just works since we don't really have devices that use
less than 8 bits per register, and hence we never enter into such a
case (while I2C is naturally using 7-bit addresses).
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists