linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* regmap different register size
@ 2015-05-26 18:54 Andreas Werner
  2015-05-26 19:00 ` Felipe Balbi
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Werner @ 2015-05-26 18:54 UTC (permalink / raw)
  To: linux-kernel

Hi,
i have a question regarding regmap usage.

I have a i2c multifunction device which does have a register and value width of 8bits except
the revision register. The revision can only be read by a i2c block transfer.

Does it makes sense to read the Revision once by the i2c API and let the rest of the device read/write
by regmap?

Regmap should reduce code but in this case i had to check the i2c block functionality first then read the
revisoin and then init the regmap stuff.

May be in this case it would be better to use the i2c only instead of mixing i2c API and regmap.

Regards
Andy

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: regmap different register size
  2015-05-26 18:54 regmap different register size Andreas Werner
@ 2015-05-26 19:00 ` Felipe Balbi
  2015-05-26 19:27   ` Andreas Werner
  0 siblings, 1 reply; 3+ messages in thread
From: Felipe Balbi @ 2015-05-26 19:00 UTC (permalink / raw)
  To: Andreas Werner; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 582 bytes --]

Hi,

On Tue, May 26, 2015 at 08:54:25PM +0200, Andreas Werner wrote:
> i have a question regarding regmap usage.
> 
> I have a i2c multifunction device which does have a register and value
> width of 8bits except the revision register. The revision can only be
> read by a i2c block transfer.

read revision during probe using i2c block transfer, cache the value in
your own driver structure and all subsequent reads just return the
cached value. Everything else should be ok via regmap. This is first
thing that came to mind, maybe there's a better way.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: regmap different register size
  2015-05-26 19:00 ` Felipe Balbi
@ 2015-05-26 19:27   ` Andreas Werner
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Werner @ 2015-05-26 19:27 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-kernel

On Tue, May 26, 2015 at 02:00:39PM -0500, Felipe Balbi wrote:
> Hi,
> 
> On Tue, May 26, 2015 at 08:54:25PM +0200, Andreas Werner wrote:
> > i have a question regarding regmap usage.
> > 
> > I have a i2c multifunction device which does have a register and value
> > width of 8bits except the revision register. The revision can only be
> > read by a i2c block transfer.
> 
> read revision during probe using i2c block transfer, cache the value in
> your own driver structure and all subsequent reads just return the
> cached value. Everything else should be ok via regmap. This is first
> thing that came to mind, maybe there's a better way.
> 
> -- 
> balbi

This is what I want to do yes and i think this would be the only way to do it
because there is no mechanism to handle different register sizes with regmap.

Regards
Andy

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-26 19:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-26 18:54 regmap different register size Andreas Werner
2015-05-26 19:00 ` Felipe Balbi
2015-05-26 19:27   ` Andreas Werner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).