Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[linux-2.6-block.git] / drivers / media / video / msp3400-driver.h
CommitLineData
56fc08ca 1/*
56fc08ca
MCC
2 */
3
49965a80
HV
4#ifndef MSP3400_DRIVER_H
5#define MSP3400_DRIVER_H
1da177e4 6
2474ed44 7#include <media/msp3400.h>
76efd62f 8#include <media/v4l2-device.h>
2474ed44 9
1da177e4
LT
10/* ---------------------------------------------------------------------- */
11
53b0a1c6
HV
12/* This macro is allowed for *constants* only, gcc must calculate it
13 at compile time. Remember -- no floats in kernel mode */
14#define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24)))
15
16#define MSP_MODE_AM_DETECT 0
17#define MSP_MODE_FM_RADIO 2
18#define MSP_MODE_FM_TERRA 3
19#define MSP_MODE_FM_SAT 4
20#define MSP_MODE_FM_NICAM1 5
21#define MSP_MODE_FM_NICAM2 6
22#define MSP_MODE_AM_NICAM 7
23#define MSP_MODE_BTSC 8
24#define MSP_MODE_EXTERN 9
25
42772574
HV
26#define SCART_IN1 0
27#define SCART_IN2 1
28#define SCART_IN3 2
29#define SCART_IN4 3
30#define SCART_IN1_DA 4
31#define SCART_IN2_DA 5
32#define SCART_MONO 6
33#define SCART_MUTE 7
1da177e4
LT
34
35#define SCART_DSP_IN 0
36#define SCART1_OUT 1
37#define SCART2_OUT 2
38
53b0a1c6
HV
39#define OPMODE_AUTO -1
40#define OPMODE_MANUAL 0
41#define OPMODE_AUTODETECT 1 /* use autodetect (>= msp3410 only) */
42#define OPMODE_AUTOSELECT 2 /* use autodetect & autoselect (>= msp34xxG) */
43
44/* module parameters */
f167cb4e
MCC
45extern int msp_debug;
46extern int msp_once;
47extern int msp_amsound;
48extern int msp_standard;
49extern int msp_dolby;
50extern int msp_stereo_thresh;
53b0a1c6
HV
51
52struct msp_state {
76efd62f 53 struct v4l2_subdev sd;
53b0a1c6 54 int rev1, rev2;
74cab31c 55 int ident;
5af0c8f6
HV
56 u8 has_nicam;
57 u8 has_radio;
58 u8 has_headphones;
59 u8 has_ntsc_jp_d_k3;
0020d3ef
HV
60 u8 has_scart2;
61 u8 has_scart3;
5af0c8f6 62 u8 has_scart4;
0020d3ef 63 u8 has_scart2_out;
5af0c8f6
HV
64 u8 has_scart2_out_volume;
65 u8 has_i2s_conf;
66 u8 has_subwoofer;
67 u8 has_sound_processing;
68 u8 has_virtual_dolby_surround;
69 u8 has_dolby_pro_logic;
de98cdaf 70 u8 force_btsc;
7560d7a4
HV
71
72 int radio;
53b0a1c6 73 int opmode;
5af0c8f6 74 int std;
53b0a1c6 75 int mode;
5af0c8f6 76 v4l2_std_id v4l2_std;
53b0a1c6
HV
77 int nicam_on;
78 int acb;
79 int in_scart;
80 int i2s_mode;
81 int main, second; /* sound carrier */
82 int input;
5325b427
HV
83 u32 route_in;
84 u32 route_out;
53b0a1c6
HV
85
86 /* v4l2 */
87 int audmode;
88 int rxsubchans;
89
d312a46e
HV
90 int volume, muted;
91 int balance, loudness;
53b0a1c6 92 int bass, treble;
3bbe5a83 93 int scan_in_progress;
53b0a1c6
HV
94
95 /* thread */
96 struct task_struct *kthread;
97 wait_queue_head_t wq;
0a115373
RD
98 unsigned int restart:1;
99 unsigned int watch_stereo:1;
53b0a1c6
HV
100};
101
76efd62f
HV
102static inline struct msp_state *to_state(struct v4l2_subdev *sd)
103{
104 return container_of(sd, struct msp_state, sd);
105}
106
53b0a1c6
HV
107/* msp3400-driver.c */
108int msp_write_dem(struct i2c_client *client, int addr, int val);
109int msp_write_dsp(struct i2c_client *client, int addr, int val);
110int msp_read_dem(struct i2c_client *client, int addr);
111int msp_read_dsp(struct i2c_client *client, int addr);
112int msp_reset(struct i2c_client *client);
113void msp_set_scart(struct i2c_client *client, int in, int out);
53b0a1c6 114void msp_set_audio(struct i2c_client *client);
53b0a1c6
HV
115int msp_sleep(struct msp_state *state, int timeout);
116
117/* msp3400-kthreads.c */
5af0c8f6 118const char *msp_standard_std_name(int std);
8a4b275f 119void msp_set_audmode(struct i2c_client *client);
de533ccf 120int msp_detect_stereo(struct i2c_client *client);
53b0a1c6
HV
121int msp3400c_thread(void *data);
122int msp3410d_thread(void *data);
123int msp34xxg_thread(void *data);
8a4b275f
HV
124void msp3400c_set_mode(struct i2c_client *client, int mode);
125void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2);
53b0a1c6 126
49965a80 127#endif /* MSP3400_DRIVER_H */