mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marc Reilly <marc@cpdesign.com.au>
To: barebox@lists.infradead.org
Cc: Vanalme Filip <F.Vanalme@televic.com>
Subject: Re: PMIC device driver
Date: Thu, 17 Feb 2011 07:34:34 +1100	[thread overview]
Message-ID: <201102170734.34357.marc@cpdesign.com.au> (raw)
In-Reply-To: <6EE7D1502C48E44E92DCADF9DD3E0DB9017FF3B00817@SRV-VS06.TELEVIC.COM>


Hi,

> > indicate the register within the PMIC to read/write. On the other hand,
> > the standard read and write functions only take 3 parameters (device,
> > buffer, buffersize). How do I pass that offset to these functions ? How
> > do I use the PMIC device driver ?
> > (Maybe this is a general Linux device driver question, but I'm not that
> > familiar with device drivers, so...)

I'd be using the pmic_read_reg and pmic_write_reg functions (they should be 
renamed and exported first though.)

Have a look at the mc13892 driver ..

> > 
> > Is it the best way to do it like this (open, read, write), or do I better
> > call those functions directly ? (I have to set the PMIC registers in the
> > "late_init" function of the barebox startup sequence)

... and the freescale-mx35-3stack for example.


> 
> [Filip] Think I found how it works. I have to use the normal read, write
> and lseek functions to read/write PMIC registers. 

As I said above, I reckon your board code will be cleaner if you skip the file 
I/O and use the _read_reg and _write_reg functions directly.


> The 'offset' and 'flag'
> parameters in read and write functions are for internal use only. Correct.
> When reading, an internal index is incremented. A following read starts
> where the previous ended. With lseek, one can move that index to address
> the correct register. Right ?
In general, yes.


HTH,

Cheers
Marc


> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2011-02-16 20:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-16 12:20 Vanalme Filip
2011-02-16 20:34 ` Marc Reilly [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-02-16  8:37 Vanalme Filip

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=201102170734.34357.marc@cpdesign.com.au \
    --to=marc@cpdesign.com.au \
    --cc=F.Vanalme@televic.com \
    --cc=barebox@lists.infradead.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