All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <m.chehab@samsung.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: "Guennadi Liakhovetski" <g.liakhovetski@gmx.de>,
	"Frank Schäfer" <fschaefer.oss@googlemail.com>,
	"Sylwester Nawrocki" <sylvester.nawrocki@gmail.com>,
	"Hans Verkuil" <hans.verkuil@cisco.com>,
	"Linux Media Mailing List" <linux-media@vger.kernel.org>
Subject: Re: em28xx + ov2640 and v4l2-clk
Date: Tue, 27 Aug 2013 13:00:41 -0300	[thread overview]
Message-ID: <20130827130041.15db82d5@samsung.com> (raw)
In-Reply-To: <5182139.9PqyLJNP0L@avalon>

Em Tue, 27 Aug 2013 17:27:52 +0200
Laurent Pinchart <laurent.pinchart@ideasonboard.com> escreveu:

> Hi Mauro,
> 
> On Tuesday 27 August 2013 11:08:58 Mauro Carvalho Chehab wrote:
> > Laurent Pinchart <laurent.pinchart@ideasonboard.com> escreveu:
> > > On Monday 26 August 2013 11:09:33 Mauro Carvalho Chehab wrote:
> > > > Guennadi Liakhovetski <g.liakhovetski@gmx.de> escreveu:
> 

> > Ok, but the voltage and clock regulators are not mapped, on embedded
> > devices, as part of the USB or PCI bus bridge device (except, of course,
> > when the voltage/clocks are needed by the bridge device itself). It is
> > mapped elsewhere, at DT.
> 
> Or in a C code board file, depending on the platform. DT or board files are 
> more or less equivalent, both of them store information about the board. For 
> PCI and USB devices we need to store that information somewhere as well. As 
> the em28xx driver already stores board layout information in em28xx-cards.c, 
> we could store clock information there as well (I haven't checked whether 
> that's the best place to store that information in the driver). I don't see 
> why storing board-specific clock information ("there's a fixed-frequency clock 
> with this frequency and this name on the board") in the driver is a different 
> issue than storing other kind of board information in the em28xx_board 
> structure.

Yes, on PCI/USB drivers, we have a board specific setup. On em28xx, it is
at em28xx-cards.c.

Yet, there's no board-specific information in this case: em28xx doesn't
manage clocks. It is always on. No need to add a bit there at the boards
config file to initialize the clock before loading the subdevice, because
the clock is already there.

> The point is that the client driver knows that it needs a clock, and knows how 
> to use it (for instance it knows that it should turn the clock on at least 
> 100ms before sending the first I2C command). However, the client should not 
> know how the clock is provided. That's the clock API abstraction layer. The 
> client will request the clock and turn it on/off when it needs to, and if the 
> clock source is a crystal it will always be on. On platforms where the clock 
> can be controlled we will thus save power by disabling the clock when it's not 
> used, and on other platforms the clock will just always be on, without any 
> need to code this explictly in all client drivers.

On em28xx devices, power saving is done by enabling reset pin. On several
hardware, doing that internally disables the clock line. I'm not sure if
ov2640 supports this mode (Frank may know better how power saving is done
with those cameras). Other devices have an special pin for power off or
power saving.

Anyway, that rises an interesting question: on devices with wired clocks,
the power saving mode should not be provided via clock API abstraction
layer, but via a callback to the bridge (as the bridge knows the GPIO
register/bit that corresponds to device reset and/or power off pin).

> > So, the only sense on having a clock API is when the hardware allows some
> > control on it.
> > 
> > So, if the hardware can't be controlled and it is always on, it makes no
> > sense to register a clock.
> 
> Please also note that, even if the clock can't be controlled, the sensor might 
> need to query the clock frequency for instance to adjust its PLL parameters. 
> The clk_get_rate() call is used for such a purpose, and requires a clock 
> object.

Ok, this is a good point.

> > The thing is that you're wanting to use the clock register as a way to
> > detect that the device got initialized.
> 
> I'm not sure to follow you there, I don't think that's how I want to use the 
> clock. Could you please elaborate ?

As Sylwester pointed, the lack of clock register makes ov2640 to defer
probing, as it assumes that the sensor is not ready.

Cheers,
Mauro

  reply	other threads:[~2013-08-27 16:00 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-16 19:00 em28xx + ov2640 and v4l2-clk Frank Schäfer
2013-08-17 10:51 ` Guennadi Liakhovetski
2013-08-18 11:40   ` Frank Schäfer
2013-08-18 15:20     ` Mauro Carvalho Chehab
2013-08-20 13:38       ` Laurent Pinchart
2013-08-20 15:31         ` Mauro Carvalho Chehab
2013-08-20 16:39           ` Frank Schäfer
2013-08-24 18:52             ` Mauro Carvalho Chehab
2013-08-20 16:34         ` Frank Schäfer
2013-08-21 20:39           ` Frank Schäfer
2013-08-21 21:42             ` Sylwester Nawrocki
2013-08-22 22:15               ` Frank Schäfer
2013-08-24 19:03                 ` Mauro Carvalho Chehab
2013-08-24 21:28                   ` Sylwester Nawrocki
2013-08-26 13:54                   ` Guennadi Liakhovetski
2013-08-26 14:09                     ` Mauro Carvalho Chehab
2013-08-27 12:52                       ` Laurent Pinchart
2013-08-27 14:08                         ` Mauro Carvalho Chehab
2013-08-27 15:27                           ` Laurent Pinchart
2013-08-27 16:00                             ` Mauro Carvalho Chehab [this message]
2013-08-28  9:00                               ` Sylwester Nawrocki
2013-08-28  9:27                                 ` Mauro Carvalho Chehab
2013-08-28  9:50                                   ` Laurent Pinchart
2013-09-02 18:30                         ` Frank Schäfer
2013-09-02 21:44                           ` Sylwester Nawrocki
2013-09-02 22:02                           ` Laurent Pinchart
2013-08-30 10:30                 ` Guennadi Liakhovetski
2013-08-30 13:43                   ` Frank Schäfer
2013-10-08 16:21       ` Frank Schäfer
2013-10-08 16:38         ` Guennadi Liakhovetski
2013-10-10 13:33           ` Frank Schäfer
2013-10-10 13:50             ` Guennadi Liakhovetski
2013-10-10 17:15               ` Frank Schäfer
2013-10-10 17:50                 ` Guennadi Liakhovetski
2013-10-10 18:38                   ` Frank Schäfer
2013-10-10 18:57                     ` Frank Schäfer
2013-10-12  3:45               ` Mauro Carvalho Chehab
2013-10-13 14:00                 ` Frank Schäfer
2013-10-16 19:39                   ` Frank Schäfer
2013-10-15  7:37                 ` Guennadi Liakhovetski
2013-10-15  8:37                   ` 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=20130827130041.15db82d5@samsung.com \
    --to=m.chehab@samsung.com \
    --cc=fschaefer.oss@googlemail.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=hans.verkuil@cisco.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sylvester.nawrocki@gmail.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 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.