6 * @brief Common functions and data for the Sonix SN9C20x webcam bridge chips.
8 * @note Copyright (C) Dave Neuer
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
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
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
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_microdia
*dev
);
49 int sn9c20x_set_LEDs(struct usb_microdia
*dev
, int enable
);
50 int sn9c20x_enable_video(struct usb_microdia
*dev
, int enable
);
51 int sn9c20x_i2c_initialize(struct usb_microdia
*dev
);
53 int sn9c20x_write_i2c_data_ext(struct usb_microdia
*dev
, __u8 nbytes
,
54 __u8 address
, const __u8
[nbytes
], __u8 last_byte
);
56 static inline int sn9c20x_write_i2c_data(struct usb_microdia
*dev
, __u8 nbytes
,
57 __u8 address
, const __u8 data
[nbytes
])
59 return sn9c20x_write_i2c_data_ext(dev
, nbytes
, address
, data
,
63 int sn9c20x_read_i2c_data(struct usb_microdia
*dev
, __u8 nbytes
,
64 __u8 address
, __u8
*result
);
66 int sn9c20x_write_i2c_data16(struct usb_microdia
*dev
, __u8 datalen
,
67 __u8 address
, const __u16
[datalen
]);
69 int sn9c20x_read_i2c_data16(struct usb_microdia
*dev
, __u8 datalen
,
70 __u8 address
, __u16
*result
);
72 int sn9c20x_set_contrast(struct usb_microdia
*dev
);
74 int sn9c20x_set_brightness(struct usb_microdia
*dev
);
76 int sn9c20x_set_gamma(struct usb_microdia
*dev
);
78 int sn9c20x_set_sharpness(struct usb_microdia
*dev
);
80 int sn9c20x_set_rgb_gain(struct usb_microdia
*dev
);
82 int sn9c20x_set_resolution(struct usb_microdia
*dev
,
83 int width
, int height
);
85 int sn9c20x_get_closest_resolution(struct usb_microdia
*, int *, int *);
86 int sn9c20x_set_raw(struct usb_microdia
*);
87 int sn9c20x_set_jpeg(struct usb_microdia
*);