Re: regmap I3C support

From: Guenter Roeck
Date: Fri Nov 15 2024 - 12:02:19 EST


On 11/15/24 07:06, Mark Brown wrote:
On Thu, Nov 14, 2024 at 10:58:05PM -0800, Guenter Roeck wrote:
On Thu, Nov 14, 2024 at 05:26:19PM +0000, Mark Brown wrote:

Right, so the fact that I3C depends on I2C deals with a lot of the
problems that plague the I2C/SPI combination. Ugh. I guess the helper
should be OK and there's not much doing for I2C/SPI.

Is it really that difficult for I2C and SPI ? The patch below seems to work
for the LTC2947 driver. It doesn't even need dummies (the compiler drops
the unused code), though I am not sure if that can be relied on. I thought
that dummy functions are needed, but maybe I am wrong.

The Kconfig for the combined ltc2947 driver is

config SENSORS_LTC2947
tristate "Analog Devices LTC2947 High Precision Power and Energy Monitor"
depends on I2C || SPI
depends on I2C || I2C=n
select REGMAP_I2C if I2C
select REGMAP_SPI if SPI

This prevents building the driver in if I2C=m which isn't always
desirable, and IIRC the randconfig people kept turning issues up. You
can make things work well enough for normal configurations, it's all
edge cases that cause issues.

You mean if SPI=y and I2C=m ? Good point. That isn't normally a problem
for sensor drivers, but I understand that it may be undesirable for others.

Thanks,
Guenter