public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <snjw23@gmail.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Kassey Lee <kassey1216@gmail.com>,
	linux-media@vger.kernel.org, g.liakhovetski@gmx.de,
	Kassey Lee <ygli@marvell.com>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	qingx@marvell.com, ytang5@marvell.com
Subject: Re: [PATCH 8/8] marvell-cam: Basic working MMP camera driver
Date: Thu, 16 Jun 2011 21:44:43 +0200	[thread overview]
Message-ID: <4DFA5D2B.5090701@gmail.com> (raw)
In-Reply-To: <20110616091720.22962c5c@bike.lwn.net>

Hello,

On 06/16/2011 05:17 PM, Jonathan Corbet wrote:
> On Thu, 16 Jun 2011 10:37:37 +0800
> Kassey Lee<kassey1216@gmail.com>  wrote:
> 
>>> +static void mmpcam_power_down(struct mcam_camera *mcam)
>>> +{
>>> +       struct mmp_camera *cam = mcam_to_cam(mcam);
>>> +       struct mmp_camera_platform_data *pdata;
>>> +/*
>>> + * Turn off clocks and set reset lines
>>> + */
>>> +       iowrite32(0, cam->power_regs + REG_CCIC_DCGCR);
>>> +       iowrite32(0, cam->power_regs + REG_CCIC_CRCR);
>>> +/*
>>> + * Shut down the sensor.
>>> + */
>>> +       pdata = cam->pdev->dev.platform_data;
>>> +       gpio_set_value(pdata->sensor_power_gpio, 0);
>>> +       gpio_set_value(pdata->sensor_reset_gpio, 0);
> 
>> it is better to have a callback function to controller sensor power on/off.
>> and place the callback function in board.c

It might be more convenient for the driver writer but I do not think
it is generally better. Platform callbacks cannot really be migrated 
to FDT. For reasons pointed out by Jon below I have also been trying
to avoid callbacks in sensors' platform data.

> 
> This is an interesting question, actually.  The problem is that board
> files are on their way out; it's going to be very hard to get any more
> board files into the mainline going forward.
> 
> The mmp-camera driver does depend on a board file, but I've been careful
> to restrict things to basic platform data which can just as easily be put
> into a device tree.  Power management callbacks don't really qualify.
> 
> So it seems that we need to figure out a way to push this kind of
> pin/power management down into the sensor-specific code.  Looking at the
> subdev stuff, it looks like a bit of thought has been put into that
> direction; there's the s_io_pin_config() callback to describe pins to the

But having sensor's GPIOs configured by bridge driver does not help us
much here, does it? The bridge driver would still need to retrieve the
sensor configuration from somewhere, since it is machine/board specific.
And it's the subdev driver that will know how the GPIOs should be handled,
the timing constraints, etc. So as long as we can pass gpio numbers from
a device tree to subdevs we probably do not need an additional subdev operation. 
I guess when there come more subdev drivers dealing with GPIOs we could try
and see what could be generalized.

> sensor.  But it's almost entirely unused.
> 
> There is no "power up/down" callback, currently.  We could ponder on

We have the subdev s_power core operation in struct v4l2_subdev_core_ops.
However it seems that its semantic is not yet clearly documented.

> whether one should be added, or whether this should be handled through the
> existing power management code somehow.  I honestly don't know what the
> best answer is on this one - will have to do some digging.  Suggestions
> welcome.

--
Regards,
Sylwester


  reply	other threads:[~2011-06-16 19:44 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
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 [this message]
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=4DFA5D2B.5090701@gmail.com \
    --to=snjw23@gmail.com \
    --cc=corbet@lwn.net \
    --cc=g.liakhovetski@gmx.de \
    --cc=kassey1216@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=qingx@marvell.com \
    --cc=ygli@marvell.com \
    --cc=ytang5@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