]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/media/i2c/msp3400-driver.h
[media] include/media: split I2C headers from V4L2 core
[mirror_ubuntu-artful-kernel.git] / drivers / media / i2c / msp3400-driver.h
CommitLineData
56fc08ca 1/*
56fc08ca
MCC
2 */
3
49965a80
HV
4#ifndef MSP3400_DRIVER_H
5#define MSP3400_DRIVER_H
1da177e4 6
2474ed44 7#include <media/msp3400.h>
76efd62f 8#include <media/v4l2-device.h>
ebc3bba5 9#include <media/v4l2-ctrls.h>
2474ed44 10
1da177e4
LT
11/* ---------------------------------------------------------------------- */
12
53b0a1c6
HV
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)))
16
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
26
42772574
HV
27#define SCART_IN1 0
28#define SCART_IN2 1
29#define SCART_IN3 2
30#define SCART_IN4 3
31#define SCART_IN1_DA 4
32#define SCART_IN2_DA 5
33#define SCART_MONO 6
34#define SCART_MUTE 7
1da177e4
LT
35
36#define SCART_DSP_IN 0
37#define SCART1_OUT 1
38#define SCART2_OUT 2
39
53b0a1c6
HV
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) */
44
45/* module parameters */
f167cb4e 46extern int msp_debug;
90ab5ee9
RR
47extern bool msp_once;
48extern bool msp_amsound;
f167cb4e 49extern int msp_standard;
90ab5ee9 50extern bool msp_dolby;
f167cb4e 51extern int msp_stereo_thresh;
53b0a1c6
HV
52
53struct msp_state {
76efd62f 54 struct v4l2_subdev sd;
ebc3bba5 55 struct v4l2_ctrl_handler hdl;
53b0a1c6 56 int rev1, rev2;
74cab31c 57 int ident;
5af0c8f6
HV
58 u8 has_nicam;
59 u8 has_radio;
60 u8 has_headphones;
61 u8 has_ntsc_jp_d_k3;
0020d3ef
HV
62 u8 has_scart2;
63 u8 has_scart3;
5af0c8f6 64 u8 has_scart4;
0020d3ef 65 u8 has_scart2_out;
5af0c8f6
HV
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;
de98cdaf 72 u8 force_btsc;
7560d7a4
HV
73
74 int radio;
53b0a1c6 75 int opmode;
5af0c8f6 76 int std;
53b0a1c6 77 int mode;
5d1ed986 78 v4l2_std_id v4l2_std, detected_std;
53b0a1c6
HV
79 int nicam_on;
80 int acb;
81 int in_scart;
82 int i2s_mode;
83 int main, second; /* sound carrier */
84 int input;
5325b427
HV
85 u32 route_in;
86 u32 route_out;
53b0a1c6
HV
87
88 /* v4l2 */
89 int audmode;
90 int rxsubchans;
91
ebc3bba5
HV
92 struct {
93 /* volume cluster */
94 struct v4l2_ctrl *volume;
95 struct v4l2_ctrl *muted;
96 };
97
3bbe5a83 98 int scan_in_progress;
53b0a1c6
HV
99
100 /* thread */
101 struct task_struct *kthread;
102 wait_queue_head_t wq;
0a115373
RD
103 unsigned int restart:1;
104 unsigned int watch_stereo:1;
53b0a1c6
HV
105};
106
76efd62f
HV
107static inline struct msp_state *to_state(struct v4l2_subdev *sd)
108{
109 return container_of(sd, struct msp_state, sd);
110}
111
ebc3bba5
HV
112static inline struct msp_state *ctrl_to_state(struct v4l2_ctrl *ctrl)
113{
114 return container_of(ctrl->handler, struct msp_state, hdl);
115}
116
53b0a1c6
HV
117/* msp3400-driver.c */
118int msp_write_dem(struct i2c_client *client, int addr, int val);
119int msp_write_dsp(struct i2c_client *client, int addr, int val);
120int msp_read_dem(struct i2c_client *client, int addr);
121int msp_read_dsp(struct i2c_client *client, int addr);
122int msp_reset(struct i2c_client *client);
123void msp_set_scart(struct i2c_client *client, int in, int out);
ebc3bba5 124void msp_update_volume(struct msp_state *state);
53b0a1c6
HV
125int msp_sleep(struct msp_state *state, int timeout);
126
127/* msp3400-kthreads.c */
5af0c8f6 128const char *msp_standard_std_name(int std);
8a4b275f 129void msp_set_audmode(struct i2c_client *client);
de533ccf 130int msp_detect_stereo(struct i2c_client *client);
53b0a1c6
HV
131int msp3400c_thread(void *data);
132int msp3410d_thread(void *data);
133int msp34xxg_thread(void *data);
8a4b275f
HV
134void msp3400c_set_mode(struct i2c_client *client, int mode);
135void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2);
53b0a1c6 136
49965a80 137#endif /* MSP3400_DRIVER_H */