Re: problems on soc-camera subsystem

2011-05-04 Thread 乐敏
 Dear Guennadi:

  Thanks for you help,now I think I can send  emails to
linux-media@vger.kernel.org .there is still  one thing  I can not
understand.The
question is in the end of this email.

   (3) There is a host only, so I think if there are two camera
   sensors,when one sensor is working,another sensor will be poweroff and
   can not be actived.The method to switch between them I think is to close
   the sensor which is not in use.
  
   Can you tell me whether the CEU can connect multiple sensors or not,If
   yes,are there some restrictions?

 It should work, yes. Currently soc-camera handles client devices (e.g.,
 sensors) in the following way: first during probing it attaches each such
 client device to the host, performs probing _and_ detaches it immediately.
 Then at open() the same happens - only the respective sensor is attached
 to the host, so, the CEU driver only has to deal with one sensor at a
 time. Just make sure to not try to open both nodes at the same time.

   If it supports multiple sensors ,what should I do?

 Just that - write two independent sensor drivers and two platform data
 blocks for them in your board file. Then open and operate each sensor
 independently. You also might want to provide platform struct
 soc_camera_link::power() and / or reset() callbacks.


You say soc_camera will attach each sensor in the probing,but I think
each time there is
only one sensor can register to soc_camera subsystem.look at the following
code:

struct i2c_board_info ov9640_info1=
{

};

struct soc_camera_link ov9640_link1=
{
   .board_info=ov9640_info1,
   ..
};

struct platform_device ov9640_device1=
{
   .name = soc-camera-pdrv,
   .dev=
{
  .platform_data = ov9640_link1,
}
};

struct i2c_board_info ov9640_info2=
{

};

struct soc_camera_link ov9640_link2=
{
   .board_info=ov9640_info2,
   ..
};

struct platform_device ov9640_device2=
{
   .name = soc-camera-pdrv,//the name is same to the ov_9640_device1.
   .dev=
{
  .platform_data = ov9640_link2,
}
};

There are two sensors,now I want they all exist in /dev after
linux system is
boot.can I do this? if yes I want to use platform_device_register()
twice.but this action is forbindden,because they have the same
platform name,so only one sensor can registered successfully.

On the other hand if I use soc_camera subsystem to register a
video device to let
system create a node in /dev,like /dev/video0 or /dev/video1.I must
call soc_camera_device_register() to register a soc_camera_device to
soc_camera,
then if there is a camera host is registered to soc_camera,the host
will call scan_add_host() to  probe and attach each sensor,if host can
handle the sensor,
device_register() will be called,finally the probe function of
soc_camera bus--soc_camera_probe() will be called,in this function
a video device will be register to  the system,and a device node will
be create in /dev if all information of the  sensor is ok.

 So if you want to register a video device and create a device
node in /dev using soc_camera,soc_camera_device_register() must be
called.But now the only way to call  soc_camera_device_register() is
to register a platform device whose name is soc-pdrv.
Is my analysis right ?

I do not want to use modle to load the driver,I want the two
sensors' device node can all exist in /dev directory after the system
is booted,what should I do.the kernel vesion I used is 2.6.36.Please
help me.


Thanks
LeMin.
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: problems on soc-camera subsystem

2011-05-04 Thread Guennadi Liakhovetski
On Wed, 4 May 2011, ÀÖÃô wrote:

  Dear Guennadi:
 
   Thanks for you help,now I think I can send  emails to
 linux-media@vger.kernel.org .there is still  one thing  I can not
 understand.The
 question is in the end of this email.
 
(3) There is a host only, so I think if there are two camera
sensors,when one sensor is working,another sensor will be poweroff and
can not be actived.The method to switch between them I think is to close
the sensor which is not in use.
   
Can you tell me whether the CEU can connect multiple sensors or not,If
yes,are there some restrictions?
 
  It should work, yes. Currently soc-camera handles client devices (e.g.,
  sensors) in the following way: first during probing it attaches each such
  client device to the host, performs probing _and_ detaches it immediately.
  Then at open() the same happens - only the respective sensor is attached
  to the host, so, the CEU driver only has to deal with one sensor at a
  time. Just make sure to not try to open both nodes at the same time.
 
If it supports multiple sensors ,what should I do?
 
  Just that - write two independent sensor drivers and two platform data
  blocks for them in your board file. Then open and operate each sensor
  independently. You also might want to provide platform struct
  soc_camera_link::power() and / or reset() callbacks.
 
 
 You say soc_camera will attach each sensor in the probing,but I think
 each time there is
 only one sensor can register to soc_camera subsystem.

Correct. During probing each client device will be attached to the host, 
probed, and detached again.

 look at the following
 code:
 
 struct i2c_board_info ov9640_info1=
 {
 
 };
 
 struct soc_camera_link ov9640_link1=
 {
.board_info=ov9640_info1,
..
 };
 
 struct platform_device ov9640_device1=
 {
.name = soc-camera-pdrv,
.dev=
 {
   .platform_data = ov9640_link1,
 }
 };
 
 struct i2c_board_info ov9640_info2=
 {
 
 };
 
 struct soc_camera_link ov9640_link2=
 {
.board_info=ov9640_info2,
..
 };
 
 struct platform_device ov9640_device2=
 {
.name = soc-camera-pdrv,//the name is same to the 
 ov_9640_device1.
.dev=
 {
   .platform_data = ov9640_link2,
 }
 };
 
 There are two sensors,now I want they all exist in /dev after
 linux system is
 boot.can I do this? if yes I want to use platform_device_register()
 twice.but this action is forbindden,because they have the same
 platform name,so only one sensor can registered successfully.

You should use different IDs. Look at arch/sh/boards/mach-migor/setup.c or 
arch/arm/mach-mx3/mach-pcm037.c for examples.

 On the other hand if I use soc_camera subsystem to register a
 video device to let
 system create a node in /dev,like /dev/video0 or /dev/video1.I must
 call soc_camera_device_register() to register a soc_camera_device to
 soc_camera,
 then if there is a camera host is registered to soc_camera,the host
 will call scan_add_host() to  probe and attach each sensor,if host can
 handle the sensor,
 device_register() will be called,finally the probe function of
 soc_camera bus--soc_camera_probe() will be called,in this function
 a video device will be register to  the system,and a device node will
 be create in /dev if all information of the  sensor is ok.
 
  So if you want to register a video device and create a device
 node in /dev using soc_camera,soc_camera_device_register() must be
 called.But now the only way to call  soc_camera_device_register() is
 to register a platform device whose name is soc-pdrv.
 Is my analysis right ?
 
 I do not want to use modle to load the driver,I want the two
 sensors' device node can all exist in /dev directory after the system
 is booted,what should I do.the kernel vesion I used is 2.6.36.Please
 help me.

Would also be good to use the current kernel version for any new 
development. In my replies I'm targeting the newest kernel(s), and if you 
encounter any problems / questions, specific to an older version, I am 
afraid, I won't be able to help you. Also to mainline your work you'll 
have to submit patches for the latest kernel.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: problems on soc-camera subsystem

2011-05-04 Thread 乐敏
Dear Guennadi:

 You should use different IDs. Look at arch/sh/boards/mach-migor/setup.c or
 arch/arm/mach-mx3/mach-pcm037.c for examples.


 Thank you for your help,The above sentence gives me the answer.Today
I studied the platform_device subsystem again,and understant that if
you want  to register platform devices  who has the same name,you must
give each of them a different ID.what a easy problem,but cost you so
much time to interpret  for me,I am so sorry.

Thanks
LeMin
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: problems on soc-camera subsystem

2011-05-03 Thread Guennadi Liakhovetski
The original email was blocked by vger, because it contained HTML. I'm 
quoting it in my reply unchanged for all to read and comment.

On Tue, 3 May 2011, ÀÖÃô wrote:

 Dear Guennadi:
 
 
 
Thank you for your advice.This is my first time to write
  camera driver.We need two camera sensors in our project.But I do not
  know whether the host can connect multiple sensors or not.
 
  I am very sorry to take up your precious time. These days I
   studied the soc_camera subsystem which was wrote by you,the biggest
   problem I can not understant is how can I register a
   soc_camera_device.when reading the source,I found that
   soc_camera_device_register() was declared as a static function,it was
   not exported to the kernel,and it's only called by
   soc_camera_pdrv_probe() one time,this means if there are two camera
   sensors connected to the camera host,I want to register two platform
   devices whose name is soc-camera-pdrv, but this isunacceptable.could
   it be said that I can only use one camera sensor if I use the
 soc_camera
   subsystem?
  No, in principle you can use multiple sensors. But you have to explain
 (1)
  whether both your sensors are of the same type, (2) how they are
 connected
  to one host, (3) how you are going to switch between them, (4) whether
  they use the same i2c address or not. Then we can discuss how you can
  represent them in your platform data.
 
  (1)  The CPU is Renesas's sh_mobile_7372,on the cpu there is a host
  interface called Capture Engine Unit (CEU).It can conncet camera sensors
  directly.There is another interface called Camera Serial Interface
  (CSI2),
  it can connect a MIPI-CSI2 standard serial camera sensor,the CSI
  Performs serial-to-parallel conversion of data from a camera . And CSI2
  passes parallel data to CEU. The following sentences is come from the
  datasheet of the CPU.
 
  /*/
 
  List the three homologous series for the interface connecting to camera as
 follows.
  16-bit input for a main camera.
  8-bit input for a sub camera (This LSI doesn't mount PAD for sub-
 camera.)
  32-bit input from CSI2C.
 
  /*/
 
  (2)Now I plan to connect two sensors to the CEU, 16-bit input for a
  main camera and 32-bit input from CSI2,they are not the same type and
  using different I2C address. Can this able to work well?

It should work, yes.

  (3) There is a host only, so I think if there are two camera
  sensors,when one sensor is working,another sensor will be poweroff and
  can not be actived.The method to switch between them I think is to close
  the sensor which is not in use.
 
  Can you tell me whether the CEU can connect multiple sensors or not,If
  yes,are there some restrictions?

It should work, yes. Currently soc-camera handles client devices (e.g., 
sensors) in the following way: first during probing it attaches each such 
client device to the host, performs probing _and_ detaches it immediately. 
Then at open() the same happens - only the respective sensor is attached 
to the host, so, the CEU driver only has to deal with one sensor at a 
time. Just make sure to not try to open both nodes at the same time.

  If it supports multiple sensors ,what should I do?

Just that - write two independent sensor drivers and two platform data 
blocks for them in your board file. Then open and operate each sensor 
independently. You also might want to provide platform struct 
soc_camera_link::power() and / or reset() callbacks.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html