blob: 8a05cf500a8cf8d882d830fb6cdc0c1556308a1e [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
Linus Torvalds1da177e2005-04-16 15:20:36 -07009struct msp_matrix {
10 int input;
11 int output;
12};
13
Linus Torvalds1da177e2005-04-16 15:20:36 -070014/* ioctl for MSP_SET_MATRIX will have to be registered */
15#define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix)
16
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020017/* This macro is allowed for *constants* only, gcc must calculate it
18 at compile time. Remember -- no floats in kernel mode */
19#define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24)))
20
21#define MSP_MODE_AM_DETECT 0
22#define MSP_MODE_FM_RADIO 2
23#define MSP_MODE_FM_TERRA 3
24#define MSP_MODE_FM_SAT 4
25#define MSP_MODE_FM_NICAM1 5
26#define MSP_MODE_FM_NICAM2 6
27#define MSP_MODE_AM_NICAM 7
28#define MSP_MODE_BTSC 8
29#define MSP_MODE_EXTERN 9
30
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#define SCART_MASK 0
32#define SCART_IN1 1
33#define SCART_IN2 2
34#define SCART_IN1_DA 3
35#define SCART_IN2_DA 4
36#define SCART_IN3 5
37#define SCART_IN4 6
38#define SCART_MONO 7
39#define SCART_MUTE 8
40
41#define SCART_DSP_IN 0
42#define SCART1_OUT 1
43#define SCART2_OUT 2
44
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020045#define OPMODE_AUTO -1
46#define OPMODE_MANUAL 0
47#define OPMODE_AUTODETECT 1 /* use autodetect (>= msp3410 only) */
48#define OPMODE_AUTOSELECT 2 /* use autodetect & autoselect (>= msp34xxG) */
49
50/* module parameters */
51extern int debug;
52extern int once;
53extern int amsound;
54extern int standard;
55extern int dolby;
56extern int stereo_threshold;
57
58struct msp_state {
59 int rev1, rev2;
Hans Verkuil5af0c8f2006-01-09 18:21:37 -020060 u8 has_nicam;
61 u8 has_radio;
62 u8 has_headphones;
63 u8 has_ntsc_jp_d_k3;
64 u8 has_scart4;
65 u8 has_scart23_in_scart2_out;
66 u8 has_scart2_out_volume;
67 u8 has_i2s_conf;
68 u8 has_subwoofer;
69 u8 has_sound_processing;
70 u8 has_virtual_dolby_surround;
71 u8 has_dolby_pro_logic;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020072
Hans Verkuil7560d7a2006-01-09 18:21:32 -020073 int radio;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020074 int opmode;
Hans Verkuil5af0c8f2006-01-09 18:21:37 -020075 int std;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020076 int mode;
Hans Verkuil5af0c8f2006-01-09 18:21:37 -020077 v4l2_std_id v4l2_std;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020078 int nicam_on;
79 int acb;
80 int in_scart;
81 int i2s_mode;
82 int main, second; /* sound carrier */
83 int input;
84 int source; /* see msp34xxg_set_source */
85
86 /* v4l2 */
87 int audmode;
88 int rxsubchans;
89
Hans Verkuild312a462006-01-09 18:21:36 -020090 int volume, muted;
91 int balance, loudness;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020092 int bass, treble;
93
94 /* thread */
95 struct task_struct *kthread;
96 wait_queue_head_t wq;
97 int restart:1;
98 int watch_stereo:1;
99};
100
Hans Verkuil53b0a1c2006-01-09 15:32:39 -0200101/* msp3400-driver.c */
102int msp_write_dem(struct i2c_client *client, int addr, int val);
103int msp_write_dsp(struct i2c_client *client, int addr, int val);
104int msp_read_dem(struct i2c_client *client, int addr);
105int msp_read_dsp(struct i2c_client *client, int addr);
106int msp_reset(struct i2c_client *client);
107void msp_set_scart(struct i2c_client *client, int in, int out);
108void msp_set_mute(struct i2c_client *client);
109void msp_set_audio(struct i2c_client *client);
Hans Verkuil7560d7a2006-01-09 18:21:32 -0200110int msp_modus(struct i2c_client *client);
Hans Verkuil53b0a1c2006-01-09 15:32:39 -0200111int msp_sleep(struct msp_state *state, int timeout);
112
113/* msp3400-kthreads.c */
Hans Verkuil5af0c8f2006-01-09 18:21:37 -0200114const char *msp_standard_std_name(int std);
Hans Verkuil53b0a1c2006-01-09 15:32:39 -0200115void msp3400c_setcarrier(struct i2c_client *client, int cdo1, int cdo2);
116void msp3400c_setmode(struct i2c_client *client, int type);
117void msp3400c_setstereo(struct i2c_client *client, int mode);
118int autodetect_stereo(struct i2c_client *client);
119int msp3400c_thread(void *data);
120int msp3410d_thread(void *data);
121int msp34xxg_thread(void *data);
122void msp34xxg_detect_stereo(struct i2c_client *client);
123void msp34xxg_set_audmode(struct i2c_client *client, int audmode);
124
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125#endif /* MSP3400_H */