aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/media/zc0301_sensor.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/media/zc0301_sensor.h')
-rw-r--r--drivers/usb/media/zc0301_sensor.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/drivers/usb/media/zc0301_sensor.h b/drivers/usb/media/zc0301_sensor.h
new file mode 100644
index 00000000000..8890e32405d
--- /dev/null
+++ b/drivers/usb/media/zc0301_sensor.h
@@ -0,0 +1,98 @@
1/***************************************************************************
2 * API for image sensors connected to the ZC030! Image Processor and *
3 * Control Chip *
4 * *
5 * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the Free Software *
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
20 ***************************************************************************/
21
22#ifndef _ZC0301_SENSOR_H_
23#define _ZC0301_SENSOR_H_
24
25#include <linux/usb.h>
26#include <linux/videodev.h>
27#include <linux/device.h>
28#include <linux/stddef.h>
29#include <linux/errno.h>
30#include <asm/types.h>
31
32struct zc0301_device;
33struct zc0301_sensor;
34
35/*****************************************************************************/
36
37extern int zc0301_probe_pas202bcb(struct zc0301_device* cam);
38
39#define ZC0301_SENSOR_TABLE \
40/* Weak detections must go at the end of the list */ \
41static int (*zc0301_sensor_table[])(struct zc0301_device*) = { \
42 &zc0301_probe_pas202bcb, \
43 NULL, \
44};
45
46extern void
47zc0301_attach_sensor(struct zc0301_device* cam,
48 struct zc0301_sensor* sensor);
49
50#define ZC0301_USB_DEVICE(vend, prod, intclass) \
51 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
52 USB_DEVICE_ID_MATCH_INT_CLASS, \
53 .idVendor = (vend), \
54 .idProduct = (prod), \
55 .bInterfaceClass = (intclass)
56
57#define ZC0301_ID_TABLE \
58static const struct usb_device_id zc0301_id_table[] = { \
59 { ZC0301_USB_DEVICE(0x046d, 0x08ae, 0xff), }, /* PAS202BCB */ \
60 { } \
61};
62
63/*****************************************************************************/
64
65extern int zc0301_write_reg(struct zc0301_device*, u16 index, u16 value);
66extern int zc0301_read_reg(struct zc0301_device*, u16 index);
67extern int zc0301_i2c_write(struct zc0301_device*, u16 address, u16 value);
68extern int zc0301_i2c_read(struct zc0301_device*, u16 address, u8 length);
69
70/*****************************************************************************/
71
72#define ZC0301_MAX_CTRLS V4L2_CID_LASTP1-V4L2_CID_BASE+10
73#define ZC0301_V4L2_CID_DAC_MAGNITUDE V4L2_CID_PRIVATE_BASE
74#define ZC0301_V4L2_CID_GREEN_BALANCE V4L2_CID_PRIVATE_BASE + 1
75
76struct zc0301_sensor {
77 char name[32];
78
79 struct v4l2_queryctrl qctrl[ZC0301_MAX_CTRLS];
80 struct v4l2_cropcap cropcap;
81 struct v4l2_pix_format pix_format;
82
83 int (*init)(struct zc0301_device* cam);
84 int (*get_ctrl)(struct zc0301_device* cam,
85 struct v4l2_control* ctrl);
86 int (*set_ctrl)(struct zc0301_device* cam,
87 const struct v4l2_control* ctrl);
88 int (*set_crop)(struct zc0301_device* cam,
89 const struct v4l2_rect* rect);
90
91 const struct usb_device* usbdev;
92
93 /* Private */
94 struct v4l2_queryctrl _qctrl[ZC0301_MAX_CTRLS];
95 struct v4l2_rect _rect;
96};
97
98#endif /* _ZC0301_SENSOR_H_ */