Fix SXGA support to enforce bayer format
[microdia.git] / sn9c20x-bridge.h
blob9c6a2a677eb18fd21dcca802a787745d92f685c9
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_reset_device(struct usb_sn9c20x *dev);
50 int sn9c20x_set_LEDs(struct usb_sn9c20x *dev, int enable);
51 int sn9c20x_set_camera_control(struct usb_sn9c20x *dev,
52 __u32 control, __s32 value);
53 int sn9c20x_enable_video(struct usb_sn9c20x *dev, int enable);
54 int sn9c20x_i2c_initialize(struct usb_sn9c20x *dev);
56 int sn9c20x_write_i2c_data_ext(struct usb_sn9c20x *dev, __u8 nbytes,
57 __u8 address, const __u8 [nbytes], __u8 last_byte);
59 static inline int sn9c20x_write_i2c_data(struct usb_sn9c20x *dev, __u8 nbytes,
60 __u8 address, const __u8 data[nbytes])
62 return sn9c20x_write_i2c_data_ext(dev, nbytes, address, data,
63 0x10);
66 int sn9c20x_read_i2c_data(struct usb_sn9c20x *dev, __u8 nbytes,
67 __u8 address, __u8 *result);
69 int sn9c20x_write_i2c_data16(struct usb_sn9c20x *dev, __u8 datalen,
70 __u8 address, const __u16 [datalen]);
72 int sn9c20x_read_i2c_data16(struct usb_sn9c20x *dev, __u8 datalen,
73 __u8 address, __u16 *result);
75 int sn9c20x_write_i2c_array(struct usb_sn9c20x *dev,
76 struct sn9c20x_i2c_regs *regs, int bits16);
78 int sn9c20x_set_resolution(struct usb_sn9c20x *dev,
79 int width, int height);
81 int sn9c20x_get_closest_resolution(struct usb_sn9c20x *, int *, int *);
82 int sn9c20x_set_format(struct usb_sn9c20x *, __u32);
83 void sn9c20x_set_jpeg(struct usb_sn9c20x *);
84 void sn9c20x_set_raw(struct usb_sn9c20x *);
85 void sn9c20x_set_yuv420(struct usb_sn9c20x *);
86 void sn9c20x_set_yuv422(struct usb_sn9c20x *);
88 #endif