blob: 04821ebfe04a1aa80a4416c1202b74677b10968a [file] [log] [blame]
Mauro Carvalho Chehab56fc08c2005-06-23 22:05:07 -07001/*
Mauro Carvalho Chehab56fc08c2005-06-23 22:05:07 -07002 */
3
Hans Verkuil49965a82006-03-19 08:45:38 -03004#ifndef MSP3400_DRIVER_H
5#define MSP3400_DRIVER_H
Linus Torvalds1da177e2005-04-16 15:20:36 -07006
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
Hans Verkuil42772572006-03-19 06:48:51 -030023#define SCART_IN1 0
24#define SCART_IN2 1
25#define SCART_IN3 2
26#define SCART_IN4 3
27#define SCART_IN1_DA 4
28#define SCART_IN2_DA 5
29#define SCART_MONO 6
30#define SCART_MUTE 7
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
32#define SCART_DSP_IN 0
33#define SCART1_OUT 1
34#define SCART2_OUT 2
35
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020036#define OPMODE_AUTO -1
37#define OPMODE_MANUAL 0
38#define OPMODE_AUTODETECT 1 /* use autodetect (>= msp3410 only) */
39#define OPMODE_AUTOSELECT 2 /* use autodetect & autoselect (>= msp34xxG) */
40
41/* module parameters */
Mauro Carvalho Chehabf167cb42006-01-11 19:41:49 -020042extern int msp_debug;
43extern int msp_once;
44extern int msp_amsound;
45extern int msp_standard;
46extern int msp_dolby;
47extern int msp_stereo_thresh;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020048
49struct msp_state {
50 int rev1, rev2;
Hans Verkuil5af0c8f2006-01-09 18:21:37 -020051 u8 has_nicam;
52 u8 has_radio;
53 u8 has_headphones;
54 u8 has_ntsc_jp_d_k3;
55 u8 has_scart4;
56 u8 has_scart23_in_scart2_out;
57 u8 has_scart2_out_volume;
58 u8 has_i2s_conf;
59 u8 has_subwoofer;
60 u8 has_sound_processing;
61 u8 has_virtual_dolby_surround;
62 u8 has_dolby_pro_logic;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020063
Hans Verkuil7560d7a2006-01-09 18:21:32 -020064 int radio;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020065 int opmode;
Hans Verkuil5af0c8f2006-01-09 18:21:37 -020066 int std;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020067 int mode;
Hans Verkuil5af0c8f2006-01-09 18:21:37 -020068 v4l2_std_id v4l2_std;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020069 int nicam_on;
70 int acb;
71 int in_scart;
72 int i2s_mode;
73 int main, second; /* sound carrier */
74 int input;
75 int source; /* see msp34xxg_set_source */
76
77 /* v4l2 */
78 int audmode;
79 int rxsubchans;
80
Hans Verkuild312a462006-01-09 18:21:36 -020081 int volume, muted;
82 int balance, loudness;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020083 int bass, treble;
84
85 /* thread */
86 struct task_struct *kthread;
87 wait_queue_head_t wq;
88 int restart:1;
89 int watch_stereo:1;
90};
91
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020092/* msp3400-driver.c */
93int msp_write_dem(struct i2c_client *client, int addr, int val);
94int msp_write_dsp(struct i2c_client *client, int addr, int val);
95int msp_read_dem(struct i2c_client *client, int addr);
96int msp_read_dsp(struct i2c_client *client, int addr);
97int msp_reset(struct i2c_client *client);
98void msp_set_scart(struct i2c_client *client, int in, int out);
99void msp_set_mute(struct i2c_client *client);
100void msp_set_audio(struct i2c_client *client);
Hans Verkuil53b0a1c2006-01-09 15:32:39 -0200101int msp_sleep(struct msp_state *state, int timeout);
102
103/* msp3400-kthreads.c */
Hans Verkuil5af0c8f2006-01-09 18:21:37 -0200104const char *msp_standard_std_name(int std);
Hans Verkuil8a4b2752006-01-23 17:11:09 -0200105void msp_set_audmode(struct i2c_client *client);
Hans Verkuilde533cc2006-03-19 08:21:56 -0300106int msp_detect_stereo(struct i2c_client *client);
Hans Verkuil53b0a1c2006-01-09 15:32:39 -0200107int msp3400c_thread(void *data);
108int msp3410d_thread(void *data);
109int msp34xxg_thread(void *data);
Hans Verkuil8a4b2752006-01-23 17:11:09 -0200110void msp3400c_set_mode(struct i2c_client *client, int mode);
111void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2);
Hans Verkuil53b0a1c2006-01-09 15:32:39 -0200112
Hans Verkuil49965a82006-03-19 08:45:38 -0300113#endif /* MSP3400_DRIVER_H */