From: Darius Augulis <augulis.darius@gmail.com>
To: Guennadi Liakhovetski <lg@denx.de>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: [PATCH] mt9t031: use platform power hook
Date: Thu, 02 Apr 2009 20:30:27 +0300 [thread overview]
Message-ID: <49D4F633.1040806@gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0904021149580.5263@axis700.grange>
Guennadi Liakhovetski wrote:
> Use platform power hook to turn the camera on and off.
>
> Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
> ---
> diff --git a/drivers/media/video/mt9t031.c b/drivers/media/video/mt9t031.c
> index 23f9ce9..2b0927b 100644
> --- a/drivers/media/video/mt9t031.c
> +++ b/drivers/media/video/mt9t031.c
> @@ -141,8 +141,19 @@ static int get_shutter(struct soc_camera_device *icd, u32 *data)
>
> static int mt9t031_init(struct soc_camera_device *icd)
> {
> + struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd);
> + struct soc_camera_link *icl = mt9t031->client->dev.platform_data;
> int ret;
>
> + if (icl->power) {
> + ret = icl->power(&mt9t031->client->dev, 1);
> + if (ret < 0) {
> + dev_err(icd->vdev->parent,
> + "Platform failed to power-on the camera.\n");
> + return ret;
> + }
> + }
probably you would have to call icl->reset there too?
I guess this camera sensor does have a reset pin?
> +
> /* Disable chip output, synchronous option update */
> ret = reg_write(icd, MT9T031_RESET, 1);
> if (ret >= 0)
> @@ -150,13 +161,23 @@ static int mt9t031_init(struct soc_camera_device *icd)
> if (ret >= 0)
> ret = reg_clear(icd, MT9T031_OUTPUT_CONTROL, 2);
>
> + if (ret < 0 && icl->power)
> + icl->power(&mt9t031->client->dev, 0);
> +
> return ret >= 0 ? 0 : -EIO;
> }
>
> static int mt9t031_release(struct soc_camera_device *icd)
> {
> + struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd);
> + struct soc_camera_link *icl = mt9t031->client->dev.platform_data;
> +
> /* Disable the chip */
> reg_clear(icd, MT9T031_OUTPUT_CONTROL, 2);
> +
> + if (icl->power)
> + icl->power(&mt9t031->client->dev, 0);
> +
> return 0;
> }
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2009-04-02 17:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-02 9:56 [PATCH] mt9t031: use platform power hook Guennadi Liakhovetski
2009-04-02 17:30 ` Darius Augulis [this message]
2009-04-02 17:36 ` Guennadi Liakhovetski
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=49D4F633.1040806@gmail.com \
--to=augulis.darius@gmail.com \
--cc=lg@denx.de \
--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.