From: Guenter Roeck <linux@roeck-us.net>
To: Mark Brown <broonie@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, Armin Wolf <W_Armin@gmx.de>
Subject: Re: Page select register restrictions in regmap core
Date: Tue, 18 Jun 2024 14:23:07 -0700 [thread overview]
Message-ID: <7ebb98b3-e852-45af-8b5a-d0fd2357d6a0@roeck-us.net> (raw)
In-Reply-To: <17890e6b-cf00-43cd-9d99-2383b5fbef64@sirena.org.uk>
On 6/18/24 13:46, Mark Brown wrote:
> On Tue, Jun 18, 2024 at 12:33:40PM -0700, Guenter Roeck wrote:
>> On 6/18/24 10:45, Mark Brown wrote:
>>> On Tue, Jun 18, 2024 at 09:14:56AM -0700, Guenter Roeck wrote:
>
>>>> It turns out that at least some i801 controllers don't work with the
>>>> access mechanism used by regmap, or maybe the spd5118 chips don't support
>>>> I2C_FUNC_SMBUS_I2C_BLOCK. I already found that those chips don't support
>>>> auto-incrementing the register address and actually reset the address on byte
>>>> reads (i.e., subsequent calls to i2c_smbus_read_byte() always return the data
>>>> from the first register). Since regmap doesn't have a means for me to say
>>>> "don't use I2C_FUNC_SMBUS_I2C_BLOCK even if the controller supports it",
>>>> I may have to drop regmap support entirely anyway. That would be annoying,
>>>> but right now I have no idea how to work around that problem.
>
>>> You can set the use_single_read and use_single_write flags in the config
>>> to ensure registers are accessed one at a time, that restriction is
>>> moderately common.
>
>> That doesn't help, unfortunately. Thinking about it, that is not really
>> surprising. The failing write is to the page register, and that was
>> a single write anyway.
>
> Oh, that's interesting - I'm kind of surprised the wire protocols differ
> but it's been a while since I looked. We should probably add this to
spd5118 devices are ... weird. For example, they don't auto-increment
addresses on a read operation, meaning regmap_i2c_smbus_i2c_read_reg16()
doesn't work at all because i2c_smbus_read_byte() always reads from
address 0.
> the quirking in regmap-i2c.c, have it select one the 8 bit only smbus
> versions for devices that need register at a time operation. I'd not be
> surprised if other devices have issues, and anyway if it makes a
> difference to the wire protocol we should try to select something as
> close as possible to what we're actually doing.
>
> Something like the below perhaps (this probably needs to be converted to
> a match table type thing at this point, there's the SMBUS_WORD_DATA case
> too):
>
> diff --git a/drivers/base/regmap/regmap-i2c.c b/drivers/base/regmap/regmap-i2c.c
> index a905e955bbfc..499fcec00f2d 100644
> --- a/drivers/base/regmap/regmap-i2c.c
> +++ b/drivers/base/regmap/regmap-i2c.c
> @@ -313,6 +313,11 @@ static const struct regmap_bus *regmap_get_i2c_bus(struct i2c_client *i2c,
>
> if (i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C))
> bus = ®map_i2c;
> + else if (config->val_bits == 8 && config->reg_bits == 8 &&
> + config->use_single_read && config->use_single_write &&
> + i2c_check_functionality(i2c->adapter,
> + I2C_FUNC_SMBUS_BYTE_DATA))
> + bus = ®map_smbus_byte;
That might be an option. Give me more time, though - as it turns out,
I2C_FUNC_SMBUS_BYTE_DATA doesn't work for writes either on the affected
system. Something else is going on.
Thanks,
Guenter
next prev parent reply other threads:[~2024-06-18 21:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-17 14:20 Guenter Roeck
2024-06-17 15:08 ` Mark Brown
2024-06-17 16:59 ` Guenter Roeck
2024-06-17 17:22 ` Mark Brown
2024-06-17 21:55 ` Guenter Roeck
2024-06-17 22:47 ` Mark Brown
2024-06-17 23:15 ` Guenter Roeck
2024-06-18 11:35 ` Mark Brown
2024-06-18 16:14 ` Guenter Roeck
2024-06-18 17:01 ` Guenter Roeck
2024-06-18 17:45 ` Mark Brown
2024-06-18 18:10 ` Guenter Roeck
2024-06-18 19:33 ` Guenter Roeck
2024-06-18 20:46 ` Mark Brown
2024-06-18 21:23 ` Guenter Roeck [this message]
2024-06-19 3:11 ` Guenter Roeck
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=7ebb98b3-e852-45af-8b5a-d0fd2357d6a0@roeck-us.net \
--to=linux@roeck-us.net \
--cc=W_Armin@gmx.de \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®