All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] mx2_camera changes and corrections
@ 2010-08-03  9:37 Michael Grzeschik
  2010-08-03  9:37 ` [PATCH 1/5] mx2_camera: change to register and probe Michael Grzeschik
                   ` (4 more replies)
  0 siblings, 5 replies; 26+ messages in thread
From: Michael Grzeschik @ 2010-08-03  9:37 UTC (permalink / raw)
  To: linux-media; +Cc: baruch, g.liakhovetski, s.hauer, Michael Grzeschik

Hi everybody,

this patchseries include little changes, which are necessary for the mx2_camera
driver to work properly on i.MX27 baseboards, especially an issue with the
emma.

Thanks,
Michael

Michael Grzeschik (5):
  mx2_camera: change to register and probe
  mx2_camera: remove emma limitation for RGB565
  mx2_camera: fix for list bufnum in frame_done_emma
  mx2_camera: add rising edge for pixclock
  mx2_camera: add informative camera clock frequency printout

 drivers/media/video/mx2_camera.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 1/5] mx2_camera: change to register and probe
  2010-08-03  9:37 [PATCH 0/5] mx2_camera changes and corrections Michael Grzeschik
@ 2010-08-03  9:37 ` Michael Grzeschik
  2010-08-03 18:22   ` Guennadi Liakhovetski
  2010-08-05 20:17   ` Guennadi Liakhovetski
  2010-08-03  9:37 ` [PATCH 2/5] mx2_camera: remove emma limitation for RGB565 Michael Grzeschik
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 26+ messages in thread
From: Michael Grzeschik @ 2010-08-03  9:37 UTC (permalink / raw)
  To: linux-media; +Cc: baruch, g.liakhovetski, s.hauer, Michael Grzeschik

change this driver back to register and probe, since some platforms
first have to initialize an already registered power regulator to switch
on the camera.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/media/video/mx2_camera.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index 98c93fa..c77a673 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -1491,13 +1491,15 @@ static struct platform_driver mx2_camera_driver = {
 	.driver 	= {
 		.name	= MX2_CAM_DRV_NAME,
 	},
+
+	.probe          = mx2_camera_probe,
 	.remove		= __devexit_p(mx2_camera_remove),
 };
 
 
 static int __init mx2_camera_init(void)
 {
-	return platform_driver_probe(&mx2_camera_driver, &mx2_camera_probe);
+	return platform_driver_register(&mx2_camera_driver);
 }
 
 static void __exit mx2_camera_exit(void)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 2/5] mx2_camera: remove emma limitation for RGB565
  2010-08-03  9:37 [PATCH 0/5] mx2_camera changes and corrections Michael Grzeschik
  2010-08-03  9:37 ` [PATCH 1/5] mx2_camera: change to register and probe Michael Grzeschik
@ 2010-08-03  9:37 ` Michael Grzeschik
  2010-08-04  9:55   ` Guennadi Liakhovetski
  2010-08-03  9:37 ` [PATCH 3/5] mx2_camera: fix for list bufnum in frame_done_emma Michael Grzeschik
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 26+ messages in thread
From: Michael Grzeschik @ 2010-08-03  9:37 UTC (permalink / raw)
  To: linux-media; +Cc: baruch, g.liakhovetski, s.hauer, Michael Grzeschik

In the current source status the emma has no limitation for any PIXFMT
since the data is parsed raw and unprocessed into the memory.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/media/video/mx2_camera.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index c77a673..ae27640 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -897,10 +897,6 @@ static int mx2_camera_set_fmt(struct soc_camera_device *icd,
 		return -EINVAL;
 	}
 
-	/* eMMA can only do RGB565 */
-	if (mx27_camera_emma(pcdev) && pix->pixelformat != V4L2_PIX_FMT_RGB565)
-		return -EINVAL;
-
 	mf.width	= pix->width;
 	mf.height	= pix->height;
 	mf.field	= pix->field;
@@ -944,10 +940,6 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
 
 	/* FIXME: implement MX27 limits */
 
-	/* eMMA can only do RGB565 */
-	if (mx27_camera_emma(pcdev) && pixfmt != V4L2_PIX_FMT_RGB565)
-		return -EINVAL;
-
 	/* limit to MX25 hardware capabilities */
 	if (cpu_is_mx25()) {
 		if (xlate->host_fmt->bits_per_sample <= 8)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 3/5] mx2_camera: fix for list bufnum in frame_done_emma
  2010-08-03  9:37 [PATCH 0/5] mx2_camera changes and corrections Michael Grzeschik
  2010-08-03  9:37 ` [PATCH 1/5] mx2_camera: change to register and probe Michael Grzeschik
  2010-08-03  9:37 ` [PATCH 2/5] mx2_camera: remove emma limitation for RGB565 Michael Grzeschik
@ 2010-08-03  9:37 ` Michael Grzeschik
  2010-08-03  9:37 ` [PATCH 4/5] mx2_camera: add rising edge for pixclock Michael Grzeschik
  2010-08-03  9:37 ` [PATCH 5/5] mx2_camera: add informative camera clock frequency printout Michael Grzeschik
  4 siblings, 0 replies; 26+ messages in thread
From: Michael Grzeschik @ 2010-08-03  9:37 UTC (permalink / raw)
  To: linux-media; +Cc: baruch, g.liakhovetski, s.hauer, Michael Grzeschik

The emma uses bufnum 1 and 0. This patch tells the bufqueue to change
the next buffer to the next one and not the current one.
Otherwise the BUG_ON above will trigger everytime.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/media/video/mx2_camera.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index ae27640..cf9a604 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -1193,7 +1193,7 @@ static void mx27_camera_frame_done_emma(struct mx2_camera_dev *pcdev,
 	buf = list_entry(pcdev->capture.next,
 			struct mx2_buffer, vb.queue);
 
-	buf->bufnum = bufnum;
+	buf->bufnum = !bufnum;
 
 	list_move_tail(pcdev->capture.next, &pcdev->active_bufs);
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 4/5] mx2_camera: add rising edge for pixclock
  2010-08-03  9:37 [PATCH 0/5] mx2_camera changes and corrections Michael Grzeschik
                   ` (2 preceding siblings ...)
  2010-08-03  9:37 ` [PATCH 3/5] mx2_camera: fix for list bufnum in frame_done_emma Michael Grzeschik
@ 2010-08-03  9:37 ` Michael Grzeschik
  2010-08-03  9:37 ` [PATCH 5/5] mx2_camera: add informative camera clock frequency printout Michael Grzeschik
  4 siblings, 0 replies; 26+ messages in thread
From: Michael Grzeschik @ 2010-08-03  9:37 UTC (permalink / raw)
  To: linux-media; +Cc: baruch, g.liakhovetski, s.hauer, Michael Grzeschik

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/media/video/mx2_camera.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index cf9a604..7f27492 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -785,6 +785,8 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd,
 	if (ret < 0)
 		return ret;
 
+	if (common_flags & SOCAM_PCLK_SAMPLE_RISING)
+		csicr1 |= CSICR1_REDGE;
 	if (common_flags & SOCAM_PCLK_SAMPLE_FALLING)
 		csicr1 |= CSICR1_INV_PCLK;
 	if (common_flags & SOCAM_VSYNC_ACTIVE_HIGH)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 5/5] mx2_camera: add informative camera clock frequency printout
  2010-08-03  9:37 [PATCH 0/5] mx2_camera changes and corrections Michael Grzeschik
                   ` (3 preceding siblings ...)
  2010-08-03  9:37 ` [PATCH 4/5] mx2_camera: add rising edge for pixclock Michael Grzeschik
@ 2010-08-03  9:37 ` Michael Grzeschik
  2010-08-05 20:30   ` Guennadi Liakhovetski
  2010-08-27 12:39   ` [PATCH v2] " Michael Grzeschik
  4 siblings, 2 replies; 26+ messages in thread
From: Michael Grzeschik @ 2010-08-03  9:37 UTC (permalink / raw)
  To: linux-media
  Cc: baruch, g.liakhovetski, s.hauer, Michael Grzeschik, Teresa Gamez

ported mx27_camera to 2.6.33.2
Signed-off-by: Teresa Gamez <T.Gamez@phytec.de>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/media/video/mx2_camera.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index 7f27492..fb1b1cb 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -1360,6 +1360,9 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
 			goto exit_dma_free;
 	}
 
+	dev_info(&pdev->dev, "Camera clock frequency: %ld\n",
+			clk_get_rate(pcdev->clk_csi));
+
 	INIT_LIST_HEAD(&pcdev->capture);
 	INIT_LIST_HEAD(&pcdev->active_bufs);
 	spin_lock_init(&pcdev->lock);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/5] mx2_camera: change to register and probe
  2010-08-03  9:37 ` [PATCH 1/5] mx2_camera: change to register and probe Michael Grzeschik
@ 2010-08-03 18:22   ` Guennadi Liakhovetski
  2010-08-03 19:57     ` Michael Grzeschik
  2010-08-05 20:17   ` Guennadi Liakhovetski
  1 sibling, 1 reply; 26+ messages in thread
From: Guennadi Liakhovetski @ 2010-08-03 18:22 UTC (permalink / raw)
  To: Michael Grzeschik; +Cc: Linux Media Mailing List, baruch, Sascha Hauer

On Tue, 3 Aug 2010, Michael Grzeschik wrote:

> change this driver back to register and probe, since some platforms
> first have to initialize an already registered power regulator to switch
> on the camera.

Sorry, don't see a difference. Can you give an example of two call 
sequences, where this change changes the behaviour?

Thanks
Guennadi

> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
>  drivers/media/video/mx2_camera.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
> index 98c93fa..c77a673 100644
> --- a/drivers/media/video/mx2_camera.c
> +++ b/drivers/media/video/mx2_camera.c
> @@ -1491,13 +1491,15 @@ static struct platform_driver mx2_camera_driver = {
>  	.driver 	= {
>  		.name	= MX2_CAM_DRV_NAME,
>  	},
> +
> +	.probe          = mx2_camera_probe,
>  	.remove		= __devexit_p(mx2_camera_remove),
>  };
>  
>  
>  static int __init mx2_camera_init(void)
>  {
> -	return platform_driver_probe(&mx2_camera_driver, &mx2_camera_probe);
> +	return platform_driver_register(&mx2_camera_driver);
>  }
>  
>  static void __exit mx2_camera_exit(void)
> -- 
> 1.7.1
> 
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/5] mx2_camera: change to register and probe
  2010-08-03 18:22   ` Guennadi Liakhovetski
@ 2010-08-03 19:57     ` Michael Grzeschik
  2010-08-03 23:01       ` Guennadi Liakhovetski
  0 siblings, 1 reply; 26+ messages in thread
From: Michael Grzeschik @ 2010-08-03 19:57 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: Michael Grzeschik, Linux Media Mailing List, baruch, Sascha Hauer

On Tue, Aug 03, 2010 at 08:22:13PM +0200, Guennadi Liakhovetski wrote:
> On Tue, 3 Aug 2010, Michael Grzeschik wrote:
> 
> > change this driver back to register and probe, since some platforms
> > first have to initialize an already registered power regulator to switch
> > on the camera.
> 
> Sorry, don't see a difference. Can you give an example of two call 
> sequences, where this change changes the behaviour?
>

Yes, when you look at the today posted patch [1] you find the function
pcm970_baseboard_init_late as an late_initcall. It uses an already
registred regulator device to turn on the power of the camera before the
cameras device registration.

[1] [PATCH 1/2] ARM: i.MX27 pcm970: Add camera support
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-August/022317.html

Thanks,
Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/5] mx2_camera: change to register and probe
  2010-08-03 19:57     ` Michael Grzeschik
@ 2010-08-03 23:01       ` Guennadi Liakhovetski
  2010-08-04  7:09         ` Sascha Hauer
  0 siblings, 1 reply; 26+ messages in thread
From: Guennadi Liakhovetski @ 2010-08-03 23:01 UTC (permalink / raw)
  To: Michael Grzeschik
  Cc: Michael Grzeschik, Linux Media Mailing List, baruch, Sascha Hauer

On Tue, 3 Aug 2010, Michael Grzeschik wrote:

> On Tue, Aug 03, 2010 at 08:22:13PM +0200, Guennadi Liakhovetski wrote:
> > On Tue, 3 Aug 2010, Michael Grzeschik wrote:
> > 
> > > change this driver back to register and probe, since some platforms
> > > first have to initialize an already registered power regulator to switch
> > > on the camera.
> > 
> > Sorry, don't see a difference. Can you give an example of two call 
> > sequences, where this change changes the behaviour?
> >
> 
> Yes, when you look at the today posted patch [1] you find the function
> pcm970_baseboard_init_late as an late_initcall. It uses an already
> registred regulator device to turn on the power of the camera before the
> cameras device registration.
> 
> [1] [PATCH 1/2] ARM: i.MX27 pcm970: Add camera support
> http://lists.infradead.org/pipermail/linux-arm-kernel/2010-August/022317.html

Sorry again, still don't understand. What I mean is the following: take 
two cases - before and after your patch. What is the difference? As far as 
I know, the difference between platform_driver_probe() and 
platform_driver_register() is just that the probe method gets discarded in 
an __init section, which is suitable for non hotpluggable devices. I don't 
know what the difference this should make for call order. So, that's what 
I am asking about. Can you explain, how this patch changes the call order 
in your case? Can you tell, that in the unpatches case the probe is called 
at that moment, and in the patched case it is called at a different point 
of time and that fixes the problem.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/5] mx2_camera: change to register and probe
  2010-08-03 23:01       ` Guennadi Liakhovetski
@ 2010-08-04  7:09         ` Sascha Hauer
  2010-08-04  8:24           ` Guennadi Liakhovetski
  0 siblings, 1 reply; 26+ messages in thread
From: Sascha Hauer @ 2010-08-04  7:09 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: Michael Grzeschik, Michael Grzeschik, Linux Media Mailing List, baruch

On Wed, Aug 04, 2010 at 01:01:34AM +0200, Guennadi Liakhovetski wrote:
> On Tue, 3 Aug 2010, Michael Grzeschik wrote:
> 
> > On Tue, Aug 03, 2010 at 08:22:13PM +0200, Guennadi Liakhovetski wrote:
> > > On Tue, 3 Aug 2010, Michael Grzeschik wrote:
> > > 
> > > > change this driver back to register and probe, since some platforms
> > > > first have to initialize an already registered power regulator to switch
> > > > on the camera.
> > > 
> > > Sorry, don't see a difference. Can you give an example of two call 
> > > sequences, where this change changes the behaviour?
> > >
> > 
> > Yes, when you look at the today posted patch [1] you find the function
> > pcm970_baseboard_init_late as an late_initcall. It uses an already
> > registred regulator device to turn on the power of the camera before the
> > cameras device registration.
> > 
> > [1] [PATCH 1/2] ARM: i.MX27 pcm970: Add camera support
> > http://lists.infradead.org/pipermail/linux-arm-kernel/2010-August/022317.html
> 
> Sorry again, still don't understand. What I mean is the following: take 
> two cases - before and after your patch. What is the difference? As far as 
> I know, the difference between platform_driver_probe() and 
> platform_driver_register() is just that the probe method gets discarded in 
> an __init section, which is suitable for non hotpluggable devices. I don't 
> know what the difference this should make for call order. So, that's what 
> I am asking about. Can you explain, how this patch changes the call order 
> in your case? Can you tell, that in the unpatches case the probe is called 
> at that moment, and in the patched case it is called at a different point 
> of time and that fixes the problem.


The following is above platform_driver_probe:

 * Use this instead of platform_driver_register() when you know the device
 * is not hotpluggable and has already been registered, and you want to
 * remove its run-once probe() infrastructure from memory after the
 * driver has bound to the device.

So platform_driver_probe will only call the probe function when the device
is already there when this function runs. This is not the case on our board.
We have to register the camera in late_initcall (to make sure the needed
regulators are already there). During late_initcall time the
platform_driver_probe has already run.

I don't really like the trend to platform_driver_probe, because this
makes cases like camera needs regulator which in turn needs SPI even
more complicated.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/5] mx2_camera: change to register and probe
  2010-08-04  7:09         ` Sascha Hauer
@ 2010-08-04  8:24           ` Guennadi Liakhovetski
  2010-08-04  8:53             ` Michael Grzeschik
  0 siblings, 1 reply; 26+ messages in thread
From: Guennadi Liakhovetski @ 2010-08-04  8:24 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Michael Grzeschik, Michael Grzeschik, Linux Media Mailing List, baruch

On Wed, 4 Aug 2010, Sascha Hauer wrote:

> On Wed, Aug 04, 2010 at 01:01:34AM +0200, Guennadi Liakhovetski wrote:
> > On Tue, 3 Aug 2010, Michael Grzeschik wrote:
> > 
> > > On Tue, Aug 03, 2010 at 08:22:13PM +0200, Guennadi Liakhovetski wrote:
> > > > On Tue, 3 Aug 2010, Michael Grzeschik wrote:
> > > > 
> > > > > change this driver back to register and probe, since some platforms
> > > > > first have to initialize an already registered power regulator to switch
> > > > > on the camera.
> > > > 
> > > > Sorry, don't see a difference. Can you give an example of two call 
> > > > sequences, where this change changes the behaviour?
> > > >
> > > 
> > > Yes, when you look at the today posted patch [1] you find the function
> > > pcm970_baseboard_init_late as an late_initcall. It uses an already
> > > registred regulator device to turn on the power of the camera before the
> > > cameras device registration.
> > > 
> > > [1] [PATCH 1/2] ARM: i.MX27 pcm970: Add camera support
> > > http://lists.infradead.org/pipermail/linux-arm-kernel/2010-August/022317.html
> > 
> > Sorry again, still don't understand. What I mean is the following: take 
> > two cases - before and after your patch. What is the difference? As far as 
> > I know, the difference between platform_driver_probe() and 
> > platform_driver_register() is just that the probe method gets discarded in 
> > an __init section, which is suitable for non hotpluggable devices. I don't 
> > know what the difference this should make for call order. So, that's what 
> > I am asking about. Can you explain, how this patch changes the call order 
> > in your case? Can you tell, that in the unpatches case the probe is called 
> > at that moment, and in the patched case it is called at a different point 
> > of time and that fixes the problem.
> 
> 
> The following is above platform_driver_probe:
> 
>  * Use this instead of platform_driver_register() when you know the device
>  * is not hotpluggable and has already been registered, and you want to
>  * remove its run-once probe() infrastructure from memory after the
>  * driver has bound to the device.
> 
> So platform_driver_probe will only call the probe function when the device
> is already there when this function runs. This is not the case on our board.
> We have to register the camera in late_initcall (to make sure the needed
> regulators are already there). During late_initcall time the
> platform_driver_probe has already run.

Ok, now I see. I missed the key-phrase: "before the cameras device 
registration." Ok, in this case, it's certainly a valid reason for the 
change. Just one more question: wouldn't calling 
pcm970_baseboard_init_late() from device_initcall fix the problem without 
requiring to change the driver?

> I don't really like the trend to platform_driver_probe, because this
> makes cases like camera needs regulator which in turn needs SPI even
> more complicated.

Well, you can always change to using the platform_driver_register() if 
platform_driver_probe() causes problems, otherwise it does have its 
advantages, as described in the comment, you quoted above.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/5] mx2_camera: change to register and probe
  2010-08-04  8:24           ` Guennadi Liakhovetski
@ 2010-08-04  8:53             ` Michael Grzeschik
  2010-08-04  9:48               ` Guennadi Liakhovetski
  0 siblings, 1 reply; 26+ messages in thread
From: Michael Grzeschik @ 2010-08-04  8:53 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: Sascha Hauer, Michael Grzeschik, Linux Media Mailing List, baruch

On Wed, Aug 04, 2010 at 10:24:50AM +0200, Guennadi Liakhovetski wrote:
> On Wed, 4 Aug 2010, Sascha Hauer wrote:
> 
> > On Wed, Aug 04, 2010 at 01:01:34AM +0200, Guennadi Liakhovetski wrote:
> > > On Tue, 3 Aug 2010, Michael Grzeschik wrote:
> > > 
> > > > On Tue, Aug 03, 2010 at 08:22:13PM +0200, Guennadi Liakhovetski wrote:
> > > > > On Tue, 3 Aug 2010, Michael Grzeschik wrote:
> > > > > 
> > > > > > change this driver back to register and probe, since some platforms
> > > > > > first have to initialize an already registered power regulator to switch
> > > > > > on the camera.
> > > > > 
> > > > > Sorry, don't see a difference. Can you give an example of two call 
> > > > > sequences, where this change changes the behaviour?
> > > > >
> > > > 
> > > > Yes, when you look at the today posted patch [1] you find the function
> > > > pcm970_baseboard_init_late as an late_initcall. It uses an already
> > > > registred regulator device to turn on the power of the camera before the
> > > > cameras device registration.
> > > > 
> > > > [1] [PATCH 1/2] ARM: i.MX27 pcm970: Add camera support
> > > > http://lists.infradead.org/pipermail/linux-arm-kernel/2010-August/022317.html
> > > 
> > > Sorry again, still don't understand. What I mean is the following: take 
> > > two cases - before and after your patch. What is the difference? As far as 
> > > I know, the difference between platform_driver_probe() and 
> > > platform_driver_register() is just that the probe method gets discarded in 
> > > an __init section, which is suitable for non hotpluggable devices. I don't 
> > > know what the difference this should make for call order. So, that's what 
> > > I am asking about. Can you explain, how this patch changes the call order 
> > > in your case? Can you tell, that in the unpatches case the probe is called 
> > > at that moment, and in the patched case it is called at a different point 
> > > of time and that fixes the problem.
> > 
> > 
> > The following is above platform_driver_probe:
> > 
> >  * Use this instead of platform_driver_register() when you know the device
> >  * is not hotpluggable and has already been registered, and you want to
> >  * remove its run-once probe() infrastructure from memory after the
> >  * driver has bound to the device.
> > 
> > So platform_driver_probe will only call the probe function when the device
> > is already there when this function runs. This is not the case on our board.
> > We have to register the camera in late_initcall (to make sure the needed
> > regulators are already there). During late_initcall time the
> > platform_driver_probe has already run.
> 
> Ok, now I see. I missed the key-phrase: "before the cameras device 
> registration." Ok, in this case, it's certainly a valid reason for the 
> change. Just one more question: wouldn't calling 
> pcm970_baseboard_init_late() from device_initcall fix the problem without 
> requiring to change the driver?

No, sorry but this doesn't solve the problem. I tested it and get an
"unable to get regulator: -19" when i hit on that. The problem is the
device init order. The pcm970_baseboard_init_late comes first and
then the regulator. So i think we should keep that patch.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/5] mx2_camera: change to register and probe
  2010-08-04  8:53             ` Michael Grzeschik
@ 2010-08-04  9:48               ` Guennadi Liakhovetski
  0 siblings, 0 replies; 26+ messages in thread
From: Guennadi Liakhovetski @ 2010-08-04  9:48 UTC (permalink / raw)
  To: Michael Grzeschik
  Cc: Sascha Hauer, Michael Grzeschik, Linux Media Mailing List, baruch

On Wed, 4 Aug 2010, Michael Grzeschik wrote:

> No, sorry but this doesn't solve the problem. I tested it and get an
> "unable to get regulator: -19" when i hit on that. The problem is the
> device init order. The pcm970_baseboard_init_late comes first and
> then the regulator. So i think we should keep that patch.

Ok, you could register a bus-notifier on the soc-camera bus 
(http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/21364/focus=8520), 
watching out for a BUS_NOTIFY_ADD_DEVICE event. I think, that would be a 
more elegant solution, with it we still preserve the ability to clean up 
the probe function. Although, for that, I think, we'd need to make it 
__init instead of __devinit. In any case, I would prefer that solution, 
however, if for some reason you cannot or do not want to do it, I'll take 
this patch.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/5] mx2_camera: remove emma limitation for RGB565
  2010-08-03  9:37 ` [PATCH 2/5] mx2_camera: remove emma limitation for RGB565 Michael Grzeschik
@ 2010-08-04  9:55   ` Guennadi Liakhovetski
  2010-08-04 10:27     ` Michael Grzeschik
  0 siblings, 1 reply; 26+ messages in thread
From: Guennadi Liakhovetski @ 2010-08-04  9:55 UTC (permalink / raw)
  To: Michael Grzeschik; +Cc: Linux Media Mailing List, baruch, Sascha Hauer

On Tue, 3 Aug 2010, Michael Grzeschik wrote:

> In the current source status the emma has no limitation for any PIXFMT
> since the data is parsed raw and unprocessed into the memory.

I'd like some explanation for this one too, please. What about

+	/*
+	 * We only use the EMMA engine to get rid of the broken
+	 * DMA Engine. No color space consversion at the moment.
+	 * We adjust incoming and outgoing pixelformat to rgb16
+	 * and adjust the bytesperline accordingly.
+	 */
+	writel(PRP_CNTL_CH1EN |
+			PRP_CNTL_CSIEN |
+			PRP_CNTL_DATA_IN_RGB16 |
+			PRP_CNTL_CH1_OUT_RGB16 |
+			PRP_CNTL_CH1_LEN |
+			PRP_CNTL_CH1BYP |
+			PRP_CNTL_CH1_TSKIP(0) |
+			PRP_CNTL_IN_TSKIP(0),
+			pcdev->base_emma + PRP_CNTL);
+
+	writel(((bytesperline >> 1) << 16) | icd->user_height,
+			pcdev->base_emma + PRP_SRC_FRAME_SIZE);
+	writel(((bytesperline >> 1) << 16) | icd->user_height,
+			pcdev->base_emma + PRP_CH1_OUT_IMAGE_SIZE);
+	writel(bytesperline,
+			pcdev->base_emma + PRP_DEST_CH1_LINE_STRIDE);
+	writel(0x2ca00565, /* RGB565 */
+			pcdev->base_emma + PRP_SRC_PIXEL_FORMAT_CNTL);
+	writel(0x2ca00565, /* RGB565 */
+			pcdev->base_emma + PRP_CH1_PIXEL_FORMAT_CNTL);

To me it looks like the eMMA is configured for RGB565. What's the trick?

Thanks
Guennadi

> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
>  drivers/media/video/mx2_camera.c |    8 --------
>  1 files changed, 0 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
> index c77a673..ae27640 100644
> --- a/drivers/media/video/mx2_camera.c
> +++ b/drivers/media/video/mx2_camera.c
> @@ -897,10 +897,6 @@ static int mx2_camera_set_fmt(struct soc_camera_device *icd,
>  		return -EINVAL;
>  	}
>  
> -	/* eMMA can only do RGB565 */
> -	if (mx27_camera_emma(pcdev) && pix->pixelformat != V4L2_PIX_FMT_RGB565)
> -		return -EINVAL;
> -
>  	mf.width	= pix->width;
>  	mf.height	= pix->height;
>  	mf.field	= pix->field;
> @@ -944,10 +940,6 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
>  
>  	/* FIXME: implement MX27 limits */
>  
> -	/* eMMA can only do RGB565 */
> -	if (mx27_camera_emma(pcdev) && pixfmt != V4L2_PIX_FMT_RGB565)
> -		return -EINVAL;
> -
>  	/* limit to MX25 hardware capabilities */
>  	if (cpu_is_mx25()) {
>  		if (xlate->host_fmt->bits_per_sample <= 8)
> -- 
> 1.7.1
> 
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/5] mx2_camera: remove emma limitation for RGB565
  2010-08-04  9:55   ` Guennadi Liakhovetski
@ 2010-08-04 10:27     ` Michael Grzeschik
  2010-08-05 19:25       ` Guennadi Liakhovetski
  0 siblings, 1 reply; 26+ messages in thread
From: Michael Grzeschik @ 2010-08-04 10:27 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: Michael Grzeschik, Linux Media Mailing List, baruch, Sascha Hauer

On Wed, Aug 04, 2010 at 11:55:39AM +0200, Guennadi Liakhovetski wrote:
> On Tue, 3 Aug 2010, Michael Grzeschik wrote:
> 
> > In the current source status the emma has no limitation for any PIXFMT
> > since the data is parsed raw and unprocessed into the memory.
> 
> I'd like some explanation for this one too, please. What about
> 
> +	/*
> +	 * We only use the EMMA engine to get rid of the broken
> +	 * DMA Engine. No color space consversion at the moment.
> +	 * We adjust incoming and outgoing pixelformat to rgb16
> +	 * and adjust the bytesperline accordingly.
> +	 */
> +	writel(PRP_CNTL_CH1EN |
> +			PRP_CNTL_CSIEN |
> +			PRP_CNTL_DATA_IN_RGB16 |
> +			PRP_CNTL_CH1_OUT_RGB16 |
> +			PRP_CNTL_CH1_LEN |
> +			PRP_CNTL_CH1BYP |
> +			PRP_CNTL_CH1_TSKIP(0) |
> +			PRP_CNTL_IN_TSKIP(0),
> +			pcdev->base_emma + PRP_CNTL);
> +
> +	writel(((bytesperline >> 1) << 16) | icd->user_height,
> +			pcdev->base_emma + PRP_SRC_FRAME_SIZE);
> +	writel(((bytesperline >> 1) << 16) | icd->user_height,
> +			pcdev->base_emma + PRP_CH1_OUT_IMAGE_SIZE);
> +	writel(bytesperline,
> +			pcdev->base_emma + PRP_DEST_CH1_LINE_STRIDE);
> +	writel(0x2ca00565, /* RGB565 */
> +			pcdev->base_emma + PRP_SRC_PIXEL_FORMAT_CNTL);
> +	writel(0x2ca00565, /* RGB565 */
> +			pcdev->base_emma + PRP_CH1_PIXEL_FORMAT_CNTL);
> 
> To me it looks like the eMMA is configured for RGB565. What's the trick?
> 

Yes, it seems to be an indication, but the emma currently does not touch
any pixels, since the SRC_PIXEL_FORMAT and CH1_PIXEL_FORMAT are
identical. It will be needed in the future when we are going to do some
resizing operations with the emma or the SRC_PIXEL_FORMAT will differ to
the output channels. But at that time, the simple condition check for
RGB565 wouldn't be enough. So we should better remove them now.

Michael

> 
> > 
> > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> > ---
> >  drivers/media/video/mx2_camera.c |    8 --------
> >  1 files changed, 0 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
> > index c77a673..ae27640 100644
> > --- a/drivers/media/video/mx2_camera.c
> > +++ b/drivers/media/video/mx2_camera.c
> > @@ -897,10 +897,6 @@ static int mx2_camera_set_fmt(struct soc_camera_device *icd,
> >  		return -EINVAL;
> >  	}
> >  
> > -	/* eMMA can only do RGB565 */
> > -	if (mx27_camera_emma(pcdev) && pix->pixelformat != V4L2_PIX_FMT_RGB565)
> > -		return -EINVAL;
> > -
> >  	mf.width	= pix->width;
> >  	mf.height	= pix->height;
> >  	mf.field	= pix->field;
> > @@ -944,10 +940,6 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
> >  
> >  	/* FIXME: implement MX27 limits */
> >  
> > -	/* eMMA can only do RGB565 */
> > -	if (mx27_camera_emma(pcdev) && pixfmt != V4L2_PIX_FMT_RGB565)
> > -		return -EINVAL;
> > -
> >  	/* limit to MX25 hardware capabilities */
> >  	if (cpu_is_mx25()) {
> >  		if (xlate->host_fmt->bits_per_sample <= 8)
> > -- 
> > 1.7.1
> > 
> > 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 2/5] mx2_camera: remove emma limitation for RGB565
  2010-08-04 10:27     ` Michael Grzeschik
@ 2010-08-05 19:25       ` Guennadi Liakhovetski
  2010-08-09 14:22         ` [PATCH v2] " Michael Grzeschik
  2010-08-09 14:57         ` [PATCH v2][RESEND] " Michael Grzeschik
  0 siblings, 2 replies; 26+ messages in thread
From: Guennadi Liakhovetski @ 2010-08-05 19:25 UTC (permalink / raw)
  To: Michael Grzeschik
  Cc: Michael Grzeschik, Linux Media Mailing List, baruch, Sascha Hauer

On Wed, 4 Aug 2010, Michael Grzeschik wrote:

> On Wed, Aug 04, 2010 at 11:55:39AM +0200, Guennadi Liakhovetski wrote:
> > On Tue, 3 Aug 2010, Michael Grzeschik wrote:
> > 
> > > In the current source status the emma has no limitation for any PIXFMT
> > > since the data is parsed raw and unprocessed into the memory.
> > 
> > I'd like some explanation for this one too, please. What about
> > 
> > +	/*
> > +	 * We only use the EMMA engine to get rid of the broken
> > +	 * DMA Engine. No color space consversion at the moment.
> > +	 * We adjust incoming and outgoing pixelformat to rgb16
> > +	 * and adjust the bytesperline accordingly.
> > +	 */
> > +	writel(PRP_CNTL_CH1EN |
> > +			PRP_CNTL_CSIEN |
> > +			PRP_CNTL_DATA_IN_RGB16 |
> > +			PRP_CNTL_CH1_OUT_RGB16 |
> > +			PRP_CNTL_CH1_LEN |
> > +			PRP_CNTL_CH1BYP |
> > +			PRP_CNTL_CH1_TSKIP(0) |
> > +			PRP_CNTL_IN_TSKIP(0),
> > +			pcdev->base_emma + PRP_CNTL);
> > +
> > +	writel(((bytesperline >> 1) << 16) | icd->user_height,
> > +			pcdev->base_emma + PRP_SRC_FRAME_SIZE);
> > +	writel(((bytesperline >> 1) << 16) | icd->user_height,
> > +			pcdev->base_emma + PRP_CH1_OUT_IMAGE_SIZE);
> > +	writel(bytesperline,
> > +			pcdev->base_emma + PRP_DEST_CH1_LINE_STRIDE);
> > +	writel(0x2ca00565, /* RGB565 */
> > +			pcdev->base_emma + PRP_SRC_PIXEL_FORMAT_CNTL);
> > +	writel(0x2ca00565, /* RGB565 */
> > +			pcdev->base_emma + PRP_CH1_PIXEL_FORMAT_CNTL);
> > 
> > To me it looks like the eMMA is configured for RGB565. What's the trick?
> > 
> 
> Yes, it seems to be an indication, but the emma currently does not touch
> any pixels, since the SRC_PIXEL_FORMAT and CH1_PIXEL_FORMAT are
> identical. It will be needed in the future when we are going to do some
> resizing operations with the emma or the SRC_PIXEL_FORMAT will differ to
> the output channels. But at that time, the simple condition check for
> RGB565 wouldn't be enough. So we should better remove them now.

Then at least, please fix the above comment:

> > +	 * We adjust incoming and outgoing pixelformat to rgb16
> > +	 * and adjust the bytesperline accordingly.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/5] mx2_camera: change to register and probe
  2010-08-03  9:37 ` [PATCH 1/5] mx2_camera: change to register and probe Michael Grzeschik
  2010-08-03 18:22   ` Guennadi Liakhovetski
@ 2010-08-05 20:17   ` Guennadi Liakhovetski
  2010-08-10 10:25     ` Michael Grzeschik
  1 sibling, 1 reply; 26+ messages in thread
From: Guennadi Liakhovetski @ 2010-08-05 20:17 UTC (permalink / raw)
  To: Michael Grzeschik; +Cc: Linux Media Mailing List, baruch, Sascha Hauer

On Tue, 3 Aug 2010, Michael Grzeschik wrote:

> change this driver back to register and probe, since some platforms
> first have to initialize an already registered power regulator to switch
> on the camera.

I shall be preparing a pull-request for 2.6.36-rc1 #2, but since we 
haven't finished discussing this and when this is ready, this will be a 
fix - without this your platform doesn't work, right? So, we can push it 
after rc1.

Thanks
Guennadi

> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
>  drivers/media/video/mx2_camera.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
> index 98c93fa..c77a673 100644
> --- a/drivers/media/video/mx2_camera.c
> +++ b/drivers/media/video/mx2_camera.c
> @@ -1491,13 +1491,15 @@ static struct platform_driver mx2_camera_driver = {
>  	.driver 	= {
>  		.name	= MX2_CAM_DRV_NAME,
>  	},
> +
> +	.probe          = mx2_camera_probe,
>  	.remove		= __devexit_p(mx2_camera_remove),
>  };
>  
>  
>  static int __init mx2_camera_init(void)
>  {
> -	return platform_driver_probe(&mx2_camera_driver, &mx2_camera_probe);
> +	return platform_driver_register(&mx2_camera_driver);
>  }
>  
>  static void __exit mx2_camera_exit(void)
> -- 
> 1.7.1
> 
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 5/5] mx2_camera: add informative camera clock frequency printout
  2010-08-03  9:37 ` [PATCH 5/5] mx2_camera: add informative camera clock frequency printout Michael Grzeschik
@ 2010-08-05 20:30   ` Guennadi Liakhovetski
  2010-08-05 20:54     ` Michael Grzeschik
  2010-08-27 12:39   ` [PATCH v2] " Michael Grzeschik
  1 sibling, 1 reply; 26+ messages in thread
From: Guennadi Liakhovetski @ 2010-08-05 20:30 UTC (permalink / raw)
  To: Michael Grzeschik
  Cc: Linux Media Mailing List, baruch, Sascha Hauer, Teresa Gamez

On Tue, 3 Aug 2010, Michael Grzeschik wrote:

> ported mx27_camera to 2.6.33.2

Sorry, do not understand what this description has to do with the contents 
- adding a printk to a driver? I don't think this is something critical 
enough to be handled urgently now for 2.6.36, right?

Thanks
Guennadi

> Signed-off-by: Teresa Gamez <T.Gamez@phytec.de>
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
>  drivers/media/video/mx2_camera.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
> index 7f27492..fb1b1cb 100644
> --- a/drivers/media/video/mx2_camera.c
> +++ b/drivers/media/video/mx2_camera.c
> @@ -1360,6 +1360,9 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
>  			goto exit_dma_free;
>  	}
>  
> +	dev_info(&pdev->dev, "Camera clock frequency: %ld\n",
> +			clk_get_rate(pcdev->clk_csi));
> +
>  	INIT_LIST_HEAD(&pcdev->capture);
>  	INIT_LIST_HEAD(&pcdev->active_bufs);
>  	spin_lock_init(&pcdev->lock);
> -- 
> 1.7.1
> 
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 5/5] mx2_camera: add informative camera clock frequency printout
  2010-08-05 20:30   ` Guennadi Liakhovetski
@ 2010-08-05 20:54     ` Michael Grzeschik
  2010-08-27  9:46       ` Guennadi Liakhovetski
  0 siblings, 1 reply; 26+ messages in thread
From: Michael Grzeschik @ 2010-08-05 20:54 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: Michael Grzeschik, Linux Media Mailing List, baruch,
	Sascha Hauer, Teresa Gamez

On Thu, Aug 05, 2010 at 10:30:39PM +0200, Guennadi Liakhovetski wrote:
> On Tue, 3 Aug 2010, Michael Grzeschik wrote:
> 
> > ported mx27_camera to 2.6.33.2
> 
> Sorry, do not understand what this description has to do with the contents 
The Description is of topic from a previous patchseries from Teresa
Gamez and has nothin to do with the content, right!

> - adding a printk to a driver? I don't think this is something critical 
> enough to be handled urgently now for 2.6.36, right?
Yes you are right, this one isn't urgent.

Michael

> 
> Thanks
> Guennadi
> 
> > Signed-off-by: Teresa Gamez <T.Gamez@phytec.de>
> > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> > ---
> >  drivers/media/video/mx2_camera.c |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
> > index 7f27492..fb1b1cb 100644
> > --- a/drivers/media/video/mx2_camera.c
> > +++ b/drivers/media/video/mx2_camera.c
> > @@ -1360,6 +1360,9 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
> >  			goto exit_dma_free;
> >  	}
> >  
> > +	dev_info(&pdev->dev, "Camera clock frequency: %ld\n",
> > +			clk_get_rate(pcdev->clk_csi));
> > +
> >  	INIT_LIST_HEAD(&pcdev->capture);
> >  	INIT_LIST_HEAD(&pcdev->active_bufs);
> >  	spin_lock_init(&pcdev->lock);
> > -- 
> > 1.7.1
> > 
> > 
> 
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
> http://www.open-technology.de/
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH v2] mx2_camera: remove emma limitation for RGB565
  2010-08-05 19:25       ` Guennadi Liakhovetski
@ 2010-08-09 14:22         ` Michael Grzeschik
  2010-08-09 14:57         ` [PATCH v2][RESEND] " Michael Grzeschik
  1 sibling, 0 replies; 26+ messages in thread
From: Michael Grzeschik @ 2010-08-09 14:22 UTC (permalink / raw)
  To: linux-media; +Cc: baruch, g.liakhovetski, s.hauer

X-Uptime: 16:20:11 up 37 days,  5:31, 61 users,  load average: 0.68, 0.32,
	0.30

In the current source status the emma has no limitation for any PIXFMT
since the data is parsed raw and unprocessed into the memory.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
v1 -> v2
        Changed Comment in emma_buf_init as recommended

 drivers/media/video/mx2_camera.c |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index e859c7f..ccd121f 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -712,8 +712,11 @@ static void mx27_camera_emma_buf_init(struct soc_camera_device *icd,
 	/*
 	 * We only use the EMMA engine to get rid of the broken
 	 * DMA Engine. No color space consversion at the moment.
-	 * We adjust incoming and outgoing pixelformat to rgb16
-	 * and adjust the bytesperline accordingly.
+	 * We set the incomming and outgoing pixelformat to an
+	 * 16 Bit wide format and adjust the bytesperline
+	 * accordingly. With this configuration the inputdata
+	 * will not be changed by the emma and could be any type
+	 * of 16 Bit Pixelformat.
 	 */
 	writel(PRP_CNTL_CH1EN |
 			PRP_CNTL_CSIEN |
@@ -897,10 +900,6 @@ static int mx2_camera_set_fmt(struct soc_camera_device *icd,
 		return -EINVAL;
 	}
 
-	/* eMMA can only do RGB565 */
-	if (mx27_camera_emma(pcdev) && pix->pixelformat != V4L2_PIX_FMT_RGB565)
-		return -EINVAL;
-
 	mf.width	= pix->width;
 	mf.height	= pix->height;
 	mf.field	= pix->field;
@@ -944,10 +943,6 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
 
 	/* FIXME: implement MX27 limits */
 
-	/* eMMA can only do RGB565 */
-	if (mx27_camera_emma(pcdev) && pixfmt != V4L2_PIX_FMT_RGB565)
-		return -EINVAL;
-
 	/* limit to MX25 hardware capabilities */
 	if (cpu_is_mx25()) {
 		if (xlate->host_fmt->bits_per_sample <= 8)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2][RESEND] mx2_camera: remove emma limitation for RGB565
  2010-08-05 19:25       ` Guennadi Liakhovetski
  2010-08-09 14:22         ` [PATCH v2] " Michael Grzeschik
@ 2010-08-09 14:57         ` Michael Grzeschik
  1 sibling, 0 replies; 26+ messages in thread
From: Michael Grzeschik @ 2010-08-09 14:57 UTC (permalink / raw)
  To: linux-media-owner; +Cc: baruch, g.liakhovetski, s.hauer

In the current source status the emma has no limitation for any PIXFMT
since the data is parsed raw and unprocessed into the memory.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
v1 -> v2
        Changed Comment in emma_buf_init as recommended

 drivers/media/video/mx2_camera.c |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index e859c7f..ccd121f 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -712,8 +712,11 @@ static void mx27_camera_emma_buf_init(struct soc_camera_device *icd,
 	/*
 	 * We only use the EMMA engine to get rid of the broken
 	 * DMA Engine. No color space consversion at the moment.
-	 * We adjust incoming and outgoing pixelformat to rgb16
-	 * and adjust the bytesperline accordingly.
+	 * We set the incomming and outgoing pixelformat to an
+	 * 16 Bit wide format and adjust the bytesperline
+	 * accordingly. With this configuration the inputdata
+	 * will not be changed by the emma and could be any type
+	 * of 16 Bit Pixelformat.
 	 */
 	writel(PRP_CNTL_CH1EN |
 			PRP_CNTL_CSIEN |
@@ -897,10 +900,6 @@ static int mx2_camera_set_fmt(struct soc_camera_device *icd,
 		return -EINVAL;
 	}
 
-	/* eMMA can only do RGB565 */
-	if (mx27_camera_emma(pcdev) && pix->pixelformat != V4L2_PIX_FMT_RGB565)
-		return -EINVAL;
-
 	mf.width	= pix->width;
 	mf.height	= pix->height;
 	mf.field	= pix->field;
@@ -944,10 +943,6 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
 
 	/* FIXME: implement MX27 limits */
 
-	/* eMMA can only do RGB565 */
-	if (mx27_camera_emma(pcdev) && pixfmt != V4L2_PIX_FMT_RGB565)
-		return -EINVAL;
-
 	/* limit to MX25 hardware capabilities */
 	if (cpu_is_mx25()) {
 		if (xlate->host_fmt->bits_per_sample <= 8)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/5] mx2_camera: change to register and probe
  2010-08-05 20:17   ` Guennadi Liakhovetski
@ 2010-08-10 10:25     ` Michael Grzeschik
  2010-08-10 19:08       ` Guennadi Liakhovetski
  0 siblings, 1 reply; 26+ messages in thread
From: Michael Grzeschik @ 2010-08-10 10:25 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: Michael Grzeschik, Linux Media Mailing List, baruch, Sascha Hauer

Hi Guennadi,

On Thu, Aug 05, 2010 at 10:17:11PM +0200, Guennadi Liakhovetski wrote:
> On Tue, 3 Aug 2010, Michael Grzeschik wrote:
> 
> > change this driver back to register and probe, since some platforms
> > first have to initialize an already registered power regulator to switch
> > on the camera.
> 
> I shall be preparing a pull-request for 2.6.36-rc1 #2, but since we 
> haven't finished discussing this and when this is ready, this will be a 
> fix - without this your platform doesn't work, right? So, we can push it 
> after rc1.

The issue is, that we cannot change the platform code from the
late_initcall structure. For me there is no other solution than that,
because we have to enable the regulator before the camera chip to
communicate over i2c. If we would move to the notify way we would
first listen for the i2c enabled clients but for that we would still
have to first enable the regulator. At this moment i don't see a
solution in this way.

The safest way would still be to use the patch as is.

Thanks,
Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/5] mx2_camera: change to register and probe
  2010-08-10 10:25     ` Michael Grzeschik
@ 2010-08-10 19:08       ` Guennadi Liakhovetski
  2010-08-11  7:13         ` Michael Grzeschik
  0 siblings, 1 reply; 26+ messages in thread
From: Guennadi Liakhovetski @ 2010-08-10 19:08 UTC (permalink / raw)
  To: Michael Grzeschik
  Cc: Michael Grzeschik, Linux Media Mailing List, baruch, Sascha Hauer

On Tue, 10 Aug 2010, Michael Grzeschik wrote:

> Hi Guennadi,
> 
> On Thu, Aug 05, 2010 at 10:17:11PM +0200, Guennadi Liakhovetski wrote:
> > On Tue, 3 Aug 2010, Michael Grzeschik wrote:
> > 
> > > change this driver back to register and probe, since some platforms
> > > first have to initialize an already registered power regulator to switch
> > > on the camera.
> > 
> > I shall be preparing a pull-request for 2.6.36-rc1 #2, but since we 
> > haven't finished discussing this and when this is ready, this will be a 
> > fix - without this your platform doesn't work, right? So, we can push it 
> > after rc1.
> 
> The issue is, that we cannot change the platform code from the
> late_initcall structure. For me there is no other solution than that,
> because we have to enable the regulator before the camera chip to
> communicate over i2c. If we would move to the notify way we would
> first listen for the i2c enabled clients but for that we would still
> have to first enable the regulator. At this moment i don't see a
> solution in this way.

Hm, I think, there is an easier way to do this: just use the .power() 
callback from struct soc_camera_link. It is called for the first time 
before the camera is added to the i2c bus, so, before any IO is taking 
place. Just be careful to make sure you don't call one-time init actions 
(like gpio_request()) multiple times - .power is called also later again 
upon each open / close. So, you'll need some flag to detect the very first 
power-on.

Sorry, for keeping on my attempts to avoid your patch - it really seems to 
me, a better solution is possible.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 1/5] mx2_camera: change to register and probe
  2010-08-10 19:08       ` Guennadi Liakhovetski
@ 2010-08-11  7:13         ` Michael Grzeschik
  0 siblings, 0 replies; 26+ messages in thread
From: Michael Grzeschik @ 2010-08-11  7:13 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: Michael Grzeschik, Linux Media Mailing List, baruch, Sascha Hauer

Hey Guennadi,

On Tue, Aug 10, 2010 at 09:08:11PM +0200, Guennadi Liakhovetski wrote:
> On Tue, 10 Aug 2010, Michael Grzeschik wrote:
> 
> > Hi Guennadi,
> > 
> > On Thu, Aug 05, 2010 at 10:17:11PM +0200, Guennadi Liakhovetski wrote:
> > > On Tue, 3 Aug 2010, Michael Grzeschik wrote:
> > > 
> > > > change this driver back to register and probe, since some platforms
> > > > first have to initialize an already registered power regulator to switch
> > > > on the camera.
> > > 
> > > I shall be preparing a pull-request for 2.6.36-rc1 #2, but since we 
> > > haven't finished discussing this and when this is ready, this will be a 
> > > fix - without this your platform doesn't work, right? So, we can push it 
> > > after rc1.
> > 
> > The issue is, that we cannot change the platform code from the
> > late_initcall structure. For me there is no other solution than that,
> > because we have to enable the regulator before the camera chip to
> > communicate over i2c. If we would move to the notify way we would
> > first listen for the i2c enabled clients but for that we would still
> > have to first enable the regulator. At this moment i don't see a
> > solution in this way.
> 
> Hm, I think, there is an easier way to do this: just use the .power() 
> callback from struct soc_camera_link. It is called for the first time 
> before the camera is added to the i2c bus, so, before any IO is taking 
> place. Just be careful to make sure you don't call one-time init actions 
> (like gpio_request()) multiple times - .power is called also later again 
> upon each open / close. So, you'll need some flag to detect the very first 
> power-on.

this seems for me to be the best solution so far. At this time i have a
patched version (v2) for my pcm970-baseboard.c glue code. I will send it
ASOP, so this "change back to probe and register patch" is not needed
anymore.

> Sorry, for keeping on my attempts to avoid your patch - it really seems to 
> me, a better solution is possible.
Good thoughts!

Thanks for the hints,
Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 5/5] mx2_camera: add informative camera clock frequency printout
  2010-08-05 20:54     ` Michael Grzeschik
@ 2010-08-27  9:46       ` Guennadi Liakhovetski
  0 siblings, 0 replies; 26+ messages in thread
From: Guennadi Liakhovetski @ 2010-08-27  9:46 UTC (permalink / raw)
  To: Michael Grzeschik
  Cc: Michael Grzeschik, Linux Media Mailing List, baruch,
	Sascha Hauer, Teresa Gamez

On Thu, 5 Aug 2010, Michael Grzeschik wrote:

> On Thu, Aug 05, 2010 at 10:30:39PM +0200, Guennadi Liakhovetski wrote:
> > On Tue, 3 Aug 2010, Michael Grzeschik wrote:
> > 
> > > ported mx27_camera to 2.6.33.2
> > 
> > Sorry, do not understand what this description has to do with the contents 
> The Description is of topic from a previous patchseries from Teresa
> Gamez and has nothin to do with the content, right!
> 
> > - adding a printk to a driver? I don't think this is something critical 
> > enough to be handled urgently now for 2.6.36, right?
> Yes you are right, this one isn't urgent.
> 
> Michael
> 
> > 
> > Thanks
> > Guennadi
> > 
> > > Signed-off-by: Teresa Gamez <T.Gamez@phytec.de>
> > > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> > > ---
> > >  drivers/media/video/mx2_camera.c |    3 +++
> > >  1 files changed, 3 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
> > > index 7f27492..fb1b1cb 100644
> > > --- a/drivers/media/video/mx2_camera.c
> > > +++ b/drivers/media/video/mx2_camera.c
> > > @@ -1360,6 +1360,9 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
> > >  			goto exit_dma_free;
> > >  	}
> > >  
> > > +	dev_info(&pdev->dev, "Camera clock frequency: %ld\n",
> > > +			clk_get_rate(pcdev->clk_csi));
> > > +
> > >  	INIT_LIST_HEAD(&pcdev->capture);
> > >  	INIT_LIST_HEAD(&pcdev->active_bufs);
> > >  	spin_lock_init(&pcdev->lock);

Well, in mx2_camera_remove() we have a message

	dev_info(&pdev->dev, "MX2 Camera driver unloaded\n");

and currently no counterpart in probe. I don't think this "unloaded" 
message is particularly valuable, but we've already got it. So, we can 
either remove it or add one more in probe. If you prefer the latter - 
fine, but (1) I'd put it later - just before "return 0;" where we already 
know probe will not fail, and (2) make it even more informative like

"MX2 Camera (CSI) driver probed, clock frequency %ld\n"

if you really _do_ think the user is interested to know that;) Otherwise, 
make this and the "unloaded" dev_dbg().

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH v2] mx2_camera: add informative camera clock frequency printout
  2010-08-03  9:37 ` [PATCH 5/5] mx2_camera: add informative camera clock frequency printout Michael Grzeschik
  2010-08-05 20:30   ` Guennadi Liakhovetski
@ 2010-08-27 12:39   ` Michael Grzeschik
  1 sibling, 0 replies; 26+ messages in thread
From: Michael Grzeschik @ 2010-08-27 12:39 UTC (permalink / raw)
  To: linux-media; +Cc: g.liakhovetski, baruch, Michael Grzeschik

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/media/video/mx2_camera.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index 61241af..a3e04b6 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -1415,6 +1415,9 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
 	if (err)
 		goto exit_free_emma;
 
+	dev_info(&pdev->dev, "MX2 Camera (CSI) driver probed, clock frequency: %ld\n",
+			clk_get_rate(pcdev->clk_csi));
+
 	return 0;
 
 exit_free_emma:
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2010-08-27 12:39 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-03  9:37 [PATCH 0/5] mx2_camera changes and corrections Michael Grzeschik
2010-08-03  9:37 ` [PATCH 1/5] mx2_camera: change to register and probe Michael Grzeschik
2010-08-03 18:22   ` Guennadi Liakhovetski
2010-08-03 19:57     ` Michael Grzeschik
2010-08-03 23:01       ` Guennadi Liakhovetski
2010-08-04  7:09         ` Sascha Hauer
2010-08-04  8:24           ` Guennadi Liakhovetski
2010-08-04  8:53             ` Michael Grzeschik
2010-08-04  9:48               ` Guennadi Liakhovetski
2010-08-05 20:17   ` Guennadi Liakhovetski
2010-08-10 10:25     ` Michael Grzeschik
2010-08-10 19:08       ` Guennadi Liakhovetski
2010-08-11  7:13         ` Michael Grzeschik
2010-08-03  9:37 ` [PATCH 2/5] mx2_camera: remove emma limitation for RGB565 Michael Grzeschik
2010-08-04  9:55   ` Guennadi Liakhovetski
2010-08-04 10:27     ` Michael Grzeschik
2010-08-05 19:25       ` Guennadi Liakhovetski
2010-08-09 14:22         ` [PATCH v2] " Michael Grzeschik
2010-08-09 14:57         ` [PATCH v2][RESEND] " Michael Grzeschik
2010-08-03  9:37 ` [PATCH 3/5] mx2_camera: fix for list bufnum in frame_done_emma Michael Grzeschik
2010-08-03  9:37 ` [PATCH 4/5] mx2_camera: add rising edge for pixclock Michael Grzeschik
2010-08-03  9:37 ` [PATCH 5/5] mx2_camera: add informative camera clock frequency printout Michael Grzeschik
2010-08-05 20:30   ` Guennadi Liakhovetski
2010-08-05 20:54     ` Michael Grzeschik
2010-08-27  9:46       ` Guennadi Liakhovetski
2010-08-27 12:39   ` [PATCH v2] " Michael Grzeschik

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.