Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[sfrench/cifs-2.6.git] / 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_CONTROL                 0x00
26 #define INDYCAM_SHUTTER                 0x01
27 #define INDYCAM_GAIN                    0x02
28 #define INDYCAM_BRIGHTNESS              0x03 /* read-only */
29 #define INDYCAM_RED_BALANCE             0x04
30 #define INDYCAM_BLUE_BALANCE            0x05
31 #define INDYCAM_RED_SATURATION          0x06
32 #define INDYCAM_BLUE_SATURATION         0x07
33 #define INDYCAM_GAMMA                   0x08
34 #define INDYCAM_VERSION                 0x0e /* read-only */
35 #define INDYCAM_RESET                   0x0f /* write-only */
36
37 #define INDYCAM_LED                     0x46
38 #define INDYCAM_ORIENTATION             0x47
39 #define INDYCAM_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 #define INDYCAM_SHUTTER_MIN             0x00
63 #define INDYCAM_SHUTTER_MAX             0xff
64 #define INDYCAM_GAIN_MIN                0x00
65 #define INDYCAM_GAIN_MAX                0xff
66 #define INDYCAM_RED_BALANCE_MIN         0x00 /* the effect is the opposite? */
67 #define INDYCAM_RED_BALANCE_MAX         0xff
68 #define INDYCAM_BLUE_BALANCE_MIN        0x00 /* the effect is the opposite? */
69 #define INDYCAM_BLUE_BALANCE_MAX        0xff
70 #define INDYCAM_RED_SATURATION_MIN      0x00
71 #define INDYCAM_RED_SATURATION_MAX      0xff
72 #define INDYCAM_BLUE_SATURATION_MIN     0x00
73 #define INDYCAM_BLUE_SATURATION_MAX     0xff
74 #define INDYCAM_GAMMA_MIN               0x00
75 #define INDYCAM_GAMMA_MAX               0xff
76
77 /* Driver interface definitions */
78
79 #define INDYCAM_VALUE_ENABLED           1
80 #define INDYCAM_VALUE_DISABLED          0
81 #define INDYCAM_VALUE_UNCHANGED         -1
82
83 /* When setting controls, a value of -1 leaves the control unchanged. */
84 struct indycam_control {
85         int agc;        /* boolean */
86         int awb;        /* boolean */
87         int shutter;
88         int gain;
89         int red_balance;
90         int blue_balance;
91         int red_saturation;
92         int blue_saturation;
93         int gamma;
94 };
95
96 #define DECODER_INDYCAM_GET_CONTROLS    _IOR('d', 193, struct indycam_control)
97 #define DECODER_INDYCAM_SET_CONTROLS    _IOW('d', 194, struct indycam_control)
98
99 /* Default values for controls */
100
101 #define INDYCAM_AGC_DEFAULT             INDYCAM_VALUE_ENABLED
102 #define INDYCAM_AWB_DEFAULT             INDYCAM_VALUE_ENABLED
103
104 #define INDYCAM_SHUTTER_DEFAULT         INDYCAM_SHUTTER_60
105 #define INDYCAM_GAIN_DEFAULT            0x80
106 #define INDYCAM_RED_BALANCE_DEFAULT     0x18
107 #define INDYCAM_BLUE_BALANCE_DEFAULT    0xa4
108 #define INDYCAM_RED_SATURATION_DEFAULT  0x80
109 #define INDYCAM_BLUE_SATURATION_DEFAULT 0xc0
110 #define INDYCAM_GAMMA_DEFAULT           0x80
111
112 #endif