public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* OMAP3 isp single-shot
@ 2011-03-23 13:28 Daniel Lundborg
  2011-03-24  8:29 ` Sakari Ailus
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Lundborg @ 2011-03-23 13:28 UTC (permalink / raw)
  To: linux-media

Hello,

I am successfully using the gumstix overo board together with a camera sensor
Aptina MT9V034 with the kernel 2.6.35 and patches from
http://git.linuxtv.org/pinchartl/media.git (isp6).

I can use the media-ctl program and yavta to take pictures in continous
streaming mode.

media-ctl -r -l '"mt9034 3-0048":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP
CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"mt9v034 3-0048":0[SGRBG10 752x480], "OMAP3 ISP CCDC":1[SGRBG10
752x480]

and then:

yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F /dev/video2


Is there a way to set the ISP in single shot mode?

I have tested setting the mt9v034 in snapshot mode and manually trigger the
camera, but the ISP does not send a picture. Is there a way to solve this with
the current OMAP3 isp code?

I have before successfully used the isp parts from the Nokia N900 project..

/Daniel


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

* Re: OMAP3 isp single-shot
  2011-03-23 13:28 OMAP3 isp single-shot Daniel Lundborg
@ 2011-03-24  8:29 ` Sakari Ailus
  2011-03-24 10:26   ` SV: " Daniel Lundborg
  0 siblings, 1 reply; 10+ messages in thread
From: Sakari Ailus @ 2011-03-24  8:29 UTC (permalink / raw)
  To: Daniel Lundborg; +Cc: linux-media, Laurent Pinchart

Daniel Lundborg wrote:
> Hello,

Hi Daniel,

(Cc'ing Laurent.)

> I am successfully using the gumstix overo board together with a camera sensor
> Aptina MT9V034 with the kernel 2.6.35 and patches from
> http://git.linuxtv.org/pinchartl/media.git (isp6).

Which branch did you use?

> I can use the media-ctl program and yavta to take pictures in continous
> streaming mode.
> 
> media-ctl -r -l '"mt9034 3-0048":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP
> CCDC":1->"OMAP3 ISP CCDC output":0[1]'
> media-ctl -f '"mt9v034 3-0048":0[SGRBG10 752x480], "OMAP3 ISP CCDC":1[SGRBG10
> 752x480]
> 
> and then:
> 
> yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F /dev/video2
> 
> 
> Is there a way to set the ISP in single shot mode?

Single shot for the ISP is the same as to queue just one buffer. I
assume the single shot mode is something that the sensor supports?

> I have tested setting the mt9v034 in snapshot mode and manually trigger the
> camera, but the ISP does not send a picture. Is there a way to solve this with
> the current OMAP3 isp code?

Do you get any errors, or you just don't get any video buffers?

As the sensor works in streaming mode, are you sure it outputs the image
of correct size in the single shot mode?

> I have before successfully used the isp parts from the Nokia N900 project..

This is nice to hear! :-)

Regards,

-- 
Sakari Ailus
sakari.ailus@maxwell.research.nokia.com

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

* SV: OMAP3 isp single-shot
  2011-03-24  8:29 ` Sakari Ailus
@ 2011-03-24 10:26   ` Daniel Lundborg
  2011-03-24 10:35     ` Laurent Pinchart
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Lundborg @ 2011-03-24 10:26 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, Laurent Pinchart

Hello Sakari,

> Daniel Lundborg wrote:
> > Hello,
> 
> Hi Daniel,
> 
> (Cc'ing Laurent.)
> 
> > I am successfully using the gumstix overo board together with a
camera sensor
> > Aptina MT9V034 with the kernel 2.6.35 and patches from
> > http://git.linuxtv.org/pinchartl/media.git (isp6).
> 
> Which branch did you use?

I am using the media-2.6.35-0006-sensors branch which could be found
just a couple of weeks ago. It has the mt9v032 sensor in it. My mt9v034
driver is based on the mt9v032 code.

> 
> > I can use the media-ctl program and yavta to take pictures in
continous
> > streaming mode.
> > 
> > media-ctl -r -l '"mt9034 3-0048":0->"OMAP3 ISP CCDC":0[1], "OMAP3
ISP
> > CCDC":1->"OMAP3 ISP CCDC output":0[1]'
> > media-ctl -f '"mt9v034 3-0048":0[SGRBG10 752x480], "OMAP3 ISP
CCDC":1[SGRBG10
> > 752x480]
> > 
> > and then:
> > 
> > yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F /dev/video2
> > 
> > 
> > Is there a way to set the ISP in single shot mode?
> 
> Single shot for the ISP is the same as to queue just one buffer. I
> assume the single shot mode is something that the sensor supports?
> 
> > I have tested setting the mt9v034 in snapshot mode and manually
trigger the
> > camera, but the ISP does not send a picture. Is there a way to solve
this with
> > the current OMAP3 isp code?
> 
> Do you get any errors, or you just don't get any video buffers?

This is the output from yavta when I put the sensor in streaming mode:

root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F
/dev/video2

Device /dev/video2 opened: OMAP3 ISP CCDC output (media).
Video format set: width: 752 height: 480 buffer size: 721920
Video format: BA10 (30314142) 752x480
1 buffers requested.
length: 721920 offset: 0
Buffer 0 mapped at address 0x4014d000.
0 (0) [-] 0 721920 bytes 65877.098848 1300958239.111966 0.001 fps
Captured 1 frames in 0.000062 seconds (16129.032258 fps,
11643870967.741936 B/s).
1 buffers released.

And the output when putting the sensor in snapshot mode:

root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F
/dev/video2

Device /dev/video2 opened: OMAP3 ISP CCDC output (media).
Video format set: width: 752 height: 480 buffer size: 721920
Video format: BA10 (30314142) 752x480
1 buffers requested.
length: 721920 offset: 0
Buffer 0 mapped at address 0x4014d000.

And it freezes. I can stop yavta with CTRL+C.

To put the sensor in snapshot/shutter mode I set the ext_trig = 1 in the
platform_data structure in my board file.

struct mt9v034_platform_data {
	unsigned int clk_pol:1;
	unsigned int ext_trig:1;

	void (*set_clock)(struct v4l2_subdev *subdev, unsigned int
rate);
};

And in the s_stream I set the chip_control register for the MT9V034
sensor to:

static int mt9v034_s_stream(struct v4l2_subdev *subdev, int enable)
{
  struct mt9v034 *mt9v034 = to_mt9v034(subdev);
  const u16 chip_clear = mt9v034->pdata->ext_trig? 0x0100 : 0;
  const u16 chip_set = mt9v034->pdata->ext_trig? 0x18 :
MT9V034_CHIP_CONTROL_MASTER_MODE | MT9V034_CHIP_CONTROL_DOUT_ENABLE |
MT9V034_CHIP_CONTROL_SEQUENTIAL;
  struct i2c_client *client = v4l2_get_subdevdata(subdev);
  struct v4l2_mbus_framefmt *format = &mt9v034->format;
  struct v4l2_rect *crop = &mt9v034->crop;
  unsigned int hratio;
  unsigned int vratio;
  int ret;

  if (!enable) {
    ret = mt9v034_set_chip_control(mt9v034, chip_clear, chip_set);
    if (ret < 0)
      return ret;

    return __mt9v034_set_power(mt9v034, 0);
  }

  ret = __mt9v034_set_power(mt9v034, 1);
  if (ret < 0)
    return ret;

  /* Configure the window size and row/column bin */
  hratio = DIV_ROUND_CLOSEST(crop->width, format->width);
  vratio = DIV_ROUND_CLOSEST(crop->height, format->height);

  ret = mt9v034_write(client, MT9V034_READ_MODE,
        (hratio - 1) << MT9V034_READ_MODE_ROW_BIN_SHIFT |
        (vratio - 1) << MT9V034_READ_MODE_COLUMN_BIN_SHIFT);
  if (ret < 0)
    return ret;

  ret = mt9v034_write(client, MT9V034_COLUMN_START, crop->left);
  if (ret < 0)
    return ret;

  ret = mt9v034_write(client, MT9V034_ROW_START, crop->top);
  if (ret < 0)
    return ret;

  ret = mt9v034_write(client, MT9V034_WINDOW_WIDTH, crop->width);
  if (ret < 0)
    return ret;

  ret = mt9v034_write(client, MT9V034_WINDOW_HEIGHT, crop->height);
  if (ret < 0)
    return ret;

  /* Disable the noise correction algorithm and restore the controls. */
  ret  = mt9v034_write(client, MT9V034_ROW_NOISE_CORR_CONTROL, 0);
  if (ret < 0)
    return ret;

  v4l2_ctrl_handler_setup(&mt9v034->ctrls);
  
  ret = mt9v034_set_chip_control(mt9v034, chip_clear, chip_set);
  
  return ret;
}

I can see on the oscilloscope that the sensor is sending something when
I trigger it, but no picture is received..

> As the sensor works in streaming mode, are you sure it outputs the
image
> of correct size in the single shot mode?

The sensor has the same output in streaming and single shot mode.

> 
> > I have before successfully used the isp parts from the Nokia N900
project..
> 
> This is nice to hear! :-)
> 
> Regards,
> 
> -- 
> Sakari Ailus
> sakari.ailus@maxwell.research.nokia.com


Thanks,

Daniel Lundborg
daniel.lundborg@prevas.se


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

* Re: SV: OMAP3 isp single-shot
  2011-03-24 10:26   ` SV: " Daniel Lundborg
@ 2011-03-24 10:35     ` Laurent Pinchart
  2011-03-24 10:54       ` SV: " Daniel Lundborg
  2011-03-25 13:10       ` Daniel Lundborg
  0 siblings, 2 replies; 10+ messages in thread
From: Laurent Pinchart @ 2011-03-24 10:35 UTC (permalink / raw)
  To: Daniel Lundborg; +Cc: Sakari Ailus, linux-media

Hi Daniel,

On Thursday 24 March 2011 11:26:01 Daniel Lundborg wrote:
> > Daniel Lundborg wrote:
> > >
> > > I am successfully using the gumstix overo board together with a camera
> > > sensor Aptina MT9V034 with the kernel 2.6.35 and patches from
> > > http://git.linuxtv.org/pinchartl/media.git (isp6).
> > 
> > Which branch did you use?
> 
> I am using the media-2.6.35-0006-sensors branch which could be found
> just a couple of weeks ago. It has the mt9v032 sensor in it. My mt9v034
> driver is based on the mt9v032 code.

Now that the OMAP3 ISP driver is on its way to mainline, I've reorganized the 
repository. You can use the media-2.6.38-0002-sensors branch for 2.6.38.

> > > I can use the media-ctl program and yavta to take pictures in continous
> > > streaming mode.
> > > 
> > > media-ctl -r -l '"mt9034 3-0048":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP
> > > CCDC":1->"OMAP3 ISP CCDC output":0[1]'
> > > media-ctl -f '"mt9v034 3-0048":0[SGRBG10 752x480], "OMAP3 ISP
> > > CCDC":1[SGRBG10 752x480]
> > > 
> > > and then:
> > > 
> > > yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F /dev/video2
> > > 
> > > Is there a way to set the ISP in single shot mode?
> > 
> > Single shot for the ISP is the same as to queue just one buffer. I assume
> > the single shot mode is something that the sensor supports?
> > 
> > > I have tested setting the mt9v034 in snapshot mode and manually trigger
> > > the camera, but the ISP does not send a picture. Is there a way to solve
> > > this with the current OMAP3 isp code?
> > 
> > Do you get any errors, or you just don't get any video buffers?
> 
> This is the output from yavta when I put the sensor in streaming mode:
> 
> root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F
> /dev/video2
> 
> Device /dev/video2 opened: OMAP3 ISP CCDC output (media).
> Video format set: width: 752 height: 480 buffer size: 721920
> Video format: BA10 (30314142) 752x480
> 1 buffers requested.
> length: 721920 offset: 0
> Buffer 0 mapped at address 0x4014d000.
> 0 (0) [-] 0 721920 bytes 65877.098848 1300958239.111966 0.001 fps
> Captured 1 frames in 0.000062 seconds (16129.032258 fps,
> 11643870967.741936 B/s).
> 1 buffers released.
> 
> And the output when putting the sensor in snapshot mode:
> 
> root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F
> /dev/video2
> 
> Device /dev/video2 opened: OMAP3 ISP CCDC output (media).
> Video format set: width: 752 height: 480 buffer size: 721920
> Video format: BA10 (30314142) 752x480
> 1 buffers requested.
> length: 721920 offset: 0
> Buffer 0 mapped at address 0x4014d000.
> 
> And it freezes. I can stop yavta with CTRL+C.

Have you tried to trigger the sensor multiple times in a row ?

> To put the sensor in snapshot/shutter mode I set the ext_trig = 1 in the
> platform_data structure in my board file.
> 
> struct mt9v034_platform_data {
> 	unsigned int clk_pol:1;
> 	unsigned int ext_trig:1;
> 
> 	void (*set_clock)(struct v4l2_subdev *subdev, unsigned int rate);
> };
> 
> And in the s_stream I set the chip_control register for the MT9V034
> sensor to:
> 
> static int mt9v034_s_stream(struct v4l2_subdev *subdev, int enable)
> {
>   struct mt9v034 *mt9v034 = to_mt9v034(subdev);
>   const u16 chip_clear = mt9v034->pdata->ext_trig? 0x0100 : 0;
>   const u16 chip_set = mt9v034->pdata->ext_trig? 0x18 :
> MT9V034_CHIP_CONTROL_MASTER_MODE | MT9V034_CHIP_CONTROL_DOUT_ENABLE |
> MT9V034_CHIP_CONTROL_SEQUENTIAL;
>   struct i2c_client *client = v4l2_get_subdevdata(subdev);
>   struct v4l2_mbus_framefmt *format = &mt9v034->format;
>   struct v4l2_rect *crop = &mt9v034->crop;
>   unsigned int hratio;
>   unsigned int vratio;
>   int ret;
> 
>   if (!enable) {
>     ret = mt9v034_set_chip_control(mt9v034, chip_clear, chip_set);
>     if (ret < 0)
>       return ret;
> 
>     return __mt9v034_set_power(mt9v034, 0);
>   }
> 
>   ret = __mt9v034_set_power(mt9v034, 1);
>   if (ret < 0)
>     return ret;
> 
>   /* Configure the window size and row/column bin */
>   hratio = DIV_ROUND_CLOSEST(crop->width, format->width);
>   vratio = DIV_ROUND_CLOSEST(crop->height, format->height);
> 
>   ret = mt9v034_write(client, MT9V034_READ_MODE,
>         (hratio - 1) << MT9V034_READ_MODE_ROW_BIN_SHIFT |
>         (vratio - 1) << MT9V034_READ_MODE_COLUMN_BIN_SHIFT);
>   if (ret < 0)
>     return ret;
> 
>   ret = mt9v034_write(client, MT9V034_COLUMN_START, crop->left);
>   if (ret < 0)
>     return ret;
> 
>   ret = mt9v034_write(client, MT9V034_ROW_START, crop->top);
>   if (ret < 0)
>     return ret;
> 
>   ret = mt9v034_write(client, MT9V034_WINDOW_WIDTH, crop->width);
>   if (ret < 0)
>     return ret;
> 
>   ret = mt9v034_write(client, MT9V034_WINDOW_HEIGHT, crop->height);
>   if (ret < 0)
>     return ret;
> 
>   /* Disable the noise correction algorithm and restore the controls. */
>   ret  = mt9v034_write(client, MT9V034_ROW_NOISE_CORR_CONTROL, 0);
>   if (ret < 0)
>     return ret;
> 
>   v4l2_ctrl_handler_setup(&mt9v034->ctrls);
> 
>   ret = mt9v034_set_chip_control(mt9v034, chip_clear, chip_set);
> 
>   return ret;
> }
> 
> I can see on the oscilloscope that the sensor is sending something when
> I trigger it, but no picture is received..

"something" is a bit vague, can you check the hsync/vsync signals and make 
sure they're identical in both modes ?

> > As the sensor works in streaming mode, are you sure it outputs the image
> > of correct size in the single shot mode?
> 
> The sensor has the same output in streaming and single shot mode.

-- 
Regards,

Laurent Pinchart

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

* SV: SV: OMAP3 isp single-shot
  2011-03-24 10:35     ` Laurent Pinchart
@ 2011-03-24 10:54       ` Daniel Lundborg
  2011-03-24 12:37         ` Sakari Ailus
  2011-03-25 13:10       ` Daniel Lundborg
  1 sibling, 1 reply; 10+ messages in thread
From: Daniel Lundborg @ 2011-03-24 10:54 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Sakari Ailus, linux-media

Hi Laurent,

> Hi Daniel,
> 
> On Thursday 24 March 2011 11:26:01 Daniel Lundborg wrote:
> > > Daniel Lundborg wrote:
> > > >
> > > > I am successfully using the gumstix overo board together with a 
> > > > camera sensor Aptina MT9V034 with the kernel 2.6.35 and patches 
> > > > from http://git.linuxtv.org/pinchartl/media.git (isp6).
> > > 
> > > Which branch did you use?
> > 
> > I am using the media-2.6.35-0006-sensors branch which could be found

> > just a couple of weeks ago. It has the mt9v032 sensor in it. My 
> > mt9v034 driver is based on the mt9v032 code.
> 
> Now that the OMAP3 ISP driver is on its way to mainline, I've
reorganized the repository. You can use the media-2.6.38-0002-sensors
branch for 2.6.38.

Ok. I will test that one.

> ---
> > 
> > This is the output from yavta when I put the sensor in streaming
mode:
> > 
> > root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1
-F
> > /dev/video2
> > 
> > Device /dev/video2 opened: OMAP3 ISP CCDC output (media).
> > Video format set: width: 752 height: 480 buffer size: 721920 Video 
> > format: BA10 (30314142) 752x480
> > 1 buffers requested.
> > length: 721920 offset: 0
> > Buffer 0 mapped at address 0x4014d000.
> > 0 (0) [-] 0 721920 bytes 65877.098848 1300958239.111966 0.001 fps 
> > Captured 1 frames in 0.000062 seconds (16129.032258 fps,
> > 11643870967.741936 B/s).
> > 1 buffers released.
> > 
> > And the output when putting the sensor in snapshot mode:
> > 
> > root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1
-F
> > /dev/video2
> > 
> > Device /dev/video2 opened: OMAP3 ISP CCDC output (media).
> > Video format set: width: 752 height: 480 buffer size: 721920 Video 
> > format: BA10 (30314142) 752x480
> > 1 buffers requested.
> > length: 721920 offset: 0
> > Buffer 0 mapped at address 0x4014d000.
> > 
> > And it freezes. I can stop yavta with CTRL+C.
> 
> Have you tried to trigger the sensor multiple times in a row ?

No. I will test that.

> 
> > 
> > I can see on the oscilloscope that the sensor is sending something 
> > when I trigger it, but no picture is received..
> 
> "something" is a bit vague, can you check the hsync/vsync signals and
make sure they're identical in both modes ?

Ok. Yes this needs more oscilloscope testing. 

> 
> > > As the sensor works in streaming mode, are you sure it outputs the

> > > image of correct size in the single shot mode?
> > 
> > The sensor has the same output in streaming and single shot mode.
> 
> --
> Regards,
> 
> Laurent Pinchart

Thanks,

Daniel Lundborg
daniel.lundborg@prevas.se

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

* Re: SV: SV: OMAP3 isp single-shot
  2011-03-24 10:54       ` SV: " Daniel Lundborg
@ 2011-03-24 12:37         ` Sakari Ailus
  0 siblings, 0 replies; 10+ messages in thread
From: Sakari Ailus @ 2011-03-24 12:37 UTC (permalink / raw)
  To: Daniel Lundborg; +Cc: Laurent Pinchart, linux-media

Daniel Lundborg wrote:
> Hi Laurent,

Hi all,

>>> Device /dev/video2 opened: OMAP3 ISP CCDC output (media).
>>> Video format set: width: 752 height: 480 buffer size: 721920 Video 
>>> format: BA10 (30314142) 752x480
>>> 1 buffers requested.
>>> length: 721920 offset: 0
>>> Buffer 0 mapped at address 0x4014d000.
>>>
>>> And it freezes. I can stop yavta with CTRL+C.
>>
>> Have you tried to trigger the sensor multiple times in a row ?
> 
> No. I will test that.

Besides the two things what were proposed, it'd be good to check which
interrupts does the ISP produce.

-- 
Sakari Ailus
sakari.ailus@maxwell.research.nokia.com

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

* Re: OMAP3 isp single-shot
  2011-03-24 10:35     ` Laurent Pinchart
  2011-03-24 10:54       ` SV: " Daniel Lundborg
@ 2011-03-25 13:10       ` Daniel Lundborg
  2011-03-29 15:09         ` Laurent Pinchart
  2011-05-25 15:47         ` omap3isp - H3A auto white balance Daniel Lundborg
  1 sibling, 2 replies; 10+ messages in thread
From: Daniel Lundborg @ 2011-03-25 13:10 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Sakari Ailus, linux-media

Hi Laurent,

> Hi Daniel,
> 
> On Thursday 24 March 2011 11:26:01 Daniel Lundborg wrote:
> > > Daniel Lundborg wrote:
> > > >
> > > > I am successfully using the gumstix overo board together with a
camera
> > > > sensor Aptina MT9V034 with the kernel 2.6.35 and patches from
> > > > http://git.linuxtv.org/pinchartl/media.git (isp6).
> > > 
> > > Which branch did you use?
> > 
> > I am using the media-2.6.35-0006-sensors branch which could be found
> > just a couple of weeks ago. It has the mt9v032 sensor in it. My
mt9v034
> > driver is based on the mt9v032 code.
> 
> Now that the OMAP3 ISP driver is on its way to mainline, I've
reorganized the 
> repository. You can use the media-2.6.38-0002-sensors branch for
2.6.38.
> 
> > > > I can use the media-ctl program and yavta to take pictures in
continous
> > > > streaming mode.
> > > > 
> > > > media-ctl -r -l '"mt9034 3-0048":0->"OMAP3 ISP CCDC":0[1],
"OMAP3 ISP
> > > > CCDC":1->"OMAP3 ISP CCDC output":0[1]'
> > > > media-ctl -f '"mt9v034 3-0048":0[SGRBG10 752x480], "OMAP3 ISP
> > > > CCDC":1[SGRBG10 752x480]
> > > > 
> > > > and then:
> > > > 
> > > > yavta -f SGRBG10 -s 752x480 -n 1 --capture=1 -F /dev/video2
> > > > 
> > > > Is there a way to set the ISP in single shot mode?
> > > 
> > > Single shot for the ISP is the same as to queue just one buffer. I
assume
> > > the single shot mode is something that the sensor supports?
> > > 
> > > > I have tested setting the mt9v034 in snapshot mode and manually
trigger
> > > > the camera, but the ISP does not send a picture. Is there a way
to solve
> > > > this with the current OMAP3 isp code?
> > > 
> > > Do you get any errors, or you just don't get any video buffers?
> > 
> > This is the output from yavta when I put the sensor in streaming
mode:
> > 
> > root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1
-F
> > /dev/video2
> > 
> > Device /dev/video2 opened: OMAP3 ISP CCDC output (media).
> > Video format set: width: 752 height: 480 buffer size: 721920
> > Video format: BA10 (30314142) 752x480
> > 1 buffers requested.
> > length: 721920 offset: 0
> > Buffer 0 mapped at address 0x4014d000.
> > 0 (0) [-] 0 721920 bytes 65877.098848 1300958239.111966 0.001 fps
> > Captured 1 frames in 0.000062 seconds (16129.032258 fps,
> > 11643870967.741936 B/s).
> > 1 buffers released.
> > 
> > And the output when putting the sensor in snapshot mode:
> > 
> > root@overo:~/yavta# ./yavta -f SGRBG10 -s 752x480 -n 1 --capture=1
-F
> > /dev/video2
> > 
> > Device /dev/video2 opened: OMAP3 ISP CCDC output (media).
> > Video format set: width: 752 height: 480 buffer size: 721920
> > Video format: BA10 (30314142) 752x480
> > 1 buffers requested.
> > length: 721920 offset: 0
> > Buffer 0 mapped at address 0x4014d000.
> > 
> > And it freezes. I can stop yavta with CTRL+C.
> 
> Have you tried to trigger the sensor multiple times in a row ?
> 
> > To put the sensor in snapshot/shutter mode I set the ext_trig = 1 in
the
> > platform_data structure in my board file.
> > 
> > struct mt9v034_platform_data {
> > 	unsigned int clk_pol:1;
> > 	unsigned int ext_trig:1;
> > 
> > 	void (*set_clock)(struct v4l2_subdev *subdev, unsigned int
rate);
> > };
> > 
> > And in the s_stream I set the chip_control register for the MT9V034
> > sensor to:
> > 
> > static int mt9v034_s_stream(struct v4l2_subdev *subdev, int enable)
> > {
> >   struct mt9v034 *mt9v034 = to_mt9v034(subdev);
> >   const u16 chip_clear = mt9v034->pdata->ext_trig? 0x0100 : 0;
> >   const u16 chip_set = mt9v034->pdata->ext_trig? 0x18 :
> > MT9V034_CHIP_CONTROL_MASTER_MODE | MT9V034_CHIP_CONTROL_DOUT_ENABLE
|
> > MT9V034_CHIP_CONTROL_SEQUENTIAL;
> >   struct i2c_client *client = v4l2_get_subdevdata(subdev);
> >   struct v4l2_mbus_framefmt *format = &mt9v034->format;
> >   struct v4l2_rect *crop = &mt9v034->crop;
> >   unsigned int hratio;
> >   unsigned int vratio;
> >   int ret;
> > 
> >   if (!enable) {
> >     ret = mt9v034_set_chip_control(mt9v034, chip_clear, chip_set);
> >     if (ret < 0)
> >       return ret;
> > 
> >     return __mt9v034_set_power(mt9v034, 0);
> >   }
> > 
> >   ret = __mt9v034_set_power(mt9v034, 1);
> >   if (ret < 0)
> >     return ret;
> > 
> >   /* Configure the window size and row/column bin */
> >   hratio = DIV_ROUND_CLOSEST(crop->width, format->width);
> >   vratio = DIV_ROUND_CLOSEST(crop->height, format->height);
> > 
> >   ret = mt9v034_write(client, MT9V034_READ_MODE,
> >         (hratio - 1) << MT9V034_READ_MODE_ROW_BIN_SHIFT |
> >         (vratio - 1) << MT9V034_READ_MODE_COLUMN_BIN_SHIFT);
> >   if (ret < 0)
> >     return ret;
> > 
> >   ret = mt9v034_write(client, MT9V034_COLUMN_START, crop->left);
> >   if (ret < 0)
> >     return ret;
> > 
> >   ret = mt9v034_write(client, MT9V034_ROW_START, crop->top);
> >   if (ret < 0)
> >     return ret;
> > 
> >   ret = mt9v034_write(client, MT9V034_WINDOW_WIDTH, crop->width);
> >   if (ret < 0)
> >     return ret;
> > 
> >   ret = mt9v034_write(client, MT9V034_WINDOW_HEIGHT, crop->height);
> >   if (ret < 0)
> >     return ret;
> > 
> >   /* Disable the noise correction algorithm and restore the
controls. */
> >   ret  = mt9v034_write(client, MT9V034_ROW_NOISE_CORR_CONTROL, 0);
> >   if (ret < 0)
> >     return ret;
> > 
> >   v4l2_ctrl_handler_setup(&mt9v034->ctrls);
> > 
> >   ret = mt9v034_set_chip_control(mt9v034, chip_clear, chip_set);
> > 
> >   return ret;
> > }
> > 
> > I can see on the oscilloscope that the sensor is sending something
when
> > I trigger it, but no picture is received..
> 
> "something" is a bit vague, can you check the hsync/vsync signals and
make 
> sure they're identical in both modes ?

I have now tested this and I can say that I am having problems
triggering the sensor. I wrongly thought I was triggering the sensor
with my other driver correctly, but that was not the case.

What I want is to put the Omap ISP to generate a signal (CAM_WEN) to
make the camera sensor take a picture.

In my working mt9v034 driver which is using kernel 2.6.31-rc7 with the
patches from <http://gitorious.org/omap3camera/mainline/commits/slave> I
set the ISP to this on power on:

  isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,
0x9a1b63ff, 0x98036000);  // Set CAM_GLOBAL_RESET pin as output, enable
shutter, set DIVC = 216
  isp_reg_and(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
ISP_TCTRL_SHUT_DELAY, 0xfe000000);  // Set no shutter delay
  isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
ISP_TCTRL_SHUT_LENGTH, 0xfe000000, 0x000003e8);  // Set shutter signal
length to 1000 (=> 1000 * 1/216MHz * 216 = 1 ms)
  isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
ISP_TCTRL_GRESET_LENGTH, 0xfe000000, 0x000003e8);  // Set shutter signal
length to 1000 (=> 1000 * 1/216MHz * 216 = 1 ms)
  isp_reg_and(isp_ccdc_dev, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_LSC_CONFIG,
~ISPCCDC_LSC_ENABLE);  // Make sure you disable LSC

And when I want to take a picture I do:

  isp_reg_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,
0x00e00000);  // Enable shutter (SHUTEN bit = 1)
  isp_reg_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,
0x20000000);  // Start generation of CAM_GLOBAL_RESET signal (GRESETEN
bit = 1)
  
When I try to do this in the newer driver I manage to generate a pulse
on the CAM_WEN pin, but no VSYNC, HSYNC or data is transmitted.

Am I missing something?

> 
> > > As the sensor works in streaming mode, are you sure it outputs the
image
> > > of correct size in the single shot mode?
> > 
> > The sensor has the same output in streaming and single shot mode.
> 
> -- 

Regards,

Daniel Lundborg

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

* Re: OMAP3 isp single-shot
  2011-03-25 13:10       ` Daniel Lundborg
@ 2011-03-29 15:09         ` Laurent Pinchart
  2011-04-12  7:16           ` Daniel Lundborg
  2011-05-25 15:47         ` omap3isp - H3A auto white balance Daniel Lundborg
  1 sibling, 1 reply; 10+ messages in thread
From: Laurent Pinchart @ 2011-03-29 15:09 UTC (permalink / raw)
  To: Daniel Lundborg; +Cc: Sakari Ailus, linux-media

Hi Daniel,

On Friday 25 March 2011 14:10:28 Daniel Lundborg wrote:
> > On Thursday 24 March 2011 11:26:01 Daniel Lundborg wrote:

[snip]

> > > I can see on the oscilloscope that the sensor is sending something when
> > > I trigger it, but no picture is received..
> > 
> > "something" is a bit vague, can you check the hsync/vsync signals and make
> > sure they're identical in both modes ?
> 
> I have now tested this and I can say that I am having problems triggering
> the sensor. I wrongly thought I was triggering the sensor with my other
> driver correctly, but that was not the case.
> 
> What I want is to put the Omap ISP to generate a signal (CAM_WEN) to
> make the camera sensor take a picture.

That's not possible. The cam_wen signal is an input to the ISP. The ISP Timing 
Control module can generate pulses on the cam_shutter, cam_strobe and 
cam_global_reset signals only.

What you could do is configure the cam_wen pin as a GPIO and control it using 
the GPIO framework (either in kernelspace or userspace).

> In my working mt9v034 driver which is using kernel 2.6.31-rc7 with the
> patches from <http://gitorious.org/omap3camera/mainline/commits/slave> I
> set the ISP to this on power on:
> 
>   isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,
> 0x9a1b63ff, 0x98036000);  // Set CAM_GLOBAL_RESET pin as output, enable
> shutter, set DIVC = 216

What ISP driver version are you using ? isp_reg_and_or has been replaced by 
isp_reg_clr_set a very long time ago. You should really upgrade.

>   isp_reg_and(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
> ISP_TCTRL_SHUT_DELAY, 0xfe000000);  // Set no shutter delay
>   isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
> ISP_TCTRL_SHUT_LENGTH, 0xfe000000, 0x000003e8);  // Set shutter signal
> length to 1000 (=> 1000 * 1/216MHz * 216 = 1 ms)
>   isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
> ISP_TCTRL_GRESET_LENGTH, 0xfe000000, 0x000003e8);  // Set shutter signal
> length to 1000 (=> 1000 * 1/216MHz * 216 = 1 ms)
>   isp_reg_and(isp_ccdc_dev, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_LSC_CONFIG,
> ~ISPCCDC_LSC_ENABLE);  // Make sure you disable LSC
> 
> And when I want to take a picture I do:
> 
>   isp_reg_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,
> 0x00e00000);  // Enable shutter (SHUTEN bit = 1)
>   isp_reg_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,
> 0x20000000);  // Start generation of CAM_GLOBAL_RESET signal (GRESETEN
> bit = 1)
> 
> When I try to do this in the newer driver I manage to generate a pulse
> on the CAM_WEN pin, but no VSYNC, HSYNC or data is transmitted.

I fail to see how that code can generate a pulse on the cam_wen signal. It 
should only control the cam_shutter, cam_strobe and cam_global_shutter pins.

> Am I missing something?

Is your sensor correctly configured ? Is there a publicly available datasheet 
for the MT9V034 ?

-- 
Regards,

Laurent Pinchart

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

* Re: OMAP3 isp single-shot
  2011-03-29 15:09         ` Laurent Pinchart
@ 2011-04-12  7:16           ` Daniel Lundborg
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Lundborg @ 2011-04-12  7:16 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Sakari Ailus, linux-media

Hi Laurent,

> On Friday 25 March 2011 14:10:28 Daniel Lundborg wrote:
> > > On Thursday 24 March 2011 11:26:01 Daniel Lundborg wrote:
> 
> [snip]
> 
> > > > I can see on the oscilloscope that the sensor is sending
something 
> > > > when I trigger it, but no picture is received..
> > > 
> > > "something" is a bit vague, can you check the hsync/vsync signals 
> > > and make sure they're identical in both modes ?
> > 
> > I have now tested this and I can say that I am having problems 
> > triggering the sensor. I wrongly thought I was triggering the sensor

> > with my other driver correctly, but that was not the case.
> > 
> > What I want is to put the Omap ISP to generate a signal (CAM_WEN) to

> > make the camera sensor take a picture.
> 
> That's not possible. The cam_wen signal is an input to the ISP. The
ISP Timing Control module can generate pulses on the cam_shutter,
cam_strobe and cam_global_reset signals only.

I meant the CAM_WEN pin that should be set as CAM_SHUTTER.. :)

> 
> What you could do is configure the cam_wen pin as a GPIO and control
it using the GPIO framework (either in kernelspace or userspace).
> 
> > In my working mt9v034 driver which is using kernel 2.6.31-rc7 with
the 
> > patches from
<http://gitorious.org/omap3camera/mainline/commits/slave> 
> > I set the ISP to this on power on:
> > 
> >   isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN,
ISP_TCTRL_CTRL, 
> > 0x9a1b63ff, 0x98036000);  // Set CAM_GLOBAL_RESET pin as output, 
> > enable shutter, set DIVC = 216
> 
> What ISP driver version are you using ? isp_reg_and_or has been
replaced by isp_reg_clr_set a very long time ago. You should really
upgrade.

That's what I was trying to do :)

> 
> >   isp_reg_and(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, 
> > ISP_TCTRL_SHUT_DELAY, 0xfe000000);  // Set no shutter delay
> >   isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, 
> > ISP_TCTRL_SHUT_LENGTH, 0xfe000000, 0x000003e8);  // Set shutter
signal 
> > length to 1000 (=> 1000 * 1/216MHz * 216 = 1 ms)
> >   isp_reg_and_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, 
> > ISP_TCTRL_GRESET_LENGTH, 0xfe000000, 0x000003e8);  // Set shutter 
> > signal length to 1000 (=> 1000 * 1/216MHz * 216 = 1 ms)
> >   isp_reg_and(isp_ccdc_dev, OMAP3_ISP_IOMEM_CCDC,
ISPCCDC_LSC_CONFIG, 
> > ~ISPCCDC_LSC_ENABLE);  // Make sure you disable LSC
> > 
> > And when I want to take a picture I do:
> > 
> >   isp_reg_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL, 
> > 0x00e00000);  // Enable shutter (SHUTEN bit = 1)
> >   isp_reg_or(vdev->cam->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL, 
> > 0x20000000);  // Start generation of CAM_GLOBAL_RESET signal
(GRESETEN 
> > bit = 1)
> > 
> > When I try to do this in the newer driver I manage to generate a
pulse 
> > on the CAM_WEN pin, but no VSYNC, HSYNC or data is transmitted.
> 
> I fail to see how that code can generate a pulse on the cam_wen
signal. It should only control the cam_shutter, cam_strobe and
cam_global_shutter pins.
> 
> > Am I missing something?
> 
> Is your sensor correctly configured ? Is there a publicly available
datasheet for the MT9V034 ?

I found where I was misconfiguring the sensor. I missed setting a bit in
the CHIP_CONTROL register. So now my driver is running. :)

This is how I set the sensor in shutter mode now:

  // Set chip to shutter mode  
  temp = mt9v034_read(client, MT9V034_CHIP_CONTROL);
  temp = 0x0198 | (temp & 0xfeff);
  ret = mt9v034_write(client, MT9V034_CHIP_CONTROL, temp);


Thank you,

/Daniel

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

* omap3isp - H3A auto white balance
  2011-03-25 13:10       ` Daniel Lundborg
  2011-03-29 15:09         ` Laurent Pinchart
@ 2011-05-25 15:47         ` Daniel Lundborg
  1 sibling, 0 replies; 10+ messages in thread
From: Daniel Lundborg @ 2011-05-25 15:47 UTC (permalink / raw)
  To: linux-media

Hello,

I am developing a camera sensor driver for the Aptina MT9V034. I am only
using it in snapshot mode and I can successfully trigger the sensor and
receive pictures using the latest omap3isp driver from
git://linuxtv.org/pinchartl/media.git branch omap3isp-next-sensors with
kernel 2.6.38.

I configure the sensor with media-ctl:

media-ctl -r -l '"mt9v034 3-0048":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP
CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -f '"mt9v034 3-0048":0[SGRBG10 752x480], "OMAP3 ISP
CCDC":1[SGRBG10 752x480]'

And take pictures with yavta:

./yavta -f SGRBG10 -s 752x480 -n 6 --capture=6 -F /dev/video2

My trouble is that I am always receiving whiter pictures when I wait a
moment before triggering the sensor to take a picture. If I take several
pictures in a row with for instance 20 ms between them, they all look
ok. But if I wait for 100 ms the picture will get much whiter.

I have turned off auto exposure and auto gain in the sensor and the
LED_OUT signal always have the same length (in this case 8 msec).

Why would the pictures become whiter if I wait a moment before taking a
picture?

If I set the sensor in streaming mode all pictures look like they
should.

Could there be something with the H3A auto white balance or auto
exposure?


Regards,

Daniel Lundborg

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

end of thread, other threads:[~2011-05-25 15:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-23 13:28 OMAP3 isp single-shot Daniel Lundborg
2011-03-24  8:29 ` Sakari Ailus
2011-03-24 10:26   ` SV: " Daniel Lundborg
2011-03-24 10:35     ` Laurent Pinchart
2011-03-24 10:54       ` SV: " Daniel Lundborg
2011-03-24 12:37         ` Sakari Ailus
2011-03-25 13:10       ` Daniel Lundborg
2011-03-29 15:09         ` Laurent Pinchart
2011-04-12  7:16           ` Daniel Lundborg
2011-05-25 15:47         ` omap3isp - H3A auto white balance Daniel Lundborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox