public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Jonathan Corbet <corbet@lwn.net>
Cc: linux-media@vger.kernel.org, g.liakhovetski@gmx.de,
	Kassey Lee <ygli@marvell.com>
Subject: Re: [PATCH 6/8] marvell-cam: Right-shift i2c slave ID's in the cafe driver
Date: Thu, 16 Jun 2011 21:51:31 -0300	[thread overview]
Message-ID: <4DFAA513.2040708@infradead.org> (raw)
In-Reply-To: <1307814409-46282-7-git-send-email-corbet@lwn.net>

Em 11-06-2011 14:46, Jonathan Corbet escreveu:
> This makes the cafe i2c implement consistent with the rest of Linux so that
> the core can use the same slave ID everywhere.
> 
> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
> ---
>  drivers/media/video/marvell-ccic/cafe-driver.c |    9 ++++++++-
>  drivers/media/video/marvell-ccic/mcam-core.c   |    2 +-
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/video/marvell-ccic/cafe-driver.c b/drivers/media/video/marvell-ccic/cafe-driver.c
> index 1027265..3dbc7e5 100644
> --- a/drivers/media/video/marvell-ccic/cafe-driver.c
> +++ b/drivers/media/video/marvell-ccic/cafe-driver.c
> @@ -84,7 +84,14 @@ struct cafe_camera {
>  #define	  TWSIC0_EN	  0x00000001	/* TWSI enable */
>  #define	  TWSIC0_MODE	  0x00000002	/* 1 = 16-bit, 0 = 8-bit */
>  #define	  TWSIC0_SID	  0x000003fc	/* Slave ID */
> -#define	  TWSIC0_SID_SHIFT 2
> +/*
> + * Subtle trickery: the slave ID field starts with bit 2.  But the
> + * Linux i2c stack wants to treat the bottommost bit as a separate
> + * read/write bit, which is why slave ID's are usually presented
> + * >>1.  For consistency with that behavior, we shift over three
> + * bits instead of two.
> + */

And this is consistent with the initial Philips I2C datasheets ;) Newer datasheets
use to include the read/write bit as if they're part of the I2C address, as well as
the registers that command I2C operations inside most chipsets. So, we end
by having 7-bit and 8-bit notations for I2C addresses.

> +#define	  TWSIC0_SID_SHIFT 3
>  #define	  TWSIC0_CLKDIV	  0x0007fc00	/* Clock divider */
>  #define	  TWSIC0_MASKACK  0x00400000	/* Mask ack from sensor */
>  #define	  TWSIC0_OVMAGIC  0x00800000	/* Make it work on OV sensors */
> diff --git a/drivers/media/video/marvell-ccic/mcam-core.c b/drivers/media/video/marvell-ccic/mcam-core.c
> index 0d60234..d5f18a3 100644
> --- a/drivers/media/video/marvell-ccic/mcam-core.c
> +++ b/drivers/media/video/marvell-ccic/mcam-core.c
> @@ -1549,7 +1549,7 @@ int mccic_register(struct mcam_camera *cam)
>  {
>  	struct i2c_board_info ov7670_info = {
>  		.type = "ov7670",
> -		.addr = 0x42,
> +		.addr = 0x42 >> 1,
>  		.platform_data = &sensor_cfg,
>  	};
>  	int ret;

Patch is OK.

Mauro.

  reply	other threads:[~2011-06-17  0:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-11 17:46 Refactor cafe_ccic and add Armada 610 driver [V2] Jonathan Corbet
2011-06-11 17:46 ` [PATCH 1/8] marvell-cam: Move cafe-ccic into its own directory Jonathan Corbet
     [not found]   ` <BANLkTikXATbgOZQbzaj4sQEmELsdpNobfQ@mail.gmail.com>
2011-06-14 14:23     ` Jonathan Corbet
2011-06-15  2:01       ` Kassey Lee
2011-06-15 11:37         ` Mauro Carvalho Chehab
2011-06-11 17:46 ` [PATCH 2/8] marvell-cam: Separate out the Marvell camera core Jonathan Corbet
2011-06-14  2:58   ` Kassey Lee
2011-06-14 14:49     ` Jonathan Corbet
2011-06-16  2:30       ` Kassey Lee
2011-06-16  3:12         ` Kassey Lee
2011-06-16 15:27           ` Jonathan Corbet
2011-06-17  0:45             ` Mauro Carvalho Chehab
2011-06-17  3:11             ` Kassey Lee
2011-06-22 22:12               ` Jonathan Corbet
2011-06-27  9:23                 ` Kassey Lee
2011-06-17  0:40         ` Mauro Carvalho Chehab
2011-06-17  2:51           ` Kassey Lee
2011-06-11 17:46 ` [PATCH 3/8] marvell-cam: Pass sensor parameters from the platform Jonathan Corbet
2011-06-11 17:46 ` [PATCH 4/8] marvell-cam: Remove the "untested" comment Jonathan Corbet
2011-06-11 17:46 ` [PATCH 5/8] marvell-cam: Move Cafe-specific register definitions to cafe-driver.c Jonathan Corbet
2011-06-11 17:46 ` [PATCH 6/8] marvell-cam: Right-shift i2c slave ID's in the cafe driver Jonathan Corbet
2011-06-17  0:51   ` Mauro Carvalho Chehab [this message]
2011-06-11 17:46 ` [PATCH 7/8] marvell-cam: Allocate the i2c adapter in the platform driver Jonathan Corbet
2011-06-11 17:46 ` [PATCH 8/8] marvell-cam: Basic working MMP camera driver Jonathan Corbet
2011-06-16  2:37   ` Kassey Lee
2011-06-16 15:17     ` Jonathan Corbet
2011-06-16 19:44       ` Sylwester Nawrocki
2011-06-17  1:15         ` Mauro Carvalho Chehab

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=4DFAA513.2040708@infradead.org \
    --to=mchehab@infradead.org \
    --cc=corbet@lwn.net \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-media@vger.kernel.org \
    --cc=ygli@marvell.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