Skip to content

Commit

Permalink
V4L/DVB (3838): ZC0301 driver updates
Browse files Browse the repository at this point in the history
ZC0301 driver updates:
- Add support for PB-0330 image sensor
- Generic documentation cleanups and updates

Signed-off-by: Luca Risolia <luca.risolia@studio.unibo.it>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
  • Loading branch information
Luca Risolia authored and Mauro Carvalho Chehab committed Jun 25, 2006
1 parent 2b455db commit 0230185
Show file tree
Hide file tree
Showing 7 changed files with 264 additions and 45 deletions.
80 changes: 48 additions & 32 deletions Documentation/video4linux/zc0301.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

ZC0301 Image Processor and Control Chip
Driver for Linux
=======================================
ZC0301 and ZC0301P Image Processor and Control Chip
Driver for Linux
===================================================

- Documentation -
- Documentation -


Index
Expand Down Expand Up @@ -51,13 +51,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

4. Overview and features
========================
This driver supports the video interface of the devices mounting the ZC0301
Image Processor and Control Chip.
This driver supports the video interface of the devices mounting the ZC0301 or
ZC0301P Image Processors and Control Chips.

The driver relies on the Video4Linux2 and USB core modules. It has been
designed to run properly on SMP systems as well.

The latest version of the ZC0301 driver can be found at the following URL:
The latest version of the ZC0301[P] driver can be found at the following URL:
http://www.linux-projects.org/

Some of the features of the driver are:
Expand Down Expand Up @@ -117,7 +117,7 @@ supported by the USB Audio driver thanks to the ALSA API:

And finally:

# USB Multimedia devices
# V4L USB devices
#
CONFIG_USB_ZC0301=m

Expand Down Expand Up @@ -146,46 +146,46 @@ Name: video_nr
Type: short array (min = 0, max = 64)
Syntax: <-1|n[,...]>
Description: Specify V4L2 minor mode number:
-1 = use next available
n = use minor number n
You can specify up to 64 cameras this way.
For example:
video_nr=-1,2,-1 would assign minor number 2 to the second
registered camera and use auto for the first one and for every
other camera.
-1 = use next available
n = use minor number n
You can specify up to 64 cameras this way.
For example:
video_nr=-1,2,-1 would assign minor number 2 to the second
registered camera and use auto for the first one and for every
other camera.
Default: -1
-------------------------------------------------------------------------------
Name: force_munmap
Type: bool array (min = 0, max = 64)
Syntax: <0|1[,...]>
Description: Force the application to unmap previously mapped buffer memory
before calling any VIDIOC_S_CROP or VIDIOC_S_FMT ioctl's. Not
all the applications support this feature. This parameter is
specific for each detected camera.
0 = do not force memory unmapping
1 = force memory unmapping (save memory)
before calling any VIDIOC_S_CROP or VIDIOC_S_FMT ioctl's. Not
all the applications support this feature. This parameter is
specific for each detected camera.
0 = do not force memory unmapping
1 = force memory unmapping (save memory)
Default: 0
-------------------------------------------------------------------------------
Name: frame_timeout
Type: uint array (min = 0, max = 64)
Syntax: <n[,...]>
Description: Timeout for a video frame in seconds. This parameter is
specific for each detected camera. This parameter can be
changed at runtime thanks to the /sys filesystem interface.
specific for each detected camera. This parameter can be
changed at runtime thanks to the /sys filesystem interface.
Default: 2
-------------------------------------------------------------------------------
Name: debug
Type: ushort
Syntax: <n>
Description: Debugging information level, from 0 to 3:
0 = none (use carefully)
1 = critical errors
2 = significant informations
3 = more verbose messages
Level 3 is useful for testing only, when only one device
is used at the same time. It also shows some more informations
about the hardware being detected. This module parameter can be
changed at runtime thanks to the /sys filesystem interface.
0 = none (use carefully)
1 = critical errors
2 = significant informations
3 = more verbose messages
Level 3 is useful for testing only, when only one device
is used at the same time. It also shows some more informations
about the hardware being detected. This module parameter can be
changed at runtime thanks to the /sys filesystem interface.
Default: 2
-------------------------------------------------------------------------------

Expand All @@ -204,11 +204,25 @@ Vendor ID Product ID
0x041e 0x4017
0x041e 0x401c
0x041e 0x401e
0x041e 0x401f
0x041e 0x4022
0x041e 0x4034
0x041e 0x4035
0x041e 0x4036
0x041e 0x403a
0x0458 0x7007
0x0458 0x700C
0x0458 0x700f
0x046d 0x08ae
0x055f 0xd003
0x055f 0xd004
0x046d 0x08ae
0x0ac8 0x0301
0x0ac8 0x301b
0x0ac8 0x303b
0x10fd 0x0128
0x10fd 0x8050
0x10fd 0x804e

The list above does not imply that all those devices work with this driver: up
until now only the ones that mount the following image sensors are supported;
Expand All @@ -217,6 +231,7 @@ kernel messages will always tell you whether this is the case:
Model Manufacturer
----- ------------
PAS202BCB PixArt Imaging, Inc.
PB-0330 Photobit Corporation


9. Notes for V4L2 application developers
Expand Down Expand Up @@ -250,5 +265,6 @@ the fingerprint is: '88E8 F32F 7244 68BA 3958 5D40 99DA 5D2A FCE6 35A4'.
been taken from the documentation of the ZC030x Video4Linux1 driver written
by Andrew Birkett <andy@nobugs.org>;
- The initialization values of the ZC0301 controller connected to the PAS202BCB
image sensor have been taken from the SPCA5XX driver maintained by
Michel Xhaard <mxhaard@magic.fr>.
and PB-0330 image sensors have been taken from the SPCA5XX driver maintained
by Michel Xhaard <mxhaard@magic.fr>;
- Stanislav Lechev donated one camera.
6 changes: 3 additions & 3 deletions drivers/media/video/zc0301/Kconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
config USB_ZC0301
tristate "USB ZC0301 Image Processor and Control Chip support"
tristate "USB ZC0301[P] Image Processor and Control Chip support"
depends on USB && VIDEO_V4L1
---help---
Say Y here if you want support for cameras based on the ZC0301
Image Processor and Control Chip.
Say Y here if you want support for cameras based on the ZC0301 or
ZC0301P Image Processors and Control Chips.

See <file:Documentation/video4linux/zc0301.txt> for more info.

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/zc0301/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
zc0301-objs := zc0301_core.o zc0301_pas202bcb.o
zc0301-objs := zc0301_core.o zc0301_pb0330.o zc0301_pas202bcb.o

obj-$(CONFIG_USB_ZC0301) += zc0301.o
4 changes: 2 additions & 2 deletions drivers/media/video/zc0301/zc0301_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
#define ZC0301_MODULE_AUTHOR "(C) 2006 Luca Risolia"
#define ZC0301_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"
#define ZC0301_MODULE_LICENSE "GPL"
#define ZC0301_MODULE_VERSION "1:1.03"
#define ZC0301_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 3)
#define ZC0301_MODULE_VERSION "1:1.04"
#define ZC0301_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 4)

/*****************************************************************************/

Expand Down
4 changes: 2 additions & 2 deletions drivers/media/video/zc0301/zc0301_pas202bcb.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/***************************************************************************
* Plug-in for PAS202BCB image sensor connected to the ZC030! Image *
* Plug-in for PAS202BCB image sensor connected to the ZC0301[P] Image *
* Processor and Control Chip *
* *
* Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> *
* *
* Initialization values of the ZC0301 have been taken from the SPCA5XX *
* Initialization values of the ZC0301[P] have been taken from the SPCA5XX *
* driver maintained by Michel Xhaard <mxhaard@magic.fr> *
* *
* This program is free software; you can redistribute it and/or modify *
Expand Down
187 changes: 187 additions & 0 deletions drivers/media/video/zc0301/zc0301_pb0330.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
/***************************************************************************
* Plug-in for PB-0330 image sensor connected to the ZC0301[P] Image *
* Processor and Control Chip *
* *
* Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> *
* *
* Initialization values of the ZC0301[P] have been taken from the SPCA5XX *
* driver maintained by Michel Xhaard <mxhaard@magic.fr> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
***************************************************************************/

#include <linux/delay.h>
#include "zc0301_sensor.h"


static struct zc0301_sensor pb0330;


static int pb0330_init(struct zc0301_device* cam)
{
int err = 0;

err += zc0301_write_reg(cam, 0x0000, 0x01);
err += zc0301_write_reg(cam, 0x0008, 0x03);
err += zc0301_write_reg(cam, 0x0010, 0x0A);
err += zc0301_write_reg(cam, 0x0002, 0x00);
err += zc0301_write_reg(cam, 0x0003, 0x02);
err += zc0301_write_reg(cam, 0x0004, 0x80);
err += zc0301_write_reg(cam, 0x0005, 0x01);
err += zc0301_write_reg(cam, 0x0006, 0xE0);
err += zc0301_write_reg(cam, 0x0001, 0x01);
err += zc0301_write_reg(cam, 0x0012, 0x05);
err += zc0301_write_reg(cam, 0x0012, 0x07);
err += zc0301_write_reg(cam, 0x0098, 0x00);
err += zc0301_write_reg(cam, 0x009A, 0x00);
err += zc0301_write_reg(cam, 0x011A, 0x00);
err += zc0301_write_reg(cam, 0x011C, 0x00);
err += zc0301_write_reg(cam, 0x0012, 0x05);

err += zc0301_i2c_write(cam, 0x01, 0x0006);
err += zc0301_i2c_write(cam, 0x02, 0x0011);
err += zc0301_i2c_write(cam, 0x03, 0x01E7);
err += zc0301_i2c_write(cam, 0x04, 0x0287);
err += zc0301_i2c_write(cam, 0x06, 0x0003);
err += zc0301_i2c_write(cam, 0x07, 0x3002);
err += zc0301_i2c_write(cam, 0x20, 0x1100);
err += zc0301_i2c_write(cam, 0x2F, 0xF7B0);
err += zc0301_i2c_write(cam, 0x30, 0x0005);
err += zc0301_i2c_write(cam, 0x31, 0x0000);
err += zc0301_i2c_write(cam, 0x34, 0x0100);
err += zc0301_i2c_write(cam, 0x35, 0x0060);
err += zc0301_i2c_write(cam, 0x3D, 0x068F);
err += zc0301_i2c_write(cam, 0x40, 0x01E0);
err += zc0301_i2c_write(cam, 0x58, 0x0078);
err += zc0301_i2c_write(cam, 0x62, 0x0411);

err += zc0301_write_reg(cam, 0x0087, 0x10);
err += zc0301_write_reg(cam, 0x0101, 0x37);
err += zc0301_write_reg(cam, 0x0012, 0x05);
err += zc0301_write_reg(cam, 0x0100, 0x0D);
err += zc0301_write_reg(cam, 0x0189, 0x06);
err += zc0301_write_reg(cam, 0x01AD, 0x00);
err += zc0301_write_reg(cam, 0x01C5, 0x03);
err += zc0301_write_reg(cam, 0x01CB, 0x13);
err += zc0301_write_reg(cam, 0x0250, 0x08);
err += zc0301_write_reg(cam, 0x0301, 0x08);
err += zc0301_write_reg(cam, 0x01A8, 0x60);
err += zc0301_write_reg(cam, 0x018D, 0x6C);
err += zc0301_write_reg(cam, 0x01AD, 0x09);
err += zc0301_write_reg(cam, 0x01AE, 0x15);
err += zc0301_write_reg(cam, 0x010A, 0x50);
err += zc0301_write_reg(cam, 0x010B, 0xF8);
err += zc0301_write_reg(cam, 0x010C, 0xF8);
err += zc0301_write_reg(cam, 0x010D, 0xF8);
err += zc0301_write_reg(cam, 0x010E, 0x50);
err += zc0301_write_reg(cam, 0x010F, 0xF8);
err += zc0301_write_reg(cam, 0x0110, 0xF8);
err += zc0301_write_reg(cam, 0x0111, 0xF8);
err += zc0301_write_reg(cam, 0x0112, 0x50);
err += zc0301_write_reg(cam, 0x0008, 0x03);
err += zc0301_write_reg(cam, 0x01C6, 0x08);
err += zc0301_write_reg(cam, 0x01CB, 0x0F);
err += zc0301_write_reg(cam, 0x010A, 0x50);
err += zc0301_write_reg(cam, 0x010B, 0xF8);
err += zc0301_write_reg(cam, 0x010C, 0xF8);
err += zc0301_write_reg(cam, 0x010D, 0xF8);
err += zc0301_write_reg(cam, 0x010E, 0x50);
err += zc0301_write_reg(cam, 0x010F, 0xF8);
err += zc0301_write_reg(cam, 0x0110, 0xF8);
err += zc0301_write_reg(cam, 0x0111, 0xF8);
err += zc0301_write_reg(cam, 0x0112, 0x50);
err += zc0301_write_reg(cam, 0x0180, 0x00);
err += zc0301_write_reg(cam, 0x0019, 0x00);

err += zc0301_i2c_write(cam, 0x05, 0x0066);
err += zc0301_i2c_write(cam, 0x09, 0x02B2);
err += zc0301_i2c_write(cam, 0x10, 0x0002);

err += zc0301_write_reg(cam, 0x011D, 0x60);
err += zc0301_write_reg(cam, 0x0190, 0x00);
err += zc0301_write_reg(cam, 0x0191, 0x07);
err += zc0301_write_reg(cam, 0x0192, 0x8C);
err += zc0301_write_reg(cam, 0x0195, 0x00);
err += zc0301_write_reg(cam, 0x0196, 0x00);
err += zc0301_write_reg(cam, 0x0197, 0x8A);
err += zc0301_write_reg(cam, 0x018C, 0x10);
err += zc0301_write_reg(cam, 0x018F, 0x20);
err += zc0301_write_reg(cam, 0x01A9, 0x14);
err += zc0301_write_reg(cam, 0x01AA, 0x24);
err += zc0301_write_reg(cam, 0x001D, 0xD7);
err += zc0301_write_reg(cam, 0x001E, 0xF0);
err += zc0301_write_reg(cam, 0x001F, 0xF8);
err += zc0301_write_reg(cam, 0x0020, 0xFF);
err += zc0301_write_reg(cam, 0x01AD, 0x09);
err += zc0301_write_reg(cam, 0x01AE, 0x15);
err += zc0301_write_reg(cam, 0x0180, 0x40);
err += zc0301_write_reg(cam, 0x0180, 0x42);

msleep(100);

return err;
}


static struct zc0301_sensor pb0330 = {
.name = "PB-0330",
.init = &pb0330_init,
.cropcap = {
.bounds = {
.left = 0,
.top = 0,
.width = 640,
.height = 480,
},
.defrect = {
.left = 0,
.top = 0,
.width = 640,
.height = 480,
},
},
.pix_format = {
.width = 640,
.height = 480,
.pixelformat = V4L2_PIX_FMT_JPEG,
.priv = 8,
},
};


int zc0301_probe_pb0330(struct zc0301_device* cam)
{
int r0, err = 0;

err += zc0301_write_reg(cam, 0x0000, 0x01);
err += zc0301_write_reg(cam, 0x0010, 0x0a);
err += zc0301_write_reg(cam, 0x0001, 0x01);
err += zc0301_write_reg(cam, 0x0012, 0x03);
err += zc0301_write_reg(cam, 0x0012, 0x01);

msleep(10);

r0 = zc0301_i2c_read(cam, 0x00, 2);

if (r0 < 0 || err)
return -EIO;

if (r0 != 0x8243)
return -ENODEV;

zc0301_attach_sensor(cam, &pb0330);

return 0;
}
Loading

0 comments on commit 0230185

Please sign in to comment.