msp3400-driver.h 2.9 KB
Newer Older
1 2 3
/*
 */

4 5
#ifndef MSP3400_DRIVER_H
#define MSP3400_DRIVER_H
L
Linus Torvalds 已提交
6

7 8
#include <media/msp3400.h>

L
Linus Torvalds 已提交
9 10
/* ---------------------------------------------------------------------- */

11 12 13 14 15 16 17 18 19 20 21 22 23 24
/* This macro is allowed for *constants* only, gcc must calculate it
   at compile time.  Remember -- no floats in kernel mode */
#define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24)))

#define MSP_MODE_AM_DETECT   0
#define MSP_MODE_FM_RADIO    2
#define MSP_MODE_FM_TERRA    3
#define MSP_MODE_FM_SAT      4
#define MSP_MODE_FM_NICAM1   5
#define MSP_MODE_FM_NICAM2   6
#define MSP_MODE_AM_NICAM    7
#define MSP_MODE_BTSC        8
#define MSP_MODE_EXTERN      9

25 26 27 28 29 30 31 32
#define SCART_IN1     0
#define SCART_IN2     1
#define SCART_IN3     2
#define SCART_IN4     3
#define SCART_IN1_DA  4
#define SCART_IN2_DA  5
#define SCART_MONO    6
#define SCART_MUTE    7
L
Linus Torvalds 已提交
33 34 35 36 37

#define SCART_DSP_IN  0
#define SCART1_OUT    1
#define SCART2_OUT    2

38 39 40 41 42 43
#define OPMODE_AUTO       -1
#define OPMODE_MANUAL      0
#define OPMODE_AUTODETECT  1   /* use autodetect (>= msp3410 only) */
#define OPMODE_AUTOSELECT  2   /* use autodetect & autoselect (>= msp34xxG)   */

/* module parameters */
M
 
Mauro Carvalho Chehab 已提交
44 45 46 47 48 49
extern int msp_debug;
extern int msp_once;
extern int msp_amsound;
extern int msp_standard;
extern int msp_dolby;
extern int msp_stereo_thresh;
50 51 52

struct msp_state {
	int rev1, rev2;
53 54 55 56
	u8 has_nicam;
	u8 has_radio;
	u8 has_headphones;
	u8 has_ntsc_jp_d_k3;
57 58
	u8 has_scart2;
	u8 has_scart3;
59
	u8 has_scart4;
60
	u8 has_scart2_out;
61 62 63 64 65 66
	u8 has_scart2_out_volume;
	u8 has_i2s_conf;
	u8 has_subwoofer;
	u8 has_sound_processing;
	u8 has_virtual_dolby_surround;
	u8 has_dolby_pro_logic;
67 68

	int radio;
69
	int opmode;
70
	int std;
71
	int mode;
72
	v4l2_std_id v4l2_std;
73 74 75 76 77 78
	int nicam_on;
	int acb;
	int in_scart;
	int i2s_mode;
	int main, second;	/* sound carrier */
	int input;
79
	struct v4l2_routing routing;
80 81 82 83 84

	/* v4l2 */
	int audmode;
	int rxsubchans;

85 86
	int volume, muted;
	int balance, loudness;
87
	int bass, treble;
88
	int scan_in_progress;
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107

	/* thread */
	struct task_struct   *kthread;
	wait_queue_head_t    wq;
	int                  restart:1;
	int                  watch_stereo:1;
};

/* msp3400-driver.c */
int msp_write_dem(struct i2c_client *client, int addr, int val);
int msp_write_dsp(struct i2c_client *client, int addr, int val);
int msp_read_dem(struct i2c_client *client, int addr);
int msp_read_dsp(struct i2c_client *client, int addr);
int msp_reset(struct i2c_client *client);
void msp_set_scart(struct i2c_client *client, int in, int out);
void msp_set_audio(struct i2c_client *client);
int msp_sleep(struct msp_state *state, int timeout);

/* msp3400-kthreads.c */
108
const char *msp_standard_std_name(int std);
109
void msp_set_audmode(struct i2c_client *client);
110
int msp_detect_stereo(struct i2c_client *client);
111 112 113
int msp3400c_thread(void *data);
int msp3410d_thread(void *data);
int msp34xxg_thread(void *data);
114 115
void msp3400c_set_mode(struct i2c_client *client, int mode);
void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2);
116

117
#endif /* MSP3400_DRIVER_H */