blob: b5834938df7db6f97c51a2d50c74c98d666e713f [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
Hans Verkuil2474ed42006-03-19 12:35:57 -03007#include <media/msp3400.h>
8
Linus Torvalds1da177e2005-04-16 15:20:36 -07009/* ---------------------------------------------------------------------- */
10
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020011/* This macro is allowed for *constants* only, gcc must calculate it
12 at compile time. Remember -- no floats in kernel mode */
13#define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24)))
14
15#define MSP_MODE_AM_DETECT 0
16#define MSP_MODE_FM_RADIO 2
17#define MSP_MODE_FM_TERRA 3
18#define MSP_MODE_FM_SAT 4
19#define MSP_MODE_FM_NICAM1 5
20#define MSP_MODE_FM_NICAM2 6
21#define MSP_MODE_AM_NICAM 7
22#define MSP_MODE_BTSC 8
23#define MSP_MODE_EXTERN 9
24
Hans Verkuil42772572006-03-19 06:48:51 -030025#define SCART_IN1 0
26#define SCART_IN2 1
27#define SCART_IN3 2
28#define SCART_IN4 3
29#define SCART_IN1_DA 4
30#define SCART_IN2_DA 5
31#define SCART_MONO 6
32#define SCART_MUTE 7
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
34#define SCART_DSP_IN 0
35#define SCART1_OUT 1
36#define SCART2_OUT 2
37
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020038#define OPMODE_AUTO -1
39#define OPMODE_MANUAL 0
40#define OPMODE_AUTODETECT 1 /* use autodetect (>= msp3410 only) */
41#define OPMODE_AUTOSELECT 2 /* use autodetect & autoselect (>= msp34xxG) */
42
43/* module parameters */
Mauro Carvalho Chehabf167cb4e2006-01-11 19:41:49 -020044extern int msp_debug;
45extern int msp_once;
46extern int msp_amsound;
47extern int msp_standard;
48extern int msp_dolby;
49extern int msp_stereo_thresh;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020050
51struct msp_state {
52 int rev1, rev2;
Hans Verkuil5af0c8f2006-01-09 18:21:37 -020053 u8 has_nicam;
54 u8 has_radio;
55 u8 has_headphones;
56 u8 has_ntsc_jp_d_k3;
Hans Verkuil0020d3e2006-03-30 19:50:34 -030057 u8 has_scart2;
58 u8 has_scart3;
Hans Verkuil5af0c8f2006-01-09 18:21:37 -020059 u8 has_scart4;
Hans Verkuil0020d3e2006-03-30 19:50:34 -030060 u8 has_scart2_out;
Hans Verkuil5af0c8f2006-01-09 18:21:37 -020061 u8 has_scart2_out_volume;
62 u8 has_i2s_conf;
63 u8 has_subwoofer;
64 u8 has_sound_processing;
65 u8 has_virtual_dolby_surround;
66 u8 has_dolby_pro_logic;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020067
Hans Verkuil7560d7a2006-01-09 18:21:32 -020068 int radio;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020069 int opmode;
Hans Verkuil5af0c8f2006-01-09 18:21:37 -020070 int std;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020071 int mode;
Hans Verkuil5af0c8f2006-01-09 18:21:37 -020072 v4l2_std_id v4l2_std;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020073 int nicam_on;
74 int acb;
75 int in_scart;
76 int i2s_mode;
77 int main, second; /* sound carrier */
78 int input;
Hans Verkuil2474ed42006-03-19 12:35:57 -030079 struct v4l2_routing routing;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020080
81 /* v4l2 */
82 int audmode;
83 int rxsubchans;
84
Hans Verkuild312a462006-01-09 18:21:36 -020085 int volume, muted;
86 int balance, loudness;
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020087 int bass, treble;
88
89 /* thread */
90 struct task_struct *kthread;
91 wait_queue_head_t wq;
92 int restart:1;
93 int watch_stereo:1;
94};
95
Hans Verkuil53b0a1c2006-01-09 15:32:39 -020096/* msp3400-driver.c */
97int msp_write_dem(struct i2c_client *client, int addr, int val);
98int msp_write_dsp(struct i2c_client *client, int addr, int val);
99int msp_read_dem(struct i2c_client *client, int addr);
100int msp_read_dsp(struct i2c_client *client, int addr);
101int msp_reset(struct i2c_client *client);
102void msp_set_scart(struct i2c_client *client, int in, int out);
Hans Verkuil53b0a1c2006-01-09 15:32:39 -0200103void msp_set_audio(struct i2c_client *client);
Hans Verkuil53b0a1c2006-01-09 15:32:39 -0200104int msp_sleep(struct msp_state *state, int timeout);
105
106/* msp3400-kthreads.c */
Hans Verkuil5af0c8f2006-01-09 18:21:37 -0200107const char *msp_standard_std_name(int std);
Hans Verkuil8a4b2752006-01-23 17:11:09 -0200108void msp_set_audmode(struct i2c_client *client);
Hans Verkuilde533cc2006-03-19 08:21:56 -0300109int msp_detect_stereo(struct i2c_client *client);
Hans Verkuil53b0a1c2006-01-09 15:32:39 -0200110int msp3400c_thread(void *data);
111int msp3410d_thread(void *data);
112int msp34xxg_thread(void *data);
Hans Verkuil8a4b2752006-01-23 17:11:09 -0200113void msp3400c_set_mode(struct i2c_client *client, int mode);
114void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2);
Hans Verkuil53b0a1c2006-01-09 15:32:39 -0200115
Hans Verkuil49965a82006-03-19 08:45:38 -0300116#endif /* MSP3400_DRIVER_H */