2006-02-06 16:29:35 +00:00
/***************************************************************************
2007-01-08 11:34:35 -03:00
* API for image sensors connected to the ZC0301 [ P ] Image Processor and *
2006-02-06 16:29:35 +00:00
* Control Chip *
* *
2007-01-08 11:34:35 -03:00
* Copyright ( C ) 2006 - 2007 by Luca Risolia < luca . risolia @ studio . unibo . it > *
2006-02-06 16:29:35 +00:00
* *
* 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 0213 9 , USA . *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# ifndef _ZC0301_SENSOR_H_
# define _ZC0301_SENSOR_H_
# include <linux/usb.h>
2007-06-13 15:11:15 -03:00
# include <linux/videodev2.h>
2006-02-06 16:29:35 +00:00
# include <linux/device.h>
# include <linux/stddef.h>
# include <linux/errno.h>
# include <asm/types.h>
struct zc0301_device ;
struct zc0301_sensor ;
/*****************************************************************************/
extern int zc0301_probe_pas202bcb ( struct zc0301_device * cam ) ;
2006-04-24 11:28:23 -03:00
extern int zc0301_probe_pb0330 ( struct zc0301_device * cam ) ;
2006-02-06 16:29:35 +00:00
# define ZC0301_SENSOR_TABLE \
/* Weak detections must go at the end of the list */ \
static int ( * zc0301_sensor_table [ ] ) ( struct zc0301_device * ) = { \
& zc0301_probe_pas202bcb , \
2006-04-24 11:28:23 -03:00
& zc0301_probe_pb0330 , \
2006-02-06 16:29:35 +00:00
NULL , \
} ;
2006-02-25 06:57:49 +00:00
extern struct zc0301_device *
zc0301_match_id ( struct zc0301_device * cam , const struct usb_device_id * id ) ;
2006-02-06 16:29:35 +00:00
extern void
2006-02-25 06:57:49 +00:00
zc0301_attach_sensor ( struct zc0301_device * cam , struct zc0301_sensor * sensor ) ;
2006-02-06 16:29:35 +00:00
# define ZC0301_USB_DEVICE(vend, prod, intclass) \
. match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
2006-03-25 09:19:53 -03:00
USB_DEVICE_ID_MATCH_INT_CLASS , \
2006-02-06 16:29:35 +00:00
. idVendor = ( vend ) , \
. idProduct = ( prod ) , \
. bInterfaceClass = ( intclass )
2009-01-07 08:00:18 -03:00
# if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE
2006-02-06 16:29:35 +00:00
# define ZC0301_ID_TABLE \
static const struct usb_device_id zc0301_id_table [ ] = { \
2006-04-24 11:28:23 -03:00
{ ZC0301_USB_DEVICE ( 0x046d , 0x08ae , 0xff ) , } , /* PAS202 */ \
{ ZC0301_USB_DEVICE ( 0x0ac8 , 0x303b , 0xff ) , } , /* PB-0330 */ \
2006-02-06 16:29:35 +00:00
{ } \
} ;
2009-01-07 08:00:18 -03:00
# else
# define ZC0301_ID_TABLE \
static const struct usb_device_id zc0301_id_table [ ] = { \
{ ZC0301_USB_DEVICE ( 0x046d , 0x08ae , 0xff ) , } , /* PAS202 */ \
{ } \
} ;
# endif
2006-02-06 16:29:35 +00:00
/*****************************************************************************/
extern int zc0301_write_reg ( struct zc0301_device * , u16 index , u16 value ) ;
extern int zc0301_read_reg ( struct zc0301_device * , u16 index ) ;
extern int zc0301_i2c_write ( struct zc0301_device * , u16 address , u16 value ) ;
extern int zc0301_i2c_read ( struct zc0301_device * , u16 address , u8 length ) ;
/*****************************************************************************/
2007-01-08 11:34:35 -03:00
# define ZC0301_MAX_CTRLS (V4L2_CID_LASTP1 - V4L2_CID_BASE + 10)
# define ZC0301_V4L2_CID_DAC_MAGNITUDE (V4L2_CID_PRIVATE_BASE + 0)
# define ZC0301_V4L2_CID_GREEN_BALANCE (V4L2_CID_PRIVATE_BASE + 1)
2006-02-06 16:29:35 +00:00
struct zc0301_sensor {
char name [ 32 ] ;
struct v4l2_queryctrl qctrl [ ZC0301_MAX_CTRLS ] ;
struct v4l2_cropcap cropcap ;
struct v4l2_pix_format pix_format ;
2006-02-25 06:57:49 +00:00
int ( * init ) ( struct zc0301_device * ) ;
int ( * get_ctrl ) ( struct zc0301_device * , struct v4l2_control * ctrl ) ;
int ( * set_ctrl ) ( struct zc0301_device * ,
2006-03-25 09:19:53 -03:00
const struct v4l2_control * ctrl ) ;
2006-02-25 06:57:49 +00:00
int ( * set_crop ) ( struct zc0301_device * , const struct v4l2_rect * rect ) ;
2006-02-06 16:29:35 +00:00
/* Private */
struct v4l2_queryctrl _qctrl [ ZC0301_MAX_CTRLS ] ;
struct v4l2_rect _rect ;
} ;
# endif /* _ZC0301_SENSOR_H_ */