blob: 6fb5c8c994e7dbbca4d34f071f7b90ee43084fdc [file] [log] [blame]
Mauro Carvalho Chehab56fc08c2005-06-23 22:05:07 -07001/*
Mauro Carvalho Chehab56fc08c2005-06-23 22:05:07 -07002 */
3
Linus Torvalds1da177e2005-04-16 15:20:36 -07004#ifndef MSP3400_H
5#define MSP3400_H
6
7/* ---------------------------------------------------------------------- */
8
Hans Verkuil53b0a1c2006-01-09 15:32:39 -02009/* This macro is allowed for *constants* only, gcc must calculate it
10 at compile time. Remember -- no floats in kernel mode */
11#define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24)))
12
13#define MSP_MODE_AM_DETECT 0
14#define MSP_MODE_FM_RADIO 2
15#define MSP_MODE_FM_TERRA 3
16#define MSP_MODE_FM_SAT 4
17#define MSP_MODE_FM_NICAM1 5
18#define MSP_MODE_FM_NICAM2 6
19#define MSP_MODE_AM_NICAM 7
20#define MSP_MODE_BTSC 8
21#define MSP_MODE_EXTERN 9
22
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#define SCART_MASK 0
24#define SCART_IN1 1
25#define SCART_IN2 2
26#define SCART_IN1_DA 3
27#define SCART_IN2_DA 4
28#define SCART_IN3 5
29#define SCART_IN4 6
30#define SCART_MONO 7
31#define SCART_MUTE 8
32
33#define SCART_DSP_IN 0
34#define SCART1_OUT 1
35#define SCART2_OUT 2
36
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020037#define OPMODE_AUTO -1
38#define OPMODE_MANUAL 0
39#define OPMODE_AUTODETECT 1 /* use autodetect (>= msp3410 only) */
40#define OPMODE_AUTOSELECT 2 /* use autodetect & autoselect (>= msp34xxG) */
41
42/* module parameters */
Mauro Carvalho Chehabf167cb4e2006-01-11 19:41:49 -020043extern int msp_debug;
44extern int msp_once;
45extern int msp_amsound;
46extern int msp_standard;
47extern int msp_dolby;
48extern int msp_stereo_thresh;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020049
50struct msp_state {
51 int rev1, rev2;
Hans Verkuil5af0c8f2006-01-09 18:21:37 -020052 u8 has_nicam;
53 u8 has_radio;
54 u8 has_headphones;
55 u8 has_ntsc_jp_d_k3;
56 u8 has_scart4;
57 u8 has_scart23_in_scart2_out;
58 u8 has_scart2_out_volume;
59 u8 has_i2s_conf;
60 u8 has_subwoofer;
61 u8 has_sound_processing;
62 u8 has_virtual_dolby_surround;
63 u8 has_dolby_pro_logic;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020064
Hans Verkuil7560d7a2006-01-09 18:21:32 -020065 int radio;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020066 int opmode;
Hans Verkuil5af0c8f2006-01-09 18:21:37 -020067 int std;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020068 int mode;
Hans Verkuil5af0c8f2006-01-09 18:21:37 -020069 v4l2_std_id v4l2_std;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020070 int nicam_on;
71 int acb;
72 int in_scart;
73 int i2s_mode;
74 int main, second; /* sound carrier */
75 int input;
76 int source; /* see msp34xxg_set_source */
77
78 /* v4l2 */
79 int audmode;
80 int rxsubchans;
81
Hans Verkuild312a462006-01-09 18:21:36 -020082 int volume, muted;
83 int balance, loudness;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020084 int bass, treble;
85
86 /* thread */
87 struct task_struct *kthread;
88 wait_queue_head_t wq;
89 int restart:1;
90 int watch_stereo:1;
91};
92
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020093/* msp3400-driver.c */
94int msp_write_dem(struct i2c_client *client, int addr, int val);
95int msp_write_dsp(struct i2c_client *client, int addr, int val);
96int msp_read_dem(struct i2c_client *client, int addr);
97int msp_read_dsp(struct i2c_client *client, int addr);
98int msp_reset(struct i2c_client *client);
99void msp_set_scart(struct i2c_client *client, int in, int out);
100void msp_set_mute(struct i2c_client *client);
101void msp_set_audio(struct i2c_client *client);
Hans Verkuil7560d7a2006-01-09 18:21:32 -0200102int msp_modus(struct i2c_client *client);
Hans Verkuil53b0a1c2006-01-09 15:32:39 -0200103int msp_sleep(struct msp_state *state, int timeout);
104
105/* msp3400-kthreads.c */
Hans Verkuil5af0c8f2006-01-09 18:21:37 -0200106const char *msp_standard_std_name(int std);
Hans Verkuil8a4b2752006-01-23 17:11:09 -0200107void msp_set_audmode(struct i2c_client *client);
108void msp_detect_stereo(struct i2c_client *client);
Hans Verkuil53b0a1c2006-01-09 15:32:39 -0200109int msp3400c_thread(void *data);
110int msp3410d_thread(void *data);
111int msp34xxg_thread(void *data);
Hans Verkuil8a4b2752006-01-23 17:11:09 -0200112void msp3400c_set_mode(struct i2c_client *client, int mode);
113void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2);
Hans Verkuil53b0a1c2006-01-09 15:32:39 -0200114
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115#endif /* MSP3400_H */