All of lore.kernel.org
 help / color / mirror / Atom feed
From: jmondi <jacopo@jmondi.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Jacopo Mondi <jacopo+renesas@jmondi.org>,
	niklas.soderlund@ragnatech.se, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v1 03/12] media: i2c: mt9m111: Skip chid identification
Date: Mon, 26 Jun 2017 15:19:24 +0200	[thread overview]
Message-ID: <20170626131924.GA11157@w540> (raw)
In-Reply-To: <3719659.Y7GHEXHMmq@avalon>

Hi Laurent,

On Tue, Jun 20, 2017 at 10:48:21AM +0300, Laurent Pinchart wrote:
> Hi Jacopo,
>
> Thank you for the patch.
>
> On Monday 19 Jun 2017 19:04:40 Jacopo Mondi wrote:
> > Reads of chip identification code (both on registers 0x00 and 0xff)
> > always return 0x00.
>
> This shouldn't be the case. It might mean that your I2C master controller
> doesn't handle reads correctly. I don't think this patch is correct.

Indeed this patch was not meant for inclusion (as it is part of an RFC series)
but I still fail to read the chip identifier even when using a tool to
sniff the bus or talk directly to the chip (I'm using bus pirate
for this purpose).

What puzzles me is that I get back reads from some registers that match the
defaults reported by the data sheet, while other registers return
meaningful values but different from what I have indicated as defaults
in the sensor manual, while chip identifier reads always back as 0x00.

I am pasting some examples down here of some interactions with the
chip using bus pirate serial control console [1]

I wonder if I am working with a different chip revision from the one
the driver and the datasheet have as reference, but it really seems
unlikely to me..

Thanks
   j


[1]
** Read register 0x106: expected value 0x700E -> got it!
I2C>[0x90+0xf0+0x00+0x1]
I2C START BIT
WRITE: 0x90 ACK
WRITE: 0xF0 ACK
WRITE: 0x00 ACK
WRITE: 0x01 ACK
I2C STOP BIT
I2C>[0x90+0x06+[0x91+rr]
I2C START BIT
WRITE: 0x90 ACK
WRITE: 0x06 ACK
I2C START BIT
WRITE: 0x91 ACK
READ: 0x70
READ:  ACK 0x0E
NACK
I2C STOP BIT

** Read register 0x108: expected value 0x0080 -> got 0xc800
I2C>[0x90+0xf0+0x00+0x1]
I2C START BIT
WRITE: 0x90 ACK
WRITE: 0xF0 ACK
WRITE: 0x00 ACK
WRITE: 0x01 ACK
I2C STOP BIT
I2C>[0x90+0x08+[0x91+rr]
I2C START BIT
WRITE: 0x90 ACK
WRITE: 0x08 ACK
I2C START BIT
WRITE: 0x91 ACK
READ: 0xC8
READ:  ACK 0x00
NACK
I2C STOP BIT

** Read Chip ID: expected value 0x143a -> got 0x0000
I2C>[0x90+0xf0+0x00+0x0]
I2C START BIT
WRITE: 0x90 ACK
WRITE: 0xF0 ACK
WRITE: 0x00 ACK
WRITE: 0x00 ACK
I2C STOP BIT
I2C>[0x90+0x00+[0x91+rr]
I2C START BIT
WRITE: 0x90 ACK
WRITE: 0x00 ACK
I2C START BIT
WRITE: 0x91 ACK
READ: 0x00
READ:  ACK 0x00
NACK
I2C STOP BIT

>
> > Skip chip identification to have the device complete probing.
> >
> > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> > ---
> >  drivers/media/i2c/mt9m111.c | 19 -------------------
> >  1 file changed, 19 deletions(-)
> >
> > diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c
> > index 72e71b7..8e86d51 100644
> > --- a/drivers/media/i2c/mt9m111.c
> > +++ b/drivers/media/i2c/mt9m111.c
> > @@ -890,31 +890,12 @@ static struct v4l2_subdev_ops mt9m111_subdev_ops = {
> >  static int mt9m111_video_probe(struct i2c_client *client)
> >  {
> >  	struct mt9m111 *mt9m111 = to_mt9m111(client);
> > -	s32 data;
> >  	int ret;
> >
> >  	ret = mt9m111_s_power(&mt9m111->subdev, 1);
> >  	if (ret < 0)
> >  		return ret;
> >
> > -	data = reg_read(CHIP_VERSION);
> > -
> > -	switch (data) {
> > -	case 0x143a: /* MT9M111 or MT9M131 */
> > -		dev_info(&client->dev,
> > -			"Detected a MT9M111/MT9M131 chip ID %x\n", data);
> > -		break;
> > -	case 0x148c: /* MT9M112 */
> > -		dev_info(&client->dev, "Detected a MT9M112 chip ID %x\n",
> data);
> > -		break;
> > -	default:
> > -		dev_err(&client->dev,
> > -			"No MT9M111/MT9M112/MT9M131 chip detected register
> read %x\n",
> > -			data);
> > -		ret = -ENODEV;
> > -		goto done;
> > -	}
> > -
> >  	ret = mt9m111_init(mt9m111);
> >  	if (ret)
> >  		goto done;
>
> --
> Regards,
>
> Laurent Pinchart
>

  reply	other threads:[~2017-06-26 13:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-19 17:04 [PATCH v1 00/12] rcar: vin: Add digital input to Gen3 Jacopo Mondi
2017-06-19 17:04 ` [PATCH v1 01/12] arm64: boot: dts: salvator-x: Add camera module Jacopo Mondi
2017-06-20  7:20   ` Geert Uytterhoeven
2017-06-20  7:45   ` Laurent Pinchart
2017-06-19 17:04 ` [PATCH v1 02/12] arm64: boot: dts: Salvator-X: Add VIN parallel input Jacopo Mondi
2017-06-19 19:32   ` Niklas Söderlund
2017-06-19 17:04 ` [PATCH v1 03/12] media: i2c: mt9m111: Skip chid identification Jacopo Mondi
2017-06-20  7:48   ` Laurent Pinchart
2017-06-26 13:19     ` jmondi [this message]
2017-06-19 17:04 ` [PATCH v1 04/12] media: i2c: mt9m111: Add source pad Jacopo Mondi
2017-06-20  7:50   ` Laurent Pinchart
2017-06-19 17:04 ` [PATCH v1 05/12] media: rcar: vin: Prepare to parse Gen3 digital input Jacopo Mondi
2017-06-19 19:39   ` Niklas Söderlund
2017-06-20  7:28     ` jmondi
2017-06-19 17:04 ` [PATCH v1 06/12] media: rcar: vin: Accept parallel input on Gen3 Jacopo Mondi
2017-06-19 17:04 ` [PATCH v1 07/12] media: rcar: vin: Add ID for " Jacopo Mondi
2017-06-19 19:46   ` Niklas Söderlund
2017-06-19 17:04 ` [PATCH v1 08/12] media: rcar: vin: Parse digital input after CSI " Jacopo Mondi
2017-06-19 17:04 ` [PATCH v1 09/12] media: rcar: vin: Install notifier for digital input Jacopo Mondi
2017-06-19 19:51   ` Niklas Söderlund
2017-06-20  7:32     ` jmondi
2017-06-19 17:04 ` [PATCH v1 10/12] media: rcar: vin: Add digital input mask to vin_dev Jacopo Mondi
2017-06-19 17:04 ` [PATCH v1 11/12] media: rcar: vin: Store VIN instance id Jacopo Mondi
2017-06-19 17:04 ` [PATCH v1 12/12] media: rcar: vin: Link digital subdev to VIN instance Jacopo Mondi

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=20170626131924.GA11157@w540 \
    --to=jacopo@jmondi.org \
    --cc=jacopo+renesas@jmondi.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.