diff options
Diffstat (limited to 'drivers/media/video/msp3400.h')
-rw-r--r-- | drivers/media/video/msp3400.h | 127 |
1 files changed, 120 insertions, 7 deletions
diff --git a/drivers/media/video/msp3400.h b/drivers/media/video/msp3400.h index 2d9ff40f0b09..33d64ac75d37 100644 --- a/drivers/media/video/msp3400.h +++ b/drivers/media/video/msp3400.h | |||
@@ -6,22 +6,62 @@ | |||
6 | 6 | ||
7 | /* ---------------------------------------------------------------------- */ | 7 | /* ---------------------------------------------------------------------- */ |
8 | 8 | ||
9 | struct msp_dfpreg { | 9 | #define msp_err(fmt, arg...) \ |
10 | int reg; | 10 | printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \ |
11 | int value; | 11 | i2c_adapter_id(client->adapter), client->addr , ## arg) |
12 | }; | 12 | #define msp_warn(fmt, arg...) \ |
13 | printk(KERN_WARNING "%s %d-%04x: " fmt, client->driver->driver.name, \ | ||
14 | i2c_adapter_id(client->adapter), client->addr , ## arg) | ||
15 | #define msp_info(fmt, arg...) \ | ||
16 | printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \ | ||
17 | i2c_adapter_id(client->adapter), client->addr , ## arg) | ||
18 | |||
19 | /* level 1 debug. */ | ||
20 | #define msp_dbg1(fmt, arg...) \ | ||
21 | do { \ | ||
22 | if (debug) \ | ||
23 | printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->driver.name, \ | ||
24 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ | ||
25 | } while (0) | ||
26 | |||
27 | /* level 2 debug. */ | ||
28 | #define msp_dbg2(fmt, arg...) \ | ||
29 | do { \ | ||
30 | if (debug >= 2) \ | ||
31 | printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ | ||
32 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ | ||
33 | } while (0) | ||
34 | |||
35 | /* level 3 debug. Use with care. */ | ||
36 | #define msp_dbg3(fmt, arg...) \ | ||
37 | do { \ | ||
38 | if (debug >= 16) \ | ||
39 | printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ | ||
40 | i2c_adapter_id(client->adapter), client->addr , ## arg); \ | ||
41 | } while (0) | ||
13 | 42 | ||
14 | struct msp_matrix { | 43 | struct msp_matrix { |
15 | int input; | 44 | int input; |
16 | int output; | 45 | int output; |
17 | }; | 46 | }; |
18 | 47 | ||
19 | #define MSP_SET_DFPREG _IOW('m',15,struct msp_dfpreg) | ||
20 | #define MSP_GET_DFPREG _IOW('m',16,struct msp_dfpreg) | ||
21 | |||
22 | /* ioctl for MSP_SET_MATRIX will have to be registered */ | 48 | /* ioctl for MSP_SET_MATRIX will have to be registered */ |
23 | #define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix) | 49 | #define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix) |
24 | 50 | ||
51 | /* This macro is allowed for *constants* only, gcc must calculate it | ||
52 | at compile time. Remember -- no floats in kernel mode */ | ||
53 | #define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24))) | ||
54 | |||
55 | #define MSP_MODE_AM_DETECT 0 | ||
56 | #define MSP_MODE_FM_RADIO 2 | ||
57 | #define MSP_MODE_FM_TERRA 3 | ||
58 | #define MSP_MODE_FM_SAT 4 | ||
59 | #define MSP_MODE_FM_NICAM1 5 | ||
60 | #define MSP_MODE_FM_NICAM2 6 | ||
61 | #define MSP_MODE_AM_NICAM 7 | ||
62 | #define MSP_MODE_BTSC 8 | ||
63 | #define MSP_MODE_EXTERN 9 | ||
64 | |||
25 | #define SCART_MASK 0 | 65 | #define SCART_MASK 0 |
26 | #define SCART_IN1 1 | 66 | #define SCART_IN1 1 |
27 | #define SCART_IN2 2 | 67 | #define SCART_IN2 2 |
@@ -36,4 +76,77 @@ struct msp_matrix { | |||
36 | #define SCART1_OUT 1 | 76 | #define SCART1_OUT 1 |
37 | #define SCART2_OUT 2 | 77 | #define SCART2_OUT 2 |
38 | 78 | ||
79 | #define OPMODE_AUTO -1 | ||
80 | #define OPMODE_MANUAL 0 | ||
81 | #define OPMODE_AUTODETECT 1 /* use autodetect (>= msp3410 only) */ | ||
82 | #define OPMODE_AUTOSELECT 2 /* use autodetect & autoselect (>= msp34xxG) */ | ||
83 | |||
84 | /* module parameters */ | ||
85 | extern int debug; | ||
86 | extern int once; | ||
87 | extern int amsound; | ||
88 | extern int standard; | ||
89 | extern int dolby; | ||
90 | extern int stereo_threshold; | ||
91 | |||
92 | struct msp_state { | ||
93 | int rev1, rev2; | ||
94 | |||
95 | int opmode; | ||
96 | int mode; | ||
97 | int norm; | ||
98 | int stereo; | ||
99 | int nicam_on; | ||
100 | int acb; | ||
101 | int in_scart; | ||
102 | int i2s_mode; | ||
103 | int main, second; /* sound carrier */ | ||
104 | int input; | ||
105 | int source; /* see msp34xxg_set_source */ | ||
106 | |||
107 | /* v4l2 */ | ||
108 | int audmode; | ||
109 | int rxsubchans; | ||
110 | |||
111 | int muted; | ||
112 | int volume, balance; | ||
113 | int bass, treble; | ||
114 | |||
115 | /* thread */ | ||
116 | struct task_struct *kthread; | ||
117 | wait_queue_head_t wq; | ||
118 | int restart:1; | ||
119 | int watch_stereo:1; | ||
120 | }; | ||
121 | |||
122 | #define VIDEO_MODE_RADIO 16 /* norm magic for radio mode */ | ||
123 | |||
124 | #define HAVE_NICAM(state) (((state->rev2 >> 8) & 0xff) != 0) | ||
125 | #define HAVE_RADIO(state) ((state->rev1 & 0x0f) >= 'G'-'@') | ||
126 | |||
127 | /* msp3400-driver.c */ | ||
128 | int msp_write_dem(struct i2c_client *client, int addr, int val); | ||
129 | int msp_write_dsp(struct i2c_client *client, int addr, int val); | ||
130 | int msp_read_dem(struct i2c_client *client, int addr); | ||
131 | int msp_read_dsp(struct i2c_client *client, int addr); | ||
132 | int msp_reset(struct i2c_client *client); | ||
133 | void msp_set_scart(struct i2c_client *client, int in, int out); | ||
134 | void msp_set_mute(struct i2c_client *client); | ||
135 | void msp_set_audio(struct i2c_client *client); | ||
136 | int msp_modus(struct i2c_client *client, int norm); | ||
137 | int msp_standard(int norm); | ||
138 | int msp_sleep(struct msp_state *state, int timeout); | ||
139 | |||
140 | /* msp3400-kthreads.c */ | ||
141 | const char *msp_standard_mode_name(int mode); | ||
142 | void msp3400c_setcarrier(struct i2c_client *client, int cdo1, int cdo2); | ||
143 | void msp3400c_setmode(struct i2c_client *client, int type); | ||
144 | void msp3400c_setstereo(struct i2c_client *client, int mode); | ||
145 | int autodetect_stereo(struct i2c_client *client); | ||
146 | int msp3400c_thread(void *data); | ||
147 | int msp3410d_thread(void *data); | ||
148 | int msp34xxg_thread(void *data); | ||
149 | void msp34xxg_detect_stereo(struct i2c_client *client); | ||
150 | void msp34xxg_set_audmode(struct i2c_client *client, int audmode); | ||
151 | |||
39 | #endif /* MSP3400_H */ | 152 | #endif /* MSP3400_H */ |