Mauro Carvalho Chehab | 56fc08c | 2005-06-23 22:05:07 -0700 | [diff] [blame] | 1 | /* |
Mauro Carvalho Chehab | 56fc08c | 2005-06-23 22:05:07 -0700 | [diff] [blame] | 2 | */ |
| 3 | |
Hans Verkuil | 49965a8 | 2006-03-19 08:45:38 -0300 | [diff] [blame^] | 4 | #ifndef MSP3400_DRIVER_H |
| 5 | #define MSP3400_DRIVER_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | |
| 7 | /* ---------------------------------------------------------------------- */ |
| 8 | |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 9 | /* 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 Verkuil | 4277257 | 2006-03-19 06:48:51 -0300 | [diff] [blame] | 23 | #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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
| 32 | #define SCART_DSP_IN 0 |
| 33 | #define SCART1_OUT 1 |
| 34 | #define SCART2_OUT 2 |
| 35 | |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 36 | #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 Chehab | f167cb4 | 2006-01-11 19:41:49 -0200 | [diff] [blame] | 42 | extern int msp_debug; |
| 43 | extern int msp_once; |
| 44 | extern int msp_amsound; |
| 45 | extern int msp_standard; |
| 46 | extern int msp_dolby; |
| 47 | extern int msp_stereo_thresh; |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 48 | |
| 49 | struct msp_state { |
| 50 | int rev1, rev2; |
Hans Verkuil | 5af0c8f | 2006-01-09 18:21:37 -0200 | [diff] [blame] | 51 | 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 Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 63 | |
Hans Verkuil | 7560d7a | 2006-01-09 18:21:32 -0200 | [diff] [blame] | 64 | int radio; |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 65 | int opmode; |
Hans Verkuil | 5af0c8f | 2006-01-09 18:21:37 -0200 | [diff] [blame] | 66 | int std; |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 67 | int mode; |
Hans Verkuil | 5af0c8f | 2006-01-09 18:21:37 -0200 | [diff] [blame] | 68 | v4l2_std_id v4l2_std; |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 69 | 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 Verkuil | d312a46 | 2006-01-09 18:21:36 -0200 | [diff] [blame] | 81 | int volume, muted; |
| 82 | int balance, loudness; |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 83 | 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 Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 92 | /* msp3400-driver.c */ |
| 93 | int msp_write_dem(struct i2c_client *client, int addr, int val); |
| 94 | int msp_write_dsp(struct i2c_client *client, int addr, int val); |
| 95 | int msp_read_dem(struct i2c_client *client, int addr); |
| 96 | int msp_read_dsp(struct i2c_client *client, int addr); |
| 97 | int msp_reset(struct i2c_client *client); |
| 98 | void msp_set_scart(struct i2c_client *client, int in, int out); |
| 99 | void msp_set_mute(struct i2c_client *client); |
| 100 | void msp_set_audio(struct i2c_client *client); |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 101 | int msp_sleep(struct msp_state *state, int timeout); |
| 102 | |
| 103 | /* msp3400-kthreads.c */ |
Hans Verkuil | 5af0c8f | 2006-01-09 18:21:37 -0200 | [diff] [blame] | 104 | const char *msp_standard_std_name(int std); |
Hans Verkuil | 8a4b275 | 2006-01-23 17:11:09 -0200 | [diff] [blame] | 105 | void msp_set_audmode(struct i2c_client *client); |
Hans Verkuil | de533cc | 2006-03-19 08:21:56 -0300 | [diff] [blame] | 106 | int msp_detect_stereo(struct i2c_client *client); |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 107 | int msp3400c_thread(void *data); |
| 108 | int msp3410d_thread(void *data); |
| 109 | int msp34xxg_thread(void *data); |
Hans Verkuil | 8a4b275 | 2006-01-23 17:11:09 -0200 | [diff] [blame] | 110 | void msp3400c_set_mode(struct i2c_client *client, int mode); |
| 111 | void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2); |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 112 | |
Hans Verkuil | 49965a8 | 2006-03-19 08:45:38 -0300 | [diff] [blame^] | 113 | #endif /* MSP3400_DRIVER_H */ |