Complete renaming to sn920x and declare driver "v2009.01"
[microdia.git] / sn9c20x-bridge.h
blob029042cd03f201a0aa2e6783b6b91bcff41d7296
1 /**
2 * @file sn9c20x.h
3 * @author Dave Neuer
4 * @date 2008-03-02
6 * @brief Common functions and data for the Sonix SN9C20x webcam bridge chips.
8 * @note Copyright (C) Dave Neuer
10 * @par Licences
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #ifndef SN9C20X_BRIDGE_H
28 #define SN9C20X_BRIDGE_H
30 #define SN9C20X_I2C_400KHZ 0x01
31 #define SN9C20X_I2C_READ 0x02
32 #define SN9C20X_I2C_READY 0x04
33 #define SN9C20X_I2C_ERROR 0x08
34 #define SN9C20X_I2C_2WIRE 0x80
36 /* registers */
37 #define SN9C20X_SHARPNESS 0x10f6
38 #define SN9C20X_RED_GAIN 0x118c
39 #define SN9C20X_GREEN1_GAIN 0x118d
40 #define SN9C20X_GREEN2_GAIN 0x118e
41 #define SN9C20X_BLUE_GAIN 0x118f
42 #define SN9C20X_SCALE 0x1189
44 #define SN9C20X_NO_SCALE 0x00
45 #define SN9C20X_1_2_SCALE 0x10
46 #define SN9C20X_1_4_SCALE 0x20
48 int sn9c20x_initialize(struct usb_sn9c20x *dev);
49 int sn9c20x_set_LEDs(struct usb_sn9c20x *dev, int enable);
50 int sn9c20x_set_camera_control(struct usb_sn9c20x *dev, __u32 control, __u32 value);
51 int sn9c20x_enable_video(struct usb_sn9c20x *dev, int enable);
52 int sn9c20x_i2c_initialize(struct usb_sn9c20x *dev);
54 int sn9c20x_write_i2c_data_ext(struct usb_sn9c20x *dev, __u8 nbytes,
55 __u8 address, const __u8 [nbytes], __u8 last_byte);
57 static inline int sn9c20x_write_i2c_data(struct usb_sn9c20x *dev, __u8 nbytes,
58 __u8 address, const __u8 data[nbytes])
60 return sn9c20x_write_i2c_data_ext(dev, nbytes, address, data,
61 0x10);
64 int sn9c20x_read_i2c_data(struct usb_sn9c20x *dev, __u8 nbytes,
65 __u8 address, __u8 *result);
67 int sn9c20x_write_i2c_data16(struct usb_sn9c20x *dev, __u8 datalen,
68 __u8 address, const __u16 [datalen]);
70 int sn9c20x_read_i2c_data16(struct usb_sn9c20x *dev, __u8 datalen,
71 __u8 address, __u16 *result);
73 int sn9c20x_write_i2c_array(struct usb_sn9c20x *dev,
74 struct sn9c20x_i2c_regs *regs, int bits16);
76 int sn9c20x_set_resolution(struct usb_sn9c20x *dev,
77 int width, int height);
79 int sn9c20x_get_closest_resolution(struct usb_sn9c20x *, int *, int *);
80 int sn9c20x_set_format(struct usb_sn9c20x *, __u32);
81 void sn9c20x_set_jpeg(struct usb_sn9c20x *);
82 void sn9c20x_set_raw(struct usb_sn9c20x *);
83 void sn9c20x_set_yuv420(struct usb_sn9c20x *);
84 void sn9c20x_set_yuv422(struct usb_sn9c20x *);
86 #endif