Support for hardware resolultion change
[microdia.git] / sn9c20x.h
blob41003f3fbc36f275e11197a484313dfd5d46bd5b
1 /**
2 * @file sn9c20x.h
3 * @author Dave Neuer
4 * @date 2008-03-02
5 * @version v0.0.0
7 * @brief Common functions and data for the Sonix SN9C20x webcam bridge chips.
9 * @note Copyright (C) Dave Neuer
11 * @par Licences
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #ifndef SN9C20X_H
29 #define SN9C20X_H
31 #define SN9C20X_I2C_400KHZ 0x01
32 #define SN9C20X_I2C_READ 0x02
33 #define SN9C20X_I2C_READY 0x04
34 #define SN9C20X_I2C_ERROR 0x08
35 #define SN9C20X_I2C_2WIRE 0x80
37 /* registers */
38 #define SN9C20X_HSTART 0x10fb
39 #define SN9C20X_HSIZE 0x10fc
40 #define SN9C20X_VSTART 0x10fd
41 #define SN9C20X_VSIZE 0x10fe
42 #define SN9C20X_SHARPNESS 0x10f6
43 #define SN9C20X_RED_GAIN 0x118c
44 #define SN9C20X_GREEN1_GAIN 0x118d
45 #define SN9C20X_GREEN2_GAIN 0x118e
46 #define SN9C20X_BLUE_GAIN 0x118f
47 #define SN9C20X_SCALE 0x1189
49 #define SN9C20X_NO_SCALE 0x00
50 #define SN9C20X_1_2_SCALE 0x10
51 #define SN9C20X_1_4_SCALE 0x20
54 int sn9c20x_initialize_i2c(struct usb_microdia * dev, __u8 flags, __u8 slave);
56 int sn9c20x_write_i2c_data(struct usb_microdia * dev, __u8 slave, __u8 nbytes,
57 __u8 address, __u8 flags, const __u8 [nbytes]);
59 int sn9c20x_read_i2c_data(struct usb_microdia * dev, __u8 slave, __u8 nbytes,
60 __u8 address, __u8 flags, __u8 * result);
62 int sn9c20x_write_i2c_data16(struct usb_microdia * dev, __u8 slave, __u8 datalen,
63 __u8 address, __u8 flags, const __u16 [datalen]);
65 int sn9c20x_read_i2c_data16(struct usb_microdia * dev, __u8 slave, __u8 datalen,
66 __u8 address, __u8 flags, __u16 * result);
68 int sn9c20x_set_contrast(struct usb_microdia *dev);
70 int sn9c20x_set_brightness(struct usb_microdia *dev);
72 int sn9c20x_set_gamma(struct usb_microdia *dev);
74 int sn9c20x_set_sharpness(struct usb_microdia *dev);
76 int sn9c20x_set_rgb_gain(struct usb_microdia *dev);
78 int sn9c20x_set_resolution(struct usb_microdia *dev,
79 int width, int height);
81 int sn9c20x_get_closest_resolution(int *width, int *height);
84 #endif