public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Antti Palosaari <crope@iki.fi>
To: linux-media <linux-media@vger.kernel.org>
Cc: Michael Krufky <mkrufky@kernellabs.com>,
	Mauro Carvalho Chehab <mchehab@redhat.com>,
	Jean Delvare <khali@linux-fr.org>
Subject: [RFC 0/2] add generic helper function for I2C register write
Date: Wed, 09 Nov 2011 01:52:36 +0200	[thread overview]
Message-ID: <4EB9C0C4.1090200@iki.fi> (raw)

This adds helper function for most typical I2C register write. Main 
reason was the fact I2C messages are are needed to split smaller parts 
as I2C-adapters cannot send all long messages used.

Basically there is three different kind of I2C register access used:
* register write (I2C write)
* register read (I2C write + I2C read)
* register read (I2C read)

Register read is usually done using write+read combination (with 
REPEATED START) and almost all I2C-adapters we have can handle it. Some 
rare situations simple read is used. That means for example reading 
small amount of registers starting from register 0 and thus register 
write for setting desired register is not needed. Other used rarely used 
combination for register read is simple register write (for set desired 
reg) and then perform simple register read. It looks like write+read but 
there is no REPEATED START, both messages are own transactions. I hope 
this story gives better understanding :)

At that point, I just implemented simple register write as a example. It 
does not have even any configuration for "register map", like register 
address length nor register value length. It just assumes register is 
one byte wide for both address and value. Lets add those later when needed.

And here is the list of drivers I have been working and this kind of 
splitting have been one problematic issue;
* RTL2832U & RTL2832
* RTL2831U & RTL2830
* AF9015 & TDA18212
* AF9015 & TDA18271
* EM28xx & TDA10071
* Anysee & CX24116
* <demod driver not released yet>

So, as you can see, there is a lot of drivers need splitting!

Any comments?


Antti Palosaari (2):
   dvb-core: add generic helper function for I2C register write
   tda18218: use generic dvb_wr_regs()

  drivers/media/common/tuners/tda18218.c      |   69 
+++++---------------------
  drivers/media/common/tuners/tda18218_priv.h |    3 +
  drivers/media/dvb/dvb-core/Makefile         |    2 +-
  drivers/media/dvb/dvb-core/dvb_generic.c    |   48 ++++++++++++++++++
  drivers/media/dvb/dvb-core/dvb_generic.h    |   21 ++++++++
  5 files changed, 87 insertions(+), 56 deletions(-)
  create mode 100644 drivers/media/dvb/dvb-core/dvb_generic.c
  create mode 100644 drivers/media/dvb/dvb-core/dvb_generic.h

-- 
1.7.4.4
---


-- 
http://palosaari.fi/



                 reply	other threads:[~2011-11-08 23:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4EB9C0C4.1090200@iki.fi \
    --to=crope@iki.fi \
    --cc=khali@linux-fr.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=mkrufky@kernellabs.com \
    /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