All of lore.kernel.org
 help / color / mirror / Atom feed
From: javier Martin <javier.martin@vista-silicon.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	carlighting@yahoo.co.nz, beagleboard@googlegroups.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 1/2] MT9P031: Add support for Aptina mt9p031 sensor.
Date: Tue, 24 May 2011 10:31:46 +0200	[thread overview]
Message-ID: <BANLkTinKgj-HmKwAWN-e6+8kj6ZRC4WJgg@mail.gmail.com> (raw)
In-Reply-To: <201105231103.26775.laurent.pinchart@ideasonboard.com>

Hi, Laurent, Guennadi,
thank you for your review. I've already fixed most of the issues.

On 23 May 2011 11:03, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> Hi Guennadi and Javier,
>
> On Saturday 21 May 2011 17:29:18 Guennadi Liakhovetski wrote:
>> On Fri, 20 May 2011, Javier Martin wrote:
>
> [snip]
>
>> > diff --git a/drivers/media/video/mt9p031.c
>> > b/drivers/media/video/mt9p031.c new file mode 100644
>> > index 0000000..e406b64
>> > --- /dev/null
>> > +++ b/drivers/media/video/mt9p031.c
>
> [snip]
>> > +}
>> > +
>> > +static int mt9p031_power_on(struct mt9p031 *mt9p031)
>> > +{
>> > +   int ret;
>> > +
>> > +   /* turn on VDD_IO */
>> > +   ret = regulator_enable(mt9p031->reg_2v8);
>> > +   if (ret) {
>> > +           pr_err("Failed to enable 2.8v regulator: %d\n", ret);
>>
>> dev_err()
>>
>> > +           return ret;
>> > +   }
>> > +   if (mt9p031->pdata->set_xclk)
>> > +           mt9p031->pdata->set_xclk(&mt9p031->subdev, 54000000);
>
> Can you make 54000000 a #define at the beginning of the file ?
>
> You should soft-reset the chip here by calling mt9p031_reset().
>

If I do this, I would be force to cache some registers and restart
them. I've tried to do this but I don't know what is failing that
there are some artifacts consisting on horizontal black lines in the
image.
Please, let me push this to mainline without this feature as a first
step, since I'll have to spend some assigned to another project.

[snip]
>> > + */
>> > +static int mt9p031_video_probe(struct i2c_client *client)
>> > +{
>> > +   s32 data;
>> > +   int ret;
>> > +
>> > +   /* Read out the chip version register */
>> > +   data = reg_read(client, MT9P031_CHIP_VERSION);
>> > +   if (data != MT9P031_CHIP_VERSION_VALUE) {
>> > +           dev_err(&client->dev,
>> > +                   "No MT9P031 chip detected, register read %x\n", data);
>> > +           return -ENODEV;
>> > +   }
>> > +
>> > +   dev_info(&client->dev, "Detected a MT9P031 chip ID %x\n", data);
>> > +
>> > +   ret = mt9p031_reset(client);
>> > +   if (ret < 0)
>> > +           dev_err(&client->dev, "Failed to initialise the camera\n");
>
> If you move the soft-reset operation to mt9p031_power_on(), you don't need to
> call it here.
>

The reason for this is the same as before. I haven't still been able
to success on restarting registers and getting everything to work
fine.
It would be great if you allowed me to push this as it is as an
intermediate step.

[snip]
>
>> > +   mt9p031->rect.width     = MT9P031_MAX_WIDTH;
>> > +   mt9p031->rect.height    = MT9P031_MAX_HEIGHT;
>> > +
>> > +   mt9p031->format.code = V4L2_MBUS_FMT_SGRBG12_1X12;
>> > +
>> > +   mt9p031->format.width = MT9P031_MAX_WIDTH;
>> > +   mt9p031->format.height = MT9P031_MAX_HEIGHT;
>> > +   mt9p031->format.field = V4L2_FIELD_NONE;
>> > +   mt9p031->format.colorspace = V4L2_COLORSPACE_SRGB;
>> > +
>> > +   mt9p031->xskip = 1;
>> > +   mt9p031->yskip = 1;
>> > +
>> > +   mt9p031->reg_1v8 = regulator_get(NULL, "cam_1v8");
>> > +   if (IS_ERR(mt9p031->reg_1v8)) {
>> > +           ret = PTR_ERR(mt9p031->reg_1v8);
>> > +           pr_err("Failed 1.8v regulator: %d\n", ret);
>>
>> dev_err()
>>
>> > +           goto e1v8;
>> > +   }
>
> The driver can be used with boards where either or both of the 1.8V and 2.8V
> supplies are always on, thus not connected to any regulator. I'm not sure how
> that's usually handled, if board code should define an "always-on" power
> supply, or if the driver shouldn't fail when no regulator is present. In any
> case, this must be handled.
>

I think board code should define an "always-on" power supply.

>> > +
>> > +   mt9p031->reg_2v8 = regulator_get(NULL, "cam_2v8");
>> > +   if (IS_ERR(mt9p031->reg_2v8)) {
>> > +           ret = PTR_ERR(mt9p031->reg_2v8);
>> > +           pr_err("Failed 2.8v regulator: %d\n", ret);
>>
>> ditto
>>
>> > +           goto e2v8;
>> > +   }
>> > +   /* turn on core */
>> > +   ret = regulator_enable(mt9p031->reg_1v8);
>> > +   if (ret) {
>> > +           pr_err("Failed to enable 1.8v regulator: %d\n", ret);
>>
>> ditto
>>
>> > +           goto e1v8en;
>> > +   }
>> > +   return 0;
>
> Why do you leave core power on at the end of probe() ? You should only turn it
> on when needed.
>

Just as I said, because restarting registers does not work yet.





-- 
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com

WARNING: multiple messages have this Message-ID (diff)
From: javier.martin@vista-silicon.com (javier Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] MT9P031: Add support for Aptina mt9p031 sensor.
Date: Tue, 24 May 2011 10:31:46 +0200	[thread overview]
Message-ID: <BANLkTinKgj-HmKwAWN-e6+8kj6ZRC4WJgg@mail.gmail.com> (raw)
In-Reply-To: <201105231103.26775.laurent.pinchart@ideasonboard.com>

Hi, Laurent, Guennadi,
thank you for your review. I've already fixed most of the issues.

On 23 May 2011 11:03, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> Hi Guennadi and Javier,
>
> On Saturday 21 May 2011 17:29:18 Guennadi Liakhovetski wrote:
>> On Fri, 20 May 2011, Javier Martin wrote:
>
> [snip]
>
>> > diff --git a/drivers/media/video/mt9p031.c
>> > b/drivers/media/video/mt9p031.c new file mode 100644
>> > index 0000000..e406b64
>> > --- /dev/null
>> > +++ b/drivers/media/video/mt9p031.c
>
> [snip]
>> > +}
>> > +
>> > +static int mt9p031_power_on(struct mt9p031 *mt9p031)
>> > +{
>> > + ? int ret;
>> > +
>> > + ? /* turn on VDD_IO */
>> > + ? ret = regulator_enable(mt9p031->reg_2v8);
>> > + ? if (ret) {
>> > + ? ? ? ? ? pr_err("Failed to enable 2.8v regulator: %d\n", ret);
>>
>> dev_err()
>>
>> > + ? ? ? ? ? return ret;
>> > + ? }
>> > + ? if (mt9p031->pdata->set_xclk)
>> > + ? ? ? ? ? mt9p031->pdata->set_xclk(&mt9p031->subdev, 54000000);
>
> Can you make 54000000 a #define at the beginning of the file ?
>
> You should soft-reset the chip here by calling mt9p031_reset().
>

If I do this, I would be force to cache some registers and restart
them. I've tried to do this but I don't know what is failing that
there are some artifacts consisting on horizontal black lines in the
image.
Please, let me push this to mainline without this feature as a first
step, since I'll have to spend some assigned to another project.

[snip]
>> > + */
>> > +static int mt9p031_video_probe(struct i2c_client *client)
>> > +{
>> > + ? s32 data;
>> > + ? int ret;
>> > +
>> > + ? /* Read out the chip version register */
>> > + ? data = reg_read(client, MT9P031_CHIP_VERSION);
>> > + ? if (data != MT9P031_CHIP_VERSION_VALUE) {
>> > + ? ? ? ? ? dev_err(&client->dev,
>> > + ? ? ? ? ? ? ? ? ? "No MT9P031 chip detected, register read %x\n", data);
>> > + ? ? ? ? ? return -ENODEV;
>> > + ? }
>> > +
>> > + ? dev_info(&client->dev, "Detected a MT9P031 chip ID %x\n", data);
>> > +
>> > + ? ret = mt9p031_reset(client);
>> > + ? if (ret < 0)
>> > + ? ? ? ? ? dev_err(&client->dev, "Failed to initialise the camera\n");
>
> If you move the soft-reset operation to mt9p031_power_on(), you don't need to
> call it here.
>

The reason for this is the same as before. I haven't still been able
to success on restarting registers and getting everything to work
fine.
It would be great if you allowed me to push this as it is as an
intermediate step.

[snip]
>
>> > + ? mt9p031->rect.width ? ? = MT9P031_MAX_WIDTH;
>> > + ? mt9p031->rect.height ? ?= MT9P031_MAX_HEIGHT;
>> > +
>> > + ? mt9p031->format.code = V4L2_MBUS_FMT_SGRBG12_1X12;
>> > +
>> > + ? mt9p031->format.width = MT9P031_MAX_WIDTH;
>> > + ? mt9p031->format.height = MT9P031_MAX_HEIGHT;
>> > + ? mt9p031->format.field = V4L2_FIELD_NONE;
>> > + ? mt9p031->format.colorspace = V4L2_COLORSPACE_SRGB;
>> > +
>> > + ? mt9p031->xskip = 1;
>> > + ? mt9p031->yskip = 1;
>> > +
>> > + ? mt9p031->reg_1v8 = regulator_get(NULL, "cam_1v8");
>> > + ? if (IS_ERR(mt9p031->reg_1v8)) {
>> > + ? ? ? ? ? ret = PTR_ERR(mt9p031->reg_1v8);
>> > + ? ? ? ? ? pr_err("Failed 1.8v regulator: %d\n", ret);
>>
>> dev_err()
>>
>> > + ? ? ? ? ? goto e1v8;
>> > + ? }
>
> The driver can be used with boards where either or both of the 1.8V and 2.8V
> supplies are always on, thus not connected to any regulator. I'm not sure how
> that's usually handled, if board code should define an "always-on" power
> supply, or if the driver shouldn't fail when no regulator is present. In any
> case, this must be handled.
>

I think board code should define an "always-on" power supply.

>> > +
>> > + ? mt9p031->reg_2v8 = regulator_get(NULL, "cam_2v8");
>> > + ? if (IS_ERR(mt9p031->reg_2v8)) {
>> > + ? ? ? ? ? ret = PTR_ERR(mt9p031->reg_2v8);
>> > + ? ? ? ? ? pr_err("Failed 2.8v regulator: %d\n", ret);
>>
>> ditto
>>
>> > + ? ? ? ? ? goto e2v8;
>> > + ? }
>> > + ? /* turn on core */
>> > + ? ret = regulator_enable(mt9p031->reg_1v8);
>> > + ? if (ret) {
>> > + ? ? ? ? ? pr_err("Failed to enable 1.8v regulator: %d\n", ret);
>>
>> ditto
>>
>> > + ? ? ? ? ? goto e1v8en;
>> > + ? }
>> > + ? return 0;
>
> Why do you leave core power on at the end of probe() ? You should only turn it
> on when needed.
>

Just as I said, because restarting registers does not work yet.





-- 
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com

  parent reply	other threads:[~2011-05-24  8:31 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-20 13:47 [PATCH v2 1/2] MT9P031: Add support for Aptina mt9p031 sensor Javier Martin
2011-05-20 13:47 ` Javier Martin
2011-05-20 13:47 ` [PATCH v2 2/2] OMAP3BEAGLE: Add support for mt9p031 sensor driver Javier Martin
2011-05-20 13:47   ` Javier Martin
2011-05-20 15:57   ` [beagleboard] " Koen Kooi
2011-05-20 15:57     ` Koen Kooi
2011-05-23  7:01     ` javier Martin
2011-05-23  7:01       ` javier Martin
2011-05-23  8:00       ` Laurent Pinchart
2011-05-23  8:00         ` Laurent Pinchart
2011-05-23  8:55         ` Koen Kooi
2011-05-23  8:55           ` Koen Kooi
2011-05-23  9:14           ` Laurent Pinchart
2011-05-23  9:14             ` Laurent Pinchart
2011-05-22 13:49   ` Igor Grinberg
2011-05-22 13:49     ` Igor Grinberg
2011-05-23  7:25     ` javier Martin
2011-05-23  7:25       ` javier Martin
2011-05-23  7:25       ` javier Martin
2011-05-23  7:47       ` Laurent Pinchart
2011-05-23  7:47         ` Laurent Pinchart
2011-05-23 17:03         ` Igor Grinberg
2011-05-23 17:03           ` Igor Grinberg
2011-05-21 12:55 ` [PATCH v2 1/2] MT9P031: Add support for Aptina mt9p031 sensor Mauro Carvalho Chehab
2011-05-21 12:55   ` Mauro Carvalho Chehab
2011-05-22 20:41   ` Laurent Pinchart
2011-05-22 20:41     ` Laurent Pinchart
2011-05-21 15:29 ` Guennadi Liakhovetski
2011-05-21 15:29   ` Guennadi Liakhovetski
2011-05-23  8:20   ` javier Martin
2011-05-23  8:20     ` javier Martin
2011-05-23  8:48     ` Guennadi Liakhovetski
2011-05-23  8:48       ` Guennadi Liakhovetski
2011-05-23  9:08       ` Laurent Pinchart
2011-05-23  9:08         ` Laurent Pinchart
2011-05-23  9:03   ` Laurent Pinchart
2011-05-23  9:03     ` Laurent Pinchart
2011-05-23  9:26     ` Guennadi Liakhovetski
2011-05-23  9:26       ` Guennadi Liakhovetski
2011-05-24  8:31     ` javier Martin [this message]
2011-05-24  8:31       ` javier Martin
2011-05-24  8:39       ` Laurent Pinchart
2011-05-24  8:39         ` Laurent Pinchart
2011-05-24  8:56         ` javier Martin
2011-05-24  8:56           ` javier Martin
2011-05-24  8:58           ` Laurent Pinchart
2011-05-24  8:58             ` Laurent Pinchart
2011-05-23  3:01 Chris Rodley
2011-05-23  6:54 ` javier Martin
2011-05-24  5:03 Chris Rodley
2011-05-25  3:45 Chris Rodley
2011-05-25  7:00 ` javier Martin
2011-05-25  7:00   ` javier Martin

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=BANLkTinKgj-HmKwAWN-e6+8kj6ZRC4WJgg@mail.gmail.com \
    --to=javier.martin@vista-silicon.com \
    --cc=beagleboard@googlegroups.com \
    --cc=carlighting@yahoo.co.nz \
    --cc=g.liakhovetski@gmx.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.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 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.