Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
[linux-2.6] / drivers / media / video / indycam.h
1 /*
2  *  indycam.h - Silicon Graphics IndyCam digital camera driver
3  *
4  *  Copyright (C) 2003 Ladislav Michl <ladis@linux-mips.org>
5  *  Copyright (C) 2004,2005 Mikael Nousiainen <tmnousia@cc.hut.fi>
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 version 2 as
9  *  published by the Free Software Foundation.
10  */
11
12 #ifndef _INDYCAM_H_
13 #define _INDYCAM_H_
14
15 /* I2C address for the Guinness Camera */
16 #define INDYCAM_ADDR                    0x56
17
18 /* Camera version */
19 #define CAMERA_VERSION_INDY             0x10    /* v1.0 */
20 #define CAMERA_VERSION_MOOSE            0x12    /* v1.2 */
21 #define INDYCAM_VERSION_MAJOR(x)        (((x) & 0xf0) >> 4)
22 #define INDYCAM_VERSION_MINOR(x)        ((x) & 0x0f)
23
24 /* Register bus addresses */
25 #define INDYCAM_REG_CONTROL             0x00
26 #define INDYCAM_REG_SHUTTER             0x01
27 #define INDYCAM_REG_GAIN                0x02
28 #define INDYCAM_REG_BRIGHTNESS          0x03 /* read-only */
29 #define INDYCAM_REG_RED_BALANCE         0x04
30 #define INDYCAM_REG_BLUE_BALANCE        0x05
31 #define INDYCAM_REG_RED_SATURATION      0x06
32 #define INDYCAM_REG_BLUE_SATURATION     0x07
33 #define INDYCAM_REG_GAMMA               0x08
34 #define INDYCAM_REG_VERSION             0x0e /* read-only */
35 #define INDYCAM_REG_RESET               0x0f /* write-only */
36
37 #define INDYCAM_REG_LED                 0x46
38 #define INDYCAM_REG_ORIENTATION         0x47
39 #define INDYCAM_REG_BUTTON              0x48
40
41 /* Field definitions of registers */
42 #define INDYCAM_CONTROL_AGCENA          (1<<0) /* automatic gain control */
43 #define INDYCAM_CONTROL_AWBCTL          (1<<1) /* automatic white balance */
44                                                 /* 2-3 are reserved */
45 #define INDYCAM_CONTROL_EVNFLD          (1<<4)  /* read-only */
46
47 #define INDYCAM_SHUTTER_10000           0x02    /* 1/10000 second */
48 #define INDYCAM_SHUTTER_4000            0x04    /* 1/4000 second */
49 #define INDYCAM_SHUTTER_2000            0x08    /* 1/2000 second */
50 #define INDYCAM_SHUTTER_1000            0x10    /* 1/1000 second */
51 #define INDYCAM_SHUTTER_500             0x20    /* 1/500 second */
52 #define INDYCAM_SHUTTER_250             0x3f    /* 1/250 second */
53 #define INDYCAM_SHUTTER_125             0x7e    /* 1/125 second */
54 #define INDYCAM_SHUTTER_100             0x9e    /* 1/100 second */
55 #define INDYCAM_SHUTTER_60              0x00    /* 1/60 second */
56
57 #define INDYCAM_LED_ACTIVE                      0x10
58 #define INDYCAM_LED_INACTIVE                    0x30
59 #define INDYCAM_ORIENTATION_BOTTOM_TO_TOP       0x40
60 #define INDYCAM_BUTTON_RELEASED                 0x10
61
62 /* Values for controls */
63 #define INDYCAM_SHUTTER_MIN             0x00
64 #define INDYCAM_SHUTTER_MAX             0xff
65 #define INDYCAM_GAIN_MIN                0x00
66 #define INDYCAM_GAIN_MAX                0xff
67 #define INDYCAM_RED_BALANCE_MIN         0x00
68 #define INDYCAM_RED_BALANCE_MAX         0xff
69 #define INDYCAM_BLUE_BALANCE_MIN        0x00
70 #define INDYCAM_BLUE_BALANCE_MAX        0xff
71 #define INDYCAM_RED_SATURATION_MIN      0x00
72 #define INDYCAM_RED_SATURATION_MAX      0xff
73 #define INDYCAM_BLUE_SATURATION_MIN     0x00
74 #define INDYCAM_BLUE_SATURATION_MAX     0xff
75 #define INDYCAM_GAMMA_MIN               0x00
76 #define INDYCAM_GAMMA_MAX               0xff
77
78 #define INDYCAM_AGC_DEFAULT             1
79 #define INDYCAM_AWB_DEFAULT             0
80 #define INDYCAM_SHUTTER_DEFAULT         0xff
81 #define INDYCAM_GAIN_DEFAULT            0x80
82 #define INDYCAM_RED_BALANCE_DEFAULT     0x18
83 #define INDYCAM_BLUE_BALANCE_DEFAULT    0xa4
84 #define INDYCAM_RED_SATURATION_DEFAULT  0x80
85 #define INDYCAM_BLUE_SATURATION_DEFAULT 0xc0
86 #define INDYCAM_GAMMA_DEFAULT           0x80
87
88 /* Driver interface definitions */
89
90 #define INDYCAM_CONTROL_AGC                     0       /* boolean */
91 #define INDYCAM_CONTROL_AWB                     1       /* boolean */
92 #define INDYCAM_CONTROL_SHUTTER                 2
93 #define INDYCAM_CONTROL_GAIN                    3
94 #define INDYCAM_CONTROL_RED_BALANCE             4
95 #define INDYCAM_CONTROL_BLUE_BALANCE            5
96 #define INDYCAM_CONTROL_RED_SATURATION          6
97 #define INDYCAM_CONTROL_BLUE_SATURATION         7
98 #define INDYCAM_CONTROL_GAMMA                   8
99
100 struct indycam_control {
101         u8 type;
102         s32 value;
103 };
104
105 #define DECODER_INDYCAM_GET_CONTROL     _IOR('d', 193, struct indycam_control)
106 #define DECODER_INDYCAM_SET_CONTROL     _IOW('d', 194, struct indycam_control)
107
108 #endif