perf tools: Don't clone maps from parent when synthesizing forks
[linux/fpc-iii.git] / drivers / media / i2c / msp3400-driver.h
blobb6c7698bce5a1fe983d97e88e6176b9806be001b
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 */
5 #ifndef MSP3400_DRIVER_H
6 #define MSP3400_DRIVER_H
8 #include <media/drv-intf/msp3400.h>
9 #include <media/v4l2-device.h>
10 #include <media/v4l2-ctrls.h>
11 #include <media/v4l2-mc.h>
13 /* ---------------------------------------------------------------------- */
15 /* This macro is allowed for *constants* only, gcc must calculate it
16 at compile time. Remember -- no floats in kernel mode */
17 #define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24)))
19 #define MSP_MODE_AM_DETECT 0
20 #define MSP_MODE_FM_RADIO 2
21 #define MSP_MODE_FM_TERRA 3
22 #define MSP_MODE_FM_SAT 4
23 #define MSP_MODE_FM_NICAM1 5
24 #define MSP_MODE_FM_NICAM2 6
25 #define MSP_MODE_AM_NICAM 7
26 #define MSP_MODE_BTSC 8
27 #define MSP_MODE_EXTERN 9
29 #define SCART_IN1 0
30 #define SCART_IN2 1
31 #define SCART_IN3 2
32 #define SCART_IN4 3
33 #define SCART_IN1_DA 4
34 #define SCART_IN2_DA 5
35 #define SCART_MONO 6
36 #define SCART_MUTE 7
38 #define SCART_DSP_IN 0
39 #define SCART1_OUT 1
40 #define SCART2_OUT 2
42 #define OPMODE_AUTO -1
43 #define OPMODE_MANUAL 0
44 #define OPMODE_AUTODETECT 1 /* use autodetect (>= msp3410 only) */
45 #define OPMODE_AUTOSELECT 2 /* use autodetect & autoselect (>= msp34xxG) */
47 /* module parameters */
48 extern int msp_debug;
49 extern bool msp_once;
50 extern bool msp_amsound;
51 extern int msp_standard;
52 extern bool msp_dolby;
53 extern int msp_stereo_thresh;
55 struct msp_state {
56 struct v4l2_subdev sd;
57 struct v4l2_ctrl_handler hdl;
58 int rev1, rev2;
59 int ident;
60 u8 has_nicam;
61 u8 has_radio;
62 u8 has_headphones;
63 u8 has_ntsc_jp_d_k3;
64 u8 has_scart2;
65 u8 has_scart3;
66 u8 has_scart4;
67 u8 has_scart2_out;
68 u8 has_scart2_out_volume;
69 u8 has_i2s_conf;
70 u8 has_subwoofer;
71 u8 has_sound_processing;
72 u8 has_virtual_dolby_surround;
73 u8 has_dolby_pro_logic;
74 u8 force_btsc;
76 int radio;
77 int opmode;
78 int std;
79 int mode;
80 v4l2_std_id v4l2_std, detected_std;
81 int nicam_on;
82 int acb;
83 int in_scart;
84 int i2s_mode;
85 int main, second; /* sound carrier */
86 int input;
87 u32 route_in;
88 u32 route_out;
90 /* v4l2 */
91 int audmode;
92 int rxsubchans;
94 struct {
95 /* volume cluster */
96 struct v4l2_ctrl *volume;
97 struct v4l2_ctrl *muted;
100 int scan_in_progress;
102 /* thread */
103 struct task_struct *kthread;
104 wait_queue_head_t wq;
105 unsigned int restart:1;
106 unsigned int watch_stereo:1;
108 #if IS_ENABLED(CONFIG_MEDIA_CONTROLLER)
109 struct media_pad pads[IF_AUD_DEC_PAD_NUM_PADS];
110 #endif
113 static inline struct msp_state *to_state(struct v4l2_subdev *sd)
115 return container_of(sd, struct msp_state, sd);
118 static inline struct msp_state *ctrl_to_state(struct v4l2_ctrl *ctrl)
120 return container_of(ctrl->handler, struct msp_state, hdl);
123 /* msp3400-driver.c */
124 int msp_write_dem(struct i2c_client *client, int addr, int val);
125 int msp_write_dsp(struct i2c_client *client, int addr, int val);
126 int msp_read_dem(struct i2c_client *client, int addr);
127 int msp_read_dsp(struct i2c_client *client, int addr);
128 int msp_reset(struct i2c_client *client);
129 void msp_set_scart(struct i2c_client *client, int in, int out);
130 void msp_update_volume(struct msp_state *state);
131 int msp_sleep(struct msp_state *state, int timeout);
133 /* msp3400-kthreads.c */
134 const char *msp_standard_std_name(int std);
135 void msp_set_audmode(struct i2c_client *client);
136 int msp_detect_stereo(struct i2c_client *client);
137 int msp3400c_thread(void *data);
138 int msp3410d_thread(void *data);
139 int msp34xxg_thread(void *data);
140 void msp3400c_set_mode(struct i2c_client *client, int mode);
141 void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2);
143 #endif /* MSP3400_DRIVER_H */