This source file includes following definitions.
- to_state
- to_sd
- is_cx2583x
- is_cx2584x
- is_cx231xx
- is_cx2388x
- is_cx23885
- is_cx23887
- is_cx23888
1
2
3
4
5
6
7 #ifndef _CX25840_CORE_H_
8 #define _CX25840_CORE_H_
9
10 #include <linux/videodev2.h>
11 #include <media/v4l2-device.h>
12 #include <media/v4l2-ctrls.h>
13 #include <linux/i2c.h>
14
15 struct cx25840_ir_state;
16
17 enum cx25840_model {
18 CX23885_AV,
19 CX23887_AV,
20 CX23888_AV,
21 CX2310X_AV,
22 CX25840,
23 CX25841,
24 CX25842,
25 CX25843,
26 CX25836,
27 CX25837,
28 };
29
30 enum cx25840_media_pads {
31 CX25840_PAD_INPUT,
32 CX25840_PAD_VID_OUT,
33
34 CX25840_NUM_PADS
35 };
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71 struct cx25840_state {
72 struct i2c_client *c;
73 struct v4l2_subdev sd;
74 struct v4l2_ctrl_handler hdl;
75 struct {
76
77 struct v4l2_ctrl *volume;
78 struct v4l2_ctrl *mute;
79 };
80 int pvr150_workaround;
81 bool generic_mode;
82 int radio;
83 v4l2_std_id std;
84 enum cx25840_video_input vid_input;
85 u32 vid_config;
86 enum cx25840_audio_input aud_input;
87 u32 audclk_freq;
88 int audmode;
89 int vbi_line_offset;
90 enum cx25840_model id;
91 u32 rev;
92 int is_initialized;
93 unsigned int vbi_regs_offset;
94 wait_queue_head_t fw_wait;
95 struct work_struct fw_work;
96 struct cx25840_ir_state *ir_state;
97 #if defined(CONFIG_MEDIA_CONTROLLER)
98 struct media_pad pads[CX25840_NUM_PADS];
99 #endif
100 };
101
102 static inline struct cx25840_state *to_state(struct v4l2_subdev *sd)
103 {
104 return container_of(sd, struct cx25840_state, sd);
105 }
106
107 static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl)
108 {
109 return &container_of(ctrl->handler, struct cx25840_state, hdl)->sd;
110 }
111
112 static inline bool is_cx2583x(struct cx25840_state *state)
113 {
114 return state->id == CX25836 ||
115 state->id == CX25837;
116 }
117
118 static inline bool is_cx2584x(struct cx25840_state *state)
119 {
120 return state->id == CX25840 ||
121 state->id == CX25841 ||
122 state->id == CX25842 ||
123 state->id == CX25843;
124 }
125
126 static inline bool is_cx231xx(struct cx25840_state *state)
127 {
128 return state->id == CX2310X_AV;
129 }
130
131 static inline bool is_cx2388x(struct cx25840_state *state)
132 {
133 return state->id == CX23885_AV ||
134 state->id == CX23887_AV ||
135 state->id == CX23888_AV;
136 }
137
138 static inline bool is_cx23885(struct cx25840_state *state)
139 {
140 return state->id == CX23885_AV;
141 }
142
143 static inline bool is_cx23887(struct cx25840_state *state)
144 {
145 return state->id == CX23887_AV;
146 }
147
148 static inline bool is_cx23888(struct cx25840_state *state)
149 {
150 return state->id == CX23888_AV;
151 }
152
153
154
155 int cx25840_write(struct i2c_client *client, u16 addr, u8 value);
156 int cx25840_write4(struct i2c_client *client, u16 addr, u32 value);
157 u8 cx25840_read(struct i2c_client *client, u16 addr);
158 u32 cx25840_read4(struct i2c_client *client, u16 addr);
159 int cx25840_and_or(struct i2c_client *client, u16 addr, unsigned int mask,
160 u8 value);
161 int cx25840_and_or4(struct i2c_client *client, u16 addr, u32 and_mask,
162 u32 or_value);
163 void cx25840_std_setup(struct i2c_client *client);
164
165
166
167 int cx25840_loadfw(struct i2c_client *client);
168
169
170
171 void cx25840_audio_set_path(struct i2c_client *client);
172 int cx25840_s_clock_freq(struct v4l2_subdev *sd, u32 freq);
173
174 extern const struct v4l2_ctrl_ops cx25840_audio_ctrl_ops;
175
176
177
178 int cx25840_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt);
179 int cx25840_s_sliced_fmt(struct v4l2_subdev *sd,
180 struct v4l2_sliced_vbi_format *fmt);
181 int cx25840_g_sliced_fmt(struct v4l2_subdev *sd,
182 struct v4l2_sliced_vbi_format *fmt);
183 int cx25840_decode_vbi_line(struct v4l2_subdev *sd,
184 struct v4l2_decode_vbi_line *vbi);
185
186
187
188 extern const struct v4l2_subdev_ir_ops cx25840_ir_ops;
189 int cx25840_ir_log_status(struct v4l2_subdev *sd);
190 int cx25840_ir_irq_handler(struct v4l2_subdev *sd, u32 status, bool *handled);
191 int cx25840_ir_probe(struct v4l2_subdev *sd);
192 int cx25840_ir_remove(struct v4l2_subdev *sd);
193
194 #endif