Re: [RFC PATCH v2] regmap: smbus: add support for regmap over smbus

From: Mark Brown
Date: Tue Apr 15 2014 - 12:47:12 EST


On Tue, Apr 15, 2014 at 03:34:55PM +0200, Lars-Peter Clausen wrote:
> On 04/15/2014 02:56 PM, Mark Brown wrote:

> > - Providing APIs for registering actual smbus devices as a convenience
> > for devices with that constraint, regardless of how that is done
> > behind the scenes.

> > - Having the I2C implementation automatically use the smbus APIs if
> > it can and either the controller is smbus only or it makes sense to
> > do so for optimisation.

> I don't think it makes sense to expose smbus explicitly. We can already
> describe smbus restricted devices just fine with the current regmap_config
> and already support them with the current I2C regmap implementation. Using

Please note what I said about convenience - if lots of devices have
exactly the same set of constraints to set up it's possible sensible to
have a standard way of specifying them. It's going to be a bit easier
to just say it's smbus than to remember exactly what that means.

> native I2C to access these devices will be more efficient than going through
> the smbus emulation layer. The smbus emulation layer essentially does the
> same as we do in regmap, so using the smbus emulation layer through regmap
> means doing the same thing twice.

Right, that's why I said it's probably only worth it if the controller
does smbus natively.

> As I see it there are currently 3 cases:

> 1) Device is strictly smbus only and the controller supports native smbus
> => Use smbus
> 2) The device is smbus compatible but has extensions (e.g. support for multi
> register writes) and the controller supports only smbus.
> => Use smbus
> 3) For every other case
> => Use native I2C.

It's not clear to me that if the controller supports smbus we shouldn't
use it; presumably it's adding some value to have written the code to
take advantage of it. That would mean another case for device is smbus
only and controller has explicit smbus support.

Attachment: signature.asc
Description: Digital signature