4 #ifndef MSP3400_DRIVER_H
5 #define MSP3400_DRIVER_H
7 #include <media/msp3400.h>
8 #include <media/v4l2-device.h>
10 /* ---------------------------------------------------------------------- */
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)))
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
30 #define SCART_IN1_DA 4
31 #define SCART_IN2_DA 5
35 #define SCART_DSP_IN 0
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) */
44 /* module parameters */
47 extern int msp_amsound;
48 extern int msp_standard;
50 extern int msp_stereo_thresh;
53 struct v4l2_subdev sd;
64 u8 has_scart2_out_volume;
67 u8 has_sound_processing;
68 u8 has_virtual_dolby_surround;
69 u8 has_dolby_pro_logic;
81 int main, second; /* sound carrier */
83 struct v4l2_routing routing;
90 int balance, loudness;
95 struct task_struct *kthread;
97 unsigned int restart:1;
98 unsigned int watch_stereo:1;
101 static inline struct msp_state *to_state(struct v4l2_subdev *sd)
103 return container_of(sd, struct msp_state, sd);
106 /* msp3400-driver.c */
107 int msp_write_dem(struct i2c_client *client, int addr, int val);
108 int msp_write_dsp(struct i2c_client *client, int addr, int val);
109 int msp_read_dem(struct i2c_client *client, int addr);
110 int msp_read_dsp(struct i2c_client *client, int addr);
111 int msp_reset(struct i2c_client *client);
112 void msp_set_scart(struct i2c_client *client, int in, int out);
113 void msp_set_audio(struct i2c_client *client);
114 int msp_sleep(struct msp_state *state, int timeout);
116 /* msp3400-kthreads.c */
117 const char *msp_standard_std_name(int std);
118 void msp_set_audmode(struct i2c_client *client);
119 int msp_detect_stereo(struct i2c_client *client);
120 int msp3400c_thread(void *data);
121 int msp3410d_thread(void *data);
122 int msp34xxg_thread(void *data);
123 void msp3400c_set_mode(struct i2c_client *client, int mode);
124 void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2);
126 #endif /* MSP3400_DRIVER_H */