4 #ifndef MSP3400_DRIVER_H
5 #define MSP3400_DRIVER_H
7 #include <media/msp3400.h>
8 #include <media/v4l2-device.h>
9 #include <media/v4l2-ctrls.h>
11 /* ---------------------------------------------------------------------- */
13 /* This macro is allowed for *constants* only, gcc must calculate it
14 at compile time. Remember -- no floats in kernel mode */
15 #define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24)))
17 #define MSP_MODE_AM_DETECT 0
18 #define MSP_MODE_FM_RADIO 2
19 #define MSP_MODE_FM_TERRA 3
20 #define MSP_MODE_FM_SAT 4
21 #define MSP_MODE_FM_NICAM1 5
22 #define MSP_MODE_FM_NICAM2 6
23 #define MSP_MODE_AM_NICAM 7
24 #define MSP_MODE_BTSC 8
25 #define MSP_MODE_EXTERN 9
31 #define SCART_IN1_DA 4
32 #define SCART_IN2_DA 5
36 #define SCART_DSP_IN 0
40 #define OPMODE_AUTO -1
41 #define OPMODE_MANUAL 0
42 #define OPMODE_AUTODETECT 1 /* use autodetect (>= msp3410 only) */
43 #define OPMODE_AUTOSELECT 2 /* use autodetect & autoselect (>= msp34xxG) */
45 /* module parameters */
48 extern bool msp_amsound
;
49 extern int msp_standard
;
50 extern bool msp_dolby
;
51 extern int msp_stereo_thresh
;
54 struct v4l2_subdev sd
;
55 struct v4l2_ctrl_handler hdl
;
66 u8 has_scart2_out_volume
;
69 u8 has_sound_processing
;
70 u8 has_virtual_dolby_surround
;
71 u8 has_dolby_pro_logic
;
78 v4l2_std_id v4l2_std
, detected_std
;
83 int main
, second
; /* sound carrier */
94 struct v4l2_ctrl
*volume
;
95 struct v4l2_ctrl
*muted
;
101 struct task_struct
*kthread
;
102 wait_queue_head_t wq
;
103 unsigned int restart
:1;
104 unsigned int watch_stereo
:1;
107 static inline struct msp_state
*to_state(struct v4l2_subdev
*sd
)
109 return container_of(sd
, struct msp_state
, sd
);
112 static inline struct msp_state
*ctrl_to_state(struct v4l2_ctrl
*ctrl
)
114 return container_of(ctrl
->handler
, struct msp_state
, hdl
);
117 /* msp3400-driver.c */
118 int msp_write_dem(struct i2c_client
*client
, int addr
, int val
);
119 int msp_write_dsp(struct i2c_client
*client
, int addr
, int val
);
120 int msp_read_dem(struct i2c_client
*client
, int addr
);
121 int msp_read_dsp(struct i2c_client
*client
, int addr
);
122 int msp_reset(struct i2c_client
*client
);
123 void msp_set_scart(struct i2c_client
*client
, int in
, int out
);
124 void msp_update_volume(struct msp_state
*state
);
125 int msp_sleep(struct msp_state
*state
, int timeout
);
127 /* msp3400-kthreads.c */
128 const char *msp_standard_std_name(int std
);
129 void msp_set_audmode(struct i2c_client
*client
);
130 int msp_detect_stereo(struct i2c_client
*client
);
131 int msp3400c_thread(void *data
);
132 int msp3410d_thread(void *data
);
133 int msp34xxg_thread(void *data
);
134 void msp3400c_set_mode(struct i2c_client
*client
, int mode
);
135 void msp3400c_set_carrier(struct i2c_client
*client
, int cdo1
, int cdo2
);
137 #endif /* MSP3400_DRIVER_H */