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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | #ifndef MSP3400_H |
| 5 | #define MSP3400_H |
| 6 | |
| 7 | /* ---------------------------------------------------------------------- */ |
| 8 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | struct msp_matrix { |
| 10 | int input; |
| 11 | int output; |
| 12 | }; |
| 13 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | /* ioctl for MSP_SET_MATRIX will have to be registered */ |
| 15 | #define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix) |
| 16 | |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 17 | /* This macro is allowed for *constants* only, gcc must calculate it |
| 18 | at compile time. Remember -- no floats in kernel mode */ |
| 19 | #define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24))) |
| 20 | |
| 21 | #define MSP_MODE_AM_DETECT 0 |
| 22 | #define MSP_MODE_FM_RADIO 2 |
| 23 | #define MSP_MODE_FM_TERRA 3 |
| 24 | #define MSP_MODE_FM_SAT 4 |
| 25 | #define MSP_MODE_FM_NICAM1 5 |
| 26 | #define MSP_MODE_FM_NICAM2 6 |
| 27 | #define MSP_MODE_AM_NICAM 7 |
| 28 | #define MSP_MODE_BTSC 8 |
| 29 | #define MSP_MODE_EXTERN 9 |
| 30 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | #define SCART_MASK 0 |
| 32 | #define SCART_IN1 1 |
| 33 | #define SCART_IN2 2 |
| 34 | #define SCART_IN1_DA 3 |
| 35 | #define SCART_IN2_DA 4 |
| 36 | #define SCART_IN3 5 |
| 37 | #define SCART_IN4 6 |
| 38 | #define SCART_MONO 7 |
| 39 | #define SCART_MUTE 8 |
| 40 | |
| 41 | #define SCART_DSP_IN 0 |
| 42 | #define SCART1_OUT 1 |
| 43 | #define SCART2_OUT 2 |
| 44 | |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 45 | #define OPMODE_AUTO -1 |
| 46 | #define OPMODE_MANUAL 0 |
| 47 | #define OPMODE_AUTODETECT 1 /* use autodetect (>= msp3410 only) */ |
| 48 | #define OPMODE_AUTOSELECT 2 /* use autodetect & autoselect (>= msp34xxG) */ |
| 49 | |
| 50 | /* module parameters */ |
| 51 | extern int debug; |
| 52 | extern int once; |
| 53 | extern int amsound; |
| 54 | extern int standard; |
| 55 | extern int dolby; |
| 56 | extern int stereo_threshold; |
| 57 | |
| 58 | struct msp_state { |
| 59 | int rev1, rev2; |
Hans Verkuil | 5af0c8f | 2006-01-09 18:21:37 -0200 | [diff] [blame] | 60 | u8 has_nicam; |
| 61 | u8 has_radio; |
| 62 | u8 has_headphones; |
| 63 | u8 has_ntsc_jp_d_k3; |
| 64 | u8 has_scart4; |
| 65 | u8 has_scart23_in_scart2_out; |
| 66 | u8 has_scart2_out_volume; |
| 67 | u8 has_i2s_conf; |
| 68 | u8 has_subwoofer; |
| 69 | u8 has_sound_processing; |
| 70 | u8 has_virtual_dolby_surround; |
| 71 | u8 has_dolby_pro_logic; |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 72 | |
Hans Verkuil | 7560d7a | 2006-01-09 18:21:32 -0200 | [diff] [blame] | 73 | int radio; |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 74 | int opmode; |
Hans Verkuil | 5af0c8f | 2006-01-09 18:21:37 -0200 | [diff] [blame] | 75 | int std; |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 76 | int mode; |
Hans Verkuil | 5af0c8f | 2006-01-09 18:21:37 -0200 | [diff] [blame] | 77 | v4l2_std_id v4l2_std; |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 78 | int nicam_on; |
| 79 | int acb; |
| 80 | int in_scart; |
| 81 | int i2s_mode; |
| 82 | int main, second; /* sound carrier */ |
| 83 | int input; |
| 84 | int source; /* see msp34xxg_set_source */ |
| 85 | |
| 86 | /* v4l2 */ |
| 87 | int audmode; |
| 88 | int rxsubchans; |
| 89 | |
Hans Verkuil | d312a46 | 2006-01-09 18:21:36 -0200 | [diff] [blame] | 90 | int volume, muted; |
| 91 | int balance, loudness; |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 92 | int bass, treble; |
| 93 | |
| 94 | /* thread */ |
| 95 | struct task_struct *kthread; |
| 96 | wait_queue_head_t wq; |
| 97 | int restart:1; |
| 98 | int watch_stereo:1; |
| 99 | }; |
| 100 | |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 101 | /* msp3400-driver.c */ |
| 102 | int msp_write_dem(struct i2c_client *client, int addr, int val); |
| 103 | int msp_write_dsp(struct i2c_client *client, int addr, int val); |
| 104 | int msp_read_dem(struct i2c_client *client, int addr); |
| 105 | int msp_read_dsp(struct i2c_client *client, int addr); |
| 106 | int msp_reset(struct i2c_client *client); |
| 107 | void msp_set_scart(struct i2c_client *client, int in, int out); |
| 108 | void msp_set_mute(struct i2c_client *client); |
| 109 | void msp_set_audio(struct i2c_client *client); |
Hans Verkuil | 7560d7a | 2006-01-09 18:21:32 -0200 | [diff] [blame] | 110 | int msp_modus(struct i2c_client *client); |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 111 | int msp_sleep(struct msp_state *state, int timeout); |
| 112 | |
| 113 | /* msp3400-kthreads.c */ |
Hans Verkuil | 5af0c8f | 2006-01-09 18:21:37 -0200 | [diff] [blame] | 114 | const char *msp_standard_std_name(int std); |
Hans Verkuil | 53b0a1c | 2006-01-09 15:32:39 -0200 | [diff] [blame] | 115 | void msp3400c_setcarrier(struct i2c_client *client, int cdo1, int cdo2); |
| 116 | void msp3400c_setmode(struct i2c_client *client, int type); |
| 117 | void msp3400c_setstereo(struct i2c_client *client, int mode); |
| 118 | int autodetect_stereo(struct i2c_client *client); |
| 119 | int msp3400c_thread(void *data); |
| 120 | int msp3410d_thread(void *data); |
| 121 | int msp34xxg_thread(void *data); |
| 122 | void msp34xxg_detect_stereo(struct i2c_client *client); |
| 123 | void msp34xxg_set_audmode(struct i2c_client *client, int audmode); |
| 124 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | #endif /* MSP3400_H */ |