Searched refs:sd (Results 1 - 200 of 564) sorted by relevance

123

/linux-4.1.27/drivers/media/platform/davinci/
H A Dvpbe_venc.c66 struct v4l2_subdev sd; member in struct:venc_state
78 static inline struct venc_state *to_state(struct v4l2_subdev *sd) to_state() argument
80 return container_of(sd, struct venc_state, sd); to_state()
83 static inline u32 venc_read(struct v4l2_subdev *sd, u32 offset) venc_read() argument
85 struct venc_state *venc = to_state(sd); venc_read()
90 static inline u32 venc_write(struct v4l2_subdev *sd, u32 offset, u32 val) venc_write() argument
92 struct venc_state *venc = to_state(sd); venc_write()
99 static inline u32 venc_modify(struct v4l2_subdev *sd, u32 offset, venc_modify() argument
102 u32 new_val = (venc_read(sd, offset) & ~mask) | (val & mask); venc_modify()
104 venc_write(sd, offset, new_val); venc_modify()
109 static inline u32 vdaccfg_write(struct v4l2_subdev *sd, u32 val) vdaccfg_write() argument
111 struct venc_state *venc = to_state(sd); vdaccfg_write()
124 static int venc_set_dac(struct v4l2_subdev *sd, u32 out_index) venc_set_dac() argument
128 v4l2_dbg(debug, 1, sd, "Setting output to Composite\n"); venc_set_dac()
129 venc_write(sd, VENC_DACSEL, 0); venc_set_dac()
132 v4l2_dbg(debug, 1, sd, "Setting output to Component\n"); venc_set_dac()
133 venc_write(sd, VENC_DACSEL, VDAC_COMPONENT); venc_set_dac()
136 v4l2_dbg(debug, 1, sd, "Setting output to S-video\n"); venc_set_dac()
137 venc_write(sd, VENC_DACSEL, VDAC_S_VIDEO); venc_set_dac()
146 static void venc_enabledigitaloutput(struct v4l2_subdev *sd, int benable) venc_enabledigitaloutput() argument
148 struct venc_state *venc = to_state(sd); venc_enabledigitaloutput()
150 v4l2_dbg(debug, 2, sd, "venc_enabledigitaloutput\n"); venc_enabledigitaloutput()
153 venc_write(sd, VENC_VMOD, 0); venc_enabledigitaloutput()
154 venc_write(sd, VENC_CVBS, 0); venc_enabledigitaloutput()
155 venc_write(sd, VENC_LCDOUT, 0); venc_enabledigitaloutput()
156 venc_write(sd, VENC_HSPLS, 0); venc_enabledigitaloutput()
157 venc_write(sd, VENC_HSTART, 0); venc_enabledigitaloutput()
158 venc_write(sd, VENC_HVALID, 0); venc_enabledigitaloutput()
159 venc_write(sd, VENC_HINT, 0); venc_enabledigitaloutput()
160 venc_write(sd, VENC_VSPLS, 0); venc_enabledigitaloutput()
161 venc_write(sd, VENC_VSTART, 0); venc_enabledigitaloutput()
162 venc_write(sd, VENC_VVALID, 0); venc_enabledigitaloutput()
163 venc_write(sd, VENC_VINT, 0); venc_enabledigitaloutput()
164 venc_write(sd, VENC_YCCCTL, 0); venc_enabledigitaloutput()
165 venc_write(sd, VENC_DACSEL, 0); venc_enabledigitaloutput()
168 venc_write(sd, VENC_VMOD, 0); venc_enabledigitaloutput()
170 venc_write(sd, VENC_VIDCTL, 0x141); venc_enabledigitaloutput()
173 venc_write(sd, VENC_SYNCCTL, 0); venc_enabledigitaloutput()
176 venc_write(sd, VENC_DCLKCTL, 0); venc_enabledigitaloutput()
177 venc_write(sd, VENC_DRGBX1, 0x0000057C); venc_enabledigitaloutput()
180 venc_write(sd, VENC_LCDOUT, 0); venc_enabledigitaloutput()
182 venc_write(sd, VENC_CMPNT, 0x100); venc_enabledigitaloutput()
183 venc_write(sd, VENC_HSPLS, 0); venc_enabledigitaloutput()
184 venc_write(sd, VENC_HINT, 0); venc_enabledigitaloutput()
185 venc_write(sd, VENC_HSTART, 0); venc_enabledigitaloutput()
186 venc_write(sd, VENC_HVALID, 0); venc_enabledigitaloutput()
188 venc_write(sd, VENC_VSPLS, 0); venc_enabledigitaloutput()
189 venc_write(sd, VENC_VINT, 0); venc_enabledigitaloutput()
190 venc_write(sd, VENC_VSTART, 0); venc_enabledigitaloutput()
191 venc_write(sd, VENC_VVALID, 0); venc_enabledigitaloutput()
193 venc_write(sd, VENC_HSDLY, 0); venc_enabledigitaloutput()
194 venc_write(sd, VENC_VSDLY, 0); venc_enabledigitaloutput()
196 venc_write(sd, VENC_YCCCTL, 0); venc_enabledigitaloutput()
197 venc_write(sd, VENC_VSTARTA, 0); venc_enabledigitaloutput()
200 venc_write(sd, VENC_OSDCLK0, 1); venc_enabledigitaloutput()
201 venc_write(sd, VENC_OSDCLK1, 2); venc_enabledigitaloutput()
229 static int venc_set_ntsc(struct v4l2_subdev *sd) venc_set_ntsc() argument
232 struct venc_state *venc = to_state(sd); venc_set_ntsc()
235 v4l2_dbg(debug, 2, sd, "venc_set_ntsc\n"); venc_set_ntsc()
243 venc_enabledigitaloutput(sd, 0); venc_set_ntsc()
246 venc_write(sd, VENC_CLKCTL, 0x01); venc_set_ntsc()
247 venc_write(sd, VENC_VIDCTL, 0); venc_set_ntsc()
248 val = vdaccfg_write(sd, VDAC_CONFIG_SD_V3); venc_set_ntsc()
250 venc_write(sd, VENC_CLKCTL, 0x01); venc_set_ntsc()
251 venc_write(sd, VENC_VIDCTL, 0); venc_set_ntsc()
252 vdaccfg_write(sd, VDAC_CONFIG_SD_V2); venc_set_ntsc()
255 venc_modify(sd, VENC_VIDCTL, 0, 1 << 1); venc_set_ntsc()
257 venc_write(sd, VENC_YCCCTL, 0x1); venc_set_ntsc()
258 venc_modify(sd, VENC_VDPRO, 0, VENC_VDPRO_DAFRQ); venc_set_ntsc()
259 venc_modify(sd, VENC_VDPRO, 0, VENC_VDPRO_DAUPS); venc_set_ntsc()
262 venc_write(sd, VENC_VMOD, 0); venc_set_ntsc()
263 venc_modify(sd, VENC_VMOD, (1 << VENC_VMOD_VIE_SHIFT), venc_set_ntsc()
265 venc_modify(sd, VENC_VMOD, (0 << VENC_VMOD_VMD), VENC_VMOD_VMD); venc_set_ntsc()
266 venc_modify(sd, VENC_VMOD, (0 << VENC_VMOD_TVTYP_SHIFT), venc_set_ntsc()
268 venc_write(sd, VENC_DACTST, 0x0); venc_set_ntsc()
269 venc_modify(sd, VENC_VMOD, VENC_VMOD_VENC, VENC_VMOD_VENC); venc_set_ntsc()
277 static int venc_set_pal(struct v4l2_subdev *sd) venc_set_pal() argument
279 struct venc_state *venc = to_state(sd); venc_set_pal()
281 v4l2_dbg(debug, 2, sd, "venc_set_pal\n"); venc_set_pal()
289 venc_enabledigitaloutput(sd, 0); venc_set_pal()
292 venc_write(sd, VENC_CLKCTL, 0x1); venc_set_pal()
293 venc_write(sd, VENC_VIDCTL, 0); venc_set_pal()
294 vdaccfg_write(sd, VDAC_CONFIG_SD_V3); venc_set_pal()
296 venc_write(sd, VENC_CLKCTL, 0x1); venc_set_pal()
297 venc_write(sd, VENC_VIDCTL, 0); venc_set_pal()
298 vdaccfg_write(sd, VDAC_CONFIG_SD_V2); venc_set_pal()
301 venc_modify(sd, VENC_VIDCTL, 0, 1 << 1); venc_set_pal()
303 venc_write(sd, VENC_YCCCTL, 0x1); venc_set_pal()
306 venc_modify(sd, VENC_SYNCCTL, 1 << VENC_SYNCCTL_OVD_SHIFT, venc_set_pal()
308 venc_write(sd, VENC_VMOD, 0); venc_set_pal()
309 venc_modify(sd, VENC_VMOD, venc_set_pal()
312 venc_modify(sd, VENC_VMOD, venc_set_pal()
314 venc_modify(sd, VENC_VMOD, venc_set_pal()
317 venc_write(sd, VENC_DACTST, 0x0); venc_set_pal()
318 venc_modify(sd, VENC_VMOD, VENC_VMOD_VENC, VENC_VMOD_VENC); venc_set_pal()
329 static int venc_set_480p59_94(struct v4l2_subdev *sd) venc_set_480p59_94() argument
331 struct venc_state *venc = to_state(sd); venc_set_480p59_94()
334 v4l2_dbg(debug, 2, sd, "venc_set_480p59_94\n"); venc_set_480p59_94()
344 venc_enabledigitaloutput(sd, 0); venc_set_480p59_94()
347 vdaccfg_write(sd, VDAC_CONFIG_HD_V2); venc_set_480p59_94()
348 venc_write(sd, VENC_OSDCLK0, 0); venc_set_480p59_94()
349 venc_write(sd, VENC_OSDCLK1, 1); venc_set_480p59_94()
352 venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAFRQ, venc_set_480p59_94()
354 venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAUPS, venc_set_480p59_94()
358 venc_write(sd, VENC_VMOD, 0); venc_set_480p59_94()
359 venc_modify(sd, VENC_VMOD, (1 << VENC_VMOD_VIE_SHIFT), venc_set_480p59_94()
361 venc_modify(sd, VENC_VMOD, VENC_VMOD_HDMD, VENC_VMOD_HDMD); venc_set_480p59_94()
362 venc_modify(sd, VENC_VMOD, (HDTV_525P << VENC_VMOD_TVTYP_SHIFT), venc_set_480p59_94()
364 venc_modify(sd, VENC_VMOD, VENC_VMOD_VDMD_YCBCR8 << venc_set_480p59_94()
367 venc_modify(sd, VENC_VMOD, VENC_VMOD_VENC, VENC_VMOD_VENC); venc_set_480p59_94()
377 static int venc_set_576p50(struct v4l2_subdev *sd) venc_set_576p50() argument
379 struct venc_state *venc = to_state(sd); venc_set_576p50()
382 v4l2_dbg(debug, 2, sd, "venc_set_576p50\n"); venc_set_576p50()
392 venc_enabledigitaloutput(sd, 0); venc_set_576p50()
395 vdaccfg_write(sd, VDAC_CONFIG_HD_V2); venc_set_576p50()
397 venc_write(sd, VENC_OSDCLK0, 0); venc_set_576p50()
398 venc_write(sd, VENC_OSDCLK1, 1); venc_set_576p50()
401 venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAFRQ, venc_set_576p50()
403 venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAUPS, venc_set_576p50()
407 venc_write(sd, VENC_VMOD, 0); venc_set_576p50()
408 venc_modify(sd, VENC_VMOD, (1 << VENC_VMOD_VIE_SHIFT), venc_set_576p50()
410 venc_modify(sd, VENC_VMOD, VENC_VMOD_HDMD, VENC_VMOD_HDMD); venc_set_576p50()
411 venc_modify(sd, VENC_VMOD, (HDTV_625P << VENC_VMOD_TVTYP_SHIFT), venc_set_576p50()
414 venc_modify(sd, VENC_VMOD, VENC_VMOD_VDMD_YCBCR8 << venc_set_576p50()
416 venc_modify(sd, VENC_VMOD, VENC_VMOD_VENC, VENC_VMOD_VENC); venc_set_576p50()
424 static int venc_set_720p60_internal(struct v4l2_subdev *sd) venc_set_720p60_internal() argument
426 struct venc_state *venc = to_state(sd); venc_set_720p60_internal()
433 venc_enabledigitaloutput(sd, 0); venc_set_720p60_internal()
435 venc_write(sd, VENC_OSDCLK0, 0); venc_set_720p60_internal()
436 venc_write(sd, VENC_OSDCLK1, 1); venc_set_720p60_internal()
438 venc_write(sd, VENC_VMOD, 0); venc_set_720p60_internal()
440 venc_modify(sd, VENC_VMOD, (1 << VENC_VMOD_VIE_SHIFT), venc_set_720p60_internal()
442 venc_modify(sd, VENC_VMOD, VENC_VMOD_HDMD, VENC_VMOD_HDMD); venc_set_720p60_internal()
443 venc_modify(sd, VENC_VMOD, (HDTV_720P << VENC_VMOD_TVTYP_SHIFT), venc_set_720p60_internal()
445 venc_modify(sd, VENC_VMOD, VENC_VMOD_VENC, VENC_VMOD_VENC); venc_set_720p60_internal()
446 venc_write(sd, VENC_XHINTVL, 0); venc_set_720p60_internal()
453 static int venc_set_1080i30_internal(struct v4l2_subdev *sd) venc_set_1080i30_internal() argument
455 struct venc_state *venc = to_state(sd); venc_set_1080i30_internal()
462 venc_enabledigitaloutput(sd, 0); venc_set_1080i30_internal()
464 venc_write(sd, VENC_OSDCLK0, 0); venc_set_1080i30_internal()
465 venc_write(sd, VENC_OSDCLK1, 1); venc_set_1080i30_internal()
468 venc_write(sd, VENC_VMOD, 0); venc_set_1080i30_internal()
470 venc_modify(sd, VENC_VMOD, (1 << VENC_VMOD_VIE_SHIFT), venc_set_1080i30_internal()
472 venc_modify(sd, VENC_VMOD, VENC_VMOD_HDMD, VENC_VMOD_HDMD); venc_set_1080i30_internal()
473 venc_modify(sd, VENC_VMOD, (HDTV_1080I << VENC_VMOD_TVTYP_SHIFT), venc_set_1080i30_internal()
475 venc_modify(sd, VENC_VMOD, VENC_VMOD_VENC, VENC_VMOD_VENC); venc_set_1080i30_internal()
476 venc_write(sd, VENC_XHINTVL, 0); venc_set_1080i30_internal()
480 static int venc_s_std_output(struct v4l2_subdev *sd, v4l2_std_id norm) venc_s_std_output() argument
482 v4l2_dbg(debug, 1, sd, "venc_s_std_output\n"); venc_s_std_output()
485 return venc_set_ntsc(sd); venc_s_std_output()
487 return venc_set_pal(sd); venc_s_std_output()
492 static int venc_s_dv_timings(struct v4l2_subdev *sd, venc_s_dv_timings() argument
495 struct venc_state *venc = to_state(sd); venc_s_dv_timings()
499 v4l2_dbg(debug, 1, sd, "venc_s_dv_timings\n"); venc_s_dv_timings()
502 return venc_set_576p50(sd); venc_s_dv_timings()
504 return venc_set_480p59_94(sd); venc_s_dv_timings()
508 ret = venc_set_720p60_internal(sd); venc_s_dv_timings()
510 vdaccfg_write(sd, VDAC_CONFIG_HD_V2); venc_s_dv_timings()
515 ret = venc_set_1080i30_internal(sd); venc_s_dv_timings()
517 vdaccfg_write(sd, VDAC_CONFIG_HD_V2); venc_s_dv_timings()
523 static int venc_s_routing(struct v4l2_subdev *sd, u32 input, u32 output, venc_s_routing() argument
526 struct venc_state *venc = to_state(sd); venc_s_routing()
529 v4l2_dbg(debug, 1, sd, "venc_s_routing\n"); venc_s_routing()
531 ret = venc_set_dac(sd, output); venc_s_routing()
538 static long venc_ioctl(struct v4l2_subdev *sd, venc_ioctl() argument
546 val = venc_read(sd, VENC_VSTAT); venc_ioctl()
551 v4l2_err(sd, "Wrong IOCTL cmd\n"); venc_ioctl()
573 static int venc_initialize(struct v4l2_subdev *sd) venc_initialize() argument
575 struct venc_state *venc = to_state(sd); venc_initialize()
582 ret = venc_s_routing(sd, 0, venc->output, 0); venc_initialize()
584 v4l2_err(sd, "Error setting output during init\n"); venc_initialize()
588 ret = venc_s_std_output(sd, venc->std); venc_initialize()
590 v4l2_err(sd, "Error setting std during init\n"); venc_initialize()
619 v4l2_subdev_init(&venc->sd, &venc_ops); venc_sub_dev_init()
621 strcpy(venc->sd.name, venc_name); venc_sub_dev_init()
622 if (v4l2_device_register_subdev(v4l2_dev, &venc->sd) < 0) { venc_sub_dev_init()
627 if (venc_initialize(&venc->sd)) { venc_sub_dev_init()
633 return &venc->sd; venc_sub_dev_init()
H A Dvpbe_osd.c63 static inline u32 osd_read(struct osd_state *sd, u32 offset) osd_read() argument
65 struct osd_state *osd = sd; osd_read()
70 static inline u32 osd_write(struct osd_state *sd, u32 val, u32 offset) osd_write() argument
72 struct osd_state *osd = sd; osd_write()
79 static inline u32 osd_set(struct osd_state *sd, u32 mask, u32 offset) osd_set() argument
81 struct osd_state *osd = sd; osd_set()
91 static inline u32 osd_clear(struct osd_state *sd, u32 mask, u32 offset) osd_clear() argument
93 struct osd_state *osd = sd; osd_clear()
103 static inline u32 osd_modify(struct osd_state *sd, u32 mask, u32 val, osd_modify() argument
106 struct osd_state *osd = sd; osd_modify()
129 * @sd - ptr to struct osd_state
142 static int _osd_dm6446_vid0_pingpong(struct osd_state *sd, _osd_dm6446_vid0_pingpong() argument
149 pdata = (struct osd_platform_data *)sd->dev->platform_data; _osd_dm6446_vid0_pingpong()
153 osd_write(sd, fb_base_phys & ~0x1F, OSD_VIDWIN0ADR); _osd_dm6446_vid0_pingpong()
154 osd_write(sd, fb_base_phys & ~0x1F, OSD_PPVWIN0ADR); _osd_dm6446_vid0_pingpong()
155 osd_modify(sd, OSD_MISCCTL_PPSW | OSD_MISCCTL_PPRV, 0, _osd_dm6446_vid0_pingpong()
161 osd_write(sd, _osd_dm6446_vid0_pingpong()
164 osd_write(sd, _osd_dm6446_vid0_pingpong()
167 osd_modify(sd, _osd_dm6446_vid0_pingpong()
178 static void _osd_set_field_inversion(struct osd_state *sd, int enable) _osd_set_field_inversion() argument
185 osd_modify(sd, OSD_MODE_FSINV, fsinv, OSD_MODE); _osd_set_field_inversion()
188 static void _osd_set_blink_attribute(struct osd_state *sd, int enable, _osd_set_blink_attribute() argument
198 osd_modify(sd, OSD_OSDATRMD_BLNKINT | OSD_OSDATRMD_BLNK, osdatrmd, _osd_set_blink_attribute()
202 static void _osd_set_rom_clut(struct osd_state *sd, _osd_set_rom_clut() argument
206 osd_clear(sd, OSD_MISCCTL_RSEL, OSD_MISCCTL); _osd_set_rom_clut()
208 osd_set(sd, OSD_MISCCTL_RSEL, OSD_MISCCTL); _osd_set_rom_clut()
211 static void _osd_set_palette_map(struct osd_state *sd, _osd_set_palette_map() argument
257 osd_modify(sd, bmp_mask, clut_index << bmp_shift, bmp_offset); _osd_set_palette_map()
260 static void _osd_set_rec601_attenuation(struct osd_state *sd, _osd_set_rec601_attenuation() argument
265 osd_modify(sd, OSD_OSDWIN0MD_ATN0E, _osd_set_rec601_attenuation()
268 if (sd->vpbe_type == VPBE_VERSION_1) _osd_set_rec601_attenuation()
269 osd_modify(sd, OSD_OSDWIN0MD_ATN0E, _osd_set_rec601_attenuation()
272 else if ((sd->vpbe_type == VPBE_VERSION_3) || _osd_set_rec601_attenuation()
273 (sd->vpbe_type == VPBE_VERSION_2)) _osd_set_rec601_attenuation()
274 osd_modify(sd, OSD_EXTMODE_ATNOSD0EN, _osd_set_rec601_attenuation()
279 osd_modify(sd, OSD_OSDWIN1MD_ATN1E, _osd_set_rec601_attenuation()
282 if (sd->vpbe_type == VPBE_VERSION_1) _osd_set_rec601_attenuation()
283 osd_modify(sd, OSD_OSDWIN1MD_ATN1E, _osd_set_rec601_attenuation()
286 else if ((sd->vpbe_type == VPBE_VERSION_3) || _osd_set_rec601_attenuation()
287 (sd->vpbe_type == VPBE_VERSION_2)) _osd_set_rec601_attenuation()
288 osd_modify(sd, OSD_EXTMODE_ATNOSD1EN, _osd_set_rec601_attenuation()
295 static void _osd_set_blending_factor(struct osd_state *sd, _osd_set_blending_factor() argument
301 osd_modify(sd, OSD_OSDWIN0MD_BLND0, _osd_set_blending_factor()
305 osd_modify(sd, OSD_OSDWIN1MD_BLND1, _osd_set_blending_factor()
311 static void _osd_enable_rgb888_pixblend(struct osd_state *sd, _osd_enable_rgb888_pixblend() argument
315 osd_modify(sd, OSD_MISCCTL_BLDSEL, 0, OSD_MISCCTL); _osd_enable_rgb888_pixblend()
318 osd_modify(sd, OSD_EXTMODE_OSD0BLDCHR, _osd_enable_rgb888_pixblend()
322 osd_modify(sd, OSD_EXTMODE_OSD1BLDCHR, _osd_enable_rgb888_pixblend()
328 static void _osd_enable_color_key(struct osd_state *sd, _osd_enable_color_key() argument
338 if (sd->vpbe_type == VPBE_VERSION_3) { _osd_enable_color_key()
341 osd_modify(sd, OSD_TRANSPBMPIDX_BMP0, _osd_enable_color_key()
347 osd_modify(sd, OSD_TRANSPBMPIDX_BMP1, _osd_enable_color_key()
356 if (sd->vpbe_type == VPBE_VERSION_1) _osd_enable_color_key()
357 osd_write(sd, colorkey & OSD_TRANSPVAL_RGBTRANS, _osd_enable_color_key()
359 else if (sd->vpbe_type == VPBE_VERSION_3) _osd_enable_color_key()
360 osd_write(sd, colorkey & OSD_TRANSPVALL_RGBL, _osd_enable_color_key()
365 if (sd->vpbe_type == VPBE_VERSION_3) _osd_enable_color_key()
366 osd_modify(sd, OSD_TRANSPVALU_Y, colorkey, _osd_enable_color_key()
370 if (sd->vpbe_type == VPBE_VERSION_3) { _osd_enable_color_key()
371 osd_write(sd, colorkey & OSD_TRANSPVALL_RGBL, _osd_enable_color_key()
373 osd_modify(sd, OSD_TRANSPVALU_RGBU, colorkey >> 16, _osd_enable_color_key()
383 osd_set(sd, OSD_OSDWIN0MD_TE0, OSD_OSDWIN0MD); _osd_enable_color_key()
386 osd_set(sd, OSD_OSDWIN1MD_TE1, OSD_OSDWIN1MD); _osd_enable_color_key()
391 static void _osd_disable_color_key(struct osd_state *sd, _osd_disable_color_key() argument
396 osd_clear(sd, OSD_OSDWIN0MD_TE0, OSD_OSDWIN0MD); _osd_disable_color_key()
399 osd_clear(sd, OSD_OSDWIN1MD_TE1, OSD_OSDWIN1MD); _osd_disable_color_key()
404 static void _osd_set_osd_clut(struct osd_state *sd, _osd_set_osd_clut() argument
414 osd_modify(sd, OSD_OSDWIN0MD_CLUTS0, winmd, OSD_OSDWIN0MD); _osd_set_osd_clut()
419 osd_modify(sd, OSD_OSDWIN1MD_CLUTS1, winmd, OSD_OSDWIN1MD); _osd_set_osd_clut()
424 static void _osd_set_zoom(struct osd_state *sd, enum osd_layer layer, _osd_set_zoom() argument
434 osd_modify(sd, OSD_OSDWIN0MD_OHZ0 | OSD_OSDWIN0MD_OVZ0, winmd, _osd_set_zoom()
440 osd_modify(sd, OSD_VIDWINMD_VHZ0 | OSD_VIDWINMD_VVZ0, winmd, _osd_set_zoom()
446 osd_modify(sd, OSD_OSDWIN1MD_OHZ1 | OSD_OSDWIN1MD_OVZ1, winmd, _osd_set_zoom()
452 osd_modify(sd, OSD_VIDWINMD_VHZ1 | OSD_VIDWINMD_VVZ1, winmd, _osd_set_zoom()
458 static void _osd_disable_layer(struct osd_state *sd, enum osd_layer layer) _osd_disable_layer() argument
462 osd_clear(sd, OSD_OSDWIN0MD_OACT0, OSD_OSDWIN0MD); _osd_disable_layer()
465 osd_clear(sd, OSD_VIDWINMD_ACT0, OSD_VIDWINMD); _osd_disable_layer()
469 osd_clear(sd, OSD_OSDWIN1MD_OASW | OSD_OSDWIN1MD_OACT1, _osd_disable_layer()
473 osd_clear(sd, OSD_VIDWINMD_ACT1, OSD_VIDWINMD); _osd_disable_layer()
478 static void osd_disable_layer(struct osd_state *sd, enum osd_layer layer) osd_disable_layer() argument
480 struct osd_state *osd = sd; osd_disable_layer()
492 _osd_disable_layer(sd, layer); osd_disable_layer()
497 static void _osd_enable_attribute_mode(struct osd_state *sd) _osd_enable_attribute_mode() argument
500 osd_set(sd, OSD_OSDWIN1MD_OASW, OSD_OSDWIN1MD); _osd_enable_attribute_mode()
503 static void _osd_enable_layer(struct osd_state *sd, enum osd_layer layer) _osd_enable_layer() argument
507 osd_set(sd, OSD_OSDWIN0MD_OACT0, OSD_OSDWIN0MD); _osd_enable_layer()
510 osd_set(sd, OSD_VIDWINMD_ACT0, OSD_VIDWINMD); _osd_enable_layer()
514 osd_modify(sd, OSD_OSDWIN1MD_OASW | OSD_OSDWIN1MD_OACT1, _osd_enable_layer()
518 osd_set(sd, OSD_VIDWINMD_ACT1, OSD_VIDWINMD); _osd_enable_layer()
523 static int osd_enable_layer(struct osd_state *sd, enum osd_layer layer, osd_enable_layer() argument
526 struct osd_state *osd = sd; osd_enable_layer()
553 _osd_enable_layer(sd, layer); osd_enable_layer()
555 _osd_enable_attribute_mode(sd); osd_enable_layer()
556 _osd_set_blink_attribute(sd, osd->is_blinking, osd->blink); osd_enable_layer()
572 static void _osd_start_layer(struct osd_state *sd, enum osd_layer layer, _osd_start_layer() argument
577 if (sd->vpbe_type == VPBE_VERSION_1) { _osd_start_layer()
580 osd_write(sd, fb_base_phys & ~0x1F, OSD_OSDWIN0ADR); _osd_start_layer()
583 osd_write(sd, fb_base_phys & ~0x1F, OSD_VIDWIN0ADR); _osd_start_layer()
586 osd_write(sd, fb_base_phys & ~0x1F, OSD_OSDWIN1ADR); _osd_start_layer()
589 osd_write(sd, fb_base_phys & ~0x1F, OSD_VIDWIN1ADR); _osd_start_layer()
592 } else if (sd->vpbe_type == VPBE_VERSION_3) { _osd_start_layer()
598 osd_modify(sd, OSD_OSDWINADH_O0AH, _osd_start_layer()
602 osd_write(sd, fb_offset_32 & OSD_OSDWIN0ADL_O0AL, _osd_start_layer()
606 osd_modify(sd, OSD_VIDWINADH_V0AH, _osd_start_layer()
610 osd_write(sd, fb_offset_32 & OSD_VIDWIN0ADL_V0AL, _osd_start_layer()
614 osd_modify(sd, OSD_OSDWINADH_O1AH, _osd_start_layer()
618 osd_write(sd, fb_offset_32 & OSD_OSDWIN1ADL_O1AL, _osd_start_layer()
622 osd_modify(sd, OSD_VIDWINADH_V1AH, _osd_start_layer()
626 osd_write(sd, fb_offset_32 & OSD_VIDWIN1ADL_V1AL, _osd_start_layer()
630 } else if (sd->vpbe_type == VPBE_VERSION_2) { _osd_start_layer()
631 struct osd_window_state *win = &sd->win[layer]; _osd_start_layer()
652 osd_modify(sd, OSD_VIDWIN0OFST_V0AH, _osd_start_layer()
657 osd_modify(sd, OSD_VIDWINADH_V0AH, _osd_start_layer()
662 osd_write(sd, fb_offset_32 & OSD_WINADL_MASK, _osd_start_layer()
665 osd_modify(sd, OSD_VIDWIN1OFST_V1AH, _osd_start_layer()
671 osd_modify(sd, OSD_VIDWINADH_V1AH, _osd_start_layer()
677 osd_write(sd, cbcr_offset_32 & OSD_WINADL_MASK, _osd_start_layer()
687 osd_modify(sd, OSD_OSDWIN0OFST_O0AH, _osd_start_layer()
692 osd_modify(sd, OSD_OSDWINADH_O0AH, _osd_start_layer()
696 osd_write(sd, fb_offset_32 & OSD_WINADL_MASK, _osd_start_layer()
701 osd_modify(sd, OSD_VIDWIN0OFST_V0AH, _osd_start_layer()
706 osd_modify(sd, OSD_VIDWINADH_V0AH, _osd_start_layer()
711 osd_write(sd, fb_offset_32 & OSD_WINADL_MASK, _osd_start_layer()
716 osd_modify(sd, OSD_OSDWIN1OFST_O1AH, _osd_start_layer()
721 osd_modify(sd, OSD_OSDWINADH_O1AH, _osd_start_layer()
726 osd_write(sd, fb_offset_32 & OSD_WINADL_MASK, _osd_start_layer()
731 osd_modify(sd, OSD_VIDWIN1OFST_V1AH, _osd_start_layer()
736 osd_modify(sd, OSD_VIDWINADH_V1AH, _osd_start_layer()
741 osd_write(sd, fb_offset_32 & OSD_WINADL_MASK, _osd_start_layer()
749 static void osd_start_layer(struct osd_state *sd, enum osd_layer layer, osd_start_layer() argument
753 struct osd_state *osd = sd; osd_start_layer()
761 _osd_start_layer(sd, layer, fb_base_phys, cbcr_ofst); osd_start_layer()
765 _osd_dm6446_vid0_pingpong(sd, osd->field_inversion, osd_start_layer()
773 static void osd_get_layer_config(struct osd_state *sd, enum osd_layer layer, osd_get_layer_config() argument
776 struct osd_state *osd = sd; osd_get_layer_config()
789 * @sd - ptr to struct osd_state
799 static int try_layer_config(struct osd_state *sd, enum osd_layer layer, try_layer_config() argument
802 struct osd_state *osd = sd; try_layer_config()
913 static void _osd_disable_vid_rgb888(struct osd_state *sd) _osd_disable_vid_rgb888() argument
921 if (sd->vpbe_type == VPBE_VERSION_1) _osd_disable_vid_rgb888()
922 osd_clear(sd, OSD_MISCCTL_RGBEN, OSD_MISCCTL); _osd_disable_vid_rgb888()
925 static void _osd_enable_vid_rgb888(struct osd_state *sd, _osd_enable_vid_rgb888() argument
935 if (sd->vpbe_type == VPBE_VERSION_1) { _osd_enable_vid_rgb888()
937 osd_modify(sd, OSD_MISCCTL_RGBEN | OSD_MISCCTL_RGBWIN, _osd_enable_vid_rgb888()
940 osd_modify(sd, OSD_MISCCTL_RGBEN | OSD_MISCCTL_RGBWIN, _osd_enable_vid_rgb888()
946 static void _osd_set_cbcr_order(struct osd_state *sd, _osd_set_cbcr_order() argument
954 osd_clear(sd, OSD_MODE_CS, OSD_MODE); _osd_set_cbcr_order()
956 osd_set(sd, OSD_MODE_CS, OSD_MODE); _osd_set_cbcr_order()
959 static void _osd_set_layer_config(struct osd_state *sd, enum osd_layer layer, _osd_set_layer_config() argument
964 _osd_set_cbcr_order(sd, lconfig->pixfmt); _osd_set_layer_config()
968 if (sd->vpbe_type == VPBE_VERSION_1) { _osd_set_layer_config()
972 } else if ((sd->vpbe_type == VPBE_VERSION_3) || _osd_set_layer_config()
973 (sd->vpbe_type == VPBE_VERSION_2)) { _osd_set_layer_config()
982 _osd_enable_rgb888_pixblend(sd, OSDWIN_OSD0); _osd_set_layer_config()
1016 osd_modify(sd, winmd_mask, winmd, OSD_OSDWIN0MD); _osd_set_layer_config()
1017 osd_write(sd, lconfig->line_length >> 5, OSD_OSDWIN0OFST); _osd_set_layer_config()
1018 osd_write(sd, lconfig->xpos, OSD_OSDWIN0XP); _osd_set_layer_config()
1019 osd_write(sd, lconfig->xsize, OSD_OSDWIN0XL); _osd_set_layer_config()
1021 osd_write(sd, lconfig->ypos >> 1, OSD_OSDWIN0YP); _osd_set_layer_config()
1022 osd_write(sd, lconfig->ysize >> 1, OSD_OSDWIN0YL); _osd_set_layer_config()
1024 osd_write(sd, lconfig->ypos, OSD_OSDWIN0YP); _osd_set_layer_config()
1025 osd_write(sd, lconfig->ysize, OSD_OSDWIN0YL); _osd_set_layer_config()
1033 osd_modify(sd, winmd_mask, winmd, OSD_VIDWINMD); _osd_set_layer_config()
1034 osd_write(sd, lconfig->line_length >> 5, OSD_VIDWIN0OFST); _osd_set_layer_config()
1035 osd_write(sd, lconfig->xpos, OSD_VIDWIN0XP); _osd_set_layer_config()
1036 osd_write(sd, lconfig->xsize, OSD_VIDWIN0XL); _osd_set_layer_config()
1041 if ((sd->vpbe_type == VPBE_VERSION_2) && _osd_set_layer_config()
1047 osd_modify(sd, winmd_mask, winmd, _osd_set_layer_config()
1051 osd_modify(sd, OSD_MISCCTL_S420D, _osd_set_layer_config()
1053 osd_write(sd, lconfig->line_length >> 5, _osd_set_layer_config()
1055 osd_write(sd, lconfig->xpos, OSD_VIDWIN1XP); _osd_set_layer_config()
1056 osd_write(sd, lconfig->xsize, OSD_VIDWIN1XL); _osd_set_layer_config()
1063 osd_write(sd, _osd_set_layer_config()
1066 osd_write(sd, _osd_set_layer_config()
1070 } else if ((sd->vpbe_type == VPBE_VERSION_2) && _osd_set_layer_config()
1072 osd_modify(sd, OSD_MISCCTL_S420D, ~OSD_MISCCTL_S420D, _osd_set_layer_config()
1077 osd_write(sd, lconfig->ypos >> 1, OSD_VIDWIN0YP); _osd_set_layer_config()
1078 osd_write(sd, lconfig->ysize >> 1, OSD_VIDWIN0YL); _osd_set_layer_config()
1079 if ((sd->vpbe_type == VPBE_VERSION_2) && _osd_set_layer_config()
1081 osd_write(sd, lconfig->ypos >> 1, _osd_set_layer_config()
1083 osd_write(sd, lconfig->ysize >> 1, _osd_set_layer_config()
1087 osd_write(sd, lconfig->ypos, OSD_VIDWIN0YP); _osd_set_layer_config()
1088 osd_write(sd, lconfig->ysize, OSD_VIDWIN0YL); _osd_set_layer_config()
1089 if ((sd->vpbe_type == VPBE_VERSION_2) && _osd_set_layer_config()
1091 osd_write(sd, lconfig->ypos, OSD_VIDWIN1YP); _osd_set_layer_config()
1092 osd_write(sd, lconfig->ysize, OSD_VIDWIN1YL); _osd_set_layer_config()
1103 if (sd->vpbe_type == VPBE_VERSION_1) { _osd_set_layer_config()
1113 if (sd->vpbe_type == VPBE_VERSION_1) { _osd_set_layer_config()
1117 } else if ((sd->vpbe_type == VPBE_VERSION_3) _osd_set_layer_config()
1118 || (sd->vpbe_type == VPBE_VERSION_2)) { _osd_set_layer_config()
1128 _osd_enable_rgb888_pixblend(sd, _osd_set_layer_config()
1165 osd_modify(sd, winmd_mask, winmd, OSD_OSDWIN1MD); _osd_set_layer_config()
1166 osd_write(sd, lconfig->line_length >> 5, OSD_OSDWIN1OFST); _osd_set_layer_config()
1167 osd_write(sd, lconfig->xpos, OSD_OSDWIN1XP); _osd_set_layer_config()
1168 osd_write(sd, lconfig->xsize, OSD_OSDWIN1XL); _osd_set_layer_config()
1170 osd_write(sd, lconfig->ypos >> 1, OSD_OSDWIN1YP); _osd_set_layer_config()
1171 osd_write(sd, lconfig->ysize >> 1, OSD_OSDWIN1YL); _osd_set_layer_config()
1173 osd_write(sd, lconfig->ypos, OSD_OSDWIN1YP); _osd_set_layer_config()
1174 osd_write(sd, lconfig->ysize, OSD_OSDWIN1YL); _osd_set_layer_config()
1182 osd_modify(sd, winmd_mask, winmd, OSD_VIDWINMD); _osd_set_layer_config()
1183 osd_write(sd, lconfig->line_length >> 5, OSD_VIDWIN1OFST); _osd_set_layer_config()
1184 osd_write(sd, lconfig->xpos, OSD_VIDWIN1XP); _osd_set_layer_config()
1185 osd_write(sd, lconfig->xsize, OSD_VIDWIN1XL); _osd_set_layer_config()
1190 if (sd->vpbe_type == VPBE_VERSION_2) { _osd_set_layer_config()
1196 osd_modify(sd, winmd_mask, winmd, _osd_set_layer_config()
1199 osd_modify(sd, OSD_MISCCTL_S420D, _osd_set_layer_config()
1201 osd_write(sd, lconfig->line_length >> 5, _osd_set_layer_config()
1203 osd_write(sd, lconfig->xpos, OSD_VIDWIN0XP); _osd_set_layer_config()
1204 osd_write(sd, lconfig->xsize, OSD_VIDWIN0XL); _osd_set_layer_config()
1206 osd_modify(sd, OSD_MISCCTL_S420D, _osd_set_layer_config()
1212 osd_write(sd, lconfig->ypos >> 1, OSD_VIDWIN1YP); _osd_set_layer_config()
1213 osd_write(sd, lconfig->ysize >> 1, OSD_VIDWIN1YL); _osd_set_layer_config()
1214 if ((sd->vpbe_type == VPBE_VERSION_2) && _osd_set_layer_config()
1216 osd_write(sd, lconfig->ypos >> 1, _osd_set_layer_config()
1218 osd_write(sd, lconfig->ysize >> 1, _osd_set_layer_config()
1222 osd_write(sd, lconfig->ypos, OSD_VIDWIN1YP); _osd_set_layer_config()
1223 osd_write(sd, lconfig->ysize, OSD_VIDWIN1YL); _osd_set_layer_config()
1224 if ((sd->vpbe_type == VPBE_VERSION_2) && _osd_set_layer_config()
1226 osd_write(sd, lconfig->ypos, OSD_VIDWIN0YP); _osd_set_layer_config()
1227 osd_write(sd, lconfig->ysize, OSD_VIDWIN0YL); _osd_set_layer_config()
1234 static int osd_set_layer_config(struct osd_state *sd, enum osd_layer layer, osd_set_layer_config() argument
1237 struct osd_state *osd = sd; osd_set_layer_config()
1245 reject_config = try_layer_config(sd, layer, lconfig); osd_set_layer_config()
1265 _osd_disable_layer(sd, layer); osd_set_layer_config()
1269 _osd_set_layer_config(sd, layer, lconfig); osd_set_layer_config()
1284 _osd_set_osd_clut(sd, OSDWIN_OSD1, osd_set_layer_config()
1286 _osd_set_blending_factor(sd, OSDWIN_OSD1, osd_set_layer_config()
1289 _osd_enable_color_key(sd, OSDWIN_OSD1, osd_set_layer_config()
1294 _osd_disable_color_key(sd, OSDWIN_OSD1); osd_set_layer_config()
1295 _osd_set_rec601_attenuation(sd, OSDWIN_OSD1, osd_set_layer_config()
1305 _osd_set_blink_attribute(sd, osd->is_blinking, osd_set_layer_config()
1346 _osd_set_palette_map(sd, osdwin, clut_index, osd_set_layer_config()
1356 _osd_enable_vid_rgb888(sd, WIN_VID0); osd_set_layer_config()
1358 _osd_enable_vid_rgb888(sd, WIN_VID1); osd_set_layer_config()
1360 _osd_disable_vid_rgb888(sd); osd_set_layer_config()
1364 _osd_dm6446_vid0_pingpong(sd, osd->field_inversion, osd_set_layer_config()
1374 static void osd_init_layer(struct osd_state *sd, enum osd_layer layer) osd_init_layer() argument
1376 struct osd_state *osd = sd; osd_init_layer()
1386 _osd_disable_layer(sd, layer); osd_init_layer()
1390 _osd_set_zoom(sd, layer, win->h_zoom, win->v_zoom); osd_init_layer()
1393 _osd_start_layer(sd, layer, win->fb_base_phys, 0); osd_init_layer()
1412 _osd_set_layer_config(sd, layer, cfg); osd_init_layer()
1414 _osd_set_osd_clut(sd, osdwin, osdwin_state->clut); osd_init_layer()
1416 _osd_disable_color_key(sd, osdwin); osd_init_layer()
1418 _osd_set_blending_factor(sd, osdwin, osdwin_state->blend); osd_init_layer()
1420 _osd_set_rec601_attenuation(sd, osdwin, osd_init_layer()
1431 _osd_set_layer_config(sd, layer, cfg); osd_init_layer()
1438 static void osd_release_layer(struct osd_state *sd, enum osd_layer layer) osd_release_layer() argument
1440 struct osd_state *osd = sd; osd_release_layer()
1452 osd_init_layer(sd, layer); osd_release_layer()
1460 static int osd_request_layer(struct osd_state *sd, enum osd_layer layer) osd_request_layer() argument
1462 struct osd_state *osd = sd; osd_request_layer()
1479 static void _osd_init(struct osd_state *sd) _osd_init() argument
1481 osd_write(sd, 0, OSD_MODE); _osd_init()
1482 osd_write(sd, 0, OSD_VIDWINMD); _osd_init()
1483 osd_write(sd, 0, OSD_OSDWIN0MD); _osd_init()
1484 osd_write(sd, 0, OSD_OSDWIN1MD); _osd_init()
1485 osd_write(sd, 0, OSD_RECTCUR); _osd_init()
1486 osd_write(sd, 0, OSD_MISCCTL); _osd_init()
1487 if (sd->vpbe_type == VPBE_VERSION_3) { _osd_init()
1488 osd_write(sd, 0, OSD_VBNDRY); _osd_init()
1489 osd_write(sd, 0, OSD_EXTMODE); _osd_init()
1490 osd_write(sd, OSD_MISCCTL_DMANG, OSD_MISCCTL); _osd_init()
1494 static void osd_set_left_margin(struct osd_state *sd, u32 val) osd_set_left_margin() argument
1496 osd_write(sd, val, OSD_BASEPX); osd_set_left_margin()
1499 static void osd_set_top_margin(struct osd_state *sd, u32 val) osd_set_top_margin() argument
1501 osd_write(sd, val, OSD_BASEPY); osd_set_top_margin()
/linux-4.1.27/drivers/media/usb/gspca/m5602/
H A Dm5602_po1030.c24 static void po1030_dump_registers(struct sd *sd);
55 int po1030_probe(struct sd *sd) po1030_probe() argument
58 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; po1030_probe()
76 m5602_write_sensor(sd, po1030_probe()
79 m5602_write_bridge(sd, preinit_po1030[i][1], data); po1030_probe()
82 if (m5602_read_sensor(sd, PO1030_DEVID_H, &dev_id_h, 1)) po1030_probe()
92 sd->gspca_dev.cam.cam_mode = po1030_modes; po1030_probe()
93 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(po1030_modes); po1030_probe()
98 int po1030_init(struct sd *sd) po1030_init() argument
108 err = m5602_write_bridge(sd, po1030_init()
115 err = m5602_write_sensor(sd, po1030_init()
128 po1030_dump_registers(sd); po1030_init()
133 int po1030_init_controls(struct sd *sd) po1030_init_controls() argument
135 struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler; po1030_init_controls()
137 sd->gspca_dev.vdev.ctrl_handler = hdl; po1030_init_controls()
140 sd->auto_white_bal = v4l2_ctrl_new_std(hdl, &po1030_ctrl_ops, po1030_init_controls()
143 sd->green_bal = v4l2_ctrl_new_custom(hdl, &po1030_greenbal_cfg, NULL); po1030_init_controls()
144 sd->red_bal = v4l2_ctrl_new_std(hdl, &po1030_ctrl_ops, po1030_init_controls()
147 sd->blue_bal = v4l2_ctrl_new_std(hdl, &po1030_ctrl_ops, po1030_init_controls()
151 sd->autoexpo = v4l2_ctrl_new_std_menu(hdl, &po1030_ctrl_ops, po1030_init_controls()
153 sd->expo = v4l2_ctrl_new_std(hdl, &po1030_ctrl_ops, V4L2_CID_EXPOSURE, po1030_init_controls()
156 sd->gain = v4l2_ctrl_new_std(hdl, &po1030_ctrl_ops, V4L2_CID_GAIN, 0, po1030_init_controls()
159 sd->hflip = v4l2_ctrl_new_std(hdl, &po1030_ctrl_ops, V4L2_CID_HFLIP, po1030_init_controls()
161 sd->vflip = v4l2_ctrl_new_std(hdl, &po1030_ctrl_ops, V4L2_CID_VFLIP, po1030_init_controls()
169 v4l2_ctrl_auto_cluster(4, &sd->auto_white_bal, 0, false); po1030_init_controls()
170 v4l2_ctrl_auto_cluster(2, &sd->autoexpo, 0, false); po1030_init_controls()
171 v4l2_ctrl_cluster(2, &sd->hflip); po1030_init_controls()
176 int po1030_start(struct sd *sd) po1030_start() argument
178 struct cam *cam = &sd->gspca_dev.cam; po1030_start()
180 int width = cam->cam_mode[sd->gspca_dev.curr_mode].width; po1030_start()
181 int height = cam->cam_mode[sd->gspca_dev.curr_mode].height; po1030_start()
182 int ver_offs = cam->cam_mode[sd->gspca_dev.curr_mode].priv; po1030_start()
188 err = m5602_write_sensor(sd, PO1030_CONTROL3, &data, 1); po1030_start()
193 err = m5602_write_sensor(sd, PO1030_WINDOWWIDTH_H, &data, 1); po1030_start()
198 err = m5602_write_sensor(sd, PO1030_WINDOWWIDTH_L, &data, 1); po1030_start()
203 err = m5602_write_sensor(sd, PO1030_WINDOWHEIGHT_H, &data, 1); po1030_start()
208 err = m5602_write_sensor(sd, PO1030_WINDOWHEIGHT_L, &data, 1); po1030_start()
216 err = m5602_write_sensor(sd, PO1030_CONTROL3, &data, 1); po1030_start()
221 err = m5602_write_sensor(sd, PO1030_WINDOWWIDTH_H, &data, 1); po1030_start()
226 err = m5602_write_sensor(sd, PO1030_WINDOWWIDTH_L, &data, 1); po1030_start()
231 err = m5602_write_sensor(sd, PO1030_WINDOWHEIGHT_H, &data, 1); po1030_start()
236 err = m5602_write_sensor(sd, PO1030_WINDOWHEIGHT_L, &data, 1); po1030_start()
242 err = m5602_write_bridge(sd, M5602_XB_SENSOR_TYPE, 0x0c); po1030_start()
246 err = m5602_write_bridge(sd, M5602_XB_LINE_OF_FRAME_H, 0x81); po1030_start()
250 err = m5602_write_bridge(sd, M5602_XB_PIX_OF_LINE_H, 0x82); po1030_start()
254 err = m5602_write_bridge(sd, M5602_XB_SIG_INI, 0x01); po1030_start()
258 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, po1030_start()
263 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (ver_offs & 0xff)); po1030_start()
268 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, 0); po1030_start()
272 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (height >> 8) & 0xff); po1030_start()
276 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (height & 0xff)); po1030_start()
281 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, 0); po1030_start()
284 err = m5602_write_bridge(sd, M5602_XB_SIG_INI, 0); po1030_start()
287 err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, 0); po1030_start()
291 err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, (width >> 8) & 0xff); po1030_start()
295 err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, (width & 0xff)); po1030_start()
299 err = m5602_write_bridge(sd, M5602_XB_SIG_INI, 0); po1030_start()
305 struct sd *sd = (struct sd *) gspca_dev; po1030_set_exposure() local
315 err = m5602_write_sensor(sd, PO1030_INTEGLINES_H, po1030_set_exposure()
323 err = m5602_write_sensor(sd, PO1030_INTEGLINES_M, po1030_set_exposure()
331 struct sd *sd = (struct sd *) gspca_dev; po1030_set_gain() local
337 err = m5602_write_sensor(sd, PO1030_GLOBALGAIN, po1030_set_gain()
344 struct sd *sd = (struct sd *) gspca_dev; po1030_set_hvflip() local
348 PDEBUG(D_CONF, "Set hvflip %d %d", sd->hflip->val, sd->vflip->val); po1030_set_hvflip()
349 err = m5602_read_sensor(sd, PO1030_CONTROL2, &i2c_data, 1); po1030_set_hvflip()
353 i2c_data = (0x3f & i2c_data) | (sd->hflip->val << 7) | po1030_set_hvflip()
354 (sd->vflip->val << 6); po1030_set_hvflip()
356 err = m5602_write_sensor(sd, PO1030_CONTROL2, po1030_set_hvflip()
364 struct sd *sd = (struct sd *) gspca_dev; po1030_set_red_balance() local
370 err = m5602_write_sensor(sd, PO1030_RED_GAIN, po1030_set_red_balance()
377 struct sd *sd = (struct sd *) gspca_dev; po1030_set_blue_balance() local
383 err = m5602_write_sensor(sd, PO1030_BLUE_GAIN, po1030_set_blue_balance()
391 struct sd *sd = (struct sd *) gspca_dev; po1030_set_green_balance() local
398 err = m5602_write_sensor(sd, PO1030_GREEN_1_GAIN, po1030_set_green_balance()
403 return m5602_write_sensor(sd, PO1030_GREEN_2_GAIN, po1030_set_green_balance()
410 struct sd *sd = (struct sd *) gspca_dev; po1030_set_auto_white_balance() local
414 err = m5602_read_sensor(sd, PO1030_AUTOCTRL1, &i2c_data, 1); po1030_set_auto_white_balance()
420 err = m5602_write_sensor(sd, PO1030_AUTOCTRL1, &i2c_data, 1); po1030_set_auto_white_balance()
427 struct sd *sd = (struct sd *) gspca_dev; po1030_set_auto_exposure() local
431 err = m5602_read_sensor(sd, PO1030_AUTOCTRL1, &i2c_data, 1); po1030_set_auto_exposure()
438 return m5602_write_sensor(sd, PO1030_AUTOCTRL1, &i2c_data, 1); po1030_set_auto_exposure()
441 void po1030_disconnect(struct sd *sd) po1030_disconnect() argument
443 sd->sensor = NULL; po1030_disconnect()
450 struct sd *sd = (struct sd *) gspca_dev; po1030_s_ctrl() local
461 err = po1030_set_green_balance(gspca_dev, sd->green_bal->val); po1030_s_ctrl()
464 err = po1030_set_red_balance(gspca_dev, sd->red_bal->val); po1030_s_ctrl()
467 err = po1030_set_blue_balance(gspca_dev, sd->blue_bal->val); po1030_s_ctrl()
473 err = po1030_set_exposure(gspca_dev, sd->expo->val); po1030_s_ctrl()
488 static void po1030_dump_registers(struct sd *sd) po1030_dump_registers() argument
495 m5602_read_sensor(sd, address, &value, 1); po1030_dump_registers()
506 m5602_read_sensor(sd, address, &old_value, 1); po1030_dump_registers()
507 m5602_write_sensor(sd, address, test_value, 1); po1030_dump_registers()
508 m5602_read_sensor(sd, address, &ctrl_value, 1); po1030_dump_registers()
516 m5602_write_sensor(sd, address, &old_value, 1); po1030_dump_registers()
H A Dm5602_s5k83a.c44 static void s5k83a_dump_registers(struct sd *sd);
45 static int s5k83a_get_rotation(struct sd *sd, u8 *reg_data);
46 static int s5k83a_set_led_indication(struct sd *sd, u8 val);
50 int s5k83a_probe(struct sd *sd) s5k83a_probe() argument
54 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; s5k83a_probe()
72 err = m5602_write_sensor(sd, preinit_s5k83a[i][1], s5k83a_probe()
75 err = m5602_write_bridge(sd, preinit_s5k83a[i][1], s5k83a_probe()
82 if (m5602_read_sensor(sd, 0x00, &prod_id, 1)) s5k83a_probe()
85 if (m5602_read_sensor(sd, 0x01, &ver_id, 1)) s5k83a_probe()
94 sd->gspca_dev.cam.cam_mode = s5k83a_modes; s5k83a_probe()
95 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(s5k83a_modes); s5k83a_probe()
98 sd->rotation_thread = NULL; s5k83a_probe()
103 int s5k83a_init(struct sd *sd) s5k83a_init() argument
112 err = m5602_write_bridge(sd, s5k83a_init()
119 err = m5602_write_sensor(sd, s5k83a_init()
126 err = m5602_write_sensor(sd, s5k83a_init()
136 s5k83a_dump_registers(sd); s5k83a_init()
141 int s5k83a_init_controls(struct sd *sd) s5k83a_init_controls() argument
143 struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler; s5k83a_init_controls()
145 sd->gspca_dev.vdev.ctrl_handler = hdl; s5k83a_init_controls()
158 sd->hflip = v4l2_ctrl_new_std(hdl, &s5k83a_ctrl_ops, V4L2_CID_HFLIP, s5k83a_init_controls()
160 sd->vflip = v4l2_ctrl_new_std(hdl, &s5k83a_ctrl_ops, V4L2_CID_VFLIP, s5k83a_init_controls()
168 v4l2_ctrl_cluster(2, &sd->hflip); s5k83a_init_controls()
175 struct sd *sd = (struct sd *) data; rotation_thread_function() local
181 if (mutex_lock_interruptible(&sd->gspca_dev.usb_lock)) rotation_thread_function()
184 s5k83a_get_rotation(sd, &reg); rotation_thread_function()
189 hflip = sd->hflip->val; rotation_thread_function()
190 vflip = sd->vflip->val; rotation_thread_function()
196 s5k83a_set_flip_real((struct gspca_dev *) sd, rotation_thread_function()
200 mutex_unlock(&sd->gspca_dev.usb_lock); rotation_thread_function()
206 hflip = sd->hflip->val; rotation_thread_function()
207 vflip = sd->vflip->val; rotation_thread_function()
208 s5k83a_set_flip_real((struct gspca_dev *) sd, vflip, hflip); rotation_thread_function()
211 sd->rotation_thread = NULL; rotation_thread_function()
215 int s5k83a_start(struct sd *sd) s5k83a_start() argument
222 sd->rotation_thread = kthread_create(rotation_thread_function, s5k83a_start()
223 sd, "rotation thread"); s5k83a_start()
224 wake_up_process(sd->rotation_thread); s5k83a_start()
230 err = m5602_write_sensor(sd, start_s5k83a[i][1], s5k83a_start()
233 err = m5602_write_bridge(sd, start_s5k83a[i][1], s5k83a_start()
239 return s5k83a_set_led_indication(sd, 1); s5k83a_start()
242 int s5k83a_stop(struct sd *sd) s5k83a_stop() argument
244 if (sd->rotation_thread) s5k83a_stop()
245 kthread_stop(sd->rotation_thread); s5k83a_stop()
247 return s5k83a_set_led_indication(sd, 0); s5k83a_stop()
250 void s5k83a_disconnect(struct sd *sd) s5k83a_disconnect() argument
252 s5k83a_stop(sd); s5k83a_disconnect()
254 sd->sensor = NULL; s5k83a_disconnect()
261 struct sd *sd = (struct sd *) gspca_dev; s5k83a_set_gain() local
265 err = m5602_write_sensor(sd, 0x14, data, 2); s5k83a_set_gain()
271 err = m5602_write_sensor(sd, 0x0d, data, 2); s5k83a_set_gain()
279 err = m5602_write_sensor(sd, S5K83A_GAIN, data, 2); s5k83a_set_gain()
288 struct sd *sd = (struct sd *) gspca_dev; s5k83a_set_brightness() local
291 err = m5602_write_sensor(sd, S5K83A_BRIGHTNESS, data, 1); s5k83a_set_brightness()
299 struct sd *sd = (struct sd *) gspca_dev; s5k83a_set_exposure() local
303 err = m5602_write_sensor(sd, S5K83A_EXPOSURE, data, 2); s5k83a_set_exposure()
312 struct sd *sd = (struct sd *) gspca_dev; s5k83a_set_flip_real() local
315 err = m5602_write_sensor(sd, S5K83A_PAGE_MAP, data, 1); s5k83a_set_flip_real()
324 err = m5602_write_sensor(sd, S5K83A_FLIP, data, 1); s5k83a_set_flip_real()
329 err = m5602_write_sensor(sd, S5K83A_VFLIP_TUNE, data, 1); s5k83a_set_flip_real()
334 err = m5602_write_sensor(sd, S5K83A_HFLIP_TUNE, data, 1); s5k83a_set_flip_real()
342 struct sd *sd = (struct sd *) gspca_dev; s5k83a_set_hvflip() local
343 int hflip = sd->hflip->val; s5k83a_set_hvflip()
344 int vflip = sd->vflip->val; s5k83a_set_hvflip()
346 err = s5k83a_get_rotation(sd, &reg); s5k83a_set_hvflip()
387 static int s5k83a_set_led_indication(struct sd *sd, u8 val) s5k83a_set_led_indication() argument
392 err = m5602_read_bridge(sd, M5602_XB_GPIO_DAT, data); s5k83a_set_led_indication()
401 err = m5602_write_bridge(sd, M5602_XB_GPIO_DAT, data[0]); s5k83a_set_led_indication()
407 static int s5k83a_get_rotation(struct sd *sd, u8 *reg_data) s5k83a_get_rotation() argument
409 int err = m5602_read_bridge(sd, M5602_XB_GPIO_DAT, reg_data); s5k83a_get_rotation()
414 static void s5k83a_dump_registers(struct sd *sd) s5k83a_dump_registers() argument
418 m5602_read_sensor(sd, S5K83A_PAGE_MAP, &old_page, 1); s5k83a_dump_registers()
421 m5602_write_sensor(sd, S5K83A_PAGE_MAP, &page, 1); s5k83a_dump_registers()
426 m5602_read_sensor(sd, address, &val, 1); s5k83a_dump_registers()
433 m5602_write_sensor(sd, S5K83A_PAGE_MAP, &page, 1); s5k83a_dump_registers()
439 m5602_read_sensor(sd, address, &old_val, 1); s5k83a_dump_registers()
440 m5602_write_sensor(sd, address, &test_val, 1); s5k83a_dump_registers()
441 m5602_read_sensor(sd, address, &ctrl_val, 1); s5k83a_dump_registers()
451 m5602_write_sensor(sd, address, &old_val, 1); s5k83a_dump_registers()
455 m5602_write_sensor(sd, S5K83A_PAGE_MAP, &old_page, 1); s5k83a_dump_registers()
H A Dm5602_core.c41 int m5602_read_bridge(struct sd *sd, const u8 address, u8 *i2c_data) m5602_read_bridge() argument
44 struct gspca_dev *gspca_dev = (struct gspca_dev *) sd; m5602_read_bridge()
45 struct usb_device *udev = sd->gspca_dev.dev; m5602_read_bridge()
46 __u8 *buf = sd->gspca_dev.usb_buf; m5602_read_bridge()
63 int m5602_write_bridge(struct sd *sd, const u8 address, const u8 i2c_data) m5602_write_bridge() argument
66 struct gspca_dev *gspca_dev = (struct gspca_dev *) sd; m5602_write_bridge()
67 struct usb_device *udev = sd->gspca_dev.dev; m5602_write_bridge()
68 __u8 *buf = sd->gspca_dev.usb_buf; m5602_write_bridge()
88 static int m5602_wait_for_i2c(struct sd *sd) m5602_wait_for_i2c() argument
94 err = m5602_read_bridge(sd, M5602_XB_I2C_STATUS, &data); m5602_wait_for_i2c()
99 int m5602_read_sensor(struct sd *sd, const u8 address, m5602_read_sensor() argument
103 struct gspca_dev *gspca_dev = (struct gspca_dev *) sd; m5602_read_sensor()
105 if (!len || len > sd->sensor->i2c_regW) m5602_read_sensor()
108 err = m5602_wait_for_i2c(sd); m5602_read_sensor()
112 err = m5602_write_bridge(sd, M5602_XB_I2C_DEV_ADDR, m5602_read_sensor()
113 sd->sensor->i2c_slave_id); m5602_read_sensor()
117 err = m5602_write_bridge(sd, M5602_XB_I2C_REG_ADDR, address); m5602_read_sensor()
125 if (sd->sensor->i2c_regW == 1) { m5602_read_sensor()
126 err = m5602_write_bridge(sd, M5602_XB_I2C_CTRL, 1); m5602_read_sensor()
130 err = m5602_write_bridge(sd, M5602_XB_I2C_CTRL, 0x08); m5602_read_sensor()
132 err = m5602_write_bridge(sd, M5602_XB_I2C_CTRL, 0x18 + len); m5602_read_sensor()
136 err = m5602_wait_for_i2c(sd); m5602_read_sensor()
140 err = m5602_read_bridge(sd, M5602_XB_I2C_DATA, &(i2c_data[i])); m5602_read_sensor()
148 int m5602_write_sensor(struct sd *sd, const u8 address, m5602_write_sensor() argument
153 struct gspca_dev *gspca_dev = (struct gspca_dev *) sd; m5602_write_sensor()
154 struct usb_device *udev = sd->gspca_dev.dev; m5602_write_sensor()
155 __u8 *buf = sd->gspca_dev.usb_buf; m5602_write_sensor()
158 if (len > sd->sensor->i2c_regW || !len) m5602_write_sensor()
164 buf[11] = sd->sensor->i2c_slave_id; m5602_write_sensor()
195 static void m5602_dump_bridge(struct sd *sd) m5602_dump_bridge() argument
200 m5602_read_bridge(sd, i, &val); m5602_dump_bridge()
206 static int m5602_probe_sensor(struct sd *sd) m5602_probe_sensor() argument
209 sd->sensor = &po1030; m5602_probe_sensor()
210 if (!sd->sensor->probe(sd)) m5602_probe_sensor()
214 sd->sensor = &mt9m111; m5602_probe_sensor()
215 if (!sd->sensor->probe(sd)) m5602_probe_sensor()
219 sd->sensor = &s5k4aa; m5602_probe_sensor()
220 if (!sd->sensor->probe(sd)) m5602_probe_sensor()
224 sd->sensor = &ov9650; m5602_probe_sensor()
225 if (!sd->sensor->probe(sd)) m5602_probe_sensor()
229 sd->sensor = &ov7660; m5602_probe_sensor()
230 if (!sd->sensor->probe(sd)) m5602_probe_sensor()
234 sd->sensor = &s5k83a; m5602_probe_sensor()
235 if (!sd->sensor->probe(sd)) m5602_probe_sensor()
240 sd->sensor = NULL; m5602_probe_sensor()
249 struct sd *sd = (struct sd *) gspca_dev; m5602_init() local
254 err = sd->sensor->init(sd); m5602_init()
261 struct sd *sd = (struct sd *) gspca_dev; m5602_init_controls() local
263 if (!sd->sensor->init_controls) m5602_init_controls()
266 return sd->sensor->init_controls(sd); m5602_init_controls()
271 struct sd *sd = (struct sd *) gspca_dev; m5602_start_transfer() local
272 __u8 *buf = sd->gspca_dev.usb_buf; m5602_start_transfer()
278 if (sd->sensor->start) m5602_start_transfer()
279 sd->sensor->start(sd); m5602_start_transfer()
294 struct sd *sd = (struct sd *) gspca_dev; m5602_urb_complete() local
303 data[2] != sd->frame_id) { m5602_urb_complete()
305 sd->frame_id = data[2]; m5602_urb_complete()
314 sd->frame_count++; m5602_urb_complete()
320 sd->frame_count); m5602_urb_complete()
332 sd->frame_count, len); m5602_urb_complete()
346 struct sd *sd = (struct sd *) gspca_dev; m5602_stop_transfer() local
349 if (sd->sensor->stop) m5602_stop_transfer()
350 sd->sensor->stop(sd); m5602_stop_transfer()
368 struct sd *sd = (struct sd *) gspca_dev; m5602_configure() local
375 m5602_dump_bridge(sd); m5602_configure()
378 err = m5602_probe_sensor(sd); m5602_configure()
395 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), m5602_probe()
402 struct sd *sd = (struct sd *) gspca_dev; m5602_disconnect() local
404 if (sd->sensor->disconnect) m5602_disconnect()
405 sd->sensor->disconnect(sd); m5602_disconnect()
H A Dm5602_mt9m111.c24 static void mt9m111_dump_registers(struct sd *sd);
55 int mt9m111_probe(struct sd *sd) mt9m111_probe() argument
59 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; mt9m111_probe()
76 m5602_write_bridge(sd, mt9m111_probe()
82 m5602_write_sensor(sd, mt9m111_probe()
87 if (m5602_read_sensor(sd, MT9M111_SC_CHIPVER, data, 2)) mt9m111_probe()
98 sd->gspca_dev.cam.cam_mode = mt9m111_modes; mt9m111_probe()
99 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(mt9m111_modes); mt9m111_probe()
104 int mt9m111_init(struct sd *sd) mt9m111_init() argument
113 err = m5602_write_bridge(sd, mt9m111_init()
119 err = m5602_write_sensor(sd, mt9m111_init()
125 mt9m111_dump_registers(sd); mt9m111_init()
130 int mt9m111_init_controls(struct sd *sd) mt9m111_init_controls() argument
132 struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler; mt9m111_init_controls()
134 sd->gspca_dev.vdev.ctrl_handler = hdl; mt9m111_init_controls()
137 sd->auto_white_bal = v4l2_ctrl_new_std(hdl, &mt9m111_ctrl_ops, mt9m111_init_controls()
140 sd->green_bal = v4l2_ctrl_new_custom(hdl, &mt9m111_greenbal_cfg, NULL); mt9m111_init_controls()
141 sd->red_bal = v4l2_ctrl_new_std(hdl, &mt9m111_ctrl_ops, mt9m111_init_controls()
144 sd->blue_bal = v4l2_ctrl_new_std(hdl, &mt9m111_ctrl_ops, mt9m111_init_controls()
152 sd->hflip = v4l2_ctrl_new_std(hdl, &mt9m111_ctrl_ops, V4L2_CID_HFLIP, mt9m111_init_controls()
154 sd->vflip = v4l2_ctrl_new_std(hdl, &mt9m111_ctrl_ops, V4L2_CID_VFLIP, mt9m111_init_controls()
162 v4l2_ctrl_auto_cluster(4, &sd->auto_white_bal, 0, false); mt9m111_init_controls()
163 v4l2_ctrl_cluster(2, &sd->hflip); mt9m111_init_controls()
168 int mt9m111_start(struct sd *sd) mt9m111_start() argument
172 struct cam *cam = &sd->gspca_dev.cam; mt9m111_start()
173 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; mt9m111_start()
175 int width = cam->cam_mode[sd->gspca_dev.curr_mode].width - 1; mt9m111_start()
176 int height = cam->cam_mode[sd->gspca_dev.curr_mode].height; mt9m111_start()
180 err = m5602_write_bridge(sd, mt9m111_start()
186 err = m5602_write_sensor(sd, mt9m111_start()
193 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (height >> 8) & 0xff); mt9m111_start()
197 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (height & 0xff)); mt9m111_start()
202 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, 0); mt9m111_start()
206 err = m5602_write_bridge(sd, M5602_XB_SIG_INI, 0); mt9m111_start()
210 err = m5602_write_bridge(sd, M5602_XB_SIG_INI, 2); mt9m111_start()
215 err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, 0); mt9m111_start()
219 err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, mt9m111_start()
224 err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, width & 0xff); mt9m111_start()
228 err = m5602_write_bridge(sd, M5602_XB_SIG_INI, 0); mt9m111_start()
244 void mt9m111_disconnect(struct sd *sd) mt9m111_disconnect() argument
246 sd->sensor = NULL; mt9m111_disconnect()
253 struct sd *sd = (struct sd *) gspca_dev; mt9m111_set_hvflip() local
257 PDEBUG(D_CONF, "Set hvflip to %d %d", sd->hflip->val, sd->vflip->val); mt9m111_set_hvflip()
260 hflip = !sd->hflip->val; mt9m111_set_hvflip()
261 vflip = !sd->vflip->val; mt9m111_set_hvflip()
264 err = m5602_write_sensor(sd, MT9M111_PAGE_MAP, data, 2); mt9m111_set_hvflip()
278 err = m5602_write_sensor(sd, MT9M111_SC_R_MODE_CONTEXT_B, mt9m111_set_hvflip()
286 struct sd *sd = (struct sd *) gspca_dev; mt9m111_set_auto_white_balance() local
290 err = m5602_read_sensor(sd, MT9M111_CP_OPERATING_MODE_CTL, data, 2); mt9m111_set_auto_white_balance()
296 err = m5602_write_sensor(sd, MT9M111_CP_OPERATING_MODE_CTL, data, 2); mt9m111_set_auto_white_balance()
306 struct sd *sd = (struct sd *) gspca_dev; mt9m111_set_gain() local
309 err = m5602_write_sensor(sd, MT9M111_PAGE_MAP, data, 2); mt9m111_set_gain()
334 err = m5602_write_sensor(sd, MT9M111_SC_GLOBAL_GAIN, mt9m111_set_gain()
344 struct sd *sd = (struct sd *) gspca_dev; mt9m111_set_green_balance() local
350 err = m5602_write_sensor(sd, MT9M111_SC_GREEN_1_GAIN, mt9m111_set_green_balance()
355 return m5602_write_sensor(sd, MT9M111_SC_GREEN_2_GAIN, mt9m111_set_green_balance()
362 struct sd *sd = (struct sd *) gspca_dev; mt9m111_set_blue_balance() local
369 return m5602_write_sensor(sd, MT9M111_SC_BLUE_GAIN, mt9m111_set_blue_balance()
376 struct sd *sd = (struct sd *) gspca_dev; mt9m111_set_red_balance() local
383 return m5602_write_sensor(sd, MT9M111_SC_RED_GAIN, mt9m111_set_red_balance()
391 struct sd *sd = (struct sd *) gspca_dev; mt9m111_s_ctrl() local
402 err = mt9m111_set_green_balance(gspca_dev, sd->green_bal->val); mt9m111_s_ctrl()
405 err = mt9m111_set_red_balance(gspca_dev, sd->red_bal->val); mt9m111_s_ctrl()
408 err = mt9m111_set_blue_balance(gspca_dev, sd->blue_bal->val); mt9m111_s_ctrl()
423 static void mt9m111_dump_registers(struct sd *sd) mt9m111_dump_registers() argument
431 m5602_write_sensor(sd, MT9M111_PAGE_MAP, value, 2); mt9m111_dump_registers()
433 m5602_read_sensor(sd, address, value, 2); mt9m111_dump_registers()
440 m5602_write_sensor(sd, MT9M111_PAGE_MAP, value, 2); mt9m111_dump_registers()
442 m5602_read_sensor(sd, address, value, 2); mt9m111_dump_registers()
449 m5602_write_sensor(sd, MT9M111_PAGE_MAP, value, 2); mt9m111_dump_registers()
451 m5602_read_sensor(sd, address, value, 2); mt9m111_dump_registers()
H A Dm5602_ov7660.c24 static void ov7660_dump_registers(struct sd *sd);
44 int ov7660_probe(struct sd *sd) ov7660_probe() argument
64 err = m5602_write_bridge(sd, ov7660_probe()
69 err = m5602_write_sensor(sd, ov7660_probe()
76 if (m5602_read_sensor(sd, OV7660_PID, &prod_id, 1)) ov7660_probe()
79 if (m5602_read_sensor(sd, OV7660_VER, &ver_id, 1)) ov7660_probe()
91 sd->gspca_dev.cam.cam_mode = ov7660_modes; ov7660_probe()
92 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(ov7660_modes); ov7660_probe()
97 int ov7660_init(struct sd *sd) ov7660_init() argument
106 err = m5602_write_bridge(sd, ov7660_init()
111 err = m5602_write_sensor(sd, ov7660_init()
119 ov7660_dump_registers(sd); ov7660_init()
124 int ov7660_init_controls(struct sd *sd) ov7660_init_controls() argument
126 struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler; ov7660_init_controls()
128 sd->gspca_dev.vdev.ctrl_handler = hdl; ov7660_init_controls()
136 sd->autogain = v4l2_ctrl_new_std(hdl, &ov7660_ctrl_ops, ov7660_init_controls()
138 sd->gain = v4l2_ctrl_new_std(hdl, &ov7660_ctrl_ops, V4L2_CID_GAIN, 0, ov7660_init_controls()
141 sd->hflip = v4l2_ctrl_new_std(hdl, &ov7660_ctrl_ops, V4L2_CID_HFLIP, ov7660_init_controls()
143 sd->vflip = v4l2_ctrl_new_std(hdl, &ov7660_ctrl_ops, V4L2_CID_VFLIP, ov7660_init_controls()
151 v4l2_ctrl_auto_cluster(2, &sd->autogain, 0, false); ov7660_init_controls()
152 v4l2_ctrl_cluster(2, &sd->hflip); ov7660_init_controls()
157 int ov7660_start(struct sd *sd) ov7660_start() argument
162 int ov7660_stop(struct sd *sd) ov7660_stop() argument
167 void ov7660_disconnect(struct sd *sd) ov7660_disconnect() argument
169 ov7660_stop(sd); ov7660_disconnect()
171 sd->sensor = NULL; ov7660_disconnect()
178 struct sd *sd = (struct sd *) gspca_dev; ov7660_set_gain() local
182 err = m5602_write_sensor(sd, OV7660_GAIN, &i2c_data, 1); ov7660_set_gain()
191 struct sd *sd = (struct sd *) gspca_dev; ov7660_set_auto_white_balance() local
195 err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1); ov7660_set_auto_white_balance()
200 err = m5602_write_sensor(sd, OV7660_COM8, &i2c_data, 1); ov7660_set_auto_white_balance()
209 struct sd *sd = (struct sd *) gspca_dev; ov7660_set_auto_gain() local
213 err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1); ov7660_set_auto_gain()
219 return m5602_write_sensor(sd, OV7660_COM8, &i2c_data, 1); ov7660_set_auto_gain()
227 struct sd *sd = (struct sd *) gspca_dev; ov7660_set_auto_exposure() local
231 err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1); ov7660_set_auto_exposure()
238 return m5602_write_sensor(sd, OV7660_COM8, &i2c_data, 1); ov7660_set_auto_exposure()
245 struct sd *sd = (struct sd *) gspca_dev; ov7660_set_hvflip() local
247 PDEBUG(D_CONF, "Set hvflip to %d, %d", sd->hflip->val, sd->vflip->val); ov7660_set_hvflip()
249 i2c_data = (sd->hflip->val << 5) | (sd->vflip->val << 4); ov7660_set_hvflip()
251 err = m5602_write_sensor(sd, OV7660_MVFP, &i2c_data, 1); ov7660_set_hvflip()
260 struct sd *sd = (struct sd *) gspca_dev; ov7660_s_ctrl() local
277 err = ov7660_set_gain(gspca_dev, sd->gain->val); ov7660_s_ctrl()
289 static void ov7660_dump_registers(struct sd *sd) ov7660_dump_registers() argument
295 m5602_read_sensor(sd, address, &value, 1); ov7660_dump_registers()
306 m5602_read_sensor(sd, address, &old_value, 1); ov7660_dump_registers()
307 m5602_write_sensor(sd, address, test_value, 1); ov7660_dump_registers()
308 m5602_read_sensor(sd, address, &ctrl_value, 1); ov7660_dump_registers()
316 m5602_write_sensor(sd, address, &old_value, 1); ov7660_dump_registers()
H A Dm5602_ov9650.c24 static void ov9650_dump_registers(struct sd *sd);
146 int ov9650_probe(struct sd *sd) ov9650_probe() argument
150 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov9650_probe()
168 err = m5602_write_sensor(sd, ov9650_probe()
171 err = m5602_write_bridge(sd, ov9650_probe()
178 if (m5602_read_sensor(sd, OV9650_PID, &prod_id, 1)) ov9650_probe()
181 if (m5602_read_sensor(sd, OV9650_VER, &ver_id, 1)) ov9650_probe()
191 sd->gspca_dev.cam.cam_mode = ov9650_modes; ov9650_probe()
192 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(ov9650_modes); ov9650_probe()
197 int ov9650_init(struct sd *sd) ov9650_init() argument
203 ov9650_dump_registers(sd); ov9650_init()
208 err = m5602_write_sensor(sd, init_ov9650[i][1], ov9650_init()
211 err = m5602_write_bridge(sd, init_ov9650[i][1], data); ov9650_init()
217 int ov9650_init_controls(struct sd *sd) ov9650_init_controls() argument
219 struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler; ov9650_init_controls()
221 sd->gspca_dev.vdev.ctrl_handler = hdl; ov9650_init_controls()
224 sd->auto_white_bal = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, ov9650_init_controls()
227 sd->red_bal = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, ov9650_init_controls()
230 sd->blue_bal = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, ov9650_init_controls()
234 sd->autoexpo = v4l2_ctrl_new_std_menu(hdl, &ov9650_ctrl_ops, ov9650_init_controls()
236 sd->expo = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, V4L2_CID_EXPOSURE, ov9650_init_controls()
239 sd->autogain = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, ov9650_init_controls()
241 sd->gain = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, V4L2_CID_GAIN, 0, ov9650_init_controls()
244 sd->hflip = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, V4L2_CID_HFLIP, ov9650_init_controls()
246 sd->vflip = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, V4L2_CID_VFLIP, ov9650_init_controls()
254 v4l2_ctrl_auto_cluster(3, &sd->auto_white_bal, 0, false); ov9650_init_controls()
255 v4l2_ctrl_auto_cluster(2, &sd->autoexpo, 0, false); ov9650_init_controls()
256 v4l2_ctrl_auto_cluster(2, &sd->autogain, 0, false); ov9650_init_controls()
257 v4l2_ctrl_cluster(2, &sd->hflip); ov9650_init_controls()
262 int ov9650_start(struct sd *sd) ov9650_start() argument
266 struct cam *cam = &sd->gspca_dev.cam; ov9650_start()
268 int width = cam->cam_mode[sd->gspca_dev.curr_mode].width; ov9650_start()
269 int height = cam->cam_mode[sd->gspca_dev.curr_mode].height; ov9650_start()
270 int ver_offs = cam->cam_mode[sd->gspca_dev.curr_mode].priv; ov9650_start()
272 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov9650_start()
275 sd->vflip->val) || ov9650_start()
277 !sd->vflip->val)) ov9650_start()
286 err = m5602_write_bridge(sd, res_init_ov9650[i][1], ov9650_start()
290 err = m5602_write_sensor(sd, ov9650_start()
297 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, ov9650_start()
302 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (ver_offs & 0xff)); ov9650_start()
306 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, 0); ov9650_start()
310 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (height >> 8) & 0xff); ov9650_start()
314 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, (height & 0xff)); ov9650_start()
319 err = m5602_write_bridge(sd, M5602_XB_VSYNC_PARA, 0); ov9650_start()
323 err = m5602_write_bridge(sd, M5602_XB_SIG_INI, 0); ov9650_start()
327 err = m5602_write_bridge(sd, M5602_XB_SIG_INI, 2); ov9650_start()
331 err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, ov9650_start()
336 err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, hor_offs & 0xff); ov9650_start()
340 err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, ov9650_start()
345 err = m5602_write_bridge(sd, M5602_XB_HSYNC_PARA, ov9650_start()
350 err = m5602_write_bridge(sd, M5602_XB_SIG_INI, 0); ov9650_start()
360 err = m5602_write_sensor(sd, OV9650_COM7, &data, 1); ov9650_start()
368 err = m5602_write_sensor(sd, OV9650_COM7, &data, 1); ov9650_start()
376 err = m5602_write_sensor(sd, OV9650_COM7, &data, 1); ov9650_start()
384 err = m5602_write_sensor(sd, OV9650_COM7, &data, 1); ov9650_start()
390 int ov9650_stop(struct sd *sd) ov9650_stop() argument
393 return m5602_write_sensor(sd, OV9650_COM2, &data, 1); ov9650_stop()
396 void ov9650_disconnect(struct sd *sd) ov9650_disconnect() argument
398 ov9650_stop(sd); ov9650_disconnect()
400 sd->sensor = NULL; ov9650_disconnect()
405 struct sd *sd = (struct sd *) gspca_dev; ov9650_set_exposure() local
413 err = m5602_write_sensor(sd, OV9650_AECHM, ov9650_set_exposure()
420 err = m5602_write_sensor(sd, OV9650_AECH, ov9650_set_exposure()
427 err = m5602_write_sensor(sd, OV9650_COM1, &i2c_data, 1); ov9650_set_exposure()
435 struct sd *sd = (struct sd *) gspca_dev; ov9650_set_gain() local
442 err = m5602_read_sensor(sd, OV9650_VREF, &i2c_data, 1); ov9650_set_gain()
449 err = m5602_write_sensor(sd, OV9650_VREF, &i2c_data, 1); ov9650_set_gain()
455 err = m5602_write_sensor(sd, OV9650_GAIN, &i2c_data, 1); ov9650_set_gain()
463 struct sd *sd = (struct sd *) gspca_dev; ov9650_set_red_balance() local
468 err = m5602_write_sensor(sd, OV9650_RED, &i2c_data, 1); ov9650_set_red_balance()
476 struct sd *sd = (struct sd *) gspca_dev; ov9650_set_blue_balance() local
481 err = m5602_write_sensor(sd, OV9650_BLUE, &i2c_data, 1); ov9650_set_blue_balance()
489 struct sd *sd = (struct sd *) gspca_dev; ov9650_set_hvflip() local
490 int hflip = sd->hflip->val; ov9650_set_hvflip()
491 int vflip = sd->vflip->val; ov9650_set_hvflip()
499 err = m5602_write_sensor(sd, OV9650_MVFP, &i2c_data, 1); ov9650_set_hvflip()
505 err = ov9650_start(sd); ov9650_set_hvflip()
515 struct sd *sd = (struct sd *) gspca_dev; ov9650_set_auto_exposure() local
519 err = m5602_read_sensor(sd, OV9650_COM8, &i2c_data, 1); ov9650_set_auto_exposure()
526 return m5602_write_sensor(sd, OV9650_COM8, &i2c_data, 1); ov9650_set_auto_exposure()
534 struct sd *sd = (struct sd *) gspca_dev; ov9650_set_auto_white_balance() local
538 err = m5602_read_sensor(sd, OV9650_COM8, &i2c_data, 1); ov9650_set_auto_white_balance()
543 err = m5602_write_sensor(sd, OV9650_COM8, &i2c_data, 1); ov9650_set_auto_white_balance()
552 struct sd *sd = (struct sd *) gspca_dev; ov9650_set_auto_gain() local
556 err = m5602_read_sensor(sd, OV9650_COM8, &i2c_data, 1); ov9650_set_auto_gain()
562 return m5602_write_sensor(sd, OV9650_COM8, &i2c_data, 1); ov9650_set_auto_gain()
569 struct sd *sd = (struct sd *) gspca_dev; ov9650_s_ctrl() local
580 err = ov9650_set_red_balance(gspca_dev, sd->red_bal->val); ov9650_s_ctrl()
583 err = ov9650_set_blue_balance(gspca_dev, sd->blue_bal->val); ov9650_s_ctrl()
589 err = ov9650_set_exposure(gspca_dev, sd->expo->val); ov9650_s_ctrl()
595 err = ov9650_set_gain(gspca_dev, sd->gain->val); ov9650_s_ctrl()
607 static void ov9650_dump_registers(struct sd *sd) ov9650_dump_registers() argument
613 m5602_read_sensor(sd, address, &value, 1); ov9650_dump_registers()
624 m5602_read_sensor(sd, address, &old_value, 1); ov9650_dump_registers()
625 m5602_write_sensor(sd, address, test_value, 1); ov9650_dump_registers()
626 m5602_read_sensor(sd, address, &ctrl_value, 1); ov9650_dump_registers()
634 m5602_write_sensor(sd, address, &old_value, 1); ov9650_dump_registers()
H A Dm5602_s5k4aa.c24 static void s5k4aa_dump_registers(struct sd *sd);
144 int s5k4aa_probe(struct sd *sd) s5k4aa_probe() argument
148 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; s5k4aa_probe()
169 err = m5602_write_bridge(sd, s5k4aa_probe()
176 err = m5602_write_sensor(sd, s5k4aa_probe()
184 err = m5602_write_sensor(sd, s5k4aa_probe()
195 if (m5602_read_sensor(sd, 0x00, prod_id, 2)) s5k4aa_probe()
197 if (m5602_read_sensor(sd, 0x02, prod_id+2, 2)) s5k4aa_probe()
199 if (m5602_read_sensor(sd, 0x04, prod_id+4, 2)) s5k4aa_probe()
208 sd->gspca_dev.cam.cam_mode = s5k4aa_modes; s5k4aa_probe()
209 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(s5k4aa_modes); s5k4aa_probe()
214 int s5k4aa_start(struct sd *sd) s5k4aa_start() argument
218 struct cam *cam = &sd->gspca_dev.cam; s5k4aa_start()
219 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; s5k4aa_start()
221 switch (cam->cam_mode[sd->gspca_dev.curr_mode].width) { s5k4aa_start()
228 err = m5602_write_bridge(sd, s5k4aa_start()
235 err = m5602_write_sensor(sd, s5k4aa_start()
243 err = m5602_write_sensor(sd, s5k4aa_start()
261 err = m5602_write_bridge(sd, s5k4aa_start()
268 err = m5602_write_sensor(sd, s5k4aa_start()
276 err = m5602_write_sensor(sd, s5k4aa_start()
294 int s5k4aa_init(struct sd *sd) s5k4aa_init() argument
303 err = m5602_write_bridge(sd, s5k4aa_init()
310 err = m5602_write_sensor(sd, s5k4aa_init()
317 err = m5602_write_sensor(sd, s5k4aa_init()
327 s5k4aa_dump_registers(sd); s5k4aa_init()
332 int s5k4aa_init_controls(struct sd *sd) s5k4aa_init_controls() argument
334 struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler; s5k4aa_init_controls()
336 sd->gspca_dev.vdev.ctrl_handler = hdl; s5k4aa_init_controls()
351 sd->hflip = v4l2_ctrl_new_std(hdl, &s5k4aa_ctrl_ops, V4L2_CID_HFLIP, s5k4aa_init_controls()
353 sd->vflip = v4l2_ctrl_new_std(hdl, &s5k4aa_ctrl_ops, V4L2_CID_VFLIP, s5k4aa_init_controls()
361 v4l2_ctrl_cluster(2, &sd->hflip); s5k4aa_init_controls()
368 struct sd *sd = (struct sd *) gspca_dev; s5k4aa_set_exposure() local
373 err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); s5k4aa_set_exposure()
377 err = m5602_write_sensor(sd, S5K4AA_EXPOSURE_HI, &data, 1); s5k4aa_set_exposure()
381 err = m5602_write_sensor(sd, S5K4AA_EXPOSURE_LO, &data, 1); s5k4aa_set_exposure()
388 struct sd *sd = (struct sd *) gspca_dev; s5k4aa_set_hvflip() local
391 int hflip = sd->hflip->val; s5k4aa_set_hvflip()
392 int vflip = sd->vflip->val; s5k4aa_set_hvflip()
395 err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); s5k4aa_set_hvflip()
399 err = m5602_read_sensor(sd, S5K4AA_READ_MODE, &data, 1); s5k4aa_set_hvflip()
409 err = m5602_write_sensor(sd, S5K4AA_READ_MODE, &data, 1); s5k4aa_set_hvflip()
413 err = m5602_read_sensor(sd, S5K4AA_COLSTART_LO, &data, 1); s5k4aa_set_hvflip()
420 err = m5602_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1); s5k4aa_set_hvflip()
424 err = m5602_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); s5k4aa_set_hvflip()
431 err = m5602_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1); s5k4aa_set_hvflip()
440 struct sd *sd = (struct sd *) gspca_dev; s5k4aa_set_gain() local
445 err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); s5k4aa_set_gain()
450 err = m5602_write_sensor(sd, S5K4AA_GAIN, &data, 1); s5k4aa_set_gain()
457 struct sd *sd = (struct sd *) gspca_dev; s5k4aa_set_brightness() local
462 err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); s5k4aa_set_brightness()
467 return m5602_write_sensor(sd, S5K4AA_BRIGHTNESS, &data, 1); s5k4aa_set_brightness()
472 struct sd *sd = (struct sd *) gspca_dev; s5k4aa_set_noise() local
477 err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1); s5k4aa_set_noise()
482 return m5602_write_sensor(sd, S5K4AA_NOISE_SUPP, &data, 1); s5k4aa_set_noise()
517 void s5k4aa_disconnect(struct sd *sd) s5k4aa_disconnect() argument
519 sd->sensor = NULL; s5k4aa_disconnect()
522 static void s5k4aa_dump_registers(struct sd *sd) s5k4aa_dump_registers() argument
526 m5602_read_sensor(sd, S5K4AA_PAGE_MAP, &old_page, 1); s5k4aa_dump_registers()
528 m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &page, 1); s5k4aa_dump_registers()
533 m5602_read_sensor(sd, address, &value, 1); s5k4aa_dump_registers()
541 m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &page, 1); s5k4aa_dump_registers()
547 m5602_read_sensor(sd, address, &old_value, 1); s5k4aa_dump_registers()
548 m5602_write_sensor(sd, address, &test_value, 1); s5k4aa_dump_registers()
549 m5602_read_sensor(sd, address, &ctrl_value, 1); s5k4aa_dump_registers()
559 m5602_write_sensor(sd, address, &old_value, 1); s5k4aa_dump_registers()
563 m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &old_page, 1); s5k4aa_dump_registers()
H A Dm5602_sensor.h55 int (*probe)(struct sd *sd);
58 int (*init)(struct sd *sd);
61 int (*init_controls)(struct sd *sd);
64 int (*start)(struct sd *sd);
67 int (*stop)(struct sd *sd);
70 void (*disconnect)(struct sd *sd);
H A Dm5602_bridge.h133 struct sd { struct
169 struct sd *sd, const u8 address, u8 *i2c_data);
172 struct sd *sd, const u8 address, const u8 i2c_data);
174 int m5602_write_sensor(struct sd *sd, const u8 address,
177 int m5602_read_sensor(struct sd *sd, const u8 address,
H A Dm5602_ov7660.h91 int ov7660_probe(struct sd *sd);
92 int ov7660_init(struct sd *sd);
93 int ov7660_init(struct sd *sd);
94 int ov7660_init_controls(struct sd *sd);
95 int ov7660_start(struct sd *sd);
96 int ov7660_stop(struct sd *sd);
97 void ov7660_disconnect(struct sd *sd);
H A Dm5602_ov9650.h140 int ov9650_probe(struct sd *sd);
141 int ov9650_init(struct sd *sd);
142 int ov9650_init_controls(struct sd *sd);
143 int ov9650_start(struct sd *sd);
144 int ov9650_stop(struct sd *sd);
145 void ov9650_disconnect(struct sd *sd);
H A Dm5602_s5k83a.h46 int s5k83a_probe(struct sd *sd);
47 int s5k83a_init(struct sd *sd);
48 int s5k83a_init_controls(struct sd *sd);
49 int s5k83a_start(struct sd *sd);
50 int s5k83a_stop(struct sd *sd);
51 void s5k83a_disconnect(struct sd *sd);
/linux-4.1.27/drivers/media/i2c/
H A Dadv7842.c69 struct v4l2_subdev sd; member in struct:adv7842_state
214 static inline struct adv7842_state *to_state(struct v4l2_subdev *sd) to_state() argument
216 return container_of(sd, struct adv7842_state, sd); to_state()
221 return &container_of(ctrl->handler, struct adv7842_state, hdl)->sd; to_sd()
319 static inline int io_read(struct v4l2_subdev *sd, u8 reg) io_read() argument
321 struct i2c_client *client = v4l2_get_subdevdata(sd); io_read()
326 static inline int io_write(struct v4l2_subdev *sd, u8 reg, u8 val) io_write() argument
328 struct i2c_client *client = v4l2_get_subdevdata(sd); io_write()
333 static inline int io_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) io_write_and_or() argument
335 return io_write(sd, reg, (io_read(sd, reg) & mask) | val); io_write_and_or()
338 static inline int avlink_read(struct v4l2_subdev *sd, u8 reg) avlink_read() argument
340 struct adv7842_state *state = to_state(sd); avlink_read()
345 static inline int avlink_write(struct v4l2_subdev *sd, u8 reg, u8 val) avlink_write() argument
347 struct adv7842_state *state = to_state(sd); avlink_write()
352 static inline int cec_read(struct v4l2_subdev *sd, u8 reg) cec_read() argument
354 struct adv7842_state *state = to_state(sd); cec_read()
359 static inline int cec_write(struct v4l2_subdev *sd, u8 reg, u8 val) cec_write() argument
361 struct adv7842_state *state = to_state(sd); cec_write()
366 static inline int cec_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) cec_write_and_or() argument
368 return cec_write(sd, reg, (cec_read(sd, reg) & mask) | val); cec_write_and_or()
371 static inline int infoframe_read(struct v4l2_subdev *sd, u8 reg) infoframe_read() argument
373 struct adv7842_state *state = to_state(sd); infoframe_read()
378 static inline int infoframe_write(struct v4l2_subdev *sd, u8 reg, u8 val) infoframe_write() argument
380 struct adv7842_state *state = to_state(sd); infoframe_write()
385 static inline int sdp_io_read(struct v4l2_subdev *sd, u8 reg) sdp_io_read() argument
387 struct adv7842_state *state = to_state(sd); sdp_io_read()
392 static inline int sdp_io_write(struct v4l2_subdev *sd, u8 reg, u8 val) sdp_io_write() argument
394 struct adv7842_state *state = to_state(sd); sdp_io_write()
399 static inline int sdp_io_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) sdp_io_write_and_or() argument
401 return sdp_io_write(sd, reg, (sdp_io_read(sd, reg) & mask) | val); sdp_io_write_and_or()
404 static inline int sdp_read(struct v4l2_subdev *sd, u8 reg) sdp_read() argument
406 struct adv7842_state *state = to_state(sd); sdp_read()
411 static inline int sdp_write(struct v4l2_subdev *sd, u8 reg, u8 val) sdp_write() argument
413 struct adv7842_state *state = to_state(sd); sdp_write()
418 static inline int sdp_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) sdp_write_and_or() argument
420 return sdp_write(sd, reg, (sdp_read(sd, reg) & mask) | val); sdp_write_and_or()
423 static inline int afe_read(struct v4l2_subdev *sd, u8 reg) afe_read() argument
425 struct adv7842_state *state = to_state(sd); afe_read()
430 static inline int afe_write(struct v4l2_subdev *sd, u8 reg, u8 val) afe_write() argument
432 struct adv7842_state *state = to_state(sd); afe_write()
437 static inline int afe_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) afe_write_and_or() argument
439 return afe_write(sd, reg, (afe_read(sd, reg) & mask) | val); afe_write_and_or()
442 static inline int rep_read(struct v4l2_subdev *sd, u8 reg) rep_read() argument
444 struct adv7842_state *state = to_state(sd); rep_read()
449 static inline int rep_write(struct v4l2_subdev *sd, u8 reg, u8 val) rep_write() argument
451 struct adv7842_state *state = to_state(sd); rep_write()
456 static inline int rep_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) rep_write_and_or() argument
458 return rep_write(sd, reg, (rep_read(sd, reg) & mask) | val); rep_write_and_or()
461 static inline int edid_read(struct v4l2_subdev *sd, u8 reg) edid_read() argument
463 struct adv7842_state *state = to_state(sd); edid_read()
468 static inline int edid_write(struct v4l2_subdev *sd, u8 reg, u8 val) edid_write() argument
470 struct adv7842_state *state = to_state(sd); edid_write()
475 static inline int hdmi_read(struct v4l2_subdev *sd, u8 reg) hdmi_read() argument
477 struct adv7842_state *state = to_state(sd); hdmi_read()
482 static inline int hdmi_write(struct v4l2_subdev *sd, u8 reg, u8 val) hdmi_write() argument
484 struct adv7842_state *state = to_state(sd); hdmi_write()
489 static inline int hdmi_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) hdmi_write_and_or() argument
491 return hdmi_write(sd, reg, (hdmi_read(sd, reg) & mask) | val); hdmi_write_and_or()
494 static inline int cp_read(struct v4l2_subdev *sd, u8 reg) cp_read() argument
496 struct adv7842_state *state = to_state(sd); cp_read()
501 static inline int cp_write(struct v4l2_subdev *sd, u8 reg, u8 val) cp_write() argument
503 struct adv7842_state *state = to_state(sd); cp_write()
508 static inline int cp_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) cp_write_and_or() argument
510 return cp_write(sd, reg, (cp_read(sd, reg) & mask) | val); cp_write_and_or()
513 static inline int vdp_read(struct v4l2_subdev *sd, u8 reg) vdp_read() argument
515 struct adv7842_state *state = to_state(sd); vdp_read()
520 static inline int vdp_write(struct v4l2_subdev *sd, u8 reg, u8 val) vdp_write() argument
522 struct adv7842_state *state = to_state(sd); vdp_write()
527 static void main_reset(struct v4l2_subdev *sd) main_reset() argument
529 struct i2c_client *client = v4l2_get_subdevdata(sd); main_reset()
531 v4l2_dbg(1, debug, sd, "%s:\n", __func__); main_reset()
540 static inline bool is_analog_input(struct v4l2_subdev *sd) is_analog_input() argument
542 struct adv7842_state *state = to_state(sd); is_analog_input()
548 static inline bool is_digital_input(struct v4l2_subdev *sd) is_digital_input() argument
550 struct adv7842_state *state = to_state(sd); is_digital_input()
578 adv7842_get_dv_timings_cap(struct v4l2_subdev *sd) adv7842_get_dv_timings_cap() argument
580 return is_digital_input(sd) ? &adv7842_timings_cap_digital : adv7842_get_dv_timings_cap()
591 struct v4l2_subdev *sd = &state->sd; adv7842_delayed_work_enable_hotplug() local
595 v4l2_dbg(2, debug, sd, "%s: enable hotplug on ports: 0x%x\n", adv7842_delayed_work_enable_hotplug()
602 io_write_and_or(sd, 0x20, 0xcf, mask); adv7842_delayed_work_enable_hotplug()
605 static int edid_write_vga_segment(struct v4l2_subdev *sd) edid_write_vga_segment() argument
607 struct i2c_client *client = v4l2_get_subdevdata(sd); edid_write_vga_segment()
608 struct adv7842_state *state = to_state(sd); edid_write_vga_segment()
613 v4l2_dbg(2, debug, sd, "%s: write EDID on VGA port\n", __func__); edid_write_vga_segment()
616 io_write_and_or(sd, 0x20, 0xcf, 0x00); edid_write_vga_segment()
619 rep_write_and_or(sd, 0x7f, 0x7f, 0x00); edid_write_vga_segment()
622 rep_write_and_or(sd, 0x77, 0xef, 0x10); edid_write_vga_segment()
633 rep_write_and_or(sd, 0x7f, 0x7f, 0x80); edid_write_vga_segment()
636 if (rep_read(sd, 0x79) & 0x20) edid_write_vga_segment()
685 static int edid_write_hdmi_segment(struct v4l2_subdev *sd, u8 port) edid_write_hdmi_segment() argument
687 struct i2c_client *client = v4l2_get_subdevdata(sd); edid_write_hdmi_segment()
688 struct adv7842_state *state = to_state(sd); edid_write_hdmi_segment()
694 v4l2_dbg(2, debug, sd, "%s: write EDID on port %c (spa at 0x%x)\n", edid_write_hdmi_segment()
698 io_write_and_or(sd, 0x20, 0xcf, 0x00); edid_write_hdmi_segment()
701 rep_write_and_or(sd, 0x77, 0xf3, 0x00); edid_write_hdmi_segment()
707 rep_write_and_or(sd, 0x77, 0xef, 0x00); edid_write_hdmi_segment()
719 rep_write(sd, 0x72, val[spa_loc]); edid_write_hdmi_segment()
720 rep_write(sd, 0x73, val[spa_loc + 1]); edid_write_hdmi_segment()
722 rep_write(sd, 0x74, val[spa_loc]); edid_write_hdmi_segment()
723 rep_write(sd, 0x75, val[spa_loc + 1]); edid_write_hdmi_segment()
725 rep_write(sd, 0x76, spa_loc & 0xff); edid_write_hdmi_segment()
726 rep_write_and_or(sd, 0x77, 0xbf, (spa_loc >> 2) & 0x40); edid_write_hdmi_segment()
731 rep_write_and_or(sd, 0x77, 0xf3, state->hdmi_edid.present); edid_write_hdmi_segment()
734 if (rep_read(sd, 0x7d) & state->hdmi_edid.present) edid_write_hdmi_segment()
754 static void adv7842_inv_register(struct v4l2_subdev *sd) adv7842_inv_register() argument
756 v4l2_info(sd, "0x000-0x0ff: IO Map\n"); adv7842_inv_register()
757 v4l2_info(sd, "0x100-0x1ff: AVLink Map\n"); adv7842_inv_register()
758 v4l2_info(sd, "0x200-0x2ff: CEC Map\n"); adv7842_inv_register()
759 v4l2_info(sd, "0x300-0x3ff: InfoFrame Map\n"); adv7842_inv_register()
760 v4l2_info(sd, "0x400-0x4ff: SDP_IO Map\n"); adv7842_inv_register()
761 v4l2_info(sd, "0x500-0x5ff: SDP Map\n"); adv7842_inv_register()
762 v4l2_info(sd, "0x600-0x6ff: AFE Map\n"); adv7842_inv_register()
763 v4l2_info(sd, "0x700-0x7ff: Repeater Map\n"); adv7842_inv_register()
764 v4l2_info(sd, "0x800-0x8ff: EDID Map\n"); adv7842_inv_register()
765 v4l2_info(sd, "0x900-0x9ff: HDMI Map\n"); adv7842_inv_register()
766 v4l2_info(sd, "0xa00-0xaff: CP Map\n"); adv7842_inv_register()
767 v4l2_info(sd, "0xb00-0xbff: VDP Map\n"); adv7842_inv_register()
770 static int adv7842_g_register(struct v4l2_subdev *sd, adv7842_g_register() argument
776 reg->val = io_read(sd, reg->reg & 0xff); adv7842_g_register()
779 reg->val = avlink_read(sd, reg->reg & 0xff); adv7842_g_register()
782 reg->val = cec_read(sd, reg->reg & 0xff); adv7842_g_register()
785 reg->val = infoframe_read(sd, reg->reg & 0xff); adv7842_g_register()
788 reg->val = sdp_io_read(sd, reg->reg & 0xff); adv7842_g_register()
791 reg->val = sdp_read(sd, reg->reg & 0xff); adv7842_g_register()
794 reg->val = afe_read(sd, reg->reg & 0xff); adv7842_g_register()
797 reg->val = rep_read(sd, reg->reg & 0xff); adv7842_g_register()
800 reg->val = edid_read(sd, reg->reg & 0xff); adv7842_g_register()
803 reg->val = hdmi_read(sd, reg->reg & 0xff); adv7842_g_register()
806 reg->val = cp_read(sd, reg->reg & 0xff); adv7842_g_register()
809 reg->val = vdp_read(sd, reg->reg & 0xff); adv7842_g_register()
812 v4l2_info(sd, "Register %03llx not supported\n", reg->reg); adv7842_g_register()
813 adv7842_inv_register(sd); adv7842_g_register()
819 static int adv7842_s_register(struct v4l2_subdev *sd, adv7842_s_register() argument
826 io_write(sd, reg->reg & 0xff, val); adv7842_s_register()
829 avlink_write(sd, reg->reg & 0xff, val); adv7842_s_register()
832 cec_write(sd, reg->reg & 0xff, val); adv7842_s_register()
835 infoframe_write(sd, reg->reg & 0xff, val); adv7842_s_register()
838 sdp_io_write(sd, reg->reg & 0xff, val); adv7842_s_register()
841 sdp_write(sd, reg->reg & 0xff, val); adv7842_s_register()
844 afe_write(sd, reg->reg & 0xff, val); adv7842_s_register()
847 rep_write(sd, reg->reg & 0xff, val); adv7842_s_register()
850 edid_write(sd, reg->reg & 0xff, val); adv7842_s_register()
853 hdmi_write(sd, reg->reg & 0xff, val); adv7842_s_register()
856 cp_write(sd, reg->reg & 0xff, val); adv7842_s_register()
859 vdp_write(sd, reg->reg & 0xff, val); adv7842_s_register()
862 v4l2_info(sd, "Register %03llx not supported\n", reg->reg); adv7842_s_register()
863 adv7842_inv_register(sd); adv7842_s_register()
870 static int adv7842_s_detect_tx_5v_ctrl(struct v4l2_subdev *sd) adv7842_s_detect_tx_5v_ctrl() argument
872 struct adv7842_state *state = to_state(sd); adv7842_s_detect_tx_5v_ctrl()
874 u8 reg_io_6f = io_read(sd, 0x6f); adv7842_s_detect_tx_5v_ctrl()
882 v4l2_dbg(1, debug, sd, "%s: 0x%x -> 0x%x\n", __func__, prev, val); adv7842_s_detect_tx_5v_ctrl()
889 static int find_and_set_predefined_video_timings(struct v4l2_subdev *sd, find_and_set_predefined_video_timings() argument
898 is_digital_input(sd) ? 250000 : 1000000)) find_and_set_predefined_video_timings()
901 io_write(sd, 0x00, predef_vid_timings[i].vid_std); find_and_set_predefined_video_timings()
903 io_write(sd, 0x01, (predef_vid_timings[i].v_freq << 4) + prim_mode); find_and_set_predefined_video_timings()
910 static int configure_predefined_video_timings(struct v4l2_subdev *sd, configure_predefined_video_timings() argument
913 struct adv7842_state *state = to_state(sd); configure_predefined_video_timings()
916 v4l2_dbg(1, debug, sd, "%s\n", __func__); configure_predefined_video_timings()
919 io_write(sd, 0x16, 0x43); configure_predefined_video_timings()
920 io_write(sd, 0x17, 0x5a); configure_predefined_video_timings()
922 cp_write_and_or(sd, 0x81, 0xef, 0x00); configure_predefined_video_timings()
923 cp_write(sd, 0x26, 0x00); configure_predefined_video_timings()
924 cp_write(sd, 0x27, 0x00); configure_predefined_video_timings()
925 cp_write(sd, 0x28, 0x00); configure_predefined_video_timings()
926 cp_write(sd, 0x29, 0x00); configure_predefined_video_timings()
927 cp_write(sd, 0x8f, 0x40); configure_predefined_video_timings()
928 cp_write(sd, 0x90, 0x00); configure_predefined_video_timings()
929 cp_write(sd, 0xa5, 0x00); configure_predefined_video_timings()
930 cp_write(sd, 0xa6, 0x00); configure_predefined_video_timings()
931 cp_write(sd, 0xa7, 0x00); configure_predefined_video_timings()
932 cp_write(sd, 0xab, 0x00); configure_predefined_video_timings()
933 cp_write(sd, 0xac, 0x00); configure_predefined_video_timings()
938 err = find_and_set_predefined_video_timings(sd, configure_predefined_video_timings()
941 err = find_and_set_predefined_video_timings(sd, configure_predefined_video_timings()
945 err = find_and_set_predefined_video_timings(sd, configure_predefined_video_timings()
948 err = find_and_set_predefined_video_timings(sd, configure_predefined_video_timings()
952 v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n", configure_predefined_video_timings()
962 static void configure_custom_video_timings(struct v4l2_subdev *sd, configure_custom_video_timings() argument
965 struct adv7842_state *state = to_state(sd); configure_custom_video_timings()
966 struct i2c_client *client = v4l2_get_subdevdata(sd); configure_custom_video_timings()
980 v4l2_dbg(2, debug, sd, "%s\n", __func__); configure_custom_video_timings()
986 io_write(sd, 0x00, 0x07); /* video std */ configure_custom_video_timings()
987 io_write(sd, 0x01, 0x02); /* prim mode */ configure_custom_video_timings()
989 cp_write_and_or(sd, 0x81, 0xef, 0x10); configure_custom_video_timings()
995 v4l2_err(sd, "writing to reg 0x16 and 0x17 failed\n"); configure_custom_video_timings()
1000 cp_write(sd, 0x26, (cp_start_sav >> 8) & 0xf); configure_custom_video_timings()
1001 cp_write(sd, 0x27, (cp_start_sav & 0xff)); configure_custom_video_timings()
1002 cp_write(sd, 0x28, (cp_start_eav >> 8) & 0xf); configure_custom_video_timings()
1003 cp_write(sd, 0x29, (cp_start_eav & 0xff)); configure_custom_video_timings()
1006 cp_write(sd, 0xa5, (cp_start_vbi >> 4) & 0xff); configure_custom_video_timings()
1007 cp_write(sd, 0xa6, ((cp_start_vbi & 0xf) << 4) | configure_custom_video_timings()
1009 cp_write(sd, 0xa7, cp_end_vbi & 0xff); configure_custom_video_timings()
1014 io_write(sd, 0x00, 0x02); /* video std */ configure_custom_video_timings()
1015 io_write(sd, 0x01, 0x06); /* prim mode */ configure_custom_video_timings()
1018 v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n", configure_custom_video_timings()
1023 cp_write(sd, 0x8f, (ch1_fr_ll >> 8) & 0x7); configure_custom_video_timings()
1024 cp_write(sd, 0x90, ch1_fr_ll & 0xff); configure_custom_video_timings()
1025 cp_write(sd, 0xab, (height >> 4) & 0xff); configure_custom_video_timings()
1026 cp_write(sd, 0xac, (height & 0x0f) << 4); configure_custom_video_timings()
1029 static void adv7842_set_offset(struct v4l2_subdev *sd, bool auto_offset, u16 offset_a, u16 offset_b, u16 offset_c) adv7842_set_offset() argument
1031 struct adv7842_state *state = to_state(sd); adv7842_set_offset()
1040 v4l2_dbg(2, debug, sd, "%s: %s offset: a = 0x%x, b = 0x%x, c = 0x%x\n", adv7842_set_offset()
1044 offset_buf[0]= (cp_read(sd, 0x77) & 0xc0) | ((offset_a & 0x3f0) >> 4); adv7842_set_offset()
1051 v4l2_err(sd, "%s: i2c error writing to CP reg 0x77, 0x78, 0x79, 0x7a\n", __func__); adv7842_set_offset()
1054 static void adv7842_set_gain(struct v4l2_subdev *sd, bool auto_gain, u16 gain_a, u16 gain_b, u16 gain_c) adv7842_set_gain() argument
1056 struct adv7842_state *state = to_state(sd); adv7842_set_gain()
1069 v4l2_dbg(2, debug, sd, "%s: %s gain: a = 0x%x, b = 0x%x, c = 0x%x\n", adv7842_set_gain()
1080 v4l2_err(sd, "%s: i2c error writing to CP reg 0x73, 0x74, 0x75, 0x76\n", __func__); adv7842_set_gain()
1083 static void set_rgb_quantization_range(struct v4l2_subdev *sd) set_rgb_quantization_range() argument
1085 struct adv7842_state *state = to_state(sd); set_rgb_quantization_range()
1086 bool rgb_output = io_read(sd, 0x02) & 0x02; set_rgb_quantization_range()
1087 bool hdmi_signal = hdmi_read(sd, 0x05) & 0x80; set_rgb_quantization_range()
1089 v4l2_dbg(2, debug, sd, "%s: RGB quantization range: %d, RGB out: %d, HDMI: %d\n", set_rgb_quantization_range()
1093 adv7842_set_gain(sd, true, 0x0, 0x0, 0x0); set_rgb_quantization_range()
1094 adv7842_set_offset(sd, true, 0x0, 0x0, 0x0); set_rgb_quantization_range()
1101 io_write_and_or(sd, 0x02, 0x0f, 0x10); set_rgb_quantization_range()
1108 io_write_and_or(sd, 0x02, 0x0f, 0xf0); set_rgb_quantization_range()
1115 io_write_and_or(sd, 0x02, 0x0f, 0xf0); set_rgb_quantization_range()
1124 io_write_and_or(sd, 0x02, 0x0f, 0x00); set_rgb_quantization_range()
1127 io_write_and_or(sd, 0x02, 0x0f, 0x10); set_rgb_quantization_range()
1129 if (is_digital_input(sd) && rgb_output) { set_rgb_quantization_range()
1130 adv7842_set_offset(sd, false, 0x40, 0x40, 0x40); set_rgb_quantization_range()
1132 adv7842_set_gain(sd, false, 0xe0, 0xe0, 0xe0); set_rgb_quantization_range()
1133 adv7842_set_offset(sd, false, 0x70, 0x70, 0x70); set_rgb_quantization_range()
1140 io_write_and_or(sd, 0x02, 0x0f, 0x20); set_rgb_quantization_range()
1145 io_write_and_or(sd, 0x02, 0x0f, 0x00); set_rgb_quantization_range()
1151 io_write_and_or(sd, 0x02, 0x0f, 0x60); set_rgb_quantization_range()
1156 io_write_and_or(sd, 0x02, 0x0f, 0x10); set_rgb_quantization_range()
1158 if (is_analog_input(sd) || hdmi_signal) set_rgb_quantization_range()
1163 adv7842_set_offset(sd, false, 0x40, 0x40, 0x40); set_rgb_quantization_range()
1165 adv7842_set_gain(sd, false, 0xe0, 0xe0, 0xe0); set_rgb_quantization_range()
1166 adv7842_set_offset(sd, false, 0x70, 0x70, 0x70); set_rgb_quantization_range()
1174 struct v4l2_subdev *sd = to_sd(ctrl); adv7842_s_ctrl() local
1175 struct adv7842_state *state = to_state(sd); adv7842_s_ctrl()
1184 cp_write(sd, 0x3c, ctrl->val); adv7842_s_ctrl()
1185 sdp_write(sd, 0x14, ctrl->val); adv7842_s_ctrl()
1189 cp_write(sd, 0x3a, ctrl->val); adv7842_s_ctrl()
1190 sdp_write(sd, 0x13, ctrl->val); adv7842_s_ctrl()
1194 cp_write(sd, 0x3b, ctrl->val); adv7842_s_ctrl()
1195 sdp_write(sd, 0x15, ctrl->val); adv7842_s_ctrl()
1199 cp_write(sd, 0x3d, ctrl->val); adv7842_s_ctrl()
1200 sdp_write(sd, 0x16, ctrl->val); adv7842_s_ctrl()
1205 afe_write(sd, 0xc8, ctrl->val); adv7842_s_ctrl()
1208 cp_write_and_or(sd, 0xbf, ~0x04, (ctrl->val << 2)); adv7842_s_ctrl()
1209 sdp_write_and_or(sd, 0xdd, ~0x04, (ctrl->val << 2)); adv7842_s_ctrl()
1229 v4l2_dbg(1, debug, sd, "R %x, G %x, B %x\n", R, G, B); adv7842_s_ctrl()
1230 v4l2_dbg(1, debug, sd, "Y %x, U %x, V %x\n", Y, U, V); adv7842_s_ctrl()
1233 cp_write(sd, 0xc1, R); adv7842_s_ctrl()
1234 cp_write(sd, 0xc0, G); adv7842_s_ctrl()
1235 cp_write(sd, 0xc2, B); adv7842_s_ctrl()
1237 sdp_write(sd, 0xde, Y); adv7842_s_ctrl()
1238 sdp_write(sd, 0xdf, (V & 0xf0) | ((U >> 4) & 0x0f)); adv7842_s_ctrl()
1243 set_rgb_quantization_range(sd); adv7842_s_ctrl()
1249 static inline bool no_power(struct v4l2_subdev *sd) no_power() argument
1251 return io_read(sd, 0x0c) & 0x24; no_power()
1254 static inline bool no_cp_signal(struct v4l2_subdev *sd) no_cp_signal() argument
1256 return ((cp_read(sd, 0xb5) & 0xd0) != 0xd0) || !(cp_read(sd, 0xb1) & 0x80); no_cp_signal()
1259 static inline bool is_hdmi(struct v4l2_subdev *sd) is_hdmi() argument
1261 return hdmi_read(sd, 0x05) & 0x80; is_hdmi()
1264 static int adv7842_g_input_status(struct v4l2_subdev *sd, u32 *status) adv7842_g_input_status() argument
1266 struct adv7842_state *state = to_state(sd); adv7842_g_input_status()
1270 if (io_read(sd, 0x0c) & 0x24) adv7842_g_input_status()
1275 if (!(sdp_read(sd, 0x5A) & 0x01)) adv7842_g_input_status()
1278 v4l2_dbg(1, debug, sd, "%s: SDP status = 0x%x\n", adv7842_g_input_status()
1283 if ((cp_read(sd, 0xb5) & 0xd0) != 0xd0 || adv7842_g_input_status()
1284 !(cp_read(sd, 0xb1) & 0x80)) adv7842_g_input_status()
1288 if (is_digital_input(sd) && ((io_read(sd, 0x74) & 0x03) != 0x03)) adv7842_g_input_status()
1291 v4l2_dbg(1, debug, sd, "%s: CP status = 0x%x\n", adv7842_g_input_status()
1303 static int stdi2dv_timings(struct v4l2_subdev *sd, stdi2dv_timings() argument
1307 struct adv7842_state *state = to_state(sd); stdi2dv_timings()
1316 adv7842_get_dv_timings_cap(sd), stdi2dv_timings()
1344 v4l2_dbg(2, debug, sd, stdi2dv_timings()
1351 static int read_stdi(struct v4l2_subdev *sd, struct stdi_readback *stdi) read_stdi() argument
1355 adv7842_g_input_status(sd, &status); read_stdi()
1357 v4l2_dbg(2, debug, sd, "%s: no signal\n", __func__); read_stdi()
1361 stdi->bl = ((cp_read(sd, 0xb1) & 0x3f) << 8) | cp_read(sd, 0xb2); read_stdi()
1362 stdi->lcf = ((cp_read(sd, 0xb3) & 0x7) << 8) | cp_read(sd, 0xb4); read_stdi()
1363 stdi->lcvs = cp_read(sd, 0xb3) >> 3; read_stdi()
1365 if ((cp_read(sd, 0xb5) & 0x80) && ((cp_read(sd, 0xb5) & 0x03) == 0x01)) { read_stdi()
1366 stdi->hs_pol = ((cp_read(sd, 0xb5) & 0x10) ? read_stdi()
1367 ((cp_read(sd, 0xb5) & 0x08) ? '+' : '-') : 'x'); read_stdi()
1368 stdi->vs_pol = ((cp_read(sd, 0xb5) & 0x40) ? read_stdi()
1369 ((cp_read(sd, 0xb5) & 0x20) ? '+' : '-') : 'x'); read_stdi()
1374 stdi->interlaced = (cp_read(sd, 0xb1) & 0x40) ? true : false; read_stdi()
1377 v4l2_dbg(2, debug, sd, "%s: invalid signal\n", __func__); read_stdi()
1381 v4l2_dbg(2, debug, sd, read_stdi()
1390 static int adv7842_enum_dv_timings(struct v4l2_subdev *sd, adv7842_enum_dv_timings() argument
1397 adv7842_get_dv_timings_cap(sd), adv7842_check_dv_timings, NULL); adv7842_enum_dv_timings()
1400 static int adv7842_dv_timings_cap(struct v4l2_subdev *sd, adv7842_dv_timings_cap() argument
1406 *cap = *adv7842_get_dv_timings_cap(sd); adv7842_dv_timings_cap()
1412 static void adv7842_fill_optional_dv_timings_fields(struct v4l2_subdev *sd, adv7842_fill_optional_dv_timings_fields() argument
1415 v4l2_find_dv_timings_cap(timings, adv7842_get_dv_timings_cap(sd), adv7842_fill_optional_dv_timings_fields()
1416 is_digital_input(sd) ? 250000 : 1000000, adv7842_fill_optional_dv_timings_fields()
1420 static int adv7842_query_dv_timings(struct v4l2_subdev *sd, adv7842_query_dv_timings() argument
1423 struct adv7842_state *state = to_state(sd); adv7842_query_dv_timings()
1427 v4l2_dbg(1, debug, sd, "%s:\n", __func__); adv7842_query_dv_timings()
1436 if (read_stdi(sd, &stdi)) { adv7842_query_dv_timings()
1438 v4l2_dbg(1, debug, sd, "%s: no valid signal\n", __func__); adv7842_query_dv_timings()
1444 if (is_digital_input(sd)) { adv7842_query_dv_timings()
1449 bt->width = (hdmi_read(sd, 0x07) & 0x0f) * 256 + hdmi_read(sd, 0x08); adv7842_query_dv_timings()
1450 bt->height = (hdmi_read(sd, 0x09) & 0x0f) * 256 + hdmi_read(sd, 0x0a); adv7842_query_dv_timings()
1451 freq = ((hdmi_read(sd, 0x51) << 1) + (hdmi_read(sd, 0x52) >> 7)) * 1000000; adv7842_query_dv_timings()
1452 freq += ((hdmi_read(sd, 0x52) & 0x7f) * 7813); adv7842_query_dv_timings()
1453 if (is_hdmi(sd)) { adv7842_query_dv_timings()
1455 freq = freq * 8 / (((hdmi_read(sd, 0x0b) & 0xc0) >> 6) * 2 + 8); adv7842_query_dv_timings()
1458 bt->hfrontporch = (hdmi_read(sd, 0x20) & 0x03) * 256 + adv7842_query_dv_timings()
1459 hdmi_read(sd, 0x21); adv7842_query_dv_timings()
1460 bt->hsync = (hdmi_read(sd, 0x22) & 0x03) * 256 + adv7842_query_dv_timings()
1461 hdmi_read(sd, 0x23); adv7842_query_dv_timings()
1462 bt->hbackporch = (hdmi_read(sd, 0x24) & 0x03) * 256 + adv7842_query_dv_timings()
1463 hdmi_read(sd, 0x25); adv7842_query_dv_timings()
1464 bt->vfrontporch = ((hdmi_read(sd, 0x2a) & 0x1f) * 256 + adv7842_query_dv_timings()
1465 hdmi_read(sd, 0x2b)) / 2; adv7842_query_dv_timings()
1466 bt->vsync = ((hdmi_read(sd, 0x2e) & 0x1f) * 256 + adv7842_query_dv_timings()
1467 hdmi_read(sd, 0x2f)) / 2; adv7842_query_dv_timings()
1468 bt->vbackporch = ((hdmi_read(sd, 0x32) & 0x1f) * 256 + adv7842_query_dv_timings()
1469 hdmi_read(sd, 0x33)) / 2; adv7842_query_dv_timings()
1470 bt->polarities = ((hdmi_read(sd, 0x05) & 0x10) ? V4L2_DV_VSYNC_POS_POL : 0) | adv7842_query_dv_timings()
1471 ((hdmi_read(sd, 0x05) & 0x20) ? V4L2_DV_HSYNC_POS_POL : 0); adv7842_query_dv_timings()
1473 bt->height += (hdmi_read(sd, 0x0b) & 0x0f) * 256 + adv7842_query_dv_timings()
1474 hdmi_read(sd, 0x0c); adv7842_query_dv_timings()
1475 bt->il_vfrontporch = ((hdmi_read(sd, 0x2c) & 0x1f) * 256 + adv7842_query_dv_timings()
1476 hdmi_read(sd, 0x2d)) / 2; adv7842_query_dv_timings()
1477 bt->il_vsync = ((hdmi_read(sd, 0x30) & 0x1f) * 256 + adv7842_query_dv_timings()
1478 hdmi_read(sd, 0x31)) / 2; adv7842_query_dv_timings()
1479 bt->il_vbackporch = ((hdmi_read(sd, 0x34) & 0x1f) * 256 + adv7842_query_dv_timings()
1480 hdmi_read(sd, 0x35)) / 2; adv7842_query_dv_timings()
1482 adv7842_fill_optional_dv_timings_fields(sd, timings); adv7842_query_dv_timings()
1488 if (!stdi2dv_timings(sd, &stdi, timings)) adv7842_query_dv_timings()
1491 v4l2_dbg(1, debug, sd, "%s: lcvs + 1 = %d\n", __func__, stdi.lcvs); adv7842_query_dv_timings()
1492 if (!stdi2dv_timings(sd, &stdi, timings)) adv7842_query_dv_timings()
1495 v4l2_dbg(1, debug, sd, "%s: lcvs - 1 = %d\n", __func__, stdi.lcvs); adv7842_query_dv_timings()
1496 if (stdi2dv_timings(sd, &stdi, timings)) { adv7842_query_dv_timings()
1507 v4l2_dbg(1, debug, sd, "%s: restart STDI\n", __func__); adv7842_query_dv_timings()
1510 cp_write_and_or(sd, 0x86, 0xf9, 0x00); adv7842_query_dv_timings()
1512 cp_write_and_or(sd, 0x86, 0xf9, 0x04); adv7842_query_dv_timings()
1514 cp_write_and_or(sd, 0x86, 0xf9, 0x02); adv7842_query_dv_timings()
1518 v4l2_dbg(1, debug, sd, "%s: format not supported\n", __func__); adv7842_query_dv_timings()
1526 v4l2_print_dv_timings(sd->name, "adv7842_query_dv_timings:", adv7842_query_dv_timings()
1531 static int adv7842_s_dv_timings(struct v4l2_subdev *sd, adv7842_s_dv_timings() argument
1534 struct adv7842_state *state = to_state(sd); adv7842_s_dv_timings()
1538 v4l2_dbg(1, debug, sd, "%s:\n", __func__); adv7842_s_dv_timings()
1544 v4l2_dbg(1, debug, sd, "%s: no change\n", __func__); adv7842_s_dv_timings()
1550 if (!v4l2_valid_dv_timings(timings, adv7842_get_dv_timings_cap(sd), adv7842_s_dv_timings()
1554 adv7842_fill_optional_dv_timings_fields(sd, timings); adv7842_s_dv_timings()
1558 cp_write(sd, 0x91, bt->interlaced ? 0x40 : 0x00); adv7842_s_dv_timings()
1561 err = configure_predefined_video_timings(sd, timings); adv7842_s_dv_timings()
1565 configure_custom_video_timings(sd, bt); adv7842_s_dv_timings()
1568 set_rgb_quantization_range(sd); adv7842_s_dv_timings()
1572 v4l2_print_dv_timings(sd->name, "adv7842_s_dv_timings: ", adv7842_s_dv_timings()
1577 static int adv7842_g_dv_timings(struct v4l2_subdev *sd, adv7842_g_dv_timings() argument
1580 struct adv7842_state *state = to_state(sd); adv7842_g_dv_timings()
1588 static void enable_input(struct v4l2_subdev *sd) enable_input() argument
1590 struct adv7842_state *state = to_state(sd); enable_input()
1592 set_rgb_quantization_range(sd); enable_input()
1597 io_write(sd, 0x15, 0xb0); /* Disable Tristate of Pins (no audio) */ enable_input()
1600 hdmi_write(sd, 0x01, 0x00); /* Enable HDMI clock terminators */ enable_input()
1601 io_write(sd, 0x15, 0xa0); /* Disable Tristate of Pins */ enable_input()
1602 hdmi_write_and_or(sd, 0x1a, 0xef, 0x00); /* Unmute audio */ enable_input()
1605 v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n", enable_input()
1611 static void disable_input(struct v4l2_subdev *sd) disable_input() argument
1613 hdmi_write_and_or(sd, 0x1a, 0xef, 0x10); /* Mute audio [REF_01, c. 2.2.2] */ disable_input()
1615 io_write(sd, 0x15, 0xbe); /* Tristate all outputs from video core */ disable_input()
1616 hdmi_write(sd, 0x01, 0x78); /* Disable HDMI clock terminators */ disable_input()
1619 static void sdp_csc_coeff(struct v4l2_subdev *sd, sdp_csc_coeff() argument
1623 sdp_io_write_and_or(sd, 0xe0, 0xbf, c->manual ? 0x00 : 0x40); sdp_csc_coeff()
1629 sdp_io_write_and_or(sd, 0xe0, 0x7f, c->scaling == 2 ? 0x80 : 0x00); sdp_csc_coeff()
1632 sdp_io_write_and_or(sd, 0xe0, 0xe0, c->A1 >> 8); sdp_csc_coeff()
1633 sdp_io_write(sd, 0xe1, c->A1); sdp_csc_coeff()
1634 sdp_io_write_and_or(sd, 0xe2, 0xe0, c->A2 >> 8); sdp_csc_coeff()
1635 sdp_io_write(sd, 0xe3, c->A2); sdp_csc_coeff()
1636 sdp_io_write_and_or(sd, 0xe4, 0xe0, c->A3 >> 8); sdp_csc_coeff()
1637 sdp_io_write(sd, 0xe5, c->A3); sdp_csc_coeff()
1640 sdp_io_write_and_or(sd, 0xe6, 0x80, c->A4 >> 8); sdp_csc_coeff()
1641 sdp_io_write(sd, 0xe7, c->A4); sdp_csc_coeff()
1644 sdp_io_write_and_or(sd, 0xe8, 0xe0, c->B1 >> 8); sdp_csc_coeff()
1645 sdp_io_write(sd, 0xe9, c->B1); sdp_csc_coeff()
1646 sdp_io_write_and_or(sd, 0xea, 0xe0, c->B2 >> 8); sdp_csc_coeff()
1647 sdp_io_write(sd, 0xeb, c->B2); sdp_csc_coeff()
1648 sdp_io_write_and_or(sd, 0xec, 0xe0, c->B3 >> 8); sdp_csc_coeff()
1649 sdp_io_write(sd, 0xed, c->B3); sdp_csc_coeff()
1652 sdp_io_write_and_or(sd, 0xee, 0x80, c->B4 >> 8); sdp_csc_coeff()
1653 sdp_io_write(sd, 0xef, c->B4); sdp_csc_coeff()
1656 sdp_io_write_and_or(sd, 0xf0, 0xe0, c->C1 >> 8); sdp_csc_coeff()
1657 sdp_io_write(sd, 0xf1, c->C1); sdp_csc_coeff()
1658 sdp_io_write_and_or(sd, 0xf2, 0xe0, c->C2 >> 8); sdp_csc_coeff()
1659 sdp_io_write(sd, 0xf3, c->C2); sdp_csc_coeff()
1660 sdp_io_write_and_or(sd, 0xf4, 0xe0, c->C3 >> 8); sdp_csc_coeff()
1661 sdp_io_write(sd, 0xf5, c->C3); sdp_csc_coeff()
1664 sdp_io_write_and_or(sd, 0xf6, 0x80, c->C4 >> 8); sdp_csc_coeff()
1665 sdp_io_write(sd, 0xf7, c->C4); sdp_csc_coeff()
1668 static void select_input(struct v4l2_subdev *sd, select_input() argument
1671 struct adv7842_state *state = to_state(sd); select_input()
1675 io_write(sd, 0x00, vid_std_select); /* video std: CVBS or YC mode */ select_input()
1676 io_write(sd, 0x01, 0); /* prim mode */ select_input()
1678 cp_write_and_or(sd, 0x81, 0xef, 0x10); select_input()
1680 afe_write(sd, 0x00, 0x00); /* power up ADC */ select_input()
1681 afe_write(sd, 0xc8, 0x00); /* phase control */ select_input()
1683 io_write(sd, 0xdd, 0x90); /* Manual 2x output clock */ select_input()
1687 afe_write_and_or(sd, 0x02, 0x7f, 0x80); select_input()
1689 afe_write(sd, 0x03, 0xa0); /* ADC0 to AIN10 (CVBS), ADC1 N/C*/ select_input()
1690 afe_write(sd, 0x04, 0x00); /* ADC2 N/C,ADC3 N/C*/ select_input()
1692 afe_write(sd, 0x03, 0xa0); /* ADC0 to AIN10 (CVBS), ADC1 N/C*/ select_input()
1693 afe_write(sd, 0x04, 0xc0); /* ADC2 to AIN12, ADC3 N/C*/ select_input()
1695 afe_write(sd, 0x0c, 0x1f); /* ADI recommend write */ select_input()
1696 afe_write(sd, 0x12, 0x63); /* ADI recommend write */ select_input()
1698 sdp_io_write(sd, 0xb2, 0x60); /* Disable AV codes */ select_input()
1699 sdp_io_write(sd, 0xc8, 0xe3); /* Disable Ancillary data */ select_input()
1702 sdp_write(sd, 0x00, 0x3F); /* Autodetect PAL NTSC (not SECAM) */ select_input()
1703 sdp_write(sd, 0x01, 0x00); /* Pedestal Off */ select_input()
1705 sdp_write(sd, 0x03, 0xE4); /* Manual VCR Gain Luma 0x40B */ select_input()
1706 sdp_write(sd, 0x04, 0x0B); /* Manual Luma setting */ select_input()
1707 sdp_write(sd, 0x05, 0xC3); /* Manual Chroma setting 0x3FE */ select_input()
1708 sdp_write(sd, 0x06, 0xFE); /* Manual Chroma setting */ select_input()
1709 sdp_write(sd, 0x12, 0x0D); /* Frame TBC,I_P, 3D comb enabled */ select_input()
1710 sdp_write(sd, 0xA7, 0x00); /* ADI Recommended Write */ select_input()
1711 sdp_io_write(sd, 0xB0, 0x00); /* Disable H and v blanking */ select_input()
1714 sdp_write_and_or(sd, 0x12, 0xf6, 0x09); select_input()
1721 afe_write_and_or(sd, 0x02, 0x7f, 0x00); select_input()
1723 io_write(sd, 0x00, vid_std_select); /* video std */ select_input()
1724 io_write(sd, 0x01, 0x02); /* prim mode */ select_input()
1725 cp_write_and_or(sd, 0x81, 0xef, 0x10); /* enable embedded syncs select_input()
1728 afe_write(sd, 0x00, 0x00); /* power up ADC */ select_input()
1729 afe_write(sd, 0xc8, 0x00); /* phase control */ select_input()
1732 io_write_and_or(sd, 0x02, 0x0f, 0x60); select_input()
1735 io_write_and_or(sd, 0x02, 0x0f, 0x10); select_input()
1741 afe_write(sd, 0x0c, 0x1f); /* ADC Range improvement */ select_input()
1742 afe_write(sd, 0x12, 0x63); /* ADC Range improvement */ select_input()
1745 cp_write(sd, 0x73, 0x10); select_input()
1746 cp_write(sd, 0x74, 0x04); select_input()
1747 cp_write(sd, 0x75, 0x01); select_input()
1748 cp_write(sd, 0x76, 0x00); select_input()
1750 cp_write(sd, 0x3e, 0x04); /* CP core pre-gain control */ select_input()
1751 cp_write(sd, 0xc3, 0x39); /* CP coast control. Graphics mode */ select_input()
1752 cp_write(sd, 0x40, 0x5c); /* CP core pre-gain control. Graphics mode */ select_input()
1757 afe_write_and_or(sd, 0x02, 0x7f, 0x00); select_input()
1760 hdmi_write(sd, 0x00, 0x02); /* select port A */ select_input()
1762 hdmi_write(sd, 0x00, 0x03); /* select port B */ select_input()
1763 io_write(sd, 0x00, vid_std_select); /* video std */ select_input()
1764 io_write(sd, 0x01, 5); /* prim mode */ select_input()
1765 cp_write_and_or(sd, 0x81, 0xef, 0x00); /* disable embedded syncs select_input()
1771 hdmi_write(sd, 0xc0, 0x00); select_input()
1772 hdmi_write(sd, 0x0d, 0x34); /* ADI recommended write */ select_input()
1773 hdmi_write(sd, 0x3d, 0x10); /* ADI recommended write */ select_input()
1774 hdmi_write(sd, 0x44, 0x85); /* TMDS PLL optimization */ select_input()
1775 hdmi_write(sd, 0x46, 0x1f); /* ADI recommended write */ select_input()
1776 hdmi_write(sd, 0x57, 0xb6); /* TMDS PLL optimization */ select_input()
1777 hdmi_write(sd, 0x58, 0x03); /* TMDS PLL optimization */ select_input()
1778 hdmi_write(sd, 0x60, 0x88); /* TMDS PLL optimization */ select_input()
1779 hdmi_write(sd, 0x61, 0x88); /* TMDS PLL optimization */ select_input()
1780 hdmi_write(sd, 0x6c, 0x18); /* Disable ISRC clearing bit, select_input()
1782 hdmi_write(sd, 0x75, 0x10); /* DDC drive strength */ select_input()
1783 hdmi_write(sd, 0x85, 0x1f); /* equaliser */ select_input()
1784 hdmi_write(sd, 0x87, 0x70); /* ADI recommended write */ select_input()
1785 hdmi_write(sd, 0x89, 0x04); /* equaliser */ select_input()
1786 hdmi_write(sd, 0x8a, 0x1e); /* equaliser */ select_input()
1787 hdmi_write(sd, 0x93, 0x04); /* equaliser */ select_input()
1788 hdmi_write(sd, 0x94, 0x1e); /* equaliser */ select_input()
1789 hdmi_write(sd, 0x99, 0xa1); /* ADI recommended write */ select_input()
1790 hdmi_write(sd, 0x9b, 0x09); /* ADI recommended write */ select_input()
1791 hdmi_write(sd, 0x9d, 0x02); /* equaliser */ select_input()
1793 afe_write(sd, 0x00, 0xff); /* power down ADC */ select_input()
1794 afe_write(sd, 0xc8, 0x40); /* phase control */ select_input()
1797 cp_write(sd, 0x73, 0x10); select_input()
1798 cp_write(sd, 0x74, 0x04); select_input()
1799 cp_write(sd, 0x75, 0x01); select_input()
1800 cp_write(sd, 0x76, 0x00); select_input()
1805 afe_write(sd, 0x12, 0xfb); /* ADC noise shaping filter controls */ select_input()
1806 afe_write(sd, 0x0c, 0x0d); /* CP core gain controls */ select_input()
1807 cp_write(sd, 0x3e, 0x00); /* CP core pre-gain control */ select_input()
1810 cp_write(sd, 0xc3, 0x33); /* Component mode */ select_input()
1813 io_write_and_or(sd, 0x02, 0x0f, 0xf0); select_input()
1817 v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n", select_input()
1823 static int adv7842_s_routing(struct v4l2_subdev *sd, adv7842_s_routing() argument
1826 struct adv7842_state *state = to_state(sd); adv7842_s_routing()
1828 v4l2_dbg(2, debug, sd, "%s: input %d\n", __func__, input); adv7842_s_routing()
1861 disable_input(sd); adv7842_s_routing()
1862 select_input(sd, state->vid_std_select); adv7842_s_routing()
1863 enable_input(sd); adv7842_s_routing()
1865 v4l2_subdev_notify(sd, ADV7842_FMT_CHANGE, NULL); adv7842_s_routing()
1870 static int adv7842_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned int index, adv7842_enum_mbus_fmt() argument
1880 static int adv7842_g_mbus_fmt(struct v4l2_subdev *sd, adv7842_g_mbus_fmt() argument
1883 struct adv7842_state *state = to_state(sd); adv7842_g_mbus_fmt()
1892 if (!(sdp_read(sd, 0x5A) & 0x01)) adv7842_g_mbus_fmt()
1912 static void adv7842_irq_enable(struct v4l2_subdev *sd, bool enable) adv7842_irq_enable() argument
1916 io_write(sd, 0x46, 0x9c); adv7842_irq_enable()
1918 io_write(sd, 0x5a, 0x10); adv7842_irq_enable()
1920 io_write(sd, 0x73, 0x03); adv7842_irq_enable()
1922 io_write(sd, 0x78, 0x03); adv7842_irq_enable()
1924 io_write(sd, 0xa0, 0x09); adv7842_irq_enable()
1926 io_write(sd, 0x69, 0x08); adv7842_irq_enable()
1928 io_write(sd, 0x46, 0x0); adv7842_irq_enable()
1929 io_write(sd, 0x5a, 0x0); adv7842_irq_enable()
1930 io_write(sd, 0x73, 0x0); adv7842_irq_enable()
1931 io_write(sd, 0x78, 0x0); adv7842_irq_enable()
1932 io_write(sd, 0xa0, 0x0); adv7842_irq_enable()
1933 io_write(sd, 0x69, 0x0); adv7842_irq_enable()
1937 static int adv7842_isr(struct v4l2_subdev *sd, u32 status, bool *handled) adv7842_isr() argument
1939 struct adv7842_state *state = to_state(sd); adv7842_isr()
1943 adv7842_irq_enable(sd, false); adv7842_isr()
1946 irq_status[0] = io_read(sd, 0x43); adv7842_isr()
1947 irq_status[1] = io_read(sd, 0x57); adv7842_isr()
1948 irq_status[2] = io_read(sd, 0x70); adv7842_isr()
1949 irq_status[3] = io_read(sd, 0x75); adv7842_isr()
1950 irq_status[4] = io_read(sd, 0x9d); adv7842_isr()
1951 irq_status[5] = io_read(sd, 0x66); adv7842_isr()
1955 io_write(sd, 0x44, irq_status[0]); adv7842_isr()
1957 io_write(sd, 0x58, irq_status[1]); adv7842_isr()
1959 io_write(sd, 0x71, irq_status[2]); adv7842_isr()
1961 io_write(sd, 0x76, irq_status[3]); adv7842_isr()
1963 io_write(sd, 0x9e, irq_status[4]); adv7842_isr()
1965 io_write(sd, 0x67, irq_status[5]); adv7842_isr()
1967 adv7842_irq_enable(sd, true); adv7842_isr()
1969 v4l2_dbg(1, debug, sd, "%s: irq %x, %x, %x, %x, %x, %x\n", __func__, adv7842_isr()
1983 if (is_digital_input(sd)) adv7842_isr()
1990 v4l2_dbg(1, debug, sd, adv7842_isr()
1994 v4l2_subdev_notify(sd, ADV7842_FMT_CHANGE, NULL); adv7842_isr()
2001 v4l2_dbg(1, debug, sd, "%s: irq %s mode\n", __func__, adv7842_isr()
2002 (io_read(sd, 0x65) & 0x08) ? "HDMI" : "DVI"); adv7842_isr()
2003 set_rgb_quantization_range(sd); adv7842_isr()
2010 v4l2_dbg(1, debug, sd, "%s: irq tx_5v\n", __func__); adv7842_isr()
2011 adv7842_s_detect_tx_5v_ctrl(sd); adv7842_isr()
2018 static int adv7842_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) adv7842_get_edid() argument
2020 struct adv7842_state *state = to_state(sd); adv7842_get_edid()
2058 static int adv7842_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *e) adv7842_set_edid() argument
2060 struct adv7842_state *state = to_state(sd); adv7842_set_edid()
2083 err = edid_write_vga_segment(sd); adv7842_set_edid()
2093 err = edid_write_hdmi_segment(sd, e->pad); adv7842_set_edid()
2099 v4l2_err(sd, "error %d writing edid on port %d\n", err, e->pad); adv7842_set_edid()
2110 static void log_infoframe(struct v4l2_subdev *sd, struct adv7842_cfg_read_infoframe *cri) log_infoframe() argument
2116 struct i2c_client *client = v4l2_get_subdevdata(sd); log_infoframe()
2119 if (!(io_read(sd, 0x60) & cri->present_mask)) { log_infoframe()
2120 v4l2_info(sd, "%s infoframe not received\n", cri->desc); log_infoframe()
2125 buffer[i] = infoframe_read(sd, cri->head_addr + i); log_infoframe()
2130 v4l2_err(sd, "%s: invalid %s infoframe length %d\n", __func__, cri->desc, len); log_infoframe()
2135 buffer[i + 3] = infoframe_read(sd, cri->payload_addr + i); log_infoframe()
2138 v4l2_err(sd, "%s: unpack of %s infoframe failed\n", __func__, cri->desc); log_infoframe()
2145 static void adv7842_log_infoframes(struct v4l2_subdev *sd) adv7842_log_infoframes() argument
2155 if (!(hdmi_read(sd, 0x05) & 0x80)) { adv7842_log_infoframes()
2156 v4l2_info(sd, "receive DVI-D signal, no infoframes\n"); adv7842_log_infoframes()
2161 log_infoframe(sd, &cri[i]); adv7842_log_infoframes()
2183 static int adv7842_sdp_log_status(struct v4l2_subdev *sd) adv7842_sdp_log_status() argument
2186 uint8_t sdp_signal_detected = sdp_read(sd, 0x5A) & 0x01; adv7842_sdp_log_status()
2188 v4l2_info(sd, "Chip powered %s\n", no_power(sd) ? "off" : "on"); adv7842_sdp_log_status()
2189 v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x\n", adv7842_sdp_log_status()
2190 io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f); adv7842_sdp_log_status()
2192 v4l2_info(sd, "SDP: free run: %s\n", adv7842_sdp_log_status()
2193 (sdp_read(sd, 0x56) & 0x01) ? "on" : "off"); adv7842_sdp_log_status()
2194 v4l2_info(sd, "SDP: %s\n", sdp_signal_detected ? adv7842_sdp_log_status()
2211 v4l2_info(sd, "SDP: standard %s\n", adv7842_sdp_log_status()
2212 sdp_std_txt[sdp_read(sd, 0x52) & 0x0f]); adv7842_sdp_log_status()
2213 v4l2_info(sd, "SDP: %s\n", adv7842_sdp_log_status()
2214 (sdp_read(sd, 0x59) & 0x08) ? "50Hz" : "60Hz"); adv7842_sdp_log_status()
2215 v4l2_info(sd, "SDP: %s\n", adv7842_sdp_log_status()
2216 (sdp_read(sd, 0x57) & 0x08) ? "Interlaced" : "Progressive"); adv7842_sdp_log_status()
2217 v4l2_info(sd, "SDP: deinterlacer %s\n", adv7842_sdp_log_status()
2218 (sdp_read(sd, 0x12) & 0x08) ? "enabled" : "disabled"); adv7842_sdp_log_status()
2219 v4l2_info(sd, "SDP: csc %s mode\n", adv7842_sdp_log_status()
2220 (sdp_io_read(sd, 0xe0) & 0x40) ? "auto" : "manual"); adv7842_sdp_log_status()
2225 static int adv7842_cp_log_status(struct v4l2_subdev *sd) adv7842_cp_log_status() argument
2228 struct adv7842_state *state = to_state(sd); adv7842_cp_log_status()
2230 uint8_t reg_io_0x02 = io_read(sd, 0x02); adv7842_cp_log_status()
2231 uint8_t reg_io_0x21 = io_read(sd, 0x21); adv7842_cp_log_status()
2232 uint8_t reg_rep_0x77 = rep_read(sd, 0x77); adv7842_cp_log_status()
2233 uint8_t reg_rep_0x7d = rep_read(sd, 0x7d); adv7842_cp_log_status()
2234 bool audio_pll_locked = hdmi_read(sd, 0x04) & 0x01; adv7842_cp_log_status()
2235 bool audio_sample_packet_detect = hdmi_read(sd, 0x18) & 0x01; adv7842_cp_log_status()
2236 bool audio_mute = io_read(sd, 0x65) & 0x40; adv7842_cp_log_status()
2264 v4l2_info(sd, "-----Chip status-----\n"); adv7842_cp_log_status()
2265 v4l2_info(sd, "Chip power: %s\n", no_power(sd) ? "off" : "on"); adv7842_cp_log_status()
2266 v4l2_info(sd, "HDMI/DVI-D port selected: %s\n", adv7842_cp_log_status()
2268 v4l2_info(sd, "EDID A %s, B %s\n", adv7842_cp_log_status()
2273 v4l2_info(sd, "HPD A %s, B %s\n", adv7842_cp_log_status()
2276 v4l2_info(sd, "CEC %s\n", !!(cec_read(sd, 0x2a) & 0x01) ? adv7842_cp_log_status()
2279 v4l2_info(sd, "-----Signal status-----\n"); adv7842_cp_log_status()
2281 v4l2_info(sd, "Cable detected (+5V power): %s\n", adv7842_cp_log_status()
2282 io_read(sd, 0x6f) & 0x02 ? "true" : "false"); adv7842_cp_log_status()
2283 v4l2_info(sd, "TMDS signal detected: %s\n", adv7842_cp_log_status()
2284 (io_read(sd, 0x6a) & 0x02) ? "true" : "false"); adv7842_cp_log_status()
2285 v4l2_info(sd, "TMDS signal locked: %s\n", adv7842_cp_log_status()
2286 (io_read(sd, 0x6a) & 0x20) ? "true" : "false"); adv7842_cp_log_status()
2288 v4l2_info(sd, "Cable detected (+5V power):%s\n", adv7842_cp_log_status()
2289 io_read(sd, 0x6f) & 0x01 ? "true" : "false"); adv7842_cp_log_status()
2290 v4l2_info(sd, "TMDS signal detected: %s\n", adv7842_cp_log_status()
2291 (io_read(sd, 0x6a) & 0x01) ? "true" : "false"); adv7842_cp_log_status()
2292 v4l2_info(sd, "TMDS signal locked: %s\n", adv7842_cp_log_status()
2293 (io_read(sd, 0x6a) & 0x10) ? "true" : "false"); adv7842_cp_log_status()
2295 v4l2_info(sd, "CP free run: %s\n", adv7842_cp_log_status()
2296 (!!(cp_read(sd, 0xff) & 0x10) ? "on" : "off")); adv7842_cp_log_status()
2297 v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x, v_freq = 0x%x\n", adv7842_cp_log_status()
2298 io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f, adv7842_cp_log_status()
2299 (io_read(sd, 0x01) & 0x70) >> 4); adv7842_cp_log_status()
2301 v4l2_info(sd, "-----Video Timings-----\n"); adv7842_cp_log_status()
2302 if (no_cp_signal(sd)) { adv7842_cp_log_status()
2303 v4l2_info(sd, "STDI: not locked\n"); adv7842_cp_log_status()
2305 uint32_t bl = ((cp_read(sd, 0xb1) & 0x3f) << 8) | cp_read(sd, 0xb2); adv7842_cp_log_status()
2306 uint32_t lcf = ((cp_read(sd, 0xb3) & 0x7) << 8) | cp_read(sd, 0xb4); adv7842_cp_log_status()
2307 uint32_t lcvs = cp_read(sd, 0xb3) >> 3; adv7842_cp_log_status()
2308 uint32_t fcl = ((cp_read(sd, 0xb8) & 0x1f) << 8) | cp_read(sd, 0xb9); adv7842_cp_log_status()
2309 char hs_pol = ((cp_read(sd, 0xb5) & 0x10) ? adv7842_cp_log_status()
2310 ((cp_read(sd, 0xb5) & 0x08) ? '+' : '-') : 'x'); adv7842_cp_log_status()
2311 char vs_pol = ((cp_read(sd, 0xb5) & 0x40) ? adv7842_cp_log_status()
2312 ((cp_read(sd, 0xb5) & 0x20) ? '+' : '-') : 'x'); adv7842_cp_log_status()
2313 v4l2_info(sd, adv7842_cp_log_status()
2316 (cp_read(sd, 0xb1) & 0x40) ? adv7842_cp_log_status()
2320 if (adv7842_query_dv_timings(sd, &timings)) adv7842_cp_log_status()
2321 v4l2_info(sd, "No video detected\n"); adv7842_cp_log_status()
2323 v4l2_print_dv_timings(sd->name, "Detected format: ", adv7842_cp_log_status()
2325 v4l2_print_dv_timings(sd->name, "Configured format: ", adv7842_cp_log_status()
2328 if (no_cp_signal(sd)) adv7842_cp_log_status()
2331 v4l2_info(sd, "-----Color space-----\n"); adv7842_cp_log_status()
2332 v4l2_info(sd, "RGB quantization range ctrl: %s\n", adv7842_cp_log_status()
2334 v4l2_info(sd, "Input color space: %s\n", adv7842_cp_log_status()
2336 v4l2_info(sd, "Output color space: %s %s, saturator %s\n", adv7842_cp_log_status()
2341 v4l2_info(sd, "Color space conversion: %s\n", adv7842_cp_log_status()
2342 csc_coeff_sel_rb[cp_read(sd, 0xf4) >> 4]); adv7842_cp_log_status()
2344 if (!is_digital_input(sd)) adv7842_cp_log_status()
2347 v4l2_info(sd, "-----%s status-----\n", is_hdmi(sd) ? "HDMI" : "DVI-D"); adv7842_cp_log_status()
2348 v4l2_info(sd, "HDCP encrypted content: %s\n", adv7842_cp_log_status()
2349 (hdmi_read(sd, 0x05) & 0x40) ? "true" : "false"); adv7842_cp_log_status()
2350 v4l2_info(sd, "HDCP keys read: %s%s\n", adv7842_cp_log_status()
2351 (hdmi_read(sd, 0x04) & 0x20) ? "yes" : "no", adv7842_cp_log_status()
2352 (hdmi_read(sd, 0x04) & 0x10) ? "ERROR" : ""); adv7842_cp_log_status()
2353 if (!is_hdmi(sd)) adv7842_cp_log_status()
2356 v4l2_info(sd, "Audio: pll %s, samples %s, %s\n", adv7842_cp_log_status()
2361 v4l2_info(sd, "Audio format: %s\n", adv7842_cp_log_status()
2362 (hdmi_read(sd, 0x07) & 0x40) ? "multi-channel" : "stereo"); adv7842_cp_log_status()
2364 v4l2_info(sd, "Audio CTS: %u\n", (hdmi_read(sd, 0x5b) << 12) + adv7842_cp_log_status()
2365 (hdmi_read(sd, 0x5c) << 8) + adv7842_cp_log_status()
2366 (hdmi_read(sd, 0x5d) & 0xf0)); adv7842_cp_log_status()
2367 v4l2_info(sd, "Audio N: %u\n", ((hdmi_read(sd, 0x5d) & 0x0f) << 16) + adv7842_cp_log_status()
2368 (hdmi_read(sd, 0x5e) << 8) + adv7842_cp_log_status()
2369 hdmi_read(sd, 0x5f)); adv7842_cp_log_status()
2370 v4l2_info(sd, "AV Mute: %s\n", adv7842_cp_log_status()
2371 (hdmi_read(sd, 0x04) & 0x40) ? "on" : "off"); adv7842_cp_log_status()
2372 v4l2_info(sd, "Deep color mode: %s\n", adv7842_cp_log_status()
2373 deep_color_mode_txt[hdmi_read(sd, 0x0b) >> 6]); adv7842_cp_log_status()
2375 adv7842_log_infoframes(sd); adv7842_cp_log_status()
2380 static int adv7842_log_status(struct v4l2_subdev *sd) adv7842_log_status() argument
2382 struct adv7842_state *state = to_state(sd); adv7842_log_status()
2385 return adv7842_sdp_log_status(sd); adv7842_log_status()
2386 return adv7842_cp_log_status(sd); adv7842_log_status()
2389 static int adv7842_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) adv7842_querystd() argument
2391 struct adv7842_state *state = to_state(sd); adv7842_querystd()
2393 v4l2_dbg(1, debug, sd, "%s:\n", __func__); adv7842_querystd()
2398 if (!(sdp_read(sd, 0x5A) & 0x01)) { adv7842_querystd()
2400 v4l2_dbg(1, debug, sd, "%s: no valid signal\n", __func__); adv7842_querystd()
2404 switch (sdp_read(sd, 0x52) & 0x0f) { adv7842_querystd()
2444 static void adv7842_s_sdp_io(struct v4l2_subdev *sd, struct adv7842_sdp_io_sync_adjustment *s) adv7842_s_sdp_io() argument
2447 sdp_io_write(sd, 0x94, (s->hs_beg >> 8) & 0xf); adv7842_s_sdp_io()
2448 sdp_io_write(sd, 0x95, s->hs_beg & 0xff); adv7842_s_sdp_io()
2449 sdp_io_write(sd, 0x96, (s->hs_width >> 8) & 0xf); adv7842_s_sdp_io()
2450 sdp_io_write(sd, 0x97, s->hs_width & 0xff); adv7842_s_sdp_io()
2451 sdp_io_write(sd, 0x98, (s->de_beg >> 8) & 0xf); adv7842_s_sdp_io()
2452 sdp_io_write(sd, 0x99, s->de_beg & 0xff); adv7842_s_sdp_io()
2453 sdp_io_write(sd, 0x9a, (s->de_end >> 8) & 0xf); adv7842_s_sdp_io()
2454 sdp_io_write(sd, 0x9b, s->de_end & 0xff); adv7842_s_sdp_io()
2455 sdp_io_write(sd, 0xa8, s->vs_beg_o); adv7842_s_sdp_io()
2456 sdp_io_write(sd, 0xa9, s->vs_beg_e); adv7842_s_sdp_io()
2457 sdp_io_write(sd, 0xaa, s->vs_end_o); adv7842_s_sdp_io()
2458 sdp_io_write(sd, 0xab, s->vs_end_e); adv7842_s_sdp_io()
2459 sdp_io_write(sd, 0xac, s->de_v_beg_o); adv7842_s_sdp_io()
2460 sdp_io_write(sd, 0xad, s->de_v_beg_e); adv7842_s_sdp_io()
2461 sdp_io_write(sd, 0xae, s->de_v_end_o); adv7842_s_sdp_io()
2462 sdp_io_write(sd, 0xaf, s->de_v_end_e); adv7842_s_sdp_io()
2465 sdp_io_write(sd, 0x94, 0x00); adv7842_s_sdp_io()
2466 sdp_io_write(sd, 0x95, 0x00); adv7842_s_sdp_io()
2467 sdp_io_write(sd, 0x96, 0x00); adv7842_s_sdp_io()
2468 sdp_io_write(sd, 0x97, 0x20); adv7842_s_sdp_io()
2469 sdp_io_write(sd, 0x98, 0x00); adv7842_s_sdp_io()
2470 sdp_io_write(sd, 0x99, 0x00); adv7842_s_sdp_io()
2471 sdp_io_write(sd, 0x9a, 0x00); adv7842_s_sdp_io()
2472 sdp_io_write(sd, 0x9b, 0x00); adv7842_s_sdp_io()
2473 sdp_io_write(sd, 0xa8, 0x04); adv7842_s_sdp_io()
2474 sdp_io_write(sd, 0xa9, 0x04); adv7842_s_sdp_io()
2475 sdp_io_write(sd, 0xaa, 0x04); adv7842_s_sdp_io()
2476 sdp_io_write(sd, 0xab, 0x04); adv7842_s_sdp_io()
2477 sdp_io_write(sd, 0xac, 0x04); adv7842_s_sdp_io()
2478 sdp_io_write(sd, 0xad, 0x04); adv7842_s_sdp_io()
2479 sdp_io_write(sd, 0xae, 0x04); adv7842_s_sdp_io()
2480 sdp_io_write(sd, 0xaf, 0x04); adv7842_s_sdp_io()
2484 static int adv7842_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) adv7842_s_std() argument
2486 struct adv7842_state *state = to_state(sd); adv7842_s_std()
2489 v4l2_dbg(1, debug, sd, "%s:\n", __func__); adv7842_s_std()
2495 adv7842_s_sdp_io(sd, &pdata->sdp_io_sync_625); adv7842_s_std()
2497 adv7842_s_sdp_io(sd, &pdata->sdp_io_sync_525); adv7842_s_std()
2499 adv7842_s_sdp_io(sd, NULL); adv7842_s_std()
2508 static int adv7842_g_std(struct v4l2_subdev *sd, v4l2_std_id *norm) adv7842_g_std() argument
2510 struct adv7842_state *state = to_state(sd); adv7842_g_std()
2512 v4l2_dbg(1, debug, sd, "%s:\n", __func__); adv7842_g_std()
2523 static int adv7842_core_init(struct v4l2_subdev *sd) adv7842_core_init() argument
2525 struct adv7842_state *state = to_state(sd); adv7842_core_init()
2527 hdmi_write(sd, 0x48, adv7842_core_init()
2531 disable_input(sd); adv7842_core_init()
2537 rep_write_and_or(sd, 0x77, 0xd3, 0x20); adv7842_core_init()
2540 io_write(sd, 0x0c, 0x42); /* Power up part and power down VDP */ adv7842_core_init()
2541 io_write(sd, 0x15, 0x80); /* Power up pads */ adv7842_core_init()
2544 io_write(sd, 0x02, adv7842_core_init()
2550 io_write(sd, 0x03, pdata->op_format_sel); adv7842_core_init()
2551 io_write_and_or(sd, 0x04, 0x1f, pdata->op_ch_sel << 5); adv7842_core_init()
2552 io_write_and_or(sd, 0x05, 0xf0, pdata->blank_data << 3 | adv7842_core_init()
2558 hdmi_write_and_or(sd, 0x1a, 0xf1, 0x08); /* Wait 1 s before unmute */ adv7842_core_init()
2561 io_write_and_or(sd, 0x14, 0xc0, adv7842_core_init()
2567 cp_write_and_or(sd, 0xba, 0xfc, pdata->hdmi_free_run_enable | adv7842_core_init()
2571 sdp_write_and_or(sd, 0xdd, 0xf0, pdata->sdp_free_run_force | adv7842_core_init()
2577 cp_write(sd, 0x69, 0x14); /* Enable CP CSC */ adv7842_core_init()
2578 io_write(sd, 0x06, 0xa6); /* positive VS and HS and DE */ adv7842_core_init()
2579 cp_write(sd, 0xf3, 0xdc); /* Low threshold to enter/exit free run mode */ adv7842_core_init()
2580 afe_write(sd, 0xb5, 0x01); /* Setting MCLK to 256Fs */ adv7842_core_init()
2582 afe_write(sd, 0x02, pdata->ain_sel); /* Select analog input muxing mode */ adv7842_core_init()
2583 io_write_and_or(sd, 0x30, ~(1 << 4), pdata->output_bus_lsb_to_msb << 4); adv7842_core_init()
2585 sdp_csc_coeff(sd, &pdata->sdp_csc_coeff); adv7842_core_init()
2589 sdp_write(sd, 0x12, 0x0d); /* Frame TBC,3D comb enabled */ adv7842_core_init()
2592 sdp_io_write(sd, 0x6f, 0x00); /* DDR mode */ adv7842_core_init()
2593 sdp_io_write(sd, 0x75, 0x0a); /* 128 MB memory size */ adv7842_core_init()
2594 sdp_io_write(sd, 0x7a, 0xa5); /* Timing Adjustment */ adv7842_core_init()
2595 sdp_io_write(sd, 0x7b, 0x8f); /* Timing Adjustment */ adv7842_core_init()
2596 sdp_io_write(sd, 0x60, 0x01); /* SDRAM reset */ adv7842_core_init()
2598 sdp_io_write(sd, 0x75, 0x0a); /* 64 MB memory size ?*/ adv7842_core_init()
2599 sdp_io_write(sd, 0x74, 0x00); /* must be zero for sdr sdram */ adv7842_core_init()
2600 sdp_io_write(sd, 0x79, 0x33); /* CAS latency to 3, adv7842_core_init()
2602 sdp_io_write(sd, 0x6f, 0x01); /* SDR mode */ adv7842_core_init()
2603 sdp_io_write(sd, 0x7a, 0xa5); /* Timing Adjustment */ adv7842_core_init()
2604 sdp_io_write(sd, 0x7b, 0x8f); /* Timing Adjustment */ adv7842_core_init()
2605 sdp_io_write(sd, 0x60, 0x01); /* SDRAM reset */ adv7842_core_init()
2612 sdp_io_write(sd, 0x29, 0x10); /* Tristate memory interface */ adv7842_core_init()
2615 select_input(sd, pdata->vid_std_select); adv7842_core_init()
2617 enable_input(sd); adv7842_core_init()
2621 hdmi_write(sd, 0x69, 0x5c); adv7842_core_init()
2624 hdmi_write(sd, 0x69, 0xa3); adv7842_core_init()
2626 io_write_and_or(sd, 0x20, 0xcf, 0x00); adv7842_core_init()
2630 io_write(sd, 0x19, 0x80 | pdata->llc_dll_phase); adv7842_core_init()
2631 io_write(sd, 0x33, 0x40); adv7842_core_init()
2634 io_write(sd, 0x40, 0xf2); /* Configure INT1 */ adv7842_core_init()
2636 adv7842_irq_enable(sd, true); adv7842_core_init()
2638 return v4l2_ctrl_handler_setup(sd->ctrl_handler); adv7842_core_init()
2643 static int adv7842_ddr_ram_test(struct v4l2_subdev *sd) adv7842_ddr_ram_test() argument
2656 io_write(sd, 0x00, 0x01); /* Program SDP 4x1 */ adv7842_ddr_ram_test()
2657 io_write(sd, 0x01, 0x00); /* Program SDP mode */ adv7842_ddr_ram_test()
2658 afe_write(sd, 0x80, 0x92); /* SDP Recommeneded Write */ adv7842_ddr_ram_test()
2659 afe_write(sd, 0x9B, 0x01); /* SDP Recommeneded Write ADV7844ES1 */ adv7842_ddr_ram_test()
2660 afe_write(sd, 0x9C, 0x60); /* SDP Recommeneded Write ADV7844ES1 */ adv7842_ddr_ram_test()
2661 afe_write(sd, 0x9E, 0x02); /* SDP Recommeneded Write ADV7844ES1 */ adv7842_ddr_ram_test()
2662 afe_write(sd, 0xA0, 0x0B); /* SDP Recommeneded Write ADV7844ES1 */ adv7842_ddr_ram_test()
2663 afe_write(sd, 0xC3, 0x02); /* Memory BIST Initialisation */ adv7842_ddr_ram_test()
2664 io_write(sd, 0x0C, 0x40); /* Power up ADV7844 */ adv7842_ddr_ram_test()
2665 io_write(sd, 0x15, 0xBA); /* Enable outputs */ adv7842_ddr_ram_test()
2666 sdp_write(sd, 0x12, 0x00); /* Disable 3D comb, Frame TBC & 3DNR */ adv7842_ddr_ram_test()
2667 io_write(sd, 0xFF, 0x04); /* Reset memory controller */ adv7842_ddr_ram_test()
2671 sdp_write(sd, 0x12, 0x00); /* Disable 3D Comb, Frame TBC & 3DNR */ adv7842_ddr_ram_test()
2672 sdp_io_write(sd, 0x2A, 0x01); /* Memory BIST Initialisation */ adv7842_ddr_ram_test()
2673 sdp_io_write(sd, 0x7c, 0x19); /* Memory BIST Initialisation */ adv7842_ddr_ram_test()
2674 sdp_io_write(sd, 0x80, 0x87); /* Memory BIST Initialisation */ adv7842_ddr_ram_test()
2675 sdp_io_write(sd, 0x81, 0x4a); /* Memory BIST Initialisation */ adv7842_ddr_ram_test()
2676 sdp_io_write(sd, 0x82, 0x2c); /* Memory BIST Initialisation */ adv7842_ddr_ram_test()
2677 sdp_io_write(sd, 0x83, 0x0e); /* Memory BIST Initialisation */ adv7842_ddr_ram_test()
2678 sdp_io_write(sd, 0x84, 0x94); /* Memory BIST Initialisation */ adv7842_ddr_ram_test()
2679 sdp_io_write(sd, 0x85, 0x62); /* Memory BIST Initialisation */ adv7842_ddr_ram_test()
2680 sdp_io_write(sd, 0x7d, 0x00); /* Memory BIST Initialisation */ adv7842_ddr_ram_test()
2681 sdp_io_write(sd, 0x7e, 0x1a); /* Memory BIST Initialisation */ adv7842_ddr_ram_test()
2685 sdp_io_write(sd, 0xd9, 0xd5); /* Enable BIST Test */ adv7842_ddr_ram_test()
2686 sdp_write(sd, 0x12, 0x05); /* Enable FRAME TBC & 3D COMB */ adv7842_ddr_ram_test()
2691 u8 result = sdp_io_read(sd, 0xdb); adv7842_ddr_ram_test()
2702 v4l2_dbg(1, debug, sd, adv7842_ddr_ram_test()
2711 static void adv7842_rewrite_i2c_addresses(struct v4l2_subdev *sd, adv7842_rewrite_i2c_addresses() argument
2714 io_write(sd, 0xf1, pdata->i2c_sdp << 1); adv7842_rewrite_i2c_addresses()
2715 io_write(sd, 0xf2, pdata->i2c_sdp_io << 1); adv7842_rewrite_i2c_addresses()
2716 io_write(sd, 0xf3, pdata->i2c_avlink << 1); adv7842_rewrite_i2c_addresses()
2717 io_write(sd, 0xf4, pdata->i2c_cec << 1); adv7842_rewrite_i2c_addresses()
2718 io_write(sd, 0xf5, pdata->i2c_infoframe << 1); adv7842_rewrite_i2c_addresses()
2720 io_write(sd, 0xf8, pdata->i2c_afe << 1); adv7842_rewrite_i2c_addresses()
2721 io_write(sd, 0xf9, pdata->i2c_repeater << 1); adv7842_rewrite_i2c_addresses()
2722 io_write(sd, 0xfa, pdata->i2c_edid << 1); adv7842_rewrite_i2c_addresses()
2723 io_write(sd, 0xfb, pdata->i2c_hdmi << 1); adv7842_rewrite_i2c_addresses()
2725 io_write(sd, 0xfd, pdata->i2c_cp << 1); adv7842_rewrite_i2c_addresses()
2726 io_write(sd, 0xfe, pdata->i2c_vdp << 1); adv7842_rewrite_i2c_addresses()
2729 static int adv7842_command_ram_test(struct v4l2_subdev *sd) adv7842_command_ram_test() argument
2731 struct i2c_client *client = v4l2_get_subdevdata(sd); adv7842_command_ram_test()
2732 struct adv7842_state *state = to_state(sd); adv7842_command_ram_test()
2741 v4l2_info(sd, "no sdram or no ddr sdram\n"); adv7842_command_ram_test()
2745 main_reset(sd); adv7842_command_ram_test()
2747 adv7842_rewrite_i2c_addresses(sd, pdata); adv7842_command_ram_test()
2750 ret = adv7842_ddr_ram_test(sd); adv7842_command_ram_test()
2752 main_reset(sd); adv7842_command_ram_test()
2754 adv7842_rewrite_i2c_addresses(sd, pdata); adv7842_command_ram_test()
2757 adv7842_core_init(sd); adv7842_command_ram_test()
2759 disable_input(sd); adv7842_command_ram_test()
2761 select_input(sd, state->vid_std_select); adv7842_command_ram_test()
2763 enable_input(sd); adv7842_command_ram_test()
2765 edid_write_vga_segment(sd); adv7842_command_ram_test()
2766 edid_write_hdmi_segment(sd, ADV7842_EDID_PORT_A); adv7842_command_ram_test()
2767 edid_write_hdmi_segment(sd, ADV7842_EDID_PORT_B); adv7842_command_ram_test()
2773 adv7842_s_dv_timings(sd, &timings); adv7842_command_ram_test()
2778 static long adv7842_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) adv7842_ioctl() argument
2782 return adv7842_command_ram_test(sd); adv7842_ioctl()
2864 static void adv7842_unregister_clients(struct v4l2_subdev *sd) adv7842_unregister_clients() argument
2866 struct adv7842_state *state = to_state(sd); adv7842_unregister_clients()
2903 static struct i2c_client *adv7842_dummy_client(struct v4l2_subdev *sd, const char *desc, adv7842_dummy_client() argument
2906 struct i2c_client *client = v4l2_get_subdevdata(sd); adv7842_dummy_client()
2909 io_write(sd, io_reg, addr << 1); adv7842_dummy_client()
2912 v4l2_err(sd, "no %s i2c addr configured\n", desc); adv7842_dummy_client()
2916 cp = i2c_new_dummy(client->adapter, io_read(sd, io_reg) >> 1); adv7842_dummy_client()
2918 v4l2_err(sd, "register %s on i2c addr 0x%x failed\n", desc, addr); adv7842_dummy_client()
2923 static int adv7842_register_clients(struct v4l2_subdev *sd) adv7842_register_clients() argument
2925 struct adv7842_state *state = to_state(sd); adv7842_register_clients()
2928 state->i2c_avlink = adv7842_dummy_client(sd, "avlink", pdata->i2c_avlink, 0xf3); adv7842_register_clients()
2929 state->i2c_cec = adv7842_dummy_client(sd, "cec", pdata->i2c_cec, 0xf4); adv7842_register_clients()
2930 state->i2c_infoframe = adv7842_dummy_client(sd, "infoframe", pdata->i2c_infoframe, 0xf5); adv7842_register_clients()
2931 state->i2c_sdp_io = adv7842_dummy_client(sd, "sdp_io", pdata->i2c_sdp_io, 0xf2); adv7842_register_clients()
2932 state->i2c_sdp = adv7842_dummy_client(sd, "sdp", pdata->i2c_sdp, 0xf1); adv7842_register_clients()
2933 state->i2c_afe = adv7842_dummy_client(sd, "afe", pdata->i2c_afe, 0xf8); adv7842_register_clients()
2934 state->i2c_repeater = adv7842_dummy_client(sd, "repeater", pdata->i2c_repeater, 0xf9); adv7842_register_clients()
2935 state->i2c_edid = adv7842_dummy_client(sd, "edid", pdata->i2c_edid, 0xfa); adv7842_register_clients()
2936 state->i2c_hdmi = adv7842_dummy_client(sd, "hdmi", pdata->i2c_hdmi, 0xfb); adv7842_register_clients()
2937 state->i2c_cp = adv7842_dummy_client(sd, "cp", pdata->i2c_cp, 0xfd); adv7842_register_clients()
2938 state->i2c_vdp = adv7842_dummy_client(sd, "vdp", pdata->i2c_vdp, 0xfe); adv7842_register_clients()
2964 struct v4l2_subdev *sd; adv7842_probe() local
2990 sd = &state->sd; adv7842_probe()
2991 v4l2_i2c_subdev_init(sd, client, &adv7842_ops); adv7842_probe()
2992 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; adv7842_probe()
3002 v4l2_info(sd, "got rev=0x%04x on first read attempt\n", rev); adv7842_probe()
3007 v4l2_info(sd, "not an adv7842 on address 0x%x (rev=0x%04x)\n", adv7842_probe()
3013 main_reset(sd); adv7842_probe()
3042 sd->ctrl_handler = hdl; adv7842_probe()
3053 if (adv7842_s_detect_tx_5v_ctrl(sd)) { adv7842_probe()
3058 if (adv7842_register_clients(sd) < 0) { adv7842_probe()
3060 v4l2_err(sd, "failed to create all i2c clients\n"); adv7842_probe()
3067 v4l2_err(sd, "Could not create work queue\n"); adv7842_probe()
3076 err = media_entity_init(&sd->entity, 1, &state->pad, 0); adv7842_probe()
3080 err = adv7842_core_init(sd); adv7842_probe()
3084 v4l2_info(sd, "%s found @ 0x%x (%s)\n", client->name, adv7842_probe()
3089 media_entity_cleanup(&sd->entity); adv7842_probe()
3094 adv7842_unregister_clients(sd); adv7842_probe()
3104 struct v4l2_subdev *sd = i2c_get_clientdata(client); adv7842_remove() local
3105 struct adv7842_state *state = to_state(sd); adv7842_remove()
3107 adv7842_irq_enable(sd, false); adv7842_remove()
3111 v4l2_device_unregister_subdev(sd); adv7842_remove()
3112 media_entity_cleanup(&sd->entity); adv7842_remove()
3113 adv7842_unregister_clients(sd); adv7842_remove()
3114 v4l2_ctrl_handler_free(sd->ctrl_handler); adv7842_remove()
H A Dadv7183.c37 struct v4l2_subdev sd; member in struct:adv7183
75 static inline struct adv7183 *to_adv7183(struct v4l2_subdev *sd) to_adv7183() argument
77 return container_of(sd, struct adv7183, sd); to_adv7183()
81 return &container_of(ctrl->handler, struct adv7183, hdl)->sd; to_sd()
84 static inline int adv7183_read(struct v4l2_subdev *sd, unsigned char reg) adv7183_read() argument
86 struct i2c_client *client = v4l2_get_subdevdata(sd); adv7183_read()
91 static inline int adv7183_write(struct v4l2_subdev *sd, unsigned char reg, adv7183_write() argument
94 struct i2c_client *client = v4l2_get_subdevdata(sd); adv7183_write()
99 static int adv7183_writeregs(struct v4l2_subdev *sd, adv7183_writeregs() argument
106 v4l2_err(sd, "invalid regs array\n"); adv7183_writeregs()
115 adv7183_write(sd, reg, data); adv7183_writeregs()
120 static int adv7183_log_status(struct v4l2_subdev *sd) adv7183_log_status() argument
122 struct adv7183 *decoder = to_adv7183(sd); adv7183_log_status()
124 v4l2_info(sd, "adv7183: Input control = 0x%02x\n", adv7183_log_status()
125 adv7183_read(sd, ADV7183_IN_CTRL)); adv7183_log_status()
126 v4l2_info(sd, "adv7183: Video selection = 0x%02x\n", adv7183_log_status()
127 adv7183_read(sd, ADV7183_VD_SEL)); adv7183_log_status()
128 v4l2_info(sd, "adv7183: Output control = 0x%02x\n", adv7183_log_status()
129 adv7183_read(sd, ADV7183_OUT_CTRL)); adv7183_log_status()
130 v4l2_info(sd, "adv7183: Extended output control = 0x%02x\n", adv7183_log_status()
131 adv7183_read(sd, ADV7183_EXT_OUT_CTRL)); adv7183_log_status()
132 v4l2_info(sd, "adv7183: Autodetect enable = 0x%02x\n", adv7183_log_status()
133 adv7183_read(sd, ADV7183_AUTO_DET_EN)); adv7183_log_status()
134 v4l2_info(sd, "adv7183: Contrast = 0x%02x\n", adv7183_log_status()
135 adv7183_read(sd, ADV7183_CONTRAST)); adv7183_log_status()
136 v4l2_info(sd, "adv7183: Brightness = 0x%02x\n", adv7183_log_status()
137 adv7183_read(sd, ADV7183_BRIGHTNESS)); adv7183_log_status()
138 v4l2_info(sd, "adv7183: Hue = 0x%02x\n", adv7183_log_status()
139 adv7183_read(sd, ADV7183_HUE)); adv7183_log_status()
140 v4l2_info(sd, "adv7183: Default value Y = 0x%02x\n", adv7183_log_status()
141 adv7183_read(sd, ADV7183_DEF_Y)); adv7183_log_status()
142 v4l2_info(sd, "adv7183: Default value C = 0x%02x\n", adv7183_log_status()
143 adv7183_read(sd, ADV7183_DEF_C)); adv7183_log_status()
144 v4l2_info(sd, "adv7183: ADI control = 0x%02x\n", adv7183_log_status()
145 adv7183_read(sd, ADV7183_ADI_CTRL)); adv7183_log_status()
146 v4l2_info(sd, "adv7183: Power Management = 0x%02x\n", adv7183_log_status()
147 adv7183_read(sd, ADV7183_POW_MANAGE)); adv7183_log_status()
148 v4l2_info(sd, "adv7183: Status 1 2 and 3 = 0x%02x 0x%02x 0x%02x\n", adv7183_log_status()
149 adv7183_read(sd, ADV7183_STATUS_1), adv7183_log_status()
150 adv7183_read(sd, ADV7183_STATUS_2), adv7183_log_status()
151 adv7183_read(sd, ADV7183_STATUS_3)); adv7183_log_status()
152 v4l2_info(sd, "adv7183: Ident = 0x%02x\n", adv7183_log_status()
153 adv7183_read(sd, ADV7183_IDENT)); adv7183_log_status()
154 v4l2_info(sd, "adv7183: Analog clamp control = 0x%02x\n", adv7183_log_status()
155 adv7183_read(sd, ADV7183_ANAL_CLAMP_CTRL)); adv7183_log_status()
156 v4l2_info(sd, "adv7183: Digital clamp control 1 = 0x%02x\n", adv7183_log_status()
157 adv7183_read(sd, ADV7183_DIGI_CLAMP_CTRL_1)); adv7183_log_status()
158 v4l2_info(sd, "adv7183: Shaping filter control 1 and 2 = 0x%02x 0x%02x\n", adv7183_log_status()
159 adv7183_read(sd, ADV7183_SHAP_FILT_CTRL), adv7183_log_status()
160 adv7183_read(sd, ADV7183_SHAP_FILT_CTRL_2)); adv7183_log_status()
161 v4l2_info(sd, "adv7183: Comb filter control = 0x%02x\n", adv7183_log_status()
162 adv7183_read(sd, ADV7183_COMB_FILT_CTRL)); adv7183_log_status()
163 v4l2_info(sd, "adv7183: ADI control 2 = 0x%02x\n", adv7183_log_status()
164 adv7183_read(sd, ADV7183_ADI_CTRL_2)); adv7183_log_status()
165 v4l2_info(sd, "adv7183: Pixel delay control = 0x%02x\n", adv7183_log_status()
166 adv7183_read(sd, ADV7183_PIX_DELAY_CTRL)); adv7183_log_status()
167 v4l2_info(sd, "adv7183: Misc gain control = 0x%02x\n", adv7183_log_status()
168 adv7183_read(sd, ADV7183_MISC_GAIN_CTRL)); adv7183_log_status()
169 v4l2_info(sd, "adv7183: AGC mode control = 0x%02x\n", adv7183_log_status()
170 adv7183_read(sd, ADV7183_AGC_MODE_CTRL)); adv7183_log_status()
171 v4l2_info(sd, "adv7183: Chroma gain control 1 and 2 = 0x%02x 0x%02x\n", adv7183_log_status()
172 adv7183_read(sd, ADV7183_CHRO_GAIN_CTRL_1), adv7183_log_status()
173 adv7183_read(sd, ADV7183_CHRO_GAIN_CTRL_2)); adv7183_log_status()
174 v4l2_info(sd, "adv7183: Luma gain control 1 and 2 = 0x%02x 0x%02x\n", adv7183_log_status()
175 adv7183_read(sd, ADV7183_LUMA_GAIN_CTRL_1), adv7183_log_status()
176 adv7183_read(sd, ADV7183_LUMA_GAIN_CTRL_2)); adv7183_log_status()
177 v4l2_info(sd, "adv7183: Vsync field control 1 2 and 3 = 0x%02x 0x%02x 0x%02x\n", adv7183_log_status()
178 adv7183_read(sd, ADV7183_VS_FIELD_CTRL_1), adv7183_log_status()
179 adv7183_read(sd, ADV7183_VS_FIELD_CTRL_2), adv7183_log_status()
180 adv7183_read(sd, ADV7183_VS_FIELD_CTRL_3)); adv7183_log_status()
181 v4l2_info(sd, "adv7183: Hsync position control 1 2 and 3 = 0x%02x 0x%02x 0x%02x\n", adv7183_log_status()
182 adv7183_read(sd, ADV7183_HS_POS_CTRL_1), adv7183_log_status()
183 adv7183_read(sd, ADV7183_HS_POS_CTRL_2), adv7183_log_status()
184 adv7183_read(sd, ADV7183_HS_POS_CTRL_3)); adv7183_log_status()
185 v4l2_info(sd, "adv7183: Polarity = 0x%02x\n", adv7183_log_status()
186 adv7183_read(sd, ADV7183_POLARITY)); adv7183_log_status()
187 v4l2_info(sd, "adv7183: ADC control = 0x%02x\n", adv7183_log_status()
188 adv7183_read(sd, ADV7183_ADC_CTRL)); adv7183_log_status()
189 v4l2_info(sd, "adv7183: SD offset Cb and Cr = 0x%02x 0x%02x\n", adv7183_log_status()
190 adv7183_read(sd, ADV7183_SD_OFFSET_CB), adv7183_log_status()
191 adv7183_read(sd, ADV7183_SD_OFFSET_CR)); adv7183_log_status()
192 v4l2_info(sd, "adv7183: SD saturation Cb and Cr = 0x%02x 0x%02x\n", adv7183_log_status()
193 adv7183_read(sd, ADV7183_SD_SATURATION_CB), adv7183_log_status()
194 adv7183_read(sd, ADV7183_SD_SATURATION_CR)); adv7183_log_status()
195 v4l2_info(sd, "adv7183: Drive strength = 0x%02x\n", adv7183_log_status()
196 adv7183_read(sd, ADV7183_DRIVE_STR)); adv7183_log_status()
197 v4l2_ctrl_handler_log_status(&decoder->hdl, sd->name); adv7183_log_status()
201 static int adv7183_g_std(struct v4l2_subdev *sd, v4l2_std_id *std) adv7183_g_std() argument
203 struct adv7183 *decoder = to_adv7183(sd); adv7183_g_std()
209 static int adv7183_s_std(struct v4l2_subdev *sd, v4l2_std_id std) adv7183_s_std() argument
211 struct adv7183 *decoder = to_adv7183(sd); adv7183_s_std()
214 reg = adv7183_read(sd, ADV7183_IN_CTRL) & 0xF; adv7183_s_std()
233 adv7183_write(sd, ADV7183_IN_CTRL, reg); adv7183_s_std()
240 static int adv7183_reset(struct v4l2_subdev *sd, u32 val) adv7183_reset() argument
244 reg = adv7183_read(sd, ADV7183_POW_MANAGE) | 0x80; adv7183_reset()
245 adv7183_write(sd, ADV7183_POW_MANAGE, reg); adv7183_reset()
251 static int adv7183_s_routing(struct v4l2_subdev *sd, adv7183_s_routing() argument
254 struct adv7183 *decoder = to_adv7183(sd); adv7183_s_routing()
262 reg = adv7183_read(sd, ADV7183_IN_CTRL) & 0xF0; adv7183_s_routing()
312 adv7183_write(sd, ADV7183_IN_CTRL, reg); adv7183_s_routing()
317 reg = adv7183_read(sd, ADV7183_OUT_CTRL) & 0xC0; adv7183_s_routing()
326 adv7183_write(sd, ADV7183_OUT_CTRL, reg); adv7183_s_routing()
334 struct v4l2_subdev *sd = to_sd(ctrl); adv7183_s_ctrl() local
341 adv7183_write(sd, ADV7183_BRIGHTNESS, val); adv7183_s_ctrl()
344 adv7183_write(sd, ADV7183_CONTRAST, val); adv7183_s_ctrl()
347 adv7183_write(sd, ADV7183_SD_SATURATION_CB, val >> 8); adv7183_s_ctrl()
348 adv7183_write(sd, ADV7183_SD_SATURATION_CR, (val & 0xFF)); adv7183_s_ctrl()
351 adv7183_write(sd, ADV7183_SD_OFFSET_CB, val >> 8); adv7183_s_ctrl()
352 adv7183_write(sd, ADV7183_SD_OFFSET_CR, (val & 0xFF)); adv7183_s_ctrl()
361 static int adv7183_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) adv7183_querystd() argument
363 struct adv7183 *decoder = to_adv7183(sd); adv7183_querystd()
367 reg = adv7183_read(sd, ADV7183_IN_CTRL) & 0xF; adv7183_querystd()
368 adv7183_write(sd, ADV7183_IN_CTRL, reg); adv7183_querystd()
374 reg = adv7183_read(sd, ADV7183_STATUS_1); adv7183_querystd()
406 adv7183_s_std(sd, decoder->std); adv7183_querystd()
410 static int adv7183_g_input_status(struct v4l2_subdev *sd, u32 *status) adv7183_g_input_status() argument
415 reg = adv7183_read(sd, ADV7183_STATUS_1); adv7183_g_input_status()
423 static int adv7183_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index, adv7183_enum_mbus_fmt() argument
433 static int adv7183_try_mbus_fmt(struct v4l2_subdev *sd, adv7183_try_mbus_fmt() argument
436 struct adv7183 *decoder = to_adv7183(sd); adv7183_try_mbus_fmt()
452 static int adv7183_s_mbus_fmt(struct v4l2_subdev *sd, adv7183_s_mbus_fmt() argument
455 struct adv7183 *decoder = to_adv7183(sd); adv7183_s_mbus_fmt()
457 adv7183_try_mbus_fmt(sd, fmt); adv7183_s_mbus_fmt()
462 static int adv7183_g_mbus_fmt(struct v4l2_subdev *sd, adv7183_g_mbus_fmt() argument
465 struct adv7183 *decoder = to_adv7183(sd); adv7183_g_mbus_fmt()
471 static int adv7183_s_stream(struct v4l2_subdev *sd, int enable) adv7183_s_stream() argument
473 struct adv7183 *decoder = to_adv7183(sd); adv7183_s_stream()
484 static int adv7183_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) adv7183_g_register() argument
486 reg->val = adv7183_read(sd, reg->reg & 0xff); adv7183_g_register()
491 static int adv7183_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) adv7183_s_register() argument
493 adv7183_write(sd, reg->reg & 0xff, reg->val & 0xff); adv7183_s_register()
533 struct v4l2_subdev *sd; adv7183_probe() local
570 sd = &decoder->sd; adv7183_probe()
571 v4l2_i2c_subdev_init(sd, client, &adv7183_ops); adv7183_probe()
584 sd->ctrl_handler = hdl; adv7183_probe()
604 adv7183_writeregs(sd, adv7183_init_regs, ARRAY_SIZE(adv7183_init_regs)); adv7183_probe()
605 adv7183_s_std(sd, decoder->std); adv7183_probe()
608 adv7183_s_mbus_fmt(sd, &fmt); adv7183_probe()
622 struct v4l2_subdev *sd = i2c_get_clientdata(client); adv7183_remove() local
624 v4l2_device_unregister_subdev(sd); adv7183_remove()
625 v4l2_ctrl_handler_free(sd->ctrl_handler); adv7183_remove()
H A Dad9389b.c81 struct v4l2_subdev sd; member in struct:ad9389b_state
105 static void ad9389b_check_monitor_present_status(struct v4l2_subdev *sd);
106 static bool ad9389b_check_edid_status(struct v4l2_subdev *sd);
107 static void ad9389b_setup(struct v4l2_subdev *sd);
108 static int ad9389b_s_i2s_clock_freq(struct v4l2_subdev *sd, u32 freq);
109 static int ad9389b_s_clock_freq(struct v4l2_subdev *sd, u32 freq);
111 static inline struct ad9389b_state *get_ad9389b_state(struct v4l2_subdev *sd) get_ad9389b_state() argument
113 return container_of(sd, struct ad9389b_state, sd); get_ad9389b_state()
118 return &container_of(ctrl->handler, struct ad9389b_state, hdl)->sd; to_sd()
123 static int ad9389b_rd(struct v4l2_subdev *sd, u8 reg) ad9389b_rd() argument
125 struct i2c_client *client = v4l2_get_subdevdata(sd); ad9389b_rd()
130 static int ad9389b_wr(struct v4l2_subdev *sd, u8 reg, u8 val) ad9389b_wr() argument
132 struct i2c_client *client = v4l2_get_subdevdata(sd); ad9389b_wr()
141 v4l2_err(sd, "%s: failed reg 0x%x, val 0x%x\n", __func__, reg, val); ad9389b_wr()
147 static inline void ad9389b_wr_and_or(struct v4l2_subdev *sd, u8 reg, ad9389b_wr_and_or() argument
150 ad9389b_wr(sd, reg, (ad9389b_rd(sd, reg) & clr_mask) | val_mask); ad9389b_wr_and_or()
153 static void ad9389b_edid_rd(struct v4l2_subdev *sd, u16 len, u8 *buf) ad9389b_edid_rd() argument
155 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_edid_rd()
158 v4l2_dbg(1, debug, sd, "%s:\n", __func__); ad9389b_edid_rd()
164 static inline bool ad9389b_have_hotplug(struct v4l2_subdev *sd) ad9389b_have_hotplug() argument
166 return ad9389b_rd(sd, 0x42) & MASK_AD9389B_HPD_DETECT; ad9389b_have_hotplug()
169 static inline bool ad9389b_have_rx_sense(struct v4l2_subdev *sd) ad9389b_have_rx_sense() argument
171 return ad9389b_rd(sd, 0x42) & MASK_AD9389B_MSEN_DETECT; ad9389b_have_rx_sense()
174 static void ad9389b_csc_conversion_mode(struct v4l2_subdev *sd, u8 mode) ad9389b_csc_conversion_mode() argument
176 ad9389b_wr_and_or(sd, 0x17, 0xe7, (mode & 0x3)<<3); ad9389b_csc_conversion_mode()
177 ad9389b_wr_and_or(sd, 0x18, 0x9f, (mode & 0x3)<<5); ad9389b_csc_conversion_mode()
180 static void ad9389b_csc_coeff(struct v4l2_subdev *sd, ad9389b_csc_coeff() argument
186 ad9389b_wr_and_or(sd, 0x18, 0xe0, A1>>8); ad9389b_csc_coeff()
187 ad9389b_wr(sd, 0x19, A1); ad9389b_csc_coeff()
188 ad9389b_wr_and_or(sd, 0x1A, 0xe0, A2>>8); ad9389b_csc_coeff()
189 ad9389b_wr(sd, 0x1B, A2); ad9389b_csc_coeff()
190 ad9389b_wr_and_or(sd, 0x1c, 0xe0, A3>>8); ad9389b_csc_coeff()
191 ad9389b_wr(sd, 0x1d, A3); ad9389b_csc_coeff()
192 ad9389b_wr_and_or(sd, 0x1e, 0xe0, A4>>8); ad9389b_csc_coeff()
193 ad9389b_wr(sd, 0x1f, A4); ad9389b_csc_coeff()
196 ad9389b_wr_and_or(sd, 0x20, 0xe0, B1>>8); ad9389b_csc_coeff()
197 ad9389b_wr(sd, 0x21, B1); ad9389b_csc_coeff()
198 ad9389b_wr_and_or(sd, 0x22, 0xe0, B2>>8); ad9389b_csc_coeff()
199 ad9389b_wr(sd, 0x23, B2); ad9389b_csc_coeff()
200 ad9389b_wr_and_or(sd, 0x24, 0xe0, B3>>8); ad9389b_csc_coeff()
201 ad9389b_wr(sd, 0x25, B3); ad9389b_csc_coeff()
202 ad9389b_wr_and_or(sd, 0x26, 0xe0, B4>>8); ad9389b_csc_coeff()
203 ad9389b_wr(sd, 0x27, B4); ad9389b_csc_coeff()
206 ad9389b_wr_and_or(sd, 0x28, 0xe0, C1>>8); ad9389b_csc_coeff()
207 ad9389b_wr(sd, 0x29, C1); ad9389b_csc_coeff()
208 ad9389b_wr_and_or(sd, 0x2A, 0xe0, C2>>8); ad9389b_csc_coeff()
209 ad9389b_wr(sd, 0x2B, C2); ad9389b_csc_coeff()
210 ad9389b_wr_and_or(sd, 0x2C, 0xe0, C3>>8); ad9389b_csc_coeff()
211 ad9389b_wr(sd, 0x2D, C3); ad9389b_csc_coeff()
212 ad9389b_wr_and_or(sd, 0x2E, 0xe0, C4>>8); ad9389b_csc_coeff()
213 ad9389b_wr(sd, 0x2F, C4); ad9389b_csc_coeff()
216 static void ad9389b_csc_rgb_full2limit(struct v4l2_subdev *sd, bool enable) ad9389b_csc_rgb_full2limit() argument
221 ad9389b_csc_conversion_mode(sd, csc_mode); ad9389b_csc_rgb_full2limit()
222 ad9389b_csc_coeff(sd, ad9389b_csc_rgb_full2limit()
227 ad9389b_wr_and_or(sd, 0x3b, 0xfe, 0x1); ad9389b_csc_rgb_full2limit()
229 ad9389b_wr_and_or(sd, 0xcd, 0xf9, 0x02); ad9389b_csc_rgb_full2limit()
232 ad9389b_wr_and_or(sd, 0x3b, 0xfe, 0x0); ad9389b_csc_rgb_full2limit()
234 ad9389b_wr_and_or(sd, 0xcd, 0xf9, 0x04); ad9389b_csc_rgb_full2limit()
238 static void ad9389b_set_IT_content_AVI_InfoFrame(struct v4l2_subdev *sd) ad9389b_set_IT_content_AVI_InfoFrame() argument
240 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_set_IT_content_AVI_InfoFrame()
244 ad9389b_wr_and_or(sd, 0xcd, 0xbf, 0x00); ad9389b_set_IT_content_AVI_InfoFrame()
247 ad9389b_wr_and_or(sd, 0xcd, 0xbf, 0x40); ad9389b_set_IT_content_AVI_InfoFrame()
251 static int ad9389b_set_rgb_quantization_mode(struct v4l2_subdev *sd, struct v4l2_ctrl *ctrl) ad9389b_set_rgb_quantization_mode() argument
253 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_set_rgb_quantization_mode()
260 ad9389b_csc_rgb_full2limit(sd, true); ad9389b_set_rgb_quantization_mode()
263 ad9389b_csc_rgb_full2limit(sd, false); ad9389b_set_rgb_quantization_mode()
268 ad9389b_csc_rgb_full2limit(sd, true); ad9389b_set_rgb_quantization_mode()
272 ad9389b_csc_rgb_full2limit(sd, false); ad9389b_set_rgb_quantization_mode()
280 static void ad9389b_set_manual_pll_gear(struct v4l2_subdev *sd, u32 pixelclock) ad9389b_set_manual_pll_gear() argument
308 ad9389b_wr_and_or(sd, 0x98, 0x0f, gear); ad9389b_set_manual_pll_gear()
315 struct v4l2_subdev *sd = to_sd(ctrl); ad9389b_s_ctrl() local
316 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_s_ctrl()
318 v4l2_dbg(1, debug, sd, ad9389b_s_ctrl()
323 ad9389b_wr_and_or(sd, 0xaf, 0xfd, ad9389b_s_ctrl()
328 return ad9389b_set_rgb_quantization_mode(sd, ctrl); ad9389b_s_ctrl()
339 static int ad9389b_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) ad9389b_g_register() argument
341 reg->val = ad9389b_rd(sd, reg->reg & 0xff); ad9389b_g_register()
346 static int ad9389b_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) ad9389b_s_register() argument
348 ad9389b_wr(sd, reg->reg & 0xff, reg->val & 0xff); ad9389b_s_register()
353 static int ad9389b_log_status(struct v4l2_subdev *sd) ad9389b_log_status() argument
355 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_log_status()
382 v4l2_info(sd, "chip revision %d\n", state->chip_revision); ad9389b_log_status()
383 v4l2_info(sd, "power %s\n", state->power_on ? "on" : "off"); ad9389b_log_status()
384 v4l2_info(sd, "%s hotplug, %s Rx Sense, %s EDID (%d block(s))\n", ad9389b_log_status()
385 (ad9389b_rd(sd, 0x42) & MASK_AD9389B_HPD_DETECT) ? ad9389b_log_status()
387 (ad9389b_rd(sd, 0x42) & MASK_AD9389B_MSEN_DETECT) ? ad9389b_log_status()
390 v4l2_info(sd, "%s output %s\n", ad9389b_log_status()
391 (ad9389b_rd(sd, 0xaf) & 0x02) ? ad9389b_log_status()
393 (ad9389b_rd(sd, 0xa1) & 0x3c) ? ad9389b_log_status()
395 v4l2_info(sd, "ad9389b: %s\n", (ad9389b_rd(sd, 0xb8) & 0x40) ? ad9389b_log_status()
397 v4l2_info(sd, "state: %s, error: %s, detect count: %u, msk/irq: %02x/%02x\n", ad9389b_log_status()
398 states[ad9389b_rd(sd, 0xc8) & 0xf], ad9389b_log_status()
399 errors[ad9389b_rd(sd, 0xc8) >> 4], ad9389b_log_status()
401 ad9389b_rd(sd, 0x94), ad9389b_rd(sd, 0x96)); ad9389b_log_status()
402 manual_gear = ad9389b_rd(sd, 0x98) & 0x80; ad9389b_log_status()
403 v4l2_info(sd, "ad9389b: RGB quantization: %s range\n", ad9389b_log_status()
404 ad9389b_rd(sd, 0x3b) & 0x01 ? "limited" : "full"); ad9389b_log_status()
405 v4l2_info(sd, "ad9389b: %s gear %d\n", ad9389b_log_status()
407 manual_gear ? ((ad9389b_rd(sd, 0x98) & 0x70) >> 4) : ad9389b_log_status()
408 ((ad9389b_rd(sd, 0x9e) & 0x0e) >> 1)); ad9389b_log_status()
409 if (ad9389b_rd(sd, 0xaf) & 0x02) { ad9389b_log_status()
411 u8 manual_cts = ad9389b_rd(sd, 0x0a) & 0x80; ad9389b_log_status()
412 u32 N = (ad9389b_rd(sd, 0x01) & 0xf) << 16 | ad9389b_log_status()
413 ad9389b_rd(sd, 0x02) << 8 | ad9389b_log_status()
414 ad9389b_rd(sd, 0x03); ad9389b_log_status()
415 u8 vic_detect = ad9389b_rd(sd, 0x3e) >> 2; ad9389b_log_status()
416 u8 vic_sent = ad9389b_rd(sd, 0x3d) & 0x3f; ad9389b_log_status()
420 CTS = (ad9389b_rd(sd, 0x07) & 0xf) << 16 | ad9389b_log_status()
421 ad9389b_rd(sd, 0x08) << 8 | ad9389b_log_status()
422 ad9389b_rd(sd, 0x09); ad9389b_log_status()
424 CTS = (ad9389b_rd(sd, 0x04) & 0xf) << 16 | ad9389b_log_status()
425 ad9389b_rd(sd, 0x05) << 8 | ad9389b_log_status()
426 ad9389b_rd(sd, 0x06); ad9389b_log_status()
427 N = (ad9389b_rd(sd, 0x01) & 0xf) << 16 | ad9389b_log_status()
428 ad9389b_rd(sd, 0x02) << 8 | ad9389b_log_status()
429 ad9389b_rd(sd, 0x03); ad9389b_log_status()
431 v4l2_info(sd, "ad9389b: CTS %s mode: N %d, CTS %d\n", ad9389b_log_status()
434 v4l2_info(sd, "ad9389b: VIC: detected %d, sent %d\n", ad9389b_log_status()
438 v4l2_print_dv_timings(sd->name, "timings: ", ad9389b_log_status()
441 v4l2_info(sd, "no timings set\n"); ad9389b_log_status()
446 static int ad9389b_s_power(struct v4l2_subdev *sd, int on) ad9389b_s_power() argument
448 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_s_power()
453 v4l2_dbg(1, debug, sd, "%s: power %s\n", __func__, on ? "on" : "off"); ad9389b_s_power()
459 ad9389b_wr_and_or(sd, 0x41, 0xbf, 0x40); ad9389b_s_power()
467 ad9389b_wr_and_or(sd, 0x41, 0xbf, 0x0); ad9389b_s_power()
468 if ((ad9389b_rd(sd, 0x41) & 0x40) == 0) ad9389b_s_power()
470 ad9389b_wr_and_or(sd, 0x41, 0xbf, 0x40); ad9389b_s_power()
474 v4l2_dbg(1, debug, sd, "failed to powerup the ad9389b\n"); ad9389b_s_power()
475 ad9389b_s_power(sd, 0); ad9389b_s_power()
479 v4l2_dbg(1, debug, sd, ad9389b_s_power()
483 ad9389b_wr_and_or(sd, 0xba, 0xef, 0x10); ad9389b_s_power()
486 ad9389b_wr_and_or(sd, 0x98, 0xf0, 0x07); ad9389b_s_power()
487 ad9389b_wr(sd, 0x9c, 0x38); ad9389b_s_power()
488 ad9389b_wr_and_or(sd, 0x9d, 0xfc, 0x01); ad9389b_s_power()
492 ad9389b_wr(sd, 0xa2, pdata->diff_data_drive_strength); ad9389b_s_power()
494 ad9389b_wr(sd, 0xa2, 0x87); ad9389b_s_power()
497 ad9389b_wr(sd, 0xa3, pdata->diff_clk_drive_strength); ad9389b_s_power()
499 ad9389b_wr(sd, 0xa3, 0x87); ad9389b_s_power()
501 ad9389b_wr(sd, 0x0a, 0x01); ad9389b_s_power()
502 ad9389b_wr(sd, 0xbb, 0xff); ad9389b_s_power()
505 ad9389b_wr(sd, 0xc9, 0xf); ad9389b_s_power()
510 static void ad9389b_set_isr(struct v4l2_subdev *sd, bool enable) ad9389b_set_isr() argument
520 else if (ad9389b_have_hotplug(sd)) ad9389b_set_isr()
532 ad9389b_wr(sd, 0x94, irqs); ad9389b_set_isr()
533 irqs_rd = ad9389b_rd(sd, 0x94); ad9389b_set_isr()
537 v4l2_err(sd, "Could not set interrupts: hw failure?\n"); ad9389b_set_isr()
541 static int ad9389b_isr(struct v4l2_subdev *sd, u32 status, bool *handled) ad9389b_isr() argument
546 ad9389b_set_isr(sd, false); ad9389b_isr()
547 irq_status = ad9389b_rd(sd, 0x96); ad9389b_isr()
549 ad9389b_wr(sd, 0x96, irq_status); ad9389b_isr()
551 ad9389b_set_isr(sd, true); ad9389b_isr()
553 v4l2_dbg(1, debug, sd, "%s: irq_status 0x%x\n", __func__, irq_status); ad9389b_isr()
556 ad9389b_check_monitor_present_status(sd); ad9389b_isr()
558 ad9389b_check_edid_status(sd); ad9389b_isr()
577 static int ad9389b_s_stream(struct v4l2_subdev *sd, int enable) ad9389b_s_stream() argument
579 v4l2_dbg(1, debug, sd, "%s: %sable\n", __func__, (enable ? "en" : "dis")); ad9389b_s_stream()
581 ad9389b_wr_and_or(sd, 0xa1, ~0x3c, (enable ? 0 : 0x3c)); ad9389b_s_stream()
583 ad9389b_check_monitor_present_status(sd); ad9389b_s_stream()
585 ad9389b_s_power(sd, 0); ad9389b_s_stream()
601 static int ad9389b_s_dv_timings(struct v4l2_subdev *sd, ad9389b_s_dv_timings() argument
604 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_s_dv_timings()
606 v4l2_dbg(1, debug, sd, "%s:\n", __func__); ad9389b_s_dv_timings()
622 ad9389b_set_rgb_quantization_mode(sd, state->rgb_quantization_range_ctrl); ad9389b_s_dv_timings()
626 ad9389b_set_manual_pll_gear(sd, (u32)timings->bt.pixelclock); ad9389b_s_dv_timings()
629 ad9389b_set_IT_content_AVI_InfoFrame(sd); ad9389b_s_dv_timings()
634 static int ad9389b_g_dv_timings(struct v4l2_subdev *sd, ad9389b_g_dv_timings() argument
637 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_g_dv_timings()
639 v4l2_dbg(1, debug, sd, "%s:\n", __func__); ad9389b_g_dv_timings()
649 static int ad9389b_enum_dv_timings(struct v4l2_subdev *sd, ad9389b_enum_dv_timings() argument
659 static int ad9389b_dv_timings_cap(struct v4l2_subdev *sd, ad9389b_dv_timings_cap() argument
677 static int ad9389b_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) ad9389b_get_edid() argument
679 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_get_edid()
686 v4l2_dbg(1, debug, sd, "EDID segment 0 not found\n"); ad9389b_get_edid()
706 static int ad9389b_s_audio_stream(struct v4l2_subdev *sd, int enable) ad9389b_s_audio_stream() argument
708 v4l2_dbg(1, debug, sd, "%s: %sable\n", __func__, (enable ? "en" : "dis")); ad9389b_s_audio_stream()
711 ad9389b_wr_and_or(sd, 0x45, 0x3f, 0x80); ad9389b_s_audio_stream()
713 ad9389b_wr_and_or(sd, 0x45, 0x3f, 0x40); ad9389b_s_audio_stream()
718 static int ad9389b_s_clock_freq(struct v4l2_subdev *sd, u32 freq) ad9389b_s_clock_freq() argument
735 ad9389b_wr(sd, 0x01, (N >> 16) & 0xf); ad9389b_s_clock_freq()
736 ad9389b_wr(sd, 0x02, (N >> 8) & 0xff); ad9389b_s_clock_freq()
737 ad9389b_wr(sd, 0x03, N & 0xff); ad9389b_s_clock_freq()
742 static int ad9389b_s_i2s_clock_freq(struct v4l2_subdev *sd, u32 freq) ad9389b_s_i2s_clock_freq() argument
759 ad9389b_wr_and_or(sd, 0x15, 0xf, i2s_sf); ad9389b_s_i2s_clock_freq()
764 static int ad9389b_s_routing(struct v4l2_subdev *sd, u32 input, u32 output, u32 config) ad9389b_s_routing() argument
770 ad9389b_wr_and_or(sd, 0x50, 0x1f, 0x20); ad9389b_s_routing()
772 ad9389b_wr(sd, 0x51, 0x00); ad9389b_s_routing()
776 ad9389b_wr_and_or(sd, 0x14, 0xf0, 0x02); ad9389b_s_routing()
798 static void ad9389b_dbg_dump_edid(int lvl, int debug, struct v4l2_subdev *sd, ad9389b_dbg_dump_edid() argument
806 v4l2_dbg(lvl, debug, sd, "edid segment %d\n", segment); ad9389b_dbg_dump_edid()
812 v4l2_dbg(lvl, debug, sd, "\n"); ad9389b_dbg_dump_edid()
818 v4l2_dbg(lvl, debug, sd, "%s\n", b); ad9389b_dbg_dump_edid()
827 struct v4l2_subdev *sd = &state->sd; ad9389b_edid_handler() local
830 v4l2_dbg(1, debug, sd, "%s:\n", __func__); ad9389b_edid_handler()
832 if (ad9389b_check_edid_status(sd)) { ad9389b_edid_handler()
837 if (ad9389b_have_hotplug(sd)) { ad9389b_edid_handler()
843 v4l2_dbg(1, debug, sd, "%s: edid read failed\n", __func__); ad9389b_edid_handler()
844 ad9389b_s_power(sd, false); ad9389b_edid_handler()
845 ad9389b_s_power(sd, true); ad9389b_edid_handler()
854 ed.segment = ad9389b_rd(sd, 0xc4); ad9389b_edid_handler()
855 v4l2_subdev_notify(sd, AD9389B_EDID_DETECT, (void *)&ed); ad9389b_edid_handler()
856 v4l2_dbg(1, debug, sd, "%s: no edid found\n", __func__); ad9389b_edid_handler()
859 static void ad9389b_audio_setup(struct v4l2_subdev *sd) ad9389b_audio_setup() argument
861 v4l2_dbg(1, debug, sd, "%s\n", __func__); ad9389b_audio_setup()
863 ad9389b_s_i2s_clock_freq(sd, 48000); ad9389b_audio_setup()
864 ad9389b_s_clock_freq(sd, 48000); ad9389b_audio_setup()
865 ad9389b_s_routing(sd, 0, 0, 0); ad9389b_audio_setup()
871 static void ad9389b_setup(struct v4l2_subdev *sd) ad9389b_setup() argument
873 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_setup()
875 v4l2_dbg(1, debug, sd, "%s\n", __func__); ad9389b_setup()
878 ad9389b_wr_and_or(sd, 0x15, 0xf1, 0x0); ad9389b_setup()
880 ad9389b_wr_and_or(sd, 0x16, 0x3f, 0x0); ad9389b_setup()
883 ad9389b_wr_and_or(sd, 0x17, 0xf9, 0x06); ad9389b_setup()
885 ad9389b_wr_and_or(sd, 0x45, 0xc7, 0x08); ad9389b_setup()
887 ad9389b_wr_and_or(sd, 0x46, 0x3f, 0x80); ad9389b_setup()
889 ad9389b_wr(sd, 0x3c, 0x0); ad9389b_setup()
891 ad9389b_wr(sd, 0x47, 0x80); ad9389b_setup()
893 ad9389b_wr_and_or(sd, 0xaf, 0xef, 0x0); ad9389b_setup()
895 ad9389b_wr_and_or(sd, 0xba, 0x1f, 0x60); ad9389b_setup()
897 ad9389b_audio_setup(sd); ad9389b_setup()
901 ad9389b_set_IT_content_AVI_InfoFrame(sd); ad9389b_setup()
904 static void ad9389b_notify_monitor_detect(struct v4l2_subdev *sd) ad9389b_notify_monitor_detect() argument
907 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_notify_monitor_detect()
910 v4l2_subdev_notify(sd, AD9389B_MONITOR_DETECT, (void *)&mdt); ad9389b_notify_monitor_detect()
913 static void ad9389b_update_monitor_present_status(struct v4l2_subdev *sd) ad9389b_update_monitor_present_status() argument
915 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_update_monitor_present_status()
917 u8 status = ad9389b_rd(sd, 0x42); ad9389b_update_monitor_present_status()
919 v4l2_dbg(1, debug, sd, "%s: status: 0x%x%s%s\n", ad9389b_update_monitor_present_status()
926 v4l2_dbg(1, debug, sd, "%s: hotplug detected\n", __func__); ad9389b_update_monitor_present_status()
928 if (!ad9389b_s_power(sd, true)) { ad9389b_update_monitor_present_status()
929 v4l2_dbg(1, debug, sd, ad9389b_update_monitor_present_status()
933 ad9389b_setup(sd); ad9389b_update_monitor_present_status()
934 ad9389b_notify_monitor_detect(sd); ad9389b_update_monitor_present_status()
939 v4l2_dbg(1, debug, sd, "%s: hotplug not detected\n", __func__); ad9389b_update_monitor_present_status()
941 ad9389b_notify_monitor_detect(sd); ad9389b_update_monitor_present_status()
942 ad9389b_s_power(sd, false); ad9389b_update_monitor_present_status()
947 v4l2_ctrl_s_ctrl(state->hotplug_ctrl, ad9389b_have_hotplug(sd) ? 0x1 : 0x0); ad9389b_update_monitor_present_status()
948 v4l2_ctrl_s_ctrl(state->rx_sense_ctrl, ad9389b_have_rx_sense(sd) ? 0x1 : 0x0); ad9389b_update_monitor_present_status()
956 static void ad9389b_check_monitor_present_status(struct v4l2_subdev *sd) ad9389b_check_monitor_present_status() argument
958 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_check_monitor_present_status()
961 ad9389b_update_monitor_present_status(sd); ad9389b_check_monitor_present_status()
967 while (state->power_on && (ad9389b_rd(sd, 0x41) & 0x40)) { ad9389b_check_monitor_present_status()
969 v4l2_err(sd, "retried %d times, give up\n", retry); ad9389b_check_monitor_present_status()
972 v4l2_dbg(1, debug, sd, "%s: reset and re-check status (%d)\n", __func__, retry); ad9389b_check_monitor_present_status()
973 ad9389b_notify_monitor_detect(sd); ad9389b_check_monitor_present_status()
976 ad9389b_s_power(sd, false); ad9389b_check_monitor_present_status()
977 ad9389b_update_monitor_present_status(sd); ad9389b_check_monitor_present_status()
991 static bool edid_verify_crc(struct v4l2_subdev *sd, u32 segment) edid_verify_crc() argument
993 struct ad9389b_state *state = get_ad9389b_state(sd); edid_verify_crc()
1005 static bool edid_verify_header(struct v4l2_subdev *sd, u32 segment) edid_verify_header() argument
1010 struct ad9389b_state *state = get_ad9389b_state(sd); edid_verify_header()
1024 static bool ad9389b_check_edid_status(struct v4l2_subdev *sd) ad9389b_check_edid_status() argument
1026 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_check_edid_status()
1029 u8 edidRdy = ad9389b_rd(sd, 0xc5); ad9389b_check_edid_status()
1031 v4l2_dbg(1, debug, sd, "%s: edid ready (retries: %d)\n", ad9389b_check_edid_status()
1037 segment = ad9389b_rd(sd, 0xc4); ad9389b_check_edid_status()
1039 v4l2_err(sd, "edid segment number too big\n"); ad9389b_check_edid_status()
1042 v4l2_dbg(1, debug, sd, "%s: got segment %d\n", __func__, segment); ad9389b_check_edid_status()
1043 ad9389b_edid_rd(sd, 256, &state->edid.data[segment * 256]); ad9389b_check_edid_status()
1044 ad9389b_dbg_dump_edid(2, debug, sd, segment, ad9389b_check_edid_status()
1048 v4l2_dbg(1, debug, sd, "%s: %d blocks in total\n", ad9389b_check_edid_status()
1051 if (!edid_verify_crc(sd, segment) || ad9389b_check_edid_status()
1052 !edid_verify_header(sd, segment)) { ad9389b_check_edid_status()
1054 v4l2_err(sd, "%s: edid crc or header error\n", __func__); ad9389b_check_edid_status()
1055 ad9389b_s_power(sd, false); ad9389b_check_edid_status()
1056 ad9389b_s_power(sd, true); ad9389b_check_edid_status()
1063 v4l2_dbg(1, debug, sd, "%s: request segment %d\n", ad9389b_check_edid_status()
1065 ad9389b_wr(sd, 0xc9, 0xf); ad9389b_check_edid_status()
1066 ad9389b_wr(sd, 0xc4, state->edid.segments); ad9389b_check_edid_status()
1076 v4l2_subdev_notify(sd, AD9389B_EDID_DETECT, (void *)&ed); ad9389b_check_edid_status()
1084 static void ad9389b_init_setup(struct v4l2_subdev *sd) ad9389b_init_setup() argument
1086 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_init_setup()
1089 v4l2_dbg(1, debug, sd, "%s\n", __func__); ad9389b_init_setup()
1092 ad9389b_wr(sd, 0x96, 0xff); ad9389b_init_setup()
1096 ad9389b_set_isr(sd, false); ad9389b_init_setup()
1105 struct v4l2_subdev *sd; ad9389b_probe() local
1126 sd = &state->sd; ad9389b_probe()
1127 v4l2_i2c_subdev_init(sd, client, &ad9389b_ops); ad9389b_probe()
1128 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; ad9389b_probe()
1148 sd->ctrl_handler = hdl; ad9389b_probe()
1161 err = media_entity_init(&sd->entity, 1, &state->pad, 0); ad9389b_probe()
1165 state->chip_revision = ad9389b_rd(sd, 0x0); ad9389b_probe()
1167 v4l2_err(sd, "chip_revision %d != 2\n", state->chip_revision); ad9389b_probe()
1171 v4l2_dbg(1, debug, sd, "reg 0x41 0x%x, chip version (reg 0x00) 0x%x\n", ad9389b_probe()
1172 ad9389b_rd(sd, 0x41), state->chip_revision); ad9389b_probe()
1176 v4l2_err(sd, "failed to register edid i2c client\n"); ad9389b_probe()
1181 state->work_queue = create_singlethread_workqueue(sd->name); ad9389b_probe()
1183 v4l2_err(sd, "could not create workqueue\n"); ad9389b_probe()
1191 ad9389b_init_setup(sd); ad9389b_probe()
1192 ad9389b_set_isr(sd, true); ad9389b_probe()
1194 v4l2_info(sd, "%s found @ 0x%x (%s)\n", client->name, ad9389b_probe()
1201 media_entity_cleanup(&sd->entity); ad9389b_probe()
1211 struct v4l2_subdev *sd = i2c_get_clientdata(client); ad9389b_remove() local
1212 struct ad9389b_state *state = get_ad9389b_state(sd); ad9389b_remove()
1216 v4l2_dbg(1, debug, sd, "%s removed @ 0x%x (%s)\n", client->name, ad9389b_remove()
1219 ad9389b_s_stream(sd, false); ad9389b_remove()
1220 ad9389b_s_audio_stream(sd, false); ad9389b_remove()
1221 ad9389b_init_setup(sd); ad9389b_remove()
1225 v4l2_device_unregister_subdev(sd); ad9389b_remove()
1226 media_entity_cleanup(&sd->entity); ad9389b_remove()
1227 v4l2_ctrl_handler_free(sd->ctrl_handler); ad9389b_remove()
H A Dths7303.c36 struct v4l2_subdev sd; member in struct:ths7303_state
55 static inline struct ths7303_state *to_state(struct v4l2_subdev *sd) to_state() argument
57 return container_of(sd, struct ths7303_state, sd); to_state()
60 static int ths7303_read(struct v4l2_subdev *sd, u8 reg) ths7303_read() argument
62 struct i2c_client *client = v4l2_get_subdevdata(sd); ths7303_read()
67 static int ths7303_write(struct v4l2_subdev *sd, u8 reg, u8 val) ths7303_write() argument
69 struct i2c_client *client = v4l2_get_subdevdata(sd); ths7303_write()
82 static int ths7303_setval(struct v4l2_subdev *sd, ths7303_setval() argument
85 struct i2c_client *client = v4l2_get_subdevdata(sd); ths7303_setval()
86 struct ths7303_state *state = to_state(sd); ths7303_setval()
115 err = ths7303_write(sd, THS7303_CHANNEL_1, val); ths7303_setval()
122 err = ths7303_write(sd, THS7303_CHANNEL_2, val); ths7303_setval()
129 err = ths7303_write(sd, THS7303_CHANNEL_3, val); ths7303_setval()
139 static int ths7303_s_std_output(struct v4l2_subdev *sd, v4l2_std_id norm) ths7303_s_std_output() argument
141 struct ths7303_state *state = to_state(sd); ths7303_s_std_output()
146 return ths7303_setval(sd, THS7303_FILTER_MODE_480I_576I); ths7303_s_std_output()
149 return ths7303_setval(sd, THS7303_FILTER_MODE_DISABLE); ths7303_s_std_output()
152 static int ths7303_config(struct v4l2_subdev *sd) ths7303_config() argument
154 struct ths7303_state *state = to_state(sd); ths7303_config()
158 ths7303_write(sd, THS7303_CHANNEL_1, ths7303_config()
159 (ths7303_read(sd, THS7303_CHANNEL_1) & 0xf8) | ths7303_config()
161 ths7303_write(sd, THS7303_CHANNEL_2, ths7303_config()
162 (ths7303_read(sd, THS7303_CHANNEL_2) & 0xf8) | ths7303_config()
164 ths7303_write(sd, THS7303_CHANNEL_3, ths7303_config()
165 (ths7303_read(sd, THS7303_CHANNEL_3) & 0xf8) | ths7303_config()
171 res = ths7303_setval(sd, THS7303_FILTER_MODE_1080P); ths7303_config()
173 res = ths7303_setval(sd, THS7303_FILTER_MODE_720P_1080I); ths7303_config()
175 res = ths7303_setval(sd, THS7303_FILTER_MODE_480P_576P); ths7303_config()
177 res = ths7303_setval(sd, THS7303_FILTER_MODE_480I_576I); ths7303_config()
180 res = ths7303_setval(sd, THS7303_FILTER_MODE_DISABLE); ths7303_config()
186 static int ths7303_s_stream(struct v4l2_subdev *sd, int enable) ths7303_s_stream() argument
188 struct ths7303_state *state = to_state(sd); ths7303_s_stream()
192 return ths7303_config(sd); ths7303_s_stream()
196 static int ths7303_s_dv_timings(struct v4l2_subdev *sd, ths7303_s_dv_timings() argument
199 struct ths7303_state *state = to_state(sd); ths7303_s_dv_timings()
207 return ths7303_config(sd); ths7303_s_dv_timings()
218 static int ths7303_g_register(struct v4l2_subdev *sd, ths7303_g_register() argument
222 reg->val = ths7303_read(sd, reg->reg); ths7303_g_register()
226 static int ths7303_s_register(struct v4l2_subdev *sd, ths7303_s_register() argument
229 ths7303_write(sd, reg->reg, reg->val); ths7303_s_register()
264 static void ths7303_log_channel_status(struct v4l2_subdev *sd, u8 reg) ths7303_log_channel_status() argument
266 u8 val = ths7303_read(sd, reg); ths7303_log_channel_status()
269 v4l2_info(sd, "Channel %d Off\n", reg); ths7303_log_channel_status()
273 v4l2_info(sd, "Channel %d On\n", reg); ths7303_log_channel_status()
274 v4l2_info(sd, " value 0x%x\n", val); ths7303_log_channel_status()
275 v4l2_info(sd, " %s\n", stc_lpf_sel_txt[(val >> 6) & 0x3]); ths7303_log_channel_status()
276 v4l2_info(sd, " %s\n", in_mux_sel_txt[(val >> 5) & 0x1]); ths7303_log_channel_status()
277 v4l2_info(sd, " %s\n", lpf_freq_sel_txt[(val >> 3) & 0x3]); ths7303_log_channel_status()
278 v4l2_info(sd, " %s\n", in_bias_sel_dis_cont_txt[(val >> 0) & 0x7]); ths7303_log_channel_status()
281 static int ths7303_log_status(struct v4l2_subdev *sd) ths7303_log_status() argument
283 struct ths7303_state *state = to_state(sd); ths7303_log_status()
285 v4l2_info(sd, "stream %s\n", state->stream_on ? "On" : "Off"); ths7303_log_status()
293 v4l2_info(sd, ths7303_log_status()
302 v4l2_info(sd, "no timings set\n"); ths7303_log_status()
305 ths7303_log_channel_status(sd, THS7303_CHANNEL_1); ths7303_log_status()
306 ths7303_log_channel_status(sd, THS7303_CHANNEL_2); ths7303_log_status()
307 ths7303_log_channel_status(sd, THS7303_CHANNEL_3); ths7303_log_status()
330 struct v4l2_subdev *sd; ths7303_probe() local
349 sd = &state->sd; ths7303_probe()
350 v4l2_i2c_subdev_init(sd, client, &ths7303_ops); ths7303_probe()
353 if (ths7303_setval(sd, THS7303_FILTER_MODE_480I_576I) < 0) { ths7303_probe()
363 struct v4l2_subdev *sd = i2c_get_clientdata(client); ths7303_remove() local
365 v4l2_device_unregister_subdev(sd); ths7303_remove()
H A Dths8200.c41 struct v4l2_subdev sd; member in struct:ths8200_state
56 static inline struct ths8200_state *to_state(struct v4l2_subdev *sd) to_state() argument
58 return container_of(sd, struct ths8200_state, sd); to_state()
71 static int ths8200_read(struct v4l2_subdev *sd, u8 reg) ths8200_read() argument
73 struct i2c_client *client = v4l2_get_subdevdata(sd); ths8200_read()
78 static int ths8200_write(struct v4l2_subdev *sd, u8 reg, u8 val) ths8200_write() argument
80 struct i2c_client *client = v4l2_get_subdevdata(sd); ths8200_write()
89 v4l2_err(sd, "I2C Write Problem\n"); ths8200_write()
97 ths8200_write_and_or(struct v4l2_subdev *sd, u8 reg, ths8200_write_and_or() argument
100 ths8200_write(sd, reg, (ths8200_read(sd, reg) & clr_mask) | val_mask); ths8200_write_and_or()
105 static int ths8200_g_register(struct v4l2_subdev *sd, ths8200_g_register() argument
108 reg->val = ths8200_read(sd, reg->reg & 0xff); ths8200_g_register()
114 static int ths8200_s_register(struct v4l2_subdev *sd, ths8200_s_register() argument
117 ths8200_write(sd, reg->reg & 0xff, reg->val & 0xff); ths8200_s_register()
123 static int ths8200_log_status(struct v4l2_subdev *sd) ths8200_log_status() argument
125 struct ths8200_state *state = to_state(sd); ths8200_log_status()
126 uint8_t reg_03 = ths8200_read(sd, THS8200_CHIP_CTL); ths8200_log_status()
128 v4l2_info(sd, "----- Chip status -----\n"); ths8200_log_status()
129 v4l2_info(sd, "version: %u\n", state->chip_version); ths8200_log_status()
130 v4l2_info(sd, "power: %s\n", (reg_03 & 0x0c) ? "off" : "on"); ths8200_log_status()
131 v4l2_info(sd, "reset: %s\n", (reg_03 & 0x01) ? "off" : "on"); ths8200_log_status()
132 v4l2_info(sd, "test pattern: %s\n", ths8200_log_status()
134 v4l2_info(sd, "format: %ux%u\n", ths8200_log_status()
135 ths8200_read(sd, THS8200_DTG2_PIXEL_CNT_MSB) * 256 + ths8200_log_status()
136 ths8200_read(sd, THS8200_DTG2_PIXEL_CNT_LSB), ths8200_log_status()
137 (ths8200_read(sd, THS8200_DTG2_LINE_CNT_MSB) & 0x07) * 256 + ths8200_log_status()
138 ths8200_read(sd, THS8200_DTG2_LINE_CNT_LSB)); ths8200_log_status()
139 v4l2_print_dv_timings(sd->name, "Configured format:", ths8200_log_status()
145 static int ths8200_s_power(struct v4l2_subdev *sd, int on) ths8200_s_power() argument
147 struct ths8200_state *state = to_state(sd); ths8200_s_power()
149 v4l2_dbg(1, debug, sd, "%s: power %s\n", __func__, on ? "on" : "off"); ths8200_s_power()
154 ths8200_write_and_or(sd, THS8200_CHIP_CTL, 0xf2, (on ? 0x00 : 0x0c)); ths8200_s_power()
172 static int ths8200_s_stream(struct v4l2_subdev *sd, int enable) ths8200_s_stream() argument
174 struct ths8200_state *state = to_state(sd); ths8200_s_stream()
177 ths8200_s_power(sd, true); ths8200_s_stream()
179 ths8200_write_and_or(sd, THS8200_CHIP_CTL, 0xfe, ths8200_s_stream()
182 v4l2_dbg(1, debug, sd, "%s: %sable\n", ths8200_s_stream()
188 static void ths8200_core_init(struct v4l2_subdev *sd) ths8200_core_init() argument
191 ths8200_write_and_or(sd, THS8200_CHIP_CTL, 0x3f, 0xc0); ths8200_core_init()
198 ths8200_write(sd, THS8200_DATA_CNTL, 0x70); ths8200_core_init()
203 ths8200_write(sd, THS8200_DTG1_MODE, 0x87); ths8200_core_init()
210 ths8200_write(sd, THS8200_DTG1_Y_SYNC_MSB, 0x00); ths8200_core_init()
211 ths8200_write(sd, THS8200_DTG1_CBCR_SYNC_MSB, 0x00); ths8200_core_init()
214 static void ths8200_setup(struct v4l2_subdev *sd, struct v4l2_bt_timings *bt) ths8200_setup() argument
222 ths8200_s_stream(sd, false); ths8200_setup()
225 ths8200_write(sd, THS8200_DTG1_SPEC_A, bt->hsync); ths8200_setup()
226 ths8200_write(sd, THS8200_DTG1_SPEC_B, bt->hfrontporch); ths8200_setup()
230 ths8200_write(sd, THS8200_DTG1_SPEC_C, 0x00); ths8200_setup()
235 ths8200_write(sd, THS8200_DTG1_SPEC_D_LSB, ths8200_setup()
238 ths8200_write(sd, THS8200_DTG1_SPEC_E_LSB, 0x00); ths8200_setup()
243 ths8200_write(sd, THS8200_DTG1_SPEC_DEH_MSB, ths8200_setup()
247 ths8200_write(sd, THS8200_DTG1_SPEC_K_LSB, (bt->hfrontporch) & 0xff); ths8200_setup()
248 ths8200_write(sd, THS8200_DTG1_SPEC_K_MSB, ths8200_setup()
252 ths8200_write(sd, THS8200_DTG1_SPEC_G_LSB, (htotal(bt)/2) & 0xff); ths8200_setup()
253 ths8200_write(sd, THS8200_DTG1_SPEC_G_MSB, ths8200_setup()
257 ths8200_write(sd, THS8200_DTG1_TOT_PIXELS_MSB, htotal(bt) >> 8); ths8200_setup()
258 ths8200_write(sd, THS8200_DTG1_TOT_PIXELS_LSB, htotal(bt) & 0xff); ths8200_setup()
264 ths8200_write(sd, THS8200_DTG1_FRAME_FIELD_SZ_MSB, ths8200_setup()
266 ths8200_write(sd, THS8200_DTG1_FRAME_SZ_LSB, vtotal(bt) & 0xff); ths8200_setup()
272 ths8200_write(sd, THS8200_DTG1_FIELD_SZ_LSB, 0xff); ths8200_setup()
289 ths8200_write_and_or(sd, THS8200_DTG2_BP1_2_MSB, 0x88, ths8200_setup()
292 ths8200_write(sd, THS8200_DTG2_BP3_4_MSB, ((vtotal(bt)) >> 4) & 0x70); ths8200_setup()
293 ths8200_write(sd, THS8200_DTG2_BP1_LSB, line_start_active_video & 0xff); ths8200_setup()
294 ths8200_write(sd, THS8200_DTG2_BP2_LSB, line_start_front_porch & 0xff); ths8200_setup()
295 ths8200_write(sd, THS8200_DTG2_BP3_LSB, (vtotal(bt)) & 0xff); ths8200_setup()
298 ths8200_write(sd, THS8200_DTG2_LINETYPE1, 0x90); ths8200_setup()
299 ths8200_write(sd, THS8200_DTG2_LINETYPE2, 0x90); ths8200_setup()
302 ths8200_write(sd, THS8200_DTG2_HLENGTH_LSB, bt->hsync & 0xff); ths8200_setup()
303 ths8200_write_and_or(sd, THS8200_DTG2_HLENGTH_LSB_HDLY_MSB, 0x3f, ths8200_setup()
307 ths8200_write_and_or(sd, THS8200_DTG2_HLENGTH_LSB_HDLY_MSB, 0xe0, ths8200_setup()
309 ths8200_write(sd, THS8200_DTG2_HLENGTH_HDLY_LSB, htotal(bt)); ths8200_setup()
312 ths8200_write(sd, THS8200_DTG2_VLENGTH1_LSB, (bt->vsync + 1) & 0xff); ths8200_setup()
313 ths8200_write_and_or(sd, THS8200_DTG2_VLENGTH1_MSB_VDLY1_MSB, 0x3f, ths8200_setup()
317 ths8200_write_and_or(sd, THS8200_DTG2_VLENGTH1_MSB_VDLY1_MSB, 0xf8, ths8200_setup()
319 ths8200_write(sd, THS8200_DTG2_VDLY1_LSB, vtotal(bt) + 1); ths8200_setup()
324 ths8200_write(sd, THS8200_DTG2_VLENGTH2_LSB, 0x00); ths8200_setup()
325 ths8200_write(sd, THS8200_DTG2_VLENGTH2_MSB_VDLY2_MSB, 0x07); ths8200_setup()
326 ths8200_write(sd, THS8200_DTG2_VDLY2_LSB, 0xff); ths8200_setup()
330 ths8200_write(sd, THS8200_DTG2_HS_IN_DLY_MSB, 0); ths8200_setup()
331 ths8200_write(sd, THS8200_DTG2_HS_IN_DLY_LSB, 0); ths8200_setup()
332 ths8200_write(sd, THS8200_DTG2_VS_IN_DLY_MSB, 0); ths8200_setup()
333 ths8200_write(sd, THS8200_DTG2_VS_IN_DLY_LSB, 0); ths8200_setup()
349 ths8200_write(sd, THS8200_DTG2_CNTL, 0x44 | polarity); ths8200_setup()
352 ths8200_s_stream(sd, true); ths8200_setup()
354 v4l2_dbg(1, debug, sd, "%s: frame %dx%d, polarity %d\n" ths8200_setup()
361 static int ths8200_s_dv_timings(struct v4l2_subdev *sd, ths8200_s_dv_timings() argument
364 struct ths8200_state *state = to_state(sd); ths8200_s_dv_timings()
366 v4l2_dbg(1, debug, sd, "%s:\n", __func__); ths8200_s_dv_timings()
374 v4l2_dbg(1, debug, sd, "Unsupported format\n"); ths8200_s_dv_timings()
383 ths8200_setup(sd, &timings->bt); ths8200_s_dv_timings()
388 static int ths8200_g_dv_timings(struct v4l2_subdev *sd, ths8200_g_dv_timings() argument
391 struct ths8200_state *state = to_state(sd); ths8200_g_dv_timings()
393 v4l2_dbg(1, debug, sd, "%s:\n", __func__); ths8200_g_dv_timings()
400 static int ths8200_enum_dv_timings(struct v4l2_subdev *sd, ths8200_enum_dv_timings() argument
410 static int ths8200_dv_timings_cap(struct v4l2_subdev *sd, ths8200_dv_timings_cap() argument
443 struct v4l2_subdev *sd; ths8200_probe() local
454 sd = &state->sd; ths8200_probe()
455 v4l2_i2c_subdev_init(sd, client, &ths8200_ops); ths8200_probe()
457 state->chip_version = ths8200_read(sd, THS8200_VERSION); ths8200_probe()
458 v4l2_dbg(1, debug, sd, "chip version 0x%x\n", state->chip_version); ths8200_probe()
460 ths8200_core_init(sd); ths8200_probe()
462 error = v4l2_async_register_subdev(&state->sd); ths8200_probe()
466 v4l2_info(sd, "%s found @ 0x%x (%s)\n", client->name, ths8200_probe()
474 struct v4l2_subdev *sd = i2c_get_clientdata(client); ths8200_remove() local
475 struct ths8200_state *decoder = to_state(sd); ths8200_remove()
477 v4l2_dbg(1, debug, sd, "%s removed @ 0x%x (%s)\n", client->name, ths8200_remove()
480 ths8200_s_power(sd, false); ths8200_remove()
481 v4l2_async_unregister_subdev(&decoder->sd); ths8200_remove()
H A Dadv7175.c51 struct v4l2_subdev sd; member in struct:adv7175
56 static inline struct adv7175 *to_adv7175(struct v4l2_subdev *sd) to_adv7175() argument
58 return container_of(sd, struct adv7175, sd); to_adv7175()
70 static inline int adv7175_write(struct v4l2_subdev *sd, u8 reg, u8 value) adv7175_write() argument
72 struct i2c_client *client = v4l2_get_subdevdata(sd); adv7175_write()
77 static inline int adv7175_read(struct v4l2_subdev *sd, u8 reg) adv7175_read() argument
79 struct i2c_client *client = v4l2_get_subdevdata(sd); adv7175_read()
84 static int adv7175_write_block(struct v4l2_subdev *sd, adv7175_write_block() argument
87 struct i2c_client *client = v4l2_get_subdevdata(sd); adv7175_write_block()
115 ret = adv7175_write(sd, reg, *data++); adv7175_write_block()
125 static void set_subcarrier_freq(struct v4l2_subdev *sd, int pass_through) set_subcarrier_freq() argument
130 adv7175_write(sd, 0x02, 0x00); set_subcarrier_freq()
132 adv7175_write(sd, 0x02, 0x55); set_subcarrier_freq()
134 adv7175_write(sd, 0x03, 0x55); set_subcarrier_freq()
135 adv7175_write(sd, 0x04, 0x55); set_subcarrier_freq()
136 adv7175_write(sd, 0x05, 0x25); set_subcarrier_freq()
196 static int adv7175_init(struct v4l2_subdev *sd, u32 val) adv7175_init() argument
199 adv7175_write_block(sd, init_common, sizeof(init_common)); adv7175_init()
200 adv7175_write(sd, 0x07, TR0MODE | TR0RST); adv7175_init()
201 adv7175_write(sd, 0x07, TR0MODE); adv7175_init()
205 static int adv7175_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) adv7175_s_std_output() argument
207 struct adv7175 *encoder = to_adv7175(sd); adv7175_s_std_output()
210 adv7175_write_block(sd, init_ntsc, sizeof(init_ntsc)); adv7175_s_std_output()
212 adv7175_write(sd, 0x0d, 0x4f); /* Enable genlock */ adv7175_s_std_output()
213 adv7175_write(sd, 0x07, TR0MODE | TR0RST); adv7175_s_std_output()
214 adv7175_write(sd, 0x07, TR0MODE); adv7175_s_std_output()
216 adv7175_write_block(sd, init_pal, sizeof(init_pal)); adv7175_s_std_output()
218 adv7175_write(sd, 0x0d, 0x4f); /* Enable genlock */ adv7175_s_std_output()
219 adv7175_write(sd, 0x07, TR0MODE | TR0RST); adv7175_s_std_output()
220 adv7175_write(sd, 0x07, TR0MODE); adv7175_s_std_output()
228 adv7175_write_block(sd, init_pal, sizeof(init_pal)); adv7175_s_std_output()
230 adv7175_write(sd, 0x0d, 0x49); /* Disable genlock */ adv7175_s_std_output()
231 adv7175_write(sd, 0x07, TR0MODE | TR0RST); adv7175_s_std_output()
232 adv7175_write(sd, 0x07, TR0MODE); adv7175_s_std_output()
234 v4l2_dbg(1, debug, sd, "illegal norm: %llx\n", adv7175_s_std_output()
238 v4l2_dbg(1, debug, sd, "switched to %llx\n", (unsigned long long)std); adv7175_s_std_output()
243 static int adv7175_s_routing(struct v4l2_subdev *sd, adv7175_s_routing() argument
246 struct adv7175 *encoder = to_adv7175(sd); adv7175_s_routing()
254 adv7175_write(sd, 0x01, 0x00); adv7175_s_routing()
257 set_subcarrier_freq(sd, 1); adv7175_s_routing()
259 adv7175_write(sd, 0x0c, TR1CAPT); /* TR1 */ adv7175_s_routing()
261 adv7175_write(sd, 0x0d, 0x49); /* Disable genlock */ adv7175_s_routing()
263 adv7175_write(sd, 0x0d, 0x4f); /* Enable genlock */ adv7175_s_routing()
264 adv7175_write(sd, 0x07, TR0MODE | TR0RST); adv7175_s_routing()
265 adv7175_write(sd, 0x07, TR0MODE); adv7175_s_routing()
270 adv7175_write(sd, 0x01, 0x00); adv7175_s_routing()
273 set_subcarrier_freq(sd, 0); adv7175_s_routing()
275 adv7175_write(sd, 0x0c, TR1PLAY); /* TR1 */ adv7175_s_routing()
276 adv7175_write(sd, 0x0d, 0x49); adv7175_s_routing()
277 adv7175_write(sd, 0x07, TR0MODE | TR0RST); adv7175_s_routing()
278 adv7175_write(sd, 0x07, TR0MODE); adv7175_s_routing()
283 adv7175_write(sd, 0x01, 0x80); adv7175_s_routing()
286 set_subcarrier_freq(sd, 0); adv7175_s_routing()
288 adv7175_write(sd, 0x0d, 0x49); adv7175_s_routing()
289 adv7175_write(sd, 0x07, TR0MODE | TR0RST); adv7175_s_routing()
290 adv7175_write(sd, 0x07, TR0MODE); adv7175_s_routing()
295 v4l2_dbg(1, debug, sd, "illegal input: %d\n", input); adv7175_s_routing()
298 v4l2_dbg(1, debug, sd, "switched to %s\n", inputs[input]); adv7175_s_routing()
303 static int adv7175_enum_fmt(struct v4l2_subdev *sd, unsigned int index, adv7175_enum_fmt() argument
313 static int adv7175_g_fmt(struct v4l2_subdev *sd, adv7175_g_fmt() argument
316 u8 val = adv7175_read(sd, 0x7); adv7175_g_fmt()
331 static int adv7175_s_fmt(struct v4l2_subdev *sd, adv7175_s_fmt() argument
334 u8 val = adv7175_read(sd, 0x7); adv7175_s_fmt()
347 v4l2_dbg(1, debug, sd, adv7175_s_fmt()
352 ret = adv7175_write(sd, 0x7, val); adv7175_s_fmt()
357 static int adv7175_s_power(struct v4l2_subdev *sd, int on) adv7175_s_power() argument
360 adv7175_write(sd, 0x01, 0x00); adv7175_s_power()
362 adv7175_write(sd, 0x01, 0x78); adv7175_s_power()
394 struct v4l2_subdev *sd; adv7175_probe() local
406 sd = &encoder->sd; adv7175_probe()
407 v4l2_i2c_subdev_init(sd, client, &adv7175_ops); adv7175_probe()
411 i = adv7175_write_block(sd, init_common, sizeof(init_common)); adv7175_probe()
413 i = adv7175_write(sd, 0x07, TR0MODE | TR0RST); adv7175_probe()
414 i = adv7175_write(sd, 0x07, TR0MODE); adv7175_probe()
415 i = adv7175_read(sd, 0x12); adv7175_probe()
416 v4l2_dbg(1, debug, sd, "revision %d\n", i & 1); adv7175_probe()
419 v4l2_dbg(1, debug, sd, "init error 0x%x\n", i); adv7175_probe()
425 struct v4l2_subdev *sd = i2c_get_clientdata(client); adv7175_remove() local
427 v4l2_device_unregister_subdev(sd); adv7175_remove()
H A Dsaa7110.c55 struct v4l2_subdev sd; member in struct:saa7110
66 static inline struct saa7110 *to_saa7110(struct v4l2_subdev *sd) to_saa7110() argument
68 return container_of(sd, struct saa7110, sd); to_saa7110()
73 return &container_of(ctrl->handler, struct saa7110, hdl)->sd; to_sd()
80 static int saa7110_write(struct v4l2_subdev *sd, u8 reg, u8 value) saa7110_write() argument
82 struct i2c_client *client = v4l2_get_subdevdata(sd); saa7110_write()
83 struct saa7110 *decoder = to_saa7110(sd); saa7110_write()
89 static int saa7110_write_block(struct v4l2_subdev *sd, const u8 *data, unsigned int len) saa7110_write_block() argument
91 struct i2c_client *client = v4l2_get_subdevdata(sd); saa7110_write_block()
92 struct saa7110 *decoder = to_saa7110(sd); saa7110_write_block()
109 ret = saa7110_write(sd, reg++, *data++); saa7110_write_block()
118 static inline int saa7110_read(struct v4l2_subdev *sd) saa7110_read() argument
120 struct i2c_client *client = v4l2_get_subdevdata(sd); saa7110_read()
133 static int saa7110_selmux(struct v4l2_subdev *sd, int chan) saa7110_selmux() argument
164 struct saa7110 *decoder = to_saa7110(sd); saa7110_selmux()
167 saa7110_write(sd, 0x06, ptr[0]); /* Luminance control */ saa7110_selmux()
168 saa7110_write(sd, 0x20, ptr[1]); /* Analog Control #1 */ saa7110_selmux()
169 saa7110_write(sd, 0x21, ptr[2]); /* Analog Control #2 */ saa7110_selmux()
170 saa7110_write(sd, 0x22, ptr[3]); /* Mixer Control #1 */ saa7110_selmux()
171 saa7110_write(sd, 0x2C, ptr[4]); /* Mixer Control #2 */ saa7110_selmux()
172 saa7110_write(sd, 0x30, ptr[5]); /* ADCs gain control */ saa7110_selmux()
173 saa7110_write(sd, 0x31, ptr[6]); /* Mixer Control #3 */ saa7110_selmux()
174 saa7110_write(sd, 0x21, ptr[7]); /* Analog Control #2 */ saa7110_selmux()
190 static v4l2_std_id determine_norm(struct v4l2_subdev *sd) determine_norm() argument
193 struct saa7110 *decoder = to_saa7110(sd); determine_norm()
197 saa7110_write_block(sd, initseq, sizeof(initseq)); determine_norm()
198 saa7110_selmux(sd, decoder->input); determine_norm()
202 status = saa7110_read(sd); determine_norm()
204 v4l2_dbg(1, debug, sd, "status=0x%02x (no signal)\n", status); determine_norm()
208 saa7110_write(sd, 0x06, 0x83); determine_norm()
210 v4l2_dbg(1, debug, sd, "status=0x%02x (NTSC/no color)\n", status); determine_norm()
211 /*saa7110_write(sd,0x2E,0x81);*/ determine_norm()
214 v4l2_dbg(1, debug, sd, "status=0x%02x (PAL/no color)\n", status); determine_norm()
215 /*saa7110_write(sd,0x2E,0x9A);*/ determine_norm()
218 /*saa7110_write(sd,0x06,0x03);*/ determine_norm()
220 v4l2_dbg(1, debug, sd, "status=0x%02x (NTSC)\n", status); determine_norm()
221 saa7110_write(sd, 0x0D, 0x86); determine_norm()
222 saa7110_write(sd, 0x0F, 0x50); determine_norm()
223 saa7110_write(sd, 0x11, 0x2C); determine_norm()
224 /*saa7110_write(sd,0x2E,0x81);*/ determine_norm()
229 saa7110_write(sd, 0x0D, 0x86); determine_norm()
230 saa7110_write(sd, 0x0F, 0x10); determine_norm()
231 saa7110_write(sd, 0x11, 0x59); determine_norm()
232 /*saa7110_write(sd,0x2E,0x9A);*/ determine_norm()
238 status = saa7110_read(sd); determine_norm()
240 v4l2_dbg(1, debug, sd, "status=0x%02x (SECAM)\n", status); determine_norm()
241 saa7110_write(sd, 0x0D, 0x87); determine_norm()
244 v4l2_dbg(1, debug, sd, "status=0x%02x (PAL)\n", status); determine_norm()
248 static int saa7110_g_input_status(struct v4l2_subdev *sd, u32 *pstatus) saa7110_g_input_status() argument
250 struct saa7110 *decoder = to_saa7110(sd); saa7110_g_input_status()
252 int status = saa7110_read(sd); saa7110_g_input_status()
254 v4l2_dbg(1, debug, sd, "status=0x%02x norm=%llx\n", saa7110_g_input_status()
265 static int saa7110_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) saa7110_querystd() argument
267 *std &= determine_norm(sd); saa7110_querystd()
271 static int saa7110_s_std(struct v4l2_subdev *sd, v4l2_std_id std) saa7110_s_std() argument
273 struct saa7110 *decoder = to_saa7110(sd); saa7110_s_std()
277 /*saa7110_write(sd, 0x06, 0x03);*/ saa7110_s_std()
279 saa7110_write(sd, 0x0D, 0x86); saa7110_s_std()
280 saa7110_write(sd, 0x0F, 0x50); saa7110_s_std()
281 saa7110_write(sd, 0x11, 0x2C); saa7110_s_std()
282 /*saa7110_write(sd, 0x2E, 0x81);*/ saa7110_s_std()
283 v4l2_dbg(1, debug, sd, "switched to NTSC\n"); saa7110_s_std()
285 saa7110_write(sd, 0x0D, 0x86); saa7110_s_std()
286 saa7110_write(sd, 0x0F, 0x10); saa7110_s_std()
287 saa7110_write(sd, 0x11, 0x59); saa7110_s_std()
288 /*saa7110_write(sd, 0x2E, 0x9A);*/ saa7110_s_std()
289 v4l2_dbg(1, debug, sd, "switched to PAL\n"); saa7110_s_std()
291 saa7110_write(sd, 0x0D, 0x87); saa7110_s_std()
292 saa7110_write(sd, 0x0F, 0x10); saa7110_s_std()
293 saa7110_write(sd, 0x11, 0x59); saa7110_s_std()
294 /*saa7110_write(sd, 0x2E, 0x9A);*/ saa7110_s_std()
295 v4l2_dbg(1, debug, sd, "switched to SECAM\n"); saa7110_s_std()
303 static int saa7110_s_routing(struct v4l2_subdev *sd, saa7110_s_routing() argument
306 struct saa7110 *decoder = to_saa7110(sd); saa7110_s_routing()
309 v4l2_dbg(1, debug, sd, "input=%d not available\n", input); saa7110_s_routing()
313 saa7110_selmux(sd, input); saa7110_s_routing()
314 v4l2_dbg(1, debug, sd, "switched to input=%d\n", input); saa7110_s_routing()
319 static int saa7110_s_stream(struct v4l2_subdev *sd, int enable) saa7110_s_stream() argument
321 struct saa7110 *decoder = to_saa7110(sd); saa7110_s_stream()
325 saa7110_write(sd, 0x0E, enable ? 0x18 : 0x80); saa7110_s_stream()
326 v4l2_dbg(1, debug, sd, "YUV %s\n", enable ? "on" : "off"); saa7110_s_stream()
333 struct v4l2_subdev *sd = to_sd(ctrl); saa7110_s_ctrl() local
337 saa7110_write(sd, 0x19, ctrl->val); saa7110_s_ctrl()
340 saa7110_write(sd, 0x13, ctrl->val); saa7110_s_ctrl()
343 saa7110_write(sd, 0x12, ctrl->val); saa7110_s_ctrl()
346 saa7110_write(sd, 0x07, ctrl->val); saa7110_s_ctrl()
389 struct v4l2_subdev *sd; saa7110_probe() local
403 sd = &decoder->sd; saa7110_probe()
404 v4l2_i2c_subdev_init(sd, client, &saa7110_ops); saa7110_probe()
417 sd->ctrl_handler = &decoder->hdl; saa7110_probe()
428 rv = saa7110_write_block(sd, initseq, sizeof(initseq)); saa7110_probe()
430 v4l2_dbg(1, debug, sd, "init status %d\n", rv); saa7110_probe()
433 saa7110_write(sd, 0x21, 0x10); saa7110_probe()
434 saa7110_write(sd, 0x0e, 0x18); saa7110_probe()
435 saa7110_write(sd, 0x0D, 0x04); saa7110_probe()
436 ver = saa7110_read(sd); saa7110_probe()
437 saa7110_write(sd, 0x0D, 0x06); saa7110_probe()
439 status = saa7110_read(sd); saa7110_probe()
440 v4l2_dbg(1, debug, sd, "version %x, status=0x%02x\n", saa7110_probe()
442 saa7110_write(sd, 0x0D, 0x86); saa7110_probe()
443 saa7110_write(sd, 0x0F, 0x10); saa7110_probe()
444 saa7110_write(sd, 0x11, 0x59); saa7110_probe()
445 /*saa7110_write(sd, 0x2E, 0x9A);*/ saa7110_probe()
448 /*saa7110_selmux(sd,0);*/ saa7110_probe()
449 /*determine_norm(sd);*/ saa7110_probe()
457 struct v4l2_subdev *sd = i2c_get_clientdata(client); saa7110_remove() local
458 struct saa7110 *decoder = to_saa7110(sd); saa7110_remove()
460 v4l2_device_unregister_subdev(sd); saa7110_remove()
H A Dadv7511.c88 struct v4l2_subdev sd; member in struct:adv7511_state
118 static void adv7511_check_monitor_present_status(struct v4l2_subdev *sd);
119 static bool adv7511_check_edid_status(struct v4l2_subdev *sd);
120 static void adv7511_setup(struct v4l2_subdev *sd);
121 static int adv7511_s_i2s_clock_freq(struct v4l2_subdev *sd, u32 freq);
122 static int adv7511_s_clock_freq(struct v4l2_subdev *sd, u32 freq);
137 static inline struct adv7511_state *get_adv7511_state(struct v4l2_subdev *sd) get_adv7511_state() argument
139 return container_of(sd, struct adv7511_state, sd); get_adv7511_state()
144 return &container_of(ctrl->handler, struct adv7511_state, hdl)->sd; to_sd()
179 static int adv7511_rd(struct v4l2_subdev *sd, u8 reg) adv7511_rd() argument
181 struct i2c_client *client = v4l2_get_subdevdata(sd); adv7511_rd()
186 static int adv7511_wr(struct v4l2_subdev *sd, u8 reg, u8 val) adv7511_wr() argument
188 struct i2c_client *client = v4l2_get_subdevdata(sd); adv7511_wr()
197 v4l2_err(sd, "%s: i2c write error\n", __func__); adv7511_wr()
203 static inline void adv7511_wr_and_or(struct v4l2_subdev *sd, u8 reg, uint8_t clr_mask, uint8_t val_mask) adv7511_wr_and_or() argument
205 adv7511_wr(sd, reg, (adv7511_rd(sd, reg) & clr_mask) | val_mask); adv7511_wr_and_or()
225 static inline void adv7511_edid_rd(struct v4l2_subdev *sd, uint16_t len, uint8_t *buf) adv7511_edid_rd() argument
227 struct adv7511_state *state = get_adv7511_state(sd); adv7511_edid_rd()
231 v4l2_dbg(1, debug, sd, "%s:\n", __func__); adv7511_edid_rd()
237 v4l2_err(sd, "%s: i2c read error\n", __func__); adv7511_edid_rd()
240 static inline bool adv7511_have_hotplug(struct v4l2_subdev *sd) adv7511_have_hotplug() argument
242 return adv7511_rd(sd, 0x42) & MASK_ADV7511_HPD_DETECT; adv7511_have_hotplug()
245 static inline bool adv7511_have_rx_sense(struct v4l2_subdev *sd) adv7511_have_rx_sense() argument
247 return adv7511_rd(sd, 0x42) & MASK_ADV7511_MSEN_DETECT; adv7511_have_rx_sense()
250 static void adv7511_csc_conversion_mode(struct v4l2_subdev *sd, uint8_t mode) adv7511_csc_conversion_mode() argument
252 adv7511_wr_and_or(sd, 0x18, 0x9f, (mode & 0x3)<<5); adv7511_csc_conversion_mode()
255 static void adv7511_csc_coeff(struct v4l2_subdev *sd, adv7511_csc_coeff() argument
261 adv7511_wr_and_or(sd, 0x18, 0xe0, A1>>8); adv7511_csc_coeff()
262 adv7511_wr(sd, 0x19, A1); adv7511_csc_coeff()
263 adv7511_wr_and_or(sd, 0x1A, 0xe0, A2>>8); adv7511_csc_coeff()
264 adv7511_wr(sd, 0x1B, A2); adv7511_csc_coeff()
265 adv7511_wr_and_or(sd, 0x1c, 0xe0, A3>>8); adv7511_csc_coeff()
266 adv7511_wr(sd, 0x1d, A3); adv7511_csc_coeff()
267 adv7511_wr_and_or(sd, 0x1e, 0xe0, A4>>8); adv7511_csc_coeff()
268 adv7511_wr(sd, 0x1f, A4); adv7511_csc_coeff()
271 adv7511_wr_and_or(sd, 0x20, 0xe0, B1>>8); adv7511_csc_coeff()
272 adv7511_wr(sd, 0x21, B1); adv7511_csc_coeff()
273 adv7511_wr_and_or(sd, 0x22, 0xe0, B2>>8); adv7511_csc_coeff()
274 adv7511_wr(sd, 0x23, B2); adv7511_csc_coeff()
275 adv7511_wr_and_or(sd, 0x24, 0xe0, B3>>8); adv7511_csc_coeff()
276 adv7511_wr(sd, 0x25, B3); adv7511_csc_coeff()
277 adv7511_wr_and_or(sd, 0x26, 0xe0, B4>>8); adv7511_csc_coeff()
278 adv7511_wr(sd, 0x27, B4); adv7511_csc_coeff()
281 adv7511_wr_and_or(sd, 0x28, 0xe0, C1>>8); adv7511_csc_coeff()
282 adv7511_wr(sd, 0x29, C1); adv7511_csc_coeff()
283 adv7511_wr_and_or(sd, 0x2A, 0xe0, C2>>8); adv7511_csc_coeff()
284 adv7511_wr(sd, 0x2B, C2); adv7511_csc_coeff()
285 adv7511_wr_and_or(sd, 0x2C, 0xe0, C3>>8); adv7511_csc_coeff()
286 adv7511_wr(sd, 0x2D, C3); adv7511_csc_coeff()
287 adv7511_wr_and_or(sd, 0x2E, 0xe0, C4>>8); adv7511_csc_coeff()
288 adv7511_wr(sd, 0x2F, C4); adv7511_csc_coeff()
291 static void adv7511_csc_rgb_full2limit(struct v4l2_subdev *sd, bool enable) adv7511_csc_rgb_full2limit() argument
295 adv7511_csc_conversion_mode(sd, csc_mode); adv7511_csc_rgb_full2limit()
296 adv7511_csc_coeff(sd, adv7511_csc_rgb_full2limit()
301 adv7511_wr_and_or(sd, 0x18, 0x7f, 0x80); adv7511_csc_rgb_full2limit()
303 adv7511_wr_and_or(sd, 0x57, 0xf3, 0x04); adv7511_csc_rgb_full2limit()
306 adv7511_wr_and_or(sd, 0x18, 0x7f, 0x0); adv7511_csc_rgb_full2limit()
308 adv7511_wr_and_or(sd, 0x57, 0xf3, 0x08); adv7511_csc_rgb_full2limit()
312 static void adv7511_set_IT_content_AVI_InfoFrame(struct v4l2_subdev *sd) adv7511_set_IT_content_AVI_InfoFrame() argument
314 struct adv7511_state *state = get_adv7511_state(sd); adv7511_set_IT_content_AVI_InfoFrame()
317 adv7511_wr_and_or(sd, 0x57, 0x7f, 0x00); adv7511_set_IT_content_AVI_InfoFrame()
320 adv7511_wr_and_or(sd, 0x57, 0x7f, 0x80); adv7511_set_IT_content_AVI_InfoFrame()
324 static int adv7511_set_rgb_quantization_mode(struct v4l2_subdev *sd, struct v4l2_ctrl *ctrl) adv7511_set_rgb_quantization_mode() argument
332 struct adv7511_state *state = get_adv7511_state(sd); adv7511_set_rgb_quantization_mode()
336 adv7511_csc_rgb_full2limit(sd, true); adv7511_set_rgb_quantization_mode()
339 adv7511_csc_rgb_full2limit(sd, false); adv7511_set_rgb_quantization_mode()
345 adv7511_csc_rgb_full2limit(sd, true); adv7511_set_rgb_quantization_mode()
349 adv7511_csc_rgb_full2limit(sd, false); adv7511_set_rgb_quantization_mode()
359 struct v4l2_subdev *sd = to_sd(ctrl); adv7511_s_ctrl() local
360 struct adv7511_state *state = get_adv7511_state(sd); adv7511_s_ctrl()
362 v4l2_dbg(1, debug, sd, "%s: ctrl id: %d, ctrl->val %d\n", __func__, ctrl->id, ctrl->val); adv7511_s_ctrl()
366 adv7511_wr_and_or(sd, 0xaf, 0xfd, ctrl->val == V4L2_DV_TX_MODE_HDMI ? 0x02 : 0x00); adv7511_s_ctrl()
370 return adv7511_set_rgb_quantization_mode(sd, ctrl); adv7511_s_ctrl()
382 static void adv7511_inv_register(struct v4l2_subdev *sd) adv7511_inv_register() argument
384 v4l2_info(sd, "0x000-0x0ff: Main Map\n"); adv7511_inv_register()
387 static int adv7511_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) adv7511_g_register() argument
392 reg->val = adv7511_rd(sd, reg->reg & 0xff); adv7511_g_register()
395 v4l2_info(sd, "Register %03llx not supported\n", reg->reg); adv7511_g_register()
396 adv7511_inv_register(sd); adv7511_g_register()
402 static int adv7511_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) adv7511_s_register() argument
406 adv7511_wr(sd, reg->reg & 0xff, reg->val & 0xff); adv7511_s_register()
409 v4l2_info(sd, "Register %03llx not supported\n", reg->reg); adv7511_s_register()
410 adv7511_inv_register(sd); adv7511_s_register()
417 static int adv7511_log_status(struct v4l2_subdev *sd) adv7511_log_status() argument
419 struct adv7511_state *state = get_adv7511_state(sd); adv7511_log_status()
444 v4l2_info(sd, "power %s\n", state->power_on ? "on" : "off"); adv7511_log_status()
445 v4l2_info(sd, "%s hotplug, %s Rx Sense, %s EDID (%d block(s))\n", adv7511_log_status()
446 (adv7511_rd(sd, 0x42) & MASK_ADV7511_HPD_DETECT) ? "detected" : "no", adv7511_log_status()
447 (adv7511_rd(sd, 0x42) & MASK_ADV7511_MSEN_DETECT) ? "detected" : "no", adv7511_log_status()
450 v4l2_info(sd, "%s output %s\n", adv7511_log_status()
451 (adv7511_rd(sd, 0xaf) & 0x02) ? adv7511_log_status()
453 (adv7511_rd(sd, 0xa1) & 0x3c) ? adv7511_log_status()
455 v4l2_info(sd, "state: %s, error: %s, detect count: %u, msk/irq: %02x/%02x\n", adv7511_log_status()
456 states[adv7511_rd(sd, 0xc8) & 0xf], adv7511_log_status()
457 errors[adv7511_rd(sd, 0xc8) >> 4], state->edid_detect_counter, adv7511_log_status()
458 adv7511_rd(sd, 0x94), adv7511_rd(sd, 0x96)); adv7511_log_status()
459 v4l2_info(sd, "RGB quantization: %s range\n", adv7511_rd(sd, 0x18) & 0x80 ? "limited" : "full"); adv7511_log_status()
460 if (adv7511_rd(sd, 0xaf) & 0x02) { adv7511_log_status()
462 u8 manual_cts = adv7511_rd(sd, 0x0a) & 0x80; adv7511_log_status()
463 u32 N = (adv7511_rd(sd, 0x01) & 0xf) << 16 | adv7511_log_status()
464 adv7511_rd(sd, 0x02) << 8 | adv7511_log_status()
465 adv7511_rd(sd, 0x03); adv7511_log_status()
466 u8 vic_detect = adv7511_rd(sd, 0x3e) >> 2; adv7511_log_status()
467 u8 vic_sent = adv7511_rd(sd, 0x3d) & 0x3f; adv7511_log_status()
471 CTS = (adv7511_rd(sd, 0x07) & 0xf) << 16 | adv7511_log_status()
472 adv7511_rd(sd, 0x08) << 8 | adv7511_log_status()
473 adv7511_rd(sd, 0x09); adv7511_log_status()
475 CTS = (adv7511_rd(sd, 0x04) & 0xf) << 16 | adv7511_log_status()
476 adv7511_rd(sd, 0x05) << 8 | adv7511_log_status()
477 adv7511_rd(sd, 0x06); adv7511_log_status()
478 v4l2_info(sd, "CTS %s mode: N %d, CTS %d\n", adv7511_log_status()
480 v4l2_info(sd, "VIC: detected %d, sent %d\n", adv7511_log_status()
484 v4l2_print_dv_timings(sd->name, "timings: ", adv7511_log_status()
487 v4l2_info(sd, "no timings set\n"); adv7511_log_status()
488 v4l2_info(sd, "i2c edid addr: 0x%x\n", state->i2c_edid_addr); adv7511_log_status()
489 v4l2_info(sd, "i2c cec addr: 0x%x\n", state->i2c_cec_addr); adv7511_log_status()
494 static int adv7511_s_power(struct v4l2_subdev *sd, int on) adv7511_s_power() argument
496 struct adv7511_state *state = get_adv7511_state(sd); adv7511_s_power()
500 v4l2_dbg(1, debug, sd, "%s: power %s\n", __func__, on ? "on" : "off"); adv7511_s_power()
506 adv7511_wr_and_or(sd, 0x41, 0xbf, 0x40); adv7511_s_power()
514 adv7511_wr_and_or(sd, 0x41, 0xbf, 0x0); adv7511_s_power()
515 if ((adv7511_rd(sd, 0x41) & 0x40) == 0) adv7511_s_power()
517 adv7511_wr_and_or(sd, 0x41, 0xbf, 0x40); adv7511_s_power()
521 v4l2_dbg(1, debug, sd, "%s: failed to powerup the adv7511!\n", __func__); adv7511_s_power()
522 adv7511_s_power(sd, 0); adv7511_s_power()
526 v4l2_dbg(1, debug, sd, "%s: needed %d retries to powerup the adv7511\n", __func__, i); adv7511_s_power()
529 adv7511_wr(sd, 0x98, 0x03); adv7511_s_power()
530 adv7511_wr_and_or(sd, 0x9a, 0xfe, 0x70); adv7511_s_power()
531 adv7511_wr(sd, 0x9c, 0x30); adv7511_s_power()
532 adv7511_wr_and_or(sd, 0x9d, 0xfc, 0x01); adv7511_s_power()
533 adv7511_wr(sd, 0xa2, 0xa4); adv7511_s_power()
534 adv7511_wr(sd, 0xa3, 0xa4); adv7511_s_power()
535 adv7511_wr(sd, 0xe0, 0xd0); adv7511_s_power()
536 adv7511_wr(sd, 0xf9, 0x00); adv7511_s_power()
538 adv7511_wr(sd, 0x43, state->i2c_edid_addr); adv7511_s_power()
541 adv7511_wr(sd, 0xc9, 0xf); adv7511_s_power()
546 static void adv7511_set_isr(struct v4l2_subdev *sd, bool enable) adv7511_set_isr() argument
552 v4l2_dbg(2, debug, sd, "%s: %s\n", __func__, enable ? "enable" : "disable"); adv7511_set_isr()
558 else if (adv7511_have_hotplug(sd)) adv7511_set_isr()
570 adv7511_wr(sd, 0x94, irqs); adv7511_set_isr()
571 irqs_rd = adv7511_rd(sd, 0x94); adv7511_set_isr()
576 v4l2_err(sd, "Could not set interrupts: hw failure?\n"); adv7511_set_isr()
580 static int adv7511_isr(struct v4l2_subdev *sd, u32 status, bool *handled) adv7511_isr() argument
585 adv7511_set_isr(sd, false); adv7511_isr()
586 irq_status = adv7511_rd(sd, 0x96); adv7511_isr()
588 adv7511_wr(sd, 0x96, irq_status); adv7511_isr()
590 v4l2_dbg(1, debug, sd, "%s: irq 0x%x\n", __func__, irq_status); adv7511_isr()
593 adv7511_check_monitor_present_status(sd); adv7511_isr()
595 adv7511_check_edid_status(sd); adv7511_isr()
598 adv7511_set_isr(sd, true); adv7511_isr()
618 static int adv7511_s_stream(struct v4l2_subdev *sd, int enable) adv7511_s_stream() argument
620 struct adv7511_state *state = get_adv7511_state(sd); adv7511_s_stream()
622 v4l2_dbg(1, debug, sd, "%s: %sable\n", __func__, (enable ? "en" : "dis")); adv7511_s_stream()
623 adv7511_wr_and_or(sd, 0xa1, ~0x3c, (enable ? 0 : 0x3c)); adv7511_s_stream()
625 adv7511_check_monitor_present_status(sd); adv7511_s_stream()
627 adv7511_s_power(sd, 0); adv7511_s_stream()
633 static int adv7511_s_dv_timings(struct v4l2_subdev *sd, adv7511_s_dv_timings() argument
636 struct adv7511_state *state = get_adv7511_state(sd); adv7511_s_dv_timings()
638 v4l2_dbg(1, debug, sd, "%s:\n", __func__); adv7511_s_dv_timings()
654 adv7511_set_rgb_quantization_mode(sd, state->rgb_quantization_range_ctrl); adv7511_s_dv_timings()
657 adv7511_set_IT_content_AVI_InfoFrame(sd); adv7511_s_dv_timings()
662 static int adv7511_g_dv_timings(struct v4l2_subdev *sd, adv7511_g_dv_timings() argument
665 struct adv7511_state *state = get_adv7511_state(sd); adv7511_g_dv_timings()
667 v4l2_dbg(1, debug, sd, "%s:\n", __func__); adv7511_g_dv_timings()
677 static int adv7511_enum_dv_timings(struct v4l2_subdev *sd, adv7511_enum_dv_timings() argument
686 static int adv7511_dv_timings_cap(struct v4l2_subdev *sd, adv7511_dv_timings_cap() argument
703 static int adv7511_s_audio_stream(struct v4l2_subdev *sd, int enable) adv7511_s_audio_stream() argument
705 v4l2_dbg(1, debug, sd, "%s: %sable\n", __func__, (enable ? "en" : "dis")); adv7511_s_audio_stream()
708 adv7511_wr_and_or(sd, 0x4b, 0x3f, 0x80); adv7511_s_audio_stream()
710 adv7511_wr_and_or(sd, 0x4b, 0x3f, 0x40); adv7511_s_audio_stream()
715 static int adv7511_s_clock_freq(struct v4l2_subdev *sd, u32 freq) adv7511_s_clock_freq() argument
732 adv7511_wr(sd, 0x01, (N >> 16) & 0xf); adv7511_s_clock_freq()
733 adv7511_wr(sd, 0x02, (N >> 8) & 0xff); adv7511_s_clock_freq()
734 adv7511_wr(sd, 0x03, N & 0xff); adv7511_s_clock_freq()
739 static int adv7511_s_i2s_clock_freq(struct v4l2_subdev *sd, u32 freq) adv7511_s_i2s_clock_freq() argument
756 adv7511_wr_and_or(sd, 0x15, 0xf, i2s_sf); adv7511_s_i2s_clock_freq()
761 static int adv7511_s_routing(struct v4l2_subdev *sd, u32 input, u32 output, u32 config) adv7511_s_routing() argument
764 adv7511_wr_and_or(sd, 0x73, 0xf8, 0x1); adv7511_s_routing()
766 adv7511_wr(sd, 0x76, 0x00); adv7511_s_routing()
769 adv7511_wr_and_or(sd, 0x14, 0xf0, 0x02); adv7511_s_routing()
783 static int adv7511_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) adv7511_get_edid() argument
785 struct adv7511_state *state = get_adv7511_state(sd); adv7511_get_edid()
812 static int adv7511_enum_mbus_code(struct v4l2_subdev *sd, adv7511_enum_mbus_code() argument
845 static int adv7511_get_fmt(struct v4l2_subdev *sd, adv7511_get_fmt() argument
849 struct adv7511_state *state = get_adv7511_state(sd); adv7511_get_fmt()
859 fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); adv7511_get_fmt()
874 static int adv7511_set_fmt(struct v4l2_subdev *sd, adv7511_set_fmt() argument
878 struct adv7511_state *state = get_adv7511_state(sd); adv7511_set_fmt()
910 fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); adv7511_set_fmt()
920 adv7511_wr_and_or(sd, 0x15, 0xf0, 0x01); adv7511_set_fmt()
921 adv7511_wr_and_or(sd, 0x16, 0x03, 0xb8); adv7511_set_fmt()
925 adv7511_wr_and_or(sd, 0x15, 0xf0, 0x01); adv7511_set_fmt()
926 adv7511_wr_and_or(sd, 0x16, 0x03, 0xbc); adv7511_set_fmt()
931 adv7511_wr_and_or(sd, 0x15, 0xf0, 0x00); adv7511_set_fmt()
932 adv7511_wr_and_or(sd, 0x16, 0x03, 0x00); adv7511_set_fmt()
1002 adv7511_wr_and_or(sd, 0x4a, 0xbf, 0); adv7511_set_fmt()
1003 adv7511_wr_and_or(sd, 0x55, 0x9f, y << 5); adv7511_set_fmt()
1004 adv7511_wr_and_or(sd, 0x56, 0x3f, c << 6); adv7511_set_fmt()
1005 adv7511_wr_and_or(sd, 0x57, 0x83, (ec << 4) | (q << 2)); adv7511_set_fmt()
1006 adv7511_wr_and_or(sd, 0x59, 0x0f, yq << 4); adv7511_set_fmt()
1007 adv7511_wr_and_or(sd, 0x4a, 0xff, 1); adv7511_set_fmt()
1031 static void adv7511_dbg_dump_edid(int lvl, int debug, struct v4l2_subdev *sd, int segment, uint8_t *buf) adv7511_dbg_dump_edid() argument
1035 v4l2_dbg(lvl, debug, sd, "edid segment %d\n", segment); adv7511_dbg_dump_edid()
1040 v4l2_dbg(lvl, debug, sd, "\n"); adv7511_dbg_dump_edid()
1046 v4l2_dbg(lvl, debug, sd, "%s\n", b); adv7511_dbg_dump_edid()
1051 static void adv7511_notify_no_edid(struct v4l2_subdev *sd) adv7511_notify_no_edid() argument
1053 struct adv7511_state *state = get_adv7511_state(sd); adv7511_notify_no_edid()
1058 ed.segment = adv7511_rd(sd, 0xc4); adv7511_notify_no_edid()
1059 v4l2_subdev_notify(sd, ADV7511_EDID_DETECT, (void *)&ed); adv7511_notify_no_edid()
1067 struct v4l2_subdev *sd = &state->sd; adv7511_edid_handler() local
1069 v4l2_dbg(1, debug, sd, "%s:\n", __func__); adv7511_edid_handler()
1071 if (adv7511_check_edid_status(sd)) { adv7511_edid_handler()
1076 if (adv7511_have_hotplug(sd)) { adv7511_edid_handler()
1082 v4l2_dbg(1, debug, sd, "%s: edid read failed\n", __func__); adv7511_edid_handler()
1084 adv7511_s_power(sd, false); adv7511_edid_handler()
1085 adv7511_s_power(sd, true); adv7511_edid_handler()
1092 adv7511_notify_no_edid(sd); adv7511_edid_handler()
1093 v4l2_dbg(1, debug, sd, "%s: no edid found\n", __func__); adv7511_edid_handler()
1096 static void adv7511_audio_setup(struct v4l2_subdev *sd) adv7511_audio_setup() argument
1098 v4l2_dbg(1, debug, sd, "%s\n", __func__); adv7511_audio_setup()
1100 adv7511_s_i2s_clock_freq(sd, 48000); adv7511_audio_setup()
1101 adv7511_s_clock_freq(sd, 48000); adv7511_audio_setup()
1102 adv7511_s_routing(sd, 0, 0, 0); adv7511_audio_setup()
1106 static void adv7511_setup(struct v4l2_subdev *sd) adv7511_setup() argument
1108 struct adv7511_state *state = get_adv7511_state(sd); adv7511_setup()
1109 v4l2_dbg(1, debug, sd, "%s\n", __func__); adv7511_setup()
1112 adv7511_wr_and_or(sd, 0x15, 0xf0, 0x0); adv7511_setup()
1114 adv7511_wr_and_or(sd, 0x16, 0x7f, 0x0); adv7511_setup()
1116 adv7511_wr_and_or(sd, 0x17, 0xf9, 0x06); adv7511_setup()
1118 adv7511_wr_and_or(sd, 0x3b, 0x9f, 0x0); adv7511_setup()
1120 adv7511_wr_and_or(sd, 0x18, 0x7f, 0x0); adv7511_setup()
1123 adv7511_wr_and_or(sd, 0x55, 0x9c, 0x12); adv7511_setup()
1125 adv7511_wr_and_or(sd, 0x44, 0xe7, 0x10); adv7511_setup()
1127 adv7511_wr(sd, 0x56, 0xa8); adv7511_setup()
1129 adv7511_wr_and_or(sd, 0xaf, 0xed, 0x0); adv7511_setup()
1132 adv7511_wr_and_or(sd, 0xba, 0x1f, 0x60); adv7511_setup()
1134 adv7511_audio_setup(sd); adv7511_setup()
1139 static void adv7511_notify_monitor_detect(struct v4l2_subdev *sd) adv7511_notify_monitor_detect() argument
1142 struct adv7511_state *state = get_adv7511_state(sd); adv7511_notify_monitor_detect()
1145 v4l2_subdev_notify(sd, ADV7511_MONITOR_DETECT, (void *)&mdt); adv7511_notify_monitor_detect()
1148 static void adv7511_check_monitor_present_status(struct v4l2_subdev *sd) adv7511_check_monitor_present_status() argument
1150 struct adv7511_state *state = get_adv7511_state(sd); adv7511_check_monitor_present_status()
1152 uint8_t status = adv7511_rd(sd, 0x42); adv7511_check_monitor_present_status()
1154 v4l2_dbg(1, debug, sd, "%s: status: 0x%x%s%s\n", adv7511_check_monitor_present_status()
1161 v4l2_ctrl_s_ctrl(state->hotplug_ctrl, adv7511_have_hotplug(sd) ? 0x1 : 0x0); adv7511_check_monitor_present_status()
1162 v4l2_ctrl_s_ctrl(state->rx_sense_ctrl, adv7511_have_rx_sense(sd) ? 0x1 : 0x0); adv7511_check_monitor_present_status()
1165 v4l2_dbg(1, debug, sd, "%s: hotplug and (rx-sense or edid)\n", __func__); adv7511_check_monitor_present_status()
1167 v4l2_dbg(1, debug, sd, "%s: monitor detected\n", __func__); adv7511_check_monitor_present_status()
1169 adv7511_set_isr(sd, true); adv7511_check_monitor_present_status()
1170 if (!adv7511_s_power(sd, true)) { adv7511_check_monitor_present_status()
1171 v4l2_dbg(1, debug, sd, "%s: monitor detected, powerup failed\n", __func__); adv7511_check_monitor_present_status()
1174 adv7511_setup(sd); adv7511_check_monitor_present_status()
1175 adv7511_notify_monitor_detect(sd); adv7511_check_monitor_present_status()
1180 v4l2_dbg(1, debug, sd, "%s: hotplug detected\n", __func__); adv7511_check_monitor_present_status()
1184 v4l2_dbg(1, debug, sd, "%s: hotplug not detected\n", __func__); adv7511_check_monitor_present_status()
1186 v4l2_dbg(1, debug, sd, "%s: monitor not detected\n", __func__); adv7511_check_monitor_present_status()
1188 adv7511_notify_monitor_detect(sd); adv7511_check_monitor_present_status()
1190 adv7511_s_power(sd, false); adv7511_check_monitor_present_status()
1192 adv7511_notify_no_edid(sd); adv7511_check_monitor_present_status()
1206 static bool edid_verify_crc(struct v4l2_subdev *sd, u32 segment) edid_verify_crc() argument
1208 struct adv7511_state *state = get_adv7511_state(sd); edid_verify_crc()
1219 static bool edid_verify_header(struct v4l2_subdev *sd, u32 segment) edid_verify_header() argument
1224 struct adv7511_state *state = get_adv7511_state(sd); edid_verify_header()
1232 static bool adv7511_check_edid_status(struct v4l2_subdev *sd) adv7511_check_edid_status() argument
1234 struct adv7511_state *state = get_adv7511_state(sd); adv7511_check_edid_status()
1235 uint8_t edidRdy = adv7511_rd(sd, 0xc5); adv7511_check_edid_status()
1237 v4l2_dbg(1, debug, sd, "%s: edid ready (retries: %d)\n", adv7511_check_edid_status()
1244 int segment = adv7511_rd(sd, 0xc4); adv7511_check_edid_status()
1248 v4l2_err(sd, "edid segment number too big\n"); adv7511_check_edid_status()
1251 v4l2_dbg(1, debug, sd, "%s: got segment %d\n", __func__, segment); adv7511_check_edid_status()
1252 adv7511_edid_rd(sd, 256, &state->edid.data[segment * 256]); adv7511_check_edid_status()
1253 adv7511_dbg_dump_edid(2, debug, sd, segment, &state->edid.data[segment * 256]); adv7511_check_edid_status()
1256 v4l2_dbg(1, debug, sd, "%s: %d blocks in total\n", __func__, state->edid.blocks); adv7511_check_edid_status()
1258 if (!edid_verify_crc(sd, segment) || adv7511_check_edid_status()
1259 !edid_verify_header(sd, segment)) { adv7511_check_edid_status()
1261 v4l2_err(sd, "%s: edid crc or header error\n", __func__); adv7511_check_edid_status()
1263 adv7511_s_power(sd, false); adv7511_check_edid_status()
1264 adv7511_s_power(sd, true); adv7511_check_edid_status()
1272 v4l2_dbg(1, debug, sd, "%s: request segment %d\n", __func__, state->edid.segments); adv7511_check_edid_status()
1273 adv7511_wr(sd, 0xc9, 0xf); adv7511_check_edid_status()
1274 adv7511_wr(sd, 0xc4, state->edid.segments); adv7511_check_edid_status()
1280 v4l2_dbg(1, debug, sd, "%s: edid complete with %d segment(s)\n", __func__, state->edid.segments); adv7511_check_edid_status()
1289 v4l2_subdev_notify(sd, ADV7511_EDID_DETECT, (void *)&ed); adv7511_check_edid_status()
1298 static void adv7511_init_setup(struct v4l2_subdev *sd) adv7511_init_setup() argument
1300 struct adv7511_state *state = get_adv7511_state(sd); adv7511_init_setup()
1303 v4l2_dbg(1, debug, sd, "%s\n", __func__); adv7511_init_setup()
1306 adv7511_wr(sd, 0x96, 0xff); adv7511_init_setup()
1312 adv7511_wr_and_or(sd, 0xd6, 0x3f, 0xc0); adv7511_init_setup()
1315 adv7511_set_isr(sd, false); adv7511_init_setup()
1316 adv7511_s_stream(sd, false); adv7511_init_setup()
1317 adv7511_s_audio_stream(sd, false); adv7511_init_setup()
1325 struct v4l2_subdev *sd; adv7511_probe() local
1346 sd = &state->sd; adv7511_probe()
1348 v4l2_dbg(1, debug, sd, "detecting adv7511 client on address 0x%x\n", adv7511_probe()
1351 v4l2_i2c_subdev_init(sd, client, &adv7511_ops); adv7511_probe()
1369 sd->ctrl_handler = hdl; adv7511_probe()
1381 err = media_entity_init(&sd->entity, 1, &state->pad, 0); adv7511_probe()
1389 state->chip_revision = adv7511_rd(sd, 0x0); adv7511_probe()
1390 chip_id[0] = adv7511_rd(sd, 0xf5); adv7511_probe()
1391 chip_id[1] = adv7511_rd(sd, 0xf6); adv7511_probe()
1393 v4l2_err(sd, "chip_id != 0x7511, read 0x%02x%02x\n", chip_id[0], chip_id[1]); adv7511_probe()
1400 v4l2_err(sd, "failed to register edid i2c client\n"); adv7511_probe()
1405 adv7511_wr(sd, 0xe2, 0x01); /* power down cec section */ adv7511_probe()
1406 state->work_queue = create_singlethread_workqueue(sd->name); adv7511_probe()
1408 v4l2_err(sd, "could not create workqueue\n"); adv7511_probe()
1415 adv7511_init_setup(sd); adv7511_probe()
1416 adv7511_set_isr(sd, true); adv7511_probe()
1417 adv7511_check_monitor_present_status(sd); adv7511_probe()
1419 v4l2_info(sd, "%s found @ 0x%x (%s)\n", client->name, adv7511_probe()
1426 media_entity_cleanup(&sd->entity); adv7511_probe()
1436 struct v4l2_subdev *sd = i2c_get_clientdata(client); adv7511_remove() local
1437 struct adv7511_state *state = get_adv7511_state(sd); adv7511_remove()
1441 v4l2_dbg(1, debug, sd, "%s removed @ 0x%x (%s)\n", client->name, adv7511_remove()
1444 adv7511_init_setup(sd); adv7511_remove()
1448 v4l2_device_unregister_subdev(sd); adv7511_remove()
1449 media_entity_cleanup(&sd->entity); adv7511_remove()
1450 v4l2_ctrl_handler_free(sd->ctrl_handler); adv7511_remove()
H A Dcs5345.c40 struct v4l2_subdev sd; member in struct:cs5345_state
44 static inline struct cs5345_state *to_state(struct v4l2_subdev *sd) to_state() argument
46 return container_of(sd, struct cs5345_state, sd); to_state()
51 return &container_of(ctrl->handler, struct cs5345_state, hdl)->sd; to_sd()
56 static inline int cs5345_write(struct v4l2_subdev *sd, u8 reg, u8 value) cs5345_write() argument
58 struct i2c_client *client = v4l2_get_subdevdata(sd); cs5345_write()
63 static inline int cs5345_read(struct v4l2_subdev *sd, u8 reg) cs5345_read() argument
65 struct i2c_client *client = v4l2_get_subdevdata(sd); cs5345_read()
70 static int cs5345_s_routing(struct v4l2_subdev *sd, cs5345_s_routing() argument
74 v4l2_err(sd, "Invalid input %d.\n", input); cs5345_s_routing()
77 cs5345_write(sd, 0x09, input & 0xf); cs5345_s_routing()
78 cs5345_write(sd, 0x05, input & 0xf0); cs5345_s_routing()
84 struct v4l2_subdev *sd = to_sd(ctrl); cs5345_s_ctrl() local
88 cs5345_write(sd, 0x04, ctrl->val ? 0x80 : 0); cs5345_s_ctrl()
91 cs5345_write(sd, 0x07, ((u8)ctrl->val) & 0x3f); cs5345_s_ctrl()
92 cs5345_write(sd, 0x08, ((u8)ctrl->val) & 0x3f); cs5345_s_ctrl()
99 static int cs5345_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) cs5345_g_register() argument
102 reg->val = cs5345_read(sd, reg->reg & 0x1f); cs5345_g_register()
106 static int cs5345_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) cs5345_s_register() argument
108 cs5345_write(sd, reg->reg & 0x1f, reg->val & 0xff); cs5345_s_register()
113 static int cs5345_log_status(struct v4l2_subdev *sd) cs5345_log_status() argument
115 u8 v = cs5345_read(sd, 0x09) & 7; cs5345_log_status()
116 u8 m = cs5345_read(sd, 0x04); cs5345_log_status()
117 int vol = cs5345_read(sd, 0x08) & 0x3f; cs5345_log_status()
119 v4l2_info(sd, "Input: %d%s\n", v, cs5345_log_status()
123 v4l2_info(sd, "Volume: %d dB\n", vol); cs5345_log_status()
163 struct v4l2_subdev *sd; cs5345_probe() local
175 sd = &state->sd; cs5345_probe()
176 v4l2_i2c_subdev_init(sd, client, &cs5345_ops); cs5345_probe()
183 sd->ctrl_handler = &state->hdl; cs5345_probe()
193 cs5345_write(sd, 0x02, 0x00); cs5345_probe()
194 cs5345_write(sd, 0x04, 0x01); cs5345_probe()
195 cs5345_write(sd, 0x09, 0x01); cs5345_probe()
203 struct v4l2_subdev *sd = i2c_get_clientdata(client); cs5345_remove() local
204 struct cs5345_state *state = to_state(sd); cs5345_remove()
206 v4l2_device_unregister_subdev(sd); cs5345_remove()
H A Dadv7604.c117 void (*set_termination)(struct v4l2_subdev *sd, bool enable);
118 void (*setup_irqs)(struct v4l2_subdev *sd);
119 unsigned int (*read_hdmi_pixelclock)(struct v4l2_subdev *sd);
120 unsigned int (*read_cable_det)(struct v4l2_subdev *sd);
143 struct v4l2_subdev sd; member in struct:adv76xx_state
332 static inline struct adv76xx_state *to_state(struct v4l2_subdev *sd) to_state() argument
334 return container_of(sd, struct adv76xx_state, sd); to_state()
413 static inline int io_read(struct v4l2_subdev *sd, u8 reg) io_read() argument
415 struct adv76xx_state *state = to_state(sd); io_read()
420 static inline int io_write(struct v4l2_subdev *sd, u8 reg, u8 val) io_write() argument
422 struct adv76xx_state *state = to_state(sd); io_write()
427 static inline int io_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) io_write_clr_set() argument
429 return io_write(sd, reg, (io_read(sd, reg) & ~mask) | val); io_write_clr_set()
432 static inline int avlink_read(struct v4l2_subdev *sd, u8 reg) avlink_read() argument
434 struct adv76xx_state *state = to_state(sd); avlink_read()
439 static inline int avlink_write(struct v4l2_subdev *sd, u8 reg, u8 val) avlink_write() argument
441 struct adv76xx_state *state = to_state(sd); avlink_write()
446 static inline int cec_read(struct v4l2_subdev *sd, u8 reg) cec_read() argument
448 struct adv76xx_state *state = to_state(sd); cec_read()
453 static inline int cec_write(struct v4l2_subdev *sd, u8 reg, u8 val) cec_write() argument
455 struct adv76xx_state *state = to_state(sd); cec_write()
460 static inline int infoframe_read(struct v4l2_subdev *sd, u8 reg) infoframe_read() argument
462 struct adv76xx_state *state = to_state(sd); infoframe_read()
467 static inline int infoframe_write(struct v4l2_subdev *sd, u8 reg, u8 val) infoframe_write() argument
469 struct adv76xx_state *state = to_state(sd); infoframe_write()
475 static inline int afe_read(struct v4l2_subdev *sd, u8 reg) afe_read() argument
477 struct adv76xx_state *state = to_state(sd); afe_read()
482 static inline int afe_write(struct v4l2_subdev *sd, u8 reg, u8 val) afe_write() argument
484 struct adv76xx_state *state = to_state(sd); afe_write()
489 static inline int rep_read(struct v4l2_subdev *sd, u8 reg) rep_read() argument
491 struct adv76xx_state *state = to_state(sd); rep_read()
496 static inline int rep_write(struct v4l2_subdev *sd, u8 reg, u8 val) rep_write() argument
498 struct adv76xx_state *state = to_state(sd); rep_write()
503 static inline int rep_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) rep_write_clr_set() argument
505 return rep_write(sd, reg, (rep_read(sd, reg) & ~mask) | val); rep_write_clr_set()
508 static inline int edid_read(struct v4l2_subdev *sd, u8 reg) edid_read() argument
510 struct adv76xx_state *state = to_state(sd); edid_read()
515 static inline int edid_write(struct v4l2_subdev *sd, u8 reg, u8 val) edid_write() argument
517 struct adv76xx_state *state = to_state(sd); edid_write()
522 static inline int edid_write_block(struct v4l2_subdev *sd, edid_write_block() argument
525 struct adv76xx_state *state = to_state(sd); edid_write_block()
529 v4l2_dbg(2, debug, sd, "%s: write EDID block (%d byte)\n", __func__, len); edid_write_block()
544 v4l2_subdev_notify(&state->sd, ADV76XX_HOTPLUG, &hpd); adv76xx_set_hpd()
552 struct v4l2_subdev *sd = &state->sd; adv76xx_delayed_work_enable_hotplug() local
554 v4l2_dbg(2, debug, sd, "%s: enable hotplug\n", __func__); adv76xx_delayed_work_enable_hotplug()
559 static inline int hdmi_read(struct v4l2_subdev *sd, u8 reg) hdmi_read() argument
561 struct adv76xx_state *state = to_state(sd); hdmi_read()
566 static u16 hdmi_read16(struct v4l2_subdev *sd, u8 reg, u16 mask) hdmi_read16() argument
568 return ((hdmi_read(sd, reg) << 8) | hdmi_read(sd, reg + 1)) & mask; hdmi_read16()
571 static inline int hdmi_write(struct v4l2_subdev *sd, u8 reg, u8 val) hdmi_write() argument
573 struct adv76xx_state *state = to_state(sd); hdmi_write()
578 static inline int hdmi_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) hdmi_write_clr_set() argument
580 return hdmi_write(sd, reg, (hdmi_read(sd, reg) & ~mask) | val); hdmi_write_clr_set()
583 static inline int test_write(struct v4l2_subdev *sd, u8 reg, u8 val) test_write() argument
585 struct adv76xx_state *state = to_state(sd); test_write()
590 static inline int cp_read(struct v4l2_subdev *sd, u8 reg) cp_read() argument
592 struct adv76xx_state *state = to_state(sd); cp_read()
597 static u16 cp_read16(struct v4l2_subdev *sd, u8 reg, u16 mask) cp_read16() argument
599 return ((cp_read(sd, reg) << 8) | cp_read(sd, reg + 1)) & mask; cp_read16()
602 static inline int cp_write(struct v4l2_subdev *sd, u8 reg, u8 val) cp_write() argument
604 struct adv76xx_state *state = to_state(sd); cp_write()
609 static inline int cp_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) cp_write_clr_set() argument
611 return cp_write(sd, reg, (cp_read(sd, reg) & ~mask) | val); cp_write_clr_set()
614 static inline int vdp_read(struct v4l2_subdev *sd, u8 reg) vdp_read() argument
616 struct adv76xx_state *state = to_state(sd); vdp_read()
621 static inline int vdp_write(struct v4l2_subdev *sd, u8 reg, u8 val) vdp_write() argument
623 struct adv76xx_state *state = to_state(sd); vdp_write()
632 static int adv76xx_read_reg(struct v4l2_subdev *sd, unsigned int reg) adv76xx_read_reg() argument
634 struct adv76xx_state *state = to_state(sd); adv76xx_read_reg()
646 static int adv76xx_write_reg(struct v4l2_subdev *sd, unsigned int reg, u8 val) adv76xx_write_reg() argument
648 struct adv76xx_state *state = to_state(sd); adv76xx_write_reg()
659 static void adv76xx_write_reg_seq(struct v4l2_subdev *sd, adv76xx_write_reg_seq() argument
665 adv76xx_write_reg(sd, reg_seq[i].reg, reg_seq[i].val); adv76xx_write_reg_seq()
757 static inline bool is_analog_input(struct v4l2_subdev *sd) is_analog_input() argument
759 struct adv76xx_state *state = to_state(sd); is_analog_input()
765 static inline bool is_digital_input(struct v4l2_subdev *sd) is_digital_input() argument
767 struct adv76xx_state *state = to_state(sd); is_digital_input()
778 static void adv76xx_inv_register(struct v4l2_subdev *sd) adv76xx_inv_register() argument
780 v4l2_info(sd, "0x000-0x0ff: IO Map\n"); adv76xx_inv_register()
781 v4l2_info(sd, "0x100-0x1ff: AVLink Map\n"); adv76xx_inv_register()
782 v4l2_info(sd, "0x200-0x2ff: CEC Map\n"); adv76xx_inv_register()
783 v4l2_info(sd, "0x300-0x3ff: InfoFrame Map\n"); adv76xx_inv_register()
784 v4l2_info(sd, "0x400-0x4ff: ESDP Map\n"); adv76xx_inv_register()
785 v4l2_info(sd, "0x500-0x5ff: DPP Map\n"); adv76xx_inv_register()
786 v4l2_info(sd, "0x600-0x6ff: AFE Map\n"); adv76xx_inv_register()
787 v4l2_info(sd, "0x700-0x7ff: Repeater Map\n"); adv76xx_inv_register()
788 v4l2_info(sd, "0x800-0x8ff: EDID Map\n"); adv76xx_inv_register()
789 v4l2_info(sd, "0x900-0x9ff: HDMI Map\n"); adv76xx_inv_register()
790 v4l2_info(sd, "0xa00-0xaff: Test Map\n"); adv76xx_inv_register()
791 v4l2_info(sd, "0xb00-0xbff: CP Map\n"); adv76xx_inv_register()
792 v4l2_info(sd, "0xc00-0xcff: VDP Map\n"); adv76xx_inv_register()
795 static int adv76xx_g_register(struct v4l2_subdev *sd, adv76xx_g_register() argument
800 ret = adv76xx_read_reg(sd, reg->reg); adv76xx_g_register()
802 v4l2_info(sd, "Register %03llx not supported\n", reg->reg); adv76xx_g_register()
803 adv76xx_inv_register(sd); adv76xx_g_register()
813 static int adv76xx_s_register(struct v4l2_subdev *sd, adv76xx_s_register() argument
818 ret = adv76xx_write_reg(sd, reg->reg, reg->val); adv76xx_s_register()
820 v4l2_info(sd, "Register %03llx not supported\n", reg->reg); adv76xx_s_register()
821 adv76xx_inv_register(sd); adv76xx_s_register()
829 static unsigned int adv7604_read_cable_det(struct v4l2_subdev *sd) adv7604_read_cable_det() argument
831 u8 value = io_read(sd, 0x6f); adv7604_read_cable_det()
839 static unsigned int adv7611_read_cable_det(struct v4l2_subdev *sd) adv7611_read_cable_det() argument
841 u8 value = io_read(sd, 0x6f); adv7611_read_cable_det()
846 static int adv76xx_s_detect_tx_5v_ctrl(struct v4l2_subdev *sd) adv76xx_s_detect_tx_5v_ctrl() argument
848 struct adv76xx_state *state = to_state(sd); adv76xx_s_detect_tx_5v_ctrl()
852 info->read_cable_det(sd)); adv76xx_s_detect_tx_5v_ctrl()
855 static int find_and_set_predefined_video_timings(struct v4l2_subdev *sd, find_and_set_predefined_video_timings() argument
864 is_digital_input(sd) ? 250000 : 1000000)) find_and_set_predefined_video_timings()
866 io_write(sd, 0x00, predef_vid_timings[i].vid_std); /* video std */ find_and_set_predefined_video_timings()
867 io_write(sd, 0x01, (predef_vid_timings[i].v_freq << 4) + find_and_set_predefined_video_timings()
875 static int configure_predefined_video_timings(struct v4l2_subdev *sd, configure_predefined_video_timings() argument
878 struct adv76xx_state *state = to_state(sd); configure_predefined_video_timings()
881 v4l2_dbg(1, debug, sd, "%s", __func__); configure_predefined_video_timings()
885 io_write(sd, 0x16, 0x43); configure_predefined_video_timings()
886 io_write(sd, 0x17, 0x5a); configure_predefined_video_timings()
889 cp_write_clr_set(sd, 0x81, 0x10, 0x00); configure_predefined_video_timings()
890 cp_write(sd, 0x8f, 0x00); configure_predefined_video_timings()
891 cp_write(sd, 0x90, 0x00); configure_predefined_video_timings()
892 cp_write(sd, 0xa2, 0x00); configure_predefined_video_timings()
893 cp_write(sd, 0xa3, 0x00); configure_predefined_video_timings()
894 cp_write(sd, 0xa4, 0x00); configure_predefined_video_timings()
895 cp_write(sd, 0xa5, 0x00); configure_predefined_video_timings()
896 cp_write(sd, 0xa6, 0x00); configure_predefined_video_timings()
897 cp_write(sd, 0xa7, 0x00); configure_predefined_video_timings()
898 cp_write(sd, 0xab, 0x00); configure_predefined_video_timings()
899 cp_write(sd, 0xac, 0x00); configure_predefined_video_timings()
901 if (is_analog_input(sd)) { configure_predefined_video_timings()
902 err = find_and_set_predefined_video_timings(sd, configure_predefined_video_timings()
905 err = find_and_set_predefined_video_timings(sd, configure_predefined_video_timings()
907 } else if (is_digital_input(sd)) { configure_predefined_video_timings()
908 err = find_and_set_predefined_video_timings(sd, configure_predefined_video_timings()
911 err = find_and_set_predefined_video_timings(sd, configure_predefined_video_timings()
914 v4l2_dbg(2, debug, sd, "%s: Unknown port %d selected\n", configure_predefined_video_timings()
923 static void configure_custom_video_timings(struct v4l2_subdev *sd, configure_custom_video_timings() argument
926 struct adv76xx_state *state = to_state(sd); configure_custom_video_timings()
940 v4l2_dbg(2, debug, sd, "%s\n", __func__); configure_custom_video_timings()
942 if (is_analog_input(sd)) { configure_custom_video_timings()
944 io_write(sd, 0x00, 0x07); /* video std */ configure_custom_video_timings()
945 io_write(sd, 0x01, 0x02); /* prim mode */ configure_custom_video_timings()
947 cp_write_clr_set(sd, 0x81, 0x10, 0x10); configure_custom_video_timings()
954 v4l2_err(sd, "writing to reg 0x16 and 0x17 failed\n"); configure_custom_video_timings()
957 cp_write(sd, 0xa2, (cp_start_sav >> 4) & 0xff); configure_custom_video_timings()
958 cp_write(sd, 0xa3, ((cp_start_sav & 0x0f) << 4) | configure_custom_video_timings()
960 cp_write(sd, 0xa4, cp_start_eav & 0xff); configure_custom_video_timings()
963 cp_write(sd, 0xa5, (cp_start_vbi >> 4) & 0xff); configure_custom_video_timings()
964 cp_write(sd, 0xa6, ((cp_start_vbi & 0xf) << 4) | configure_custom_video_timings()
966 cp_write(sd, 0xa7, cp_end_vbi & 0xff); configure_custom_video_timings()
967 } else if (is_digital_input(sd)) { configure_custom_video_timings()
970 io_write(sd, 0x00, 0x02); /* video std */ configure_custom_video_timings()
971 io_write(sd, 0x01, 0x06); /* prim mode */ configure_custom_video_timings()
973 v4l2_dbg(2, debug, sd, "%s: Unknown port %d selected\n", configure_custom_video_timings()
977 cp_write(sd, 0x8f, (ch1_fr_ll >> 8) & 0x7); configure_custom_video_timings()
978 cp_write(sd, 0x90, ch1_fr_ll & 0xff); configure_custom_video_timings()
979 cp_write(sd, 0xab, (height >> 4) & 0xff); configure_custom_video_timings()
980 cp_write(sd, 0xac, (height & 0x0f) << 4); configure_custom_video_timings()
983 static void adv76xx_set_offset(struct v4l2_subdev *sd, bool auto_offset, u16 offset_a, u16 offset_b, u16 offset_c) adv76xx_set_offset() argument
985 struct adv76xx_state *state = to_state(sd); adv76xx_set_offset()
994 v4l2_dbg(2, debug, sd, "%s: %s offset: a = 0x%x, b = 0x%x, c = 0x%x\n", adv76xx_set_offset()
998 offset_buf[0] = (cp_read(sd, 0x77) & 0xc0) | ((offset_a & 0x3f0) >> 4); adv76xx_set_offset()
1006 v4l2_err(sd, "%s: i2c error writing to CP reg 0x77, 0x78, 0x79, 0x7a\n", __func__); adv76xx_set_offset()
1009 static void adv76xx_set_gain(struct v4l2_subdev *sd, bool auto_gain, u16 gain_a, u16 gain_b, u16 gain_c) adv76xx_set_gain() argument
1011 struct adv76xx_state *state = to_state(sd); adv76xx_set_gain()
1024 v4l2_dbg(2, debug, sd, "%s: %s gain: a = 0x%x, b = 0x%x, c = 0x%x\n", adv76xx_set_gain()
1036 v4l2_err(sd, "%s: i2c error writing to CP reg 0x73, 0x74, 0x75, 0x76\n", __func__); adv76xx_set_gain()
1039 static void set_rgb_quantization_range(struct v4l2_subdev *sd) set_rgb_quantization_range() argument
1041 struct adv76xx_state *state = to_state(sd); set_rgb_quantization_range()
1042 bool rgb_output = io_read(sd, 0x02) & 0x02; set_rgb_quantization_range()
1043 bool hdmi_signal = hdmi_read(sd, 0x05) & 0x80; set_rgb_quantization_range()
1045 v4l2_dbg(2, debug, sd, "%s: RGB quantization range: %d, RGB out: %d, HDMI: %d\n", set_rgb_quantization_range()
1049 adv76xx_set_gain(sd, true, 0x0, 0x0, 0x0); set_rgb_quantization_range()
1050 adv76xx_set_offset(sd, true, 0x0, 0x0, 0x0); set_rgb_quantization_range()
1057 io_write_clr_set(sd, 0x02, 0xf0, 0x10); set_rgb_quantization_range()
1064 io_write_clr_set(sd, 0x02, 0xf0, 0xf0); set_rgb_quantization_range()
1071 io_write_clr_set(sd, 0x02, 0xf0, 0xf0); set_rgb_quantization_range()
1080 io_write_clr_set(sd, 0x02, 0xf0, 0x00); set_rgb_quantization_range()
1083 io_write_clr_set(sd, 0x02, 0xf0, 0x10); set_rgb_quantization_range()
1085 if (is_digital_input(sd) && rgb_output) { set_rgb_quantization_range()
1086 adv76xx_set_offset(sd, false, 0x40, 0x40, 0x40); set_rgb_quantization_range()
1088 adv76xx_set_gain(sd, false, 0xe0, 0xe0, 0xe0); set_rgb_quantization_range()
1089 adv76xx_set_offset(sd, false, 0x70, 0x70, 0x70); set_rgb_quantization_range()
1096 io_write_clr_set(sd, 0x02, 0xf0, 0x20); set_rgb_quantization_range()
1101 io_write_clr_set(sd, 0x02, 0xf0, 0x00); set_rgb_quantization_range()
1107 io_write_clr_set(sd, 0x02, 0xf0, 0x60); set_rgb_quantization_range()
1112 io_write_clr_set(sd, 0x02, 0xf0, 0x10); set_rgb_quantization_range()
1114 if (is_analog_input(sd) || hdmi_signal) set_rgb_quantization_range()
1119 adv76xx_set_offset(sd, false, 0x40, 0x40, 0x40); set_rgb_quantization_range()
1121 adv76xx_set_gain(sd, false, 0xe0, 0xe0, 0xe0); set_rgb_quantization_range()
1122 adv76xx_set_offset(sd, false, 0x70, 0x70, 0x70); set_rgb_quantization_range()
1130 struct v4l2_subdev *sd = adv76xx_s_ctrl() local
1131 &container_of(ctrl->handler, struct adv76xx_state, hdl)->sd; adv76xx_s_ctrl()
1133 struct adv76xx_state *state = to_state(sd); adv76xx_s_ctrl()
1137 cp_write(sd, 0x3c, ctrl->val); adv76xx_s_ctrl()
1140 cp_write(sd, 0x3a, ctrl->val); adv76xx_s_ctrl()
1143 cp_write(sd, 0x3b, ctrl->val); adv76xx_s_ctrl()
1146 cp_write(sd, 0x3d, ctrl->val); adv76xx_s_ctrl()
1150 set_rgb_quantization_range(sd); adv76xx_s_ctrl()
1159 afe_write(sd, 0xc8, ctrl->val); adv76xx_s_ctrl()
1164 cp_write_clr_set(sd, 0xbf, 0x04, ctrl->val << 2); adv76xx_s_ctrl()
1167 cp_write(sd, 0xc0, (ctrl->val & 0xff0000) >> 16); adv76xx_s_ctrl()
1168 cp_write(sd, 0xc1, (ctrl->val & 0x00ff00) >> 8); adv76xx_s_ctrl()
1169 cp_write(sd, 0xc2, (u8)(ctrl->val & 0x0000ff)); adv76xx_s_ctrl()
1177 static inline bool no_power(struct v4l2_subdev *sd) no_power() argument
1180 return io_read(sd, 0x0c) & 0x24; no_power()
1183 static inline bool no_signal_tmds(struct v4l2_subdev *sd) no_signal_tmds() argument
1185 struct adv76xx_state *state = to_state(sd); no_signal_tmds()
1187 return !(io_read(sd, 0x6a) & (0x10 >> state->selected_input)); no_signal_tmds()
1190 static inline bool no_lock_tmds(struct v4l2_subdev *sd) no_lock_tmds() argument
1192 struct adv76xx_state *state = to_state(sd); no_lock_tmds()
1195 return (io_read(sd, 0x6a) & info->tdms_lock_mask) != info->tdms_lock_mask; no_lock_tmds()
1198 static inline bool is_hdmi(struct v4l2_subdev *sd) is_hdmi() argument
1200 return hdmi_read(sd, 0x05) & 0x80; is_hdmi()
1203 static inline bool no_lock_sspd(struct v4l2_subdev *sd) no_lock_sspd() argument
1205 struct adv76xx_state *state = to_state(sd); no_lock_sspd()
1215 return ((cp_read(sd, 0xb5) & 0xd0) != 0xd0); no_lock_sspd()
1218 static inline bool no_lock_stdi(struct v4l2_subdev *sd) no_lock_stdi() argument
1221 return !(cp_read(sd, 0xb1) & 0x80); no_lock_stdi()
1224 static inline bool no_signal(struct v4l2_subdev *sd) no_signal() argument
1228 ret = no_power(sd); no_signal()
1230 ret |= no_lock_stdi(sd); no_signal()
1231 ret |= no_lock_sspd(sd); no_signal()
1233 if (is_digital_input(sd)) { no_signal()
1234 ret |= no_lock_tmds(sd); no_signal()
1235 ret |= no_signal_tmds(sd); no_signal()
1241 static inline bool no_lock_cp(struct v4l2_subdev *sd) no_lock_cp() argument
1243 struct adv76xx_state *state = to_state(sd); no_lock_cp()
1250 return io_read(sd, 0x12) & 0x01; no_lock_cp()
1253 static inline bool in_free_run(struct v4l2_subdev *sd) in_free_run() argument
1255 return cp_read(sd, 0xff) & 0x10; in_free_run()
1258 static int adv76xx_g_input_status(struct v4l2_subdev *sd, u32 *status) adv76xx_g_input_status() argument
1261 *status |= no_power(sd) ? V4L2_IN_ST_NO_POWER : 0; adv76xx_g_input_status()
1262 *status |= no_signal(sd) ? V4L2_IN_ST_NO_SIGNAL : 0; adv76xx_g_input_status()
1263 if (!in_free_run(sd) && no_lock_cp(sd)) adv76xx_g_input_status()
1264 *status |= is_digital_input(sd) ? adv76xx_g_input_status()
1267 v4l2_dbg(1, debug, sd, "%s: status = 0x%x\n", __func__, *status); adv76xx_g_input_status()
1280 static int stdi2dv_timings(struct v4l2_subdev *sd, stdi2dv_timings() argument
1284 struct adv76xx_state *state = to_state(sd); stdi2dv_timings()
1315 v4l2_dbg(2, debug, sd, stdi2dv_timings()
1323 static int read_stdi(struct v4l2_subdev *sd, struct stdi_readback *stdi) read_stdi() argument
1325 struct adv76xx_state *state = to_state(sd); read_stdi()
1329 if (no_lock_stdi(sd) || no_lock_sspd(sd)) { read_stdi()
1330 v4l2_dbg(2, debug, sd, "%s: STDI and/or SSPD not locked\n", __func__); read_stdi()
1335 stdi->bl = cp_read16(sd, 0xb1, 0x3fff); read_stdi()
1336 stdi->lcf = cp_read16(sd, info->lcf_reg, 0x7ff); read_stdi()
1337 stdi->lcvs = cp_read(sd, 0xb3) >> 3; read_stdi()
1338 stdi->interlaced = io_read(sd, 0x12) & 0x10; read_stdi()
1342 polarity = cp_read(sd, 0xb5); read_stdi()
1353 polarity = hdmi_read(sd, 0x05); read_stdi()
1358 if (no_lock_stdi(sd) || no_lock_sspd(sd)) { read_stdi()
1359 v4l2_dbg(2, debug, sd, read_stdi()
1365 v4l2_dbg(2, debug, sd, "%s: invalid signal\n", __func__); read_stdi()
1370 v4l2_dbg(2, debug, sd, read_stdi()
1379 static int adv76xx_enum_dv_timings(struct v4l2_subdev *sd, adv76xx_enum_dv_timings() argument
1382 struct adv76xx_state *state = to_state(sd); adv76xx_enum_dv_timings()
1395 static int adv76xx_dv_timings_cap(struct v4l2_subdev *sd, adv76xx_dv_timings_cap() argument
1398 struct adv76xx_state *state = to_state(sd); adv76xx_dv_timings_cap()
1431 static void adv76xx_fill_optional_dv_timings_fields(struct v4l2_subdev *sd, adv76xx_fill_optional_dv_timings_fields() argument
1438 is_digital_input(sd) ? 250000 : 1000000)) { adv76xx_fill_optional_dv_timings_fields()
1445 static unsigned int adv7604_read_hdmi_pixelclock(struct v4l2_subdev *sd) adv7604_read_hdmi_pixelclock() argument
1450 a = hdmi_read(sd, 0x06); adv7604_read_hdmi_pixelclock()
1451 b = hdmi_read(sd, 0x3b); adv7604_read_hdmi_pixelclock()
1456 if (is_hdmi(sd)) { adv7604_read_hdmi_pixelclock()
1458 unsigned bits_per_channel = ((hdmi_read(sd, 0x0b) & 0x60) >> 4) + 8; adv7604_read_hdmi_pixelclock()
1466 static unsigned int adv7611_read_hdmi_pixelclock(struct v4l2_subdev *sd) adv7611_read_hdmi_pixelclock() argument
1470 a = hdmi_read(sd, 0x51); adv7611_read_hdmi_pixelclock()
1471 b = hdmi_read(sd, 0x52); adv7611_read_hdmi_pixelclock()
1477 static int adv76xx_query_dv_timings(struct v4l2_subdev *sd, adv76xx_query_dv_timings() argument
1480 struct adv76xx_state *state = to_state(sd); adv76xx_query_dv_timings()
1490 if (no_signal(sd)) { adv76xx_query_dv_timings()
1492 v4l2_dbg(1, debug, sd, "%s: no valid signal\n", __func__); adv76xx_query_dv_timings()
1497 if (read_stdi(sd, &stdi)) { adv76xx_query_dv_timings()
1498 v4l2_dbg(1, debug, sd, "%s: STDI/SSPD not locked\n", __func__); adv76xx_query_dv_timings()
1504 if (is_digital_input(sd)) { adv76xx_query_dv_timings()
1508 bt->width = hdmi_read16(sd, 0x07, 0xfff); adv76xx_query_dv_timings()
1509 bt->height = hdmi_read16(sd, 0x09, 0xfff); adv76xx_query_dv_timings()
1510 bt->pixelclock = info->read_hdmi_pixelclock(sd); adv76xx_query_dv_timings()
1511 bt->hfrontporch = hdmi_read16(sd, 0x20, 0x3ff); adv76xx_query_dv_timings()
1512 bt->hsync = hdmi_read16(sd, 0x22, 0x3ff); adv76xx_query_dv_timings()
1513 bt->hbackporch = hdmi_read16(sd, 0x24, 0x3ff); adv76xx_query_dv_timings()
1514 bt->vfrontporch = hdmi_read16(sd, 0x2a, 0x1fff) / 2; adv76xx_query_dv_timings()
1515 bt->vsync = hdmi_read16(sd, 0x2e, 0x1fff) / 2; adv76xx_query_dv_timings()
1516 bt->vbackporch = hdmi_read16(sd, 0x32, 0x1fff) / 2; adv76xx_query_dv_timings()
1517 bt->polarities = ((hdmi_read(sd, 0x05) & 0x10) ? V4L2_DV_VSYNC_POS_POL : 0) | adv76xx_query_dv_timings()
1518 ((hdmi_read(sd, 0x05) & 0x20) ? V4L2_DV_HSYNC_POS_POL : 0); adv76xx_query_dv_timings()
1520 bt->height += hdmi_read16(sd, 0x0b, 0xfff); adv76xx_query_dv_timings()
1521 bt->il_vfrontporch = hdmi_read16(sd, 0x2c, 0x1fff) / 2; adv76xx_query_dv_timings()
1522 bt->il_vsync = hdmi_read16(sd, 0x30, 0x1fff) / 2; adv76xx_query_dv_timings()
1523 bt->il_vbackporch = hdmi_read16(sd, 0x34, 0x1fff) / 2; adv76xx_query_dv_timings()
1525 adv76xx_fill_optional_dv_timings_fields(sd, timings); adv76xx_query_dv_timings()
1531 if (!stdi2dv_timings(sd, &stdi, timings)) adv76xx_query_dv_timings()
1534 v4l2_dbg(1, debug, sd, "%s: lcvs + 1 = %d\n", __func__, stdi.lcvs); adv76xx_query_dv_timings()
1535 if (!stdi2dv_timings(sd, &stdi, timings)) adv76xx_query_dv_timings()
1538 v4l2_dbg(1, debug, sd, "%s: lcvs - 1 = %d\n", __func__, stdi.lcvs); adv76xx_query_dv_timings()
1539 if (stdi2dv_timings(sd, &stdi, timings)) { adv76xx_query_dv_timings()
1550 v4l2_dbg(1, debug, sd, "%s: restart STDI\n", __func__); adv76xx_query_dv_timings()
1553 cp_write_clr_set(sd, 0x86, 0x06, 0x00); adv76xx_query_dv_timings()
1555 cp_write_clr_set(sd, 0x86, 0x06, 0x04); adv76xx_query_dv_timings()
1557 cp_write_clr_set(sd, 0x86, 0x06, 0x02); adv76xx_query_dv_timings()
1561 v4l2_dbg(1, debug, sd, "%s: format not supported\n", __func__); adv76xx_query_dv_timings()
1568 if (no_signal(sd)) { adv76xx_query_dv_timings()
1569 v4l2_dbg(1, debug, sd, "%s: signal lost during readout\n", __func__); adv76xx_query_dv_timings()
1574 if ((is_analog_input(sd) && bt->pixelclock > 170000000) || adv76xx_query_dv_timings()
1575 (is_digital_input(sd) && bt->pixelclock > 225000000)) { adv76xx_query_dv_timings()
1576 v4l2_dbg(1, debug, sd, "%s: pixelclock out of range %d\n", adv76xx_query_dv_timings()
1582 v4l2_print_dv_timings(sd->name, "adv76xx_query_dv_timings: ", adv76xx_query_dv_timings()
1588 static int adv76xx_s_dv_timings(struct v4l2_subdev *sd, adv76xx_s_dv_timings() argument
1591 struct adv76xx_state *state = to_state(sd); adv76xx_s_dv_timings()
1599 v4l2_dbg(1, debug, sd, "%s: no change\n", __func__); adv76xx_s_dv_timings()
1605 if ((is_analog_input(sd) && bt->pixelclock > 170000000) || adv76xx_s_dv_timings()
1606 (is_digital_input(sd) && bt->pixelclock > 225000000)) { adv76xx_s_dv_timings()
1607 v4l2_dbg(1, debug, sd, "%s: pixelclock out of range %d\n", adv76xx_s_dv_timings()
1612 adv76xx_fill_optional_dv_timings_fields(sd, timings); adv76xx_s_dv_timings()
1616 cp_write_clr_set(sd, 0x91, 0x40, bt->interlaced ? 0x40 : 0x00); adv76xx_s_dv_timings()
1619 err = configure_predefined_video_timings(sd, timings); adv76xx_s_dv_timings()
1623 configure_custom_video_timings(sd, bt); adv76xx_s_dv_timings()
1626 set_rgb_quantization_range(sd); adv76xx_s_dv_timings()
1629 v4l2_print_dv_timings(sd->name, "adv76xx_s_dv_timings: ", adv76xx_s_dv_timings()
1634 static int adv76xx_g_dv_timings(struct v4l2_subdev *sd, adv76xx_g_dv_timings() argument
1637 struct adv76xx_state *state = to_state(sd); adv76xx_g_dv_timings()
1643 static void adv7604_set_termination(struct v4l2_subdev *sd, bool enable) adv7604_set_termination() argument
1645 hdmi_write(sd, 0x01, enable ? 0x00 : 0x78); adv7604_set_termination()
1648 static void adv7611_set_termination(struct v4l2_subdev *sd, bool enable) adv7611_set_termination() argument
1650 hdmi_write(sd, 0x83, enable ? 0xfe : 0xff); adv7611_set_termination()
1653 static void enable_input(struct v4l2_subdev *sd) enable_input() argument
1655 struct adv76xx_state *state = to_state(sd); enable_input()
1657 if (is_analog_input(sd)) { enable_input()
1658 io_write(sd, 0x15, 0xb0); /* Disable Tristate of Pins (no audio) */ enable_input()
1659 } else if (is_digital_input(sd)) { enable_input()
1660 hdmi_write_clr_set(sd, 0x00, 0x03, state->selected_input); enable_input()
1661 state->info->set_termination(sd, true); enable_input()
1662 io_write(sd, 0x15, 0xa0); /* Disable Tristate of Pins */ enable_input()
1663 hdmi_write_clr_set(sd, 0x1a, 0x10, 0x00); /* Unmute audio */ enable_input()
1665 v4l2_dbg(2, debug, sd, "%s: Unknown port %d selected\n", enable_input()
1670 static void disable_input(struct v4l2_subdev *sd) disable_input() argument
1672 struct adv76xx_state *state = to_state(sd); disable_input()
1674 hdmi_write_clr_set(sd, 0x1a, 0x10, 0x10); /* Mute audio */ disable_input()
1676 io_write(sd, 0x15, 0xbe); /* Tristate all outputs from video core */ disable_input()
1677 state->info->set_termination(sd, false); disable_input()
1680 static void select_input(struct v4l2_subdev *sd) select_input() argument
1682 struct adv76xx_state *state = to_state(sd); select_input()
1685 if (is_analog_input(sd)) { select_input()
1686 adv76xx_write_reg_seq(sd, info->recommended_settings[0]); select_input()
1688 afe_write(sd, 0x00, 0x08); /* power up ADC */ select_input()
1689 afe_write(sd, 0x01, 0x06); /* power up Analog Front End */ select_input()
1690 afe_write(sd, 0xc8, 0x00); /* phase control */ select_input()
1691 } else if (is_digital_input(sd)) { select_input()
1692 hdmi_write(sd, 0x00, state->selected_input & 0x03); select_input()
1694 adv76xx_write_reg_seq(sd, info->recommended_settings[1]); select_input()
1697 afe_write(sd, 0x00, 0xff); /* power down ADC */ select_input()
1698 afe_write(sd, 0x01, 0xfe); /* power down Analog Front End */ select_input()
1699 afe_write(sd, 0xc8, 0x40); /* phase control */ select_input()
1702 cp_write(sd, 0x3e, 0x00); /* CP core pre-gain control */ select_input()
1703 cp_write(sd, 0xc3, 0x39); /* CP coast control. Graphics mode */ select_input()
1704 cp_write(sd, 0x40, 0x80); /* CP core pre-gain control. Graphics mode */ select_input()
1706 v4l2_dbg(2, debug, sd, "%s: Unknown port %d selected\n", select_input()
1711 static int adv76xx_s_routing(struct v4l2_subdev *sd, adv76xx_s_routing() argument
1714 struct adv76xx_state *state = to_state(sd); adv76xx_s_routing()
1716 v4l2_dbg(2, debug, sd, "%s: input %d, selected input %d", adv76xx_s_routing()
1727 disable_input(sd); adv76xx_s_routing()
1729 select_input(sd); adv76xx_s_routing()
1731 enable_input(sd); adv76xx_s_routing()
1736 static int adv76xx_enum_mbus_code(struct v4l2_subdev *sd, adv76xx_enum_mbus_code() argument
1740 struct adv76xx_state *state = to_state(sd); adv76xx_enum_mbus_code()
1804 struct v4l2_subdev *sd = &state->sd; adv76xx_setup_format() local
1806 io_write_clr_set(sd, 0x02, 0x02, adv76xx_setup_format()
1808 io_write(sd, 0x03, state->format->op_format_sel | adv76xx_setup_format()
1810 io_write_clr_set(sd, 0x04, 0xe0, adv76xx_op_ch_sel(state)); adv76xx_setup_format()
1811 io_write_clr_set(sd, 0x05, 0x01, adv76xx_setup_format()
1815 static int adv76xx_get_format(struct v4l2_subdev *sd, adv76xx_get_format() argument
1819 struct adv76xx_state *state = to_state(sd); adv76xx_get_format()
1829 fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); adv76xx_get_format()
1838 static int adv76xx_set_format(struct v4l2_subdev *sd, adv76xx_set_format() argument
1842 struct adv76xx_state *state = to_state(sd); adv76xx_set_format()
1858 fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); adv76xx_set_format()
1868 static int adv76xx_isr(struct v4l2_subdev *sd, u32 status, bool *handled) adv76xx_isr() argument
1870 struct adv76xx_state *state = to_state(sd); adv76xx_isr()
1872 const u8 irq_reg_0x43 = io_read(sd, 0x43); adv76xx_isr()
1873 const u8 irq_reg_0x6b = io_read(sd, 0x6b); adv76xx_isr()
1874 const u8 irq_reg_0x70 = io_read(sd, 0x70); adv76xx_isr()
1880 io_write(sd, 0x44, irq_reg_0x43); adv76xx_isr()
1882 io_write(sd, 0x71, irq_reg_0x70); adv76xx_isr()
1884 io_write(sd, 0x6c, irq_reg_0x6b); adv76xx_isr()
1886 v4l2_dbg(2, debug, sd, "%s: ", __func__); adv76xx_isr()
1890 fmt_change_digital = is_digital_input(sd) adv76xx_isr()
1895 v4l2_dbg(1, debug, sd, adv76xx_isr()
1899 v4l2_subdev_notify(sd, ADV76XX_FMT_CHANGE, NULL); adv76xx_isr()
1906 v4l2_dbg(1, debug, sd, "%s: irq %s mode\n", __func__, adv76xx_isr()
1907 (io_read(sd, 0x6a) & 0x01) ? "HDMI" : "DVI"); adv76xx_isr()
1908 set_rgb_quantization_range(sd); adv76xx_isr()
1916 v4l2_dbg(1, debug, sd, "%s: tx_5v: 0x%x\n", __func__, tx_5v); adv76xx_isr()
1917 adv76xx_s_detect_tx_5v_ctrl(sd); adv76xx_isr()
1924 static int adv76xx_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) adv76xx_get_edid() argument
1926 struct adv76xx_state *state = to_state(sd); adv76xx_get_edid()
1990 static int adv76xx_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) adv76xx_set_edid() argument
1992 struct adv76xx_state *state = to_state(sd); adv76xx_set_edid()
2008 rep_write_clr_set(sd, info->edid_enable_reg, 0x0f, state->edid.present); adv76xx_set_edid()
2017 v4l2_dbg(2, debug, sd, "%s: clear EDID pad %d, edid.present = 0x%x\n", adv76xx_set_edid()
2026 v4l2_dbg(2, debug, sd, "%s: write EDID pad %d, edid.present = 0x%x\n", adv76xx_set_edid()
2032 rep_write_clr_set(sd, info->edid_enable_reg, 0x0f, 0x00); adv76xx_set_edid()
2044 rep_write(sd, 0x70, edid->edid[spa_loc]); adv76xx_set_edid()
2045 rep_write(sd, 0x71, edid->edid[spa_loc + 1]); adv76xx_set_edid()
2048 rep_write(sd, 0x72, edid->edid[spa_loc]); adv76xx_set_edid()
2049 rep_write(sd, 0x73, edid->edid[spa_loc + 1]); adv76xx_set_edid()
2052 rep_write(sd, 0x74, edid->edid[spa_loc]); adv76xx_set_edid()
2053 rep_write(sd, 0x75, edid->edid[spa_loc + 1]); adv76xx_set_edid()
2060 rep_write(sd, 0x76, spa_loc & 0xff); adv76xx_set_edid()
2061 rep_write_clr_set(sd, 0x77, 0x40, (spa_loc & 0x100) >> 2); adv76xx_set_edid()
2064 rep_write_clr_set(sd, 0x71, 0x01, (spa_loc & 0x100) >> 8); adv76xx_set_edid()
2076 err = edid_write_block(sd, 128 * edid->blocks, state->edid.edid); adv76xx_set_edid()
2078 v4l2_err(sd, "error %d writing edid pad %d\n", err, edid->pad); adv76xx_set_edid()
2084 rep_write_clr_set(sd, info->edid_enable_reg, 0x0f, state->edid.present); adv76xx_set_edid()
2087 if (rep_read(sd, info->edid_status_reg) & state->edid.present) adv76xx_set_edid()
2092 v4l2_err(sd, "error enabling edid (0x%x)\n", state->edid.present); adv76xx_set_edid()
2104 static void print_avi_infoframe(struct v4l2_subdev *sd) print_avi_infoframe() argument
2111 if (!is_hdmi(sd)) { print_avi_infoframe()
2112 v4l2_info(sd, "receive DVI-D signal (AVI infoframe not supported)\n"); print_avi_infoframe()
2115 if (!(io_read(sd, 0x60) & 0x01)) { print_avi_infoframe()
2116 v4l2_info(sd, "AVI infoframe not received\n"); print_avi_infoframe()
2120 if (io_read(sd, 0x83) & 0x01) { print_avi_infoframe()
2121 v4l2_info(sd, "AVI infoframe checksum error has occurred earlier\n"); print_avi_infoframe()
2122 io_write(sd, 0x85, 0x01); /* clear AVI_INF_CKS_ERR_RAW */ print_avi_infoframe()
2123 if (io_read(sd, 0x83) & 0x01) { print_avi_infoframe()
2124 v4l2_info(sd, "AVI infoframe checksum error still present\n"); print_avi_infoframe()
2125 io_write(sd, 0x85, 0x01); /* clear AVI_INF_CKS_ERR_RAW */ print_avi_infoframe()
2129 avi_len = infoframe_read(sd, 0xe2); print_avi_infoframe()
2130 avi_ver = infoframe_read(sd, 0xe1); print_avi_infoframe()
2131 v4l2_info(sd, "AVI infoframe version %d (%d byte)\n", print_avi_infoframe()
2138 buf[i] = infoframe_read(sd, i); print_avi_infoframe()
2140 v4l2_info(sd, print_avi_infoframe()
2146 static int adv76xx_log_status(struct v4l2_subdev *sd) adv76xx_log_status() argument
2148 struct adv76xx_state *state = to_state(sd); adv76xx_log_status()
2152 u8 reg_io_0x02 = io_read(sd, 0x02); adv76xx_log_status()
2182 v4l2_info(sd, "-----Chip status-----\n"); adv76xx_log_status()
2183 v4l2_info(sd, "Chip power: %s\n", no_power(sd) ? "off" : "on"); adv76xx_log_status()
2184 edid_enabled = rep_read(sd, info->edid_status_reg); adv76xx_log_status()
2185 v4l2_info(sd, "EDID enabled port A: %s, B: %s, C: %s, D: %s\n", adv76xx_log_status()
2190 v4l2_info(sd, "CEC: %s\n", !!(cec_read(sd, 0x2a) & 0x01) ? adv76xx_log_status()
2193 v4l2_info(sd, "-----Signal status-----\n"); adv76xx_log_status()
2194 cable_det = info->read_cable_det(sd); adv76xx_log_status()
2195 v4l2_info(sd, "Cable detected (+5V power) port A: %s, B: %s, C: %s, D: %s\n", adv76xx_log_status()
2200 v4l2_info(sd, "TMDS signal detected: %s\n", adv76xx_log_status()
2201 no_signal_tmds(sd) ? "false" : "true"); adv76xx_log_status()
2202 v4l2_info(sd, "TMDS signal locked: %s\n", adv76xx_log_status()
2203 no_lock_tmds(sd) ? "false" : "true"); adv76xx_log_status()
2204 v4l2_info(sd, "SSPD locked: %s\n", no_lock_sspd(sd) ? "false" : "true"); adv76xx_log_status()
2205 v4l2_info(sd, "STDI locked: %s\n", no_lock_stdi(sd) ? "false" : "true"); adv76xx_log_status()
2206 v4l2_info(sd, "CP locked: %s\n", no_lock_cp(sd) ? "false" : "true"); adv76xx_log_status()
2207 v4l2_info(sd, "CP free run: %s\n", adv76xx_log_status()
2208 (in_free_run(sd)) ? "on" : "off"); adv76xx_log_status()
2209 v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x, v_freq = 0x%x\n", adv76xx_log_status()
2210 io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f, adv76xx_log_status()
2211 (io_read(sd, 0x01) & 0x70) >> 4); adv76xx_log_status()
2213 v4l2_info(sd, "-----Video Timings-----\n"); adv76xx_log_status()
2214 if (read_stdi(sd, &stdi)) adv76xx_log_status()
2215 v4l2_info(sd, "STDI: not locked\n"); adv76xx_log_status()
2217 v4l2_info(sd, "STDI: lcf (frame height - 1) = %d, bl = %d, lcvs (vsync) = %d, %s, %chsync, %cvsync\n", adv76xx_log_status()
2221 if (adv76xx_query_dv_timings(sd, &timings)) adv76xx_log_status()
2222 v4l2_info(sd, "No video detected\n"); adv76xx_log_status()
2224 v4l2_print_dv_timings(sd->name, "Detected format: ", adv76xx_log_status()
2226 v4l2_print_dv_timings(sd->name, "Configured format: ", adv76xx_log_status()
2229 if (no_signal(sd)) adv76xx_log_status()
2232 v4l2_info(sd, "-----Color space-----\n"); adv76xx_log_status()
2233 v4l2_info(sd, "RGB quantization range ctrl: %s\n", adv76xx_log_status()
2235 v4l2_info(sd, "Input color space: %s\n", adv76xx_log_status()
2237 v4l2_info(sd, "Output color space: %s %s, saturator %s\n", adv76xx_log_status()
2242 v4l2_info(sd, "Color space conversion: %s\n", adv76xx_log_status()
2243 csc_coeff_sel_rb[cp_read(sd, info->cp_csc) >> 4]); adv76xx_log_status()
2245 if (!is_digital_input(sd)) adv76xx_log_status()
2248 v4l2_info(sd, "-----%s status-----\n", is_hdmi(sd) ? "HDMI" : "DVI-D"); adv76xx_log_status()
2249 v4l2_info(sd, "Digital video port selected: %c\n", adv76xx_log_status()
2250 (hdmi_read(sd, 0x00) & 0x03) + 'A'); adv76xx_log_status()
2251 v4l2_info(sd, "HDCP encrypted content: %s\n", adv76xx_log_status()
2252 (hdmi_read(sd, 0x05) & 0x40) ? "true" : "false"); adv76xx_log_status()
2253 v4l2_info(sd, "HDCP keys read: %s%s\n", adv76xx_log_status()
2254 (hdmi_read(sd, 0x04) & 0x20) ? "yes" : "no", adv76xx_log_status()
2255 (hdmi_read(sd, 0x04) & 0x10) ? "ERROR" : ""); adv76xx_log_status()
2256 if (is_hdmi(sd)) { adv76xx_log_status()
2257 bool audio_pll_locked = hdmi_read(sd, 0x04) & 0x01; adv76xx_log_status()
2258 bool audio_sample_packet_detect = hdmi_read(sd, 0x18) & 0x01; adv76xx_log_status()
2259 bool audio_mute = io_read(sd, 0x65) & 0x40; adv76xx_log_status()
2261 v4l2_info(sd, "Audio: pll %s, samples %s, %s\n", adv76xx_log_status()
2266 v4l2_info(sd, "Audio format: %s\n", adv76xx_log_status()
2267 (hdmi_read(sd, 0x07) & 0x20) ? "multi-channel" : "stereo"); adv76xx_log_status()
2269 v4l2_info(sd, "Audio CTS: %u\n", (hdmi_read(sd, 0x5b) << 12) + adv76xx_log_status()
2270 (hdmi_read(sd, 0x5c) << 8) + adv76xx_log_status()
2271 (hdmi_read(sd, 0x5d) & 0xf0)); adv76xx_log_status()
2272 v4l2_info(sd, "Audio N: %u\n", ((hdmi_read(sd, 0x5d) & 0x0f) << 16) + adv76xx_log_status()
2273 (hdmi_read(sd, 0x5e) << 8) + adv76xx_log_status()
2274 hdmi_read(sd, 0x5f)); adv76xx_log_status()
2275 v4l2_info(sd, "AV Mute: %s\n", (hdmi_read(sd, 0x04) & 0x40) ? "on" : "off"); adv76xx_log_status()
2277 v4l2_info(sd, "Deep color mode: %s\n", deep_color_mode_txt[(hdmi_read(sd, 0x0b) & 0x60) >> 5]); adv76xx_log_status()
2279 print_avi_infoframe(sd); adv76xx_log_status()
2361 static int adv76xx_core_init(struct v4l2_subdev *sd) adv76xx_core_init() argument
2363 struct adv76xx_state *state = to_state(sd); adv76xx_core_init()
2367 hdmi_write(sd, 0x48, adv76xx_core_init()
2371 disable_input(sd); adv76xx_core_init()
2376 select_input(sd); adv76xx_core_init()
2377 enable_input(sd); adv76xx_core_init()
2381 io_write(sd, 0x0c, 0x42); /* Power up part and power down VDP */ adv76xx_core_init()
2382 io_write(sd, 0x0b, 0x44); /* Power down ESDP block */ adv76xx_core_init()
2383 cp_write(sd, 0xcf, 0x01); /* Power down macrovision */ adv76xx_core_init()
2386 io_write_clr_set(sd, 0x02, 0x0f, adv76xx_core_init()
2390 io_write_clr_set(sd, 0x05, 0x0e, pdata->blank_data << 3 | adv76xx_core_init()
2395 cp_write(sd, 0x69, 0x30); /* Enable CP CSC */ adv76xx_core_init()
2398 io_write(sd, 0x06, 0xa0 | pdata->inv_vs_pol << 2 | adv76xx_core_init()
2402 io_write(sd, 0x14, 0x40 | pdata->dr_str_data << 4 | adv76xx_core_init()
2406 cp_write(sd, 0xba, (pdata->hdmi_free_run_mode << 1) | 0x01); /* HDMI free run */ adv76xx_core_init()
2407 cp_write(sd, 0xf3, 0xdc); /* Low threshold to enter/exit free run mode */ adv76xx_core_init()
2408 cp_write(sd, 0xf9, 0x23); /* STDI ch. 1 - LCVS change threshold - adv76xx_core_init()
2410 cp_write(sd, 0x45, 0x23); /* STDI ch. 2 - LCVS change threshold - adv76xx_core_init()
2412 cp_write(sd, 0xc9, 0x2d); /* use prim_mode and vid_std as free run resolution adv76xx_core_init()
2416 hdmi_write_clr_set(sd, 0x15, 0x03, 0x03); /* Mute on FIFO over-/underflow [REF_01, c. 1.2.18] */ adv76xx_core_init()
2417 hdmi_write_clr_set(sd, 0x1a, 0x0e, 0x08); /* Wait 1 s before unmute */ adv76xx_core_init()
2418 hdmi_write_clr_set(sd, 0x68, 0x06, 0x06); /* FIFO reset on over-/underflow [REF_01, c. 1.2.19] */ adv76xx_core_init()
2421 afe_write(sd, 0xb5, 0x01); /* Setting MCLK to 256Fs */ adv76xx_core_init()
2424 afe_write(sd, 0x02, pdata->ain_sel); /* Select analog input muxing mode */ adv76xx_core_init()
2425 io_write_clr_set(sd, 0x30, 1 << 4, pdata->output_bus_lsb_to_msb << 4); adv76xx_core_init()
2429 io_write(sd, 0x40, 0xc0 | pdata->int1_config); /* Configure INT1 */ adv76xx_core_init()
2430 io_write(sd, 0x46, 0x98); /* Enable SSPD, STDI and CP unlocked interrupts */ adv76xx_core_init()
2431 io_write(sd, 0x6e, info->fmt_change_digital_mask); /* Enable V_LOCKED and DE_REGEN_LCK interrupts */ adv76xx_core_init()
2432 io_write(sd, 0x73, info->cable_det_mask); /* Enable cable detection (+5v) interrupts */ adv76xx_core_init()
2433 info->setup_irqs(sd); adv76xx_core_init()
2435 return v4l2_ctrl_handler_setup(sd->ctrl_handler); adv76xx_core_init()
2438 static void adv7604_setup_irqs(struct v4l2_subdev *sd) adv7604_setup_irqs() argument
2440 io_write(sd, 0x41, 0xd7); /* STDI irq for any change, disable INT2 */ adv7604_setup_irqs()
2443 static void adv7611_setup_irqs(struct v4l2_subdev *sd) adv7611_setup_irqs() argument
2445 io_write(sd, 0x41, 0xd0); /* STDI irq for any change, disable INT2 */ adv7611_setup_irqs()
2458 static struct i2c_client *adv76xx_dummy_client(struct v4l2_subdev *sd, adv76xx_dummy_client() argument
2461 struct i2c_client *client = v4l2_get_subdevdata(sd); adv76xx_dummy_client()
2464 io_write(sd, io_reg, addr << 1); adv76xx_dummy_client()
2465 return i2c_new_dummy(client->adapter, io_read(sd, io_reg) >> 1); adv76xx_dummy_client()
2683 struct v4l2_subdev *sd; adv76xx_probe() local
2742 sd = &state->sd; adv76xx_probe()
2743 v4l2_i2c_subdev_init(sd, client, &adv76xx_ops); adv76xx_probe()
2744 snprintf(sd->name, sizeof(sd->name), "%s %d-%04x", adv76xx_probe()
2747 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; adv76xx_probe()
2757 v4l2_info(sd, "not an adv7604 on address 0x%x\n", adv76xx_probe()
2765 v4l2_info(sd, "not an adv7611 on address 0x%x\n", adv76xx_probe()
2802 sd->ctrl_handler = hdl; adv76xx_probe()
2814 if (adv76xx_s_detect_tx_5v_ctrl(sd)) { adv76xx_probe()
2824 adv76xx_dummy_client(sd, state->pdata.i2c_addresses[i], adv76xx_probe()
2828 v4l2_err(sd, "failed to create i2c client %u\n", i); adv76xx_probe()
2836 v4l2_err(sd, "Could not create work queue\n"); adv76xx_probe()
2850 err = media_entity_init(&sd->entity, state->source_pad + 1, adv76xx_probe()
2855 err = adv76xx_core_init(sd); adv76xx_probe()
2858 v4l2_info(sd, "%s found @ 0x%x (%s)\n", client->name, adv76xx_probe()
2861 err = v4l2_async_register_subdev(sd); adv76xx_probe()
2868 media_entity_cleanup(&sd->entity); adv76xx_probe()
2883 struct v4l2_subdev *sd = i2c_get_clientdata(client); adv76xx_remove() local
2884 struct adv76xx_state *state = to_state(sd); adv76xx_remove()
2888 v4l2_async_unregister_subdev(sd); adv76xx_remove()
2889 media_entity_cleanup(&sd->entity); adv76xx_remove()
2890 adv76xx_unregister_clients(to_state(sd)); adv76xx_remove()
2891 v4l2_ctrl_handler_free(sd->ctrl_handler); adv76xx_remove()
H A Dwm8775.c57 struct v4l2_subdev sd; member in struct:wm8775_state
66 static inline struct wm8775_state *to_state(struct v4l2_subdev *sd) to_state() argument
68 return container_of(sd, struct wm8775_state, sd); to_state()
73 return &container_of(ctrl->handler, struct wm8775_state, hdl)->sd; to_sd()
76 static int wm8775_write(struct v4l2_subdev *sd, int reg, u16 val) wm8775_write() argument
78 struct i2c_client *client = v4l2_get_subdevdata(sd); wm8775_write()
82 v4l2_err(sd, "Invalid register R%d\n", reg); wm8775_write()
90 v4l2_err(sd, "I2C: cannot write %03x to register R%d\n", val, reg); wm8775_write()
94 static void wm8775_set_audio(struct v4l2_subdev *sd, int quietly) wm8775_set_audio() argument
96 struct wm8775_state *state = to_state(sd); wm8775_set_audio()
108 wm8775_write(sd, R21, 0x0c0 | state->input); wm8775_set_audio()
110 wm8775_write(sd, R14, vol_l | 0x100); /* 0x100= Left channel ADC zero cross enable */ wm8775_set_audio()
111 wm8775_write(sd, R15, vol_r | 0x100); /* 0x100= Right channel ADC zero cross enable */ wm8775_set_audio()
115 wm8775_write(sd, R21, state->input); wm8775_set_audio()
118 static int wm8775_s_routing(struct v4l2_subdev *sd, wm8775_s_routing() argument
121 struct wm8775_state *state = to_state(sd); wm8775_s_routing()
129 v4l2_err(sd, "Invalid input %d.\n", input); wm8775_s_routing()
137 wm8775_set_audio(sd, 1); wm8775_s_routing()
143 struct v4l2_subdev *sd = to_sd(ctrl); wm8775_s_ctrl() local
149 wm8775_set_audio(sd, 0); wm8775_s_ctrl()
152 wm8775_write(sd, R17, (ctrl->val ? ALC_EN : 0) | ALC_HOLD); wm8775_s_ctrl()
158 static int wm8775_log_status(struct v4l2_subdev *sd) wm8775_log_status() argument
160 struct wm8775_state *state = to_state(sd); wm8775_log_status()
162 v4l2_info(sd, "Input: %d\n", state->input); wm8775_log_status()
163 v4l2_ctrl_handler_log_status(&state->hdl, sd->name); wm8775_log_status()
167 static int wm8775_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *freq) wm8775_s_frequency() argument
169 wm8775_set_audio(sd, 0); wm8775_s_frequency()
217 struct v4l2_subdev *sd; wm8775_probe() local
236 sd = &state->sd; wm8775_probe()
237 v4l2_i2c_subdev_init(sd, client, &wm8775_ops); wm8775_probe()
249 sd->ctrl_handler = &state->hdl; wm8775_probe()
259 wm8775_write(sd, R23, 0x000); wm8775_probe()
261 wm8775_write(sd, R7, 0x000); wm8775_probe()
263 wm8775_write(sd, R11, 0x021); wm8775_probe()
265 wm8775_write(sd, R12, 0x102); wm8775_probe()
267 wm8775_write(sd, R13, 0x000); wm8775_probe()
271 wm8775_write(sd, R14, 0x1d4); wm8775_probe()
273 wm8775_write(sd, R15, 0x1d4); wm8775_probe()
275 wm8775_write(sd, R16, 0x1bf); wm8775_probe()
278 wm8775_write(sd, R17, 0x185); wm8775_probe()
281 wm8775_write(sd, R16, 0x1bb); wm8775_probe()
283 wm8775_write(sd, R17, (state->loud->val ? ALC_EN : 0) | ALC_HOLD); wm8775_probe()
286 wm8775_write(sd, R18, 0x0a2); wm8775_probe()
288 wm8775_write(sd, R19, 0x005); wm8775_probe()
291 wm8775_write(sd, R20, 0x07a); wm8775_probe()
293 wm8775_write(sd, R21, 0x102); wm8775_probe()
296 wm8775_write(sd, R20, 0x0fb); wm8775_probe()
298 wm8775_set_audio(sd, 1); /* set volume/mute/mux */ wm8775_probe()
305 struct v4l2_subdev *sd = i2c_get_clientdata(client); wm8775_remove() local
306 struct wm8775_state *state = to_state(sd); wm8775_remove()
308 v4l2_device_unregister_subdev(sd); wm8775_remove()
H A Dtlv320aic23b.c44 struct v4l2_subdev sd; member in struct:tlv320aic23b_state
48 static inline struct tlv320aic23b_state *to_state(struct v4l2_subdev *sd) to_state() argument
50 return container_of(sd, struct tlv320aic23b_state, sd); to_state()
55 return &container_of(ctrl->handler, struct tlv320aic23b_state, hdl)->sd; to_sd()
58 static int tlv320aic23b_write(struct v4l2_subdev *sd, int reg, u16 val) tlv320aic23b_write() argument
60 struct i2c_client *client = v4l2_get_subdevdata(sd); tlv320aic23b_write()
64 v4l2_err(sd, "Invalid register R%d\n", reg); tlv320aic23b_write()
72 v4l2_err(sd, "I2C: cannot write %03x to register R%d\n", val, reg); tlv320aic23b_write()
76 static int tlv320aic23b_s_clock_freq(struct v4l2_subdev *sd, u32 freq) tlv320aic23b_s_clock_freq() argument
80 tlv320aic23b_write(sd, 8, 0x018); tlv320aic23b_s_clock_freq()
83 tlv320aic23b_write(sd, 8, 0x022); tlv320aic23b_s_clock_freq()
86 tlv320aic23b_write(sd, 8, 0x000); tlv320aic23b_s_clock_freq()
96 struct v4l2_subdev *sd = to_sd(ctrl); tlv320aic23b_s_ctrl() local
100 tlv320aic23b_write(sd, 0, 0x180); /* mute both channels */ tlv320aic23b_s_ctrl()
103 tlv320aic23b_write(sd, 0, 0x119); tlv320aic23b_s_ctrl()
109 static int tlv320aic23b_log_status(struct v4l2_subdev *sd) tlv320aic23b_log_status() argument
111 struct tlv320aic23b_state *state = to_state(sd); tlv320aic23b_log_status()
113 v4l2_ctrl_handler_log_status(&state->hdl, sd->name); tlv320aic23b_log_status()
156 struct v4l2_subdev *sd; tlv320aic23b_probe() local
168 sd = &state->sd; tlv320aic23b_probe()
169 v4l2_i2c_subdev_init(sd, client, &tlv320aic23b_ops); tlv320aic23b_probe()
174 tlv320aic23b_write(sd, 15, 0x000); tlv320aic23b_probe()
176 tlv320aic23b_write(sd, 6, 0x00A); tlv320aic23b_probe()
178 tlv320aic23b_write(sd, 7, 0x049); tlv320aic23b_probe()
180 tlv320aic23b_write(sd, 0, 0x119); tlv320aic23b_probe()
182 tlv320aic23b_write(sd, 8, 0x000); tlv320aic23b_probe()
184 tlv320aic23b_write(sd, 9, 0x001); tlv320aic23b_probe()
189 sd->ctrl_handler = &state->hdl; tlv320aic23b_probe()
202 struct v4l2_subdev *sd = i2c_get_clientdata(client); tlv320aic23b_remove() local
203 struct tlv320aic23b_state *state = to_state(sd); tlv320aic23b_remove()
205 v4l2_device_unregister_subdev(sd); tlv320aic23b_remove()
H A Dtw9906.c31 struct v4l2_subdev sd; member in struct:tw9906
36 static inline struct tw9906 *to_state(struct v4l2_subdev *sd) to_state() argument
38 return container_of(sd, struct tw9906, sd); to_state()
73 static int write_reg(struct v4l2_subdev *sd, u8 reg, u8 value) write_reg() argument
75 struct i2c_client *client = v4l2_get_subdevdata(sd); write_reg()
80 static int write_regs(struct v4l2_subdev *sd, const u8 *regs) write_regs() argument
85 if (write_reg(sd, regs[i], regs[i + 1]) < 0) write_regs()
90 static int tw9906_s_video_routing(struct v4l2_subdev *sd, u32 input, tw9906_s_video_routing() argument
93 write_reg(sd, 0x02, 0x40 | (input << 1)); tw9906_s_video_routing()
97 static int tw9906_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) tw9906_s_std() argument
99 struct tw9906 *dec = to_state(sd); tw9906_s_std()
116 write_regs(sd, is_60hz ? config_60hz : config_50hz); tw9906_s_std()
124 struct v4l2_subdev *sd = &dec->sd; tw9906_s_ctrl() local
128 write_reg(sd, 0x10, ctrl->val); tw9906_s_ctrl()
131 write_reg(sd, 0x11, ctrl->val); tw9906_s_ctrl()
134 write_reg(sd, 0x15, ctrl->val); tw9906_s_ctrl()
142 static int tw9906_log_status(struct v4l2_subdev *sd) tw9906_log_status() argument
144 struct tw9906 *dec = to_state(sd); tw9906_log_status()
147 v4l2_info(sd, "Standard: %d Hz\n", is_60hz ? 60 : 50); tw9906_log_status()
148 v4l2_ctrl_subdev_log_status(sd); tw9906_log_status()
176 struct v4l2_subdev *sd; tw9906_probe() local
189 sd = &dec->sd; tw9906_probe()
190 v4l2_i2c_subdev_init(sd, client, &tw9906_ops); tw9906_probe()
199 sd->ctrl_handler = hdl; tw9906_probe()
210 if (write_regs(sd, initial_registers) < 0) { tw9906_probe()
220 struct v4l2_subdev *sd = i2c_get_clientdata(client); tw9906_remove() local
222 v4l2_device_unregister_subdev(sd); tw9906_remove()
223 v4l2_ctrl_handler_free(&to_state(sd)->hdl); tw9906_remove()
H A Dmt9v011.c52 struct v4l2_subdev sd; member in struct:mt9v011
63 static inline struct mt9v011 *to_mt9v011(struct v4l2_subdev *sd) to_mt9v011() argument
65 return container_of(sd, struct mt9v011, sd); to_mt9v011()
68 static int mt9v011_read(struct v4l2_subdev *sd, unsigned char addr) mt9v011_read() argument
70 struct i2c_client *c = v4l2_get_subdevdata(sd); mt9v011_read()
76 v4l2_dbg(0, debug, sd, mt9v011_read()
83 v4l2_dbg(0, debug, sd, mt9v011_read()
88 v4l2_dbg(2, debug, sd, "mt9v011: read 0x%02x = 0x%04x\n", addr, val); mt9v011_read()
93 static void mt9v011_write(struct v4l2_subdev *sd, unsigned char addr, mt9v011_write() argument
96 struct i2c_client *c = v4l2_get_subdevdata(sd); mt9v011_write()
104 v4l2_dbg(2, debug, sd, mt9v011_write()
108 v4l2_dbg(0, debug, sd, mt9v011_write()
173 static void set_balance(struct v4l2_subdev *sd) set_balance() argument
175 struct mt9v011 *core = to_mt9v011(sd); set_balance()
192 mt9v011_write(sd, R2B_MT9V011_GREEN_1_GAIN, green_gain); set_balance()
193 mt9v011_write(sd, R2E_MT9V011_GREEN_2_GAIN, green_gain); set_balance()
194 mt9v011_write(sd, R2C_MT9V011_BLUE_GAIN, blue_gain); set_balance()
195 mt9v011_write(sd, R2D_MT9V011_RED_GAIN, red_gain); set_balance()
196 mt9v011_write(sd, R09_MT9V011_SHUTTER_WIDTH, exposure); set_balance()
199 static void calc_fps(struct v4l2_subdev *sd, u32 *numerator, u32 *denominator) calc_fps() argument
201 struct mt9v011 *core = to_mt9v011(sd); calc_fps()
207 height = mt9v011_read(sd, R03_MT9V011_HEIGHT); calc_fps()
208 width = mt9v011_read(sd, R04_MT9V011_WIDTH); calc_fps()
209 hblank = mt9v011_read(sd, R05_MT9V011_HBLANK); calc_fps()
210 vblank = mt9v011_read(sd, R06_MT9V011_VBLANK); calc_fps()
211 speed = mt9v011_read(sd, R0A_MT9V011_CLK_SPEED); calc_fps()
220 v4l2_dbg(1, debug, sd, "Programmed to %u.%03u fps (%d pixel clcks)\n", calc_fps()
229 static u16 calc_speed(struct v4l2_subdev *sd, u32 numerator, u32 denominator) calc_speed() argument
231 struct mt9v011 *core = to_mt9v011(sd); calc_speed()
240 height = mt9v011_read(sd, R03_MT9V011_HEIGHT); calc_speed()
241 width = mt9v011_read(sd, R04_MT9V011_WIDTH); calc_speed()
242 hblank = mt9v011_read(sd, R05_MT9V011_HBLANK); calc_speed()
243 vblank = mt9v011_read(sd, R06_MT9V011_VBLANK); calc_speed()
269 static void set_res(struct v4l2_subdev *sd) set_res() argument
271 struct mt9v011 *core = to_mt9v011(sd); set_res()
286 mt9v011_write(sd, R02_MT9V011_COLSTART, hstart); set_res()
287 mt9v011_write(sd, R04_MT9V011_WIDTH, core->width); set_res()
288 mt9v011_write(sd, R05_MT9V011_HBLANK, 771 - core->width); set_res()
291 mt9v011_write(sd, R01_MT9V011_ROWSTART, vstart); set_res()
292 mt9v011_write(sd, R03_MT9V011_HEIGHT, core->height); set_res()
293 mt9v011_write(sd, R06_MT9V011_VBLANK, 508 - core->height); set_res()
295 calc_fps(sd, NULL, NULL); set_res()
298 static void set_read_mode(struct v4l2_subdev *sd) set_read_mode() argument
300 struct mt9v011 *core = to_mt9v011(sd); set_read_mode()
309 mt9v011_write(sd, R20_MT9V011_READ_MODE, mode); set_read_mode()
312 static int mt9v011_reset(struct v4l2_subdev *sd, u32 val) mt9v011_reset() argument
317 mt9v011_write(sd, mt9v011_init_default[i].reg, mt9v011_reset()
320 set_balance(sd); mt9v011_reset()
321 set_res(sd); mt9v011_reset()
322 set_read_mode(sd); mt9v011_reset()
327 static int mt9v011_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index, mt9v011_enum_mbus_fmt() argument
337 static int mt9v011_try_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) mt9v011_try_mbus_fmt() argument
350 static int mt9v011_g_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) mt9v011_g_parm() argument
359 calc_fps(sd, mt9v011_g_parm()
366 static int mt9v011_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) mt9v011_s_parm() argument
377 speed = calc_speed(sd, tpf->numerator, tpf->denominator); mt9v011_s_parm()
379 mt9v011_write(sd, R0A_MT9V011_CLK_SPEED, speed); mt9v011_s_parm()
380 v4l2_dbg(1, debug, sd, "Setting speed to %d\n", speed); mt9v011_s_parm()
383 calc_fps(sd, &tpf->numerator, &tpf->denominator); mt9v011_s_parm()
388 static int mt9v011_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) mt9v011_s_mbus_fmt() argument
390 struct mt9v011 *core = to_mt9v011(sd); mt9v011_s_mbus_fmt()
393 rc = mt9v011_try_mbus_fmt(sd, fmt); mt9v011_s_mbus_fmt()
400 set_res(sd); mt9v011_s_mbus_fmt()
406 static int mt9v011_g_register(struct v4l2_subdev *sd, mt9v011_g_register() argument
409 reg->val = mt9v011_read(sd, reg->reg & 0xff); mt9v011_g_register()
415 static int mt9v011_s_register(struct v4l2_subdev *sd, mt9v011_s_register() argument
418 mt9v011_write(sd, reg->reg & 0xff, reg->val & 0xffff); mt9v011_s_register()
428 struct v4l2_subdev *sd = &core->sd; mt9v011_s_ctrl() local
445 set_read_mode(sd); mt9v011_s_ctrl()
449 set_read_mode(sd); mt9v011_s_ctrl()
455 set_balance(sd); mt9v011_s_ctrl()
494 struct v4l2_subdev *sd; mt9v011_probe() local
505 sd = &core->sd; mt9v011_probe()
506 v4l2_i2c_subdev_init(sd, c, &mt9v011_ops); mt9v011_probe()
509 version = mt9v011_read(sd, R00_MT9V011_CHIP_VERSION); mt9v011_probe()
512 v4l2_info(sd, "*** unknown micron chip detected (0x%04x).\n", mt9v011_probe()
534 v4l2_err(sd, "control initialization error %d\n", ret); mt9v011_probe()
538 core->sd.ctrl_handler = &core->ctrls; mt9v011_probe()
550 v4l2_dbg(1, debug, sd, "xtal set to %d.%03d MHz\n", mt9v011_probe()
562 struct v4l2_subdev *sd = i2c_get_clientdata(c); mt9v011_remove() local
563 struct mt9v011 *core = to_mt9v011(sd); mt9v011_remove()
565 v4l2_dbg(1, debug, sd, mt9v011_remove()
569 v4l2_device_unregister_subdev(sd); mt9v011_remove()
H A Dtvp5150.c36 struct v4l2_subdev sd; member in struct:tvp5150
46 static inline struct tvp5150 *to_tvp5150(struct v4l2_subdev *sd) to_tvp5150() argument
48 return container_of(sd, struct tvp5150, sd); to_tvp5150()
53 return &container_of(ctrl->handler, struct tvp5150, hdl)->sd; to_sd()
56 static int tvp5150_read(struct v4l2_subdev *sd, unsigned char addr) tvp5150_read() argument
58 struct i2c_client *c = v4l2_get_subdevdata(sd); tvp5150_read()
63 v4l2_err(sd, "i2c i/o error: rc == %d\n", rc); tvp5150_read()
67 v4l2_dbg(2, debug, sd, "tvp5150: read 0x%02x = 0x%02x\n", addr, rc); tvp5150_read()
72 static inline void tvp5150_write(struct v4l2_subdev *sd, unsigned char addr, tvp5150_write() argument
75 struct i2c_client *c = v4l2_get_subdevdata(sd); tvp5150_write()
78 v4l2_dbg(2, debug, sd, "tvp5150: writing 0x%02x 0x%02x\n", addr, value); tvp5150_write()
81 v4l2_dbg(0, debug, sd, "i2c i/o error: rc == %d\n", rc); tvp5150_write()
84 static void dump_reg_range(struct v4l2_subdev *sd, char *s, u8 init, dump_reg_range() argument
95 printk("%02x ", tvp5150_read(sd, init)); dump_reg_range()
103 static int tvp5150_log_status(struct v4l2_subdev *sd) tvp5150_log_status() argument
106 tvp5150_read(sd, TVP5150_VD_IN_SRC_SEL_1)); tvp5150_log_status()
108 tvp5150_read(sd, TVP5150_ANAL_CHL_CTL)); tvp5150_log_status()
110 tvp5150_read(sd, TVP5150_OP_MODE_CTL)); tvp5150_log_status()
112 tvp5150_read(sd, TVP5150_MISC_CTL)); tvp5150_log_status()
114 tvp5150_read(sd, TVP5150_AUTOSW_MSK)); tvp5150_log_status()
116 tvp5150_read(sd, TVP5150_COLOR_KIL_THSH_CTL)); tvp5150_log_status()
118 tvp5150_read(sd, TVP5150_LUMA_PROC_CTL_1), tvp5150_log_status()
119 tvp5150_read(sd, TVP5150_LUMA_PROC_CTL_2), tvp5150_log_status()
120 tvp5150_read(sd, TVP5150_LUMA_PROC_CTL_3)); tvp5150_log_status()
122 tvp5150_read(sd, TVP5150_BRIGHT_CTL)); tvp5150_log_status()
124 tvp5150_read(sd, TVP5150_SATURATION_CTL)); tvp5150_log_status()
126 tvp5150_read(sd, TVP5150_HUE_CTL)); tvp5150_log_status()
128 tvp5150_read(sd, TVP5150_CONTRAST_CTL)); tvp5150_log_status()
130 tvp5150_read(sd, TVP5150_DATA_RATE_SEL)); tvp5150_log_status()
132 tvp5150_read(sd, TVP5150_CONF_SHARED_PIN)); tvp5150_log_status()
134 tvp5150_read(sd, TVP5150_ACT_VD_CROP_ST_MSB), tvp5150_log_status()
135 tvp5150_read(sd, TVP5150_ACT_VD_CROP_ST_LSB)); tvp5150_log_status()
137 tvp5150_read(sd, TVP5150_ACT_VD_CROP_STP_MSB), tvp5150_log_status()
138 tvp5150_read(sd, TVP5150_ACT_VD_CROP_STP_LSB)); tvp5150_log_status()
140 tvp5150_read(sd, TVP5150_GENLOCK)); tvp5150_log_status()
142 tvp5150_read(sd, TVP5150_HORIZ_SYNC_START)); tvp5150_log_status()
144 tvp5150_read(sd, TVP5150_VERT_BLANKING_START)); tvp5150_log_status()
146 tvp5150_read(sd, TVP5150_VERT_BLANKING_STOP)); tvp5150_log_status()
148 tvp5150_read(sd, TVP5150_CHROMA_PROC_CTL_1), tvp5150_log_status()
149 tvp5150_read(sd, TVP5150_CHROMA_PROC_CTL_2)); tvp5150_log_status()
151 tvp5150_read(sd, TVP5150_INT_RESET_REG_B)); tvp5150_log_status()
153 tvp5150_read(sd, TVP5150_INT_ENABLE_REG_B)); tvp5150_log_status()
155 tvp5150_read(sd, TVP5150_INTT_CONFIG_REG_B)); tvp5150_log_status()
157 tvp5150_read(sd, TVP5150_VIDEO_STD)); tvp5150_log_status()
159 tvp5150_read(sd, TVP5150_CB_GAIN_FACT), tvp5150_log_status()
160 tvp5150_read(sd, TVP5150_CR_GAIN_FACTOR)); tvp5150_log_status()
162 tvp5150_read(sd, TVP5150_MACROVISION_ON_CTR)); tvp5150_log_status()
164 tvp5150_read(sd, TVP5150_MACROVISION_OFF_CTR)); tvp5150_log_status()
166 (tvp5150_read(sd, TVP5150_REV_SELECT) & 1) ? 3 : 4); tvp5150_log_status()
168 tvp5150_read(sd, TVP5150_MSB_DEV_ID), tvp5150_log_status()
169 tvp5150_read(sd, TVP5150_LSB_DEV_ID)); tvp5150_log_status()
171 tvp5150_read(sd, TVP5150_ROM_MAJOR_VER), tvp5150_log_status()
172 tvp5150_read(sd, TVP5150_ROM_MINOR_VER)); tvp5150_log_status()
174 tvp5150_read(sd, TVP5150_VERT_LN_COUNT_MSB), tvp5150_log_status()
175 tvp5150_read(sd, TVP5150_VERT_LN_COUNT_LSB)); tvp5150_log_status()
177 tvp5150_read(sd, TVP5150_INT_STATUS_REG_B)); tvp5150_log_status()
179 tvp5150_read(sd, TVP5150_INT_ACTIVE_REG_B)); tvp5150_log_status()
181 tvp5150_read(sd, TVP5150_STATUS_REG_1), tvp5150_log_status()
182 tvp5150_read(sd, TVP5150_STATUS_REG_2), tvp5150_log_status()
183 tvp5150_read(sd, TVP5150_STATUS_REG_3), tvp5150_log_status()
184 tvp5150_read(sd, TVP5150_STATUS_REG_4), tvp5150_log_status()
185 tvp5150_read(sd, TVP5150_STATUS_REG_5)); tvp5150_log_status()
187 dump_reg_range(sd, "Teletext filter 1", TVP5150_TELETEXT_FIL1_INI, tvp5150_log_status()
189 dump_reg_range(sd, "Teletext filter 2", TVP5150_TELETEXT_FIL2_INI, tvp5150_log_status()
193 tvp5150_read(sd, TVP5150_TELETEXT_FIL_ENA)); tvp5150_log_status()
195 tvp5150_read(sd, TVP5150_INT_STATUS_REG_A)); tvp5150_log_status()
197 tvp5150_read(sd, TVP5150_INT_ENABLE_REG_A)); tvp5150_log_status()
199 tvp5150_read(sd, TVP5150_INT_CONF)); tvp5150_log_status()
201 tvp5150_read(sd, TVP5150_VDP_STATUS_REG)); tvp5150_log_status()
203 tvp5150_read(sd, TVP5150_FIFO_WORD_COUNT)); tvp5150_log_status()
205 tvp5150_read(sd, TVP5150_FIFO_INT_THRESHOLD)); tvp5150_log_status()
207 tvp5150_read(sd, TVP5150_FIFO_RESET)); tvp5150_log_status()
209 tvp5150_read(sd, TVP5150_LINE_NUMBER_INT)); tvp5150_log_status()
211 tvp5150_read(sd, TVP5150_PIX_ALIGN_REG_HIGH), tvp5150_log_status()
212 tvp5150_read(sd, TVP5150_PIX_ALIGN_REG_LOW)); tvp5150_log_status()
214 tvp5150_read(sd, TVP5150_FIFO_OUT_CTRL)); tvp5150_log_status()
216 tvp5150_read(sd, TVP5150_FULL_FIELD_ENA)); tvp5150_log_status()
218 tvp5150_read(sd, TVP5150_FULL_FIELD_MODE_REG)); tvp5150_log_status()
220 dump_reg_range(sd, "CC data", TVP5150_CC_DATA_INI, tvp5150_log_status()
223 dump_reg_range(sd, "WSS data", TVP5150_WSS_DATA_INI, tvp5150_log_status()
226 dump_reg_range(sd, "VPS data", TVP5150_VPS_DATA_INI, tvp5150_log_status()
229 dump_reg_range(sd, "VITC data", TVP5150_VITC_DATA_INI, tvp5150_log_status()
232 dump_reg_range(sd, "Line mode", TVP5150_LINE_MODE_INI, tvp5150_log_status()
241 static inline void tvp5150_selmux(struct v4l2_subdev *sd) tvp5150_selmux() argument
244 struct tvp5150 *decoder = to_tvp5150(sd); tvp5150_selmux()
263 v4l2_dbg(1, debug, sd, "Selecting video route: route input=%i, output=%i " tvp5150_selmux()
268 tvp5150_write(sd, TVP5150_OP_MODE_CTL, opmode); tvp5150_selmux()
269 tvp5150_write(sd, TVP5150_VD_IN_SRC_SEL_1, input); tvp5150_selmux()
274 val = tvp5150_read(sd, TVP5150_MISC_CTL); tvp5150_selmux()
276 v4l2_err(sd, "%s: failed with error = %d\n", __func__, val); tvp5150_selmux()
284 tvp5150_write(sd, TVP5150_MISC_CTL, val); tvp5150_selmux()
552 static int tvp5150_write_inittab(struct v4l2_subdev *sd, tvp5150_write_inittab() argument
556 tvp5150_write(sd, regs->reg, regs->value); tvp5150_write_inittab()
562 static int tvp5150_vdp_init(struct v4l2_subdev *sd, tvp5150_vdp_init() argument
568 tvp5150_write(sd, TVP5150_FULL_FIELD_ENA, 0); tvp5150_vdp_init()
572 tvp5150_write(sd, i, 0xff); tvp5150_vdp_init()
576 tvp5150_write(sd, TVP5150_CONF_RAM_ADDR_HIGH, regs->reg >> 8); tvp5150_vdp_init()
577 tvp5150_write(sd, TVP5150_CONF_RAM_ADDR_LOW, regs->reg); tvp5150_vdp_init()
580 tvp5150_write(sd, TVP5150_VDP_CONF_RAM_DATA, regs->values[i]); tvp5150_vdp_init()
588 static int tvp5150_g_sliced_vbi_cap(struct v4l2_subdev *sd, tvp5150_g_sliced_vbi_cap() argument
594 v4l2_dbg(1, debug, sd, "g_sliced_vbi_cap\n"); tvp5150_g_sliced_vbi_cap()
621 static int tvp5150_set_vbi(struct v4l2_subdev *sd, tvp5150_set_vbi() argument
626 struct tvp5150 *decoder = to_tvp5150(sd); tvp5150_set_vbi()
632 v4l2_err(sd, "VBI can't be configured without knowing number of lines\n"); tvp5150_set_vbi()
660 tvp5150_write(sd, reg, type); tvp5150_set_vbi()
664 tvp5150_write(sd, reg+1, type); tvp5150_set_vbi()
670 static int tvp5150_get_vbi(struct v4l2_subdev *sd, tvp5150_get_vbi() argument
673 struct tvp5150 *decoder = to_tvp5150(sd); tvp5150_get_vbi()
680 v4l2_err(sd, "VBI can't be configured without knowing number of lines\n"); tvp5150_get_vbi()
693 ret = tvp5150_read(sd, reg + i); tvp5150_get_vbi()
695 v4l2_err(sd, "%s: failed with error = %d\n", tvp5150_get_vbi()
707 static int tvp5150_set_std(struct v4l2_subdev *sd, v4l2_std_id std) tvp5150_set_std() argument
709 struct tvp5150 *decoder = to_tvp5150(sd); tvp5150_set_std()
732 v4l2_dbg(1, debug, sd, "Set video std register to %d.\n", fmt); tvp5150_set_std()
733 tvp5150_write(sd, TVP5150_VIDEO_STD, fmt); tvp5150_set_std()
737 static int tvp5150_s_std(struct v4l2_subdev *sd, v4l2_std_id std) tvp5150_s_std() argument
739 struct tvp5150 *decoder = to_tvp5150(sd); tvp5150_s_std()
751 return tvp5150_set_std(sd, std); tvp5150_s_std()
754 static int tvp5150_reset(struct v4l2_subdev *sd, u32 val) tvp5150_reset() argument
756 struct tvp5150 *decoder = to_tvp5150(sd); tvp5150_reset()
759 tvp5150_write_inittab(sd, tvp5150_init_default); tvp5150_reset()
762 tvp5150_vdp_init(sd, vbi_ram_default); tvp5150_reset()
765 tvp5150_selmux(sd); tvp5150_reset()
768 tvp5150_write_inittab(sd, tvp5150_init_enable); tvp5150_reset()
773 tvp5150_set_std(sd, decoder->norm); tvp5150_reset()
779 struct v4l2_subdev *sd = to_sd(ctrl); tvp5150_s_ctrl() local
783 tvp5150_write(sd, TVP5150_BRIGHT_CTL, ctrl->val); tvp5150_s_ctrl()
786 tvp5150_write(sd, TVP5150_CONTRAST_CTL, ctrl->val); tvp5150_s_ctrl()
789 tvp5150_write(sd, TVP5150_SATURATION_CTL, ctrl->val); tvp5150_s_ctrl()
792 tvp5150_write(sd, TVP5150_HUE_CTL, ctrl->val); tvp5150_s_ctrl()
798 static v4l2_std_id tvp5150_read_std(struct v4l2_subdev *sd) tvp5150_read_std() argument
800 int val = tvp5150_read(sd, TVP5150_STATUS_REG_5); tvp5150_read_std()
820 static int tvp5150_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index, tvp5150_enum_mbus_fmt() argument
830 static int tvp5150_mbus_fmt(struct v4l2_subdev *sd, tvp5150_mbus_fmt() argument
833 struct tvp5150 *decoder = to_tvp5150(sd); tvp5150_mbus_fmt()
838 tvp5150_reset(sd, 0); tvp5150_mbus_fmt()
847 v4l2_dbg(1, debug, sd, "width = %d, height = %d\n", f->width, tvp5150_mbus_fmt()
852 static int tvp5150_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) tvp5150_s_crop() argument
855 struct tvp5150 *decoder = to_tvp5150(sd); tvp5150_s_crop()
859 v4l2_dbg(1, debug, sd, "%s left=%d, top=%d, width=%d, height=%d\n", tvp5150_s_crop()
874 std = tvp5150_read_std(sd); tvp5150_s_crop()
887 tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top); tvp5150_s_crop()
888 tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP, tvp5150_s_crop()
890 tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_MSB, tvp5150_s_crop()
892 tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_LSB, tvp5150_s_crop()
894 tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_MSB, tvp5150_s_crop()
897 tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_LSB, tvp5150_s_crop()
905 static int tvp5150_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) tvp5150_g_crop() argument
907 struct tvp5150 *decoder = to_tvp5150(sd); tvp5150_g_crop()
915 static int tvp5150_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) tvp5150_cropcap() argument
917 struct tvp5150 *decoder = to_tvp5150(sd); tvp5150_cropcap()
929 std = tvp5150_read_std(sd); tvp5150_cropcap()
949 static int tvp5150_s_routing(struct v4l2_subdev *sd, tvp5150_s_routing() argument
952 struct tvp5150 *decoder = to_tvp5150(sd); tvp5150_s_routing()
956 tvp5150_selmux(sd); tvp5150_s_routing()
960 static int tvp5150_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt) tvp5150_s_raw_fmt() argument
968 tvp5150_write(sd, TVP5150_LUMA_PROC_CTL_1, 0x70); tvp5150_s_raw_fmt()
970 tvp5150_write(sd, TVP5150_VERT_BLANKING_START, 0x00); tvp5150_s_raw_fmt()
971 tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP, 0x01); tvp5150_s_raw_fmt()
976 static int tvp5150_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi) tvp5150_s_sliced_fmt() argument
984 tvp5150_set_vbi(sd, vbi_ram_default, tvp5150_s_sliced_fmt()
988 tvp5150_write(sd, TVP5150_FIFO_OUT_CTRL, 1); tvp5150_s_sliced_fmt()
991 tvp5150_write(sd, TVP5150_FIFO_OUT_CTRL, 0); tvp5150_s_sliced_fmt()
994 tvp5150_write(sd, TVP5150_FULL_FIELD_ENA, 0); tvp5150_s_sliced_fmt()
998 tvp5150_write(sd, i, 0xff); tvp5150_s_sliced_fmt()
1003 static int tvp5150_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi) tvp5150_g_sliced_fmt() argument
1011 tvp5150_get_vbi(sd, vbi_ram_default, i); tvp5150_g_sliced_fmt()
1019 static int tvp5150_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) tvp5150_g_register() argument
1023 res = tvp5150_read(sd, reg->reg & 0xff); tvp5150_g_register()
1025 v4l2_err(sd, "%s: failed with error = %d\n", __func__, res); tvp5150_g_register()
1034 static int tvp5150_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) tvp5150_s_register() argument
1036 tvp5150_write(sd, reg->reg & 0xff, reg->val & 0xff); tvp5150_s_register()
1041 static int tvp5150_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) tvp5150_g_tuner() argument
1043 int status = tvp5150_read(sd, 0x88); tvp5150_g_tuner()
1103 struct v4l2_subdev *sd; tvp5150_probe() local
1115 sd = &core->sd; tvp5150_probe()
1116 v4l2_i2c_subdev_init(sd, c, &tvp5150_ops); tvp5150_probe()
1123 res = tvp5150_read(sd, TVP5150_MSB_DEV_ID + i); tvp5150_probe()
1133 v4l2_info(sd, "tvp%02x%02xam1 detected.\n", tvp5150_probe()
1137 tvp5150_write(sd, TVP5150_REV_SELECT, 0); tvp5150_probe()
1141 v4l2_info(sd, "tvp%02x%02xa detected.\n", tvp5150_probe()
1144 v4l2_info(sd, "*** unknown tvp%02x%02x chip detected.\n", tvp5150_probe()
1146 v4l2_info(sd, "*** Rom ver is %d.%d\n", tvp5150_probe()
1164 sd->ctrl_handler = &core->hdl; tvp5150_probe()
1174 if (tvp5150_read_std(sd) & V4L2_STD_525_60) tvp5150_probe()
1182 tvp5150_log_status(sd); tvp5150_probe()
1188 struct v4l2_subdev *sd = i2c_get_clientdata(c); tvp5150_remove() local
1189 struct tvp5150 *decoder = to_tvp5150(sd); tvp5150_remove()
1191 v4l2_dbg(1, debug, sd, tvp5150_remove()
1195 v4l2_device_unregister_subdev(sd); tvp5150_remove()
H A Dsaa7127.c259 struct v4l2_subdev sd; member in struct:saa7127_state
279 static inline struct saa7127_state *to_state(struct v4l2_subdev *sd) to_state() argument
281 return container_of(sd, struct saa7127_state, sd); to_state()
315 static int saa7127_read(struct v4l2_subdev *sd, u8 reg) saa7127_read() argument
317 struct i2c_client *client = v4l2_get_subdevdata(sd); saa7127_read()
324 static int saa7127_write(struct v4l2_subdev *sd, u8 reg, u8 val) saa7127_write() argument
326 struct i2c_client *client = v4l2_get_subdevdata(sd); saa7127_write()
333 v4l2_err(sd, "I2C Write Problem\n"); saa7127_write()
339 static int saa7127_write_inittab(struct v4l2_subdev *sd, saa7127_write_inittab() argument
343 saa7127_write(sd, regs->reg, regs->value); saa7127_write_inittab()
351 static int saa7127_set_vps(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *data) saa7127_set_vps() argument
353 struct saa7127_state *state = to_state(sd); saa7127_set_vps()
359 v4l2_dbg(1, debug, sd, "Turn VPS Signal %s\n", enable ? "on" : "off"); saa7127_set_vps()
360 saa7127_write(sd, 0x54, enable << 7); saa7127_set_vps()
371 v4l2_dbg(1, debug, sd, "Set VPS data %*ph\n", 5, state->vps_data); saa7127_set_vps()
372 saa7127_write(sd, 0x55, state->vps_data[0]); saa7127_set_vps()
373 saa7127_write(sd, 0x56, state->vps_data[1]); saa7127_set_vps()
374 saa7127_write(sd, 0x57, state->vps_data[2]); saa7127_set_vps()
375 saa7127_write(sd, 0x58, state->vps_data[3]); saa7127_set_vps()
376 saa7127_write(sd, 0x59, state->vps_data[4]); saa7127_set_vps()
382 static int saa7127_set_cc(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *data) saa7127_set_cc() argument
384 struct saa7127_state *state = to_state(sd); saa7127_set_cc()
391 v4l2_dbg(1, debug, sd, saa7127_set_cc()
393 saa7127_write(sd, SAA7127_REG_CLOSED_CAPTION, saa7127_set_cc()
400 v4l2_dbg(2, debug, sd, "CC data: %04x\n", cc); saa7127_set_cc()
401 saa7127_write(sd, SAA7127_REG_LINE_21_ODD_0, cc & 0xff); saa7127_set_cc()
402 saa7127_write(sd, SAA7127_REG_LINE_21_ODD_1, cc >> 8); saa7127_set_cc()
409 static int saa7127_set_xds(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *data) saa7127_set_xds() argument
411 struct saa7127_state *state = to_state(sd); saa7127_set_xds()
418 v4l2_dbg(1, debug, sd, "Turn XDS %s\n", enable ? "on" : "off"); saa7127_set_xds()
419 saa7127_write(sd, SAA7127_REG_CLOSED_CAPTION, saa7127_set_xds()
426 v4l2_dbg(2, debug, sd, "XDS data: %04x\n", xds); saa7127_set_xds()
427 saa7127_write(sd, SAA7127_REG_LINE_21_EVEN_0, xds & 0xff); saa7127_set_xds()
428 saa7127_write(sd, SAA7127_REG_LINE_21_EVEN_1, xds >> 8); saa7127_set_xds()
435 static int saa7127_set_wss(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *data) saa7127_set_wss() argument
437 struct saa7127_state *state = to_state(sd); saa7127_set_wss()
443 v4l2_dbg(1, debug, sd, "Turn WSS %s\n", enable ? "on" : "off"); saa7127_set_wss()
444 saa7127_write(sd, 0x27, enable << 7); saa7127_set_wss()
450 saa7127_write(sd, 0x26, data->data[0]); saa7127_set_wss()
451 saa7127_write(sd, 0x27, 0x80 | (data->data[1] & 0x3f)); saa7127_set_wss()
452 v4l2_dbg(1, debug, sd, saa7127_set_wss()
460 static int saa7127_set_video_enable(struct v4l2_subdev *sd, int enable) saa7127_set_video_enable() argument
462 struct saa7127_state *state = to_state(sd); saa7127_set_video_enable()
465 v4l2_dbg(1, debug, sd, "Enable Video Output\n"); saa7127_set_video_enable()
466 saa7127_write(sd, 0x2d, state->reg_2d); saa7127_set_video_enable()
467 saa7127_write(sd, 0x61, state->reg_61); saa7127_set_video_enable()
469 v4l2_dbg(1, debug, sd, "Disable Video Output\n"); saa7127_set_video_enable()
470 saa7127_write(sd, 0x2d, (state->reg_2d & 0xf0)); saa7127_set_video_enable()
471 saa7127_write(sd, 0x61, (state->reg_61 | 0xc0)); saa7127_set_video_enable()
479 static int saa7127_set_std(struct v4l2_subdev *sd, v4l2_std_id std) saa7127_set_std() argument
481 struct saa7127_state *state = to_state(sd); saa7127_set_std()
485 v4l2_dbg(1, debug, sd, "Selecting 60 Hz video Standard\n"); saa7127_set_std()
494 v4l2_dbg(1, debug, sd, saa7127_set_std()
500 v4l2_dbg(1, debug, sd, "Selecting 50 Hz PAL video Standard\n"); saa7127_set_std()
506 saa7127_write_inittab(sd, inittab); saa7127_set_std()
513 static int saa7127_set_output_type(struct v4l2_subdev *sd, int output) saa7127_set_output_type() argument
515 struct saa7127_state *state = to_state(sd); saa7127_set_output_type()
560 v4l2_dbg(1, debug, sd, saa7127_set_output_type()
564 saa7127_write(sd, 0x2d, state->reg_2d); saa7127_set_output_type()
565 saa7127_write(sd, 0x3a, state->reg_3a | state->reg_3a_cb); saa7127_set_output_type()
572 static int saa7127_set_input_type(struct v4l2_subdev *sd, int input) saa7127_set_input_type() argument
574 struct saa7127_state *state = to_state(sd); saa7127_set_input_type()
578 v4l2_dbg(1, debug, sd, "Selecting Normal Encoder Input\n"); saa7127_set_input_type()
583 v4l2_dbg(1, debug, sd, "Selecting Color Bar generator\n"); saa7127_set_input_type()
590 saa7127_write(sd, 0x3a, state->reg_3a | state->reg_3a_cb); saa7127_set_input_type()
597 static int saa7127_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) saa7127_s_std_output() argument
599 struct saa7127_state *state = to_state(sd); saa7127_s_std_output()
603 return saa7127_set_std(sd, std); saa7127_s_std_output()
606 static int saa7127_s_routing(struct v4l2_subdev *sd, saa7127_s_routing() argument
609 struct saa7127_state *state = to_state(sd); saa7127_s_routing()
613 rc = saa7127_set_input_type(sd, input); saa7127_s_routing()
615 rc = saa7127_set_output_type(sd, output); saa7127_s_routing()
619 static int saa7127_s_stream(struct v4l2_subdev *sd, int enable) saa7127_s_stream() argument
621 struct saa7127_state *state = to_state(sd); saa7127_s_stream()
625 return saa7127_set_video_enable(sd, enable); saa7127_s_stream()
628 static int saa7127_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt) saa7127_g_sliced_fmt() argument
630 struct saa7127_state *state = to_state(sd); saa7127_g_sliced_fmt()
648 static int saa7127_s_vbi_data(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *data) saa7127_s_vbi_data() argument
652 return saa7127_set_wss(sd, data); saa7127_s_vbi_data()
654 return saa7127_set_vps(sd, data); saa7127_s_vbi_data()
657 return saa7127_set_cc(sd, data); saa7127_s_vbi_data()
658 return saa7127_set_xds(sd, data); saa7127_s_vbi_data()
666 static int saa7127_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) saa7127_g_register() argument
668 reg->val = saa7127_read(sd, reg->reg & 0xff); saa7127_g_register()
673 static int saa7127_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) saa7127_s_register() argument
675 saa7127_write(sd, reg->reg & 0xff, reg->val & 0xff); saa7127_s_register()
680 static int saa7127_log_status(struct v4l2_subdev *sd) saa7127_log_status() argument
682 struct saa7127_state *state = to_state(sd); saa7127_log_status()
684 v4l2_info(sd, "Standard: %s\n", (state->std & V4L2_STD_525_60) ? "60 Hz" : "50 Hz"); saa7127_log_status()
685 v4l2_info(sd, "Input: %s\n", state->input_type ? "color bars" : "normal"); saa7127_log_status()
686 v4l2_info(sd, "Output: %s\n", state->video_enable ? saa7127_log_status()
688 v4l2_info(sd, "WSS: %s\n", state->wss_enable ? saa7127_log_status()
690 v4l2_info(sd, "VPS: %s\n", state->vps_enable ? "enabled" : "disabled"); saa7127_log_status()
691 v4l2_info(sd, "CC: %s\n", state->cc_enable ? "enabled" : "disabled"); saa7127_log_status()
728 struct v4l2_subdev *sd; saa7127_probe() local
742 sd = &state->sd; saa7127_probe()
743 v4l2_i2c_subdev_init(sd, client, &saa7127_ops); saa7127_probe()
750 if ((saa7127_read(sd, 0) & 0xe4) != 0 || saa7127_probe()
751 (saa7127_read(sd, 0x29) & 0x3f) != 0x1d) { saa7127_probe()
752 v4l2_dbg(1, debug, sd, "saa7127 not found\n"); saa7127_probe()
762 read_result = saa7127_read(sd, SAA7129_REG_FADE_KEY_COL2); saa7127_probe()
763 saa7127_write(sd, SAA7129_REG_FADE_KEY_COL2, 0xaa); saa7127_probe()
764 if (saa7127_read(sd, SAA7129_REG_FADE_KEY_COL2) == 0xaa) { saa7127_probe()
765 saa7127_write(sd, SAA7129_REG_FADE_KEY_COL2, saa7127_probe()
775 v4l2_info(sd, "%s found @ 0x%x (%s)\n", client->name, saa7127_probe()
778 v4l2_dbg(1, debug, sd, "Configuring encoder\n"); saa7127_probe()
779 saa7127_write_inittab(sd, saa7127_init_config_common); saa7127_probe()
780 saa7127_set_std(sd, V4L2_STD_NTSC); saa7127_probe()
781 saa7127_set_output_type(sd, SAA7127_OUTPUT_TYPE_BOTH); saa7127_probe()
782 saa7127_set_vps(sd, &vbi); saa7127_probe()
783 saa7127_set_wss(sd, &vbi); saa7127_probe()
784 saa7127_set_cc(sd, &vbi); saa7127_probe()
785 saa7127_set_xds(sd, &vbi); saa7127_probe()
789 saa7127_set_input_type(sd, SAA7127_INPUT_TYPE_TEST_IMAGE); saa7127_probe()
791 saa7127_set_input_type(sd, SAA7127_INPUT_TYPE_NORMAL); saa7127_probe()
792 saa7127_set_video_enable(sd, 1); saa7127_probe()
795 saa7127_write_inittab(sd, saa7129_init_config_extra); saa7127_probe()
803 struct v4l2_subdev *sd = i2c_get_clientdata(client); saa7127_remove() local
805 v4l2_device_unregister_subdev(sd); saa7127_remove()
807 saa7127_set_video_enable(sd, 0); saa7127_remove()
H A Dks0127.c200 struct v4l2_subdev sd; member in struct:ks0127
205 static inline struct ks0127 *to_ks0127(struct v4l2_subdev *sd) to_ks0127() argument
207 return container_of(sd, struct ks0127, sd); to_ks0127()
315 static u8 ks0127_read(struct v4l2_subdev *sd, u8 reg) ks0127_read() argument
317 struct i2c_client *client = v4l2_get_subdevdata(sd); ks0127_read()
336 v4l2_dbg(1, debug, sd, "read error\n"); ks0127_read()
342 static void ks0127_write(struct v4l2_subdev *sd, u8 reg, u8 val) ks0127_write() argument
344 struct i2c_client *client = v4l2_get_subdevdata(sd); ks0127_write()
345 struct ks0127 *ks = to_ks0127(sd); ks0127_write()
349 v4l2_dbg(1, debug, sd, "write error\n"); ks0127_write()
356 static void ks0127_and_or(struct v4l2_subdev *sd, u8 reg, u8 and_v, u8 or_v) ks0127_and_or() argument
358 struct ks0127 *ks = to_ks0127(sd); ks0127_and_or()
362 ks0127_write(sd, reg, val); ks0127_and_or()
370 static void ks0127_init(struct v4l2_subdev *sd) ks0127_init() argument
375 v4l2_dbg(1, debug, sd, "reset\n"); ks0127_init()
382 ks0127_write(sd, i, table[i]); ks0127_init()
385 ks0127_write(sd, i, table[i]); ks0127_init()
388 ks0127_write(sd, i, table[i]); ks0127_init()
391 ks0127_write(sd, i, table[i]); ks0127_init()
394 if ((ks0127_read(sd, KS_STAT) & 0x80) == 0) { ks0127_init()
395 v4l2_dbg(1, debug, sd, "ks0122s found\n"); ks0127_init()
399 switch (ks0127_read(sd, KS_CMDE) & 0x0f) { ks0127_init()
401 v4l2_dbg(1, debug, sd, "ks0127 found\n"); ks0127_init()
405 v4l2_dbg(1, debug, sd, "ks0127B Revision A found\n"); ks0127_init()
409 v4l2_dbg(1, debug, sd, "unknown revision\n"); ks0127_init()
414 static int ks0127_s_routing(struct v4l2_subdev *sd, ks0127_s_routing() argument
417 struct ks0127 *ks = to_ks0127(sd); ks0127_s_routing()
426 v4l2_dbg(1, debug, sd, ks0127_s_routing()
429 ks0127_and_or(sd, KS_CMDA, 0xfc, 0x00); ks0127_s_routing()
431 ks0127_and_or(sd, KS_CMDA, ~0x40, 0x00); ks0127_s_routing()
433 ks0127_and_or(sd, KS_CMDB, 0xb0, input); ks0127_s_routing()
435 ks0127_and_or(sd, KS_CMDC, 0x70, 0x0a); ks0127_s_routing()
437 ks0127_and_or(sd, KS_CMDD, 0x03, 0x00); ks0127_s_routing()
439 ks0127_and_or(sd, KS_CTRACK, 0xcf, 0x00); ks0127_s_routing()
441 ks0127_and_or(sd, KS_LUMA, 0x00, ks0127_s_routing()
444 ks0127_and_or(sd, KS_VERTIA, 0x08, 0x81); ks0127_s_routing()
446 ks0127_and_or(sd, KS_VERTIC, 0x0f, 0x90); ks0127_s_routing()
449 ks0127_and_or(sd, KS_CHROMB, 0x0f, 0x90); ks0127_s_routing()
451 ks0127_write(sd, KS_UGAIN, reg_defaults[KS_UGAIN]); ks0127_s_routing()
452 ks0127_write(sd, KS_VGAIN, reg_defaults[KS_VGAIN]); ks0127_s_routing()
453 ks0127_write(sd, KS_UVOFFH, reg_defaults[KS_UVOFFH]); ks0127_s_routing()
454 ks0127_write(sd, KS_UVOFFL, reg_defaults[KS_UVOFFL]); ks0127_s_routing()
460 v4l2_dbg(1, debug, sd, ks0127_s_routing()
463 ks0127_and_or(sd, KS_CMDA, 0xfc, 0x00); ks0127_s_routing()
465 ks0127_and_or(sd, KS_CMDA, ~0x40, 0x00); ks0127_s_routing()
467 ks0127_and_or(sd, KS_CMDB, 0xb0, input); ks0127_s_routing()
469 ks0127_and_or(sd, KS_CMDC, 0x70, 0x0a); ks0127_s_routing()
471 ks0127_and_or(sd, KS_CMDD, 0x03, 0x00); ks0127_s_routing()
473 ks0127_and_or(sd, KS_CTRACK, 0xcf, 0x00); ks0127_s_routing()
474 ks0127_and_or(sd, KS_LUMA, 0x00, ks0127_s_routing()
477 ks0127_and_or(sd, KS_VERTIA, 0x08, ks0127_s_routing()
479 ks0127_and_or(sd, KS_VERTIC, 0x0f, ks0127_s_routing()
482 ks0127_and_or(sd, KS_CHROMB, 0x0f, ks0127_s_routing()
485 ks0127_write(sd, KS_UGAIN, reg_defaults[KS_UGAIN]); ks0127_s_routing()
486 ks0127_write(sd, KS_VGAIN, reg_defaults[KS_VGAIN]); ks0127_s_routing()
487 ks0127_write(sd, KS_UVOFFH, reg_defaults[KS_UVOFFH]); ks0127_s_routing()
488 ks0127_write(sd, KS_UVOFFL, reg_defaults[KS_UVOFFL]); ks0127_s_routing()
492 v4l2_dbg(1, debug, sd, "s_routing 15: YUV656\n"); ks0127_s_routing()
495 ks0127_and_or(sd, KS_CMDA, 0xfc, 0x03); ks0127_s_routing()
498 ks0127_and_or(sd, KS_CMDA, 0xfc, 0x02); ks0127_s_routing()
500 ks0127_and_or(sd, KS_CMDA, 0xff, 0x40); /* VSE=1 */ ks0127_s_routing()
502 ks0127_and_or(sd, KS_CMDB, 0xb0, (input | 0x40)); ks0127_s_routing()
505 ks0127_and_or(sd, KS_CMDC, 0x70, 0x87); ks0127_s_routing()
507 ks0127_and_or(sd, KS_CMDD, 0x03, 0x08); ks0127_s_routing()
509 ks0127_and_or(sd, KS_CTRACK, 0xcf, 0x30); ks0127_s_routing()
511 ks0127_and_or(sd, KS_LUMA, 0x00, 0x71); ks0127_s_routing()
512 ks0127_and_or(sd, KS_VERTIC, 0x0f, ks0127_s_routing()
516 ks0127_and_or(sd, KS_VERTIA, 0x08, 0x81); ks0127_s_routing()
518 ks0127_and_or(sd, KS_CHROMB, 0x0f, ks0127_s_routing()
521 ks0127_and_or(sd, KS_CON, 0x00, 0x00); ks0127_s_routing()
522 ks0127_and_or(sd, KS_BRT, 0x00, 32); /* spec: 34 */ ks0127_s_routing()
524 ks0127_and_or(sd, KS_SAT, 0x00, 0xe8); ks0127_s_routing()
525 ks0127_and_or(sd, KS_HUE, 0x00, 0); ks0127_s_routing()
527 ks0127_and_or(sd, KS_UGAIN, 0x00, 238); ks0127_s_routing()
528 ks0127_and_or(sd, KS_VGAIN, 0x00, 0x00); ks0127_s_routing()
531 ks0127_and_or(sd, KS_UVOFFH, 0x00, 0x4f); ks0127_s_routing()
532 ks0127_and_or(sd, KS_UVOFFL, 0x00, 0x00); ks0127_s_routing()
536 v4l2_dbg(1, debug, sd, ks0127_s_routing()
543 ks0127_write(sd, KS_DEMOD, reg_defaults[KS_DEMOD]); ks0127_s_routing()
547 static int ks0127_s_std(struct v4l2_subdev *sd, v4l2_std_id std) ks0127_s_std() argument
549 struct ks0127 *ks = to_ks0127(sd); ks0127_s_std()
552 ks0127_and_or(sd, KS_DEMOD, 0xf0, 0x00); ks0127_s_std()
556 v4l2_dbg(1, debug, sd, ks0127_s_std()
558 ks0127_and_or(sd, KS_CHROMA, 0x9f, 0x20); ks0127_s_std()
560 v4l2_dbg(1, debug, sd, ks0127_s_std()
562 ks0127_and_or(sd, KS_CHROMA, 0x9f, 0x40); ks0127_s_std()
564 v4l2_dbg(1, debug, sd, ks0127_s_std()
566 ks0127_and_or(sd, KS_CHROMA, 0x9f, 0x20); ks0127_s_std()
568 v4l2_dbg(1, debug, sd, ks0127_s_std()
570 ks0127_and_or(sd, KS_CHROMA, 0x9f, 0x40); ks0127_s_std()
572 v4l2_dbg(1, debug, sd, ks0127_s_std()
576 ks0127_and_or(sd, KS_CHROMA, 0xdf, 0x20); ks0127_s_std()
577 ks0127_and_or(sd, KS_DEMOD, 0xf0, 0x00); ks0127_s_std()
581 if (!(ks0127_read(sd, KS_DEMOD) & 0x40)) ks0127_s_std()
583 ks0127_and_or(sd, KS_DEMOD, 0xf0, 0x0f); ks0127_s_std()
585 v4l2_dbg(1, debug, sd, "s_std: Unknown norm %llx\n", ks0127_s_std()
591 static int ks0127_s_stream(struct v4l2_subdev *sd, int enable) ks0127_s_stream() argument
593 v4l2_dbg(1, debug, sd, "s_stream(%d)\n", enable); ks0127_s_stream()
596 ks0127_and_or(sd, KS_OFMTA, 0xcf, 0x30); ks0127_s_stream()
598 ks0127_and_or(sd, KS_CDEM, 0x7f, 0x00); ks0127_s_stream()
601 ks0127_and_or(sd, KS_OFMTA, 0xcf, 0x00); ks0127_s_stream()
603 ks0127_and_or(sd, KS_CDEM, 0x7f, 0x80); ks0127_s_stream()
608 static int ks0127_status(struct v4l2_subdev *sd, u32 *pstatus, v4l2_std_id *pstd) ks0127_status() argument
614 status = ks0127_read(sd, KS_STAT); ks0127_status()
637 static int ks0127_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) ks0127_querystd() argument
639 v4l2_dbg(1, debug, sd, "querystd\n"); ks0127_querystd()
640 return ks0127_status(sd, NULL, std); ks0127_querystd()
643 static int ks0127_g_input_status(struct v4l2_subdev *sd, u32 *status) ks0127_g_input_status() argument
645 v4l2_dbg(1, debug, sd, "g_input_status\n"); ks0127_g_input_status()
646 return ks0127_status(sd, status, NULL); ks0127_g_input_status()
669 struct v4l2_subdev *sd; ks0127_probe() local
678 sd = &ks->sd; ks0127_probe()
679 v4l2_i2c_subdev_init(sd, client, &ks0127_ops); ks0127_probe()
683 ks0127_write(sd, KS_CMDA, 0x2c); ks0127_probe()
687 ks0127_init(sd); ks0127_probe()
693 struct v4l2_subdev *sd = i2c_get_clientdata(client); ks0127_remove() local
695 v4l2_device_unregister_subdev(sd); ks0127_remove()
696 ks0127_write(sd, KS_OFMTA, 0x20); /* tristate */ ks0127_remove()
697 ks0127_write(sd, KS_CMDA, 0x2c | 0x80); /* power down */ ks0127_remove()
H A Dadv7170.c52 struct v4l2_subdev sd; member in struct:adv7170
59 static inline struct adv7170 *to_adv7170(struct v4l2_subdev *sd) to_adv7170() argument
61 return container_of(sd, struct adv7170, sd); to_adv7170()
73 static inline int adv7170_write(struct v4l2_subdev *sd, u8 reg, u8 value) adv7170_write() argument
75 struct i2c_client *client = v4l2_get_subdevdata(sd); adv7170_write()
76 struct adv7170 *encoder = to_adv7170(sd); adv7170_write()
82 static inline int adv7170_read(struct v4l2_subdev *sd, u8 reg) adv7170_read() argument
84 struct i2c_client *client = v4l2_get_subdevdata(sd); adv7170_read()
89 static int adv7170_write_block(struct v4l2_subdev *sd, adv7170_write_block() argument
92 struct i2c_client *client = v4l2_get_subdevdata(sd); adv7170_write_block()
93 struct adv7170 *encoder = to_adv7170(sd); adv7170_write_block()
121 ret = adv7170_write(sd, reg, *data++); adv7170_write_block()
197 static int adv7170_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) adv7170_s_std_output() argument
199 struct adv7170 *encoder = to_adv7170(sd); adv7170_s_std_output()
201 v4l2_dbg(1, debug, sd, "set norm %llx\n", (unsigned long long)std); adv7170_s_std_output()
204 adv7170_write_block(sd, init_NTSC, sizeof(init_NTSC)); adv7170_s_std_output()
206 adv7170_write(sd, 0x02, 0x0e); /* Enable genlock */ adv7170_s_std_output()
207 adv7170_write(sd, 0x07, TR0MODE | TR0RST); adv7170_s_std_output()
208 adv7170_write(sd, 0x07, TR0MODE); adv7170_s_std_output()
210 adv7170_write_block(sd, init_PAL, sizeof(init_PAL)); adv7170_s_std_output()
212 adv7170_write(sd, 0x02, 0x0e); /* Enable genlock */ adv7170_s_std_output()
213 adv7170_write(sd, 0x07, TR0MODE | TR0RST); adv7170_s_std_output()
214 adv7170_write(sd, 0x07, TR0MODE); adv7170_s_std_output()
216 v4l2_dbg(1, debug, sd, "illegal norm: %llx\n", adv7170_s_std_output()
220 v4l2_dbg(1, debug, sd, "switched to %llx\n", (unsigned long long)std); adv7170_s_std_output()
225 static int adv7170_s_routing(struct v4l2_subdev *sd, adv7170_s_routing() argument
228 struct adv7170 *encoder = to_adv7170(sd); adv7170_s_routing()
234 v4l2_dbg(1, debug, sd, "set input from %s\n", adv7170_s_routing()
239 adv7170_write(sd, 0x01, 0x20); adv7170_s_routing()
240 adv7170_write(sd, 0x08, TR1CAPT); /* TR1 */ adv7170_s_routing()
241 adv7170_write(sd, 0x02, 0x0e); /* Enable genlock */ adv7170_s_routing()
242 adv7170_write(sd, 0x07, TR0MODE | TR0RST); adv7170_s_routing()
243 adv7170_write(sd, 0x07, TR0MODE); adv7170_s_routing()
248 adv7170_write(sd, 0x01, 0x00); adv7170_s_routing()
249 adv7170_write(sd, 0x08, TR1PLAY); /* TR1 */ adv7170_s_routing()
250 adv7170_write(sd, 0x02, 0x08); adv7170_s_routing()
251 adv7170_write(sd, 0x07, TR0MODE | TR0RST); adv7170_s_routing()
252 adv7170_write(sd, 0x07, TR0MODE); adv7170_s_routing()
257 v4l2_dbg(1, debug, sd, "illegal input: %d\n", input); adv7170_s_routing()
260 v4l2_dbg(1, debug, sd, "switched to %s\n", inputs[input]); adv7170_s_routing()
265 static int adv7170_enum_fmt(struct v4l2_subdev *sd, unsigned int index, adv7170_enum_fmt() argument
275 static int adv7170_g_fmt(struct v4l2_subdev *sd, adv7170_g_fmt() argument
278 u8 val = adv7170_read(sd, 0x7); adv7170_g_fmt()
293 static int adv7170_s_fmt(struct v4l2_subdev *sd, adv7170_s_fmt() argument
296 u8 val = adv7170_read(sd, 0x7); adv7170_s_fmt()
309 v4l2_dbg(1, debug, sd, adv7170_s_fmt()
314 ret = adv7170_write(sd, 0x7, val); adv7170_s_fmt()
339 struct v4l2_subdev *sd; adv7170_probe() local
352 sd = &encoder->sd; adv7170_probe()
353 v4l2_i2c_subdev_init(sd, client, &adv7170_ops); adv7170_probe()
357 i = adv7170_write_block(sd, init_NTSC, sizeof(init_NTSC)); adv7170_probe()
359 i = adv7170_write(sd, 0x07, TR0MODE | TR0RST); adv7170_probe()
360 i = adv7170_write(sd, 0x07, TR0MODE); adv7170_probe()
361 i = adv7170_read(sd, 0x12); adv7170_probe()
362 v4l2_dbg(1, debug, sd, "revision %d\n", i & 1); adv7170_probe()
365 v4l2_dbg(1, debug, sd, "init error 0x%x\n", i); adv7170_probe()
371 struct v4l2_subdev *sd = i2c_get_clientdata(client); adv7170_remove() local
373 v4l2_device_unregister_subdev(sd); adv7170_remove()
H A Dvpx3220.c46 struct v4l2_subdev sd; member in struct:vpx3220
55 static inline struct vpx3220 *to_vpx3220(struct v4l2_subdev *sd) to_vpx3220() argument
57 return container_of(sd, struct vpx3220, sd); to_vpx3220()
62 return &container_of(ctrl->handler, struct vpx3220, hdl)->sd; to_sd()
69 static inline int vpx3220_write(struct v4l2_subdev *sd, u8 reg, u8 value) vpx3220_write() argument
71 struct i2c_client *client = v4l2_get_subdevdata(sd); vpx3220_write()
78 static inline int vpx3220_read(struct v4l2_subdev *sd, u8 reg) vpx3220_read() argument
80 struct i2c_client *client = v4l2_get_subdevdata(sd); vpx3220_read()
85 static int vpx3220_fp_status(struct v4l2_subdev *sd) vpx3220_fp_status() argument
91 status = vpx3220_read(sd, 0x29); vpx3220_fp_status()
105 static int vpx3220_fp_write(struct v4l2_subdev *sd, u8 fpaddr, u16 data) vpx3220_fp_write() argument
107 struct i2c_client *client = v4l2_get_subdevdata(sd); vpx3220_fp_write()
111 v4l2_dbg(1, debug, sd, "%s: failed\n", __func__); vpx3220_fp_write()
115 if (vpx3220_fp_status(sd) < 0) vpx3220_fp_write()
120 v4l2_dbg(1, debug, sd, "%s: failed\n", __func__); vpx3220_fp_write()
127 static u16 vpx3220_fp_read(struct v4l2_subdev *sd, u16 fpaddr) vpx3220_fp_read() argument
129 struct i2c_client *client = v4l2_get_subdevdata(sd); vpx3220_fp_read()
134 v4l2_dbg(1, debug, sd, "%s: failed\n", __func__); vpx3220_fp_read()
138 if (vpx3220_fp_status(sd) < 0) vpx3220_fp_read()
144 v4l2_dbg(1, debug, sd, "%s: failed\n", __func__); vpx3220_fp_read()
151 static int vpx3220_write_block(struct v4l2_subdev *sd, const u8 *data, unsigned int len) vpx3220_write_block() argument
158 ret = vpx3220_write(sd, reg, *data++); vpx3220_write_block()
167 static int vpx3220_write_fp_block(struct v4l2_subdev *sd, vpx3220_write_fp_block() argument
175 ret |= vpx3220_fp_write(sd, reg, *data++); vpx3220_write_fp_block()
278 static int vpx3220_init(struct v4l2_subdev *sd, u32 val) vpx3220_init() argument
280 struct vpx3220 *decoder = to_vpx3220(sd); vpx3220_init()
282 vpx3220_write_block(sd, init_common, sizeof(init_common)); vpx3220_init()
283 vpx3220_write_fp_block(sd, init_fp, sizeof(init_fp) >> 1); vpx3220_init()
285 vpx3220_write_fp_block(sd, init_ntsc, sizeof(init_ntsc) >> 1); vpx3220_init()
287 vpx3220_write_fp_block(sd, init_pal, sizeof(init_pal) >> 1); vpx3220_init()
289 vpx3220_write_fp_block(sd, init_secam, sizeof(init_secam) >> 1); vpx3220_init()
291 vpx3220_write_fp_block(sd, init_pal, sizeof(init_pal) >> 1); vpx3220_init()
295 static int vpx3220_status(struct v4l2_subdev *sd, u32 *pstatus, v4l2_std_id *pstd) vpx3220_status() argument
300 status = vpx3220_fp_read(sd, 0x0f3); vpx3220_status()
302 v4l2_dbg(1, debug, sd, "status: 0x%04x\n", status); vpx3220_status()
338 static int vpx3220_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) vpx3220_querystd() argument
340 v4l2_dbg(1, debug, sd, "querystd\n"); vpx3220_querystd()
341 return vpx3220_status(sd, NULL, std); vpx3220_querystd()
344 static int vpx3220_g_input_status(struct v4l2_subdev *sd, u32 *status) vpx3220_g_input_status() argument
346 v4l2_dbg(1, debug, sd, "g_input_status\n"); vpx3220_g_input_status()
347 return vpx3220_status(sd, status, NULL); vpx3220_g_input_status()
350 static int vpx3220_s_std(struct v4l2_subdev *sd, v4l2_std_id std) vpx3220_s_std() argument
352 struct vpx3220 *decoder = to_vpx3220(sd); vpx3220_s_std()
358 temp_input = vpx3220_fp_read(sd, 0xf2); vpx3220_s_std()
360 v4l2_dbg(1, debug, sd, "s_std %llx\n", (unsigned long long)std); vpx3220_s_std()
362 vpx3220_write_fp_block(sd, init_ntsc, sizeof(init_ntsc) >> 1); vpx3220_s_std()
363 v4l2_dbg(1, debug, sd, "norm switched to NTSC\n"); vpx3220_s_std()
365 vpx3220_write_fp_block(sd, init_pal, sizeof(init_pal) >> 1); vpx3220_s_std()
366 v4l2_dbg(1, debug, sd, "norm switched to PAL\n"); vpx3220_s_std()
368 vpx3220_write_fp_block(sd, init_secam, sizeof(init_secam) >> 1); vpx3220_s_std()
369 v4l2_dbg(1, debug, sd, "norm switched to SECAM\n"); vpx3220_s_std()
377 vpx3220_fp_write(sd, 0xf2, temp_input | 0x0010); vpx3220_s_std()
382 static int vpx3220_s_routing(struct v4l2_subdev *sd, vpx3220_s_routing() argument
400 v4l2_dbg(1, debug, sd, "input switched to %s\n", inputs[input]); vpx3220_s_routing()
402 vpx3220_write(sd, 0x33, input_vals[input][0]); vpx3220_s_routing()
404 data = vpx3220_fp_read(sd, 0xf2) & ~(0x0020); vpx3220_s_routing()
408 vpx3220_fp_write(sd, 0xf2, vpx3220_s_routing()
415 static int vpx3220_s_stream(struct v4l2_subdev *sd, int enable) vpx3220_s_stream() argument
417 v4l2_dbg(1, debug, sd, "s_stream %s\n", enable ? "on" : "off"); vpx3220_s_stream()
419 vpx3220_write(sd, 0xf2, (enable ? 0x1b : 0x00)); vpx3220_s_stream()
425 struct v4l2_subdev *sd = to_sd(ctrl); vpx3220_s_ctrl() local
429 vpx3220_write(sd, 0xe6, ctrl->val); vpx3220_s_ctrl()
433 vpx3220_write(sd, 0xe7, ctrl->val + 192); vpx3220_s_ctrl()
436 vpx3220_fp_write(sd, 0xa0, ctrl->val); vpx3220_s_ctrl()
439 vpx3220_fp_write(sd, 0x1c, ctrl->val); vpx3220_s_ctrl()
483 struct v4l2_subdev *sd; vpx3220_probe() local
496 sd = &decoder->sd; vpx3220_probe()
497 v4l2_i2c_subdev_init(sd, client, &vpx3220_ops); vpx3220_probe()
510 sd->ctrl_handler = &decoder->hdl; vpx3220_probe()
536 v4l2_info(sd, "%s found @ 0x%x (%s)\n", name, vpx3220_probe()
539 v4l2_info(sd, "chip (%02x:%04x) found @ 0x%x (%s)\n", vpx3220_probe()
542 vpx3220_write_block(sd, init_common, sizeof(init_common)); vpx3220_probe()
543 vpx3220_write_fp_block(sd, init_fp, sizeof(init_fp) >> 1); vpx3220_probe()
545 vpx3220_write_fp_block(sd, init_pal, sizeof(init_pal) >> 1); vpx3220_probe()
551 struct v4l2_subdev *sd = i2c_get_clientdata(client); vpx3220_remove() local
552 struct vpx3220 *decoder = to_vpx3220(sd); vpx3220_remove()
554 v4l2_device_unregister_subdev(sd); vpx3220_remove()
H A Dupd64083.c52 struct v4l2_subdev sd; member in struct:upd64083_state
58 static inline struct upd64083_state *to_state(struct v4l2_subdev *sd) to_state() argument
60 return container_of(sd, struct upd64083_state, sd); to_state()
75 static void upd64083_write(struct v4l2_subdev *sd, u8 reg, u8 val) upd64083_write() argument
77 struct i2c_client *client = v4l2_get_subdevdata(sd); upd64083_write()
82 v4l2_dbg(1, debug, sd, "write reg: %02x val: %02x\n", reg, val); upd64083_write()
84 v4l2_err(sd, "I/O error write 0x%02x/0x%02x\n", reg, val); upd64083_write()
90 static u8 upd64083_read(struct v4l2_subdev *sd, u8 reg) upd64083_read() argument
92 struct i2c_client *client = v4l2_get_subdevdata(sd); upd64083_read()
104 static int upd64083_s_routing(struct v4l2_subdev *sd, upd64083_s_routing() argument
107 struct upd64083_state *state = to_state(sd); upd64083_s_routing()
116 upd64083_write(sd, R00, r00); upd64083_s_routing()
117 upd64083_write(sd, R02, r02); upd64083_s_routing()
122 static int upd64083_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) upd64083_g_register() argument
124 reg->val = upd64083_read(sd, reg->reg & 0xff); upd64083_g_register()
129 static int upd64083_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) upd64083_s_register() argument
131 upd64083_write(sd, reg->reg & 0xff, reg->val & 0xff); upd64083_s_register()
136 static int upd64083_log_status(struct v4l2_subdev *sd) upd64083_log_status() argument
138 struct i2c_client *client = v4l2_get_subdevdata(sd); upd64083_log_status()
142 v4l2_info(sd, "Status: SA00=%02x SA01=%02x SA02=%02x SA03=%02x " upd64083_log_status()
175 struct v4l2_subdev *sd; upd64083_probe() local
187 sd = &state->sd; upd64083_probe()
188 v4l2_i2c_subdev_init(sd, client, &upd64083_ops); upd64083_probe()
194 upd64083_write(sd, i, state->regs[i]); upd64083_probe()
200 struct v4l2_subdev *sd = i2c_get_clientdata(client); upd64083_remove() local
202 v4l2_device_unregister_subdev(sd); upd64083_remove()
H A Dvp27smpx.c41 struct v4l2_subdev sd; member in struct:vp27smpx_state
46 static inline struct vp27smpx_state *to_state(struct v4l2_subdev *sd) to_state() argument
48 return container_of(sd, struct vp27smpx_state, sd); to_state()
51 static void vp27smpx_set_audmode(struct v4l2_subdev *sd, u32 audmode) vp27smpx_set_audmode() argument
53 struct vp27smpx_state *state = to_state(sd); vp27smpx_set_audmode()
54 struct i2c_client *client = v4l2_get_subdevdata(sd); vp27smpx_set_audmode()
71 v4l2_err(sd, "I/O error setting audmode\n"); vp27smpx_set_audmode()
76 static int vp27smpx_s_radio(struct v4l2_subdev *sd) vp27smpx_s_radio() argument
78 struct vp27smpx_state *state = to_state(sd); vp27smpx_s_radio()
84 static int vp27smpx_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) vp27smpx_s_std() argument
86 struct vp27smpx_state *state = to_state(sd); vp27smpx_s_std()
92 static int vp27smpx_s_tuner(struct v4l2_subdev *sd, const struct v4l2_tuner *vt) vp27smpx_s_tuner() argument
94 struct vp27smpx_state *state = to_state(sd); vp27smpx_s_tuner()
97 vp27smpx_set_audmode(sd, vt->audmode); vp27smpx_s_tuner()
101 static int vp27smpx_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) vp27smpx_g_tuner() argument
103 struct vp27smpx_state *state = to_state(sd); vp27smpx_g_tuner()
114 static int vp27smpx_log_status(struct v4l2_subdev *sd) vp27smpx_log_status() argument
116 struct vp27smpx_state *state = to_state(sd); vp27smpx_log_status()
118 v4l2_info(sd, "Audio Mode: %u%s\n", state->audmode, vp27smpx_log_status()
158 struct v4l2_subdev *sd; vp27smpx_probe() local
170 sd = &state->sd; vp27smpx_probe()
171 v4l2_i2c_subdev_init(sd, client, &vp27smpx_ops); vp27smpx_probe()
175 vp27smpx_set_audmode(sd, state->audmode); vp27smpx_probe()
181 struct v4l2_subdev *sd = i2c_get_clientdata(client); vp27smpx_remove() local
183 v4l2_device_unregister_subdev(sd); vp27smpx_remove()
H A Dm52790.c39 struct v4l2_subdev sd; member in struct:m52790_state
44 static inline struct m52790_state *to_state(struct v4l2_subdev *sd) to_state() argument
46 return container_of(sd, struct m52790_state, sd); to_state()
51 static int m52790_write(struct v4l2_subdev *sd) m52790_write() argument
53 struct m52790_state *state = to_state(sd); m52790_write()
54 struct i2c_client *client = v4l2_get_subdevdata(sd); m52790_write()
70 static int m52790_s_routing(struct v4l2_subdev *sd, m52790_s_routing() argument
73 struct m52790_state *state = to_state(sd); m52790_s_routing()
77 m52790_write(sd); m52790_s_routing()
82 static int m52790_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) m52790_g_register() argument
84 struct m52790_state *state = to_state(sd); m52790_g_register()
93 static int m52790_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) m52790_s_register() argument
95 struct m52790_state *state = to_state(sd); m52790_s_register()
101 m52790_write(sd); m52790_s_register()
106 static int m52790_log_status(struct v4l2_subdev *sd) m52790_log_status() argument
108 struct m52790_state *state = to_state(sd); m52790_log_status()
110 v4l2_info(sd, "Switch 1: %02x\n", m52790_log_status()
112 v4l2_info(sd, "Switch 2: %02x\n", m52790_log_status()
149 struct v4l2_subdev *sd; m52790_probe() local
162 sd = &state->sd; m52790_probe()
163 v4l2_i2c_subdev_init(sd, client, &m52790_ops); m52790_probe()
166 m52790_write(sd); m52790_probe()
172 struct v4l2_subdev *sd = i2c_get_clientdata(client); m52790_remove() local
174 v4l2_device_unregister_subdev(sd); m52790_remove()
H A Dadv7343.c46 struct v4l2_subdev sd; member in struct:adv7343_state
59 static inline struct adv7343_state *to_state(struct v4l2_subdev *sd) to_state() argument
61 return container_of(sd, struct adv7343_state, sd); to_state()
66 return &container_of(ctrl->handler, struct adv7343_state, hdl)->sd; to_sd()
69 static inline int adv7343_write(struct v4l2_subdev *sd, u8 reg, u8 value) adv7343_write() argument
71 struct i2c_client *client = v4l2_get_subdevdata(sd); adv7343_write()
132 static int adv7343_setstd(struct v4l2_subdev *sd, v4l2_std_id std) adv7343_setstd() argument
134 struct adv7343_state *state = to_state(sd); adv7343_setstd()
151 v4l2_dbg(1, debug, sd, adv7343_setstd()
160 err = adv7343_write(sd, ADV7343_SD_MODE_REG1, val); adv7343_setstd()
169 err = adv7343_write(sd, ADV7343_MODE_SELECT_REG, val); adv7343_setstd()
179 err = adv7343_write(sd, reg, *fsc_ptr); adv7343_setstd()
192 err = adv7343_write(sd, ADV7343_SD_MODE_REG1, val); adv7343_setstd()
200 v4l2_err(sd, "Error setting std, write failed\n"); adv7343_setstd()
205 static int adv7343_setoutput(struct v4l2_subdev *sd, u32 output_type) adv7343_setoutput() argument
207 struct adv7343_state *state = to_state(sd); adv7343_setoutput()
212 v4l2_dbg(1, debug, sd, adv7343_setoutput()
239 err = adv7343_write(sd, ADV7343_POWER_MODE_REG, val); adv7343_setoutput()
247 err = adv7343_write(sd, ADV7343_MODE_REG0, val); adv7343_setoutput()
266 err = adv7343_write(sd, ADV7343_SD_MODE_REG2, val); adv7343_setoutput()
275 err = adv7343_write(sd, ADV7343_HD_MODE_REG6, val); adv7343_setoutput()
283 v4l2_err(sd, "Error setting output, write failed\n"); adv7343_setoutput()
288 static int adv7343_log_status(struct v4l2_subdev *sd) adv7343_log_status() argument
290 struct adv7343_state *state = to_state(sd); adv7343_log_status()
292 v4l2_info(sd, "Standard: %llx\n", (unsigned long long)state->std); adv7343_log_status()
293 v4l2_info(sd, "Output: %s\n", (state->output == 0) ? "Composite" : adv7343_log_status()
300 struct v4l2_subdev *sd = to_sd(ctrl); adv7343_s_ctrl() local
304 return adv7343_write(sd, ADV7343_SD_BRIGHTNESS_WSS, adv7343_s_ctrl()
308 return adv7343_write(sd, ADV7343_SD_HUE_REG, ctrl->val); adv7343_s_ctrl()
311 return adv7343_write(sd, ADV7343_DAC2_OUTPUT_LEVEL, ctrl->val); adv7343_s_ctrl()
331 static int adv7343_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) adv7343_s_std_output() argument
333 struct adv7343_state *state = to_state(sd); adv7343_s_std_output()
339 err = adv7343_setstd(sd, std); adv7343_s_std_output()
346 static int adv7343_s_routing(struct v4l2_subdev *sd, adv7343_s_routing() argument
349 struct adv7343_state *state = to_state(sd); adv7343_s_routing()
355 err = adv7343_setoutput(sd, output); adv7343_s_routing()
372 static int adv7343_initialize(struct v4l2_subdev *sd) adv7343_initialize() argument
374 struct adv7343_state *state = to_state(sd); adv7343_initialize()
380 err = adv7343_write(sd, adv7343_init_reg_val[i], adv7343_initialize()
383 v4l2_err(sd, "Error initializing\n"); adv7343_initialize()
389 err = adv7343_setoutput(sd, state->output); adv7343_initialize()
391 v4l2_err(sd, "Error setting output during init\n"); adv7343_initialize()
395 err = adv7343_setstd(sd, state->std); adv7343_initialize()
397 v4l2_err(sd, "Error setting std during init\n"); adv7343_initialize()
430 of_property_read_u32_array(np, "adi,sd-dac-enable", adv7343_get_pdata()
468 v4l2_i2c_subdev_init(&state->sd, client, &adv7343_ops); adv7343_probe()
483 state->sd.ctrl_handler = &state->hdl; adv7343_probe()
490 err = adv7343_initialize(&state->sd); adv7343_probe()
494 err = v4l2_async_register_subdev(&state->sd); adv7343_probe()
505 struct v4l2_subdev *sd = i2c_get_clientdata(client); adv7343_remove() local
506 struct adv7343_state *state = to_state(sd); adv7343_remove()
508 v4l2_async_unregister_subdev(&state->sd); adv7343_remove()
H A Dcs53l32a.c45 struct v4l2_subdev sd; member in struct:cs53l32a_state
49 static inline struct cs53l32a_state *to_state(struct v4l2_subdev *sd) to_state() argument
51 return container_of(sd, struct cs53l32a_state, sd); to_state()
56 return &container_of(ctrl->handler, struct cs53l32a_state, hdl)->sd; to_sd()
61 static int cs53l32a_write(struct v4l2_subdev *sd, u8 reg, u8 value) cs53l32a_write() argument
63 struct i2c_client *client = v4l2_get_subdevdata(sd); cs53l32a_write()
68 static int cs53l32a_read(struct v4l2_subdev *sd, u8 reg) cs53l32a_read() argument
70 struct i2c_client *client = v4l2_get_subdevdata(sd); cs53l32a_read()
75 static int cs53l32a_s_routing(struct v4l2_subdev *sd, cs53l32a_s_routing() argument
83 v4l2_err(sd, "Invalid input %d.\n", input); cs53l32a_s_routing()
86 cs53l32a_write(sd, 0x01, 0x01 + (input << 4)); cs53l32a_s_routing()
92 struct v4l2_subdev *sd = to_sd(ctrl); cs53l32a_s_ctrl() local
96 cs53l32a_write(sd, 0x03, ctrl->val ? 0xf0 : 0x30); cs53l32a_s_ctrl()
99 cs53l32a_write(sd, 0x04, (u8)ctrl->val); cs53l32a_s_ctrl()
100 cs53l32a_write(sd, 0x05, (u8)ctrl->val); cs53l32a_s_ctrl()
106 static int cs53l32a_log_status(struct v4l2_subdev *sd) cs53l32a_log_status() argument
108 struct cs53l32a_state *state = to_state(sd); cs53l32a_log_status()
109 u8 v = cs53l32a_read(sd, 0x01); cs53l32a_log_status()
111 v4l2_info(sd, "Input: %d\n", (v >> 4) & 3); cs53l32a_log_status()
112 v4l2_ctrl_handler_log_status(&state->hdl, sd->name); cs53l32a_log_status()
155 struct v4l2_subdev *sd; cs53l32a_probe() local
171 sd = &state->sd; cs53l32a_probe()
172 v4l2_i2c_subdev_init(sd, client, &cs53l32a_ops); cs53l32a_probe()
175 u8 v = cs53l32a_read(sd, i); cs53l32a_probe()
177 v4l2_dbg(1, debug, sd, "Read Reg %d %02x\n", i, v); cs53l32a_probe()
185 sd->ctrl_handler = &state->hdl; cs53l32a_probe()
195 cs53l32a_write(sd, 0x01, 0x21); cs53l32a_probe()
196 cs53l32a_write(sd, 0x02, 0x29); cs53l32a_probe()
197 cs53l32a_write(sd, 0x03, 0x30); cs53l32a_probe()
198 cs53l32a_write(sd, 0x04, 0x00); cs53l32a_probe()
199 cs53l32a_write(sd, 0x05, 0x00); cs53l32a_probe()
200 cs53l32a_write(sd, 0x06, 0x00); cs53l32a_probe()
201 cs53l32a_write(sd, 0x07, 0x00); cs53l32a_probe()
206 u8 v = cs53l32a_read(sd, i); cs53l32a_probe()
208 v4l2_dbg(1, debug, sd, "Read Reg %d %02x\n", i, v); cs53l32a_probe()
215 struct v4l2_subdev *sd = i2c_get_clientdata(client); cs53l32a_remove() local
216 struct cs53l32a_state *state = to_state(sd); cs53l32a_remove()
218 v4l2_device_unregister_subdev(sd); cs53l32a_remove()
H A Dtvp514x.c89 static int tvp514x_s_stream(struct v4l2_subdev *sd, int enable);
92 * @sd: Subdevice Slave handle
107 struct v4l2_subdev sd; member in struct:tvp514x_decoder
270 static inline struct tvp514x_decoder *to_decoder(struct v4l2_subdev *sd) to_decoder() argument
272 return container_of(sd, struct tvp514x_decoder, sd); to_decoder()
277 return &container_of(ctrl->handler, struct tvp514x_decoder, hdl)->sd; to_sd()
283 * @sd: ptr to v4l2_subdev struct
288 static int tvp514x_read_reg(struct v4l2_subdev *sd, u8 reg) tvp514x_read_reg() argument
291 struct i2c_client *client = v4l2_get_subdevdata(sd); tvp514x_read_reg()
298 v4l2_warn(sd, "Read: retry ... %d\n", retry); tvp514x_read_reg()
310 * @sd: ptr to v4l2_subdev struct
313 static void dump_reg(struct v4l2_subdev *sd, u8 reg) dump_reg() argument
317 val = tvp514x_read_reg(sd, reg); dump_reg()
318 v4l2_info(sd, "Reg(0x%.2X): 0x%.2X\n", reg, val); dump_reg()
323 * @sd: ptr to v4l2_subdev struct
330 static int tvp514x_write_reg(struct v4l2_subdev *sd, u8 reg, u8 val) tvp514x_write_reg() argument
333 struct i2c_client *client = v4l2_get_subdevdata(sd); tvp514x_write_reg()
340 v4l2_warn(sd, "Write: retry ... %d\n", retry); tvp514x_write_reg()
352 * @sd: ptr to v4l2_subdev struct
362 static int tvp514x_write_regs(struct v4l2_subdev *sd, tvp514x_write_regs() argument
377 err = tvp514x_write_reg(sd, next->reg, (u8) next->val); tvp514x_write_regs()
379 v4l2_err(sd, "Write failed. Err[%d]\n", err); tvp514x_write_regs()
388 * @sd: ptr to v4l2_subdev struct
393 static enum tvp514x_std tvp514x_query_current_std(struct v4l2_subdev *sd) tvp514x_query_current_std() argument
397 std = tvp514x_read_reg(sd, REG_VIDEO_STD); tvp514x_query_current_std()
400 std_status = tvp514x_read_reg(sd, REG_VIDEO_STD_STATUS); tvp514x_query_current_std()
420 static void tvp514x_reg_dump(struct v4l2_subdev *sd) tvp514x_reg_dump() argument
422 dump_reg(sd, REG_INPUT_SEL); tvp514x_reg_dump()
423 dump_reg(sd, REG_AFE_GAIN_CTRL); tvp514x_reg_dump()
424 dump_reg(sd, REG_VIDEO_STD); tvp514x_reg_dump()
425 dump_reg(sd, REG_OPERATION_MODE); tvp514x_reg_dump()
426 dump_reg(sd, REG_COLOR_KILLER); tvp514x_reg_dump()
427 dump_reg(sd, REG_LUMA_CONTROL1); tvp514x_reg_dump()
428 dump_reg(sd, REG_LUMA_CONTROL2); tvp514x_reg_dump()
429 dump_reg(sd, REG_LUMA_CONTROL3); tvp514x_reg_dump()
430 dump_reg(sd, REG_BRIGHTNESS); tvp514x_reg_dump()
431 dump_reg(sd, REG_CONTRAST); tvp514x_reg_dump()
432 dump_reg(sd, REG_SATURATION); tvp514x_reg_dump()
433 dump_reg(sd, REG_HUE); tvp514x_reg_dump()
434 dump_reg(sd, REG_CHROMA_CONTROL1); tvp514x_reg_dump()
435 dump_reg(sd, REG_CHROMA_CONTROL2); tvp514x_reg_dump()
436 dump_reg(sd, REG_COMP_PR_SATURATION); tvp514x_reg_dump()
437 dump_reg(sd, REG_COMP_Y_CONTRAST); tvp514x_reg_dump()
438 dump_reg(sd, REG_COMP_PB_SATURATION); tvp514x_reg_dump()
439 dump_reg(sd, REG_COMP_Y_BRIGHTNESS); tvp514x_reg_dump()
440 dump_reg(sd, REG_AVID_START_PIXEL_LSB); tvp514x_reg_dump()
441 dump_reg(sd, REG_AVID_START_PIXEL_MSB); tvp514x_reg_dump()
442 dump_reg(sd, REG_AVID_STOP_PIXEL_LSB); tvp514x_reg_dump()
443 dump_reg(sd, REG_AVID_STOP_PIXEL_MSB); tvp514x_reg_dump()
444 dump_reg(sd, REG_HSYNC_START_PIXEL_LSB); tvp514x_reg_dump()
445 dump_reg(sd, REG_HSYNC_START_PIXEL_MSB); tvp514x_reg_dump()
446 dump_reg(sd, REG_HSYNC_STOP_PIXEL_LSB); tvp514x_reg_dump()
447 dump_reg(sd, REG_HSYNC_STOP_PIXEL_MSB); tvp514x_reg_dump()
448 dump_reg(sd, REG_VSYNC_START_LINE_LSB); tvp514x_reg_dump()
449 dump_reg(sd, REG_VSYNC_START_LINE_MSB); tvp514x_reg_dump()
450 dump_reg(sd, REG_VSYNC_STOP_LINE_LSB); tvp514x_reg_dump()
451 dump_reg(sd, REG_VSYNC_STOP_LINE_MSB); tvp514x_reg_dump()
452 dump_reg(sd, REG_VBLK_START_LINE_LSB); tvp514x_reg_dump()
453 dump_reg(sd, REG_VBLK_START_LINE_MSB); tvp514x_reg_dump()
454 dump_reg(sd, REG_VBLK_STOP_LINE_LSB); tvp514x_reg_dump()
455 dump_reg(sd, REG_VBLK_STOP_LINE_MSB); tvp514x_reg_dump()
456 dump_reg(sd, REG_SYNC_CONTROL); tvp514x_reg_dump()
457 dump_reg(sd, REG_OUTPUT_FORMATTER1); tvp514x_reg_dump()
458 dump_reg(sd, REG_OUTPUT_FORMATTER2); tvp514x_reg_dump()
459 dump_reg(sd, REG_OUTPUT_FORMATTER3); tvp514x_reg_dump()
460 dump_reg(sd, REG_OUTPUT_FORMATTER4); tvp514x_reg_dump()
461 dump_reg(sd, REG_OUTPUT_FORMATTER5); tvp514x_reg_dump()
462 dump_reg(sd, REG_OUTPUT_FORMATTER6); tvp514x_reg_dump()
463 dump_reg(sd, REG_CLEAR_LOST_LOCK); tvp514x_reg_dump()
468 * @sd: ptr to v4l2_subdev struct
473 static int tvp514x_configure(struct v4l2_subdev *sd, tvp514x_configure() argument
480 tvp514x_write_regs(sd, decoder->tvp514x_regs); tvp514x_configure()
485 tvp514x_reg_dump(sd); tvp514x_configure()
492 * @sd: pointer to standard V4L2 sub-device structure
501 static int tvp514x_detect(struct v4l2_subdev *sd, tvp514x_detect() argument
505 struct i2c_client *client = v4l2_get_subdevdata(sd); tvp514x_detect()
507 chip_id_msb = tvp514x_read_reg(sd, REG_CHIP_ID_MSB); tvp514x_detect()
508 chip_id_lsb = tvp514x_read_reg(sd, REG_CHIP_ID_LSB); tvp514x_detect()
509 rom_ver = tvp514x_read_reg(sd, REG_ROM_VERSION); tvp514x_detect()
511 v4l2_dbg(1, debug, sd, tvp514x_detect()
520 v4l2_err(sd, "chip id mismatch msb:0x%x lsb:0x%x\n", tvp514x_detect()
527 v4l2_info(sd, "%s (Version - 0x%.2x) found at 0x%x (%s)\n", tvp514x_detect()
535 * @sd: pointer to standard V4L2 sub-device structure
541 static int tvp514x_querystd(struct v4l2_subdev *sd, v4l2_std_id *std_id) tvp514x_querystd() argument
543 struct tvp514x_decoder *decoder = to_decoder(sd); tvp514x_querystd()
553 tvp514x_s_stream(sd, 1); tvp514x_querystd()
558 current_std = tvp514x_query_current_std(sd); tvp514x_querystd()
602 sync_lock_status = tvp514x_read_reg(sd, REG_STATUS1); tvp514x_querystd()
610 v4l2_dbg(1, debug, sd, "Current STD: %s\n", tvp514x_querystd()
617 * @sd: pointer to standard V4L2 sub-device structure
623 static int tvp514x_s_std(struct v4l2_subdev *sd, v4l2_std_id std_id) tvp514x_s_std() argument
625 struct tvp514x_decoder *decoder = to_decoder(sd); tvp514x_s_std()
635 err = tvp514x_write_reg(sd, REG_VIDEO_STD, tvp514x_s_std()
644 v4l2_dbg(1, debug, sd, "Standard set to: %s\n", tvp514x_s_std()
651 * @sd: pointer to standard V4L2 sub-device structure
660 static int tvp514x_s_routing(struct v4l2_subdev *sd, tvp514x_s_routing() argument
663 struct tvp514x_decoder *decoder = to_decoder(sd); tvp514x_s_routing()
676 err = tvp514x_write_reg(sd, REG_INPUT_SEL, input_sel); tvp514x_s_routing()
680 output_sel |= tvp514x_read_reg(sd, tvp514x_s_routing()
682 err = tvp514x_write_reg(sd, REG_OUTPUT_FORMATTER1, tvp514x_s_routing()
692 v4l2_dbg(1, debug, sd, "Input set to: %d\n", input_sel); tvp514x_s_routing()
706 struct v4l2_subdev *sd = to_sd(ctrl); tvp514x_s_ctrl() local
707 struct tvp514x_decoder *decoder = to_decoder(sd); tvp514x_s_ctrl()
714 err = tvp514x_write_reg(sd, REG_BRIGHTNESS, value); tvp514x_s_ctrl()
719 err = tvp514x_write_reg(sd, REG_CONTRAST, value); tvp514x_s_ctrl()
724 err = tvp514x_write_reg(sd, REG_SATURATION, value); tvp514x_s_ctrl()
733 err = tvp514x_write_reg(sd, REG_HUE, value); tvp514x_s_ctrl()
738 err = tvp514x_write_reg(sd, REG_AFE_GAIN_CTRL, value ? 0x0f : 0x0c); tvp514x_s_ctrl()
744 v4l2_dbg(1, debug, sd, "Set Control: ID - %d - %d\n", tvp514x_s_ctrl()
751 * @sd: pointer to standard V4L2 sub-device structure
758 tvp514x_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index, tvp514x_enum_mbus_fmt() argument
770 * @sd: pointer to standard V4L2 sub-device structure
776 tvp514x_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f) tvp514x_mbus_fmt() argument
778 struct tvp514x_decoder *decoder = to_decoder(sd); tvp514x_mbus_fmt()
792 v4l2_dbg(1, debug, sd, "MBUS_FMT: Width - %d, Height - %d\n", tvp514x_mbus_fmt()
799 * @sd: pointer to standard V4L2 sub-device structure
805 tvp514x_g_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *a) tvp514x_g_parm() argument
807 struct tvp514x_decoder *decoder = to_decoder(sd); tvp514x_g_parm()
831 * @sd: pointer to standard V4L2 sub-device structure
838 tvp514x_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *a) tvp514x_s_parm() argument
840 struct tvp514x_decoder *decoder = to_decoder(sd); tvp514x_s_parm()
864 * @sd: pointer to standard V4L2 sub-device structure
869 static int tvp514x_s_stream(struct v4l2_subdev *sd, int enable) tvp514x_s_stream() argument
872 struct tvp514x_decoder *decoder = to_decoder(sd); tvp514x_s_stream()
881 err = tvp514x_write_reg(sd, REG_OPERATION_MODE, 0x01); tvp514x_s_stream()
883 v4l2_err(sd, "Unable to turn off decoder\n"); tvp514x_s_stream()
892 err = tvp514x_write_regs(sd, decoder->int_seq); tvp514x_s_stream()
894 v4l2_err(sd, "Unable to turn on decoder\n"); tvp514x_s_stream()
898 err = tvp514x_detect(sd, decoder); tvp514x_s_stream()
900 v4l2_err(sd, "Unable to detect decoder\n"); tvp514x_s_stream()
903 err = tvp514x_configure(sd, decoder); tvp514x_s_stream()
905 v4l2_err(sd, "Unable to configure decoder\n"); tvp514x_s_stream()
925 * @sd: pointer to standard V4L2 sub-device structure
931 static int tvp514x_enum_mbus_code(struct v4l2_subdev *sd, tvp514x_enum_mbus_code() argument
952 * @sd: pointer to standard V4L2 sub-device structure
958 static int tvp514x_get_pad_format(struct v4l2_subdev *sd, tvp514x_get_pad_format() argument
962 struct tvp514x_decoder *decoder = to_decoder(sd); tvp514x_get_pad_format()
981 * @sd: pointer to standard V4L2 sub-device structure
987 static int tvp514x_set_pad_format(struct v4l2_subdev *sd, tvp514x_set_pad_format() argument
991 struct tvp514x_decoder *decoder = to_decoder(sd); tvp514x_set_pad_format()
1110 struct v4l2_subdev *sd; tvp514x_probe() local
1152 sd = &decoder->sd; tvp514x_probe()
1153 v4l2_i2c_subdev_init(sd, client, &tvp514x_ops); tvp514x_probe()
1157 decoder->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; tvp514x_probe()
1158 decoder->sd.entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER; tvp514x_probe()
1160 ret = media_entity_init(&decoder->sd.entity, 1, &decoder->pad, 0); tvp514x_probe()
1162 v4l2_err(sd, "%s decoder driver failed to register !!\n", tvp514x_probe()
1163 sd->name); tvp514x_probe()
1178 sd->ctrl_handler = &decoder->hdl; tvp514x_probe()
1185 ret = v4l2_async_register_subdev(&decoder->sd); tvp514x_probe()
1187 v4l2_info(sd, "%s decoder driver registered !!\n", sd->name); tvp514x_probe()
1193 media_entity_cleanup(&decoder->sd.entity); tvp514x_probe()
1208 struct v4l2_subdev *sd = i2c_get_clientdata(client); tvp514x_remove() local
1209 struct tvp514x_decoder *decoder = to_decoder(sd); tvp514x_remove()
1211 v4l2_async_unregister_subdev(&decoder->sd); tvp514x_remove()
1213 media_entity_cleanup(&decoder->sd.entity); tvp514x_remove()
H A Dadv7393.c48 struct v4l2_subdev sd; member in struct:adv7393_state
60 static inline struct adv7393_state *to_state(struct v4l2_subdev *sd) to_state() argument
62 return container_of(sd, struct adv7393_state, sd); to_state()
67 return &container_of(ctrl->handler, struct adv7393_state, hdl)->sd; to_sd()
70 static inline int adv7393_write(struct v4l2_subdev *sd, u8 reg, u8 value) adv7393_write() argument
72 struct i2c_client *client = v4l2_get_subdevdata(sd); adv7393_write()
135 static int adv7393_setstd(struct v4l2_subdev *sd, v4l2_std_id std) adv7393_setstd() argument
137 struct adv7393_state *state = to_state(sd); adv7393_setstd()
153 v4l2_dbg(1, debug, sd, adv7393_setstd()
164 err = adv7393_write(sd, ADV7393_SD_MODE_REG1, val); adv7393_setstd()
173 err = adv7393_write(sd, ADV7393_MODE_SELECT_REG, val); adv7393_setstd()
182 err = adv7393_write(sd, reg, val); adv7393_setstd()
196 err = adv7393_write(sd, ADV7393_SD_MODE_REG2, val); adv7393_setstd()
204 v4l2_err(sd, "Error setting std, write failed\n"); adv7393_setstd()
209 static int adv7393_setoutput(struct v4l2_subdev *sd, u32 output_type) adv7393_setoutput() argument
211 struct adv7393_state *state = to_state(sd); adv7393_setoutput()
216 v4l2_dbg(1, debug, sd, adv7393_setoutput()
232 err = adv7393_write(sd, ADV7393_POWER_MODE_REG, val); adv7393_setoutput()
240 err = adv7393_write(sd, ADV7393_MODE_REG0, val); adv7393_setoutput()
252 err = adv7393_write(sd, ADV7393_SD_MODE_REG2, val); adv7393_setoutput()
260 err = adv7393_write(sd, ADV7393_HD_MODE_REG6, val); adv7393_setoutput()
268 v4l2_err(sd, "Error setting output, write failed\n"); adv7393_setoutput()
273 static int adv7393_log_status(struct v4l2_subdev *sd) adv7393_log_status() argument
275 struct adv7393_state *state = to_state(sd); adv7393_log_status()
277 v4l2_info(sd, "Standard: %llx\n", (unsigned long long)state->std); adv7393_log_status()
278 v4l2_info(sd, "Output: %s\n", (state->output == 0) ? "Composite" : adv7393_log_status()
285 struct v4l2_subdev *sd = to_sd(ctrl); adv7393_s_ctrl() local
289 return adv7393_write(sd, ADV7393_SD_BRIGHTNESS_WSS, adv7393_s_ctrl()
293 return adv7393_write(sd, ADV7393_SD_HUE_ADJUST, adv7393_s_ctrl()
297 return adv7393_write(sd, ADV7393_DAC123_OUTPUT_LEVEL, adv7393_s_ctrl()
318 static int adv7393_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) adv7393_s_std_output() argument
320 struct adv7393_state *state = to_state(sd); adv7393_s_std_output()
326 err = adv7393_setstd(sd, std); adv7393_s_std_output()
333 static int adv7393_s_routing(struct v4l2_subdev *sd, adv7393_s_routing() argument
336 struct adv7393_state *state = to_state(sd); adv7393_s_routing()
342 err = adv7393_setoutput(sd, output); adv7393_s_routing()
359 static int adv7393_initialize(struct v4l2_subdev *sd) adv7393_initialize() argument
361 struct adv7393_state *state = to_state(sd); adv7393_initialize()
367 err = adv7393_write(sd, adv7393_init_reg_val[i], adv7393_initialize()
370 v4l2_err(sd, "Error initializing\n"); adv7393_initialize()
376 err = adv7393_setoutput(sd, state->output); adv7393_initialize()
378 v4l2_err(sd, "Error setting output during init\n"); adv7393_initialize()
382 err = adv7393_setstd(sd, state->std); adv7393_initialize()
384 v4l2_err(sd, "Error setting std during init\n"); adv7393_initialize()
417 v4l2_i2c_subdev_init(&state->sd, client, &adv7393_ops); adv7393_probe()
432 state->sd.ctrl_handler = &state->hdl; adv7393_probe()
441 err = adv7393_initialize(&state->sd); adv7393_probe()
449 struct v4l2_subdev *sd = i2c_get_clientdata(client); adv7393_remove() local
450 struct adv7393_state *state = to_state(sd); adv7393_remove()
452 v4l2_device_unregister_subdev(sd); adv7393_remove()
H A Dwm8739.c54 struct v4l2_subdev sd; member in struct:wm8739_state
65 static inline struct wm8739_state *to_state(struct v4l2_subdev *sd) to_state() argument
67 return container_of(sd, struct wm8739_state, sd); to_state()
72 return &container_of(ctrl->handler, struct wm8739_state, hdl)->sd; to_sd()
77 static int wm8739_write(struct v4l2_subdev *sd, int reg, u16 val) wm8739_write() argument
79 struct i2c_client *client = v4l2_get_subdevdata(sd); wm8739_write()
83 v4l2_err(sd, "Invalid register R%d\n", reg); wm8739_write()
87 v4l2_dbg(1, debug, sd, "write: %02x %02x\n", reg, val); wm8739_write()
93 v4l2_err(sd, "I2C: cannot write %03x to register R%d\n", val, reg); wm8739_write()
99 struct v4l2_subdev *sd = to_sd(ctrl); wm8739_s_ctrl() local
100 struct wm8739_state *state = to_state(sd); wm8739_s_ctrl()
127 wm8739_write(sd, R0, (vol_l & 0x1f) | mute); wm8739_s_ctrl()
128 wm8739_write(sd, R1, (vol_r & 0x1f) | mute); wm8739_s_ctrl()
134 static int wm8739_s_clock_freq(struct v4l2_subdev *sd, u32 audiofreq) wm8739_s_clock_freq() argument
136 struct wm8739_state *state = to_state(sd); wm8739_s_clock_freq()
140 wm8739_write(sd, R9, 0x000); wm8739_s_clock_freq()
144 wm8739_write(sd, R8, 0x020); wm8739_s_clock_freq()
148 wm8739_write(sd, R8, 0x000); wm8739_s_clock_freq()
152 wm8739_write(sd, R8, 0x018); wm8739_s_clock_freq()
158 wm8739_write(sd, R9, 0x001); wm8739_s_clock_freq()
162 static int wm8739_log_status(struct v4l2_subdev *sd) wm8739_log_status() argument
164 struct wm8739_state *state = to_state(sd); wm8739_log_status()
166 v4l2_info(sd, "Frequency: %u Hz\n", state->clock_freq); wm8739_log_status()
167 v4l2_ctrl_handler_log_status(&state->hdl, sd->name); wm8739_log_status()
205 struct v4l2_subdev *sd; wm8739_probe() local
217 sd = &state->sd; wm8739_probe()
218 v4l2_i2c_subdev_init(sd, client, &wm8739_ops); wm8739_probe()
226 sd->ctrl_handler = &state->hdl; wm8739_probe()
240 wm8739_write(sd, R15, 0x00); wm8739_probe()
242 wm8739_write(sd, R5, 0x000); wm8739_probe()
244 wm8739_write(sd, R6, 0x000); wm8739_probe()
247 wm8739_write(sd, R7, 0x049); wm8739_probe()
249 wm8739_write(sd, R8, 0x000); wm8739_probe()
251 wm8739_write(sd, R9, 0x001); wm8739_probe()
259 struct v4l2_subdev *sd = i2c_get_clientdata(client); wm8739_remove() local
260 struct wm8739_state *state = to_state(sd); wm8739_remove()
262 v4l2_device_unregister_subdev(sd); wm8739_remove()
H A Dtda9840.c59 static void tda9840_write(struct v4l2_subdev *sd, u8 reg, u8 val) tda9840_write() argument
61 struct i2c_client *client = v4l2_get_subdevdata(sd); tda9840_write()
64 v4l2_dbg(1, debug, sd, "error writing %02x to %02x\n", tda9840_write()
68 static int tda9840_status(struct v4l2_subdev *sd) tda9840_status() argument
70 struct i2c_client *client = v4l2_get_subdevdata(sd); tda9840_status()
74 v4l2_dbg(1, debug, sd, tda9840_status()
80 v4l2_dbg(1, debug, sd, tda9840_status()
85 v4l2_dbg(1, debug, sd, "TDA9840_DETECT: byte: 0x%02x\n", byte); tda9840_status()
89 static int tda9840_s_tuner(struct v4l2_subdev *sd, const struct v4l2_tuner *t) tda9840_s_tuner() argument
91 int stat = tda9840_status(sd); tda9840_s_tuner()
116 v4l2_dbg(1, debug, sd, "TDA9840_SWITCH: 0x%02x\n", byte); tda9840_s_tuner()
117 tda9840_write(sd, SWITCH, byte); tda9840_s_tuner()
121 static int tda9840_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *t) tda9840_g_tuner() argument
123 int stat = tda9840_status(sd); tda9840_g_tuner()
163 struct v4l2_subdev *sd; tda9840_probe() local
174 sd = devm_kzalloc(&client->dev, sizeof(*sd), GFP_KERNEL); tda9840_probe()
175 if (sd == NULL) tda9840_probe()
177 v4l2_i2c_subdev_init(sd, client, &tda9840_ops); tda9840_probe()
180 tda9840_write(sd, LEVEL_ADJUST, 0); tda9840_probe()
181 tda9840_write(sd, STEREO_ADJUST, 0); tda9840_probe()
182 tda9840_write(sd, SWITCH, TDA9840_SET_STEREO); tda9840_probe()
188 struct v4l2_subdev *sd = i2c_get_clientdata(client); tda9840_remove() local
190 v4l2_device_unregister_subdev(sd); tda9840_remove()
H A Dupd64031a.c63 struct v4l2_subdev sd; member in struct:upd64031a_state
71 static inline struct upd64031a_state *to_state(struct v4l2_subdev *sd) to_state() argument
73 return container_of(sd, struct upd64031a_state, sd); to_state()
85 static u8 upd64031a_read(struct v4l2_subdev *sd, u8 reg) upd64031a_read() argument
87 struct i2c_client *client = v4l2_get_subdevdata(sd); upd64031a_read()
98 static void upd64031a_write(struct v4l2_subdev *sd, u8 reg, u8 val) upd64031a_write() argument
100 struct i2c_client *client = v4l2_get_subdevdata(sd); upd64031a_write()
105 v4l2_dbg(1, debug, sd, "write reg: %02X val: %02X\n", reg, val); upd64031a_write()
107 v4l2_err(sd, "I/O error write 0x%02x/0x%02x\n", reg, val); upd64031a_write()
113 static int upd64031a_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *freq) upd64031a_s_frequency() argument
115 struct upd64031a_state *state = to_state(sd); upd64031a_s_frequency()
118 v4l2_dbg(1, debug, sd, "changed input or channel\n"); upd64031a_s_frequency()
119 upd64031a_write(sd, R00, reg | 0x10); upd64031a_s_frequency()
120 upd64031a_write(sd, R00, reg & ~0x10); upd64031a_s_frequency()
126 static int upd64031a_s_routing(struct v4l2_subdev *sd, upd64031a_s_routing() argument
129 struct upd64031a_state *state = to_state(sd); upd64031a_s_routing()
143 upd64031a_write(sd, R00, r00); upd64031a_s_routing()
144 upd64031a_write(sd, R05, r05); upd64031a_s_routing()
145 upd64031a_write(sd, R08, r08); upd64031a_s_routing()
146 return upd64031a_s_frequency(sd, NULL); upd64031a_s_routing()
149 static int upd64031a_log_status(struct v4l2_subdev *sd) upd64031a_log_status() argument
151 v4l2_info(sd, "Status: SA00=0x%02x SA01=0x%02x\n", upd64031a_log_status()
152 upd64031a_read(sd, 0), upd64031a_read(sd, 1)); upd64031a_log_status()
157 static int upd64031a_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) upd64031a_g_register() argument
159 reg->val = upd64031a_read(sd, reg->reg & 0xff); upd64031a_g_register()
164 static int upd64031a_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) upd64031a_s_register() argument
166 upd64031a_write(sd, reg->reg & 0xff, reg->val & 0xff); upd64031a_s_register()
203 struct v4l2_subdev *sd; upd64031a_probe() local
215 sd = &state->sd; upd64031a_probe()
216 v4l2_i2c_subdev_init(sd, client, &upd64031a_ops); upd64031a_probe()
222 upd64031a_write(sd, i, state->regs[i]); upd64031a_probe()
228 struct v4l2_subdev *sd = i2c_get_clientdata(client); upd64031a_remove() local
230 v4l2_device_unregister_subdev(sd); upd64031a_remove()
H A Dsaa7185.c48 struct v4l2_subdev sd; member in struct:saa7185
54 static inline struct saa7185 *to_saa7185(struct v4l2_subdev *sd) to_saa7185() argument
56 return container_of(sd, struct saa7185, sd); to_saa7185()
61 static inline int saa7185_read(struct v4l2_subdev *sd) saa7185_read() argument
63 struct i2c_client *client = v4l2_get_subdevdata(sd); saa7185_read()
68 static int saa7185_write(struct v4l2_subdev *sd, u8 reg, u8 value) saa7185_write() argument
70 struct i2c_client *client = v4l2_get_subdevdata(sd); saa7185_write()
71 struct saa7185 *encoder = to_saa7185(sd); saa7185_write()
73 v4l2_dbg(1, debug, sd, "%02x set to %02x\n", reg, value); saa7185_write()
78 static int saa7185_write_block(struct v4l2_subdev *sd, saa7185_write_block() argument
81 struct i2c_client *client = v4l2_get_subdevdata(sd); saa7185_write_block()
82 struct saa7185 *encoder = to_saa7185(sd); saa7185_write_block()
110 ret = saa7185_write(sd, reg, *data++); saa7185_write_block()
220 static int saa7185_init(struct v4l2_subdev *sd, u32 val) saa7185_init() argument
222 struct saa7185 *encoder = to_saa7185(sd); saa7185_init()
224 saa7185_write_block(sd, init_common, sizeof(init_common)); saa7185_init()
226 saa7185_write_block(sd, init_ntsc, sizeof(init_ntsc)); saa7185_init()
228 saa7185_write_block(sd, init_pal, sizeof(init_pal)); saa7185_init()
232 static int saa7185_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) saa7185_s_std_output() argument
234 struct saa7185 *encoder = to_saa7185(sd); saa7185_s_std_output()
237 saa7185_write_block(sd, init_ntsc, sizeof(init_ntsc)); saa7185_s_std_output()
239 saa7185_write_block(sd, init_pal, sizeof(init_pal)); saa7185_s_std_output()
246 static int saa7185_s_routing(struct v4l2_subdev *sd, saa7185_s_routing() argument
249 struct saa7185 *encoder = to_saa7185(sd); saa7185_s_routing()
257 saa7185_write(sd, 0x3a, 0x0f); saa7185_s_routing()
259 saa7185_write(sd, 0x61, (encoder->reg[0x61] & 0xf7) | 0x08); saa7185_s_routing()
260 saa7185_write(sd, 0x6e, 0x01); saa7185_s_routing()
265 saa7185_write(sd, 0x3a, 0x0f); saa7185_s_routing()
267 saa7185_write(sd, 0x61, (encoder->reg[0x61] & 0xf7) | 0x00); saa7185_s_routing()
269 saa7185_write(sd, 0x6e, 0x00); saa7185_s_routing()
274 saa7185_write(sd, 0x3a, 0x8f); saa7185_s_routing()
276 saa7185_write(sd, 0x61, (encoder->reg[0x61] & 0xf7) | 0x08); saa7185_s_routing()
278 saa7185_write(sd, 0x6e, 0x01); saa7185_s_routing()
311 struct v4l2_subdev *sd; saa7185_probe() local
324 sd = &encoder->sd; saa7185_probe()
325 v4l2_i2c_subdev_init(sd, client, &saa7185_ops); saa7185_probe()
327 i = saa7185_write_block(sd, init_common, sizeof(init_common)); saa7185_probe()
329 i = saa7185_write_block(sd, init_ntsc, sizeof(init_ntsc)); saa7185_probe()
331 v4l2_dbg(1, debug, sd, "init error %d\n", i); saa7185_probe()
333 v4l2_dbg(1, debug, sd, "revision 0x%x\n", saa7185_probe()
334 saa7185_read(sd) >> 5); saa7185_probe()
340 struct v4l2_subdev *sd = i2c_get_clientdata(client); saa7185_remove() local
341 struct saa7185 *encoder = to_saa7185(sd); saa7185_remove()
343 v4l2_device_unregister_subdev(sd); saa7185_remove()
345 saa7185_write(sd, 0x61, (encoder->reg[0x61]) | 0x40); saa7185_remove()
H A Dnoon010pc30.c133 struct v4l2_subdev sd; member in struct:noon010_info
235 static inline struct noon010_info *to_noon010(struct v4l2_subdev *sd) to_noon010() argument
237 return container_of(sd, struct noon010_info, sd); to_noon010()
242 return &container_of(ctrl->handler, struct noon010_info, hdl)->sd; to_sd()
259 static int cam_i2c_read(struct v4l2_subdev *sd, u32 reg_addr) cam_i2c_read() argument
261 struct i2c_client *client = v4l2_get_subdevdata(sd); cam_i2c_read()
262 struct noon010_info *info = to_noon010(sd); cam_i2c_read()
270 static int cam_i2c_write(struct v4l2_subdev *sd, u32 reg_addr, u32 val) cam_i2c_write() argument
272 struct i2c_client *client = v4l2_get_subdevdata(sd); cam_i2c_write()
273 struct noon010_info *info = to_noon010(sd); cam_i2c_write()
281 static inline int noon010_bulk_write_reg(struct v4l2_subdev *sd, noon010_bulk_write_reg() argument
285 int ret = cam_i2c_write(sd, msg->addr, msg->val); noon010_bulk_write_reg()
295 static int noon010_power_ctrl(struct v4l2_subdev *sd, bool reset, bool sleep) noon010_power_ctrl() argument
297 struct noon010_info *info = to_noon010(sd); noon010_power_ctrl()
302 ret = cam_i2c_write(sd, POWER_CTRL_REG, reg | 0x02); noon010_power_ctrl()
306 ret = cam_i2c_write(sd, POWER_CTRL_REG, reg); noon010_power_ctrl()
314 static int noon010_enable_autowhitebalance(struct v4l2_subdev *sd, int on) noon010_enable_autowhitebalance() argument
318 ret = cam_i2c_write(sd, AWB_CTL_REG(1), on ? 0x2E : 0x2F); noon010_enable_autowhitebalance()
320 ret = cam_i2c_write(sd, AWB_CTL_REG(0), on ? 0xFB : 0x7B); noon010_enable_autowhitebalance()
325 static int noon010_set_flip(struct v4l2_subdev *sd, int hflip, int vflip) noon010_set_flip() argument
327 struct noon010_info *info = to_noon010(sd); noon010_set_flip()
330 reg = cam_i2c_read(sd, VDO_CTL_REG(1)); noon010_set_flip()
340 ret = cam_i2c_write(sd, VDO_CTL_REG(1), reg | 0x80); noon010_set_flip()
349 static int noon010_set_params(struct v4l2_subdev *sd) noon010_set_params() argument
351 struct noon010_info *info = to_noon010(sd); noon010_set_params()
353 int ret = cam_i2c_write(sd, VDO_CTL_REG(0), noon010_set_params()
357 return cam_i2c_write(sd, ISP_CTL_REG(0), noon010_set_params()
396 v4l2_info(&info->sd, "%s: sensor is already on\n", __func__); power_enable()
427 v4l2_dbg(1, debug, &info->sd, "%s: sensor is on\n", __func__); power_enable()
437 v4l2_info(&info->sd, "%s: sensor is already off\n", __func__); power_disable()
453 v4l2_dbg(1, debug, &info->sd, "%s: sensor is off\n", __func__); power_disable()
460 struct v4l2_subdev *sd = to_sd(ctrl); noon010_s_ctrl() local
461 struct noon010_info *info = to_noon010(sd); noon010_s_ctrl()
464 v4l2_dbg(1, debug, sd, "%s: ctrl_id: %d, value: %d\n", noon010_s_ctrl()
478 ret = noon010_enable_autowhitebalance(sd, ctrl->val); noon010_s_ctrl()
481 ret = cam_i2c_write(sd, MWB_BGAIN_REG, ctrl->val); noon010_s_ctrl()
484 ret = cam_i2c_write(sd, MWB_RGAIN_REG, ctrl->val); noon010_s_ctrl()
494 static int noon010_enum_mbus_code(struct v4l2_subdev *sd, noon010_enum_mbus_code() argument
505 static int noon010_get_fmt(struct v4l2_subdev *sd, noon010_get_fmt() argument
509 struct noon010_info *info = to_noon010(sd); noon010_get_fmt()
514 mf = v4l2_subdev_get_try_format(sd, cfg, 0); noon010_get_fmt()
533 static const struct noon010_format *noon010_try_fmt(struct v4l2_subdev *sd, noon010_try_fmt() argument
546 static int noon010_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, noon010_set_fmt() argument
549 struct noon010_info *info = to_noon010(sd); noon010_set_fmt()
555 nf = noon010_try_fmt(sd, &fmt->format); noon010_set_fmt()
562 mf = v4l2_subdev_get_try_format(sd, cfg, 0); noon010_set_fmt()
580 static int noon010_base_config(struct v4l2_subdev *sd) noon010_base_config() argument
582 int ret = noon010_bulk_write_reg(sd, noon010_base_regs); noon010_base_config()
584 ret = noon010_set_params(sd); noon010_base_config()
586 ret = noon010_set_flip(sd, 1, 0); noon010_base_config()
591 static int noon010_s_power(struct v4l2_subdev *sd, int on) noon010_s_power() argument
593 struct noon010_info *info = to_noon010(sd); noon010_s_power()
600 ret = noon010_base_config(sd); noon010_s_power()
602 noon010_power_ctrl(sd, false, true); noon010_s_power()
614 static int noon010_s_stream(struct v4l2_subdev *sd, int on) noon010_s_stream() argument
616 struct noon010_info *info = to_noon010(sd); noon010_s_stream()
621 ret = noon010_power_ctrl(sd, false, !on); noon010_s_stream()
626 ret = noon010_set_params(sd); noon010_s_stream()
634 static int noon010_log_status(struct v4l2_subdev *sd) noon010_log_status() argument
636 struct noon010_info *info = to_noon010(sd); noon010_log_status()
638 v4l2_ctrl_handler_log_status(&info->hdl, sd->name); noon010_log_status()
642 static int noon010_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) noon010_open() argument
644 struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(sd, fh->pad, 0); noon010_open()
705 struct v4l2_subdev *sd; noon010_probe() local
721 sd = &info->sd; noon010_probe()
722 v4l2_i2c_subdev_init(sd, client, &noon010_ops); noon010_probe()
723 strlcpy(sd->name, MODULE_NAME, sizeof(sd->name)); noon010_probe()
725 sd->internal_ops = &noon010_subdev_internal_ops; noon010_probe()
726 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; noon010_probe()
737 sd->ctrl_handler = &info->hdl; noon010_probe()
782 sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; noon010_probe()
783 ret = media_entity_init(&sd->entity, 1, &info->pad, 0); noon010_probe()
793 v4l2_device_unregister_subdev(sd); noon010_probe()
799 struct v4l2_subdev *sd = i2c_get_clientdata(client); noon010_remove() local
800 struct noon010_info *info = to_noon010(sd); noon010_remove()
802 v4l2_device_unregister_subdev(sd); noon010_remove()
804 media_entity_cleanup(&sd->entity); noon010_remove()
H A Dsaa717x.c57 struct v4l2_subdev sd; member in struct:saa717x_state
76 static inline struct saa717x_state *to_state(struct v4l2_subdev *sd) to_state() argument
78 return container_of(sd, struct saa717x_state, sd); to_state()
83 return &container_of(ctrl->handler, struct saa717x_state, hdl)->sd; to_sd()
99 static int saa717x_write(struct v4l2_subdev *sd, u32 reg, u32 value) saa717x_write() argument
101 struct i2c_client *client = v4l2_get_subdevdata(sd); saa717x_write()
121 v4l2_dbg(2, debug, sd, "wrote: reg 0x%03x=%08x\n", reg, value); saa717x_write()
125 static void saa717x_write_regs(struct v4l2_subdev *sd, u32 *data) saa717x_write_regs() argument
128 saa717x_write(sd, data[0], data[1]); saa717x_write_regs()
133 static u32 saa717x_read(struct v4l2_subdev *sd, u32 reg) saa717x_read() argument
135 struct i2c_client *client = v4l2_get_subdevdata(sd); saa717x_read()
159 v4l2_dbg(2, debug, sd, "read: reg 0x%03x=0x%08x\n", reg, value); saa717x_read()
693 static void get_inf_dev_status(struct v4l2_subdev *sd, get_inf_dev_status() argument
732 reg_data3 = saa717x_read(sd, 0x0528); get_inf_dev_status()
734 v4l2_dbg(1, debug, sd, "tvaudio thread status: 0x%x [%s%s%s]\n", get_inf_dev_status()
738 v4l2_dbg(1, debug, sd, "detailed status: " get_inf_dev_status()
759 v4l2_dbg(1, debug, sd, "ST!!!\n"); get_inf_dev_status()
764 v4l2_dbg(1, debug, sd, "DUAL!!!\n"); get_inf_dev_status()
770 static void set_audio_mode(struct v4l2_subdev *sd, int audio_mode) set_audio_mode() argument
772 v4l2_dbg(1, debug, sd, "writing registers to set audio mode by set %d\n", set_audio_mode()
775 saa717x_write(sd, 0x46c, reg_set_audio_template[audio_mode][0]); set_audio_mode()
776 saa717x_write(sd, 0x470, reg_set_audio_template[audio_mode][1]); set_audio_mode()
780 static int set_audio_regs(struct v4l2_subdev *sd, set_audio_regs() argument
788 saa717x_write(sd, 0x0594, decoder->audio_input); set_audio_regs()
789 v4l2_dbg(1, debug, sd, "set audio input %d\n", set_audio_regs()
809 saa717x_write(sd, 0x480, val); set_audio_regs()
814 saa717x_write(sd, 0x488, val); set_audio_regs()
819 static void set_h_prescale(struct v4l2_subdev *sd, set_h_prescale() argument
852 saa717x_write(sd, 0x60 + task_shift, vals[i].xpsc); set_h_prescale()
854 saa717x_write(sd, 0x61 + task_shift, vals[i].xacl); set_h_prescale()
856 saa717x_write(sd, 0x62 + task_shift, set_h_prescale()
859 saa717x_write(sd, 0x63 + task_shift, set_h_prescale()
864 static void set_v_scale(struct v4l2_subdev *sd, int task, int yscale) set_v_scale() argument
870 saa717x_write(sd, 0x70 + task_shift, yscale & 0xff); set_v_scale()
872 saa717x_write(sd, 0x71 + task_shift, yscale >> 8); set_v_scale()
877 struct v4l2_subdev *sd = to_sd(ctrl); saa717x_s_ctrl() local
878 struct saa717x_state *state = to_state(sd); saa717x_s_ctrl()
882 saa717x_write(sd, 0x10a, ctrl->val); saa717x_s_ctrl()
886 saa717x_write(sd, 0x10b, ctrl->val); saa717x_s_ctrl()
890 saa717x_write(sd, 0x10c, ctrl->val); saa717x_s_ctrl()
894 saa717x_write(sd, 0x10d, ctrl->val); saa717x_s_ctrl()
920 set_audio_regs(sd, state); saa717x_s_ctrl()
924 static int saa717x_s_video_routing(struct v4l2_subdev *sd, saa717x_s_video_routing() argument
927 struct saa717x_state *decoder = to_state(sd); saa717x_s_video_routing()
932 v4l2_dbg(1, debug, sd, "decoder set input (%d)\n", input); saa717x_s_video_routing()
942 v4l2_dbg(1, debug, sd, "now setting %s input %d\n", saa717x_s_video_routing()
947 saa717x_write(sd, 0x102, saa717x_s_video_routing()
948 (saa717x_read(sd, 0x102) & 0xf0) | saa717x_s_video_routing()
952 saa717x_write(sd, 0x109, saa717x_s_video_routing()
953 (saa717x_read(sd, 0x109) & 0x7f) | saa717x_s_video_routing()
959 set_audio_mode(sd, decoder->tuner_audio_mode); saa717x_s_video_routing()
963 set_audio_mode(sd, TUNER_AUDIO_STEREO); saa717x_s_video_routing()
967 saa717x_write_regs(sd, reg_init_tuner_input); saa717x_s_video_routing()
969 saa717x_write_regs(sd, reg_init_svideo_input); saa717x_s_video_routing()
971 saa717x_write_regs(sd, reg_init_composite_input); saa717x_s_video_routing()
978 static int saa717x_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) saa717x_g_register() argument
980 reg->val = saa717x_read(sd, reg->reg); saa717x_g_register()
985 static int saa717x_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) saa717x_s_register() argument
990 saa717x_write(sd, addr, val); saa717x_s_register()
995 static int saa717x_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) saa717x_s_mbus_fmt() argument
999 v4l2_dbg(1, debug, sd, "decoder set size\n"); saa717x_s_mbus_fmt()
1023 set_h_prescale(sd, 0, prescale); saa717x_s_mbus_fmt()
1024 set_h_prescale(sd, 1, prescale); saa717x_s_mbus_fmt()
1028 saa717x_write(sd, 0x6C, (u8)(h_scale & 0xFF)); saa717x_s_mbus_fmt()
1029 saa717x_write(sd, 0x6D, (u8)((h_scale >> 8) & 0xFF)); saa717x_s_mbus_fmt()
1031 saa717x_write(sd, 0xAC, (u8)(h_scale & 0xFF)); saa717x_s_mbus_fmt()
1032 saa717x_write(sd, 0xAD, (u8)((h_scale >> 8) & 0xFF)); saa717x_s_mbus_fmt()
1035 set_v_scale(sd, 0, v_scale); saa717x_s_mbus_fmt()
1036 set_v_scale(sd, 1, v_scale); saa717x_s_mbus_fmt()
1041 saa717x_write(sd, 0x5C, (u8)(fmt->width & 0xFF)); saa717x_s_mbus_fmt()
1042 saa717x_write(sd, 0x5D, (u8)((fmt->width >> 8) & 0xFF)); saa717x_s_mbus_fmt()
1044 saa717x_write(sd, 0x9C, (u8)(fmt->width & 0xFF)); saa717x_s_mbus_fmt()
1045 saa717x_write(sd, 0x9D, (u8)((fmt->width >> 8) & 0xFF)); saa717x_s_mbus_fmt()
1049 saa717x_write(sd, 0x5E, (u8)(fmt->height & 0xFF)); saa717x_s_mbus_fmt()
1050 saa717x_write(sd, 0x5F, (u8)((fmt->height >> 8) & 0xFF)); saa717x_s_mbus_fmt()
1052 saa717x_write(sd, 0x9E, (u8)(fmt->height & 0xFF)); saa717x_s_mbus_fmt()
1053 saa717x_write(sd, 0x9F, (u8)((fmt->height >> 8) & 0xFF)); saa717x_s_mbus_fmt()
1057 static int saa717x_s_radio(struct v4l2_subdev *sd) saa717x_s_radio() argument
1059 struct saa717x_state *decoder = to_state(sd); saa717x_s_radio()
1065 static int saa717x_s_std(struct v4l2_subdev *sd, v4l2_std_id std) saa717x_s_std() argument
1067 struct saa717x_state *decoder = to_state(sd); saa717x_s_std()
1069 v4l2_dbg(1, debug, sd, "decoder set norm "); saa717x_s_std()
1070 v4l2_dbg(1, debug, sd, "(not yet implementd)\n"); saa717x_s_std()
1077 static int saa717x_s_audio_routing(struct v4l2_subdev *sd, saa717x_s_audio_routing() argument
1080 struct saa717x_state *decoder = to_state(sd); saa717x_s_audio_routing()
1084 v4l2_dbg(1, debug, sd, saa717x_s_audio_routing()
1087 set_audio_regs(sd, decoder); saa717x_s_audio_routing()
1093 static int saa717x_s_stream(struct v4l2_subdev *sd, int enable) saa717x_s_stream() argument
1095 struct saa717x_state *decoder = to_state(sd); saa717x_s_stream()
1097 v4l2_dbg(1, debug, sd, "decoder %s output\n", saa717x_s_stream()
1100 saa717x_write(sd, 0x193, enable ? 0xa6 : 0x26); saa717x_s_stream()
1105 static int saa717x_s_tuner(struct v4l2_subdev *sd, const struct v4l2_tuner *vt) saa717x_s_tuner() argument
1107 struct saa717x_state *decoder = to_state(sd); saa717x_s_tuner()
1130 v4l2_dbg(1, debug, sd, "change audio mode to %s\n", saa717x_s_tuner()
1135 set_audio_mode(sd, decoder->tuner_audio_mode); saa717x_s_tuner()
1139 static int saa717x_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) saa717x_g_tuner() argument
1141 struct saa717x_state *decoder = to_state(sd); saa717x_g_tuner()
1146 get_inf_dev_status(sd, &dual_f, &stereo_f); saa717x_g_tuner()
1148 v4l2_dbg(1, debug, sd, "DETECT==st:%d dual:%d\n", saa717x_g_tuner()
1154 v4l2_dbg(1, debug, sd, "DETECT==MONO\n"); saa717x_g_tuner()
1162 v4l2_dbg(1, debug, sd, "DETECT==ST(ST)\n"); saa717x_g_tuner()
1165 v4l2_dbg(1, debug, sd, "DETECT==ST(MONO)\n"); saa717x_g_tuner()
1173 v4l2_dbg(1, debug, sd, "DETECT==DUAL1\n"); saa717x_g_tuner()
1176 v4l2_dbg(1, debug, sd, "DETECT==DUAL2\n"); saa717x_g_tuner()
1182 static int saa717x_log_status(struct v4l2_subdev *sd) saa717x_log_status() argument
1184 struct saa717x_state *state = to_state(sd); saa717x_log_status()
1186 v4l2_ctrl_handler_log_status(&state->hdl, sd->name); saa717x_log_status()
1246 struct v4l2_subdev *sd; saa717x_probe() local
1258 sd = &decoder->sd; saa717x_probe()
1259 v4l2_i2c_subdev_init(sd, client, &saa717x_ops); saa717x_probe()
1261 if (saa717x_write(sd, 0x5a4, 0xfe) && saa717x_probe()
1262 saa717x_write(sd, 0x5a5, 0x0f) && saa717x_probe()
1263 saa717x_write(sd, 0x5a6, 0x00) && saa717x_probe()
1264 saa717x_write(sd, 0x5a7, 0x01)) saa717x_probe()
1265 id = saa717x_read(sd, 0x5a0); saa717x_probe()
1267 v4l2_dbg(1, debug, sd, "saa717x not found (id=%02x)\n", id); saa717x_probe()
1278 v4l2_info(sd, "%s found @ 0x%x (%s)\n", p, saa717x_probe()
1302 sd->ctrl_handler = hdl; saa717x_probe()
1325 v4l2_dbg(1, debug, sd, "writing init values\n"); saa717x_probe()
1328 saa717x_write_regs(sd, reg_init_initialize); saa717x_probe()
1339 struct v4l2_subdev *sd = i2c_get_clientdata(client); saa717x_remove() local
1341 v4l2_device_unregister_subdev(sd); saa717x_remove()
1342 v4l2_ctrl_handler_free(sd->ctrl_handler); saa717x_remove()
H A Dtw9903.c40 struct v4l2_subdev sd; member in struct:tw9903
45 static inline struct tw9903 *to_state(struct v4l2_subdev *sd) to_state() argument
47 return container_of(sd, struct tw9903, sd); to_state()
102 static int write_reg(struct v4l2_subdev *sd, u8 reg, u8 value) write_reg() argument
104 struct i2c_client *client = v4l2_get_subdevdata(sd); write_reg()
109 static int write_regs(struct v4l2_subdev *sd, const u8 *regs) write_regs() argument
114 if (write_reg(sd, regs[i], regs[i + 1]) < 0) write_regs()
119 static int tw9903_s_video_routing(struct v4l2_subdev *sd, u32 input, tw9903_s_video_routing() argument
122 write_reg(sd, 0x02, 0x40 | (input << 1)); tw9903_s_video_routing()
126 static int tw9903_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) tw9903_s_std() argument
128 struct tw9903 *dec = to_state(sd); tw9903_s_std()
145 write_regs(sd, is_60hz ? config_60hz : config_50hz); tw9903_s_std()
154 struct v4l2_subdev *sd = &dec->sd; tw9903_s_ctrl() local
158 write_reg(sd, 0x10, ctrl->val); tw9903_s_ctrl()
161 write_reg(sd, 0x11, ctrl->val); tw9903_s_ctrl()
164 write_reg(sd, 0x15, ctrl->val); tw9903_s_ctrl()
172 static int tw9903_log_status(struct v4l2_subdev *sd) tw9903_log_status() argument
174 struct tw9903 *dec = to_state(sd); tw9903_log_status()
177 v4l2_info(sd, "Standard: %d Hz\n", is_60hz ? 60 : 50); tw9903_log_status()
178 v4l2_ctrl_subdev_log_status(sd); tw9903_log_status()
208 struct v4l2_subdev *sd; tw9903_probe() local
221 sd = &dec->sd; tw9903_probe()
222 v4l2_i2c_subdev_init(sd, client, &tw9903_ops); tw9903_probe()
231 sd->ctrl_handler = hdl; tw9903_probe()
242 if (write_regs(sd, initial_registers) < 0) { tw9903_probe()
252 struct v4l2_subdev *sd = i2c_get_clientdata(client); tw9903_remove() local
254 v4l2_device_unregister_subdev(sd); tw9903_remove()
255 v4l2_ctrl_handler_free(&to_state(sd)->hdl); tw9903_remove()
H A Duda1342.c33 static int uda1342_s_routing(struct v4l2_subdev *sd, uda1342_s_routing() argument
36 struct i2c_client *client = v4l2_get_subdevdata(sd); uda1342_s_routing()
46 v4l2_err(sd, "input %d not supported\n", input); uda1342_s_routing()
64 struct v4l2_subdev *sd; uda1342_probe() local
72 sd = devm_kzalloc(&client->dev, sizeof(*sd), GFP_KERNEL); uda1342_probe()
73 if (sd == NULL) uda1342_probe()
76 v4l2_i2c_subdev_init(sd, client, &uda1342_ops); uda1342_probe()
89 struct v4l2_subdev *sd = i2c_get_clientdata(client); uda1342_remove() local
91 v4l2_device_unregister_subdev(sd); uda1342_remove()
H A Dvs6624.c40 struct v4l2_subdev sd; member in struct:vs6624
485 static inline struct vs6624 *to_vs6624(struct v4l2_subdev *sd) to_vs6624() argument
487 return container_of(sd, struct vs6624, sd); to_vs6624()
491 return &container_of(ctrl->handler, struct vs6624, hdl)->sd; to_sd()
495 static int vs6624_read(struct v4l2_subdev *sd, u16 index) vs6624_read() argument
497 struct i2c_client *client = v4l2_get_subdevdata(sd); vs6624_read()
509 static int vs6624_write(struct v4l2_subdev *sd, u16 index, vs6624_write() argument
512 struct i2c_client *client = v4l2_get_subdevdata(sd); vs6624_write()
522 static int vs6624_writeregs(struct v4l2_subdev *sd, const u16 *regs) vs6624_writeregs() argument
531 vs6624_write(sd, reg, data); vs6624_writeregs()
538 struct v4l2_subdev *sd = to_sd(ctrl); vs6624_s_ctrl() local
542 vs6624_write(sd, VS6624_CONTRAST0, ctrl->val); vs6624_s_ctrl()
545 vs6624_write(sd, VS6624_SATURATION0, ctrl->val); vs6624_s_ctrl()
548 vs6624_write(sd, VS6624_HMIRROR0, ctrl->val); vs6624_s_ctrl()
551 vs6624_write(sd, VS6624_VFLIP0, ctrl->val); vs6624_s_ctrl()
560 static int vs6624_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index, vs6624_enum_mbus_fmt() argument
570 static int vs6624_try_mbus_fmt(struct v4l2_subdev *sd, vs6624_try_mbus_fmt() argument
596 static int vs6624_s_mbus_fmt(struct v4l2_subdev *sd, vs6624_s_mbus_fmt() argument
599 struct vs6624 *sensor = to_vs6624(sd); vs6624_s_mbus_fmt()
602 ret = vs6624_try_mbus_fmt(sd, fmt); vs6624_s_mbus_fmt()
609 vs6624_write(sd, VS6624_IMG_FMT0, 0x0); vs6624_s_mbus_fmt()
610 vs6624_write(sd, VS6624_YUV_SETUP, 0x1); vs6624_s_mbus_fmt()
613 vs6624_write(sd, VS6624_IMG_FMT0, 0x0); vs6624_s_mbus_fmt()
614 vs6624_write(sd, VS6624_YUV_SETUP, 0x3); vs6624_s_mbus_fmt()
617 vs6624_write(sd, VS6624_IMG_FMT0, 0x4); vs6624_s_mbus_fmt()
618 vs6624_write(sd, VS6624_RGB_SETUP, 0x0); vs6624_s_mbus_fmt()
626 vs6624_write(sd, VS6624_IMAGE_SIZE0, 0x2); vs6624_s_mbus_fmt()
628 vs6624_write(sd, VS6624_IMAGE_SIZE0, 0x4); vs6624_s_mbus_fmt()
630 vs6624_write(sd, VS6624_IMAGE_SIZE0, 0x6); vs6624_s_mbus_fmt()
632 vs6624_write(sd, VS6624_IMAGE_SIZE0, 0x3); vs6624_s_mbus_fmt()
634 vs6624_write(sd, VS6624_IMAGE_SIZE0, 0x5); vs6624_s_mbus_fmt()
636 vs6624_write(sd, VS6624_IMAGE_SIZE0, 0x7); vs6624_s_mbus_fmt()
638 vs6624_write(sd, VS6624_IMAGE_SIZE0, 0x8); vs6624_s_mbus_fmt()
639 vs6624_write(sd, VS6624_MAN_HSIZE0_MSB, fmt->width >> 8); vs6624_s_mbus_fmt()
640 vs6624_write(sd, VS6624_MAN_HSIZE0_LSB, fmt->width & 0xFF); vs6624_s_mbus_fmt()
641 vs6624_write(sd, VS6624_MAN_VSIZE0_MSB, fmt->height >> 8); vs6624_s_mbus_fmt()
642 vs6624_write(sd, VS6624_MAN_VSIZE0_LSB, fmt->height & 0xFF); vs6624_s_mbus_fmt()
643 vs6624_write(sd, VS6624_CROP_CTRL0, 0x1); vs6624_s_mbus_fmt()
651 static int vs6624_g_mbus_fmt(struct v4l2_subdev *sd, vs6624_g_mbus_fmt() argument
654 struct vs6624 *sensor = to_vs6624(sd); vs6624_g_mbus_fmt()
660 static int vs6624_g_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) vs6624_g_parm() argument
662 struct vs6624 *sensor = to_vs6624(sd); vs6624_g_parm()
675 static int vs6624_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) vs6624_s_parm() argument
677 struct vs6624 *sensor = to_vs6624(sd); vs6624_s_parm()
694 vs6624_write(sd, VS6624_DISABLE_FR_DAMPER, 0x0); vs6624_s_parm()
695 vs6624_write(sd, VS6624_FR_NUM_MSB, vs6624_s_parm()
697 vs6624_write(sd, VS6624_FR_NUM_LSB, vs6624_s_parm()
699 vs6624_write(sd, VS6624_FR_DEN, vs6624_s_parm()
704 static int vs6624_s_stream(struct v4l2_subdev *sd, int enable) vs6624_s_stream() argument
707 vs6624_write(sd, VS6624_USER_CMD, 0x2); vs6624_s_stream()
709 vs6624_write(sd, VS6624_USER_CMD, 0x4); vs6624_s_stream()
715 static int vs6624_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) vs6624_g_register() argument
717 reg->val = vs6624_read(sd, reg->reg & 0xffff); vs6624_g_register()
722 static int vs6624_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) vs6624_s_register() argument
724 vs6624_write(sd, reg->reg & 0xffff, reg->val & 0xff); vs6624_s_register()
759 struct v4l2_subdev *sd; vs6624_probe() local
785 sd = &sensor->sd; vs6624_probe()
786 v4l2_i2c_subdev_init(sd, client, &vs6624_ops); vs6624_probe()
788 vs6624_writeregs(sd, vs6624_p1); vs6624_probe()
789 vs6624_write(sd, VS6624_MICRO_EN, 0x2); vs6624_probe()
790 vs6624_write(sd, VS6624_DIO_EN, 0x1); vs6624_probe()
792 vs6624_writeregs(sd, vs6624_p2); vs6624_probe()
794 vs6624_writeregs(sd, vs6624_default); vs6624_probe()
795 vs6624_write(sd, VS6624_HSYNC_SETUP, 0xF); vs6624_probe()
796 vs6624_writeregs(sd, vs6624_run_setup); vs6624_probe()
801 vs6624_write(sd, VS6624_DISABLE_FR_DAMPER, 0x0); vs6624_probe()
802 vs6624_write(sd, VS6624_FR_NUM_MSB, vs6624_probe()
804 vs6624_write(sd, VS6624_FR_NUM_LSB, vs6624_probe()
806 vs6624_write(sd, VS6624_FR_DEN, vs6624_probe()
826 sd->ctrl_handler = hdl; vs6624_probe()
843 struct v4l2_subdev *sd = i2c_get_clientdata(client); vs6624_remove() local
845 v4l2_device_unregister_subdev(sd); vs6624_remove()
846 v4l2_ctrl_handler_free(sd->ctrl_handler); vs6624_remove()
H A Dsaa7115.c76 struct v4l2_subdev sd; member in struct:saa711x_state
101 static inline struct saa711x_state *to_state(struct v4l2_subdev *sd) to_state() argument
103 return container_of(sd, struct saa711x_state, sd); to_state()
108 return &container_of(ctrl->handler, struct saa711x_state, hdl)->sd; to_sd()
113 static inline int saa711x_write(struct v4l2_subdev *sd, u8 reg, u8 value) saa711x_write() argument
115 struct i2c_client *client = v4l2_get_subdevdata(sd); saa711x_write()
158 static int saa711x_writeregs(struct v4l2_subdev *sd, const unsigned char *regs) saa711x_writeregs() argument
160 struct saa711x_state *state = to_state(sd); saa711x_writeregs()
170 if (saa711x_write(sd, reg, data) < 0) saa711x_writeregs()
173 v4l2_dbg(1, debug, sd, "tried to access reserved reg 0x%02x\n", reg); saa711x_writeregs()
179 static inline int saa711x_read(struct v4l2_subdev *sd, u8 reg) saa711x_read() argument
181 struct i2c_client *client = v4l2_get_subdevdata(sd); saa711x_read()
754 static int saa711x_s_clock_freq(struct v4l2_subdev *sd, u32 freq) saa711x_s_clock_freq() argument
756 struct saa711x_state *state = to_state(sd); saa711x_s_clock_freq()
767 v4l2_dbg(1, debug, sd, "set audio clock freq: %d\n", freq); saa711x_s_clock_freq()
798 saa711x_write(sd, R_38_CLK_RATIO_AMXCLK_TO_ASCLK, 0x03); saa711x_s_clock_freq()
799 saa711x_write(sd, R_39_CLK_RATIO_ASCLK_TO_ALRCLK, 0x10 << state->double_asclk); saa711x_s_clock_freq()
800 saa711x_write(sd, R_3A_AUD_CLK_GEN_BASIC_SETUP, acc); saa711x_s_clock_freq()
802 saa711x_write(sd, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD, acpf & 0xff); saa711x_s_clock_freq()
803 saa711x_write(sd, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD+1, saa711x_s_clock_freq()
805 saa711x_write(sd, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD+2, saa711x_s_clock_freq()
808 saa711x_write(sd, R_34_AUD_MAST_CLK_NOMINAL_INC, acni & 0xff); saa711x_s_clock_freq()
809 saa711x_write(sd, R_34_AUD_MAST_CLK_NOMINAL_INC+1, (acni >> 8) & 0xff); saa711x_s_clock_freq()
810 saa711x_write(sd, R_34_AUD_MAST_CLK_NOMINAL_INC+2, (acni >> 16) & 0x3f); saa711x_s_clock_freq()
817 struct v4l2_subdev *sd = to_sd(ctrl); saa711x_g_volatile_ctrl() local
818 struct saa711x_state *state = to_state(sd); saa711x_g_volatile_ctrl()
825 saa711x_read(sd, R_0F_CHROMA_GAIN_CNTL) & 0x7f; saa711x_g_volatile_ctrl()
833 struct v4l2_subdev *sd = to_sd(ctrl); saa711x_s_ctrl() local
834 struct saa711x_state *state = to_state(sd); saa711x_s_ctrl()
838 saa711x_write(sd, R_0A_LUMA_BRIGHT_CNTL, ctrl->val); saa711x_s_ctrl()
842 saa711x_write(sd, R_0B_LUMA_CONTRAST_CNTL, ctrl->val); saa711x_s_ctrl()
846 saa711x_write(sd, R_0C_CHROMA_SAT_CNTL, ctrl->val); saa711x_s_ctrl()
850 saa711x_write(sd, R_0D_CHROMA_HUE_CNTL, ctrl->val); saa711x_s_ctrl()
856 saa711x_write(sd, R_0F_CHROMA_GAIN_CNTL, state->gain->val); saa711x_s_ctrl()
858 saa711x_write(sd, R_0F_CHROMA_GAIN_CNTL, state->gain->val | 0x80); saa711x_s_ctrl()
868 static int saa711x_set_size(struct v4l2_subdev *sd, int width, int height) saa711x_set_size() argument
870 struct saa711x_state *state = to_state(sd); saa711x_set_size()
877 v4l2_dbg(1, debug, sd, "decoder set size to %ix%i\n", width, height); saa711x_set_size()
903 saa711x_write(sd, R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH, saa711x_set_size()
905 saa711x_write(sd, R_CD_B_HORIZ_OUTPUT_WINDOW_LENGTH_MSB, saa711x_set_size()
916 saa711x_write(sd, R_CE_B_VERT_OUTPUT_WINDOW_LENGTH, saa711x_set_size()
918 saa711x_write(sd, R_CF_B_VERT_OUTPUT_WINDOW_LENGTH_MSB, saa711x_set_size()
929 saa711x_write(sd, R_D0_B_HORIZ_PRESCALING, saa711x_set_size()
932 v4l2_dbg(1, debug, sd, "Hpsc: 0x%05x, Hfsc: 0x%05x\n", HPSC, HFSC); saa711x_set_size()
934 saa711x_write(sd, R_D8_B_HORIZ_LUMA_SCALING_INC, saa711x_set_size()
936 saa711x_write(sd, R_D9_B_HORIZ_LUMA_SCALING_INC_MSB, saa711x_set_size()
940 saa711x_write(sd, R_DC_B_HORIZ_CHROMA_SCALING, saa711x_set_size()
942 saa711x_write(sd, R_DD_B_HORIZ_CHROMA_SCALING_MSB, saa711x_set_size()
946 v4l2_dbg(1, debug, sd, "Vsrc: %d, Vscy: 0x%05x\n", Vsrc, VSCY); saa711x_set_size()
949 saa711x_write(sd, R_D5_B_LUMA_CONTRAST_CNTL, saa711x_set_size()
951 saa711x_write(sd, R_D6_B_CHROMA_SATURATION_CNTL, saa711x_set_size()
955 saa711x_write(sd, R_E0_B_VERT_LUMA_SCALING_INC, saa711x_set_size()
957 saa711x_write(sd, R_E1_B_VERT_LUMA_SCALING_INC_MSB, saa711x_set_size()
960 saa711x_write(sd, R_E2_B_VERT_CHROMA_SCALING_INC, saa711x_set_size()
962 saa711x_write(sd, R_E3_B_VERT_CHROMA_SCALING_INC_MSB, saa711x_set_size()
965 saa711x_writeregs(sd, saa7115_cfg_reset_scaler); saa711x_set_size()
968 saa711x_write(sd, R_80_GLOBAL_CNTL_1, saa711x_set_size()
969 saa711x_read(sd, R_80_GLOBAL_CNTL_1) | 0x20); saa711x_set_size()
974 static void saa711x_set_v4lstd(struct v4l2_subdev *sd, v4l2_std_id std) saa711x_set_v4lstd() argument
976 struct saa711x_state *state = to_state(sd); saa711x_set_v4lstd()
992 v4l2_dbg(1, debug, sd, "decoder set standard 60 Hz\n"); saa711x_set_v4lstd()
994 u8 reg = saa711x_read(sd, R_08_SYNC_CNTL); saa711x_set_v4lstd()
997 saa711x_write(sd, R_08_SYNC_CNTL, reg); saa711x_set_v4lstd()
999 saa711x_writeregs(sd, saa7115_cfg_60hz_video); saa711x_set_v4lstd()
1001 saa711x_set_size(sd, 720, 480); saa711x_set_v4lstd()
1003 v4l2_dbg(1, debug, sd, "decoder set standard 50 Hz\n"); saa711x_set_v4lstd()
1005 u8 reg = saa711x_read(sd, R_08_SYNC_CNTL); saa711x_set_v4lstd()
1007 saa711x_write(sd, R_08_SYNC_CNTL, reg); saa711x_set_v4lstd()
1009 saa711x_writeregs(sd, saa7115_cfg_50hz_video); saa711x_set_v4lstd()
1011 saa711x_set_size(sd, 720, 576); saa711x_set_v4lstd()
1025 u8 reg = saa711x_read(sd, R_0E_CHROMA_CNTL_1) & 0x8f; saa711x_set_v4lstd()
1038 saa711x_write(sd, R_0E_CHROMA_CNTL_1, reg); saa711x_set_v4lstd()
1041 int taskb = saa711x_read(sd, R_80_GLOBAL_CNTL_1) & 0x10; saa711x_set_v4lstd()
1044 saa711x_writeregs(sd, saa7115_cfg_vbi_on); saa711x_set_v4lstd()
1047 saa711x_s_clock_freq(sd, state->audclk_freq); saa711x_set_v4lstd()
1052 static void saa711x_set_lcr(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt) saa711x_set_lcr() argument
1054 struct saa711x_state *state = to_state(sd); saa711x_set_lcr()
1125 saa711x_write(sd, i - 2 + R_41_LCR_BASE, lcr[i]); saa711x_set_lcr()
1129 saa711x_writeregs(sd, fmt == NULL ? saa711x_set_lcr()
1134 static int saa711x_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *sliced) saa711x_g_sliced_fmt() argument
1148 if (saa711x_read(sd, R_80_GLOBAL_CNTL_1) & 0x10) saa711x_g_sliced_fmt()
1151 u8 v = saa711x_read(sd, i - 2 + R_41_LCR_BASE); saa711x_g_sliced_fmt()
1161 static int saa711x_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt) saa711x_s_raw_fmt() argument
1163 saa711x_set_lcr(sd, NULL); saa711x_s_raw_fmt()
1167 static int saa711x_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt) saa711x_s_sliced_fmt() argument
1169 saa711x_set_lcr(sd, fmt); saa711x_s_sliced_fmt()
1173 static int saa711x_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) saa711x_s_mbus_fmt() argument
1179 return saa711x_set_size(sd, fmt->width, fmt->height); saa711x_s_mbus_fmt()
1188 static int saa711x_decode_vbi_line(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi) saa711x_decode_vbi_line() argument
1190 struct saa711x_state *state = to_state(sd); saa711x_decode_vbi_line()
1253 static int saa711x_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) saa711x_g_tuner() argument
1255 struct saa711x_state *state = to_state(sd); saa711x_g_tuner()
1260 status = saa711x_read(sd, R_1F_STATUS_BYTE_2_VD_DEC); saa711x_g_tuner()
1262 v4l2_dbg(1, debug, sd, "status: 0x%02x\n", status); saa711x_g_tuner()
1267 static int saa711x_s_std(struct v4l2_subdev *sd, v4l2_std_id std) saa711x_s_std() argument
1269 struct saa711x_state *state = to_state(sd); saa711x_s_std()
1272 saa711x_set_v4lstd(sd, std); saa711x_s_std()
1276 static int saa711x_s_radio(struct v4l2_subdev *sd) saa711x_s_radio() argument
1278 struct saa711x_state *state = to_state(sd); saa711x_s_radio()
1284 static int saa711x_s_routing(struct v4l2_subdev *sd, saa711x_s_routing() argument
1287 struct saa711x_state *state = to_state(sd); saa711x_s_routing()
1290 v4l2_dbg(1, debug, sd, "decoder set input %d output %d\n", saa711x_s_routing()
1304 v4l2_dbg(1, debug, sd, "now setting %s input %s output\n", saa711x_s_routing()
1314 saa711x_write(sd, R_10_CHROMA_CNTL_2, saa711x_s_routing()
1315 (saa711x_read(sd, R_10_CHROMA_CNTL_2) & 0x3f) | saa711x_s_routing()
1317 saa711x_write(sd, R_13_RT_X_PORT_OUT_CNTL, saa711x_s_routing()
1318 (saa711x_read(sd, R_13_RT_X_PORT_OUT_CNTL) & 0xf0) | saa711x_s_routing()
1323 saa711x_write(sd, R_02_INPUT_CNTL_1, saa711x_s_routing()
1324 (saa711x_read(sd, R_02_INPUT_CNTL_1) & mask) | saa711x_s_routing()
1328 saa711x_write(sd, R_09_LUMA_CNTL, saa711x_s_routing()
1329 (saa711x_read(sd, R_09_LUMA_CNTL) & 0x7f) | saa711x_s_routing()
1335 saa711x_write(sd, R_83_X_PORT_I_O_ENA_AND_OUT_CLK, saa711x_s_routing()
1336 (saa711x_read(sd, R_83_X_PORT_I_O_ENA_AND_OUT_CLK) & 0xfe) | saa711x_s_routing()
1341 saa711x_write(sd, R_85_I_PORT_SIGNAL_POLAR, 0x20); saa711x_s_routing()
1343 saa711x_write(sd, R_85_I_PORT_SIGNAL_POLAR, 0x21); saa711x_s_routing()
1348 static int saa711x_s_gpio(struct v4l2_subdev *sd, u32 val) saa711x_s_gpio() argument
1350 struct saa711x_state *state = to_state(sd); saa711x_s_gpio()
1354 saa711x_write(sd, 0x11, (saa711x_read(sd, 0x11) & 0x7f) | saa711x_s_gpio()
1359 static int saa711x_s_stream(struct v4l2_subdev *sd, int enable) saa711x_s_stream() argument
1361 struct saa711x_state *state = to_state(sd); saa711x_s_stream()
1363 v4l2_dbg(1, debug, sd, "%s output\n", saa711x_s_stream()
1371 saa711x_write(sd, R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, state->enable); saa711x_s_stream()
1375 static int saa711x_s_crystal_freq(struct v4l2_subdev *sd, u32 freq, u32 flags) saa711x_s_crystal_freq() argument
1377 struct saa711x_state *state = to_state(sd); saa711x_s_crystal_freq()
1386 saa711x_s_clock_freq(sd, state->audclk_freq); saa711x_s_crystal_freq()
1390 static int saa711x_reset(struct v4l2_subdev *sd, u32 val) saa711x_reset() argument
1392 v4l2_dbg(1, debug, sd, "decoder RESET\n"); saa711x_reset()
1393 saa711x_writeregs(sd, saa7115_cfg_reset_scaler); saa711x_reset()
1397 static int saa711x_g_vbi_data(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *data) saa711x_g_vbi_data() argument
1404 if (saa711x_read(sd, 0x6b) & 0xc0) saa711x_g_vbi_data()
1406 data->data[0] = saa711x_read(sd, 0x6c); saa711x_g_vbi_data()
1407 data->data[1] = saa711x_read(sd, 0x6d); saa711x_g_vbi_data()
1412 if (saa711x_read(sd, 0x66) & 0x30) saa711x_g_vbi_data()
1414 data->data[0] = saa711x_read(sd, 0x69); saa711x_g_vbi_data()
1415 data->data[1] = saa711x_read(sd, 0x6a); saa711x_g_vbi_data()
1419 if (saa711x_read(sd, 0x66) & 0xc0) saa711x_g_vbi_data()
1421 data->data[0] = saa711x_read(sd, 0x67); saa711x_g_vbi_data()
1422 data->data[1] = saa711x_read(sd, 0x68); saa711x_g_vbi_data()
1429 static int saa711x_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) saa711x_querystd() argument
1431 struct saa711x_state *state = to_state(sd); saa711x_querystd()
1440 reg1f = saa711x_read(sd, R_1F_STATUS_BYTE_2_VD_DEC); saa711x_querystd()
1443 reg1e = saa711x_read(sd, R_1E_STATUS_BYTE_1_VD_DEC); saa711x_querystd()
1445 v4l2_dbg(1, debug, sd, "Status byte 1 (0x1e)=0x%02x\n", reg1e); saa711x_querystd()
1470 v4l2_dbg(1, debug, sd, "Status byte 2 (0x1f)=0x%02x\n", reg1f); saa711x_querystd()
1484 v4l2_dbg(1, debug, sd, "detected std mask = %08Lx\n", *std); saa711x_querystd()
1489 static int saa711x_g_input_status(struct v4l2_subdev *sd, u32 *status) saa711x_g_input_status() argument
1491 struct saa711x_state *state = to_state(sd); saa711x_g_input_status()
1497 reg1e = saa711x_read(sd, R_1E_STATUS_BYTE_1_VD_DEC); saa711x_g_input_status()
1498 reg1f = saa711x_read(sd, R_1F_STATUS_BYTE_2_VD_DEC); saa711x_g_input_status()
1505 static int saa711x_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) saa711x_g_register() argument
1507 reg->val = saa711x_read(sd, reg->reg & 0xff); saa711x_g_register()
1512 static int saa711x_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) saa711x_s_register() argument
1514 saa711x_write(sd, reg->reg & 0xff, reg->val & 0xff); saa711x_s_register()
1519 static int saa711x_log_status(struct v4l2_subdev *sd) saa711x_log_status() argument
1521 struct saa711x_state *state = to_state(sd); saa711x_log_status()
1526 v4l2_info(sd, "Audio frequency: %d Hz\n", state->audclk_freq); saa711x_log_status()
1529 reg1f = saa711x_read(sd, R_1F_STATUS_BYTE_2_VD_DEC); saa711x_log_status()
1531 v4l2_info(sd, "Video signal: %s\n", signalOk ? "ok" : "bad"); saa711x_log_status()
1532 v4l2_info(sd, "Frequency: %s\n", (reg1f & 0x20) ? "60 Hz" : "50 Hz"); saa711x_log_status()
1537 reg1e = saa711x_read(sd, R_1E_STATUS_BYTE_1_VD_DEC); saa711x_log_status()
1538 reg1f = saa711x_read(sd, R_1F_STATUS_BYTE_2_VD_DEC); saa711x_log_status()
1544 v4l2_info(sd, "Input: S-Video %d\n", state->input - 6); saa711x_log_status()
1546 v4l2_info(sd, "Input: Composite %d\n", state->input); saa711x_log_status()
1547 v4l2_info(sd, "Video signal: %s\n", signalOk ? (vcr ? "VCR" : "broadcast/DVD") : "bad"); saa711x_log_status()
1548 v4l2_info(sd, "Frequency: %s\n", (reg1f & 0x20) ? "60 Hz" : "50 Hz"); saa711x_log_status()
1552 v4l2_info(sd, "Detected format: NTSC\n"); saa711x_log_status()
1555 v4l2_info(sd, "Detected format: PAL\n"); saa711x_log_status()
1558 v4l2_info(sd, "Detected format: SECAM\n"); saa711x_log_status()
1561 v4l2_info(sd, "Detected format: BW/No color\n"); saa711x_log_status()
1564 v4l2_info(sd, "Width, Height: %d, %d\n", state->width, state->height); saa711x_log_status()
1565 v4l2_ctrl_handler_log_status(&state->hdl, sd->name); saa711x_log_status()
1635 struct v4l2_subdev *sd = &state->sd; saa711x_write_platform_data() local
1643 work = saa711x_read(sd, R_08_SYNC_CNTL); saa711x_write_platform_data()
1646 saa711x_write(sd, R_08_SYNC_CNTL, work); saa711x_write_platform_data()
1650 work = saa711x_read(sd, R_10_CHROMA_CNTL_2); saa711x_write_platform_data()
1654 saa711x_write(sd, R_10_CHROMA_CNTL_2, work); saa711x_write_platform_data()
1658 work = saa711x_read(sd, R_10_CHROMA_CNTL_2); saa711x_write_platform_data()
1661 saa711x_write(sd, R_10_CHROMA_CNTL_2, work); saa711x_write_platform_data()
1665 work = saa711x_read(sd, R_12_RT_SIGNAL_CNTL); saa711x_write_platform_data()
1672 saa711x_write(sd, R_12_RT_SIGNAL_CNTL, work); saa711x_write_platform_data()
1676 work = saa711x_read(sd, R_12_RT_SIGNAL_CNTL); saa711x_write_platform_data()
1679 saa711x_write(sd, R_12_RT_SIGNAL_CNTL, work); saa711x_write_platform_data()
1683 work = saa711x_read(sd, R_13_RT_X_PORT_OUT_CNTL); saa711x_write_platform_data()
1687 saa711x_write(sd, R_13_RT_X_PORT_OUT_CNTL, work); saa711x_write_platform_data()
1797 struct v4l2_subdev *sd; saa711x_probe() local
1822 sd = &state->sd; saa711x_probe()
1823 v4l2_i2c_subdev_init(sd, client, &saa711x_ops); saa711x_probe()
1842 sd->ctrl_handler = hdl; saa711x_probe()
1859 v4l2_dbg(1, debug, sd, "writing init values\n"); saa711x_probe()
1867 saa711x_writeregs(sd, saa7111_init); saa711x_probe()
1870 saa711x_writeregs(sd, gm7113c_init); saa711x_probe()
1874 saa711x_writeregs(sd, gm7113c_init); saa711x_probe()
1876 saa711x_writeregs(sd, saa7113_init); saa711x_probe()
1880 saa711x_writeregs(sd, saa7115_init_auto_input); saa711x_probe()
1883 saa711x_writeregs(sd, saa7115_init_misc); saa711x_probe()
1888 saa711x_set_v4lstd(sd, V4L2_STD_NTSC); saa711x_probe()
1891 v4l2_dbg(1, debug, sd, "status: (1E) 0x%02x, (1F) 0x%02x\n", saa711x_probe()
1892 saa711x_read(sd, R_1E_STATUS_BYTE_1_VD_DEC), saa711x_probe()
1893 saa711x_read(sd, R_1F_STATUS_BYTE_2_VD_DEC)); saa711x_probe()
1901 struct v4l2_subdev *sd = i2c_get_clientdata(client); saa711x_remove() local
1903 v4l2_device_unregister_subdev(sd); saa711x_remove()
1904 v4l2_ctrl_handler_free(sd->ctrl_handler); saa711x_remove()
H A Dsr030pc30.c145 struct v4l2_subdev sd; member in struct:sr030pc30_info
284 static inline struct sr030pc30_info *to_sr030pc30(struct v4l2_subdev *sd) to_sr030pc30() argument
286 return container_of(sd, struct sr030pc30_info, sd); to_sr030pc30()
303 static int cam_i2c_read(struct v4l2_subdev *sd, u32 reg_addr) cam_i2c_read() argument
305 struct i2c_client *client = v4l2_get_subdevdata(sd); cam_i2c_read()
306 struct sr030pc30_info *info = to_sr030pc30(sd); cam_i2c_read()
314 static int cam_i2c_write(struct v4l2_subdev *sd, u32 reg_addr, u32 val) cam_i2c_write() argument
316 struct i2c_client *client = v4l2_get_subdevdata(sd); cam_i2c_write()
317 struct sr030pc30_info *info = to_sr030pc30(sd); cam_i2c_write()
326 static inline int sr030pc30_bulk_write_reg(struct v4l2_subdev *sd, sr030pc30_bulk_write_reg() argument
330 int ret = cam_i2c_write(sd, msg->addr, msg->val); sr030pc30_bulk_write_reg()
339 static int sr030pc30_pwr_ctrl(struct v4l2_subdev *sd, sr030pc30_pwr_ctrl() argument
342 struct sr030pc30_info *info = to_sr030pc30(sd); sr030pc30_pwr_ctrl()
347 ret = cam_i2c_write(sd, POWER_CTRL_REG, reg | 0x02); sr030pc30_pwr_ctrl()
349 ret = cam_i2c_write(sd, POWER_CTRL_REG, reg); sr030pc30_pwr_ctrl()
359 static int sr030pc30_set_flip(struct v4l2_subdev *sd) sr030pc30_set_flip() argument
361 struct sr030pc30_info *info = to_sr030pc30(sd); sr030pc30_set_flip()
363 s32 reg = cam_i2c_read(sd, VDO_CTL2_REG); sr030pc30_set_flip()
372 return cam_i2c_write(sd, VDO_CTL2_REG, reg | 0x80); sr030pc30_set_flip()
376 static int sr030pc30_set_params(struct v4l2_subdev *sd) sr030pc30_set_params() argument
378 struct sr030pc30_info *info = to_sr030pc30(sd); sr030pc30_set_params()
385 ret = cam_i2c_write(sd, VDO_CTL1_REG, sr030pc30_set_params()
389 ret = cam_i2c_write(sd, ISP_CTL_REG(0), sr030pc30_set_params()
392 ret = sr030pc30_set_flip(sd); sr030pc30_set_params()
425 struct v4l2_subdev *sd = &info->sd; sr030pc30_s_ctrl() local
428 v4l2_dbg(1, debug, sd, "%s: ctrl_id: %d, value: %d\n", sr030pc30_s_ctrl()
434 ret = cam_i2c_write(sd, AWB_CTL2_REG, sr030pc30_s_ctrl()
437 ret = cam_i2c_write(sd, AWB_CTL1_REG, sr030pc30_s_ctrl()
441 ret = cam_i2c_write(sd, MWB_BGAIN_REG, info->blue->val); sr030pc30_s_ctrl()
443 ret = cam_i2c_write(sd, MWB_RGAIN_REG, info->red->val); sr030pc30_s_ctrl()
449 ret = cam_i2c_write(sd, AE_CTL1_REG, sr030pc30_s_ctrl()
457 ret = cam_i2c_write(sd, EXP_TIMEH_REG, sr030pc30_s_ctrl()
460 ret = cam_i2c_write(sd, EXP_TIMEM_REG, sr030pc30_s_ctrl()
463 ret = cam_i2c_write(sd, EXP_TIMEL_REG, sr030pc30_s_ctrl()
474 static int sr030pc30_enum_fmt(struct v4l2_subdev *sd, unsigned int index, sr030pc30_enum_fmt() argument
484 static int sr030pc30_g_fmt(struct v4l2_subdev *sd, sr030pc30_g_fmt() argument
487 struct sr030pc30_info *info = to_sr030pc30(sd); sr030pc30_g_fmt()
494 ret = sr030pc30_set_params(sd); sr030pc30_g_fmt()
509 static const struct sr030pc30_format *try_fmt(struct v4l2_subdev *sd, try_fmt() argument
526 static int sr030pc30_try_fmt(struct v4l2_subdev *sd, sr030pc30_try_fmt() argument
529 if (!sd || !mf) sr030pc30_try_fmt()
532 try_fmt(sd, mf); sr030pc30_try_fmt()
536 static int sr030pc30_s_fmt(struct v4l2_subdev *sd, sr030pc30_s_fmt() argument
539 struct sr030pc30_info *info = to_sr030pc30(sd); sr030pc30_s_fmt()
541 if (!sd || !mf) sr030pc30_s_fmt()
544 info->curr_fmt = try_fmt(sd, mf); sr030pc30_s_fmt()
546 return sr030pc30_set_params(sd); sr030pc30_s_fmt()
549 static int sr030pc30_base_config(struct v4l2_subdev *sd) sr030pc30_base_config() argument
551 struct sr030pc30_info *info = to_sr030pc30(sd); sr030pc30_base_config()
555 ret = sr030pc30_bulk_write_reg(sd, sr030pc30_base_regs); sr030pc30_base_config()
559 ret = sr030pc30_set_params(sd); sr030pc30_base_config()
562 ret = sr030pc30_pwr_ctrl(sd, false, false); sr030pc30_base_config()
570 v4l2_dbg(1, debug, sd, "%s: expmin= %lx, expmax= %lx", __func__, sr030pc30_base_config()
574 ret = cam_i2c_write(sd, EXP_MMINH_REG, expmin >> 8 & 0xFF); sr030pc30_base_config()
576 ret = cam_i2c_write(sd, EXP_MMINL_REG, expmin & 0xFF); sr030pc30_base_config()
578 ret = cam_i2c_write(sd, EXP_MMAXH_REG, expmax >> 16 & 0xFF); sr030pc30_base_config()
580 ret = cam_i2c_write(sd, EXP_MMAXM_REG, expmax >> 8 & 0xFF); sr030pc30_base_config()
582 ret = cam_i2c_write(sd, EXP_MMAXL_REG, expmax & 0xFF); sr030pc30_base_config()
587 static int sr030pc30_s_power(struct v4l2_subdev *sd, int on) sr030pc30_s_power() argument
589 struct i2c_client *client = v4l2_get_subdevdata(sd); sr030pc30_s_power()
590 struct sr030pc30_info *info = to_sr030pc30(sd); sr030pc30_s_power()
604 sr030pc30_pwr_ctrl(sd, false, true); sr030pc30_s_power()
614 ret = sr030pc30_base_config(sd); sr030pc30_s_power()
686 struct v4l2_subdev *sd; sr030pc30_probe() local
705 sd = &info->sd; sr030pc30_probe()
706 strcpy(sd->name, MODULE_NAME); sr030pc30_probe()
709 v4l2_i2c_subdev_init(sd, client, &sr030pc30_ops); sr030pc30_probe()
723 sd->ctrl_handler = hdl; sr030pc30_probe()
742 struct v4l2_subdev *sd = i2c_get_clientdata(client); sr030pc30_remove() local
744 v4l2_device_unregister_subdev(sd); sr030pc30_remove()
745 v4l2_ctrl_handler_free(sd->ctrl_handler); sr030pc30_remove()
H A Dbt819.c54 struct v4l2_subdev sd; member in struct:bt819
63 static inline struct bt819 *to_bt819(struct v4l2_subdev *sd) to_bt819() argument
65 return container_of(sd, struct bt819, sd); to_bt819()
70 return &container_of(ctrl->handler, struct bt819, hdl)->sd; to_sd()
92 struct i2c_client *client = v4l2_get_subdevdata(&decoder->sd); bt819_write()
106 struct i2c_client *client = v4l2_get_subdevdata(&decoder->sd); bt819_write_block()
146 struct i2c_client *client = v4l2_get_subdevdata(&decoder->sd); bt819_read()
151 static int bt819_init(struct v4l2_subdev *sd) bt819_init() argument
187 struct bt819 *decoder = to_bt819(sd); bt819_init()
213 static int bt819_status(struct v4l2_subdev *sd, u32 *pstatus, v4l2_std_id *pstd) bt819_status() argument
215 struct bt819 *decoder = to_bt819(sd); bt819_status()
234 v4l2_dbg(1, debug, sd, "get status %x\n", status); bt819_status()
238 static int bt819_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) bt819_querystd() argument
240 return bt819_status(sd, NULL, std); bt819_querystd()
243 static int bt819_g_input_status(struct v4l2_subdev *sd, u32 *status) bt819_g_input_status() argument
245 return bt819_status(sd, status, NULL); bt819_g_input_status()
248 static int bt819_s_std(struct v4l2_subdev *sd, v4l2_std_id std) bt819_s_std() argument
250 struct bt819 *decoder = to_bt819(sd); bt819_s_std()
253 v4l2_dbg(1, debug, sd, "set norm %llx\n", (unsigned long long)std); bt819_s_std()
255 if (sd->v4l2_dev == NULL || sd->v4l2_dev->notify == NULL) bt819_s_std()
256 v4l2_err(sd, "no notify found!\n"); bt819_s_std()
259 v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, NULL); bt819_s_std()
268 v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, NULL); bt819_s_std()
277 v4l2_dbg(1, debug, sd, "unsupported norm %llx\n", bt819_s_std()
293 v4l2_subdev_notify(sd, BT819_FIFO_RESET_HIGH, NULL); bt819_s_std()
297 static int bt819_s_routing(struct v4l2_subdev *sd, bt819_s_routing() argument
300 struct bt819 *decoder = to_bt819(sd); bt819_s_routing()
302 v4l2_dbg(1, debug, sd, "set input %x\n", input); bt819_s_routing()
307 if (sd->v4l2_dev == NULL || sd->v4l2_dev->notify == NULL) bt819_s_routing()
308 v4l2_err(sd, "no notify found!\n"); bt819_s_routing()
311 v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, NULL); bt819_s_routing()
321 v4l2_subdev_notify(sd, BT819_FIFO_RESET_HIGH, NULL); bt819_s_routing()
326 static int bt819_s_stream(struct v4l2_subdev *sd, int enable) bt819_s_stream() argument
328 struct bt819 *decoder = to_bt819(sd); bt819_s_stream()
330 v4l2_dbg(1, debug, sd, "enable output %x\n", enable); bt819_s_stream()
341 struct v4l2_subdev *sd = to_sd(ctrl); bt819_s_ctrl() local
342 struct bt819 *decoder = to_bt819(sd); bt819_s_ctrl()
412 struct v4l2_subdev *sd; bt819_probe() local
422 sd = &decoder->sd; bt819_probe()
423 v4l2_i2c_subdev_init(sd, client, &bt819_ops); bt819_probe()
437 v4l2_dbg(1, debug, sd, bt819_probe()
449 i = bt819_init(sd); bt819_probe()
451 v4l2_dbg(1, debug, sd, "init status %d\n", i); bt819_probe()
462 sd->ctrl_handler = &decoder->hdl; bt819_probe()
475 struct v4l2_subdev *sd = i2c_get_clientdata(client); bt819_remove() local
476 struct bt819 *decoder = to_bt819(sd); bt819_remove()
478 v4l2_device_unregister_subdev(sd); bt819_remove()
H A Dov7670.c212 struct v4l2_subdev sd; member in struct:ov7670_info
240 static inline struct ov7670_info *to_state(struct v4l2_subdev *sd) to_state() argument
242 return container_of(sd, struct ov7670_info, sd); to_state()
247 return &container_of(ctrl->handler, struct ov7670_info, hdl)->sd; to_sd()
459 static int ov7670_read_smbus(struct v4l2_subdev *sd, unsigned char reg, ov7670_read_smbus() argument
462 struct i2c_client *client = v4l2_get_subdevdata(sd); ov7670_read_smbus()
474 static int ov7670_write_smbus(struct v4l2_subdev *sd, unsigned char reg, ov7670_write_smbus() argument
477 struct i2c_client *client = v4l2_get_subdevdata(sd); ov7670_write_smbus()
488 static int ov7670_read_i2c(struct v4l2_subdev *sd, unsigned char reg, ov7670_read_i2c() argument
491 struct i2c_client *client = v4l2_get_subdevdata(sd); ov7670_read_i2c()
521 static int ov7670_write_i2c(struct v4l2_subdev *sd, unsigned char reg, ov7670_write_i2c() argument
524 struct i2c_client *client = v4l2_get_subdevdata(sd); ov7670_write_i2c()
541 static int ov7670_read(struct v4l2_subdev *sd, unsigned char reg, ov7670_read() argument
544 struct ov7670_info *info = to_state(sd); ov7670_read()
546 return ov7670_read_smbus(sd, reg, value); ov7670_read()
548 return ov7670_read_i2c(sd, reg, value); ov7670_read()
551 static int ov7670_write(struct v4l2_subdev *sd, unsigned char reg, ov7670_write() argument
554 struct ov7670_info *info = to_state(sd); ov7670_write()
556 return ov7670_write_smbus(sd, reg, value); ov7670_write()
558 return ov7670_write_i2c(sd, reg, value); ov7670_write()
564 static int ov7670_write_array(struct v4l2_subdev *sd, struct regval_list *vals) ov7670_write_array() argument
567 int ret = ov7670_write(sd, vals->reg_num, vals->value); ov7670_write_array()
579 static int ov7670_reset(struct v4l2_subdev *sd, u32 val) ov7670_reset() argument
581 ov7670_write(sd, REG_COM7, COM7_RESET); ov7670_reset()
587 static int ov7670_init(struct v4l2_subdev *sd, u32 val) ov7670_init() argument
589 return ov7670_write_array(sd, ov7670_default_regs); ov7670_init()
594 static int ov7670_detect(struct v4l2_subdev *sd) ov7670_detect() argument
599 ret = ov7670_init(sd, 0); ov7670_detect()
602 ret = ov7670_read(sd, REG_MIDH, &v); ov7670_detect()
607 ret = ov7670_read(sd, REG_MIDL, &v); ov7670_detect()
615 ret = ov7670_read(sd, REG_PID, &v); ov7670_detect()
620 ret = ov7670_read(sd, REG_VER, &v); ov7670_detect()
762 static void ov7675_get_framerate(struct v4l2_subdev *sd, ov7675_get_framerate() argument
765 struct ov7670_info *info = to_state(sd); ov7675_get_framerate()
783 static int ov7675_set_framerate(struct v4l2_subdev *sd, ov7675_set_framerate() argument
786 struct ov7670_info *info = to_state(sd); ov7675_set_framerate()
800 ret = ov7670_write(sd, REG_DBLV, DBLV_BYPASS); ov7675_set_framerate()
803 ret = ov7670_write(sd, REG_DBLV, DBLV_X4); ov7675_set_framerate()
830 ov7675_get_framerate(sd, tpf); ov7675_set_framerate()
832 ret = ov7670_write(sd, REG_CLKRC, info->clkrc); ov7675_set_framerate()
836 return ov7670_write(sd, REG_DBLV, DBLV_X4); ov7675_set_framerate()
839 static void ov7670_get_framerate_legacy(struct v4l2_subdev *sd, ov7670_get_framerate_legacy() argument
842 struct ov7670_info *info = to_state(sd); ov7670_get_framerate_legacy()
850 static int ov7670_set_framerate_legacy(struct v4l2_subdev *sd, ov7670_set_framerate_legacy() argument
853 struct ov7670_info *info = to_state(sd); ov7670_set_framerate_legacy()
867 return ov7670_write(sd, REG_CLKRC, info->clkrc); ov7670_set_framerate_legacy()
873 static int ov7670_set_hw(struct v4l2_subdev *sd, int hstart, int hstop, ov7670_set_hw() argument
883 ret = ov7670_write(sd, REG_HSTART, (hstart >> 3) & 0xff); ov7670_set_hw()
884 ret += ov7670_write(sd, REG_HSTOP, (hstop >> 3) & 0xff); ov7670_set_hw()
885 ret += ov7670_read(sd, REG_HREF, &v); ov7670_set_hw()
888 ret += ov7670_write(sd, REG_HREF, v); ov7670_set_hw()
892 ret += ov7670_write(sd, REG_VSTART, (vstart >> 2) & 0xff); ov7670_set_hw()
893 ret += ov7670_write(sd, REG_VSTOP, (vstop >> 2) & 0xff); ov7670_set_hw()
894 ret += ov7670_read(sd, REG_VREF, &v); ov7670_set_hw()
897 ret += ov7670_write(sd, REG_VREF, v); ov7670_set_hw()
902 static int ov7670_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index, ov7670_enum_mbus_fmt() argument
912 static int ov7670_try_fmt_internal(struct v4l2_subdev *sd, ov7670_try_fmt_internal() argument
919 struct ov7670_info *info = to_state(sd); ov7670_try_fmt_internal()
973 static int ov7670_try_mbus_fmt(struct v4l2_subdev *sd, ov7670_try_mbus_fmt() argument
976 return ov7670_try_fmt_internal(sd, fmt, NULL, NULL); ov7670_try_mbus_fmt()
982 static int ov7670_s_mbus_fmt(struct v4l2_subdev *sd, ov7670_s_mbus_fmt() argument
987 struct ov7670_info *info = to_state(sd); ov7670_s_mbus_fmt()
991 ret = ov7670_try_fmt_internal(sd, fmt, &ovfmt, &wsize); ov7670_s_mbus_fmt()
1003 ov7670_write(sd, REG_COM7, com7); ov7670_s_mbus_fmt()
1007 ov7670_write_array(sd, ovfmt->regs + 1); ov7670_s_mbus_fmt()
1008 ov7670_set_hw(sd, wsize->hstart, wsize->hstop, wsize->vstart, ov7670_s_mbus_fmt()
1012 ret = ov7670_write_array(sd, wsize->regs); ov7670_s_mbus_fmt()
1026 ret = ov7670_write(sd, REG_CLKRC, info->clkrc); ov7670_s_mbus_fmt()
1034 static int ov7670_g_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) ov7670_g_parm() argument
1037 struct ov7670_info *info = to_state(sd); ov7670_g_parm()
1044 info->devtype->get_framerate(sd, &cp->timeperframe); ov7670_g_parm()
1049 static int ov7670_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) ov7670_s_parm() argument
1053 struct ov7670_info *info = to_state(sd); ov7670_s_parm()
1060 return info->devtype->set_framerate(sd, tpf); ov7670_s_parm()
1072 static int ov7670_enum_frame_interval(struct v4l2_subdev *sd, ov7670_enum_frame_interval() argument
1088 static int ov7670_enum_frame_size(struct v4l2_subdev *sd, ov7670_enum_frame_size() argument
1092 struct ov7670_info *info = to_state(sd); ov7670_enum_frame_size()
1125 static int ov7670_store_cmatrix(struct v4l2_subdev *sd, ov7670_store_cmatrix() argument
1135 ret = ov7670_read(sd, REG_CMATRIX_SIGN, &signbits); ov7670_store_cmatrix()
1154 ret += ov7670_write(sd, REG_CMATRIX_BASE + i, raw); ov7670_store_cmatrix()
1156 ret += ov7670_write(sd, REG_CMATRIX_SIGN, signbits); ov7670_store_cmatrix()
1239 static int ov7670_s_sat_hue(struct v4l2_subdev *sd, int sat, int hue) ov7670_s_sat_hue() argument
1241 struct ov7670_info *info = to_state(sd); ov7670_s_sat_hue()
1246 ret = ov7670_store_cmatrix(sd, matrix); ov7670_s_sat_hue()
1262 static int ov7670_s_brightness(struct v4l2_subdev *sd, int value) ov7670_s_brightness() argument
1267 ov7670_read(sd, REG_COM8, &com8); ov7670_s_brightness()
1269 ov7670_write(sd, REG_COM8, com8); ov7670_s_brightness()
1271 ret = ov7670_write(sd, REG_BRIGHT, v); ov7670_s_brightness()
1275 static int ov7670_s_contrast(struct v4l2_subdev *sd, int value) ov7670_s_contrast() argument
1277 return ov7670_write(sd, REG_CONTRAS, (unsigned char) value); ov7670_s_contrast()
1280 static int ov7670_s_hflip(struct v4l2_subdev *sd, int value) ov7670_s_hflip() argument
1285 ret = ov7670_read(sd, REG_MVFP, &v); ov7670_s_hflip()
1291 ret += ov7670_write(sd, REG_MVFP, v); ov7670_s_hflip()
1295 static int ov7670_s_vflip(struct v4l2_subdev *sd, int value) ov7670_s_vflip() argument
1300 ret = ov7670_read(sd, REG_MVFP, &v); ov7670_s_vflip()
1306 ret += ov7670_write(sd, REG_MVFP, v); ov7670_s_vflip()
1316 static int ov7670_g_gain(struct v4l2_subdev *sd, __s32 *value) ov7670_g_gain() argument
1321 ret = ov7670_read(sd, REG_GAIN, &gain); ov7670_g_gain()
1326 static int ov7670_s_gain(struct v4l2_subdev *sd, int value) ov7670_s_gain() argument
1331 ret = ov7670_write(sd, REG_GAIN, value & 0xff); ov7670_s_gain()
1334 ret = ov7670_read(sd, REG_COM8, &com8); ov7670_s_gain()
1335 ret = ov7670_write(sd, REG_COM8, com8 & ~COM8_AGC); ov7670_s_gain()
1343 static int ov7670_s_autogain(struct v4l2_subdev *sd, int value) ov7670_s_autogain() argument
1348 ret = ov7670_read(sd, REG_COM8, &com8); ov7670_s_autogain()
1354 ret = ov7670_write(sd, REG_COM8, com8); ov7670_s_autogain()
1359 static int ov7670_s_exp(struct v4l2_subdev *sd, int value) ov7670_s_exp() argument
1364 ret = ov7670_read(sd, REG_COM1, &com1) + ov7670_s_exp()
1365 ov7670_read(sd, REG_COM8, &com8); ov7670_s_exp()
1366 ov7670_read(sd, REG_AECHH, &aechh); ov7670_s_exp()
1373 ret = ov7670_write(sd, REG_COM1, com1) + ov7670_s_exp()
1374 ov7670_write(sd, REG_AECH, aech) + ov7670_s_exp()
1375 ov7670_write(sd, REG_AECHH, aechh); ov7670_s_exp()
1378 ret = ov7670_write(sd, REG_COM8, com8 & ~COM8_AEC); ov7670_s_exp()
1385 static int ov7670_s_autoexp(struct v4l2_subdev *sd, ov7670_s_autoexp() argument
1391 ret = ov7670_read(sd, REG_COM8, &com8); ov7670_s_autoexp()
1397 ret = ov7670_write(sd, REG_COM8, com8); ov7670_s_autoexp()
1405 struct v4l2_subdev *sd = to_sd(ctrl); ov7670_g_volatile_ctrl() local
1406 struct ov7670_info *info = to_state(sd); ov7670_g_volatile_ctrl()
1410 return ov7670_g_gain(sd, &info->gain->val); ov7670_g_volatile_ctrl()
1417 struct v4l2_subdev *sd = to_sd(ctrl); ov7670_s_ctrl() local
1418 struct ov7670_info *info = to_state(sd); ov7670_s_ctrl()
1422 return ov7670_s_brightness(sd, ctrl->val); ov7670_s_ctrl()
1424 return ov7670_s_contrast(sd, ctrl->val); ov7670_s_ctrl()
1426 return ov7670_s_sat_hue(sd, ov7670_s_ctrl()
1429 return ov7670_s_vflip(sd, ctrl->val); ov7670_s_ctrl()
1431 return ov7670_s_hflip(sd, ctrl->val); ov7670_s_ctrl()
1437 return ov7670_s_gain(sd, info->gain->val); ov7670_s_ctrl()
1439 return ov7670_s_autogain(sd, ctrl->val); ov7670_s_ctrl()
1445 return ov7670_s_exp(sd, info->exposure->val); ov7670_s_ctrl()
1447 return ov7670_s_autoexp(sd, ctrl->val); ov7670_s_ctrl()
1458 static int ov7670_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) ov7670_g_register() argument
1463 ret = ov7670_read(sd, reg->reg & 0xff, &val); ov7670_g_register()
1469 static int ov7670_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) ov7670_s_register() argument
1471 ov7670_write(sd, reg->reg & 0xff, reg->val & 0xff); ov7670_s_register()
1527 struct v4l2_subdev *sd; ov7670_probe() local
1534 sd = &info->sd; ov7670_probe()
1535 v4l2_i2c_subdev_init(sd, client, &ov7670_ops); ov7670_probe()
1564 ret = ov7670_detect(sd); ov7670_probe()
1581 info->devtype->set_framerate(sd, &tpf); ov7670_probe()
1584 ov7670_write(sd, REG_COM10, COM10_PCLK_HB); ov7670_probe()
1608 sd->ctrl_handler = &info->hdl; ov7670_probe()
1631 struct v4l2_subdev *sd = i2c_get_clientdata(client); ov7670_remove() local
1632 struct ov7670_info *info = to_state(sd); ov7670_remove()
1634 v4l2_device_unregister_subdev(sd); ov7670_remove()
H A Dtea6420.c50 static int tea6420_s_routing(struct v4l2_subdev *sd, tea6420_s_routing() argument
53 struct i2c_client *client = v4l2_get_subdevdata(sd); tea6420_s_routing()
59 v4l2_dbg(1, debug, sd, "i=%d, o=%d, g=%d\n", i, o, g); tea6420_s_routing()
85 v4l2_dbg(1, debug, sd, tea6420_s_routing()
105 struct v4l2_subdev *sd; tea6420_probe() local
115 sd = devm_kzalloc(&client->dev, sizeof(*sd), GFP_KERNEL); tea6420_probe()
116 if (sd == NULL) tea6420_probe()
118 v4l2_i2c_subdev_init(sd, client, &tea6420_ops); tea6420_probe()
123 err += tea6420_s_routing(sd, 6, i, 0); tea6420_probe()
133 struct v4l2_subdev *sd = i2c_get_clientdata(client); tea6420_remove() local
135 v4l2_device_unregister_subdev(sd); tea6420_remove()
H A Dtda7432.c63 struct v4l2_subdev sd; member in struct:tda7432
77 static inline struct tda7432 *to_state(struct v4l2_subdev *sd) to_state() argument
79 return container_of(sd, struct tda7432, sd); to_state()
84 return &container_of(ctrl->handler, struct tda7432, hdl)->sd; to_sd()
220 static int tda7432_write(struct v4l2_subdev *sd, int subaddr, int val) tda7432_write() argument
222 struct i2c_client *client = v4l2_get_subdevdata(sd); tda7432_write()
225 v4l2_dbg(2, debug, sd, "In tda7432_write\n"); tda7432_write()
226 v4l2_dbg(1, debug, sd, "Writing %d 0x%x\n", subaddr, val); tda7432_write()
230 v4l2_err(sd, "I/O error, trying (write %d 0x%x)\n", tda7432_write()
237 static int tda7432_set(struct v4l2_subdev *sd) tda7432_set() argument
239 struct i2c_client *client = v4l2_get_subdevdata(sd); tda7432_set()
256 v4l2_err(sd, "I/O error, trying tda7432_set\n"); tda7432_set()
263 static int tda7432_log_status(struct v4l2_subdev *sd) tda7432_log_status() argument
265 struct tda7432 *state = to_state(sd); tda7432_log_status()
267 v4l2_ctrl_handler_log_status(&state->hdl, sd->name); tda7432_log_status()
273 struct v4l2_subdev *sd = to_sd(ctrl); tda7432_s_ctrl() local
274 struct tda7432 *t = to_state(sd); tda7432_s_ctrl()
300 tda7432_write(sd, TDA7432_LF, lf); tda7432_s_ctrl()
301 tda7432_write(sd, TDA7432_LR, lr); tda7432_s_ctrl()
302 tda7432_write(sd, TDA7432_RF, rf); tda7432_s_ctrl()
303 tda7432_write(sd, TDA7432_RR, rr); tda7432_s_ctrl()
310 tda7432_write(sd, TDA7432_VL, volume); tda7432_s_ctrl()
320 tda7432_write(sd, TDA7432_TN, 0x10 | (bass << 4) | treble); tda7432_s_ctrl()
357 struct v4l2_subdev *sd; tda7432_probe() local
365 sd = &t->sd; tda7432_probe()
366 v4l2_i2c_subdev_init(sd, client, &tda7432_ops); tda7432_probe()
378 sd->ctrl_handler = &t->hdl; tda7432_probe()
389 v4l2_warn(sd, "loudness parameter must be between 0 and 15\n"); tda7432_probe()
396 tda7432_set(sd); tda7432_probe()
402 struct v4l2_subdev *sd = i2c_get_clientdata(client); tda7432_remove() local
403 struct tda7432 *t = to_state(sd); tda7432_remove()
405 tda7432_set(sd); tda7432_remove()
406 v4l2_device_unregister_subdev(sd); tda7432_remove()
H A Dtvp7002.c420 struct v4l2_subdev sd; member in struct:tvp7002
433 * @sd: ptr to v4l2_subdev struct
437 static inline struct tvp7002 *to_tvp7002(struct v4l2_subdev *sd) to_tvp7002() argument
439 return container_of(sd, struct tvp7002, sd); to_tvp7002()
444 return &container_of(ctrl->handler, struct tvp7002, hdl)->sd; to_sd()
449 * @sd: ptr to v4l2_subdev struct
455 static int tvp7002_read(struct v4l2_subdev *sd, u8 addr, u8 *dst) tvp7002_read() argument
457 struct i2c_client *c = v4l2_get_subdevdata(sd); tvp7002_read()
471 v4l2_err(sd, "TVP7002 read error %d\n", error); tvp7002_read()
477 * @sd: pointer to standard V4L2 sub-device structure
485 static inline void tvp7002_read_err(struct v4l2_subdev *sd, u8 reg, tvp7002_read_err() argument
489 *err = tvp7002_read(sd, reg, dst); tvp7002_read_err()
494 * @sd: ptr to v4l2_subdev struct
501 static int tvp7002_write(struct v4l2_subdev *sd, u8 addr, u8 value) tvp7002_write() argument
507 c = v4l2_get_subdevdata(sd); tvp7002_write()
515 v4l2_warn(sd, "Write: retry ... %d\n", retry); tvp7002_write()
518 v4l2_err(sd, "TVP7002 write error %d\n", error); tvp7002_write()
524 * @sd: pointer to standard V4L2 sub-device structure
532 static inline void tvp7002_write_err(struct v4l2_subdev *sd, u8 reg, tvp7002_write_err() argument
536 *err = tvp7002_write(sd, reg, val); tvp7002_write_err()
541 * @sd: ptr to v4l2_subdev struct
547 static int tvp7002_write_inittab(struct v4l2_subdev *sd, tvp7002_write_inittab() argument
555 tvp7002_write_err(sd, regs->reg, regs->value, &error); tvp7002_write_inittab()
562 static int tvp7002_s_dv_timings(struct v4l2_subdev *sd, tvp7002_s_dv_timings() argument
565 struct tvp7002 *device = to_tvp7002(sd); tvp7002_s_dv_timings()
576 return tvp7002_write_inittab(sd, tvp7002_timings[i].p_settings); tvp7002_s_dv_timings()
582 static int tvp7002_g_dv_timings(struct v4l2_subdev *sd, tvp7002_g_dv_timings() argument
585 struct tvp7002 *device = to_tvp7002(sd); tvp7002_g_dv_timings()
600 struct v4l2_subdev *sd = to_sd(ctrl); tvp7002_s_ctrl() local
605 tvp7002_write_err(sd, TVP7002_R_FINE_GAIN, ctrl->val, &error); tvp7002_s_ctrl()
606 tvp7002_write_err(sd, TVP7002_G_FINE_GAIN, ctrl->val, &error); tvp7002_s_ctrl()
607 tvp7002_write_err(sd, TVP7002_B_FINE_GAIN, ctrl->val, &error); tvp7002_s_ctrl()
615 * @sd: pointer to standard V4L2 sub-device structure
622 static int tvp7002_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f) tvp7002_mbus_fmt() argument
624 struct tvp7002 *device = to_tvp7002(sd); tvp7002_mbus_fmt()
633 v4l2_dbg(1, debug, sd, "MBUS_FMT: Width - %d, Height - %d", tvp7002_mbus_fmt()
640 * @sd: pointer to standard V4L2 sub-device structure
646 static int tvp7002_query_dv(struct v4l2_subdev *sd, int *index) tvp7002_query_dv() argument
662 tvp7002_read_err(sd, TVP7002_L_FRAME_STAT_LSBS, &lpf_lsb, &error); tvp7002_query_dv()
663 tvp7002_read_err(sd, TVP7002_L_FRAME_STAT_MSBS, &lpf_msb, &error); tvp7002_query_dv()
668 tvp7002_read_err(sd, TVP7002_CLK_L_STAT_LSBS, &cpl_lsb, &error); tvp7002_query_dv()
669 tvp7002_read_err(sd, TVP7002_CLK_L_STAT_MSBS, &cpl_msb, &error); tvp7002_query_dv()
690 v4l2_dbg(1, debug, sd, "detection failed: lpf = %x, cpl = %x\n", tvp7002_query_dv()
696 v4l2_dbg(1, debug, sd, "detected timings: %d\n", *index); tvp7002_query_dv()
700 static int tvp7002_query_dv_timings(struct v4l2_subdev *sd, tvp7002_query_dv_timings() argument
704 int err = tvp7002_query_dv(sd, &index); tvp7002_query_dv_timings()
715 * @sd: ptr to v4l2_subdev struct
722 static int tvp7002_g_register(struct v4l2_subdev *sd, tvp7002_g_register() argument
728 ret = tvp7002_read(sd, reg->reg & 0xff, &val); tvp7002_g_register()
736 * @sd: ptr to v4l2_subdev struct
742 static int tvp7002_s_register(struct v4l2_subdev *sd, tvp7002_s_register() argument
745 return tvp7002_write(sd, reg->reg & 0xff, reg->val & 0xff); tvp7002_s_register()
751 * @sd: pointer to standard V4L2 sub-device structure
758 static int tvp7002_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index, tvp7002_enum_mbus_fmt() argument
770 * @sd: pointer to standard V4L2 sub-device structure
775 static int tvp7002_s_stream(struct v4l2_subdev *sd, int enable) tvp7002_s_stream() argument
777 struct tvp7002 *device = to_tvp7002(sd); tvp7002_s_stream()
784 error = tvp7002_write(sd, TVP7002_MISC_CTL_2, enable ? 0x00 : 0x03); tvp7002_s_stream()
786 v4l2_dbg(1, debug, sd, "Fail to set streaming\n"); tvp7002_s_stream()
796 * @sd: ptr to v4l2_subdev struct
801 static int tvp7002_log_status(struct v4l2_subdev *sd) tvp7002_log_status() argument
803 struct tvp7002 *device = to_tvp7002(sd); tvp7002_log_status()
808 tvp7002_query_dv(sd, &detected); tvp7002_log_status()
811 v4l2_info(sd, "Selected DV Timings: %ux%u\n", bt->width, bt->height); tvp7002_log_status()
813 v4l2_info(sd, "Detected DV Timings: None\n"); tvp7002_log_status()
816 v4l2_info(sd, "Detected DV Timings: %ux%u\n", tvp7002_log_status()
819 v4l2_info(sd, "Streaming enabled: %s\n", tvp7002_log_status()
823 v4l2_ctrl_handler_log_status(&device->hdl, sd->name); tvp7002_log_status()
828 static int tvp7002_enum_dv_timings(struct v4l2_subdev *sd, tvp7002_enum_dv_timings() argument
848 * @sd: pointer to standard V4L2 sub-device structure
855 tvp7002_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, tvp7002_enum_mbus_code() argument
869 * @sd: pointer to standard V4L2 sub-device structure
876 tvp7002_get_pad_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, tvp7002_get_pad_format() argument
879 struct tvp7002 *tvp7002 = to_tvp7002(sd); tvp7002_get_pad_format()
892 * @sd: pointer to standard V4L2 sub-device structure
899 tvp7002_set_pad_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, tvp7002_set_pad_format() argument
902 return tvp7002_get_pad_format(sd, cfg, fmt); tvp7002_set_pad_format()
1002 struct v4l2_subdev *sd; tvp7002_probe() local
1025 sd = &device->sd; tvp7002_probe()
1030 v4l2_i2c_subdev_init(sd, c, &tvp7002_ops); tvp7002_probe()
1034 error = tvp7002_read(sd, TVP7002_CHIP_REV, &revision); tvp7002_probe()
1039 v4l2_info(sd, "Rev. %02x detected.\n", revision); tvp7002_probe()
1041 v4l2_info(sd, "Unknown revision detected.\n"); tvp7002_probe()
1044 error = tvp7002_write_inittab(sd, tvp7002_init_default); tvp7002_probe()
1052 error = tvp7002_write(sd, TVP7002_SYNC_CTL_1, polarity_a); tvp7002_probe()
1059 error = tvp7002_write(sd, TVP7002_MISC_CTL_3, polarity_b); tvp7002_probe()
1065 error = tvp7002_s_dv_timings(sd, &timings); tvp7002_probe()
1069 device->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; tvp7002_probe()
1070 device->sd.entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER; tvp7002_probe()
1072 error = media_entity_init(&device->sd.entity, 1, &device->pad, 0); tvp7002_probe()
1080 sd->ctrl_handler = &device->hdl; tvp7002_probe()
1087 error = v4l2_async_register_subdev(&device->sd); tvp7002_probe()
1096 media_entity_cleanup(&device->sd.entity); tvp7002_probe()
1110 struct v4l2_subdev *sd = i2c_get_clientdata(c); tvp7002_remove() local
1111 struct tvp7002 *device = to_tvp7002(sd); tvp7002_remove()
1113 v4l2_dbg(1, debug, sd, "Removing tvp7002 adapter" tvp7002_remove()
1115 v4l2_async_unregister_subdev(&device->sd); tvp7002_remove()
1117 media_entity_cleanup(&device->sd.entity); tvp7002_remove()
H A Dtea6415c.c49 static int tea6415c_s_routing(struct v4l2_subdev *sd, tea6415c_s_routing() argument
52 struct i2c_client *client = v4l2_get_subdevdata(sd); tea6415c_s_routing()
56 v4l2_dbg(1, debug, sd, "i=%d, o=%d\n", i, o); tea6415c_s_routing()
114 v4l2_dbg(1, debug, sd, tea6415c_s_routing()
134 struct v4l2_subdev *sd; tea6415c_probe() local
142 sd = devm_kzalloc(&client->dev, sizeof(*sd), GFP_KERNEL); tea6415c_probe()
143 if (sd == NULL) tea6415c_probe()
145 v4l2_i2c_subdev_init(sd, client, &tea6415c_ops); tea6415c_probe()
151 struct v4l2_subdev *sd = i2c_get_clientdata(client); tea6415c_remove() local
153 v4l2_device_unregister_subdev(sd); tea6415c_remove()
H A Dov7640.c56 struct v4l2_subdev *sd; ov7640_probe() local
61 sd = devm_kzalloc(&client->dev, sizeof(*sd), GFP_KERNEL); ov7640_probe()
62 if (sd == NULL) ov7640_probe()
64 v4l2_i2c_subdev_init(sd, client, &ov7640_ops); ov7640_probe()
82 struct v4l2_subdev *sd = i2c_get_clientdata(client); ov7640_remove() local
84 v4l2_device_unregister_subdev(sd); ov7640_remove()
H A Dbt856.c55 struct v4l2_subdev sd; member in struct:bt856
61 static inline struct bt856 *to_bt856(struct v4l2_subdev *sd) to_bt856() argument
63 return container_of(sd, struct bt856, sd); to_bt856()
70 struct i2c_client *client = v4l2_get_subdevdata(&encoder->sd); bt856_write()
87 v4l2_info(&encoder->sd, "register dump:\n"); bt856_dump()
95 static int bt856_init(struct v4l2_subdev *sd, u32 arg) bt856_init() argument
97 struct bt856 *encoder = to_bt856(sd); bt856_init()
100 v4l2_dbg(1, debug, sd, "init\n"); bt856_init()
122 static int bt856_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) bt856_s_std_output() argument
124 struct bt856 *encoder = to_bt856(sd); bt856_s_std_output()
126 v4l2_dbg(1, debug, sd, "set norm %llx\n", (unsigned long long)std); bt856_s_std_output()
143 static int bt856_s_routing(struct v4l2_subdev *sd, bt856_s_routing() argument
146 struct bt856 *encoder = to_bt856(sd); bt856_s_routing()
148 v4l2_dbg(1, debug, sd, "set input %d\n", input); bt856_s_routing()
201 struct v4l2_subdev *sd; bt856_probe() local
213 sd = &encoder->sd; bt856_probe()
214 v4l2_i2c_subdev_init(sd, client, &bt856_ops); bt856_probe()
241 struct v4l2_subdev *sd = i2c_get_clientdata(client); bt856_remove() local
243 v4l2_device_unregister_subdev(sd); bt856_remove()
H A Ds5k6a3.c76 static inline struct s5k6a3 *sd_to_s5k6a3(struct v4l2_subdev *sd) sd_to_s5k6a3() argument
78 return container_of(sd, struct s5k6a3, subdev); sd_to_s5k6a3()
101 static int s5k6a3_enum_mbus_code(struct v4l2_subdev *sd, s5k6a3_enum_mbus_code() argument
135 static int s5k6a3_set_fmt(struct v4l2_subdev *sd, s5k6a3_set_fmt() argument
139 struct s5k6a3 *sensor = sd_to_s5k6a3(sd); s5k6a3_set_fmt()
154 static int s5k6a3_get_fmt(struct v4l2_subdev *sd, s5k6a3_get_fmt() argument
158 struct s5k6a3 *sensor = sd_to_s5k6a3(sd); s5k6a3_get_fmt()
175 static int s5k6a3_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) s5k6a3_open() argument
177 struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(sd, fh->pad, 0); s5k6a3_open()
249 static int s5k6a3_s_power(struct v4l2_subdev *sd, int on) s5k6a3_s_power() argument
251 struct s5k6a3 *sensor = sd_to_s5k6a3(sd); s5k6a3_s_power()
284 struct v4l2_subdev *sd; s5k6a3_probe() local
326 sd = &sensor->subdev; s5k6a3_probe()
327 v4l2_i2c_subdev_init(sd, client, &s5k6a3_subdev_ops); s5k6a3_probe()
329 sd->internal_ops = &s5k6a3_sd_internal_ops; s5k6a3_probe()
336 ret = media_entity_init(&sd->entity, 1, &sensor->pad, 0); s5k6a3_probe()
343 ret = v4l2_async_register_subdev(sd); s5k6a3_probe()
347 media_entity_cleanup(&sd->entity); s5k6a3_probe()
355 struct v4l2_subdev *sd = i2c_get_clientdata(client); s5k6a3_remove() local
358 v4l2_async_unregister_subdev(sd); s5k6a3_remove()
359 media_entity_cleanup(&sd->entity); s5k6a3_remove()
H A Dml86v7667.c90 struct v4l2_subdev sd; member in struct:ml86v7667_priv
97 return container_of(subdev, struct ml86v7667_priv, sd); to_ml86v7667()
102 return &container_of(ctrl->handler, struct ml86v7667_priv, hdl)->sd; to_sd()
118 struct v4l2_subdev *sd = to_sd(ctrl); ml86v7667_s_ctrl() local
119 struct i2c_client *client = v4l2_get_subdevdata(sd); ml86v7667_s_ctrl()
163 static int ml86v7667_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) ml86v7667_querystd() argument
165 struct i2c_client *client = v4l2_get_subdevdata(sd); ml86v7667_querystd()
180 static int ml86v7667_g_input_status(struct v4l2_subdev *sd, u32 *status) ml86v7667_g_input_status() argument
182 struct i2c_client *client = v4l2_get_subdevdata(sd); ml86v7667_g_input_status()
194 static int ml86v7667_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned int index, ml86v7667_enum_mbus_fmt() argument
205 static int ml86v7667_mbus_fmt(struct v4l2_subdev *sd, ml86v7667_mbus_fmt() argument
208 struct ml86v7667_priv *priv = to_ml86v7667(sd); ml86v7667_mbus_fmt()
220 static int ml86v7667_g_mbus_config(struct v4l2_subdev *sd, ml86v7667_g_mbus_config() argument
230 static int ml86v7667_s_std(struct v4l2_subdev *sd, v4l2_std_id std) ml86v7667_s_std() argument
232 struct ml86v7667_priv *priv = to_ml86v7667(sd); ml86v7667_s_std()
233 struct i2c_client *client = v4l2_get_subdevdata(&priv->sd); ml86v7667_s_std()
249 static int ml86v7667_g_register(struct v4l2_subdev *sd, ml86v7667_g_register() argument
252 struct i2c_client *client = v4l2_get_subdevdata(sd); ml86v7667_g_register()
265 static int ml86v7667_s_register(struct v4l2_subdev *sd, ml86v7667_s_register() argument
268 struct i2c_client *client = v4l2_get_subdevdata(sd); ml86v7667_s_register()
303 struct i2c_client *client = v4l2_get_subdevdata(&priv->sd); ml86v7667_init()
358 v4l2_i2c_subdev_init(&priv->sd, client, &ml86v7667_subdev_ops); ml86v7667_probe()
377 priv->sd.ctrl_handler = &priv->hdl; ml86v7667_probe()
395 v4l2_device_unregister_subdev(&priv->sd); ml86v7667_probe()
403 struct v4l2_subdev *sd = i2c_get_clientdata(client); ml86v7667_remove() local
404 struct ml86v7667_priv *priv = to_ml86v7667(sd); ml86v7667_remove()
407 v4l2_device_unregister_subdev(&priv->sd); ml86v7667_remove()
H A Ds5k5baf.c304 struct v4l2_subdev sd; member in struct:s5k5baf
406 return &container_of(ctrl->handler, struct s5k5baf, ctrls.handler)->sd; ctrl_to_sd()
409 static inline bool s5k5baf_is_cis_subdev(struct v4l2_subdev *sd) s5k5baf_is_cis_subdev() argument
411 return sd->entity.type == MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; s5k5baf_is_cis_subdev()
414 static inline struct s5k5baf *to_s5k5baf(struct v4l2_subdev *sd) to_s5k5baf() argument
416 if (s5k5baf_is_cis_subdev(sd)) to_s5k5baf()
417 return container_of(sd, struct s5k5baf, cis_sd); to_s5k5baf()
419 return container_of(sd, struct s5k5baf, sd); to_s5k5baf()
424 struct i2c_client *c = v4l2_get_subdevdata(&state->sd); s5k5baf_i2c_read()
454 struct i2c_client *c = v4l2_get_subdevdata(&state->sd); s5k5baf_i2c_write()
484 struct i2c_client *c = v4l2_get_subdevdata(&state->sd); s5k5baf_write_arr_seq()
556 v4l2_err(&state->sd, "timeout on register synchronize (%#x)\n", addr); s5k5baf_synchronize()
606 v4l2_err(&state->sd, "error configuring PLL (%d)\n", status); s5k5baf_hw_set_clocks()
814 v4l2_info(&state->sd, s5k5baf_hw_find_min_fiv()
818 v4l2_err(&state->sd, s5k5baf_hw_find_min_fiv()
823 v4l2_err(&state->sd, "cannot find correct frame interval\n"); s5k5baf_hw_find_min_fiv()
845 v4l2_err(&state->sd, s5k5baf_hw_validate_cfg()
894 v4l2_err(&state->sd, s5k5baf_hw_set_crop_rects()
902 v4l2_err(&state->sd, "crop error: %d\n", err); s5k5baf_hw_set_crop_rects()
971 v4l2_dbg(1, debug, &state->sd, "clock frequency: %ld\n", s5k5baf_power_on()
982 v4l2_err(&state->sd, "%s() failed (%d)\n", __func__, ret); s5k5baf_power_on()
1003 v4l2_err(&state->sd, "failed to disable regulators\n"); s5k5baf_power_off()
1031 struct i2c_client *c = v4l2_get_subdevdata(&state->sd); s5k5baf_load_setfile()
1050 static int s5k5baf_set_power(struct v4l2_subdev *sd, int on) s5k5baf_set_power() argument
1052 struct s5k5baf *state = to_s5k5baf(sd); s5k5baf_set_power()
1103 static int s5k5baf_s_stream(struct v4l2_subdev *sd, int on) s5k5baf_s_stream() argument
1105 struct s5k5baf *state = to_s5k5baf(sd); s5k5baf_s_stream()
1135 static int s5k5baf_g_frame_interval(struct v4l2_subdev *sd, s5k5baf_g_frame_interval() argument
1138 struct s5k5baf *state = to_s5k5baf(sd); s5k5baf_g_frame_interval()
1168 v4l2_info(&state->sd, "frame interval changed to %d00us\n", s5k5baf_set_frame_interval()
1172 static int s5k5baf_s_frame_interval(struct v4l2_subdev *sd, s5k5baf_s_frame_interval() argument
1175 struct s5k5baf *state = to_s5k5baf(sd); s5k5baf_s_frame_interval()
1186 static int s5k5baf_enum_frame_interval(struct v4l2_subdev *sd, s5k5baf_enum_frame_interval() argument
1205 static int s5k5baf_enum_mbus_code(struct v4l2_subdev *sd, s5k5baf_enum_mbus_code() argument
1223 static int s5k5baf_enum_frame_size(struct v4l2_subdev *sd, s5k5baf_enum_frame_size() argument
1281 static int s5k5baf_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, s5k5baf_get_fmt() argument
1284 struct s5k5baf *state = to_s5k5baf(sd); s5k5baf_get_fmt()
1289 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); s5k5baf_get_fmt()
1311 static int s5k5baf_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, s5k5baf_set_fmt() argument
1315 struct s5k5baf *state = to_s5k5baf(sd); s5k5baf_set_fmt()
1322 *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = *mf; s5k5baf_set_fmt()
1373 static int s5k5baf_get_selection(struct v4l2_subdev *sd, s5k5baf_get_selection() argument
1378 struct s5k5baf *state = to_s5k5baf(sd); s5k5baf_get_selection()
1394 sel->r = *v4l2_subdev_get_try_compose(sd, cfg, sel->pad); s5k5baf_get_selection()
1396 sel->r = *v4l2_subdev_get_try_crop(sd, cfg, sel->pad); s5k5baf_get_selection()
1464 static int s5k5baf_set_selection(struct v4l2_subdev *sd, s5k5baf_set_selection() argument
1469 struct s5k5baf *state = to_s5k5baf(sd); s5k5baf_set_selection()
1486 v4l2_subdev_get_try_crop(sd, cfg, PAD_CIS), s5k5baf_set_selection()
1487 v4l2_subdev_get_try_compose(sd, cfg, PAD_CIS), s5k5baf_set_selection()
1488 v4l2_subdev_get_try_crop(sd, cfg, PAD_OUT) s5k5baf_set_selection()
1553 struct v4l2_subdev *sd = ctrl_to_sd(ctrl); s5k5baf_s_ctrl() local
1554 struct s5k5baf *state = to_s5k5baf(sd); s5k5baf_s_ctrl()
1557 v4l2_dbg(1, debug, sd, "ctrl: %s, value: %d\n", ctrl->name, ctrl->val); s5k5baf_s_ctrl()
1640 v4l2_err(&state->sd, "cannot init ctrl handler (%d)\n", ret); s5k5baf_initialize_ctrls()
1688 v4l2_err(&state->sd, "error creating controls (%d)\n", s5k5baf_initialize_ctrls()
1695 state->sd.ctrl_handler = hdl; s5k5baf_initialize_ctrls()
1702 static int s5k5baf_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) s5k5baf_open() argument
1706 mf = v4l2_subdev_get_try_format(sd, fh->pad, PAD_CIS); s5k5baf_open()
1709 if (s5k5baf_is_cis_subdev(sd)) s5k5baf_open()
1712 mf = v4l2_subdev_get_try_format(sd, fh->pad, PAD_OUT); s5k5baf_open()
1719 *v4l2_subdev_get_try_crop(sd, fh->pad, PAD_CIS) = s5k5baf_cis_rect; s5k5baf_open()
1720 *v4l2_subdev_get_try_compose(sd, fh->pad, PAD_CIS) = s5k5baf_cis_rect; s5k5baf_open()
1721 *v4l2_subdev_get_try_crop(sd, fh->pad, PAD_OUT) = s5k5baf_cis_rect; s5k5baf_open()
1738 v4l2_info(&state->sd, "FW API=%#x, revision=%#x sensor_id=%#x\n", s5k5baf_check_fw_revision()
1742 v4l2_err(&state->sd, "FW API version not supported\n"); s5k5baf_check_fw_revision()
1749 static int s5k5baf_registered(struct v4l2_subdev *sd) s5k5baf_registered() argument
1751 struct s5k5baf *state = to_s5k5baf(sd); s5k5baf_registered()
1754 ret = v4l2_device_register_subdev(sd->v4l2_dev, &state->cis_sd); s5k5baf_registered()
1756 v4l2_err(sd, "failed to register subdev %s\n", s5k5baf_registered()
1760 &state->sd.entity, PAD_CIS, s5k5baf_registered()
1766 static void s5k5baf_unregistered(struct v4l2_subdev *sd) s5k5baf_unregistered() argument
1768 struct s5k5baf *state = to_s5k5baf(sd); s5k5baf_unregistered()
1800 struct i2c_client *c = v4l2_get_subdevdata(&state->sd); s5k5baf_configure_gpios()
1893 struct v4l2_subdev *sd; s5k5baf_configure_subdevs() local
1896 sd = &state->cis_sd; s5k5baf_configure_subdevs()
1897 v4l2_subdev_init(sd, &s5k5baf_cis_subdev_ops); s5k5baf_configure_subdevs()
1898 sd->owner = THIS_MODULE; s5k5baf_configure_subdevs()
1899 v4l2_set_subdevdata(sd, state); s5k5baf_configure_subdevs()
1900 snprintf(sd->name, sizeof(sd->name), "S5K5BAF-CIS %d-%04x", s5k5baf_configure_subdevs()
1903 sd->internal_ops = &s5k5baf_cis_subdev_internal_ops; s5k5baf_configure_subdevs()
1904 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; s5k5baf_configure_subdevs()
1907 sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; s5k5baf_configure_subdevs()
1908 ret = media_entity_init(&sd->entity, NUM_CIS_PADS, &state->cis_pad, 0); s5k5baf_configure_subdevs()
1912 sd = &state->sd; s5k5baf_configure_subdevs()
1913 v4l2_i2c_subdev_init(sd, c, &s5k5baf_subdev_ops); s5k5baf_configure_subdevs()
1914 snprintf(sd->name, sizeof(sd->name), "S5K5BAF-ISP %d-%04x", s5k5baf_configure_subdevs()
1917 sd->internal_ops = &s5k5baf_subdev_internal_ops; s5k5baf_configure_subdevs()
1918 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; s5k5baf_configure_subdevs()
1922 sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV; s5k5baf_configure_subdevs()
1923 ret = media_entity_init(&sd->entity, NUM_ISP_PADS, state->pads, 0); s5k5baf_configure_subdevs()
1930 dev_err(&c->dev, "cannot init media entity %s\n", sd->name); s5k5baf_configure_subdevs()
1936 struct i2c_client *c = v4l2_get_subdevdata(&state->sd); s5k5baf_configure_regulators()
1981 state->clock = devm_clk_get(state->sd.dev, S5K5BAF_CLK_NAME); s5k5baf_probe()
2003 ret = v4l2_async_register_subdev(&state->sd); s5k5baf_probe()
2010 v4l2_ctrl_handler_free(state->sd.ctrl_handler); s5k5baf_probe()
2012 media_entity_cleanup(&state->sd.entity); s5k5baf_probe()
2019 struct v4l2_subdev *sd = i2c_get_clientdata(c); s5k5baf_remove() local
2020 struct s5k5baf *state = to_s5k5baf(sd); s5k5baf_remove()
2022 v4l2_async_unregister_subdev(sd); s5k5baf_remove()
2023 v4l2_ctrl_handler_free(sd->ctrl_handler); s5k5baf_remove()
2024 media_entity_cleanup(&sd->entity); s5k5baf_remove()
2026 sd = &state->cis_sd; s5k5baf_remove()
2027 v4l2_device_unregister_subdev(sd); s5k5baf_remove()
2028 media_entity_cleanup(&sd->entity); s5k5baf_remove()
H A Dtw2804.c40 struct v4l2_subdev sd; member in struct:tw2804
142 static inline struct tw2804 *to_state(struct v4l2_subdev *sd) to_state() argument
144 return container_of(sd, struct tw2804, sd); to_state()
152 static int tw2804_log_status(struct v4l2_subdev *sd) tw2804_log_status() argument
154 struct tw2804 *state = to_state(sd); tw2804_log_status()
156 v4l2_info(sd, "Standard: %s\n", tw2804_log_status()
158 v4l2_info(sd, "Channel: %d\n", state->channel); tw2804_log_status()
159 v4l2_info(sd, "Input: %d\n", state->input); tw2804_log_status()
160 return v4l2_ctrl_subdev_log_status(sd); tw2804_log_status()
179 struct i2c_client *client = v4l2_get_subdevdata(&state->sd); tw2804_g_volatile_ctrl()
204 struct i2c_client *client = v4l2_get_subdevdata(&state->sd); tw2804_s_ctrl()
262 static int tw2804_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) tw2804_s_std() argument
264 struct tw2804 *dec = to_state(sd); tw2804_s_std()
265 struct i2c_client *client = v4l2_get_subdevdata(sd); tw2804_s_std()
286 static int tw2804_s_video_routing(struct v4l2_subdev *sd, u32 input, u32 output, tw2804_s_video_routing() argument
289 struct tw2804 *dec = to_state(sd); tw2804_s_video_routing()
290 struct i2c_client *client = v4l2_get_subdevdata(sd); tw2804_s_video_routing()
363 struct v4l2_subdev *sd; tw2804_probe() local
373 sd = &state->sd; tw2804_probe()
374 v4l2_i2c_subdev_init(sd, client, &tw2804_ops); tw2804_probe()
407 sd->ctrl_handler = &state->hdl; tw2804_probe()
422 struct v4l2_subdev *sd = i2c_get_clientdata(client); tw2804_remove() local
423 struct tw2804 *state = to_state(sd); tw2804_remove()
425 v4l2_device_unregister_subdev(sd); tw2804_remove()
H A Ds5k4ecgx.c185 struct v4l2_subdev sd; member in struct:s5k4ecgx
200 static inline struct s5k4ecgx *to_s5k4ecgx(struct v4l2_subdev *sd) to_s5k4ecgx() argument
202 return container_of(sd, struct s5k4ecgx, sd); to_s5k4ecgx()
272 static int s5k4ecgx_read_fw_ver(struct v4l2_subdev *sd) s5k4ecgx_read_fw_ver() argument
274 struct i2c_client *client = v4l2_get_subdevdata(sd); s5k4ecgx_read_fw_ver()
280 v4l2_err(sd, "FW version check failed!\n"); s5k4ecgx_read_fw_ver()
288 v4l2_info(sd, "chip found FW ver: 0x%x, HW rev: 0x%x\n", s5k4ecgx_read_fw_ver()
293 static int s5k4ecgx_set_ahb_address(struct v4l2_subdev *sd) s5k4ecgx_set_ahb_address() argument
295 struct i2c_client *client = v4l2_get_subdevdata(sd); s5k4ecgx_set_ahb_address()
330 static int s5k4ecgx_load_firmware(struct v4l2_subdev *sd) s5k4ecgx_load_firmware() argument
332 struct i2c_client *client = v4l2_get_subdevdata(sd); s5k4ecgx_load_firmware()
339 err = request_firmware(&fw, S5K4ECGX_FIRMWARE, sd->v4l2_dev->dev); s5k4ecgx_load_firmware()
341 v4l2_err(sd, "Failed to read firmware %s\n", S5K4ECGX_FIRMWARE); s5k4ecgx_load_firmware()
346 v4l2_dbg(3, debug, sd, "FW: %s size %zu register sets %d\n", s5k4ecgx_load_firmware()
357 v4l2_err(sd, "FW: invalid crc (%#x:%#x)\n", crc, crc_file); s5k4ecgx_load_firmware()
432 struct i2c_client *client = v4l2_get_subdevdata(&priv->sd); s5k4ecgx_set_output_framefmt()
446 static int s5k4ecgx_init_sensor(struct v4l2_subdev *sd) s5k4ecgx_init_sensor() argument
450 ret = s5k4ecgx_set_ahb_address(sd); s5k4ecgx_init_sensor()
456 ret = s5k4ecgx_load_firmware(sd); s5k4ecgx_init_sensor()
458 v4l2_err(sd, "Failed to write initial settings\n"); s5k4ecgx_init_sensor()
533 static int s5k4ecgx_enum_mbus_code(struct v4l2_subdev *sd, s5k4ecgx_enum_mbus_code() argument
544 static int s5k4ecgx_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, s5k4ecgx_get_fmt() argument
547 struct s5k4ecgx *priv = to_s5k4ecgx(sd); s5k4ecgx_get_fmt()
552 mf = v4l2_subdev_get_try_format(sd, cfg, 0); s5k4ecgx_get_fmt()
571 static const struct s5k4ecgx_pixfmt *s5k4ecgx_try_fmt(struct v4l2_subdev *sd, s5k4ecgx_try_fmt() argument
584 static int s5k4ecgx_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, s5k4ecgx_set_fmt() argument
587 struct s5k4ecgx *priv = to_s5k4ecgx(sd); s5k4ecgx_set_fmt()
593 pf = s5k4ecgx_try_fmt(sd, &fmt->format); s5k4ecgx_set_fmt()
600 mf = v4l2_subdev_get_try_format(sd, cfg, 0); s5k4ecgx_set_fmt()
630 struct v4l2_subdev *sd = &container_of(ctrl->handler, struct s5k4ecgx, s5k4ecgx_s_ctrl() local
631 handler)->sd; s5k4ecgx_s_ctrl()
632 struct i2c_client *client = v4l2_get_subdevdata(sd); s5k4ecgx_s_ctrl()
633 struct s5k4ecgx *priv = to_s5k4ecgx(sd); s5k4ecgx_s_ctrl()
637 v4l2_dbg(1, debug, sd, "ctrl: 0x%x, value: %d\n", ctrl->id, ctrl->val); s5k4ecgx_s_ctrl()
662 v4l2_err(sd, "Failed to write s_ctrl err %d\n", err); s5k4ecgx_s_ctrl()
674 static int s5k4ecgx_registered(struct v4l2_subdev *sd) s5k4ecgx_registered() argument
677 struct s5k4ecgx *priv = to_s5k4ecgx(sd); s5k4ecgx_registered()
682 ret = s5k4ecgx_read_fw_ver(sd); s5k4ecgx_registered()
693 static int s5k4ecgx_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) s5k4ecgx_open() argument
695 struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(sd, fh->pad, 0); s5k4ecgx_open()
711 static int s5k4ecgx_s_power(struct v4l2_subdev *sd, int on) s5k4ecgx_s_power() argument
713 struct s5k4ecgx *priv = to_s5k4ecgx(sd); s5k4ecgx_s_power()
716 v4l2_dbg(1, debug, sd, "Switching %s\n", on ? "on" : "off"); s5k4ecgx_s_power()
724 ret = s5k4ecgx_init_sensor(sd); s5k4ecgx_s_power()
736 static int s5k4ecgx_log_status(struct v4l2_subdev *sd) s5k4ecgx_log_status() argument
738 v4l2_ctrl_handler_log_status(sd->ctrl_handler, sd->name); s5k4ecgx_log_status()
750 struct i2c_client *client = v4l2_get_subdevdata(&priv->sd); __s5k4ecgx_s_params()
797 struct i2c_client *client = v4l2_get_subdevdata(&priv->sd); __s5k4ecgx_s_stream()
816 static int s5k4ecgx_s_stream(struct v4l2_subdev *sd, int on) s5k4ecgx_s_stream() argument
818 struct s5k4ecgx *priv = to_s5k4ecgx(sd); s5k4ecgx_s_stream()
821 v4l2_dbg(1, debug, sd, "Turn streaming %s\n", on ? "on" : "off"); s5k4ecgx_s_stream()
929 priv->sd.ctrl_handler = hdl; s5k4ecgx_init_v4l2_ctrls()
938 struct v4l2_subdev *sd; s5k4ecgx_probe() local
954 sd = &priv->sd; s5k4ecgx_probe()
956 v4l2_i2c_subdev_init(sd, client, &s5k4ecgx_ops); s5k4ecgx_probe()
957 strlcpy(sd->name, S5K4ECGX_DRIVER_NAME, sizeof(sd->name)); s5k4ecgx_probe()
959 sd->internal_ops = &s5k4ecgx_subdev_internal_ops; s5k4ecgx_probe()
961 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; s5k4ecgx_probe()
964 sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; s5k4ecgx_probe()
965 ret = media_entity_init(&sd->entity, 1, &priv->pad, 0); s5k4ecgx_probe()
995 media_entity_cleanup(&priv->sd.entity); s5k4ecgx_probe()
1002 struct v4l2_subdev *sd = i2c_get_clientdata(client); s5k4ecgx_remove() local
1003 struct s5k4ecgx *priv = to_s5k4ecgx(sd); s5k4ecgx_remove()
1007 v4l2_device_unregister_subdev(sd); s5k4ecgx_remove()
1009 media_entity_cleanup(&sd->entity); s5k4ecgx_remove()
H A Dsony-btf-mpx.c49 struct v4l2_subdev sd; member in struct:sony_btf_mpx
54 static inline struct sony_btf_mpx *to_state(struct v4l2_subdev *sd) to_state() argument
56 return container_of(sd, struct sony_btf_mpx, sd); to_state()
171 struct i2c_client *client = v4l2_get_subdevdata(&t->sd); mpx_setup()
279 static int sony_btf_mpx_s_std(struct v4l2_subdev *sd, v4l2_std_id std) sony_btf_mpx_s_std() argument
281 struct sony_btf_mpx *t = to_state(sd); sony_btf_mpx_s_std()
300 static int sony_btf_mpx_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) sony_btf_mpx_g_tuner() argument
302 struct sony_btf_mpx *t = to_state(sd); sony_btf_mpx_g_tuner()
314 static int sony_btf_mpx_s_tuner(struct v4l2_subdev *sd, const struct v4l2_tuner *vt) sony_btf_mpx_s_tuner() argument
316 struct sony_btf_mpx *t = to_state(sd); sony_btf_mpx_s_tuner()
350 struct v4l2_subdev *sd; sony_btf_mpx_probe() local
362 sd = &t->sd; sony_btf_mpx_probe()
363 v4l2_i2c_subdev_init(sd, client, &sony_btf_mpx_ops); sony_btf_mpx_probe()
374 struct v4l2_subdev *sd = i2c_get_clientdata(client); sony_btf_mpx_remove() local
376 v4l2_device_unregister_subdev(sd); sony_btf_mpx_remove()
H A Ds5k6aa.c231 struct v4l2_subdev sd; member in struct:s5k6aa
306 return &container_of(ctrl->handler, struct s5k6aa, ctrls.handler)->sd; ctrl_to_sd()
309 static inline struct s5k6aa *to_s5k6aa(struct v4l2_subdev *sd) to_s5k6aa() argument
311 return container_of(sd, struct s5k6aa, sd); to_s5k6aa()
386 static int s5k6aa_write_array(struct v4l2_subdev *sd, s5k6aa_write_array() argument
389 struct i2c_client *client = v4l2_get_subdevdata(sd); s5k6aa_write_array()
430 struct i2c_client *c = v4l2_get_subdevdata(&s5k6aa->sd); s5k6aa_configure_pixel_clocks()
469 struct i2c_client *client = v4l2_get_subdevdata(&s5k6aa->sd); s5k6aa_set_mirror()
481 struct i2c_client *c = v4l2_get_subdevdata(&s5k6aa->sd); s5k6aa_set_awb()
536 struct i2c_client *c = v4l2_get_subdevdata(&s5k6aa->sd); s5k6aa_set_auto_exposure()
564 struct i2c_client *client = v4l2_get_subdevdata(&s5k6aa->sd); s5k6aa_set_anti_flicker()
591 struct i2c_client *client = v4l2_get_subdevdata(&s5k6aa->sd); s5k6aa_set_colorfx()
634 struct i2c_client *client = v4l2_get_subdevdata(&s5k6aa->sd); s5k6aa_set_output_framefmt()
651 struct i2c_client *c = v4l2_get_subdevdata(&s5k6aa->sd); s5k6aa_set_input_params()
680 struct i2c_client *client = v4l2_get_subdevdata(&s5k6aa->sd); s5k6aa_configure_video_bus()
734 struct i2c_client *client = v4l2_get_subdevdata(&s5k6aa->sd); s5k6aa_set_prev_config()
786 static int s5k6aa_initialize_isp(struct v4l2_subdev *sd) s5k6aa_initialize_isp() argument
788 struct i2c_client *client = v4l2_get_subdevdata(sd); s5k6aa_initialize_isp()
789 struct s5k6aa *s5k6aa = to_s5k6aa(sd); s5k6aa_initialize_isp()
803 ret = s5k6aa_write_array(sd, s5k6aa_analog_config); s5k6aa_initialize_isp()
871 static int s5k6aa_set_power(struct v4l2_subdev *sd, int on) s5k6aa_set_power() argument
873 struct s5k6aa *s5k6aa = to_s5k6aa(sd); s5k6aa_set_power()
882 ret = s5k6aa_initialize_isp(sd); s5k6aa_set_power()
896 return v4l2_ctrl_handler_setup(sd->ctrl_handler); s5k6aa_set_power()
901 struct i2c_client *client = v4l2_get_subdevdata(&s5k6aa->sd); __s5k6aa_stream()
913 static int s5k6aa_s_stream(struct v4l2_subdev *sd, int on) s5k6aa_s_stream() argument
915 struct s5k6aa *s5k6aa = to_s5k6aa(sd); s5k6aa_s_stream()
933 static int s5k6aa_g_frame_interval(struct v4l2_subdev *sd, s5k6aa_g_frame_interval() argument
936 struct s5k6aa *s5k6aa = to_s5k6aa(sd); s5k6aa_g_frame_interval()
973 v4l2_dbg(1, debug, &s5k6aa->sd, "Changed frame interval to %d us\n", __s5k6aa_set_frame_interval()
978 static int s5k6aa_s_frame_interval(struct v4l2_subdev *sd, s5k6aa_s_frame_interval() argument
981 struct s5k6aa *s5k6aa = to_s5k6aa(sd); s5k6aa_s_frame_interval()
984 v4l2_dbg(1, debug, sd, "Setting %d/%d frame interval\n", s5k6aa_s_frame_interval()
998 static int s5k6aa_enum_frame_interval(struct v4l2_subdev *sd, s5k6aa_enum_frame_interval() argument
1002 struct s5k6aa *s5k6aa = to_s5k6aa(sd); s5k6aa_enum_frame_interval()
1025 static int s5k6aa_enum_mbus_code(struct v4l2_subdev *sd, s5k6aa_enum_mbus_code() argument
1036 static int s5k6aa_enum_frame_size(struct v4l2_subdev *sd, s5k6aa_enum_frame_size() argument
1066 return v4l2_subdev_get_try_crop(&s5k6aa->sd, cfg, 0); __s5k6aa_get_crop_rect()
1090 static int s5k6aa_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, s5k6aa_get_fmt() argument
1093 struct s5k6aa *s5k6aa = to_s5k6aa(sd); s5k6aa_get_fmt()
1099 mf = v4l2_subdev_get_try_format(sd, cfg, 0); s5k6aa_get_fmt()
1111 static int s5k6aa_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, s5k6aa_set_fmt() argument
1114 struct s5k6aa *s5k6aa = to_s5k6aa(sd); s5k6aa_set_fmt()
1124 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); s5k6aa_set_fmt()
1125 crop = v4l2_subdev_get_try_crop(sd, cfg, 0); s5k6aa_set_fmt()
1164 static int s5k6aa_get_selection(struct v4l2_subdev *sd, s5k6aa_get_selection() argument
1168 struct s5k6aa *s5k6aa = to_s5k6aa(sd); s5k6aa_get_selection()
1181 v4l2_dbg(1, debug, sd, "Current crop rectangle: (%d,%d)/%dx%d\n", s5k6aa_get_selection()
1187 static int s5k6aa_set_selection(struct v4l2_subdev *sd, s5k6aa_set_selection() argument
1191 struct s5k6aa *s5k6aa = to_s5k6aa(sd); s5k6aa_set_selection()
1206 mf = v4l2_subdev_get_try_format(sd, cfg, 0); s5k6aa_set_selection()
1223 v4l2_dbg(1, debug, sd, "Set crop rectangle: (%d,%d)/%dx%d\n", s5k6aa_set_selection()
1251 struct v4l2_subdev *sd = ctrl_to_sd(ctrl); s5k6aa_s_ctrl() local
1252 struct i2c_client *client = v4l2_get_subdevdata(sd); s5k6aa_s_ctrl()
1253 struct s5k6aa *s5k6aa = to_s5k6aa(sd); s5k6aa_s_ctrl()
1256 v4l2_dbg(1, debug, sd, "ctrl: 0x%x, value: %d\n", ctrl->id, ctrl->val); s5k6aa_s_ctrl()
1324 static int s5k6aa_log_status(struct v4l2_subdev *sd) s5k6aa_log_status() argument
1326 v4l2_ctrl_handler_log_status(sd->ctrl_handler, sd->name); s5k6aa_log_status()
1418 s5k6aa->sd.ctrl_handler = hdl; s5k6aa_initialize_ctrls()
1425 static int s5k6aa_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) s5k6aa_open() argument
1427 struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(sd, fh->pad, 0); s5k6aa_open()
1428 struct v4l2_rect *crop = v4l2_subdev_get_try_crop(sd, fh->pad, 0); s5k6aa_open()
1446 struct i2c_client *client = v4l2_get_subdevdata(&s5k6aa->sd); s5k6aa_check_fw_revision()
1456 v4l2_err(&s5k6aa->sd, "FW revision check failed!\n"); s5k6aa_check_fw_revision()
1460 v4l2_info(&s5k6aa->sd, "FW API ver.: 0x%X, FW rev.: 0x%X\n", s5k6aa_check_fw_revision()
1466 static int s5k6aa_registered(struct v4l2_subdev *sd) s5k6aa_registered() argument
1468 struct s5k6aa *s5k6aa = to_s5k6aa(sd); s5k6aa_registered()
1506 struct i2c_client *client = v4l2_get_subdevdata(&s5k6aa->sd); s5k6aa_configure_gpios()
1545 struct v4l2_subdev *sd; s5k6aa_probe() local
1572 sd = &s5k6aa->sd; s5k6aa_probe()
1573 v4l2_i2c_subdev_init(sd, client, &s5k6aa_subdev_ops); s5k6aa_probe()
1574 strlcpy(sd->name, DRIVER_NAME, sizeof(sd->name)); s5k6aa_probe()
1576 sd->internal_ops = &s5k6aa_subdev_internal_ops; s5k6aa_probe()
1577 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; s5k6aa_probe()
1580 sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; s5k6aa_probe()
1581 ret = media_entity_init(&sd->entity, 1, &s5k6aa->pad, 0); s5k6aa_probe()
1613 media_entity_cleanup(&s5k6aa->sd.entity); s5k6aa_probe()
1619 struct v4l2_subdev *sd = i2c_get_clientdata(client); s5k6aa_remove() local
1621 v4l2_device_unregister_subdev(sd); s5k6aa_remove()
1622 v4l2_ctrl_handler_free(sd->ctrl_handler); s5k6aa_remove()
1623 media_entity_cleanup(&sd->entity); s5k6aa_remove()
H A Dbt866.c52 struct v4l2_subdev sd; member in struct:bt866
56 static inline struct bt866 *to_bt866(struct v4l2_subdev *sd) to_bt866() argument
58 return container_of(sd, struct bt866, sd); to_bt866()
63 struct i2c_client *client = v4l2_get_subdevdata(&encoder->sd); bt866_write()
90 static int bt866_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) bt866_s_std_output() argument
92 v4l2_dbg(1, debug, sd, "set norm %llx\n", (unsigned long long)std); bt866_s_std_output()
100 static int bt866_s_routing(struct v4l2_subdev *sd, bt866_s_routing() argument
130 struct bt866 *encoder = to_bt866(sd); bt866_s_routing()
153 v4l2_dbg(1, debug, sd, "set input %d\n", input); bt866_s_routing()
192 struct v4l2_subdev *sd; bt866_probe() local
200 sd = &encoder->sd; bt866_probe()
201 v4l2_i2c_subdev_init(sd, client, &bt866_ops); bt866_probe()
207 struct v4l2_subdev *sd = i2c_get_clientdata(client); bt866_remove() local
209 v4l2_device_unregister_subdev(sd); bt866_remove()
H A Dak881x.c64 static int ak881x_g_register(struct v4l2_subdev *sd, ak881x_g_register() argument
67 struct i2c_client *client = v4l2_get_subdevdata(sd); ak881x_g_register()
81 static int ak881x_s_register(struct v4l2_subdev *sd, ak881x_s_register() argument
84 struct i2c_client *client = v4l2_get_subdevdata(sd); ak881x_s_register()
96 static int ak881x_try_g_mbus_fmt(struct v4l2_subdev *sd, ak881x_try_g_mbus_fmt() argument
99 struct i2c_client *client = v4l2_get_subdevdata(sd); ak881x_try_g_mbus_fmt()
111 static int ak881x_s_mbus_fmt(struct v4l2_subdev *sd, ak881x_s_mbus_fmt() argument
118 return ak881x_try_g_mbus_fmt(sd, mf); ak881x_s_mbus_fmt()
121 static int ak881x_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned int index, ak881x_enum_mbus_fmt() argument
131 static int ak881x_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) ak881x_cropcap() argument
133 struct i2c_client *client = v4l2_get_subdevdata(sd); ak881x_cropcap()
148 static int ak881x_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) ak881x_s_std_output() argument
150 struct i2c_client *client = v4l2_get_subdevdata(sd); ak881x_s_std_output()
179 static int ak881x_s_stream(struct v4l2_subdev *sd, int enable) ak881x_s_stream() argument
181 struct i2c_client *client = v4l2_get_subdevdata(sd); ak881x_s_stream()
H A Dtvaudio.c115 struct v4l2_subdev sd; member in struct:CHIPSTATE
142 static inline struct CHIPSTATE *to_state(struct v4l2_subdev *sd) to_state() argument
144 return container_of(sd, struct CHIPSTATE, sd); to_state()
149 return &container_of(ctrl->handler, struct CHIPSTATE, hdl)->sd; to_sd()
158 struct v4l2_subdev *sd = &chip->sd; chip_write() local
159 struct i2c_client *c = v4l2_get_subdevdata(sd); chip_write()
163 v4l2_dbg(1, debug, sd, "chip_write: 0x%x\n", val); chip_write()
167 v4l2_warn(sd, "I/O error (write 0x%x)\n", val); chip_write()
172 v4l2_info(sd, chip_write()
178 v4l2_dbg(1, debug, sd, "chip_write: reg%d=0x%x\n", chip_write()
184 v4l2_warn(sd, "I/O error (write reg%d=0x%x)\n", chip_write()
195 struct v4l2_subdev *sd = &chip->sd; chip_write_masked() local
202 v4l2_info(sd, chip_write_masked()
216 struct v4l2_subdev *sd = &chip->sd; chip_read() local
217 struct i2c_client *c = v4l2_get_subdevdata(sd); chip_read()
221 v4l2_warn(sd, "I/O error (read)\n"); chip_read()
224 v4l2_dbg(1, debug, sd, "chip_read: 0x%x\n", buffer); chip_read()
230 struct v4l2_subdev *sd = &chip->sd; chip_read2() local
231 struct i2c_client *c = v4l2_get_subdevdata(sd); chip_read2()
251 v4l2_warn(sd, "I/O error (read2)\n"); chip_read2()
254 v4l2_dbg(1, debug, sd, "chip_read2: reg%d=0x%x\n", chip_read2()
261 struct v4l2_subdev *sd = &chip->sd; chip_cmd() local
262 struct i2c_client *c = v4l2_get_subdevdata(sd); chip_cmd()
269 v4l2_info(sd, chip_cmd()
278 v4l2_dbg(1, debug, sd, "chip_cmd(%s): reg=%d, data:", chip_cmd()
290 v4l2_warn(sd, "I/O error (%s)\n", name); chip_cmd()
313 struct v4l2_subdev *sd = &chip->sd; chip_thread() local
316 v4l2_dbg(1, debug, sd, "thread started\n"); chip_thread()
326 v4l2_dbg(1, debug, sd, "thread wakeup\n"); chip_thread()
338 v4l2_dbg(1, debug, sd, "thread checkmode\n"); chip_thread()
373 v4l2_dbg(1, debug, sd, "thread exiting\n"); chip_thread()
402 struct v4l2_subdev *sd = &chip->sd; tda9840_getrxsubchans() local
412 v4l2_dbg(1, debug, sd, tda9840_getrxsubchans()
722 struct v4l2_subdev *sd = &chip->sd; tda9873_getrxsubchans() local
731 v4l2_dbg(1, debug, sd, tda9873_getrxsubchans()
739 struct v4l2_subdev *sd = &chip->sd; tda9873_setaudmode() local
744 v4l2_dbg(1, debug, sd, tda9873_setaudmode()
749 v4l2_dbg(1, debug, sd, tda9873_setaudmode()
752 v4l2_dbg(1, debug, sd, "tda9873_setaudmode(): sw_data = %d\n", tda9873_setaudmode()
776 v4l2_dbg(1, debug, sd, tda9873_setaudmode()
886 struct v4l2_subdev *sd = &chip->sd; tda9874a_setup() local
918 v4l2_dbg(1, debug, sd, "tda9874a_setup(): %s [0x%02X].\n", tda9874a_setup()
925 struct v4l2_subdev *sd = &chip->sd; tda9874a_getrxsubchans() local
962 v4l2_dbg(1, debug, sd, tda9874a_getrxsubchans()
970 struct v4l2_subdev *sd = &chip->sd; tda9874a_setaudmode() local
1014 v4l2_dbg(1, debug, sd, tda9874a_setaudmode()
1053 v4l2_dbg(1, debug, sd, tda9874a_setaudmode()
1061 struct v4l2_subdev *sd = &chip->sd; tda9874a_checkit() local
1069 v4l2_dbg(1, debug, sd, "tda9874a_checkit(): DIC=0x%X, SIC=0x%X.\n", dic, sic); tda9874a_checkit()
1072 v4l2_info(sd, "found tda9874%s.\n", (dic == 0x11) ? "a" : "h"); tda9874a_checkit()
1202 struct v4l2_subdev *sd = &chip->sd; tda9875_checkit() local
1209 v4l2_info(sd, "found tda9875%s rev. %d.\n", tda9875_checkit()
1389 /* v4l2_dbg(1, debug, &chip->sd, ta8874z_getrxsubchans()
1403 struct v4l2_subdev *sd = &chip->sd; ta8874z_setaudmode() local
1407 v4l2_dbg(1, debug, sd, "ta8874z_setaudmode(): mode: 0x%02x\n", mode); ta8874z_setaudmode()
1695 struct v4l2_subdev *sd = to_sd(ctrl); tvaudio_s_ctrl() local
1696 struct CHIPSTATE *chip = to_state(sd); tvaudio_s_ctrl()
1735 static int tvaudio_s_radio(struct v4l2_subdev *sd) tvaudio_s_radio() argument
1737 struct CHIPSTATE *chip = to_state(sd); tvaudio_s_radio()
1744 static int tvaudio_s_routing(struct v4l2_subdev *sd, tvaudio_s_routing() argument
1747 struct CHIPSTATE *chip = to_state(sd); tvaudio_s_routing()
1763 static int tvaudio_s_tuner(struct v4l2_subdev *sd, const struct v4l2_tuner *vt) tvaudio_s_tuner() argument
1765 struct CHIPSTATE *chip = to_state(sd); tvaudio_s_tuner()
1793 static int tvaudio_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) tvaudio_g_tuner() argument
1795 struct CHIPSTATE *chip = to_state(sd); tvaudio_g_tuner()
1811 static int tvaudio_s_std(struct v4l2_subdev *sd, v4l2_std_id std) tvaudio_s_std() argument
1813 struct CHIPSTATE *chip = to_state(sd); tvaudio_s_std()
1819 static int tvaudio_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *freq) tvaudio_s_frequency() argument
1821 struct CHIPSTATE *chip = to_state(sd); tvaudio_s_frequency()
1840 static int tvaudio_log_status(struct v4l2_subdev *sd) tvaudio_log_status() argument
1842 struct CHIPSTATE *chip = to_state(sd); tvaudio_log_status()
1845 v4l2_info(sd, "Chip: %s\n", desc->name); tvaudio_log_status()
1846 v4l2_ctrl_handler_log_status(&chip->hdl, sd->name); tvaudio_log_status()
1898 struct v4l2_subdev *sd; tvaudio_probe() local
1911 sd = &chip->sd; tvaudio_probe()
1912 v4l2_i2c_subdev_init(sd, client, &tvaudio_ops); tvaudio_probe()
1915 v4l2_dbg(1, debug, sd, "chip found @ 0x%x\n", client->addr<<1); tvaudio_probe()
1927 v4l2_dbg(1, debug, sd, "no matching chip description found\n"); tvaudio_probe()
1930 v4l2_info(sd, "%s found @ 0x%x (%s)\n", desc->name, client->addr<<1, client->adapter->name); tvaudio_probe()
1932 v4l2_dbg(1, debug, sd, "matches:%s%s%s.\n", tvaudio_probe()
1961 v4l2_info(sd, "volume callback undefined!\n"); tvaudio_probe()
1979 v4l2_info(sd, "bass/treble callbacks undefined!\n"); tvaudio_probe()
1993 sd->ctrl_handler = &chip->hdl; tvaudio_probe()
2010 v4l2_info(sd, "set/get mode callbacks undefined!\n"); tvaudio_probe()
2019 v4l2_warn(sd, "failed to create kthread\n"); tvaudio_probe()
2028 struct v4l2_subdev *sd = i2c_get_clientdata(client); tvaudio_remove() local
2029 struct CHIPSTATE *chip = to_state(sd); tvaudio_remove()
2038 v4l2_device_unregister_subdev(sd); tvaudio_remove()
H A Dsaa6588.c68 struct v4l2_subdev sd; member in struct:saa6588
82 static inline struct saa6588 *to_saa6588(struct v4l2_subdev *sd) to_saa6588() argument
84 return container_of(sd, struct saa6588, sd); to_saa6588()
262 struct i2c_client *client = v4l2_get_subdevdata(&s->sd); saa6588_i2c_poll()
342 struct i2c_client *client = v4l2_get_subdevdata(&s->sd); saa6588_configure()
397 static long saa6588_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) saa6588_ioctl() argument
399 struct saa6588 *s = to_saa6588(sd); saa6588_ioctl()
429 static int saa6588_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) saa6588_g_tuner() argument
431 struct saa6588 *s = to_saa6588(sd); saa6588_g_tuner()
439 static int saa6588_s_tuner(struct v4l2_subdev *sd, const struct v4l2_tuner *vt) saa6588_s_tuner() argument
441 struct saa6588 *s = to_saa6588(sd); saa6588_s_tuner()
469 struct v4l2_subdev *sd; saa6588_probe() local
483 sd = &s->sd; saa6588_probe()
484 v4l2_i2c_subdev_init(sd, client, &saa6588_ops); saa6588_probe()
503 struct v4l2_subdev *sd = i2c_get_clientdata(client); saa6588_remove() local
504 struct saa6588 *s = to_saa6588(sd); saa6588_remove()
506 v4l2_device_unregister_subdev(sd); saa6588_remove()
H A Dmsp3400-driver.c351 struct i2c_client *client = v4l2_get_subdevdata(&state->sd); msp_s_ctrl()
421 static int msp_s_radio(struct v4l2_subdev *sd) msp_s_radio() argument
423 struct msp_state *state = to_state(sd); msp_s_radio()
424 struct i2c_client *client = v4l2_get_subdevdata(sd); msp_s_radio()
448 static int msp_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *freq) msp_s_frequency() argument
450 struct i2c_client *client = v4l2_get_subdevdata(sd); msp_s_frequency()
457 static int msp_querystd(struct v4l2_subdev *sd, v4l2_std_id *id) msp_querystd() argument
459 struct msp_state *state = to_state(sd); msp_querystd()
460 struct i2c_client *client = v4l2_get_subdevdata(sd); msp_querystd()
471 static int msp_s_std(struct v4l2_subdev *sd, v4l2_std_id id) msp_s_std() argument
473 struct msp_state *state = to_state(sd); msp_s_std()
474 struct i2c_client *client = v4l2_get_subdevdata(sd); msp_s_std()
484 static int msp_s_routing(struct v4l2_subdev *sd, msp_s_routing() argument
487 struct msp_state *state = to_state(sd); msp_s_routing()
488 struct i2c_client *client = v4l2_get_subdevdata(sd); msp_s_routing()
520 static int msp_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) msp_g_tuner() argument
522 struct msp_state *state = to_state(sd); msp_g_tuner()
523 struct i2c_client *client = v4l2_get_subdevdata(sd); msp_g_tuner()
538 static int msp_s_tuner(struct v4l2_subdev *sd, const struct v4l2_tuner *vt) msp_s_tuner() argument
540 struct msp_state *state = to_state(sd); msp_s_tuner()
541 struct i2c_client *client = v4l2_get_subdevdata(sd); msp_s_tuner()
553 static int msp_s_i2s_clock_freq(struct v4l2_subdev *sd, u32 freq) msp_s_i2s_clock_freq() argument
555 struct msp_state *state = to_state(sd); msp_s_i2s_clock_freq()
556 struct i2c_client *client = v4l2_get_subdevdata(sd); msp_s_i2s_clock_freq()
573 static int msp_log_status(struct v4l2_subdev *sd) msp_log_status() argument
575 struct msp_state *state = to_state(sd); msp_log_status()
576 struct i2c_client *client = v4l2_get_subdevdata(sd); msp_log_status()
584 snprintf(prefix, sizeof(prefix), "%s: Audio: ", sd->name); msp_log_status()
683 struct v4l2_subdev *sd; msp_probe() local
704 sd = &state->sd; msp_probe()
705 v4l2_i2c_subdev_init(sd, client, &msp_ops); msp_probe()
814 sd->ctrl_handler = hdl; msp_probe()
871 v4l2_device_unregister_subdev(&state->sd); msp_remove()
H A Dadv7180.c189 struct v4l2_subdev sd; member in struct:adv7180_state
207 ctrl_hdl)->sd)
328 static inline struct adv7180_state *to_state(struct v4l2_subdev *sd) to_state() argument
330 return container_of(sd, struct adv7180_state, sd); to_state()
333 static int adv7180_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) adv7180_querystd() argument
335 struct adv7180_state *state = to_state(sd); adv7180_querystd()
350 static int adv7180_s_routing(struct v4l2_subdev *sd, u32 input, adv7180_s_routing() argument
353 struct adv7180_state *state = to_state(sd); adv7180_s_routing()
373 static int adv7180_g_input_status(struct v4l2_subdev *sd, u32 *status) adv7180_g_input_status() argument
375 struct adv7180_state *state = to_state(sd); adv7180_g_input_status()
409 static int adv7180_s_std(struct v4l2_subdev *sd, v4l2_std_id std) adv7180_s_std() argument
411 struct adv7180_state *state = to_state(sd); adv7180_s_std()
468 static int adv7180_s_power(struct v4l2_subdev *sd, int on) adv7180_s_power() argument
470 struct adv7180_state *state = to_state(sd); adv7180_s_power()
487 struct v4l2_subdev *sd = to_adv7180_sd(ctrl); adv7180_s_ctrl() local
488 struct adv7180_state *state = to_state(sd); adv7180_s_ctrl()
568 state->sd.ctrl_handler = &state->ctrl_hdl; adv7180_init_controls()
584 static int adv7180_enum_mbus_code(struct v4l2_subdev *sd, adv7180_enum_mbus_code() argument
596 static int adv7180_mbus_fmt(struct v4l2_subdev *sd, adv7180_mbus_fmt() argument
599 struct adv7180_state *state = to_state(sd); adv7180_mbus_fmt()
647 static int adv7180_get_pad_format(struct v4l2_subdev *sd, adv7180_get_pad_format() argument
651 struct adv7180_state *state = to_state(sd); adv7180_get_pad_format()
654 format->format = *v4l2_subdev_get_try_format(sd, cfg, 0); adv7180_get_pad_format()
656 adv7180_mbus_fmt(sd, &format->format); adv7180_get_pad_format()
663 static int adv7180_set_pad_format(struct v4l2_subdev *sd, adv7180_set_pad_format() argument
667 struct adv7180_state *state = to_state(sd); adv7180_set_pad_format()
689 framefmt = v4l2_subdev_get_try_format(sd, cfg, 0); adv7180_set_pad_format()
693 return adv7180_mbus_fmt(sd, framefmt); adv7180_set_pad_format()
696 static int adv7180_g_mbus_config(struct v4l2_subdev *sd, adv7180_g_mbus_config() argument
699 struct adv7180_state *state = to_state(sd); adv7180_g_mbus_config()
1164 struct v4l2_subdev *sd; adv7180_probe() local
1206 sd = &state->sd; adv7180_probe()
1207 v4l2_i2c_subdev_init(sd, client, &adv7180_ops); adv7180_probe()
1208 sd->flags = V4L2_SUBDEV_FL_HAS_DEVNODE; adv7180_probe()
1215 sd->entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER; adv7180_probe()
1216 ret = media_entity_init(&sd->entity, 1, &state->pad, 0); adv7180_probe()
1232 ret = v4l2_async_register_subdev(sd); adv7180_probe()
1242 media_entity_cleanup(&sd->entity); adv7180_probe()
1257 struct v4l2_subdev *sd = i2c_get_clientdata(client); adv7180_remove() local
1258 struct adv7180_state *state = to_state(sd); adv7180_remove()
1260 v4l2_async_unregister_subdev(sd); adv7180_remove()
1265 media_entity_cleanup(&sd->entity); adv7180_remove()
1296 struct v4l2_subdev *sd = i2c_get_clientdata(client); adv7180_suspend() local
1297 struct adv7180_state *state = to_state(sd); adv7180_suspend()
1305 struct v4l2_subdev *sd = i2c_get_clientdata(client); adv7180_resume() local
1306 struct adv7180_state *state = to_state(sd); adv7180_resume()
H A Dov2659.c222 struct v4l2_subdev sd; member in struct:ov2659
832 static inline struct ov2659 *to_ov2659(struct v4l2_subdev *sd) to_ov2659() argument
834 return container_of(sd, struct ov2659, sd); to_ov2659()
990 static int ov2659_init(struct v4l2_subdev *sd, u32 val) ov2659_init() argument
992 struct i2c_client *client = v4l2_get_subdevdata(sd); ov2659_init()
1001 static int ov2659_enum_mbus_code(struct v4l2_subdev *sd, ov2659_enum_mbus_code() argument
1005 struct i2c_client *client = v4l2_get_subdevdata(sd); ov2659_enum_mbus_code()
1017 static int ov2659_enum_frame_sizes(struct v4l2_subdev *sd, ov2659_enum_frame_sizes() argument
1021 struct i2c_client *client = v4l2_get_subdevdata(sd); ov2659_enum_frame_sizes()
1043 static int ov2659_get_fmt(struct v4l2_subdev *sd, ov2659_get_fmt() argument
1047 struct i2c_client *client = v4l2_get_subdevdata(sd); ov2659_get_fmt()
1048 struct ov2659 *ov2659 = to_ov2659(sd); ov2659_get_fmt()
1054 mf = v4l2_subdev_get_try_format(sd, cfg, 0); ov2659_get_fmt()
1100 static int ov2659_set_fmt(struct v4l2_subdev *sd, ov2659_set_fmt() argument
1104 struct i2c_client *client = v4l2_get_subdevdata(sd); ov2659_set_fmt()
1108 struct ov2659 *ov2659 = to_ov2659(sd); ov2659_set_fmt()
1129 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); ov2659_set_fmt()
1178 static int ov2659_s_stream(struct v4l2_subdev *sd, int on) ov2659_s_stream() argument
1180 struct i2c_client *client = v4l2_get_subdevdata(sd); ov2659_s_stream()
1181 struct ov2659 *ov2659 = to_ov2659(sd); ov2659_s_stream()
1213 struct i2c_client *client = v4l2_get_subdevdata(&ov2659->sd); ov2659_set_test_pattern()
1260 static int ov2659_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) ov2659_open() argument
1262 struct i2c_client *client = v4l2_get_subdevdata(sd); ov2659_open()
1264 v4l2_subdev_get_try_format(sd, fh->pad, 0); ov2659_open()
1300 static int ov2659_detect(struct v4l2_subdev *sd) ov2659_detect() argument
1302 struct i2c_client *client = v4l2_get_subdevdata(sd); ov2659_detect()
1315 ret = ov2659_init(sd, 0); ov2659_detect()
1373 struct v4l2_subdev *sd; ov2659_probe() local
1410 ov2659->sd.ctrl_handler = &ov2659->ctrls; ov2659_probe()
1418 sd = &ov2659->sd; ov2659_probe()
1420 v4l2_i2c_subdev_init(sd, client, &ov2659_subdev_ops); ov2659_probe()
1422 sd->internal_ops = &ov2659_subdev_internal_ops; ov2659_probe()
1423 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | ov2659_probe()
1428 sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; ov2659_probe()
1429 ret = media_entity_init(&sd->entity, 1, &ov2659->pad, 0); ov2659_probe()
1442 ret = ov2659_detect(sd); ov2659_probe()
1449 ret = v4l2_async_register_subdev(&ov2659->sd); ov2659_probe()
1453 dev_info(&client->dev, "%s sensor driver registered !!\n", sd->name); ov2659_probe()
1460 media_entity_cleanup(&sd->entity); ov2659_probe()
1468 struct v4l2_subdev *sd = i2c_get_clientdata(client); ov2659_remove() local
1469 struct ov2659 *ov2659 = to_ov2659(sd); ov2659_remove()
1472 v4l2_async_unregister_subdev(sd); ov2659_remove()
1474 media_entity_cleanup(&sd->entity); ov2659_remove()
H A Dov9650.c248 struct v4l2_subdev sd; member in struct:ov965x
415 return &container_of(ctrl->handler, struct ov965x, ctrls.handler)->sd; ctrl_to_sd()
418 static inline struct ov965x *to_ov965x(struct v4l2_subdev *sd) to_ov965x() argument
420 return container_of(sd, struct ov965x, sd); to_ov965x()
533 static int ov965x_s_power(struct v4l2_subdev *sd, int on) ov965x_s_power() argument
535 struct ov965x *ov965x = to_ov965x(sd); ov965x_s_power()
585 v4l2_dbg(1, debug, &ov965x->sd, "clkrc: %#x, fi: %lu, tr: %lu, %d\n", ov965x_update_exposure_ctrl()
594 v4l2_err(&ov965x->sd, "Exposure ctrl range update failed\n"); ov965x_update_exposure_ctrl()
904 struct v4l2_subdev *sd = ctrl_to_sd(ctrl); ov965x_g_volatile_ctrl() local
905 struct ov965x *ov965x = to_ov965x(sd); ov965x_g_volatile_ctrl()
908 v4l2_dbg(1, debug, sd, "g_ctrl: %s\n", ctrl->name); ov965x_g_volatile_ctrl()
918 struct v4l2_subdev *sd = ctrl_to_sd(ctrl); ov965x_s_ctrl() local
919 struct ov965x *ov965x = to_ov965x(sd); ov965x_s_ctrl()
922 v4l2_dbg(1, debug, sd, "s_ctrl: %s, value: %d. power: %d\n", ov965x_s_ctrl()
1053 ov965x->sd.ctrl_handler = hdl; ov965x_initialize_controls()
1069 static int ov965x_enum_mbus_code(struct v4l2_subdev *sd, ov965x_enum_mbus_code() argument
1080 static int ov965x_enum_frame_sizes(struct v4l2_subdev *sd, ov965x_enum_frame_sizes() argument
1103 static int ov965x_g_frame_interval(struct v4l2_subdev *sd, ov965x_g_frame_interval() argument
1106 struct ov965x *ov965x = to_ov965x(sd); ov965x_g_frame_interval()
1145 v4l2_dbg(1, debug, &ov965x->sd, "Changed frame interval to %u us\n", __ov965x_set_frame_interval()
1151 static int ov965x_s_frame_interval(struct v4l2_subdev *sd, ov965x_s_frame_interval() argument
1154 struct ov965x *ov965x = to_ov965x(sd); ov965x_s_frame_interval()
1157 v4l2_dbg(1, debug, sd, "Setting %d/%d frame interval\n", ov965x_s_frame_interval()
1167 static int ov965x_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, ov965x_get_fmt() argument
1170 struct ov965x *ov965x = to_ov965x(sd); ov965x_get_fmt()
1174 mf = v4l2_subdev_get_try_format(sd, cfg, 0); ov965x_get_fmt()
1211 static int ov965x_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, ov965x_set_fmt() argument
1216 struct ov965x *ov965x = to_ov965x(sd); ov965x_set_fmt()
1234 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); ov965x_set_fmt()
1320 static int ov965x_s_stream(struct v4l2_subdev *sd, int on) ov965x_s_stream() argument
1322 struct i2c_client *client = v4l2_get_subdevdata(sd); ov965x_s_stream()
1323 struct ov965x *ov965x = to_ov965x(sd); ov965x_s_stream()
1362 static int ov965x_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) ov965x_open() argument
1364 struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(sd, fh->pad, 0); ov965x_open()
1421 v4l2_dbg(1, debug, &ov965x->sd, "set gpio %d to 1\n", gpio); ov965x_configure_gpios()
1431 static int ov965x_detect_sensor(struct v4l2_subdev *sd) ov965x_detect_sensor() argument
1433 struct i2c_client *client = v4l2_get_subdevdata(sd); ov965x_detect_sensor()
1434 struct ov965x *ov965x = to_ov965x(sd); ov965x_detect_sensor()
1452 v4l2_info(sd, "Found OV%04X sensor\n", ov965x->id); ov965x_detect_sensor()
1454 v4l2_err(sd, "Sensor detection failed (%04X, %d)\n", ov965x_detect_sensor()
1468 struct v4l2_subdev *sd; ov965x_probe() local
1490 sd = &ov965x->sd; ov965x_probe()
1491 v4l2_i2c_subdev_init(sd, client, &ov965x_subdev_ops); ov965x_probe()
1492 strlcpy(sd->name, DRIVER_NAME, sizeof(sd->name)); ov965x_probe()
1494 sd->internal_ops = &ov965x_sd_internal_ops; ov965x_probe()
1495 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | ov965x_probe()
1503 sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; ov965x_probe()
1504 ret = media_entity_init(&sd->entity, 1, &ov965x->pad, 0); ov965x_probe()
1516 ret = ov965x_detect_sensor(sd); ov965x_probe()
1525 v4l2_ctrl_handler_free(sd->ctrl_handler); ov965x_probe()
1527 media_entity_cleanup(&sd->entity); ov965x_probe()
1533 struct v4l2_subdev *sd = i2c_get_clientdata(client); ov965x_remove() local
1535 v4l2_device_unregister_subdev(sd); ov965x_remove()
1536 v4l2_ctrl_handler_free(sd->ctrl_handler); ov965x_remove()
1537 media_entity_cleanup(&sd->entity); ov965x_remove()
/linux-4.1.27/drivers/media/usb/gspca/
H A Dcpia1.c225 #define FIRMWARE_VERSION(x, y) (sd->params.version.firmwareVersion == (x) && \
226 sd->params.version.firmwareRevision == (y))
364 struct sd { struct
451 struct sd *sd = (struct sd *) gspca_dev; do_command() local
489 sd->params.version.firmwareVersion = gspca_dev->usb_buf[0]; do_command()
490 sd->params.version.firmwareRevision = gspca_dev->usb_buf[1]; do_command()
491 sd->params.version.vcVersion = gspca_dev->usb_buf[2]; do_command()
492 sd->params.version.vcRevision = gspca_dev->usb_buf[3]; do_command()
495 sd->params.pnpID.vendor = do_command()
497 sd->params.pnpID.product = do_command()
499 sd->params.pnpID.deviceRevision = do_command()
503 sd->params.status.systemState = gspca_dev->usb_buf[0]; do_command()
504 sd->params.status.grabState = gspca_dev->usb_buf[1]; do_command()
505 sd->params.status.streamState = gspca_dev->usb_buf[2]; do_command()
506 sd->params.status.fatalError = gspca_dev->usb_buf[3]; do_command()
507 sd->params.status.cmdError = gspca_dev->usb_buf[4]; do_command()
508 sd->params.status.debugFlags = gspca_dev->usb_buf[5]; do_command()
509 sd->params.status.vpStatus = gspca_dev->usb_buf[6]; do_command()
510 sd->params.status.errorCode = gspca_dev->usb_buf[7]; do_command()
513 sd->params.vpVersion.vpVersion = gspca_dev->usb_buf[0]; do_command()
514 sd->params.vpVersion.vpRevision = gspca_dev->usb_buf[1]; do_command()
515 sd->params.vpVersion.cameraHeadID = do_command()
519 sd->params.colourParams.brightness = gspca_dev->usb_buf[0]; do_command()
520 sd->params.colourParams.contrast = gspca_dev->usb_buf[1]; do_command()
521 sd->params.colourParams.saturation = gspca_dev->usb_buf[2]; do_command()
524 sd->params.colourBalance.redGain = gspca_dev->usb_buf[0]; do_command()
525 sd->params.colourBalance.greenGain = gspca_dev->usb_buf[1]; do_command()
526 sd->params.colourBalance.blueGain = gspca_dev->usb_buf[2]; do_command()
529 sd->params.exposure.gain = gspca_dev->usb_buf[0]; do_command()
530 sd->params.exposure.fineExp = gspca_dev->usb_buf[1]; do_command()
531 sd->params.exposure.coarseExpLo = gspca_dev->usb_buf[2]; do_command()
532 sd->params.exposure.coarseExpHi = gspca_dev->usb_buf[3]; do_command()
533 sd->params.exposure.redComp = gspca_dev->usb_buf[4]; do_command()
534 sd->params.exposure.green1Comp = gspca_dev->usb_buf[5]; do_command()
535 sd->params.exposure.green2Comp = gspca_dev->usb_buf[6]; do_command()
536 sd->params.exposure.blueComp = gspca_dev->usb_buf[7]; do_command()
542 if (a != sd->params.qx3.button) { do_command()
547 sd->params.qx3.button = a; do_command()
549 if (sd->params.qx3.button) { do_command()
558 sd->params.qx3.cradled = ((gspca_dev->usb_buf[2] & 0x40) == 0); do_command()
626 struct sd *sd = (struct sd *) gspca_dev; reset_camera_params() local
627 struct cam_params *params = &sd->params; reset_camera_params()
677 flicker_jumps[sd->mainsFreq] reset_camera_params()
714 struct sd *sd = (struct sd *) gspca_dev; goto_low_power() local
725 if (sd->params.status.systemState != LO_POWER_STATE) { goto_low_power()
726 if (sd->params.status.systemState != WARM_BOOT_STATE) { goto_low_power()
728 sd->params.status.systemState); goto_low_power()
729 printstatus(gspca_dev, &sd->params); goto_low_power()
740 struct sd *sd = (struct sd *) gspca_dev; goto_high_power() local
756 if (sd->params.status.systemState != HI_POWER_STATE) { goto_high_power()
758 sd->params.status.systemState); goto_high_power()
759 printstatus(gspca_dev, &sd->params); goto_high_power()
793 struct sd *sd = (struct sd *) gspca_dev; command_setformat() local
797 sd->params.format.videoSize, command_setformat()
798 sd->params.format.subSample, command_setformat()
799 sd->params.format.yuvOrder, 0); command_setformat()
804 sd->params.roi.colStart, sd->params.roi.colEnd, command_setformat()
805 sd->params.roi.rowStart, sd->params.roi.rowEnd); command_setformat()
810 struct sd *sd = (struct sd *) gspca_dev; command_setcolourparams() local
812 sd->params.colourParams.brightness, command_setcolourparams()
813 sd->params.colourParams.contrast, command_setcolourparams()
814 sd->params.colourParams.saturation, 0); command_setcolourparams()
819 struct sd *sd = (struct sd *) gspca_dev; command_setapcor() local
821 sd->params.apcor.gain1, command_setapcor()
822 sd->params.apcor.gain2, command_setapcor()
823 sd->params.apcor.gain4, command_setapcor()
824 sd->params.apcor.gain8); command_setapcor()
829 struct sd *sd = (struct sd *) gspca_dev; command_setvloffset() local
831 sd->params.vlOffset.gain1, command_setvloffset()
832 sd->params.vlOffset.gain2, command_setvloffset()
833 sd->params.vlOffset.gain4, command_setvloffset()
834 sd->params.vlOffset.gain8); command_setvloffset()
839 struct sd *sd = (struct sd *) gspca_dev; command_setexposure() local
843 sd->params.exposure.gainMode, command_setexposure()
845 sd->params.exposure.compMode, command_setexposure()
846 sd->params.exposure.centreWeight, command_setexposure()
847 sd->params.exposure.gain, command_setexposure()
848 sd->params.exposure.fineExp, command_setexposure()
849 sd->params.exposure.coarseExpLo, command_setexposure()
850 sd->params.exposure.coarseExpHi, command_setexposure()
851 sd->params.exposure.redComp, command_setexposure()
852 sd->params.exposure.green1Comp, command_setexposure()
853 sd->params.exposure.green2Comp, command_setexposure()
854 sd->params.exposure.blueComp); command_setexposure()
858 if (sd->params.exposure.expMode != 1) { command_setexposure()
861 sd->params.exposure.expMode, command_setexposure()
863 sd->params.exposure.gain, command_setexposure()
864 sd->params.exposure.fineExp, command_setexposure()
865 sd->params.exposure.coarseExpLo, command_setexposure()
866 sd->params.exposure.coarseExpHi, command_setexposure()
875 struct sd *sd = (struct sd *) gspca_dev; command_setcolourbalance() local
877 if (sd->params.colourBalance.balanceMode == 1) { command_setcolourbalance()
882 sd->params.colourBalance.redGain, command_setcolourbalance()
883 sd->params.colourBalance.greenGain, command_setcolourbalance()
884 sd->params.colourBalance.blueGain); command_setcolourbalance()
891 if (sd->params.colourBalance.balanceMode == 2) { command_setcolourbalance()
895 if (sd->params.colourBalance.balanceMode == 3) { command_setcolourbalance()
905 struct sd *sd = (struct sd *) gspca_dev; command_setcompressiontarget() local
908 sd->params.compressionTarget.frTargeting, command_setcompressiontarget()
909 sd->params.compressionTarget.targetFR, command_setcompressiontarget()
910 sd->params.compressionTarget.targetQ, 0); command_setcompressiontarget()
915 struct sd *sd = (struct sd *) gspca_dev; command_setyuvtresh() local
918 sd->params.yuvThreshold.yThreshold, command_setyuvtresh()
919 sd->params.yuvThreshold.uvThreshold, 0, 0); command_setyuvtresh()
924 struct sd *sd = (struct sd *) gspca_dev; command_setcompressionparams() local
929 sd->params.compressionParams.hysteresis, command_setcompressionparams()
930 sd->params.compressionParams.threshMax, command_setcompressionparams()
931 sd->params.compressionParams.smallStep, command_setcompressionparams()
932 sd->params.compressionParams.largeStep, command_setcompressionparams()
933 sd->params.compressionParams.decimationHysteresis, command_setcompressionparams()
934 sd->params.compressionParams.frDiffStepThresh, command_setcompressionparams()
935 sd->params.compressionParams.qDiffStepThresh, command_setcompressionparams()
936 sd->params.compressionParams.decimationThreshMod); command_setcompressionparams()
941 struct sd *sd = (struct sd *) gspca_dev; command_setcompression() local
944 sd->params.compression.mode, command_setcompression()
945 sd->params.compression.decimation, 0, 0); command_setcompression()
950 struct sd *sd = (struct sd *) gspca_dev; command_setsensorfps() local
953 sd->params.sensorFps.divisor, command_setsensorfps()
954 sd->params.sensorFps.baserate, 0, 0); command_setsensorfps()
959 struct sd *sd = (struct sd *) gspca_dev; command_setflickerctrl() local
962 sd->params.flickerControl.flickerMode, command_setflickerctrl()
963 sd->params.flickerControl.coarseJump, command_setflickerctrl()
964 sd->params.flickerControl.allowableOverExposure, command_setflickerctrl()
970 struct sd *sd = (struct sd *) gspca_dev; command_setecptiming() local
973 sd->params.ecpTiming, 0, 0, 0); command_setecptiming()
983 struct sd *sd = (struct sd *) gspca_dev; command_resume() local
986 0, sd->params.streamStartLine, 0, 0); command_resume()
991 struct sd *sd = (struct sd *) gspca_dev; command_setlights() local
994 p1 = (sd->params.qx3.bottomlight == 0) << 1; command_setlights()
995 p2 = (sd->params.qx3.toplight == 0) << 3; command_setlights()
1024 struct sd *sd = (struct sd *) gspca_dev; set_flicker() local
1025 int currentexp = sd->params.exposure.coarseExpLo + set_flicker()
1026 sd->params.exposure.coarseExpHi * 256; set_flicker()
1030 int cj = sd->params.flickerControl.coarseJump; set_flicker()
1031 sd->params.flickerControl.flickerMode = 1; set_flicker()
1032 sd->params.flickerControl.disabled = 0; set_flicker()
1033 if (sd->params.exposure.expMode != 2) { set_flicker()
1034 sd->params.exposure.expMode = 2; set_flicker()
1035 sd->exposure_status = EXPOSURE_NORMAL; set_flicker()
1037 currentexp = currentexp << sd->params.exposure.gain; set_flicker()
1038 sd->params.exposure.gain = 0; set_flicker()
1050 sd->params.exposure.coarseExpLo = startexp & 0xff; set_flicker()
1051 sd->params.exposure.coarseExpHi = startexp >> 8; set_flicker()
1055 sd->params.exposure.redComp = set_flicker()
1057 sd->params.exposure.green1Comp = set_flicker()
1059 sd->params.exposure.green2Comp = set_flicker()
1061 sd->params.exposure.blueComp = set_flicker()
1064 sd->params.exposure.redComp = COMP_RED; set_flicker()
1065 sd->params.exposure.green1Comp = COMP_GREEN1; set_flicker()
1066 sd->params.exposure.green2Comp = COMP_GREEN2; set_flicker()
1067 sd->params.exposure.blueComp = COMP_BLUE; set_flicker()
1070 sd->params.exposure.compMode = 0; set_flicker()
1072 sd->params.exposure.compMode = 1; set_flicker()
1074 sd->params.apcor.gain1 = 0x18; set_flicker()
1075 sd->params.apcor.gain2 = 0x18; set_flicker()
1076 sd->params.apcor.gain4 = 0x16; set_flicker()
1077 sd->params.apcor.gain8 = 0x14; set_flicker()
1079 sd->params.flickerControl.flickerMode = 0; set_flicker()
1080 sd->params.flickerControl.disabled = 1; set_flicker()
1083 sd->params.exposure.redComp, currentexp); set_flicker()
1085 sd->params.exposure.green1Comp, currentexp); set_flicker()
1087 sd->params.exposure.green2Comp, currentexp); set_flicker()
1089 sd->params.exposure.blueComp, currentexp); set_flicker()
1091 while (startexp > MAX_EXP && sd->params.exposure.gain < set_flicker()
1092 sd->params.exposure.gainMode - 1) { set_flicker()
1094 ++sd->params.exposure.gain; set_flicker()
1100 sd->params.exposure.coarseExpLo = startexp & 0xff; set_flicker()
1101 sd->params.exposure.coarseExpHi = startexp >> 8; set_flicker()
1102 sd->params.exposure.redComp = COMP_RED; set_flicker()
1103 sd->params.exposure.green1Comp = COMP_GREEN1; set_flicker()
1104 sd->params.exposure.green2Comp = COMP_GREEN2; set_flicker()
1105 sd->params.exposure.blueComp = COMP_BLUE; set_flicker()
1106 sd->params.exposure.compMode = 1; set_flicker()
1107 sd->params.apcor.gain1 = 0x18; set_flicker()
1108 sd->params.apcor.gain2 = 0x16; set_flicker()
1109 sd->params.apcor.gain4 = 0x24; set_flicker()
1110 sd->params.apcor.gain8 = 0x34; set_flicker()
1112 sd->params.vlOffset.gain1 = 20; set_flicker()
1113 sd->params.vlOffset.gain2 = 24; set_flicker()
1114 sd->params.vlOffset.gain4 = 26; set_flicker()
1115 sd->params.vlOffset.gain8 = 26; set_flicker()
1143 struct sd *sd = (struct sd *) gspca_dev; monitor_exposure() local
1167 light_exp = sd->params.colourParams.brightness + monitor_exposure()
1171 dark_exp = sd->params.colourParams.brightness + monitor_exposure()
1177 old_exposure = sd->params.exposure.coarseExpHi * 256 + monitor_exposure()
1178 sd->params.exposure.coarseExpLo; monitor_exposure()
1180 if (!sd->params.flickerControl.disabled) { monitor_exposure()
1189 if (sd->exposure_status == EXPOSURE_VERY_DARK) monitor_exposure()
1190 ++sd->exposure_count; monitor_exposure()
1192 sd->exposure_status = monitor_exposure()
1194 sd->exposure_count = 1; monitor_exposure()
1198 if (sd->exposure_status == EXPOSURE_DARK) monitor_exposure()
1199 ++sd->exposure_count; monitor_exposure()
1201 sd->exposure_status = EXPOSURE_DARK; monitor_exposure()
1202 sd->exposure_count = 1; monitor_exposure()
1209 if (sd->exposure_status == EXPOSURE_VERY_LIGHT) monitor_exposure()
1210 ++sd->exposure_count; monitor_exposure()
1212 sd->exposure_status = monitor_exposure()
1214 sd->exposure_count = 1; monitor_exposure()
1218 if (sd->exposure_status == EXPOSURE_LIGHT) monitor_exposure()
1219 ++sd->exposure_count; monitor_exposure()
1221 sd->exposure_status = EXPOSURE_LIGHT; monitor_exposure()
1222 sd->exposure_count = 1; monitor_exposure()
1227 sd->exposure_status = EXPOSURE_NORMAL; monitor_exposure()
1235 if (sd->exposure_status == EXPOSURE_VERY_DARK) monitor_exposure()
1236 ++sd->exposure_count; monitor_exposure()
1238 sd->exposure_status = monitor_exposure()
1240 sd->exposure_count = 1; monitor_exposure()
1244 if (sd->exposure_status == EXPOSURE_DARK) monitor_exposure()
1245 ++sd->exposure_count; monitor_exposure()
1247 sd->exposure_status = EXPOSURE_DARK; monitor_exposure()
1248 sd->exposure_count = 1; monitor_exposure()
1255 if (sd->exposure_status == EXPOSURE_VERY_LIGHT) monitor_exposure()
1256 ++sd->exposure_count; monitor_exposure()
1258 sd->exposure_status = monitor_exposure()
1260 sd->exposure_count = 1; monitor_exposure()
1264 if (sd->exposure_status == EXPOSURE_LIGHT) monitor_exposure()
1265 ++sd->exposure_count; monitor_exposure()
1267 sd->exposure_status = EXPOSURE_LIGHT; monitor_exposure()
1268 sd->exposure_count = 1; monitor_exposure()
1273 sd->exposure_status = EXPOSURE_NORMAL; monitor_exposure()
1277 framerate = atomic_read(&sd->fps); monitor_exposure()
1281 if (!sd->params.flickerControl.disabled) { monitor_exposure()
1283 if ((sd->exposure_status == EXPOSURE_VERY_DARK || monitor_exposure()
1284 sd->exposure_status == EXPOSURE_DARK) && monitor_exposure()
1285 sd->exposure_count >= DARK_TIME * framerate && monitor_exposure()
1286 sd->params.sensorFps.divisor < 2) { monitor_exposure()
1289 ++sd->params.sensorFps.divisor; monitor_exposure()
1292 sd->params.flickerControl.coarseJump = monitor_exposure()
1293 flicker_jumps[sd->mainsFreq] monitor_exposure()
1294 [sd->params.sensorFps.baserate] monitor_exposure()
1295 [sd->params.sensorFps.divisor]; monitor_exposure()
1298 new_exposure = sd->params.flickerControl.coarseJump-1; monitor_exposure()
1301 sd->params.flickerControl.coarseJump; monitor_exposure()
1302 sd->params.exposure.coarseExpLo = new_exposure & 0xff; monitor_exposure()
1303 sd->params.exposure.coarseExpHi = new_exposure >> 8; monitor_exposure()
1305 sd->exposure_status = EXPOSURE_NORMAL; monitor_exposure()
1308 } else if ((sd->exposure_status == EXPOSURE_VERY_LIGHT || monitor_exposure()
1309 sd->exposure_status == EXPOSURE_LIGHT) && monitor_exposure()
1310 sd->exposure_count >= LIGHT_TIME * framerate && monitor_exposure()
1311 sd->params.sensorFps.divisor > 0) { monitor_exposure()
1316 --sd->params.sensorFps.divisor; monitor_exposure()
1319 sd->params.flickerControl.coarseJump = monitor_exposure()
1320 flicker_jumps[sd->mainsFreq] monitor_exposure()
1321 [sd->params.sensorFps.baserate] monitor_exposure()
1322 [sd->params.sensorFps.divisor]; monitor_exposure()
1325 new_exposure = sd->params.flickerControl.coarseJump-1; monitor_exposure()
1328 sd->params.flickerControl.coarseJump < max_exp) monitor_exposure()
1330 sd->params.flickerControl.coarseJump; monitor_exposure()
1331 sd->params.exposure.coarseExpLo = new_exposure & 0xff; monitor_exposure()
1332 sd->params.exposure.coarseExpHi = new_exposure >> 8; monitor_exposure()
1334 sd->exposure_status = EXPOSURE_NORMAL; monitor_exposure()
1339 if ((sd->exposure_status == EXPOSURE_VERY_DARK || monitor_exposure()
1340 sd->exposure_status == EXPOSURE_DARK) && monitor_exposure()
1341 sd->exposure_count >= DARK_TIME * framerate && monitor_exposure()
1342 sd->params.sensorFps.divisor < 2) { monitor_exposure()
1345 ++sd->params.sensorFps.divisor; monitor_exposure()
1348 if (sd->params.exposure.gain > 0) { monitor_exposure()
1349 --sd->params.exposure.gain; monitor_exposure()
1352 sd->exposure_status = EXPOSURE_NORMAL; monitor_exposure()
1355 } else if ((sd->exposure_status == EXPOSURE_VERY_LIGHT || monitor_exposure()
1356 sd->exposure_status == EXPOSURE_LIGHT) && monitor_exposure()
1357 sd->exposure_count >= LIGHT_TIME * framerate && monitor_exposure()
1358 sd->params.sensorFps.divisor > 0) { monitor_exposure()
1361 --sd->params.sensorFps.divisor; monitor_exposure()
1364 if (sd->params.exposure.gain < monitor_exposure()
1365 sd->params.exposure.gainMode - 1) { monitor_exposure()
1366 ++sd->params.exposure.gain; monitor_exposure()
1369 sd->exposure_status = EXPOSURE_NORMAL; monitor_exposure()
1394 struct sd *sd = (struct sd *) gspca_dev; restart_flicker() local
1400 cam_exposure = atomic_read(&sd->cam_exposure); restart_flicker()
1402 if (sd->params.flickerControl.flickerMode == 0 || restart_flicker()
1406 old_exp = sd->params.exposure.coarseExpLo + restart_flicker()
1407 sd->params.exposure.coarseExpHi*256; restart_flicker()
1412 cam_exposure %= sd->params.flickerControl.coarseJump; restart_flicker()
1413 if (!sd->params.flickerControl.disabled && restart_flicker()
1414 cam_exposure <= sd->params.flickerControl.coarseJump - 3) { restart_flicker()
1416 sd->params.flickerControl.disabled = 1; restart_flicker()
1419 if (sd->params.flickerControl.disabled && restart_flicker()
1420 old_exp > sd->params.flickerControl.coarseJump + restart_flicker()
1432 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
1435 sd->mainsFreq = FREQ_DEF == V4L2_CID_POWER_LINE_FREQUENCY_60HZ; sd_config()
1447 sd->params.version.firmwareVersion = 0; sd_config()
1449 if (sd->params.version.firmwareVersion != 1) { sd_config()
1451 sd->params.version.firmwareVersion); sd_config()
1456 if (sd->params.version.firmwareRevision <= 2 && sd_config()
1457 sd->params.exposure.gainMode > 2) { sd_config()
1458 sd->params.exposure.gainMode = 2; sd_config()
1462 sd->params.qx3.qx3_detected = (sd->params.pnpID.vendor == 0x0813 && sd_config()
1463 sd->params.pnpID.product == 0x0001); sd_config()
1470 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
1475 if (sd->params.status.systemState != WARM_BOOT_STATE) { sd_start()
1477 sd->params.status.systemState); sd_start()
1478 printstatus(gspca_dev, &sd->params); sd_start()
1500 sd->params.version.firmwareVersion = 0; sd_start()
1523 if (sd->params.status.fatalError) { sd_start()
1525 sd->params.status.fatalError, sd->params.status.vpStatus); sd_start()
1536 sd->params.streamStartLine = 120; sd_start()
1540 sd->params.roi.colStart = 2; sd_start()
1541 sd->params.roi.rowStart = 6; sd_start()
1543 sd->params.roi.colStart = 0; sd_start()
1544 sd->params.roi.rowStart = 0; sd_start()
1548 sd->params.format.videoSize = VIDEOSIZE_QCIF; sd_start()
1549 sd->params.roi.colStart /= 2; sd_start()
1550 sd->params.roi.rowStart /= 2; sd_start()
1551 sd->params.streamStartLine /= 2; sd_start()
1553 sd->params.format.videoSize = VIDEOSIZE_CIF; sd_start()
1555 sd->params.roi.colEnd = sd->params.roi.colStart + sd_start()
1557 sd->params.roi.rowEnd = sd->params.roi.rowStart + sd_start()
1616 sd->first_frame = 6; sd_start()
1617 sd->exposure_status = EXPOSURE_NORMAL; sd_start()
1618 sd->exposure_count = 0; sd_start()
1619 atomic_set(&sd->cam_exposure, 0); sd_start()
1620 atomic_set(&sd->fps, 0); sd_start()
1627 struct sd *sd = (struct sd *) gspca_dev; sd_stopN() local
1642 if (sd->params.qx3.button) { sd_stopN()
1644 the latch, so we do not reset sd->params.qx3.button now, to sd_stopN()
1655 struct sd *sd = (struct sd *) gspca_dev; sd_init() local
1667 if (sd->params.qx3.qx3_detected) sd_init()
1673 sd->params.version.firmwareVersion, sd_init()
1674 sd->params.version.firmwareRevision, sd_init()
1675 sd->params.version.vcVersion, sd_init()
1676 sd->params.version.vcRevision); sd_init()
1678 sd->params.pnpID.vendor, sd->params.pnpID.product, sd_init()
1679 sd->params.pnpID.deviceRevision); sd_init()
1681 sd->params.vpVersion.vpVersion, sd_init()
1682 sd->params.vpVersion.vpRevision, sd_init()
1683 sd->params.vpVersion.cameraHeadID); sd_init()
1692 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
1697 data[16] == sd->params.format.videoSize && sd_pkt_scan()
1698 data[17] == sd->params.format.subSample && sd_pkt_scan()
1699 data[18] == sd->params.format.yuvOrder && sd_pkt_scan()
1700 data[24] == sd->params.roi.colStart && sd_pkt_scan()
1701 data[25] == sd->params.roi.colEnd && sd_pkt_scan()
1702 data[26] == sd->params.roi.rowStart && sd_pkt_scan()
1703 data[27] == sd->params.roi.rowEnd) { sd_pkt_scan()
1706 atomic_set(&sd->cam_exposure, data[39] * 2); sd_pkt_scan()
1707 atomic_set(&sd->fps, data[41]); sd_pkt_scan()
1729 struct sd *sd = (struct sd *) gspca_dev; sd_dq_callback() local
1733 if (sd->first_frame) { sd_dq_callback()
1734 sd->first_frame--; sd_dq_callback()
1735 if (sd->first_frame == 0) sd_dq_callback()
1744 if (sd->params.exposure.expMode == 2) sd_dq_callback()
1756 struct sd *sd = (struct sd *)gspca_dev; sd_s_ctrl() local
1765 sd->params.colourParams.brightness = ctrl->val; sd_s_ctrl()
1766 sd->params.flickerControl.allowableOverExposure = sd_s_ctrl()
1767 find_over_exposure(sd->params.colourParams.brightness); sd_s_ctrl()
1773 sd->params.colourParams.contrast = ctrl->val; sd_s_ctrl()
1777 sd->params.colourParams.saturation = ctrl->val; sd_s_ctrl()
1781 sd->mainsFreq = ctrl->val == V4L2_CID_POWER_LINE_FREQUENCY_60HZ; sd_s_ctrl()
1782 sd->params.flickerControl.coarseJump = sd_s_ctrl()
1783 flicker_jumps[sd->mainsFreq] sd_s_ctrl()
1784 [sd->params.sensorFps.baserate] sd_s_ctrl()
1785 [sd->params.sensorFps.divisor]; sd_s_ctrl()
1792 sd->params.qx3.bottomlight = ctrl->val; sd_s_ctrl()
1796 sd->params.qx3.toplight = ctrl->val; sd_s_ctrl()
1800 sd->params.compressionTarget.frTargeting = ctrl->val; sd_s_ctrl()
1813 struct sd *sd = (struct sd *)gspca_dev; sd_init_controls() local
1838 sd->freq = v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops, sd_init_controls()
1842 if (sd->params.qx3.qx3_detected) { sd_init_controls()
1886 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dw996Xcf.c38 #define Y_QUANTABLE (&sd->jpeg_hdr[JPEG_QT0_OFFSET])
39 #define UV_QUANTABLE (&sd->jpeg_hdr[JPEG_QT1_OFFSET])
64 static void reg_w(struct sd *sd, u16 index, u16 value);
70 static void w9968cf_write_fsb(struct sd *sd, u16* data) w9968cf_write_fsb() argument
72 struct usb_device *udev = sd->gspca_dev.dev; w9968cf_write_fsb()
76 if (sd->gspca_dev.usb_err < 0) w9968cf_write_fsb()
80 memcpy(sd->gspca_dev.usb_buf, data, 6); w9968cf_write_fsb()
84 value, 0x06, sd->gspca_dev.usb_buf, 6, 500); w9968cf_write_fsb()
87 sd->gspca_dev.usb_err = ret; w9968cf_write_fsb()
95 static void w9968cf_write_sb(struct sd *sd, u16 value) w9968cf_write_sb() argument
99 if (sd->gspca_dev.usb_err < 0) w9968cf_write_sb()
104 ret = usb_control_msg(sd->gspca_dev.dev, w9968cf_write_sb()
105 usb_sndctrlpipe(sd->gspca_dev.dev, 0), w9968cf_write_sb()
114 sd->gspca_dev.usb_err = ret; w9968cf_write_sb()
122 static int w9968cf_read_sb(struct sd *sd) w9968cf_read_sb() argument
126 if (sd->gspca_dev.usb_err < 0) w9968cf_read_sb()
131 ret = usb_control_msg(sd->gspca_dev.dev, w9968cf_read_sb()
132 usb_rcvctrlpipe(sd->gspca_dev.dev, 0), w9968cf_read_sb()
135 0, 0x01, sd->gspca_dev.usb_buf, 2, 500); w9968cf_read_sb()
137 ret = sd->gspca_dev.usb_buf[0] | w9968cf_read_sb()
138 (sd->gspca_dev.usb_buf[1] << 8); w9968cf_read_sb()
141 sd->gspca_dev.usb_err = ret; w9968cf_read_sb()
154 static void w9968cf_upload_quantizationtables(struct sd *sd) w9968cf_upload_quantizationtables() argument
159 reg_w(sd, 0x39, 0x0010); /* JPEG clock enable */ w9968cf_upload_quantizationtables()
164 reg_w(sd, 0x40 + i, a); w9968cf_upload_quantizationtables()
165 reg_w(sd, 0x60 + i, b); w9968cf_upload_quantizationtables()
167 reg_w(sd, 0x39, 0x0012); /* JPEG encoder enable */ w9968cf_upload_quantizationtables()
178 static void w9968cf_smbus_start(struct sd *sd) w9968cf_smbus_start() argument
180 w9968cf_write_sb(sd, 0x0011); /* SDE=1, SDA=0, SCL=1 */ w9968cf_smbus_start()
181 w9968cf_write_sb(sd, 0x0010); /* SDE=1, SDA=0, SCL=0 */ w9968cf_smbus_start()
184 static void w9968cf_smbus_stop(struct sd *sd) w9968cf_smbus_stop() argument
186 w9968cf_write_sb(sd, 0x0010); /* SDE=1, SDA=0, SCL=0 */ w9968cf_smbus_stop()
187 w9968cf_write_sb(sd, 0x0011); /* SDE=1, SDA=0, SCL=1 */ w9968cf_smbus_stop()
188 w9968cf_write_sb(sd, 0x0013); /* SDE=1, SDA=1, SCL=1 */ w9968cf_smbus_stop()
191 static void w9968cf_smbus_write_byte(struct sd *sd, u8 v) w9968cf_smbus_write_byte() argument
200 w9968cf_write_sb(sd, 0x10 | sda); w9968cf_smbus_write_byte()
202 w9968cf_write_sb(sd, 0x11 | sda); w9968cf_smbus_write_byte()
204 w9968cf_write_sb(sd, 0x10 | sda); w9968cf_smbus_write_byte()
208 static void w9968cf_smbus_read_byte(struct sd *sd, u8 *v) w9968cf_smbus_read_byte() argument
218 w9968cf_write_sb(sd, 0x0013); w9968cf_smbus_read_byte()
219 *v |= (w9968cf_read_sb(sd) & 0x0008) ? 1 : 0; w9968cf_smbus_read_byte()
221 w9968cf_write_sb(sd, 0x0012); w9968cf_smbus_read_byte()
225 static void w9968cf_smbus_write_nack(struct sd *sd) w9968cf_smbus_write_nack() argument
229 w9968cf_write_sb(sd, 0x0013); /* SDE=1, SDA=1, SCL=1 */ w9968cf_smbus_write_nack()
230 w9968cf_write_sb(sd, 0x0012); /* SDE=1, SDA=1, SCL=0 */ w9968cf_smbus_write_nack()
233 static void w9968cf_smbus_read_ack(struct sd *sd) w9968cf_smbus_read_ack() argument
235 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; w9968cf_smbus_read_ack()
239 w9968cf_write_sb(sd, 0x0012); /* SDE=1, SDA=1, SCL=0 */ w9968cf_smbus_read_ack()
240 w9968cf_write_sb(sd, 0x0013); /* SDE=1, SDA=1, SCL=1 */ w9968cf_smbus_read_ack()
241 sda = w9968cf_read_sb(sd); w9968cf_smbus_read_ack()
242 w9968cf_write_sb(sd, 0x0012); /* SDE=1, SDA=1, SCL=0 */ w9968cf_smbus_read_ack()
245 sd->gspca_dev.usb_err = -EIO; w9968cf_smbus_read_ack()
250 static void w9968cf_i2c_w(struct sd *sd, u8 reg, u8 value) w9968cf_i2c_w() argument
252 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; w9968cf_i2c_w()
253 u16* data = (u16 *)sd->gspca_dev.usb_buf; w9968cf_i2c_w()
255 data[0] = 0x082f | ((sd->sensor_addr & 0x80) ? 0x1500 : 0x0); w9968cf_i2c_w()
256 data[0] |= (sd->sensor_addr & 0x40) ? 0x4000 : 0x0; w9968cf_i2c_w()
257 data[1] = 0x2082 | ((sd->sensor_addr & 0x40) ? 0x0005 : 0x0); w9968cf_i2c_w()
258 data[1] |= (sd->sensor_addr & 0x20) ? 0x0150 : 0x0; w9968cf_i2c_w()
259 data[1] |= (sd->sensor_addr & 0x10) ? 0x5400 : 0x0; w9968cf_i2c_w()
260 data[2] = 0x8208 | ((sd->sensor_addr & 0x08) ? 0x0015 : 0x0); w9968cf_i2c_w()
261 data[2] |= (sd->sensor_addr & 0x04) ? 0x0540 : 0x0; w9968cf_i2c_w()
262 data[2] |= (sd->sensor_addr & 0x02) ? 0x5000 : 0x0; w9968cf_i2c_w()
263 data[3] = 0x1d20 | ((sd->sensor_addr & 0x02) ? 0x0001 : 0x0); w9968cf_i2c_w()
264 data[3] |= (sd->sensor_addr & 0x01) ? 0x0054 : 0x0; w9968cf_i2c_w()
266 w9968cf_write_fsb(sd, data); w9968cf_i2c_w()
280 w9968cf_write_fsb(sd, data); w9968cf_i2c_w()
294 w9968cf_write_fsb(sd, data); w9968cf_i2c_w()
300 static int w9968cf_i2c_r(struct sd *sd, u8 reg) w9968cf_i2c_r() argument
302 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; w9968cf_i2c_r()
307 w9968cf_write_sb(sd, 0x0013); /* don't change ! */ w9968cf_i2c_r()
309 w9968cf_smbus_start(sd); w9968cf_i2c_r()
310 w9968cf_smbus_write_byte(sd, sd->sensor_addr); w9968cf_i2c_r()
311 w9968cf_smbus_read_ack(sd); w9968cf_i2c_r()
312 w9968cf_smbus_write_byte(sd, reg); w9968cf_i2c_r()
313 w9968cf_smbus_read_ack(sd); w9968cf_i2c_r()
314 w9968cf_smbus_stop(sd); w9968cf_i2c_r()
315 w9968cf_smbus_start(sd); w9968cf_i2c_r()
316 w9968cf_smbus_write_byte(sd, sd->sensor_addr + 1); w9968cf_i2c_r()
317 w9968cf_smbus_read_ack(sd); w9968cf_i2c_r()
318 w9968cf_smbus_read_byte(sd, &value); w9968cf_i2c_r()
322 w9968cf_smbus_write_nack(sd); w9968cf_i2c_r()
323 w9968cf_smbus_stop(sd); w9968cf_i2c_r()
326 w9968cf_write_sb(sd, 0x0030); w9968cf_i2c_r()
328 if (sd->gspca_dev.usb_err >= 0) { w9968cf_i2c_r()
341 static void w9968cf_configure(struct sd *sd) w9968cf_configure() argument
343 reg_w(sd, 0x00, 0xff00); /* power-down */ w9968cf_configure()
344 reg_w(sd, 0x00, 0xbf17); /* reset everything */ w9968cf_configure()
345 reg_w(sd, 0x00, 0xbf10); /* normal operation */ w9968cf_configure()
346 reg_w(sd, 0x01, 0x0010); /* serial bus, SDS high */ w9968cf_configure()
347 reg_w(sd, 0x01, 0x0000); /* serial bus, SDS low */ w9968cf_configure()
348 reg_w(sd, 0x01, 0x0010); /* ..high 'beep-beep' */ w9968cf_configure()
349 reg_w(sd, 0x01, 0x0030); /* Set sda scl to FSB mode */ w9968cf_configure()
351 sd->stopped = 1; w9968cf_configure()
354 static void w9968cf_init(struct sd *sd) w9968cf_init() argument
356 unsigned long hw_bufsize = sd->sif ? (352 * 288 * 2) : (640 * 480 * 2), w9968cf_init()
364 reg_w(sd, 0x00, 0xff00); /* power off */ w9968cf_init()
365 reg_w(sd, 0x00, 0xbf10); /* power on */ w9968cf_init()
367 reg_w(sd, 0x03, 0x405d); /* DRAM timings */ w9968cf_init()
368 reg_w(sd, 0x04, 0x0030); /* SDRAM timings */ w9968cf_init()
370 reg_w(sd, 0x20, y0 & 0xffff); /* Y buf.0, low */ w9968cf_init()
371 reg_w(sd, 0x21, y0 >> 16); /* Y buf.0, high */ w9968cf_init()
372 reg_w(sd, 0x24, u0 & 0xffff); /* U buf.0, low */ w9968cf_init()
373 reg_w(sd, 0x25, u0 >> 16); /* U buf.0, high */ w9968cf_init()
374 reg_w(sd, 0x28, v0 & 0xffff); /* V buf.0, low */ w9968cf_init()
375 reg_w(sd, 0x29, v0 >> 16); /* V buf.0, high */ w9968cf_init()
377 reg_w(sd, 0x22, y1 & 0xffff); /* Y buf.1, low */ w9968cf_init()
378 reg_w(sd, 0x23, y1 >> 16); /* Y buf.1, high */ w9968cf_init()
379 reg_w(sd, 0x26, u1 & 0xffff); /* U buf.1, low */ w9968cf_init()
380 reg_w(sd, 0x27, u1 >> 16); /* U buf.1, high */ w9968cf_init()
381 reg_w(sd, 0x2a, v1 & 0xffff); /* V buf.1, low */ w9968cf_init()
382 reg_w(sd, 0x2b, v1 >> 16); /* V buf.1, high */ w9968cf_init()
384 reg_w(sd, 0x32, y1 & 0xffff); /* JPEG buf 0 low */ w9968cf_init()
385 reg_w(sd, 0x33, y1 >> 16); /* JPEG buf 0 high */ w9968cf_init()
387 reg_w(sd, 0x34, y1 & 0xffff); /* JPEG buf 1 low */ w9968cf_init()
388 reg_w(sd, 0x35, y1 >> 16); /* JPEG bug 1 high */ w9968cf_init()
390 reg_w(sd, 0x36, 0x0000);/* JPEG restart interval */ w9968cf_init()
391 reg_w(sd, 0x37, 0x0804);/*JPEG VLE FIFO threshold*/ w9968cf_init()
392 reg_w(sd, 0x38, 0x0000);/* disable hw up-scaling */ w9968cf_init()
393 reg_w(sd, 0x3f, 0x0000); /* JPEG/MCTL test data */ w9968cf_init()
396 static void w9968cf_set_crop_window(struct sd *sd) w9968cf_set_crop_window() argument
401 if (sd->sif) { w9968cf_set_crop_window()
409 if (sd->sensor == SEN_OV7620) { w9968cf_set_crop_window()
417 if (sd->freq->val == 1) { w9968cf_set_crop_window()
433 fw = SC(sd->gspca_dev.pixfmt.width) / max_width; w9968cf_set_crop_window()
434 fh = SC(sd->gspca_dev.pixfmt.height) / max_height; w9968cf_set_crop_window()
436 cw = (fw >= fh) ? max_width : SC(sd->gspca_dev.pixfmt.width) / fh; w9968cf_set_crop_window()
437 ch = (fw >= fh) ? SC(sd->gspca_dev.pixfmt.height) / fw : max_height; w9968cf_set_crop_window()
439 sd->sensor_width = max_width; w9968cf_set_crop_window()
440 sd->sensor_height = max_height; w9968cf_set_crop_window()
445 reg_w(sd, 0x10, start_cropx + x); w9968cf_set_crop_window()
446 reg_w(sd, 0x11, start_cropy + y); w9968cf_set_crop_window()
447 reg_w(sd, 0x12, start_cropx + x + cw); w9968cf_set_crop_window()
448 reg_w(sd, 0x13, start_cropy + y + ch); w9968cf_set_crop_window()
451 static void w9968cf_mode_init_regs(struct sd *sd) w9968cf_mode_init_regs() argument
455 w9968cf_set_crop_window(sd); w9968cf_mode_init_regs()
457 reg_w(sd, 0x14, sd->gspca_dev.pixfmt.width); w9968cf_mode_init_regs()
458 reg_w(sd, 0x15, sd->gspca_dev.pixfmt.height); w9968cf_mode_init_regs()
461 reg_w(sd, 0x30, sd->gspca_dev.pixfmt.width); w9968cf_mode_init_regs()
462 reg_w(sd, 0x31, sd->gspca_dev.pixfmt.height); w9968cf_mode_init_regs()
465 if (w9968cf_vga_mode[sd->gspca_dev.curr_mode].pixelformat == w9968cf_mode_init_regs()
467 reg_w(sd, 0x2c, sd->gspca_dev.pixfmt.width / 2); w9968cf_mode_init_regs()
468 reg_w(sd, 0x2d, sd->gspca_dev.pixfmt.width / 4); w9968cf_mode_init_regs()
470 reg_w(sd, 0x2c, sd->gspca_dev.pixfmt.width); w9968cf_mode_init_regs()
472 reg_w(sd, 0x00, 0xbf17); /* reset everything */ w9968cf_mode_init_regs()
473 reg_w(sd, 0x00, 0xbf10); /* normal operation */ w9968cf_mode_init_regs()
476 val = sd->gspca_dev.pixfmt.width * sd->gspca_dev.pixfmt.height; w9968cf_mode_init_regs()
477 reg_w(sd, 0x3d, val & 0xffff); /* low bits */ w9968cf_mode_init_regs()
478 reg_w(sd, 0x3e, val >> 16); /* high bits */ w9968cf_mode_init_regs()
480 if (w9968cf_vga_mode[sd->gspca_dev.curr_mode].pixelformat == w9968cf_mode_init_regs()
483 jpeg_define(sd->jpeg_hdr, sd->gspca_dev.pixfmt.height, w9968cf_mode_init_regs()
484 sd->gspca_dev.pixfmt.width, 0x22); /* JPEG 420 */ w9968cf_mode_init_regs()
485 jpeg_set_qual(sd->jpeg_hdr, v4l2_ctrl_g_ctrl(sd->jpegqual)); w9968cf_mode_init_regs()
486 w9968cf_upload_quantizationtables(sd); w9968cf_mode_init_regs()
487 v4l2_ctrl_grab(sd->jpegqual, true); w9968cf_mode_init_regs()
491 if (sd->sensor == SEN_OV7620) { w9968cf_mode_init_regs()
506 if (w9968cf_vga_mode[sd->gspca_dev.curr_mode].pixelformat == w9968cf_mode_init_regs()
519 reg_w(sd, 0x16, val); w9968cf_mode_init_regs()
521 sd->gspca_dev.empty_packet = 0; w9968cf_mode_init_regs()
524 static void w9968cf_stop0(struct sd *sd) w9968cf_stop0() argument
526 v4l2_ctrl_grab(sd->jpegqual, false); w9968cf_stop0()
527 reg_w(sd, 0x39, 0x0000); /* disable JPEG encoder */ w9968cf_stop0()
528 reg_w(sd, 0x16, 0x0000); /* stop video capture */ w9968cf_stop0()
543 struct sd *sd = (struct sd *) gspca_dev; w9968cf_pkt_scan() local
553 sd->jpeg_hdr, JPEG_HDR_SZ); w9968cf_pkt_scan()
H A Dov519.c64 struct sd { struct
2037 static void reg_w(struct sd *sd, u16 index, u16 value) reg_w() argument
2039 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; reg_w()
2042 if (sd->gspca_dev.usb_err < 0) reg_w()
2045 switch (sd->bridge) { reg_w()
2056 ret = usb_control_msg(sd->gspca_dev.dev, reg_w()
2057 usb_sndctrlpipe(sd->gspca_dev.dev, 0), reg_w()
2068 sd->gspca_dev.usb_buf[0] = value; reg_w()
2069 ret = usb_control_msg(sd->gspca_dev.dev, reg_w()
2070 usb_sndctrlpipe(sd->gspca_dev.dev, 0), reg_w()
2074 sd->gspca_dev.usb_buf, 1, 500); reg_w()
2078 sd->gspca_dev.usb_err = ret; reg_w()
2085 static int reg_r(struct sd *sd, u16 index) reg_r() argument
2087 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; reg_r()
2091 if (sd->gspca_dev.usb_err < 0) reg_r()
2094 switch (sd->bridge) { reg_r()
2106 ret = usb_control_msg(sd->gspca_dev.dev, reg_r()
2107 usb_rcvctrlpipe(sd->gspca_dev.dev, 0), reg_r()
2110 0, index, sd->gspca_dev.usb_buf, 1, 500); reg_r()
2113 ret = sd->gspca_dev.usb_buf[0]; reg_r()
2118 sd->gspca_dev.usb_err = ret; reg_r()
2125 static int reg_r8(struct sd *sd, reg_r8() argument
2128 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; reg_r8()
2131 if (sd->gspca_dev.usb_err < 0) reg_r8()
2134 ret = usb_control_msg(sd->gspca_dev.dev, reg_r8()
2135 usb_rcvctrlpipe(sd->gspca_dev.dev, 0), reg_r8()
2138 0, index, sd->gspca_dev.usb_buf, 8, 500); reg_r8()
2141 ret = sd->gspca_dev.usb_buf[0]; reg_r8()
2144 sd->gspca_dev.usb_err = ret; reg_r8()
2156 static void reg_w_mask(struct sd *sd, reg_w_mask() argument
2166 ret = reg_r(sd, index); reg_w_mask()
2173 reg_w(sd, index, value); reg_w_mask()
2180 static void ov518_reg_w32(struct sd *sd, u16 index, u32 value, int n) ov518_reg_w32() argument
2182 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov518_reg_w32()
2185 if (sd->gspca_dev.usb_err < 0) ov518_reg_w32()
2188 *((__le32 *) sd->gspca_dev.usb_buf) = __cpu_to_le32(value); ov518_reg_w32()
2190 ret = usb_control_msg(sd->gspca_dev.dev, ov518_reg_w32()
2191 usb_sndctrlpipe(sd->gspca_dev.dev, 0), ov518_reg_w32()
2195 sd->gspca_dev.usb_buf, n, 500); ov518_reg_w32()
2198 sd->gspca_dev.usb_err = ret; ov518_reg_w32()
2202 static void ov511_i2c_w(struct sd *sd, u8 reg, u8 value) ov511_i2c_w() argument
2204 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov511_i2c_w()
2212 reg_w(sd, R51x_I2C_SADDR_3, reg); ov511_i2c_w()
2215 reg_w(sd, R51x_I2C_DATA, value); ov511_i2c_w()
2218 reg_w(sd, R511_I2C_CTL, 0x01); ov511_i2c_w()
2221 rc = reg_r(sd, R511_I2C_CTL); ov511_i2c_w()
2236 static int ov511_i2c_r(struct sd *sd, u8 reg) ov511_i2c_r() argument
2238 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov511_i2c_r()
2244 reg_w(sd, R51x_I2C_SADDR_2, reg); ov511_i2c_r()
2247 reg_w(sd, R511_I2C_CTL, 0x03); ov511_i2c_r()
2250 rc = reg_r(sd, R511_I2C_CTL); ov511_i2c_r()
2260 reg_w(sd, R511_I2C_CTL, 0x10); ov511_i2c_r()
2271 reg_w(sd, R511_I2C_CTL, 0x05); ov511_i2c_r()
2274 rc = reg_r(sd, R511_I2C_CTL); ov511_i2c_r()
2284 reg_w(sd, R511_I2C_CTL, 0x10); ov511_i2c_r()
2292 value = reg_r(sd, R51x_I2C_DATA); ov511_i2c_r()
2297 reg_w(sd, R511_I2C_CTL, 0x05); ov511_i2c_r()
2307 static void ov518_i2c_w(struct sd *sd, ov518_i2c_w() argument
2311 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov518_i2c_w()
2316 reg_w(sd, R51x_I2C_SADDR_3, reg); ov518_i2c_w()
2319 reg_w(sd, R51x_I2C_DATA, value); ov518_i2c_w()
2322 reg_w(sd, R518_I2C_CTL, 0x01); ov518_i2c_w()
2326 reg_r8(sd, R518_I2C_CTL); ov518_i2c_w()
2336 static int ov518_i2c_r(struct sd *sd, u8 reg) ov518_i2c_r() argument
2338 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov518_i2c_r()
2342 reg_w(sd, R51x_I2C_SADDR_2, reg); ov518_i2c_r()
2345 reg_w(sd, R518_I2C_CTL, 0x03); ov518_i2c_r()
2346 reg_r8(sd, R518_I2C_CTL); ov518_i2c_r()
2349 reg_w(sd, R518_I2C_CTL, 0x05); ov518_i2c_r()
2350 reg_r8(sd, R518_I2C_CTL); ov518_i2c_r()
2352 value = reg_r(sd, R51x_I2C_DATA); ov518_i2c_r()
2357 static void ovfx2_i2c_w(struct sd *sd, u8 reg, u8 value) ovfx2_i2c_w() argument
2359 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ovfx2_i2c_w()
2362 if (sd->gspca_dev.usb_err < 0) ovfx2_i2c_w()
2365 ret = usb_control_msg(sd->gspca_dev.dev, ovfx2_i2c_w()
2366 usb_sndctrlpipe(sd->gspca_dev.dev, 0), ovfx2_i2c_w()
2373 sd->gspca_dev.usb_err = ret; ovfx2_i2c_w()
2379 static int ovfx2_i2c_r(struct sd *sd, u8 reg) ovfx2_i2c_r() argument
2381 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ovfx2_i2c_r()
2384 if (sd->gspca_dev.usb_err < 0) ovfx2_i2c_r()
2387 ret = usb_control_msg(sd->gspca_dev.dev, ovfx2_i2c_r()
2388 usb_rcvctrlpipe(sd->gspca_dev.dev, 0), ovfx2_i2c_r()
2391 0, (u16) reg, sd->gspca_dev.usb_buf, 1, 500); ovfx2_i2c_r()
2394 ret = sd->gspca_dev.usb_buf[0]; ovfx2_i2c_r()
2398 sd->gspca_dev.usb_err = ret; ovfx2_i2c_r()
2404 static void i2c_w(struct sd *sd, u8 reg, u8 value) i2c_w() argument
2406 if (sd->sensor_reg_cache[reg] == value) i2c_w()
2409 switch (sd->bridge) { i2c_w()
2412 ov511_i2c_w(sd, reg, value); i2c_w()
2417 ov518_i2c_w(sd, reg, value); i2c_w()
2420 ovfx2_i2c_w(sd, reg, value); i2c_w()
2423 w9968cf_i2c_w(sd, reg, value); i2c_w()
2427 if (sd->gspca_dev.usb_err >= 0) { i2c_w()
2430 memset(sd->sensor_reg_cache, -1, i2c_w()
2431 sizeof(sd->sensor_reg_cache)); i2c_w()
2433 sd->sensor_reg_cache[reg] = value; i2c_w()
2437 static int i2c_r(struct sd *sd, u8 reg) i2c_r() argument
2441 if (sd->sensor_reg_cache[reg] != -1) i2c_r()
2442 return sd->sensor_reg_cache[reg]; i2c_r()
2444 switch (sd->bridge) { i2c_r()
2447 ret = ov511_i2c_r(sd, reg); i2c_r()
2452 ret = ov518_i2c_r(sd, reg); i2c_r()
2455 ret = ovfx2_i2c_r(sd, reg); i2c_r()
2458 ret = w9968cf_i2c_r(sd, reg); i2c_r()
2463 sd->sensor_reg_cache[reg] = ret; i2c_r()
2473 static void i2c_w_mask(struct sd *sd, i2c_w_mask() argument
2482 rc = i2c_r(sd, reg); i2c_w_mask()
2487 i2c_w(sd, reg, value); i2c_w_mask()
2492 static inline void ov51x_stop(struct sd *sd) ov51x_stop() argument
2494 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov51x_stop()
2497 sd->stopped = 1; ov51x_stop()
2498 switch (sd->bridge) { ov51x_stop()
2501 reg_w(sd, R51x_SYS_RESET, 0x3d); ov51x_stop()
2505 reg_w_mask(sd, R51x_SYS_RESET, 0x3a, 0x3a); ov51x_stop()
2508 reg_w(sd, OV519_R51_RESET1, 0x0f); ov51x_stop()
2509 reg_w(sd, OV519_R51_RESET1, 0x00); ov51x_stop()
2510 reg_w(sd, 0x22, 0x00); /* FRAR */ ov51x_stop()
2513 reg_w_mask(sd, 0x0f, 0x00, 0x02); ov51x_stop()
2516 reg_w(sd, 0x3c, 0x0a05); /* stop USB transfer */ ov51x_stop()
2523 static inline void ov51x_restart(struct sd *sd) ov51x_restart() argument
2525 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov51x_restart()
2528 if (!sd->stopped) ov51x_restart()
2530 sd->stopped = 0; ov51x_restart()
2533 switch (sd->bridge) { ov51x_restart()
2536 reg_w(sd, R51x_SYS_RESET, 0x00); ov51x_restart()
2540 reg_w(sd, 0x2f, 0x80); ov51x_restart()
2541 reg_w(sd, R51x_SYS_RESET, 0x00); ov51x_restart()
2544 reg_w(sd, OV519_R51_RESET1, 0x0f); ov51x_restart()
2545 reg_w(sd, OV519_R51_RESET1, 0x00); ov51x_restart()
2546 reg_w(sd, 0x22, 0x1d); /* FRAR */ ov51x_restart()
2549 reg_w_mask(sd, 0x0f, 0x02, 0x02); ov51x_restart()
2552 reg_w(sd, 0x3c, 0x8a05); /* USB FIFO enable */ ov51x_restart()
2557 static void ov51x_set_slave_ids(struct sd *sd, u8 slave);
2562 static int init_ov_sensor(struct sd *sd, u8 slave) init_ov_sensor() argument
2565 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; init_ov_sensor()
2567 ov51x_set_slave_ids(sd, slave); init_ov_sensor()
2570 i2c_w(sd, 0x12, 0x80); init_ov_sensor()
2576 if (i2c_r(sd, OV7610_REG_ID_HIGH) == 0x7f && init_ov_sensor()
2577 i2c_r(sd, OV7610_REG_ID_LOW) == 0xa2) { init_ov_sensor()
2583 i2c_w(sd, 0x12, 0x80); init_ov_sensor()
2589 if (i2c_r(sd, 0x00) < 0) init_ov_sensor()
2600 static void ov51x_set_slave_ids(struct sd *sd, ov51x_set_slave_ids() argument
2603 switch (sd->bridge) { ov51x_set_slave_ids()
2605 reg_w(sd, OVFX2_I2C_ADDR, slave); ov51x_set_slave_ids()
2608 sd->sensor_addr = slave; ov51x_set_slave_ids()
2612 reg_w(sd, R51x_I2C_W_SID, slave); ov51x_set_slave_ids()
2613 reg_w(sd, R51x_I2C_R_SID, slave + 1); ov51x_set_slave_ids()
2616 static void write_regvals(struct sd *sd, write_regvals() argument
2621 reg_w(sd, regvals->reg, regvals->val); write_regvals()
2626 static void write_i2c_regvals(struct sd *sd, write_i2c_regvals() argument
2631 i2c_w(sd, regvals->reg, regvals->val); write_i2c_regvals()
2643 static void ov_hires_configure(struct sd *sd) ov_hires_configure() argument
2645 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov_hires_configure()
2648 if (sd->bridge != BRIDGE_OVFX2) { ov_hires_configure()
2656 high = i2c_r(sd, 0x0a); ov_hires_configure()
2657 low = i2c_r(sd, 0x0b); ov_hires_configure()
2664 sd->sensor = SEN_OV2610; ov_hires_configure()
2668 sd->sensor = SEN_OV2610AE; ov_hires_configure()
2672 sd->sensor = SEN_OV9600; ov_hires_configure()
2679 sd->sensor = SEN_OV3610; ov_hires_configure()
2690 static void ov8xx0_configure(struct sd *sd) ov8xx0_configure() argument
2692 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov8xx0_configure()
2698 rc = i2c_r(sd, OV7610_REG_COM_I); ov8xx0_configure()
2704 sd->sensor = SEN_OV8610; ov8xx0_configure()
2712 static void ov7xx0_configure(struct sd *sd) ov7xx0_configure() argument
2714 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov7xx0_configure()
2720 rc = i2c_r(sd, OV7610_REG_COM_I); ov7xx0_configure()
2730 high = i2c_r(sd, 0x0a); ov7xx0_configure()
2731 low = i2c_r(sd, 0x0b); ov7xx0_configure()
2735 sd->sensor = SEN_OV7670; ov7xx0_configure()
2738 sd->sensor = SEN_OV7610; ov7xx0_configure()
2742 if (i2c_r(sd, 0x15) & 1) { ov7xx0_configure()
2744 sd->sensor = SEN_OV7620AE; ov7xx0_configure()
2747 sd->sensor = SEN_OV76BE; ov7xx0_configure()
2751 high = i2c_r(sd, 0x0a); ov7xx0_configure()
2756 low = i2c_r(sd, 0x0b); ov7xx0_configure()
2769 sd->sensor = SEN_OV7640; /* FIXME */ ov7xx0_configure()
2773 sd->sensor = SEN_OV7640; /* FIXME */ ov7xx0_configure()
2777 sd->sensor = SEN_OV7648; ov7xx0_configure()
2781 sd->sensor = SEN_OV7660; ov7xx0_configure()
2789 sd->sensor = SEN_OV7620; ov7xx0_configure()
2797 static void ov6xx0_configure(struct sd *sd) ov6xx0_configure() argument
2799 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov6xx0_configure()
2805 rc = i2c_r(sd, OV7610_REG_COM_I); ov6xx0_configure()
2816 sd->sensor = SEN_OV6630; ov6xx0_configure()
2820 sd->sensor = SEN_OV6620; ov6xx0_configure()
2824 sd->sensor = SEN_OV6630; ov6xx0_configure()
2828 sd->sensor = SEN_OV66308AF; ov6xx0_configure()
2832 sd->sensor = SEN_OV6630; ov6xx0_configure()
2841 sd->sif = 1; ov6xx0_configure()
2845 static void ov51x_led_control(struct sd *sd, int on) ov51x_led_control() argument
2847 if (sd->invert_led) ov51x_led_control()
2850 switch (sd->bridge) { ov51x_led_control()
2853 reg_w(sd, R511_SYS_LED_CTL, on); ov51x_led_control()
2857 reg_w_mask(sd, R518_GPIO_OUT, 0x02 * on, 0x02); ov51x_led_control()
2860 reg_w_mask(sd, OV519_GPIO_DATA_OUT0, on, 1); ov51x_led_control()
2867 struct sd *sd = (struct sd *) gspca_dev; sd_reset_snapshot() local
2869 if (!sd->snapshot_needs_reset) sd_reset_snapshot()
2872 /* Note it is important that we clear sd->snapshot_needs_reset, sd_reset_snapshot()
2875 sd->snapshot_needs_reset = 0; sd_reset_snapshot()
2877 switch (sd->bridge) { sd_reset_snapshot()
2880 reg_w(sd, R51x_SYS_SNAP, 0x02); sd_reset_snapshot()
2881 reg_w(sd, R51x_SYS_SNAP, 0x00); sd_reset_snapshot()
2885 reg_w(sd, R51x_SYS_SNAP, 0x02); /* Reset */ sd_reset_snapshot()
2886 reg_w(sd, R51x_SYS_SNAP, 0x01); /* Enable */ sd_reset_snapshot()
2889 reg_w(sd, R51x_SYS_RESET, 0x40); sd_reset_snapshot()
2890 reg_w(sd, R51x_SYS_RESET, 0x00); sd_reset_snapshot()
2895 static void ov51x_upload_quan_tables(struct sd *sd) ov51x_upload_quan_tables() argument
2933 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov51x_upload_quan_tables()
2940 if (sd->bridge == BRIDGE_OV511 || sd->bridge == BRIDGE_OV511PLUS) { ov51x_upload_quan_tables()
2956 reg_w(sd, reg, val0); ov51x_upload_quan_tables()
2963 reg_w(sd, reg + size, val0); ov51x_upload_quan_tables()
2972 struct sd *sd = (struct sd *) gspca_dev; ov511_configure() local
3016 PDEBUG(D_PROBE, "Device custom id %x", reg_r(sd, R51x_SYS_CUST_ID)); ov511_configure()
3018 write_regvals(sd, init_511, ARRAY_SIZE(init_511)); ov511_configure()
3020 switch (sd->bridge) { ov511_configure()
3022 write_regvals(sd, norm_511, ARRAY_SIZE(norm_511)); ov511_configure()
3025 write_regvals(sd, norm_511_p, ARRAY_SIZE(norm_511_p)); ov511_configure()
3030 write_regvals(sd, compress_511, ARRAY_SIZE(compress_511)); ov511_configure()
3032 ov51x_upload_quan_tables(sd); ov511_configure()
3038 struct sd *sd = (struct sd *) gspca_dev; ov518_configure() local
3085 sd->revision = reg_r(sd, R51x_SYS_CUST_ID) & 0x1f; ov518_configure()
3086 PDEBUG(D_PROBE, "Device revision %d", sd->revision); ov518_configure()
3088 write_regvals(sd, init_518, ARRAY_SIZE(init_518)); ov518_configure()
3091 reg_w_mask(sd, R518_GPIO_CTL, 0x00, 0x02); ov518_configure()
3093 switch (sd->bridge) { ov518_configure()
3095 write_regvals(sd, norm_518, ARRAY_SIZE(norm_518)); ov518_configure()
3098 write_regvals(sd, norm_518_p, ARRAY_SIZE(norm_518_p)); ov518_configure()
3102 ov51x_upload_quan_tables(sd); ov518_configure()
3104 reg_w(sd, 0x2f, 0x80); ov518_configure()
3107 static void ov519_configure(struct sd *sd) ov519_configure() argument
3125 write_regvals(sd, init_519, ARRAY_SIZE(init_519)); ov519_configure()
3128 static void ovfx2_configure(struct sd *sd) ovfx2_configure() argument
3140 sd->stopped = 1; ovfx2_configure()
3142 write_regvals(sd, init_fx2, ARRAY_SIZE(init_fx2)); ovfx2_configure()
3147 static void ov519_set_mode(struct sd *sd) ov519_set_mode() argument
3174 write_regvals(sd, bridge_ov7660[sd->gspca_dev.curr_mode], ov519_set_mode()
3176 write_i2c_regvals(sd, sensor_ov7660[sd->gspca_dev.curr_mode], ov519_set_mode()
3178 write_i2c_regvals(sd, sensor_ov7660_2, ov519_set_mode()
3184 static void ov519_set_fr(struct sd *sd) ov519_set_fr() argument
3209 sd->frame_rate = frame_rate; ov519_set_fr()
3210 if (sd->frame_rate >= 30) ov519_set_fr()
3212 else if (sd->frame_rate >= 25) ov519_set_fr()
3214 else if (sd->frame_rate >= 20) ov519_set_fr()
3216 else if (sd->frame_rate >= 15) ov519_set_fr()
3218 else if (sd->frame_rate >= 10) ov519_set_fr()
3222 reg_w(sd, 0xa4, fr_tb[sd->gspca_dev.curr_mode][fr][0]); ov519_set_fr()
3223 reg_w(sd, 0x23, fr_tb[sd->gspca_dev.curr_mode][fr][1]); ov519_set_fr()
3224 clock = fr_tb[sd->gspca_dev.curr_mode][fr][2]; ov519_set_fr()
3225 if (sd->sensor == SEN_OV7660) ov519_set_fr()
3227 ov518_i2c_w(sd, OV7670_R11_CLKRC, clock); ov519_set_fr()
3232 struct sd *sd = (struct sd *) gspca_dev; setautogain() local
3234 i2c_w_mask(sd, 0x13, val ? 0x05 : 0x00, 0x05); setautogain()
3241 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
3244 sd->bridge = id->driver_info & BRIDGE_MASK; sd_config()
3245 sd->invert_led = (id->driver_info & BRIDGE_INVERT_LED) != 0; sd_config()
3247 switch (sd->bridge) { sd_config()
3275 sd->frame_rate = 15; sd_config()
3283 struct sd *sd = (struct sd *) gspca_dev; sd_init() local
3286 switch (sd->bridge) { sd_init()
3296 ov519_configure(sd); sd_init()
3299 ovfx2_configure(sd); sd_init()
3302 w9968cf_configure(sd); sd_init()
3309 sd->sensor = -1; sd_init()
3312 if (init_ov_sensor(sd, OV7xx0_SID) >= 0) { sd_init()
3313 ov7xx0_configure(sd); sd_init()
3316 } else if (init_ov_sensor(sd, OV6xx0_SID) >= 0) { sd_init()
3317 ov6xx0_configure(sd); sd_init()
3320 } else if (init_ov_sensor(sd, OV8xx0_SID) >= 0) { sd_init()
3321 ov8xx0_configure(sd); sd_init()
3324 } else if (init_ov_sensor(sd, OV_HIRES_SID) >= 0) { sd_init()
3325 ov_hires_configure(sd); sd_init()
3331 if (sd->sensor < 0) sd_init()
3334 ov51x_led_control(sd, 0); /* turn LED off */ sd_init()
3336 switch (sd->bridge) { sd_init()
3339 if (sd->sif) { sd_init()
3346 if (sd->sif) { sd_init()
3352 if (sd->sif) { sd_init()
3358 switch (sd->sensor) { sd_init()
3373 if (sd->sif) { sd_init()
3381 if (sd->sif) sd_init()
3385 w9968cf_init(sd); sd_init()
3390 switch (sd->sensor) { sd_init()
3392 write_i2c_regvals(sd, norm_2610, ARRAY_SIZE(norm_2610)); sd_init()
3395 i2c_w_mask(sd, 0x13, 0x27, 0x27); sd_init()
3398 write_i2c_regvals(sd, norm_2610ae, ARRAY_SIZE(norm_2610ae)); sd_init()
3401 i2c_w_mask(sd, 0x13, 0x05, 0x05); sd_init()
3404 write_i2c_regvals(sd, norm_3620b, ARRAY_SIZE(norm_3620b)); sd_init()
3407 i2c_w_mask(sd, 0x13, 0x27, 0x27); sd_init()
3410 write_i2c_regvals(sd, norm_6x20, ARRAY_SIZE(norm_6x20)); sd_init()
3414 write_i2c_regvals(sd, norm_6x30, ARRAY_SIZE(norm_6x30)); sd_init()
3419 write_i2c_regvals(sd, norm_7610, ARRAY_SIZE(norm_7610)); sd_init()
3420 i2c_w_mask(sd, 0x0e, 0x00, 0x40); sd_init()
3424 write_i2c_regvals(sd, norm_7620, ARRAY_SIZE(norm_7620)); sd_init()
3428 write_i2c_regvals(sd, norm_7640, ARRAY_SIZE(norm_7640)); sd_init()
3431 i2c_w(sd, OV7670_R12_COM7, OV7670_COM7_RESET); sd_init()
3433 reg_w(sd, OV519_R57_SNAPSHOT, 0x23); sd_init()
3434 write_regvals(sd, init_519_ov7660, sd_init()
3436 write_i2c_regvals(sd, norm_7660, ARRAY_SIZE(norm_7660)); sd_init()
3437 sd->gspca_dev.curr_mode = 1; /* 640x480 */ sd_init()
3438 ov519_set_mode(sd); sd_init()
3439 ov519_set_fr(sd); sd_init()
3441 ov51x_restart(sd); sd_init()
3442 ov51x_stop(sd); /* not in win traces */ sd_init()
3443 ov51x_led_control(sd, 0); sd_init()
3446 write_i2c_regvals(sd, norm_7670, ARRAY_SIZE(norm_7670)); sd_init()
3449 write_i2c_regvals(sd, norm_8610, ARRAY_SIZE(norm_8610)); sd_init()
3452 write_i2c_regvals(sd, norm_9600, ARRAY_SIZE(norm_9600)); sd_init()
3455 /* i2c_w_mask(sd, 0x13, 0x05, 0x05); */ sd_init()
3467 struct sd *sd = (struct sd *) gspca_dev; sd_isoc_init() local
3469 switch (sd->bridge) { sd_isoc_init()
3484 static void ov511_mode_init_regs(struct sd *sd) ov511_mode_init_regs() argument
3486 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov511_mode_init_regs()
3492 intf = usb_ifnum_to_if(sd->gspca_dev.dev, sd->gspca_dev.iface); ov511_mode_init_regs()
3493 alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt); ov511_mode_init_regs()
3496 sd->gspca_dev.usb_err = -EIO; ov511_mode_init_regs()
3501 reg_w(sd, R51x_FIFO_PSIZE, packet_size >> 5); ov511_mode_init_regs()
3503 reg_w(sd, R511_CAM_UV_EN, 0x01); ov511_mode_init_regs()
3504 reg_w(sd, R511_SNAP_UV_EN, 0x01); ov511_mode_init_regs()
3505 reg_w(sd, R511_SNAP_OPTS, 0x03); ov511_mode_init_regs()
3510 hsegs = (sd->gspca_dev.pixfmt.width >> 3) - 1; ov511_mode_init_regs()
3511 vsegs = (sd->gspca_dev.pixfmt.height >> 3) - 1; ov511_mode_init_regs()
3513 reg_w(sd, R511_CAM_PXCNT, hsegs); ov511_mode_init_regs()
3514 reg_w(sd, R511_CAM_LNCNT, vsegs); ov511_mode_init_regs()
3515 reg_w(sd, R511_CAM_PXDIV, 0x00); ov511_mode_init_regs()
3516 reg_w(sd, R511_CAM_LNDIV, 0x00); ov511_mode_init_regs()
3519 reg_w(sd, R511_CAM_OPTS, 0x03); ov511_mode_init_regs()
3522 reg_w(sd, R511_SNAP_PXCNT, hsegs); ov511_mode_init_regs()
3523 reg_w(sd, R511_SNAP_LNCNT, vsegs); ov511_mode_init_regs()
3524 reg_w(sd, R511_SNAP_PXDIV, 0x00); ov511_mode_init_regs()
3525 reg_w(sd, R511_SNAP_LNDIV, 0x00); ov511_mode_init_regs()
3529 sd->frame_rate = frame_rate; ov511_mode_init_regs()
3531 switch (sd->sensor) { ov511_mode_init_regs()
3534 sd->clockdiv = 3; ov511_mode_init_regs()
3544 if (sd->gspca_dev.pixfmt.width == 320) ov511_mode_init_regs()
3550 switch (sd->frame_rate) { ov511_mode_init_regs()
3554 if (sd->gspca_dev.pixfmt.width != 640) { ov511_mode_init_regs()
3555 sd->clockdiv = 0; ov511_mode_init_regs()
3562 sd->clockdiv = 1; ov511_mode_init_regs()
3565 sd->clockdiv = 2; ov511_mode_init_regs()
3568 sd->clockdiv = 5; ov511_mode_init_regs()
3572 sd->clockdiv = (sd->clockdiv + 1) * 2 - 1; ov511_mode_init_regs()
3574 if (sd->clockdiv > 10) ov511_mode_init_regs()
3575 sd->clockdiv = 10; ov511_mode_init_regs()
3581 sd->clockdiv = 0; ov511_mode_init_regs()
3586 fps = (interlaced ? 60 : 30) / (sd->clockdiv + 1) + 1; ov511_mode_init_regs()
3587 needed = fps * sd->gspca_dev.pixfmt.width * ov511_mode_init_regs()
3588 sd->gspca_dev.pixfmt.height * 3 / 2; ov511_mode_init_regs()
3592 reg_w(sd, R511_COMP_EN, 0x07); ov511_mode_init_regs()
3593 reg_w(sd, R511_COMP_LUT_EN, 0x03); ov511_mode_init_regs()
3595 reg_w(sd, R511_COMP_EN, 0x06); ov511_mode_init_regs()
3596 reg_w(sd, R511_COMP_LUT_EN, 0x00); ov511_mode_init_regs()
3599 reg_w(sd, R51x_SYS_RESET, OV511_RESET_OMNICE); ov511_mode_init_regs()
3600 reg_w(sd, R51x_SYS_RESET, 0); ov511_mode_init_regs()
3610 static void ov518_mode_init_regs(struct sd *sd) ov518_mode_init_regs() argument
3612 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov518_mode_init_regs()
3617 intf = usb_ifnum_to_if(sd->gspca_dev.dev, sd->gspca_dev.iface); ov518_mode_init_regs()
3618 alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt); ov518_mode_init_regs()
3621 sd->gspca_dev.usb_err = -EIO; ov518_mode_init_regs()
3626 ov518_reg_w32(sd, R51x_FIFO_PSIZE, packet_size & ~7, 2); ov518_mode_init_regs()
3629 reg_w(sd, 0x2b, 0); ov518_mode_init_regs()
3630 reg_w(sd, 0x2c, 0); ov518_mode_init_regs()
3631 reg_w(sd, 0x2d, 0); ov518_mode_init_regs()
3632 reg_w(sd, 0x2e, 0); ov518_mode_init_regs()
3633 reg_w(sd, 0x3b, 0); ov518_mode_init_regs()
3634 reg_w(sd, 0x3c, 0); ov518_mode_init_regs()
3635 reg_w(sd, 0x3d, 0); ov518_mode_init_regs()
3636 reg_w(sd, 0x3e, 0); ov518_mode_init_regs()
3638 if (sd->bridge == BRIDGE_OV518) { ov518_mode_init_regs()
3640 reg_w_mask(sd, 0x20, 0x08, 0x08); ov518_mode_init_regs()
3643 reg_w_mask(sd, 0x28, 0x80, 0xf0); ov518_mode_init_regs()
3644 reg_w_mask(sd, 0x38, 0x80, 0xf0); ov518_mode_init_regs()
3646 reg_w(sd, 0x28, 0x80); ov518_mode_init_regs()
3647 reg_w(sd, 0x38, 0x80); ov518_mode_init_regs()
3650 hsegs = sd->gspca_dev.pixfmt.width / 16; ov518_mode_init_regs()
3651 vsegs = sd->gspca_dev.pixfmt.height / 4; ov518_mode_init_regs()
3653 reg_w(sd, 0x29, hsegs); ov518_mode_init_regs()
3654 reg_w(sd, 0x2a, vsegs); ov518_mode_init_regs()
3656 reg_w(sd, 0x39, hsegs); ov518_mode_init_regs()
3657 reg_w(sd, 0x3a, vsegs); ov518_mode_init_regs()
3660 reg_w(sd, 0x2f, 0x80); ov518_mode_init_regs()
3663 if (sd->bridge == BRIDGE_OV518PLUS && sd->revision == 0 && ov518_mode_init_regs()
3664 sd->sensor == SEN_OV7620AE) ov518_mode_init_regs()
3665 sd->clockdiv = 0; ov518_mode_init_regs()
3667 sd->clockdiv = 1; ov518_mode_init_regs()
3671 reg_w(sd, 0x51, 0x04); ov518_mode_init_regs()
3672 reg_w(sd, 0x22, 0x18); ov518_mode_init_regs()
3673 reg_w(sd, 0x23, 0xff); ov518_mode_init_regs()
3675 if (sd->bridge == BRIDGE_OV518PLUS) { ov518_mode_init_regs()
3676 switch (sd->sensor) { ov518_mode_init_regs()
3690 if (sd->revision > 0 && ov518_mode_init_regs()
3691 sd->gspca_dev.pixfmt.width == 640) { ov518_mode_init_regs()
3692 reg_w(sd, 0x20, 0x60); ov518_mode_init_regs()
3693 reg_w(sd, 0x21, 0x1f); ov518_mode_init_regs()
3695 reg_w(sd, 0x20, 0x00); ov518_mode_init_regs()
3696 reg_w(sd, 0x21, 0x19); ov518_mode_init_regs()
3700 reg_w(sd, 0x20, 0x00); ov518_mode_init_regs()
3701 reg_w(sd, 0x21, 0x19); ov518_mode_init_regs()
3704 reg_w(sd, 0x21, 0x19); ov518_mode_init_regs()
3707 reg_w(sd, 0x71, 0x17); /* Compression-related? */ ov518_mode_init_regs()
3711 i2c_w(sd, 0x54, 0x23); ov518_mode_init_regs()
3713 reg_w(sd, 0x2f, 0x80); ov518_mode_init_regs()
3715 if (sd->bridge == BRIDGE_OV518PLUS) { ov518_mode_init_regs()
3716 reg_w(sd, 0x24, 0x94); ov518_mode_init_regs()
3717 reg_w(sd, 0x25, 0x90); ov518_mode_init_regs()
3718 ov518_reg_w32(sd, 0xc4, 400, 2); /* 190h */ ov518_mode_init_regs()
3719 ov518_reg_w32(sd, 0xc6, 540, 2); /* 21ch */ ov518_mode_init_regs()
3720 ov518_reg_w32(sd, 0xc7, 540, 2); /* 21ch */ ov518_mode_init_regs()
3721 ov518_reg_w32(sd, 0xc8, 108, 2); /* 6ch */ ov518_mode_init_regs()
3722 ov518_reg_w32(sd, 0xca, 131098, 3); /* 2001ah */ ov518_mode_init_regs()
3723 ov518_reg_w32(sd, 0xcb, 532, 2); /* 214h */ ov518_mode_init_regs()
3724 ov518_reg_w32(sd, 0xcc, 2400, 2); /* 960h */ ov518_mode_init_regs()
3725 ov518_reg_w32(sd, 0xcd, 32, 2); /* 20h */ ov518_mode_init_regs()
3726 ov518_reg_w32(sd, 0xce, 608, 2); /* 260h */ ov518_mode_init_regs()
3728 reg_w(sd, 0x24, 0x9f); ov518_mode_init_regs()
3729 reg_w(sd, 0x25, 0x90); ov518_mode_init_regs()
3730 ov518_reg_w32(sd, 0xc4, 400, 2); /* 190h */ ov518_mode_init_regs()
3731 ov518_reg_w32(sd, 0xc6, 381, 2); /* 17dh */ ov518_mode_init_regs()
3732 ov518_reg_w32(sd, 0xc7, 381, 2); /* 17dh */ ov518_mode_init_regs()
3733 ov518_reg_w32(sd, 0xc8, 128, 2); /* 80h */ ov518_mode_init_regs()
3734 ov518_reg_w32(sd, 0xca, 183331, 3); /* 2cc23h */ ov518_mode_init_regs()
3735 ov518_reg_w32(sd, 0xcb, 746, 2); /* 2eah */ ov518_mode_init_regs()
3736 ov518_reg_w32(sd, 0xcc, 1750, 2); /* 6d6h */ ov518_mode_init_regs()
3737 ov518_reg_w32(sd, 0xcd, 45, 2); /* 2dh */ ov518_mode_init_regs()
3738 ov518_reg_w32(sd, 0xce, 851, 2); /* 353h */ ov518_mode_init_regs()
3741 reg_w(sd, 0x2f, 0x80); ov518_mode_init_regs()
3751 static void ov519_mode_init_regs(struct sd *sd) ov519_mode_init_regs() argument
3797 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov519_mode_init_regs()
3800 switch (sd->sensor) { ov519_mode_init_regs()
3802 write_regvals(sd, mode_init_519, ARRAY_SIZE(mode_init_519)); ov519_mode_init_regs()
3803 if (sd->sensor == SEN_OV7640 || ov519_mode_init_regs()
3804 sd->sensor == SEN_OV7648) { ov519_mode_init_regs()
3806 reg_w_mask(sd, OV519_R20_DFR, 0x10, 0x10); ov519_mode_init_regs()
3812 write_regvals(sd, mode_init_519_ov7670, ov519_mode_init_regs()
3817 reg_w(sd, OV519_R10_H_SIZE, sd->gspca_dev.pixfmt.width >> 4); ov519_mode_init_regs()
3818 reg_w(sd, OV519_R11_V_SIZE, sd->gspca_dev.pixfmt.height >> 3); ov519_mode_init_regs()
3819 if (sd->sensor == SEN_OV7670 && ov519_mode_init_regs()
3820 sd->gspca_dev.cam.cam_mode[sd->gspca_dev.curr_mode].priv) ov519_mode_init_regs()
3821 reg_w(sd, OV519_R12_X_OFFSETL, 0x04); ov519_mode_init_regs()
3822 else if (sd->sensor == SEN_OV7648 && ov519_mode_init_regs()
3823 sd->gspca_dev.cam.cam_mode[sd->gspca_dev.curr_mode].priv) ov519_mode_init_regs()
3824 reg_w(sd, OV519_R12_X_OFFSETL, 0x01); ov519_mode_init_regs()
3826 reg_w(sd, OV519_R12_X_OFFSETL, 0x00); ov519_mode_init_regs()
3827 reg_w(sd, OV519_R13_X_OFFSETH, 0x00); ov519_mode_init_regs()
3828 reg_w(sd, OV519_R14_Y_OFFSETL, 0x00); ov519_mode_init_regs()
3829 reg_w(sd, OV519_R15_Y_OFFSETH, 0x00); ov519_mode_init_regs()
3830 reg_w(sd, OV519_R16_DIVIDER, 0x00); ov519_mode_init_regs()
3831 reg_w(sd, OV519_R25_FORMAT, 0x03); /* YUV422 */ ov519_mode_init_regs()
3832 reg_w(sd, 0x26, 0x00); /* Undocumented */ ov519_mode_init_regs()
3836 sd->frame_rate = frame_rate; ov519_mode_init_regs()
3839 sd->clockdiv = 0; ov519_mode_init_regs()
3840 switch (sd->sensor) { ov519_mode_init_regs()
3843 switch (sd->frame_rate) { ov519_mode_init_regs()
3846 reg_w(sd, 0xa4, 0x0c); ov519_mode_init_regs()
3847 reg_w(sd, 0x23, 0xff); ov519_mode_init_regs()
3850 reg_w(sd, 0xa4, 0x0c); ov519_mode_init_regs()
3851 reg_w(sd, 0x23, 0x1f); ov519_mode_init_regs()
3854 reg_w(sd, 0xa4, 0x0c); ov519_mode_init_regs()
3855 reg_w(sd, 0x23, 0x1b); ov519_mode_init_regs()
3858 reg_w(sd, 0xa4, 0x04); ov519_mode_init_regs()
3859 reg_w(sd, 0x23, 0xff); ov519_mode_init_regs()
3860 sd->clockdiv = 1; ov519_mode_init_regs()
3863 reg_w(sd, 0xa4, 0x04); ov519_mode_init_regs()
3864 reg_w(sd, 0x23, 0x1f); ov519_mode_init_regs()
3865 sd->clockdiv = 1; ov519_mode_init_regs()
3868 reg_w(sd, 0xa4, 0x04); ov519_mode_init_regs()
3869 reg_w(sd, 0x23, 0x1b); ov519_mode_init_regs()
3870 sd->clockdiv = 1; ov519_mode_init_regs()
3875 switch (sd->frame_rate) { ov519_mode_init_regs()
3878 reg_w(sd, 0xa4, 0x06); ov519_mode_init_regs()
3879 reg_w(sd, 0x23, 0xff); ov519_mode_init_regs()
3882 reg_w(sd, 0xa4, 0x06); ov519_mode_init_regs()
3883 reg_w(sd, 0x23, 0x1f); ov519_mode_init_regs()
3886 reg_w(sd, 0xa4, 0x06); ov519_mode_init_regs()
3887 reg_w(sd, 0x23, 0x1b); ov519_mode_init_regs()
3893 (sd->frame_rate == 0) ? 15 : sd->frame_rate); ov519_mode_init_regs()
3894 reg_w(sd, 0xa4, 0x10); ov519_mode_init_regs()
3895 switch (sd->frame_rate) { ov519_mode_init_regs()
3897 reg_w(sd, 0x23, 0xff); ov519_mode_init_regs()
3900 reg_w(sd, 0x23, 0x1b); ov519_mode_init_regs()
3904 reg_w(sd, 0x23, 0xff); ov519_mode_init_regs()
3905 sd->clockdiv = 1; ov519_mode_init_regs()
3912 static void mode_init_ov_sensor_regs(struct sd *sd) mode_init_ov_sensor_regs() argument
3914 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; mode_init_ov_sensor_regs()
3921 switch (sd->sensor) { mode_init_ov_sensor_regs()
3923 i2c_w_mask(sd, 0x14, qvga ? 0x20 : 0x00, 0x20); mode_init_ov_sensor_regs()
3924 i2c_w_mask(sd, 0x28, qvga ? 0x00 : 0x20, 0x20); mode_init_ov_sensor_regs()
3925 i2c_w(sd, 0x24, qvga ? 0x20 : 0x3a); mode_init_ov_sensor_regs()
3926 i2c_w(sd, 0x25, qvga ? 0x30 : 0x60); mode_init_ov_sensor_regs()
3927 i2c_w_mask(sd, 0x2d, qvga ? 0x40 : 0x00, 0x40); mode_init_ov_sensor_regs()
3928 i2c_w_mask(sd, 0x67, qvga ? 0xf0 : 0x90, 0xf0); mode_init_ov_sensor_regs()
3929 i2c_w_mask(sd, 0x74, qvga ? 0x20 : 0x00, 0x20); mode_init_ov_sensor_regs()
3940 if (sd->frame_rate < 25) mode_init_ov_sensor_regs()
3943 if (sd->frame_rate < 10) mode_init_ov_sensor_regs()
3946 i2c_w(sd, 0x11, v); mode_init_ov_sensor_regs()
3947 i2c_w(sd, 0x12, qvga ? 0x60 : 0x20); mode_init_ov_sensor_regs()
3964 i2c_w_mask(sd, 0x12, qvga ? 0x40 : 0x00, 0xf0); mode_init_ov_sensor_regs()
3965 i2c_w_mask(sd, 0x32, mode_init_ov_sensor_regs()
3968 i2c_w_mask(sd, 0x03, mode_init_ov_sensor_regs()
3971 i2c_w(sd, 0x17, xstart >> 4); mode_init_ov_sensor_regs()
3972 i2c_w(sd, 0x18, xend >> 4); mode_init_ov_sensor_regs()
3973 i2c_w(sd, 0x19, ystart >> 3); mode_init_ov_sensor_regs()
3974 i2c_w(sd, 0x1a, yend >> 3); mode_init_ov_sensor_regs()
3978 i2c_w_mask(sd, OV7610_REG_COM_C, qvga ? (1 << 5) : 0, 1 << 5); mode_init_ov_sensor_regs()
3979 i2c_w_mask(sd, 0x13, 0x00, 0x20); /* Select 16 bit data bus */ mode_init_ov_sensor_regs()
3980 i2c_w_mask(sd, 0x12, 0x04, 0x06); /* AWB: 1 Test pattern: 0 */ mode_init_ov_sensor_regs()
3981 i2c_w_mask(sd, 0x2d, 0x00, 0x40); /* from windrv 090403 */ mode_init_ov_sensor_regs()
3982 i2c_w_mask(sd, 0x28, 0x20, 0x20); /* progressive mode on */ mode_init_ov_sensor_regs()
3985 i2c_w_mask(sd, 0x14, qvga ? 0x20 : 0x00, 0x20); mode_init_ov_sensor_regs()
3986 i2c_w(sd, 0x35, qvga ? 0x1e : 0x9e); mode_init_ov_sensor_regs()
3987 i2c_w_mask(sd, 0x13, 0x00, 0x20); /* Select 16 bit data bus */ mode_init_ov_sensor_regs()
3988 i2c_w_mask(sd, 0x12, 0x04, 0x06); /* AWB: 1 Test pattern: 0 */ mode_init_ov_sensor_regs()
3993 i2c_w_mask(sd, 0x14, qvga ? 0x20 : 0x00, 0x20); mode_init_ov_sensor_regs()
3994 i2c_w_mask(sd, 0x28, qvga ? 0x00 : 0x20, 0x20); mode_init_ov_sensor_regs()
3995 i2c_w(sd, 0x24, qvga ? 0x20 : 0x3a); mode_init_ov_sensor_regs()
3996 i2c_w(sd, 0x25, qvga ? 0x30 : 0x60); mode_init_ov_sensor_regs()
3997 i2c_w_mask(sd, 0x2d, qvga ? 0x40 : 0x00, 0x40); mode_init_ov_sensor_regs()
3998 i2c_w_mask(sd, 0x67, qvga ? 0xb0 : 0x90, 0xf0); mode_init_ov_sensor_regs()
3999 i2c_w_mask(sd, 0x74, qvga ? 0x20 : 0x00, 0x20); mode_init_ov_sensor_regs()
4000 i2c_w_mask(sd, 0x13, 0x00, 0x20); /* Select 16 bit data bus */ mode_init_ov_sensor_regs()
4001 i2c_w_mask(sd, 0x12, 0x04, 0x06); /* AWB: 1 Test pattern: 0 */ mode_init_ov_sensor_regs()
4002 if (sd->sensor == SEN_OV76BE) mode_init_ov_sensor_regs()
4003 i2c_w(sd, 0x35, qvga ? 0x1e : 0x9e); mode_init_ov_sensor_regs()
4007 i2c_w_mask(sd, 0x14, qvga ? 0x20 : 0x00, 0x20); mode_init_ov_sensor_regs()
4008 i2c_w_mask(sd, 0x28, qvga ? 0x00 : 0x20, 0x20); mode_init_ov_sensor_regs()
4011 i2c_w_mask(sd, 0x2d, qvga ? 0x40 : 0x00, 0x40); mode_init_ov_sensor_regs()
4013 i2c_w_mask(sd, 0x67, qvga ? 0xf0 : 0x90, 0xf0); mode_init_ov_sensor_regs()
4015 i2c_w_mask(sd, 0x74, qvga ? 0x20 : 0x00, 0x20); mode_init_ov_sensor_regs()
4016 i2c_w_mask(sd, 0x12, 0x04, 0x04); /* AWB: 1 */ mode_init_ov_sensor_regs()
4022 i2c_w_mask(sd, OV7670_R12_COM7, mode_init_ov_sensor_regs()
4025 i2c_w_mask(sd, 0x13, 0x00, 0x20); /* Select 16 bit data bus */ mode_init_ov_sensor_regs()
4026 i2c_w_mask(sd, OV7670_R13_COM8, OV7670_COM8_AWB, mode_init_ov_sensor_regs()
4042 i2c_w(sd, OV7670_R17_HSTART, xstart >> 3); mode_init_ov_sensor_regs()
4043 i2c_w(sd, OV7670_R18_HSTOP, xend >> 3); mode_init_ov_sensor_regs()
4044 v = i2c_r(sd, OV7670_R32_HREF); mode_init_ov_sensor_regs()
4048 i2c_w(sd, OV7670_R32_HREF, v); mode_init_ov_sensor_regs()
4050 i2c_w(sd, OV7670_R19_VSTART, ystart >> 2); mode_init_ov_sensor_regs()
4051 i2c_w(sd, OV7670_R1A_VSTOP, yend >> 2); mode_init_ov_sensor_regs()
4052 v = i2c_r(sd, OV7670_R03_VREF); mode_init_ov_sensor_regs()
4056 i2c_w(sd, OV7670_R03_VREF, v); mode_init_ov_sensor_regs()
4059 i2c_w_mask(sd, 0x14, qvga ? 0x20 : 0x00, 0x20); mode_init_ov_sensor_regs()
4060 i2c_w_mask(sd, 0x13, 0x00, 0x20); /* Select 16 bit data bus */ mode_init_ov_sensor_regs()
4061 i2c_w_mask(sd, 0x12, 0x04, 0x06); /* AWB: 1 Test pattern: 0 */ mode_init_ov_sensor_regs()
4065 i2c_w_mask(sd, 0x14, qvga ? 0x20 : 0x00, 0x20); mode_init_ov_sensor_regs()
4066 i2c_w_mask(sd, 0x12, 0x04, 0x06); /* AWB: 1 Test pattern: 0 */ mode_init_ov_sensor_regs()
4087 i2c_w_mask(sd, 0x12, qvga ? 0x40 : 0x00, 0x40); mode_init_ov_sensor_regs()
4089 vals = sd->frame_rate < 30 ? vga_15 : vga_30; mode_init_ov_sensor_regs()
4091 vals = sd->frame_rate < 15 ? sxga_7_5 : sxga_15; mode_init_ov_sensor_regs()
4092 write_i2c_regvals(sd, vals, ARRAY_SIZE(sxga_15)); mode_init_ov_sensor_regs()
4100 i2c_w(sd, 0x11, sd->clockdiv); mode_init_ov_sensor_regs()
4106 struct sd *sd = (struct sd *) gspca_dev; sethvflip() local
4108 if (sd->gspca_dev.streaming) sethvflip()
4109 reg_w(sd, OV519_R51_RESET1, 0x0f); /* block stream */ sethvflip()
4110 i2c_w_mask(sd, OV7670_R1E_MVFP, sethvflip()
4113 if (sd->gspca_dev.streaming) sethvflip()
4114 reg_w(sd, OV519_R51_RESET1, 0x00); /* restart stream */ sethvflip()
4117 static void set_ov_sensor_window(struct sd *sd) set_ov_sensor_window() argument
4124 switch (sd->sensor) { set_ov_sensor_window()
4130 mode_init_ov_sensor_regs(sd); set_ov_sensor_window()
4133 ov519_set_mode(sd); set_ov_sensor_window()
4134 ov519_set_fr(sd); set_ov_sensor_window()
4138 gspca_dev = &sd->gspca_dev; set_ov_sensor_window()
4144 switch (sd->sensor) { set_ov_sensor_window()
4164 if (sd->sensor == SEN_OV66308AF && qvga) set_ov_sensor_window()
4190 switch (sd->sensor) { set_ov_sensor_window()
4222 mode_init_ov_sensor_regs(sd); set_ov_sensor_window()
4224 i2c_w(sd, 0x17, hwsbase); set_ov_sensor_window()
4225 i2c_w(sd, 0x18, hwebase + (sd->sensor_width >> hwscale)); set_ov_sensor_window()
4226 i2c_w(sd, 0x19, vwsbase); set_ov_sensor_window()
4227 i2c_w(sd, 0x1a, vwebase + (sd->sensor_height >> vwscale)); set_ov_sensor_window()
4233 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
4236 sd->sensor_width = sd->gspca_dev.pixfmt.width; sd_start()
4237 sd->sensor_height = sd->gspca_dev.pixfmt.height; sd_start()
4239 switch (sd->bridge) { sd_start()
4242 ov511_mode_init_regs(sd); sd_start()
4246 ov518_mode_init_regs(sd); sd_start()
4249 ov519_mode_init_regs(sd); sd_start()
4253 w9968cf_mode_init_regs(sd); sd_start()
4257 set_ov_sensor_window(sd); sd_start()
4261 sd->snapshot_needs_reset = 1; sd_start()
4264 sd->first_frame = 3; sd_start()
4266 ov51x_restart(sd); sd_start()
4267 ov51x_led_control(sd, 1); sd_start()
4273 struct sd *sd = (struct sd *) gspca_dev; sd_stopN() local
4275 ov51x_stop(sd); sd_stopN()
4276 ov51x_led_control(sd, 0); sd_stopN()
4281 struct sd *sd = (struct sd *) gspca_dev; sd_stop0() local
4283 if (!sd->gspca_dev.present) sd_stop0()
4285 if (sd->bridge == BRIDGE_W9968CF) sd_stop0()
4286 w9968cf_stop0(sd); sd_stop0()
4290 if (sd->snapshot_pressed) { sd_stop0()
4293 sd->snapshot_pressed = 0; sd_stop0()
4296 if (sd->bridge == BRIDGE_OV519) sd_stop0()
4297 reg_w(sd, OV519_R57_SNAPSHOT, 0x23); sd_stop0()
4302 struct sd *sd = (struct sd *) gspca_dev; ov51x_handle_button() local
4304 if (sd->snapshot_pressed != state) { ov51x_handle_button()
4310 sd->snapshot_needs_reset = 1; ov51x_handle_button()
4312 sd->snapshot_pressed = state; ov51x_handle_button()
4317 switch (sd->bridge) { ov51x_handle_button()
4322 sd->snapshot_needs_reset = 1; ov51x_handle_button()
4332 struct sd *sd = (struct sd *) gspca_dev; ov511_pkt_scan() local
4368 sd->packet_nr = 0; ov511_pkt_scan()
4383 struct sd *sd = (struct sd *) gspca_dev; ov518_pkt_scan() local
4391 sd->packet_nr = 0; ov518_pkt_scan()
4400 if (sd->packet_nr == data[len]) ov518_pkt_scan()
4401 sd->packet_nr++; ov518_pkt_scan()
4405 else if (sd->packet_nr == 0 || data[len]) { ov518_pkt_scan()
4407 (int)data[len], (int)sd->packet_nr); ov518_pkt_scan()
4467 struct sd *sd = (struct sd *) gspca_dev; ovfx2_pkt_scan() local
4475 if (sd->first_frame) { ovfx2_pkt_scan()
4476 sd->first_frame--; ovfx2_pkt_scan()
4478 sd->gspca_dev.pixfmt.width * ovfx2_pkt_scan()
4479 sd->gspca_dev.pixfmt.height) ovfx2_pkt_scan()
4491 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
4493 switch (sd->bridge) { sd_pkt_scan()
4518 struct sd *sd = (struct sd *) gspca_dev; setbrightness() local
4536 switch (sd->sensor) { setbrightness()
4545 i2c_w(sd, OV7610_REG_BRT, val); setbrightness()
4549 i2c_w(sd, OV7610_REG_BRT, val); setbrightness()
4552 write_i2c_regvals(sd, brit_7660[val], setbrightness()
4557 * i2c_w_mask(sd, OV7670_R13_COM8, 0, OV7670_COM8_AEC); */ setbrightness()
4558 i2c_w(sd, OV7670_R55_BRIGHT, ov7670_abs_to_sm(val)); setbrightness()
4565 struct sd *sd = (struct sd *) gspca_dev; setcontrast() local
4625 switch (sd->sensor) { setcontrast()
4628 i2c_w(sd, OV7610_REG_CNT, val); setcontrast()
4632 i2c_w_mask(sd, OV7610_REG_CNT, val >> 4, 0x0f); setcontrast()
4640 i2c_w(sd, 0x64, ctab[val >> 5]); setcontrast()
4651 i2c_w(sd, 0x64, ctab[val >> 4]); setcontrast()
4655 write_i2c_regvals(sd, contrast_7660[val], setcontrast()
4660 i2c_w(sd, OV7670_R56_CONTRAS, val >> 1); setcontrast()
4667 struct sd *sd = (struct sd *) gspca_dev; setexposure() local
4669 i2c_w(sd, 0x10, val); setexposure()
4674 struct sd *sd = (struct sd *) gspca_dev; setcolors() local
4688 switch (sd->sensor) { setcolors()
4695 i2c_w(sd, OV7610_REG_SAT, val); setcolors()
4700 /* rc = ov_i2c_write(sd->dev, 0x62, (val >> 9) & 0x7e); setcolors()
4703 i2c_w(sd, OV7610_REG_SAT, val); setcolors()
4707 i2c_w(sd, OV7610_REG_SAT, val & 0xf0); setcolors()
4710 write_i2c_regvals(sd, colors_7660[val], setcolors()
4723 struct sd *sd = (struct sd *) gspca_dev; setautobright() local
4725 i2c_w_mask(sd, 0x2d, val ? 0x10 : 0x00, 0x10); setautobright()
4728 static void setfreq_i(struct sd *sd, s32 val) setfreq_i() argument
4730 if (sd->sensor == SEN_OV7660 setfreq_i()
4731 || sd->sensor == SEN_OV7670) { setfreq_i()
4734 i2c_w_mask(sd, OV7670_R13_COM8, 0, OV7670_COM8_BFILT); setfreq_i()
4737 i2c_w_mask(sd, OV7670_R13_COM8, OV7670_COM8_BFILT, setfreq_i()
4739 i2c_w_mask(sd, OV7670_R3B_COM11, 0x08, 0x18); setfreq_i()
4742 i2c_w_mask(sd, OV7670_R13_COM8, OV7670_COM8_BFILT, setfreq_i()
4744 i2c_w_mask(sd, OV7670_R3B_COM11, 0x00, 0x18); setfreq_i()
4747 i2c_w_mask(sd, OV7670_R13_COM8, OV7670_COM8_BFILT, setfreq_i()
4749 i2c_w_mask(sd, OV7670_R3B_COM11, OV7670_COM11_HZAUTO, setfreq_i()
4756 i2c_w_mask(sd, 0x2d, 0x00, 0x04); setfreq_i()
4757 i2c_w_mask(sd, 0x2a, 0x00, 0x80); setfreq_i()
4760 i2c_w_mask(sd, 0x2d, 0x04, 0x04); setfreq_i()
4761 i2c_w_mask(sd, 0x2a, 0x80, 0x80); setfreq_i()
4763 if (sd->sensor == SEN_OV6620 || setfreq_i()
4764 sd->sensor == SEN_OV6630 || setfreq_i()
4765 sd->sensor == SEN_OV66308AF) setfreq_i()
4766 i2c_w(sd, 0x2b, 0x5e); setfreq_i()
4768 i2c_w(sd, 0x2b, 0xac); setfreq_i()
4771 i2c_w_mask(sd, 0x2d, 0x04, 0x04); setfreq_i()
4772 if (sd->sensor == SEN_OV6620 || setfreq_i()
4773 sd->sensor == SEN_OV6630 || setfreq_i()
4774 sd->sensor == SEN_OV66308AF) { setfreq_i()
4776 i2c_w_mask(sd, 0x2a, 0x80, 0x80); setfreq_i()
4777 i2c_w(sd, 0x2b, 0xa8); setfreq_i()
4780 i2c_w_mask(sd, 0x2a, 0x00, 0x80); setfreq_i()
4789 struct sd *sd = (struct sd *) gspca_dev; setfreq() local
4791 setfreq_i(sd, val); setfreq()
4794 if (sd->bridge == BRIDGE_W9968CF) setfreq()
4795 w9968cf_set_crop_window(sd); setfreq()
4801 struct sd *sd = (struct sd *) gspca_dev; sd_get_jcomp() local
4803 if (sd->bridge != BRIDGE_W9968CF) sd_get_jcomp()
4807 jcomp->quality = v4l2_ctrl_g_ctrl(sd->jpegqual); sd_get_jcomp()
4816 struct sd *sd = (struct sd *) gspca_dev; sd_set_jcomp() local
4818 if (sd->bridge != BRIDGE_W9968CF) sd_set_jcomp()
4821 v4l2_ctrl_s_ctrl(sd->jpegqual, jcomp->quality); sd_set_jcomp()
4829 struct sd *sd = (struct sd *)gspca_dev; sd_g_volatile_ctrl() local
4835 gspca_dev->exposure->val = i2c_r(sd, 0x10); sd_g_volatile_ctrl()
4845 struct sd *sd = (struct sd *)gspca_dev; sd_s_ctrl() local
4865 if (!ctrl->val && sd->brightness->is_new) sd_s_ctrl()
4866 setbrightness(gspca_dev, sd->brightness->val); sd_s_ctrl()
4872 sethvflip(gspca_dev, ctrl->val, sd->vflip->val); sd_s_ctrl()
4893 struct sd *sd = (struct sd *)gspca_dev; sd_init_controls() local
4898 if (valid_controls[sd->sensor].has_brightness) sd_init_controls()
4899 sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
4901 sd->sensor == SEN_OV7660 ? 6 : 255, 1, sd_init_controls()
4902 sd->sensor == SEN_OV7660 ? 3 : 127); sd_init_controls()
4903 if (valid_controls[sd->sensor].has_contrast) { sd_init_controls()
4904 if (sd->sensor == SEN_OV7660) sd_init_controls()
4910 (sd->sensor == SEN_OV6630 || sd_init_controls()
4911 sd->sensor == SEN_OV66308AF) ? 200 : 127); sd_init_controls()
4913 if (valid_controls[sd->sensor].has_sat) sd_init_controls()
4916 sd->sensor == SEN_OV7660 ? 4 : 255, 1, sd_init_controls()
4917 sd->sensor == SEN_OV7660 ? 2 : 127); sd_init_controls()
4918 if (valid_controls[sd->sensor].has_exposure) sd_init_controls()
4921 if (valid_controls[sd->sensor].has_hvflip) { sd_init_controls()
4922 sd->hflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
4924 sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
4927 if (valid_controls[sd->sensor].has_autobright) sd_init_controls()
4928 sd->autobright = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
4930 if (valid_controls[sd->sensor].has_autogain) sd_init_controls()
4933 if (valid_controls[sd->sensor].has_freq) { sd_init_controls()
4934 if (sd->sensor == SEN_OV7670) sd_init_controls()
4935 sd->freq = v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops, sd_init_controls()
4940 sd->freq = v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops, sd_init_controls()
4944 if (sd->bridge == BRIDGE_W9968CF) sd_init_controls()
4945 sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
4955 if (sd->autobright) sd_init_controls()
4956 v4l2_ctrl_auto_cluster(2, &sd->autobright, 0, false); sd_init_controls()
4957 if (sd->hflip) sd_init_controls()
4958 v4l2_ctrl_cluster(2, &sd->hflip); sd_init_controls()
5021 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dsn9c20x.c69 struct sd { struct
691 0x10, 0x61 and sd->hstart, vstart = 3, fixes ugly colored borders */
982 struct sd *sd = (struct sd *) gspca_dev; i2c_w1() local
989 row[0] = sd->i2c_intf | (2 << 4); i2c_w1()
990 row[1] = sd->i2c_addr; i2c_w1()
1012 struct sd *sd = (struct sd *) gspca_dev; i2c_w2() local
1019 row[0] = sd->i2c_intf | (3 << 4); i2c_w2()
1020 row[1] = sd->i2c_addr; i2c_w2()
1042 struct sd *sd = (struct sd *) gspca_dev; i2c_r1() local
1045 row[0] = sd->i2c_intf | (1 << 4); i2c_r1()
1046 row[1] = sd->i2c_addr; i2c_r1()
1054 row[0] = sd->i2c_intf | (1 << 4) | 0x02; i2c_r1()
1063 struct sd *sd = (struct sd *) gspca_dev; i2c_r2() local
1066 row[0] = sd->i2c_intf | (1 << 4); i2c_r2()
1067 row[1] = sd->i2c_addr; i2c_r2()
1075 row[0] = sd->i2c_intf | (2 << 4) | 0x02; i2c_r2()
1085 struct sd *sd = (struct sd *) gspca_dev; ov9650_init_sensor() local
1102 sd->hstart = 1; ov9650_init_sensor()
1103 sd->vstart = 7; ov9650_init_sensor()
1108 struct sd *sd = (struct sd *) gspca_dev; ov9655_init_sensor() local
1116 sd->hstart = 1; ov9655_init_sensor()
1117 sd->vstart = 2; ov9655_init_sensor()
1122 struct sd *sd = (struct sd *) gspca_dev; soi968_init_sensor() local
1130 sd->hstart = 60; soi968_init_sensor()
1131 sd->vstart = 11; soi968_init_sensor()
1136 struct sd *sd = (struct sd *) gspca_dev; ov7660_init_sensor() local
1143 sd->hstart = 3; ov7660_init_sensor()
1144 sd->vstart = 3; ov7660_init_sensor()
1149 struct sd *sd = (struct sd *) gspca_dev; ov7670_init_sensor() local
1157 sd->hstart = 0; ov7670_init_sensor()
1158 sd->vstart = 1; ov7670_init_sensor()
1163 struct sd *sd = (struct sd *) gspca_dev; mt9v_init_sensor() local
1166 sd->i2c_addr = 0x5d; mt9v_init_sensor()
1175 sd->hstart = 2; mt9v_init_sensor()
1176 sd->vstart = 2; mt9v_init_sensor()
1177 sd->sensor = SENSOR_MT9V011; mt9v_init_sensor()
1183 sd->i2c_addr = 0x5c; mt9v_init_sensor()
1193 sd->hstart = 2; mt9v_init_sensor()
1194 sd->vstart = 2; mt9v_init_sensor()
1195 sd->sensor = SENSOR_MT9V111; mt9v_init_sensor()
1201 sd->i2c_addr = 0x5d; mt9v_init_sensor()
1205 sd->i2c_addr = 0x48; mt9v_init_sensor()
1216 sd->hstart = 6; mt9v_init_sensor()
1217 sd->vstart = 2; mt9v_init_sensor()
1218 sd->sensor = SENSOR_MT9V112; mt9v_init_sensor()
1228 struct sd *sd = (struct sd *) gspca_dev; mt9m112_init_sensor() local
1234 sd->hstart = 0; mt9m112_init_sensor()
1235 sd->vstart = 2; mt9m112_init_sensor()
1240 struct sd *sd = (struct sd *) gspca_dev; mt9m111_init_sensor() local
1246 sd->hstart = 0; mt9m111_init_sensor()
1247 sd->vstart = 2; mt9m111_init_sensor()
1252 struct sd *sd = (struct sd *) gspca_dev; mt9m001_init_sensor() local
1278 sd->hstart = 1; mt9m001_init_sensor()
1279 sd->vstart = 1; mt9m001_init_sensor()
1284 struct sd *sd = (struct sd *) gspca_dev; hv7131r_init_sensor() local
1290 sd->hstart = 0; hv7131r_init_sensor()
1291 sd->vstart = 1; hv7131r_init_sensor()
1369 struct sd *sd = (struct sd *) gspca_dev; set_hvflip() local
1371 if ((sd->flags & FLIP_DETECT) && dmi_check_system(flip_dmi_table)) { set_hvflip()
1376 switch (sd->sensor) { set_hvflip()
1383 sd->vstart = 2; set_hvflip()
1385 sd->vstart = 3; set_hvflip()
1387 reg_w1(gspca_dev, 0x1182, sd->vstart); set_hvflip()
1438 struct sd *sd = (struct sd *) gspca_dev; set_exposure() local
1439 u8 exp[8] = {sd->i2c_intf, sd->i2c_addr, set_exposure()
1446 switch (sd->sensor) { set_exposure()
1494 struct sd *sd = (struct sd *) gspca_dev; set_gain() local
1495 u8 gain[8] = {sd->i2c_intf, sd->i2c_addr, set_gain()
1501 switch (sd->sensor) { set_gain()
1541 struct sd *sd = (struct sd *) gspca_dev; set_quality() local
1543 jpeg_set_qual(sd->jpeg_hdr, val); set_quality()
1545 reg_w1(gspca_dev, 0x10e0, sd->fmt | 0x20); /* write QTAB */ set_quality()
1546 reg_w(gspca_dev, 0x1100, &sd->jpeg_hdr[JPEG_QT0_OFFSET], 64); set_quality()
1547 reg_w(gspca_dev, 0x1140, &sd->jpeg_hdr[JPEG_QT1_OFFSET], 64); set_quality()
1549 reg_w1(gspca_dev, 0x10e0, sd->fmt); set_quality()
1550 sd->fmt ^= 0x0c; /* invert QTAB use + write */ set_quality()
1551 reg_w1(gspca_dev, 0x10e0, sd->fmt); set_quality()
1558 struct sd *sd = (struct sd *) gspca_dev; sd_dbg_g_register() local
1569 if (sd->sensor >= SENSOR_MT9V011 && sd_dbg_g_register()
1570 sd->sensor <= SENSOR_MT9M112) { sd_dbg_g_register()
1584 struct sd *sd = (struct sd *) gspca_dev; sd_dbg_s_register() local
1593 if (sd->sensor >= SENSOR_MT9V011 && sd_dbg_s_register()
1594 sd->sensor <= SENSOR_MT9M112) { sd_dbg_s_register()
1618 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
1624 sd->sensor = id->driver_info >> 8; sd_config()
1625 sd->i2c_addr = id->driver_info; sd_config()
1626 sd->flags = id->driver_info >> 16; sd_config()
1627 sd->i2c_intf = 0x80; /* i2c 100 Kb/s */ sd_config()
1629 switch (sd->sensor) { sd_config()
1642 sd->i2c_intf = 0x81; /* i2c 400 Kb/s */ sd_config()
1650 sd->old_step = 0; sd_config()
1651 sd->older_step = 0; sd_config()
1652 sd->exposure_step = 16; sd_config()
1654 INIT_WORK(&sd->work, qual_upd); sd_config()
1663 struct sd *sd = (struct sd *)gspca_dev; sd_s_ctrl() local
1673 set_cmatrix(gspca_dev, sd->brightness->val, sd_s_ctrl()
1674 sd->contrast->val, sd->saturation->val, sd->hue->val); sd_s_ctrl()
1681 set_redblue(gspca_dev, sd->blue->val, sd->red->val); sd_s_ctrl()
1685 set_hvflip(gspca_dev, sd->hflip->val, sd->vflip->val); sd_s_ctrl()
1697 if (sd->sensor == SENSOR_SOI968) sd_s_ctrl()
1698 set_gain(gspca_dev, sd->gain->val); sd_s_ctrl()
1700 set_exposure(gspca_dev, sd->exposure->val); sd_s_ctrl()
1715 struct sd *sd = (struct sd *) gspca_dev; sd_init_controls() local
1721 sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1723 sd->contrast = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1725 sd->saturation = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1727 sd->hue = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1730 sd->gamma = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1733 sd->blue = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1735 sd->red = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1738 if (sd->sensor != SENSOR_OV9655 && sd->sensor != SENSOR_SOI968 && sd_init_controls()
1739 sd->sensor != SENSOR_OV7670 && sd->sensor != SENSOR_MT9M001 && sd_init_controls()
1740 sd->sensor != SENSOR_MT9VPRB) { sd_init_controls()
1741 sd->hflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1743 sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1747 if (sd->sensor != SENSOR_SOI968 && sd->sensor != SENSOR_MT9VPRB && sd_init_controls()
1748 sd->sensor != SENSOR_MT9M112 && sd->sensor != SENSOR_MT9M111 && sd_init_controls()
1749 sd->sensor != SENSOR_MT9V111) sd_init_controls()
1750 sd->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1753 if (sd->sensor != SENSOR_MT9VPRB && sd->sensor != SENSOR_MT9M112 && sd_init_controls()
1754 sd->sensor != SENSOR_MT9M111 && sd->sensor != SENSOR_MT9V111) { sd_init_controls()
1755 sd->gain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1757 sd->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1761 sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1768 v4l2_ctrl_cluster(4, &sd->brightness); sd_init_controls()
1769 v4l2_ctrl_cluster(2, &sd->blue); sd_init_controls()
1770 if (sd->hflip) sd_init_controls()
1771 v4l2_ctrl_cluster(2, &sd->hflip); sd_init_controls()
1772 if (sd->autogain) { sd_init_controls()
1773 if (sd->sensor == SENSOR_SOI968) sd_init_controls()
1776 because sd->exposure == NULL. */ sd_init_controls()
1777 v4l2_ctrl_auto_cluster(3, &sd->autogain, 0, false); sd_init_controls()
1780 v4l2_ctrl_auto_cluster(2, &sd->autogain, 0, false); sd_init_controls()
1787 struct sd *sd = (struct sd *) gspca_dev; sd_init() local
1791 0x80, sd->i2c_addr, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 sd_init()
1803 if (sd->flags & LED_REVERSE) sd_init()
1814 switch (sd->sensor) { sd_init()
1883 struct sd *sd = (struct sd *) gspca_dev; configure_sensor_output() local
1886 switch (sd->sensor) { configure_sensor_output()
1894 sd->hstart = 140; configure_sensor_output()
1895 sd->vstart = 19; configure_sensor_output()
1902 sd->hstart = 60; configure_sensor_output()
1903 sd->vstart = 11; configure_sensor_output()
1987 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
1993 jpeg_define(sd->jpeg_hdr, height, width, sd_start()
1995 jpeg_set_qual(sd->jpeg_hdr, v4l2_ctrl_g_ctrl(sd->jpegqual)); sd_start()
2003 sd->fmt = fmt; sd_start()
2025 reg_w(gspca_dev, 0x1100, &sd->jpeg_hdr[JPEG_QT0_OFFSET], 64); sd_start()
2026 reg_w(gspca_dev, 0x1140, &sd->jpeg_hdr[JPEG_QT1_OFFSET], 64); sd_start()
2028 reg_w(gspca_dev, 0x1180, HW_WIN(mode, sd->hstart, sd->vstart), 6); sd_start()
2032 set_cmatrix(gspca_dev, v4l2_ctrl_g_ctrl(sd->brightness), sd_start()
2033 v4l2_ctrl_g_ctrl(sd->contrast), sd_start()
2034 v4l2_ctrl_g_ctrl(sd->saturation), sd_start()
2035 v4l2_ctrl_g_ctrl(sd->hue)); sd_start()
2036 set_gamma(gspca_dev, v4l2_ctrl_g_ctrl(sd->gamma)); sd_start()
2037 set_redblue(gspca_dev, v4l2_ctrl_g_ctrl(sd->blue), sd_start()
2038 v4l2_ctrl_g_ctrl(sd->red)); sd_start()
2039 if (sd->gain) sd_start()
2040 set_gain(gspca_dev, v4l2_ctrl_g_ctrl(sd->gain)); sd_start()
2041 if (sd->exposure) sd_start()
2042 set_exposure(gspca_dev, v4l2_ctrl_g_ctrl(sd->exposure)); sd_start()
2043 if (sd->hflip) sd_start()
2044 set_hvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip), sd_start()
2045 v4l2_ctrl_g_ctrl(sd->vflip)); sd_start()
2052 sd->pktsz = sd->npkt = 0; sd_start()
2053 sd->nchg = 0; sd_start()
2054 sd->work_thread = sd_start()
2071 struct sd *sd = (struct sd *) gspca_dev; sd_stop0() local
2073 if (sd->work_thread != NULL) { sd_stop0()
2075 destroy_workqueue(sd->work_thread); sd_stop0()
2077 sd->work_thread = NULL; sd_stop0()
2083 struct sd *sd = (struct sd *) gspca_dev; do_autoexposure() local
2084 s32 cur_exp = v4l2_ctrl_g_ctrl(sd->exposure); do_autoexposure()
2085 s32 max = sd->exposure->maximum - sd->exposure_step; do_autoexposure()
2086 s32 min = sd->exposure->minimum + sd->exposure_step; do_autoexposure()
2098 new_exp = cur_exp + sd->exposure_step; do_autoexposure()
2103 v4l2_ctrl_s_ctrl(sd->exposure, new_exp); do_autoexposure()
2105 sd->older_step = sd->old_step; do_autoexposure()
2106 sd->old_step = 1; do_autoexposure()
2108 if (sd->old_step ^ sd->older_step) do_autoexposure()
2109 sd->exposure_step /= 2; do_autoexposure()
2111 sd->exposure_step += 2; do_autoexposure()
2116 new_exp = cur_exp - sd->exposure_step; do_autoexposure()
2121 v4l2_ctrl_s_ctrl(sd->exposure, new_exp); do_autoexposure()
2122 sd->older_step = sd->old_step; do_autoexposure()
2123 sd->old_step = 0; do_autoexposure()
2125 if (sd->old_step ^ sd->older_step) do_autoexposure()
2126 sd->exposure_step /= 2; do_autoexposure()
2128 sd->exposure_step += 2; do_autoexposure()
2134 struct sd *sd = (struct sd *) gspca_dev; do_autogain() local
2135 s32 cur_gain = v4l2_ctrl_g_ctrl(sd->gain); do_autogain()
2137 if (avg_lum < MIN_AVG_LUM && cur_gain < sd->gain->maximum) do_autogain()
2138 v4l2_ctrl_s_ctrl(sd->gain, cur_gain + 1); do_autogain()
2139 if (avg_lum > MAX_AVG_LUM && cur_gain > sd->gain->minimum) do_autogain()
2140 v4l2_ctrl_s_ctrl(sd->gain, cur_gain - 1); do_autogain()
2145 struct sd *sd = (struct sd *) gspca_dev; sd_dqcallback() local
2148 if (sd->autogain == NULL || !v4l2_ctrl_g_ctrl(sd->autogain)) sd_dqcallback()
2151 avg_lum = atomic_read(&sd->avg_lum); sd_dqcallback()
2152 if (sd->sensor == SENSOR_SOI968) sd_dqcallback()
2162 struct sd *sd = container_of(work, struct sd, work); qual_upd() local
2163 struct gspca_dev *gspca_dev = &sd->gspca_dev; qual_upd()
2164 s32 qual = v4l2_ctrl_g_ctrl(sd->jpegqual); qual_upd()
2179 struct sd *sd = (struct sd *) gspca_dev; sd_int_pkt_scan() local
2181 if (!(sd->flags & HAS_NO_BUTTON) && len == 1) { sd_int_pkt_scan()
2196 struct sd *sd = (struct sd *) gspca_dev; transfer_check() local
2208 r = (sd->pktsz * 100) / transfer_check()
2209 (sd->npkt * transfer_check()
2217 sd->nchg += new_qual; transfer_check()
2218 if (sd->nchg < -6 || sd->nchg >= 12) { transfer_check()
2222 s32 curqual = sd->jpegqual->cur.val; transfer_check()
2223 sd->nchg = 0; transfer_check()
2225 if (new_qual < sd->jpegqual->minimum) transfer_check()
2226 new_qual = sd->jpegqual->minimum; transfer_check()
2227 else if (new_qual > sd->jpegqual->maximum) transfer_check()
2228 new_qual = sd->jpegqual->maximum; transfer_check()
2230 sd->jpegqual->cur.val = new_qual; transfer_check()
2231 queue_work(sd->work_thread, &sd->work); transfer_check()
2235 sd->nchg = 0; transfer_check()
2237 sd->pktsz = sd->npkt = 0; transfer_check()
2244 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
2250 is_jpeg = (sd->fmt & 0x03) == 0; sd_pkt_scan()
2277 atomic_set(&sd->avg_lum, avg_lum); sd_pkt_scan()
2291 sd->jpeg_hdr, JPEG_HDR_SZ); sd_pkt_scan()
2301 sd->npkt++; sd_pkt_scan()
2302 sd->pktsz += len; sd_pkt_scan()
2382 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dse401.c56 struct sd { struct
188 struct sd *sd = (struct sd *) gspca_dev; setexposure() local
197 sd->expo_change_state = EXPO_CHANGED; setexposure()
219 struct sd *sd = (struct sd *)gspca_dev; sd_config() local
265 sd->fmts[i].width = widths[i]; sd_config()
266 sd->fmts[i].height = heights[i]; sd_config()
267 sd->fmts[i].field = V4L2_FIELD_NONE; sd_config()
268 sd->fmts[i].colorspace = V4L2_COLORSPACE_SRGB; sd_config()
269 sd->fmts[i].priv = 1; sd_config()
275 sd->fmts[i].priv = 2; sd_config()
284 sd->fmts[i].priv = 4; sd_config()
289 if (sd->fmts[i].priv == 1) { sd_config()
291 sd->fmts[i].pixelformat = V4L2_PIX_FMT_SBGGR8; sd_config()
292 sd->fmts[i].bytesperline = widths[i]; sd_config()
293 sd->fmts[i].sizeimage = widths[i] * heights[i]; sd_config()
298 sd->fmts[i].pixelformat = V4L2_PIX_FMT_SE401; sd_config()
299 sd->fmts[i].bytesperline = 0; sd_config()
300 sd->fmts[i].sizeimage = widths[i] * heights[i] * 3; sd_config()
303 sd->fmts[i].priv * sd->fmts[i].priv); sd_config()
307 cam->cam_mode = sd->fmts; sd_config()
312 sd->resetlevel = 0x2d; /* Set initial resetlevel */ sd_config()
316 sd->has_brightness = !!gspca_dev->usb_err; sd_config()
339 struct sd *sd = (struct sd *)gspca_dev; sd_start() local
376 se401_set_feature(gspca_dev, HV7131_REG_ARLV, sd->resetlevel); sd_start()
378 sd->packet_read = 0; sd_start()
379 sd->pixels_read = 0; sd_start()
380 sd->restart_stream = 0; sd_start()
381 sd->resetlevel_frame_count = 0; sd_start()
382 sd->resetlevel_adjust_dir = 0; sd_start()
383 sd->expo_change_state = EXPO_NO_CHANGE; sd_start()
399 struct sd *sd = (struct sd *)gspca_dev; sd_dq_callback() local
404 if (sd->restart_stream) { sd_dq_callback()
407 sd->restart_stream = 0; sd_dq_callback()
413 sd->resetlevel_frame_count++; sd_dq_callback()
414 if (sd->resetlevel_frame_count < 20) sd_dq_callback()
429 oldreset = sd->resetlevel; sd_dq_callback()
431 while (alrc >= 10 && sd->resetlevel < 63) { sd_dq_callback()
432 sd->resetlevel++; sd_dq_callback()
436 while (ahrc >= 20 && sd->resetlevel > 0) { sd_dq_callback()
437 sd->resetlevel--; sd_dq_callback()
442 if (sd->resetlevel > oldreset) sd_dq_callback()
446 if (sd->resetlevel_adjust_dir && sd_dq_callback()
447 sd->resetlevel_adjust_dir != adjust_dir) sd_dq_callback()
448 sd->resetlevel = oldreset + (sd->resetlevel - oldreset) / 2; sd_dq_callback()
450 if (sd->resetlevel != oldreset) { sd_dq_callback()
451 sd->resetlevel_adjust_dir = adjust_dir; sd_dq_callback()
452 se401_set_feature(gspca_dev, HV7131_REG_ARLV, sd->resetlevel); sd_dq_callback()
455 sd->resetlevel_frame_count = 0; sd_dq_callback()
460 struct sd *sd = (struct sd *)gspca_dev; sd_complete_frame() local
462 switch (sd->expo_change_state) { sd_complete_frame()
466 sd->expo_change_state = EXPO_DROP_FRAME; sd_complete_frame()
472 sd->expo_change_state = EXPO_NO_CHANGE; sd_complete_frame()
482 struct sd *sd = (struct sd *)gspca_dev; sd_pkt_scan_janggu() local
486 if (sd->restart_stream) sd_pkt_scan_janggu()
498 if (sd->packet_read < 4) { sd_pkt_scan_janggu()
499 count = 4 - sd->packet_read; sd_pkt_scan_janggu()
502 memcpy(&sd->packet[sd->packet_read], &data[i], count); sd_pkt_scan_janggu()
503 sd->packet_read += count; sd_pkt_scan_janggu()
505 if (sd->packet_read < 4) sd_pkt_scan_janggu()
508 bits = sd->packet[3] + (sd->packet[2] << 8); sd_pkt_scan_janggu()
509 pixels = sd->packet[1] + ((sd->packet[0] & 0x3f) << 8); sd_pkt_scan_janggu()
510 info = (sd->packet[0] & 0xc0) >> 6; sd_pkt_scan_janggu()
524 count = plen - sd->packet_read; sd_pkt_scan_janggu()
527 memcpy(&sd->packet[sd->packet_read], &data[i], count); sd_pkt_scan_janggu()
528 sd->packet_read += count; sd_pkt_scan_janggu()
530 if (sd->packet_read < plen) sd_pkt_scan_janggu()
533 sd->pixels_read += pixels; sd_pkt_scan_janggu()
534 sd->packet_read = 0; sd_pkt_scan_janggu()
538 gspca_frame_add(gspca_dev, INTER_PACKET, sd->packet, sd_pkt_scan_janggu()
542 if (sd->pixels_read != imagesize) { sd_pkt_scan_janggu()
544 sd->pixels_read, imagesize); sd_pkt_scan_janggu()
547 sd_complete_frame(gspca_dev, sd->packet, plen); sd_pkt_scan_janggu()
550 gspca_frame_add(gspca_dev, FIRST_PACKET, sd->packet, sd_pkt_scan_janggu()
552 sd->pixels_read = pixels; sd_pkt_scan_janggu()
559 sd->restart_stream = 1; sd_pkt_scan_janggu()
600 struct sd *sd = (struct sd *)gspca_dev; sd_int_pkt_scan() local
614 if (sd->button_state != state) { sd_int_pkt_scan()
617 sd->button_state = state; sd_int_pkt_scan()
628 struct sd *sd = (struct sd *)gspca_dev; sd_s_ctrl() local
643 setexposure(gspca_dev, ctrl->val, sd->freq->val); sd_s_ctrl()
655 struct sd *sd = (struct sd *)gspca_dev; sd_init_controls() local
660 if (sd->has_brightness) sd_init_controls()
666 sd->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
668 sd->freq = v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops, sd_init_controls()
676 v4l2_ctrl_cluster(2, &sd->exposure); sd_init_controls()
711 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dov534.c60 struct sd { struct
757 struct sd *sd = (struct sd *) gspca_dev; set_frame_rate() local
787 if (sd->sensor != SENSOR_OV772x) set_frame_rate()
797 if (sd->frame_rate >= r->fps) set_frame_rate()
811 struct sd *sd = (struct sd *) gspca_dev; sethue() local
813 if (sd->sensor == SENSOR_OV767x) { sethue()
846 struct sd *sd = (struct sd *) gspca_dev; setsaturation() local
848 if (sd->sensor == SENSOR_OV767x) { setsaturation()
870 struct sd *sd = (struct sd *) gspca_dev; setbrightness() local
872 if (sd->sensor == SENSOR_OV767x) { setbrightness()
883 struct sd *sd = (struct sd *) gspca_dev; setcontrast() local
885 if (sd->sensor == SENSOR_OV767x) setcontrast()
921 struct sd *sd = (struct sd *) gspca_dev; setexposure() local
923 if (sd->sensor == SENSOR_OV767x) { setexposure()
942 struct sd *sd = (struct sd *) gspca_dev; getexposure() local
944 if (sd->sensor == SENSOR_OV767x) { getexposure()
971 struct sd *sd = (struct sd *) gspca_dev; setawb() local
976 if (sd->sensor == SENSOR_OV772x) setawb()
982 if (sd->sensor == SENSOR_OV772x) setawb()
990 struct sd *sd = (struct sd *) gspca_dev; setaec() local
993 data = sd->sensor == SENSOR_OV767x ? setaec()
1016 struct sd *sd = (struct sd *) gspca_dev; sethvflip() local
1019 if (sd->sensor == SENSOR_OV767x) { sethvflip()
1040 struct sd *sd = (struct sd *) gspca_dev; setlightfreq() local
1043 if (sd->sensor == SENSOR_OV767x) { setlightfreq()
1056 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
1064 sd->frame_rate = 30; sd_config()
1071 struct sd *sd = container_of(ctrl->handler, struct sd, ctrl_handler); ov534_g_volatile_ctrl() local
1072 struct gspca_dev *gspca_dev = &sd->gspca_dev; ov534_g_volatile_ctrl()
1077 if (ctrl->val && sd->gain && gspca_dev->streaming) ov534_g_volatile_ctrl()
1078 sd->gain->val = getgain(gspca_dev); ov534_g_volatile_ctrl()
1083 if (ctrl->val == V4L2_EXPOSURE_AUTO && sd->exposure && ov534_g_volatile_ctrl()
1085 sd->exposure->val = getexposure(gspca_dev); ov534_g_volatile_ctrl()
1093 struct sd *sd = container_of(ctrl->handler, struct sd, ctrl_handler); ov534_s_ctrl() local
1094 struct gspca_dev *gspca_dev = &sd->gspca_dev; ov534_s_ctrl()
1116 if (!gspca_dev->usb_err && !ctrl->val && sd->gain) ov534_s_ctrl()
1117 setgain(gspca_dev, sd->gain->val); ov534_s_ctrl()
1126 sd->exposure) ov534_s_ctrl()
1127 setexposure(gspca_dev, sd->exposure->val); ov534_s_ctrl()
1133 sethvflip(gspca_dev, ctrl->val, sd->vflip->val); ov534_s_ctrl()
1136 sethvflip(gspca_dev, sd->hflip->val, ctrl->val); ov534_s_ctrl()
1152 struct sd *sd = (struct sd *) gspca_dev; sd_init_controls() local
1153 struct v4l2_ctrl_handler *hdl = &sd->ctrl_handler; sd_init_controls()
1168 if (sd->sensor == SENSOR_OV767x) { sd_init_controls()
1200 if (sd->sensor == SENSOR_OV772x) sd_init_controls()
1201 sd->hue = v4l2_ctrl_new_std(hdl, &ov534_ctrl_ops, sd_init_controls()
1204 sd->saturation = v4l2_ctrl_new_std(hdl, &ov534_ctrl_ops, sd_init_controls()
1207 sd->brightness = v4l2_ctrl_new_std(hdl, &ov534_ctrl_ops, sd_init_controls()
1210 sd->contrast = v4l2_ctrl_new_std(hdl, &ov534_ctrl_ops, sd_init_controls()
1213 if (sd->sensor == SENSOR_OV772x) { sd_init_controls()
1214 sd->autogain = v4l2_ctrl_new_std(hdl, &ov534_ctrl_ops, sd_init_controls()
1216 sd->gain = v4l2_ctrl_new_std(hdl, &ov534_ctrl_ops, sd_init_controls()
1220 sd->autoexposure = v4l2_ctrl_new_std_menu(hdl, &ov534_ctrl_ops, sd_init_controls()
1224 sd->exposure = v4l2_ctrl_new_std(hdl, &ov534_ctrl_ops, sd_init_controls()
1228 sd->autowhitebalance = v4l2_ctrl_new_std(hdl, &ov534_ctrl_ops, sd_init_controls()
1231 if (sd->sensor == SENSOR_OV772x) sd_init_controls()
1232 sd->sharpness = v4l2_ctrl_new_std(hdl, &ov534_ctrl_ops, sd_init_controls()
1235 sd->hflip = v4l2_ctrl_new_std(hdl, &ov534_ctrl_ops, sd_init_controls()
1237 sd->vflip = v4l2_ctrl_new_std(hdl, &ov534_ctrl_ops, sd_init_controls()
1239 sd->plfreq = v4l2_ctrl_new_std_menu(hdl, &ov534_ctrl_ops, sd_init_controls()
1249 if (sd->sensor == SENSOR_OV772x) sd_init_controls()
1250 v4l2_ctrl_auto_cluster(2, &sd->autogain, 0, true); sd_init_controls()
1252 v4l2_ctrl_auto_cluster(2, &sd->autoexposure, V4L2_EXPOSURE_MANUAL, sd_init_controls()
1261 struct sd *sd = (struct sd *) gspca_dev; sd_init() local
1292 sd->sensor = SENSOR_OV767x; sd_init()
1296 sd->sensor = SENSOR_OV772x; sd_init()
1304 reg_w_array(gspca_dev, bridge_init[sd->sensor].val, sd_init()
1305 bridge_init[sd->sensor].len); sd_init()
1307 sccb_w_array(gspca_dev, sensor_init[sd->sensor].val, sd_init()
1308 sensor_init[sd->sensor].len); sd_init()
1318 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
1342 if (sd->sensor == SENSOR_OV767x) sd_start()
1347 reg_w_array(gspca_dev, bridge_start[sd->sensor][mode].val, sd_start()
1348 bridge_start[sd->sensor][mode].len); sd_start()
1349 sccb_w_array(gspca_dev, sensor_start[sd->sensor][mode].val, sd_start()
1350 sensor_start[sd->sensor][mode].len); sd_start()
1354 if (sd->hue) sd_start()
1355 sethue(gspca_dev, v4l2_ctrl_g_ctrl(sd->hue)); sd_start()
1356 setsaturation(gspca_dev, v4l2_ctrl_g_ctrl(sd->saturation)); sd_start()
1357 if (sd->autogain) sd_start()
1358 setagc(gspca_dev, v4l2_ctrl_g_ctrl(sd->autogain)); sd_start()
1359 setawb(gspca_dev, v4l2_ctrl_g_ctrl(sd->autowhitebalance)); sd_start()
1360 setaec(gspca_dev, v4l2_ctrl_g_ctrl(sd->autoexposure)); sd_start()
1361 if (sd->gain) sd_start()
1362 setgain(gspca_dev, v4l2_ctrl_g_ctrl(sd->gain)); sd_start()
1363 setexposure(gspca_dev, v4l2_ctrl_g_ctrl(sd->exposure)); sd_start()
1364 setbrightness(gspca_dev, v4l2_ctrl_g_ctrl(sd->brightness)); sd_start()
1365 setcontrast(gspca_dev, v4l2_ctrl_g_ctrl(sd->contrast)); sd_start()
1366 if (sd->sharpness) sd_start()
1367 setsharpness(gspca_dev, v4l2_ctrl_g_ctrl(sd->sharpness)); sd_start()
1368 sethvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip), sd_start()
1369 v4l2_ctrl_g_ctrl(sd->vflip)); sd_start()
1370 setlightfreq(gspca_dev, v4l2_ctrl_g_ctrl(sd->plfreq)); sd_start()
1396 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
1433 if (this_pts != sd->last_pts || this_fid != sd->last_fid) { sd_pkt_scan()
1437 sd->last_pts = this_pts; sd_pkt_scan()
1438 sd->last_fid = this_fid; sd_pkt_scan()
1443 sd->last_pts = 0; sd_pkt_scan()
1479 struct sd *sd = (struct sd *) gspca_dev; sd_get_streamparm() local
1483 tpf->denominator = sd->frame_rate; sd_get_streamparm()
1492 struct sd *sd = (struct sd *) gspca_dev; sd_set_streamparm() local
1496 sd->frame_rate = 30; sd_set_streamparm()
1499 sd->frame_rate = tpf->denominator / tpf->numerator; sd_set_streamparm()
1506 tpf->denominator = sd->frame_rate; sd_set_streamparm()
1534 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dsq930x.c36 struct sd { struct
487 static void i2c_write(struct sd *sd, i2c_write() argument
491 struct gspca_dev *gspca_dev = &sd->gspca_dev; i2c_write()
500 sensor = &sensor_tb[sd->sensor]; i2c_write()
592 static void gpio_set(struct sd *sd, u16 val, u16 mask) gpio_set() argument
594 struct gspca_dev *gspca_dev = &sd->gspca_dev; gpio_set()
597 sd->gpio[0] &= ~mask; gpio_set()
598 sd->gpio[0] |= val; gpio_set()
600 ~sd->gpio[0] << 8); gpio_set()
605 sd->gpio[1] &= ~mask; gpio_set()
606 sd->gpio[1] |= val; gpio_set()
608 ~sd->gpio[1] << 8); gpio_set()
612 static void gpio_init(struct sd *sd, gpio_init() argument
615 gpio_set(sd, *gpio++, 0x000f); gpio_init()
616 gpio_set(sd, *gpio++, 0x000f); gpio_init()
617 gpio_set(sd, *gpio++, 0x000f); gpio_init()
618 gpio_set(sd, *gpio++, 0x000f); gpio_init()
619 gpio_set(sd, *gpio, 0x000f); gpio_init()
622 static void bridge_init(struct sd *sd) bridge_init() argument
628 ucbus_write(&sd->gspca_dev, &clkfreq_cmd, 1, 1); bridge_init()
630 gpio_set(sd, SQ930_GPIO_POWER, 0xff00); bridge_init()
635 struct sd *sd = (struct sd *) gspca_dev; cmos_probe() local
648 ucbus_write(&sd->gspca_dev, sensor->cmd, sensor->cmd_len, 8); cmos_probe()
649 gpio_init(sd, sensor->gpio); cmos_probe()
661 sd->sensor = probe_order[i]; cmos_probe()
662 switch (sd->sensor) { cmos_probe()
666 sensor_tb[sd->sensor].name); cmos_probe()
707 static void global_init(struct sd *sd, int first_time) global_init() argument
709 switch (sd->sensor) { global_init()
712 ucbus_write(&sd->gspca_dev, global_init()
715 gpio_init(sd, sensor_tb[sd->sensor].gpio); global_init()
718 if (sd->type != Creative_live_motion) global_init()
719 gpio_set(sd, SQ930_GPIO_EXTRA1, 0x00ff); global_init()
721 gpio_set(sd, 0, 0x00ff); global_init()
724 ucbus_write(&sd->gspca_dev, global_init()
727 gpio_init(sd, sensor_tb[sd->sensor].gpio); global_init()
731 ucbus_write(&sd->gspca_dev, global_init()
735 gpio_init(sd, sensor_tb[sd->sensor].gpio); global_init()
736 gpio_set(sd, SQ930_GPIO_EXTRA2, SQ930_GPIO_EXTRA2); global_init()
741 mt9v111_init(&sd->gspca_dev); global_init()
743 gpio_init(sd, sensor_tb[sd->sensor].gpio); global_init()
748 static void lz24bp_ppl(struct sd *sd, u16 ppl) lz24bp_ppl() argument
755 ucbus_write(&sd->gspca_dev, cmds, ARRAY_SIZE(cmds), 2); lz24bp_ppl()
760 struct sd *sd = (struct sd *) gspca_dev; setexposure() local
770 switch (sd->sensor) { setexposure()
773 min_frclk = sd->sensor == SENSOR_ICX098BQ ? 0x210 : 0x26f; setexposure()
791 sensor = &sensor_tb[sd->sensor]; setexposure()
816 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
819 sd->sensor = id->driver_info >> 8; sd_config()
820 sd->type = id->driver_info; sd_config()
833 struct sd *sd = (struct sd *) gspca_dev; sd_init() local
835 sd->gpio[0] = sd->gpio[1] = 0xff; /* force gpio rewrite */ sd_init()
838 if (sd->sensor != SENSOR_LZ24BP) sd_init()
866 bridge_init(sd); sd_init()
868 if (sd->sensor == SENSOR_MI0360) { sd_init()
872 sd->sensor = SENSOR_ICX098BQ; sd_init()
877 PDEBUG(D_PROBE, "Sensor %s", sensor_tb[sd->sensor].name); sd_init()
878 global_init(sd, 1); sd_init()
886 struct sd *sd = (struct sd *) gspca_dev; send_start() local
891 cap = &capconfig[sd->sensor][mode]; send_start()
905 struct sd *sd = (struct sd *) gspca_dev; sd_isoc_init() local
908 sd->do_ctrl = 0; sd_isoc_init()
917 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
920 bridge_init(sd); sd_start()
921 global_init(sd, 0); sd_start()
924 switch (sd->sensor) { sd_start()
939 gpio_set(sd, SQ930_GPIO_EXTRA2 | SQ930_GPIO_RSTBAR, 0x00ff); sd_start()
942 gpio_set(sd, 0x7f, 0x00ff); sd_start()
946 gpio_set(sd, SQ930_GPIO_EXTRA2 | SQ930_GPIO_RSTBAR, 0x00ff); sd_start()
952 if (sd->type != Creative_live_motion) sd_start()
964 lz24bp_ppl(sd, mode == 1 ? 0x0564 : 0x0310); sd_start()
971 i2c_write(sd, mi0360_init_23, sd_start()
973 i2c_write(sd, mi0360_init_24, sd_start()
975 i2c_write(sd, mi0360_init_25, sd_start()
980 i2c_write(sd, mi0360_start_2, sd_start()
982 i2c_write(sd, mi0360_start_3, sd_start()
990 i2c_write(sd, sd_start()
998 i2c_write(sd, mt9v111_init_0, sd_start()
1000 i2c_write(sd, mt9v111_init_1, sd_start()
1002 i2c_write(sd, mt9v111_init_2, sd_start()
1007 i2c_write(sd, mt9v111_init_3, sd_start()
1009 i2c_write(sd, mt9v111_init_4, sd_start()
1018 if (sd->sensor == SENSOR_MT9V111) sd_start()
1019 gpio_set(sd, SQ930_GPIO_DFL_LED, SQ930_GPIO_DFL_LED); sd_start()
1021 sd->do_ctrl = 1; /* set the exposure */ sd_start()
1028 struct sd *sd = (struct sd *) gspca_dev; sd_stopN() local
1030 if (sd->sensor == SENSOR_MT9V111) sd_stopN()
1031 gpio_set(sd, 0, SQ930_GPIO_DFL_LED); sd_stopN()
1039 struct sd *sd = (struct sd *) gspca_dev; sd_dq_callback() local
1042 if (!sd->do_ctrl || gspca_dev->cam.bulk_nurbs != 0) sd_dq_callback()
1044 sd->do_ctrl = 0; sd_dq_callback()
1046 setexposure(gspca_dev, v4l2_ctrl_g_ctrl(sd->exposure), sd_dq_callback()
1047 v4l2_ctrl_g_ctrl(sd->gain)); sd_dq_callback()
1062 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
1064 if (sd->do_ctrl) sd_pkt_scan()
1075 struct sd *sd = (struct sd *) gspca_dev; sd_s_ctrl() local
1084 setexposure(gspca_dev, ctrl->val, sd->gain->val); sd_s_ctrl()
1097 struct sd *sd = (struct sd *) gspca_dev; sd_init_controls() local
1101 sd->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1103 sd->gain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1110 v4l2_ctrl_cluster(2, &sd->exposure); sd_init_controls()
1147 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dmars.c36 struct sd { struct
160 struct sd *sd = (struct sd *)gspca_dev; mars_s_ctrl() local
167 sd->illum_bottom->val = 0; mars_s_ctrl()
168 if (sd->illum_bottom->is_new && sd->illum_bottom->val) mars_s_ctrl()
169 sd->illum_top->val = 0; mars_s_ctrl()
186 setilluminators(gspca_dev, sd->illum_top->val, mars_s_ctrl()
187 sd->illum_bottom->val); mars_s_ctrl()
205 struct sd *sd = (struct sd *) gspca_dev; sd_init_controls() local
210 sd->brightness = v4l2_ctrl_new_std(hdl, &mars_ctrl_ops, sd_init_controls()
212 sd->saturation = v4l2_ctrl_new_std(hdl, &mars_ctrl_ops, sd_init_controls()
214 sd->gamma = v4l2_ctrl_new_std(hdl, &mars_ctrl_ops, sd_init_controls()
216 sd->sharpness = v4l2_ctrl_new_std(hdl, &mars_ctrl_ops, sd_init_controls()
218 sd->illum_top = v4l2_ctrl_new_std(hdl, &mars_ctrl_ops, sd_init_controls()
220 sd->illum_top->flags |= V4L2_CTRL_FLAG_UPDATE; sd_init_controls()
221 sd->illum_bottom = v4l2_ctrl_new_std(hdl, &mars_ctrl_ops, sd_init_controls()
223 sd->illum_bottom->flags |= V4L2_CTRL_FLAG_UPDATE; sd_init_controls()
228 v4l2_ctrl_cluster(2, &sd->illum_top); sd_init_controls()
252 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
257 jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, sd_start()
260 jpeg_set_qual(sd->jpeg_hdr, QUALITY); sd_start()
279 data[7] = v4l2_ctrl_g_ctrl(sd->gamma) * 0x40; /* reg 0x06: gamma */ sd_start()
311 data[2] = v4l2_ctrl_g_ctrl(sd->saturation) << 3; sd_start()
312 data[3] = ((v4l2_ctrl_g_ctrl(sd->saturation) >> 2) & 0xf8) | 0x04; sd_start()
313 data[4] = v4l2_ctrl_g_ctrl(sd->brightness); /* reg 0x61 = brightness */ sd_start()
320 data[1] = v4l2_ctrl_g_ctrl(sd->sharpness) * 4 + 3; sd_start()
343 setilluminators(gspca_dev, v4l2_ctrl_g_ctrl(sd->illum_top), sd_start()
344 v4l2_ctrl_g_ctrl(sd->illum_bottom)); sd_start()
351 struct sd *sd = (struct sd *) gspca_dev; sd_stopN() local
353 if (v4l2_ctrl_g_ctrl(sd->illum_top) || sd_stopN()
354 v4l2_ctrl_g_ctrl(sd->illum_bottom)) { sd_stopN()
368 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
392 sd->jpeg_hdr, JPEG_HDR_SZ); sd_pkt_scan()
424 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dsn9c2028.h30 struct sd *sd = (struct sd *) gspca_dev; sn9c2028_find_sof() local
35 if (m[i] == sn9c2028_sof_marker[sd->sof_read]) { sn9c2028_find_sof()
36 sd->sof_read++; sn9c2028_find_sof()
37 if (sd->sof_read == sizeof(sn9c2028_sof_marker)) { sn9c2028_find_sof()
42 sd->sof_read = 0; sn9c2028_find_sof()
46 sd->sof_read = 0; sn9c2028_find_sof()
H A Dstv0680.c41 struct sd { struct
110 struct sd *sd = (struct sd *) gspca_dev; stv0680_set_video_mode() local
112 if (sd->current_mode == mode) stv0680_set_video_mode()
129 sd->current_mode = mode; stv0680_set_video_mode()
139 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
183 sd->video_mode = 0x00; /* CIF */ sd_config()
185 sd->video_mode = 0x03; /* QVGA */ sd_config()
199 sd->current_mode = sd->orig_mode = ret; sd_config()
201 ret = stv0680_set_video_mode(gspca_dev, sd->video_mode); sd_config()
215 sd->mode.width = (gspca_dev->usb_buf[4] << 8) | sd_config()
217 sd->mode.height = (gspca_dev->usb_buf[6] << 8) | sd_config()
219 sd->mode.pixelformat = V4L2_PIX_FMT_STV0680; sd_config()
220 sd->mode.field = V4L2_FIELD_NONE; sd_config()
221 sd->mode.bytesperline = sd->mode.width; sd_config()
222 sd->mode.sizeimage = cam->bulk_size; sd_config()
223 sd->mode.colorspace = V4L2_COLORSPACE_SRGB; sd_config()
227 cam->cam_mode = &sd->mode; sd_config()
231 ret = stv0680_set_video_mode(gspca_dev, sd->orig_mode); sd_config()
254 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
256 ret = stv0680_set_video_mode(gspca_dev, sd->video_mode); sd_start()
267 if (stv_sndctrl(gspca_dev, 1, 0x09, sd->video_mode << 8, 0x0) != 0x0) sd_start()
282 struct sd *sd = (struct sd *) gspca_dev; sd_stop0() local
284 if (!sd->gspca_dev.present) sd_stop0()
287 stv0680_set_video_mode(gspca_dev, sd->orig_mode); sd_stop0()
294 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
300 if (len != sd->mode.sizeimage) { sd_pkt_scan()
337 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dsonixb.c60 struct sd { struct
543 struct sd *sd = (struct sd *) gspca_dev; setbrightness() local
545 switch (sd->sensor) { setbrightness()
552 i2cOV[1] = sensor_data[sd->sensor].sensor_addr; setbrightness()
553 i2cOV[3] = sd->brightness->val; setbrightness()
565 if (sd->sensor == SENSOR_PAS106) { setbrightness()
570 if (sd->brightness->val < 127) { setbrightness()
574 i2cpbright[4] = 127 - sd->brightness->val; setbrightness()
576 i2cpbright[4] = sd->brightness->val - 127; setbrightness()
589 struct sd *sd = (struct sd *) gspca_dev; setgain() local
592 switch (sd->sensor) { setgain()
637 if (sd->sensor == SENSOR_OV7630 && gain >= 32) setgain()
640 i2c[1] = sensor_data[sd->sensor].sensor_addr; setgain()
655 if (sd->sensor == SENSOR_PAS106) { setgain()
674 if (sd->bridge == BRIDGE_103) { setgain()
688 struct sd *sd = (struct sd *) gspca_dev; setexposure() local
690 switch (sd->sensor) { setexposure()
738 if (sd->sensor == SENSOR_OV6650) { setexposure()
772 i2c[1] = sensor_data[sd->sensor].sensor_addr; setexposure()
777 if (sd->reg11 == reg11) setexposure()
782 sd->reg11 = reg11; setexposure()
859 struct sd *sd = (struct sd *) gspca_dev; setfreq() local
861 if (sd->sensor == SENSOR_OV6650 || sd->sensor == SENSOR_OV7630) { setfreq()
867 switch (sd->plfreq->val) { setfreq()
874 i2c[3] = (sd->sensor == SENSOR_OV6650) setfreq()
878 i2c[1] = sensor_data[sd->sensor].sensor_addr; setfreq()
885 struct sd *sd = (struct sd *) gspca_dev; do_autogain() local
888 avg_lum = atomic_read(&sd->avg_lum); do_autogain()
892 if (sd->autogain_ignore_frames > 0) { do_autogain()
893 sd->autogain_ignore_frames--; do_autogain()
899 if (sensor_data[sd->sensor].flags & F_SIF) { do_autogain()
908 if (sd->brightness) do_autogain()
909 desired_avg_lum = sd->brightness->val * desired_avg_lum / 127; do_autogain()
914 sd->autogain_ignore_frames = AUTOGAIN_IGNORE_FRAMES; do_autogain()
918 deadzone, gain_knee, sd->exposure_knee)) do_autogain()
919 sd->autogain_ignore_frames = AUTOGAIN_IGNORE_FRAMES; do_autogain()
927 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
935 sd->sensor = id->driver_info >> 8; sd_config()
936 sd->bridge = id->driver_info & 0xff; sd_config()
939 if (!(sensor_data[sd->sensor].flags & F_SIF)) { sd_config()
965 struct sd *sd = (struct sd *)gspca_dev; sd_s_ctrl() local
976 sd->autogain_ignore_frames = AUTOGAIN_IGNORE_FRAMES; sd_s_ctrl()
1008 struct sd *sd = (struct sd *) gspca_dev; sd_init_controls() local
1014 if (sd->sensor == SENSOR_OV6650 || sd->sensor == SENSOR_OV7630 || sd_init_controls()
1015 sd->sensor == SENSOR_PAS106 || sd->sensor == SENSOR_PAS202) sd_init_controls()
1016 sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1020 switch (sd->sensor) { sd_init_controls()
1042 if (sd->bridge == BRIDGE_103) { sd_init_controls()
1052 switch (sd->sensor) { sd_init_controls()
1056 sd->exposure_knee = 964; sd_init_controls()
1064 sd->exposure_knee = 200; sd_init_controls()
1078 if (sd->sensor == SENSOR_OV6650 || sd->sensor == SENSOR_OV7630) sd_init_controls()
1079 sd->plfreq = v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops, sd_init_controls()
1098 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
1105 memcpy(&regs[0x01], sensor_data[sd->sensor].bridge_init, 0x19); sd_start()
1110 if (sd->bridge == BRIDGE_103) { sd_start()
1120 if (sensor_data[sd->sensor].flags & F_SIF) { sd_start()
1142 switch (sd->sensor) { sd_start()
1155 if (sd->bridge == BRIDGE_103) { sd_start()
1163 if (sd->bridge == BRIDGE_103) sd_start()
1185 (sd->bridge == BRIDGE_103) ? 0x30 : 0x1f); sd_start()
1188 i2c_w_vector(gspca_dev, sensor_data[sd->sensor].sensor_init, sd_start()
1189 sensor_data[sd->sensor].sensor_init_size); sd_start()
1192 switch (sd->sensor) { sd_start()
1204 if (sd->bridge == BRIDGE_103) { sd_start()
1232 sd->reg11 = -1; sd_start()
1239 sd->frames_to_drop = 0; sd_start()
1240 sd->autogain_ignore_frames = 0; sd_start()
1243 atomic_set(&sd->avg_lum, -1); sd_start()
1254 struct sd *sd = (struct sd *) gspca_dev; find_sof() local
1255 int i, header_size = (sd->bridge == BRIDGE_103) ? 18 : 12; find_sof()
1267 switch (sd->header_read) { find_sof()
1270 sd->header_read++; find_sof()
1274 sd->header_read++; find_sof()
1276 sd->header_read = 0; find_sof()
1280 sd->header_read++; find_sof()
1282 sd->header_read = 0; find_sof()
1286 sd->header_read++; find_sof()
1288 sd->header_read = 1; find_sof()
1290 sd->header_read = 0; find_sof()
1294 sd->header_read++; find_sof()
1296 sd->header_read = 1; find_sof()
1298 sd->header_read = 0; find_sof()
1302 sd->header_read++; find_sof()
1304 sd->header_read = 1; find_sof()
1306 sd->header_read = 0; find_sof()
1309 sd->header[sd->header_read - 6] = data[i]; find_sof()
1310 sd->header_read++; find_sof()
1311 if (sd->header_read == header_size) { find_sof()
1312 sd->header_read = 0; find_sof()
1325 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
1331 if (sd->bridge == BRIDGE_103) { sd_pkt_scan()
1359 int lum = sd->header[lum_offset] + sd_pkt_scan()
1360 (sd->header[lum_offset + 1] << 8); sd_pkt_scan()
1369 if (lum == 0 && sd->prev_avg_lum != 0) { sd_pkt_scan()
1371 sd->frames_to_drop = 2; sd_pkt_scan()
1372 sd->prev_avg_lum = 0; sd_pkt_scan()
1374 sd->prev_avg_lum = lum; sd_pkt_scan()
1375 atomic_set(&sd->avg_lum, lum); sd_pkt_scan()
1377 if (sd->frames_to_drop) sd_pkt_scan()
1378 sd->frames_to_drop--; sd_pkt_scan()
1461 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dmr97310a.c86 struct sd { struct
192 struct sd *sd = (struct sd *) gspca_dev; sensor_write1() local
197 if (sd->cam_type == CAM_TYPE_CIF) { sensor_write1()
199 confirm_reg = sd->sensor_type ? 0x13 : 0x11; sensor_write1()
355 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
362 sd->do_lcd_stop = 0; sd_config()
386 sd->cam_type = CAM_TYPE_CIF; sd_config()
398 * Name sd->sensor_type reported by sd_config()
411 sd->sensor_type = 0; sd_config()
414 sd->sensor_type = 1; sd_config()
422 sd->sensor_type); sd_config()
424 sd->cam_type = CAM_TYPE_VGA; sd_config()
431 * Name gspca_dev->usb_buf[] sd->sensor_type sd_config()
432 * sd->do_lcd_stop sd_config()
445 sd->sensor_type = 1; sd_config()
446 sd->do_lcd_stop = 0; sd_config()
447 sd->adj_colors = 0; sd_config()
449 sd->sensor_type = 2; sd_config()
460 sd->adj_colors = 1; sd_config()
462 sd->do_lcd_stop = 1; sd_config()
465 sd->sensor_type = 0; sd_config()
479 sd->sensor_type); sd_config()
485 sd->sensor_type = !!force_sensor_type; sd_config()
487 sd->sensor_type); sd_config()
501 struct sd *sd = (struct sd *) gspca_dev; start_cif_cam() local
521 if (sd->sensor_type) start_cif_cam()
533 data[8] = 0x1a + sd->sensor_type; /* reg 7, V start */ start_cif_cam()
542 data[8] = 0x06 - sd->sensor_type; /* reg 7, V start */ start_cif_cam()
549 if (!sd->sensor_type) { start_cif_cam()
570 } else { /* sd->sensor_type = 1 */ start_cif_cam()
603 struct sd *sd = (struct sd *) gspca_dev; start_vga_cam() local
612 if (!sd->sensor_type) { start_vga_cam()
616 if (sd->sensor_type == 2) { start_vga_cam()
634 if (sd->sensor_type == 2) { start_vga_cam()
638 if (sd->do_lcd_stop) start_vga_cam()
650 if (sd->do_lcd_stop) start_vga_cam()
659 if (!sd->sensor_type) { start_vga_cam()
670 } else if (sd->sensor_type == 1) { start_vga_cam()
696 if (sd->adj_colors) start_vga_cam()
756 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
759 sd->sof_read = 0; sd_start()
773 if (sd->cam_type == CAM_TYPE_CIF) { sd_start()
786 struct sd *sd = (struct sd *) gspca_dev; sd_stopN() local
791 if (sd->do_lcd_stop) sd_stopN()
797 struct sd *sd = (struct sd *) gspca_dev; setbrightness() local
803 if (sd->cam_type == CAM_TYPE_VGA) { setbrightness()
816 if (sd->do_lcd_stop) setbrightness()
824 struct sd *sd = (struct sd *) gspca_dev; setexposure() local
828 if (sd->cam_type == CAM_TYPE_CIF && sd->sensor_type == 1) { setexposure()
834 } else if (sd->sensor_type == 2) { setexposure()
855 if (sd->cam_type == CAM_TYPE_VGA && clockdiv < 4) setexposure()
859 exposure = (sd->exposure / 8) * 511 / (1000 * clockdiv / 60) */ setexposure()
876 struct sd *sd = (struct sd *) gspca_dev; setgain() local
879 if (sd->cam_type == CAM_TYPE_CIF && sd->sensor_type == 1) setgain()
881 else if (sd->cam_type == CAM_TYPE_VGA && sd->sensor_type == 2) setgain()
899 struct sd *sd = (struct sd *)gspca_dev; sd_s_ctrl() local
914 setexposure(gspca_dev, sd->exposure->val, sd_s_ctrl()
915 sd->min_clockdiv ? sd->min_clockdiv->val : 0); sd_s_ctrl()
930 struct sd *sd = (struct sd *)gspca_dev; sd_init_controls() local
954 if (sd->cam_type == CAM_TYPE_CIF) { sd_init_controls()
956 if (sd->sensor_type == 0) sd_init_controls()
962 if (sd->sensor_type == 0) sd_init_controls()
964 else if (sd->sensor_type == 2) sd_init_controls()
966 else if (sd->do_lcd_stop) sd_init_controls()
1004 sd->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1008 sd->min_clockdiv = v4l2_ctrl_new_custom(hdl, &clockdiv, NULL); sd_init_controls()
1015 v4l2_ctrl_cluster(2, &sd->exposure); sd_init_controls()
1026 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
1029 sof = pac_find_sof(gspca_dev, &sd->sof_read, data, len); sd_pkt_scan()
1075 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Djeilinj.c58 struct sd { struct
221 struct sd *sd = (struct sd *) gspca_dev; jlj_start() local
249 sd->blocks_left = 0; jlj_start()
253 if (sd->type == SPORTSCAM_DV15) jlj_start()
265 setcamquality(gspca_dev, v4l2_ctrl_g_ctrl(sd->jpegqual)); jlj_start()
267 setfreq(gspca_dev, v4l2_ctrl_g_ctrl(sd->freq)); jlj_start()
276 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
289 sd->blocks_left = data[0x0a] - 1; sd_pkt_scan()
290 PDEBUG(D_STREAM, "blocks_left = 0x%x", sd->blocks_left); sd_pkt_scan()
293 sd->jpeg_hdr, JPEG_HDR_SZ); sd_pkt_scan()
298 } else if (sd->blocks_left > 0) { sd_pkt_scan()
300 sd->blocks_left); sd_pkt_scan()
301 sd->blocks_left -= 1; sd_pkt_scan()
302 if (sd->blocks_left == 0) sd_pkt_scan()
321 struct sd *dev = (struct sd *) gspca_dev; sd_config()
378 struct sd *dev = (struct sd *) gspca_dev; sd_start()
404 struct sd *sd = (struct sd *)gspca_dev; sd_s_ctrl() local
428 jpeg_set_qual(sd->jpeg_hdr, ctrl->val); sd_s_ctrl()
441 struct sd *sd = (struct sd *)gspca_dev; sd_init_controls() local
455 sd->freq = v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops, sd_init_controls()
466 sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
480 struct sd *sd = (struct sd *) gspca_dev; sd_set_jcomp() local
482 v4l2_ctrl_s_ctrl(sd->jpegqual, jcomp->quality); sd_set_jcomp()
489 struct sd *sd = (struct sd *) gspca_dev; sd_get_jcomp() local
492 jcomp->quality = v4l2_ctrl_g_ctrl(sd->jpegqual); sd_get_jcomp()
533 sizeof(struct sd), sd_probe()
H A Dkinect.c60 struct sd { struct
136 struct sd *sd = (struct sd *) gspca_dev; send_cmd() local
139 uint8_t *obuf = sd->obuf; send_cmd()
140 uint8_t *ibuf = sd->ibuf; send_cmd()
152 chdr->tag = cpu_to_le16(sd->cam_tag); send_cmd()
159 sd->cam_tag, cmd_len, res); send_cmd()
205 sd->cam_tag++; send_cmd()
235 struct sd *sd = (struct sd *) gspca_dev; sd_config_video() local
238 sd->cam_tag = 0; sd_config_video()
240 sd->stream_flag = 0x80; sd_config_video()
261 struct sd *sd = (struct sd *) gspca_dev; sd_config_depth() local
264 sd->cam_tag = 0; sd_config_depth()
266 sd->stream_flag = 0x70; sd_config_depth()
393 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
399 uint8_t sof = sd->stream_flag | 1; sd_pkt_scan()
400 uint8_t mof = sd->stream_flag | 2; sd_pkt_scan()
401 uint8_t eof = sd->stream_flag | 5; sd_pkt_scan()
408 sd->stream_flag, hdr->magic[0], hdr->magic[1]); sd_pkt_scan()
465 sizeof(struct sd), THIS_MODULE); sd_probe()
468 sizeof(struct sd), THIS_MODULE); sd_probe()
H A Dpac7302.c113 struct sd { struct
371 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
379 sd->flags = id->driver_info; sd_config()
385 struct sd *sd = (struct sd *) gspca_dev; setbrightcont() local
397 v += (sd->brightness->val - (s32)sd->brightness->maximum) setbrightcont()
398 * 150 / (s32)sd->brightness->maximum; /* 200 ? */ setbrightcont()
399 v -= delta[i] * sd->contrast->val / (s32)sd->contrast->maximum; setbrightcont()
411 struct sd *sd = (struct sd *) gspca_dev; setcolors() local
422 v = a[i] * sd->saturation->val / (s32)sd->saturation->maximum; setcolors()
432 struct sd *sd = (struct sd *) gspca_dev; setwhitebalance() local
435 reg_w(gspca_dev, 0xc6, sd->white_balance->val); setwhitebalance()
460 struct sd *sd = (struct sd *) gspca_dev; setredbalance() local
464 rgbbalance_ctrl_to_reg_value(sd->red_balance->val)); setredbalance()
471 struct sd *sd = (struct sd *) gspca_dev; setbluebalance() local
475 rgbbalance_ctrl_to_reg_value(sd->blue_balance->val)); setbluebalance()
507 * no fps according to the formula: 90 / reg. sd->exposure is the setexposure()
533 * exposure = (sd->exposure / 2) * 448 / (1000 * clockdiv / 90) setexposure()
550 struct sd *sd = (struct sd *) gspca_dev; sethvflip() local
553 hflip = sd->hflip->val; sethvflip()
554 if (sd->flags & FL_HFLIP) sethvflip()
556 vflip = sd->vflip->val; sethvflip()
557 if (sd->flags & FL_VFLIP) sethvflip()
570 struct sd *sd = (struct sd *) gspca_dev; setsharpness() local
573 reg_w(gspca_dev, 0xb6, sd->sharpness->val); setsharpness()
589 struct sd *sd = (struct sd *)gspca_dev; sd_s_ctrl() local
600 sd->autogain_ignore_frames = PAC_AUTOGAIN_IGNORE_FRAMES; sd_s_ctrl()
647 struct sd *sd = (struct sd *) gspca_dev; sd_init_controls() local
653 sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
655 sd->contrast = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
658 sd->saturation = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
660 sd->white_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
663 sd->red_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
668 sd->blue_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
683 sd->hflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
685 sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
688 sd->sharpness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
696 v4l2_ctrl_cluster(2, &sd->brightness); sd_init_controls()
698 v4l2_ctrl_cluster(2, &sd->hflip); sd_init_controls()
705 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
710 sd->sof_read = 0; sd_start()
711 sd->autogain_ignore_frames = 0; sd_start()
712 atomic_set(&sd->avg_lum, 270 + sd->brightness->val); sd_start()
740 struct sd *sd = (struct sd *) gspca_dev; do_autogain() local
741 int avg_lum = atomic_read(&sd->avg_lum); do_autogain()
745 if (sd->autogain_ignore_frames < 0) do_autogain()
748 if (sd->autogain_ignore_frames > 0) { do_autogain()
749 sd->autogain_ignore_frames--; do_autogain()
751 desired_lum = 270 + sd->brightness->val; do_autogain()
756 sd->autogain_ignore_frames = do_autogain()
790 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
794 sof = pac_find_sof(gspca_dev, &sd->sof_read, data, len); sd_pkt_scan()
829 atomic_set(&sd->avg_lum, data[-lum_offset] + sd_pkt_scan()
950 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Detoms.c32 struct sd { struct
410 struct sd *sd = (struct sd *) gspca_dev; setcolors() local
419 if (sd->sensor == SENSOR_PAS106) { setcolors()
429 struct sd *sd = (struct sd *) gspca_dev; getcolors() local
431 if (sd->sensor == SENSOR_PAS106) { getcolors()
441 struct sd *sd = (struct sd *) gspca_dev; setautogain() local
443 if (sd->autogain) setautogain()
444 sd->ag_cnt = AG_CNT_START; setautogain()
446 sd->ag_cnt = -1; setautogain()
553 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
557 sd->sensor = id->driver_info; sd_config()
558 if (sd->sensor == SENSOR_PAS106) { sd_config()
565 sd->ag_cnt = -1; sd_config()
572 struct sd *sd = (struct sd *) gspca_dev; sd_init() local
574 if (sd->sensor == SENSOR_PAS106) sd_init()
586 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
588 if (sd->sensor == SENSOR_PAS106) sd_start()
607 struct sd *sd = (struct sd *) gspca_dev; Et_getgainG() local
609 if (sd->sensor == SENSOR_PAS106) { Et_getgainG()
619 struct sd *sd = (struct sd *) gspca_dev; Et_setgainG() local
621 if (sd->sensor == SENSOR_PAS106) { Et_setgainG()
636 struct sd *sd = (struct sd *) gspca_dev; do_autogain() local
644 if (sd->ag_cnt < 0) do_autogain()
646 if (--sd->ag_cnt >= 0) do_autogain()
648 sd->ag_cnt = AG_CNT_START; do_autogain()
702 struct sd *sd = (struct sd *)gspca_dev; sd_s_ctrl() local
720 sd->autogain = ctrl->val; sd_s_ctrl()
733 struct sd *sd = (struct sd *)gspca_dev; sd_init_controls() local
742 if (sd->sensor == SENSOR_PAS106) sd_init_controls()
779 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dpac207.c64 struct sd { struct
219 struct sd *sd = (struct sd *)gspca_dev; sd_s_ctrl() local
230 sd->autogain_ignore_frames = PAC_AUTOGAIN_IGNORE_FRAMES; sd_s_ctrl()
261 struct sd *sd = (struct sd *) gspca_dev; sd_init_controls() local
267 sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
292 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
307 pac207_write_reg(gspca_dev, 0x08, v4l2_ctrl_g_ctrl(sd->brightness)); sd_start()
333 sd->sof_read = 0; sd_start()
334 sd->autogain_ignore_frames = 0; sd_start()
335 atomic_set(&sd->avg_lum, -1); sd_start()
356 struct sd *sd = (struct sd *) gspca_dev; pac207_do_auto_gain() local
357 int avg_lum = atomic_read(&sd->avg_lum); pac207_do_auto_gain()
362 if (sd->autogain_ignore_frames > 0) pac207_do_auto_gain()
363 sd->autogain_ignore_frames--; pac207_do_auto_gain()
366 sd->autogain_ignore_frames = PAC_AUTOGAIN_IGNORE_FRAMES; pac207_do_auto_gain()
373 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
376 sof = pac_find_sof(gspca_dev, &sd->sof_read, data, len); sd_pkt_scan()
388 sd->header_read = 0; sd_pkt_scan()
393 if (sd->header_read < 11) { sd_pkt_scan()
397 if (sd->header_read < 5) { sd_pkt_scan()
398 needed = 5 - sd->header_read; sd_pkt_scan()
400 atomic_set(&sd->avg_lum, data[needed - 1]); sd_pkt_scan()
403 needed = 11 - sd->header_read; sd_pkt_scan()
405 sd->header_read += len; sd_pkt_scan()
410 sd->header_read = 11; sd_pkt_scan()
473 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dstk1135.c37 struct sd { struct
181 struct sd *sd = (struct sd *) gspca_dev; sensor_set_page() local
183 if (page != sd->sensor_page) { sensor_set_page()
185 sd->sensor_page = page; sensor_set_page()
398 struct sd *sd = (struct sd *) gspca_dev; sd_init() local
424 sd->sensor_page = 0xff; sd_init()
444 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
478 sd->pkt_seq = 0; sd_start()
498 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
513 if (sd->flip_status != flip) sd_pkt_scan()
514 sd->flip_debounce++; sd_pkt_scan()
516 sd->flip_debounce = 0; sd_pkt_scan()
521 if (seq != sd->pkt_seq) { sd_pkt_scan()
524 sd->pkt_seq = seq; sd_pkt_scan()
529 sd->pkt_seq++; sd_pkt_scan()
530 if (sd->pkt_seq > STK1135_HDR_SEQ_MASK) sd_pkt_scan()
531 sd->pkt_seq = 0; sd_pkt_scan()
546 struct sd *sd = (struct sd *) gspca_dev; sethflip() local
548 if (sd->flip_status) sethflip()
555 struct sd *sd = (struct sd *) gspca_dev; setvflip() local
557 if (sd->flip_status) setvflip()
564 struct sd *sd = (struct sd *) gspca_dev; stk1135_dq_callback() local
566 if (sd->flip_debounce > 100) { stk1135_dq_callback()
567 sd->flip_status = !sd->flip_status; stk1135_dq_callback()
568 sethflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip)); stk1135_dq_callback()
569 setvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->vflip)); stk1135_dq_callback()
601 struct sd *sd = (struct sd *) gspca_dev; sd_init_controls() local
606 sd->hflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
608 sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
672 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Djl2005bcd.c42 struct sd { struct
179 struct sd *sd = (struct sd *)gspca_dev; jl2005c_get_firmware_id() local
195 sd->firmware_id[i] = gspca_dev->usb_buf[0]; jl2005c_get_firmware_id()
198 sd->firmware_id[0], jl2005c_get_firmware_id()
199 sd->firmware_id[1], jl2005c_get_firmware_id()
200 sd->firmware_id[2], jl2005c_get_firmware_id()
201 sd->firmware_id[3], jl2005c_get_firmware_id()
202 sd->firmware_id[4], jl2005c_get_firmware_id()
203 sd->firmware_id[5]); jl2005c_get_firmware_id()
319 struct sd *dev = container_of(work, struct sd, work_struct); jl2005c_dostream()
411 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
431 if ((sd->firmware_id[0] & 0xf0) == 0x40) { sd_config()
434 sd->block_size = 0x80; sd_config()
438 sd->block_size = 0x200; sd_config()
441 INIT_WORK(&sd->work_struct, jl2005c_dostream); sd_config()
455 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
456 sd->cap_mode = gspca_dev->cam.cam_mode; sd_start()
481 sd->work_thread = create_singlethread_workqueue(MODULE_NAME); sd_start()
482 queue_work(sd->work_thread, &sd->work_struct); sd_start()
491 struct sd *dev = (struct sd *) gspca_dev; sd_stop0()
523 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dkonica.c49 struct sd { struct
178 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
184 intf = usb_ifnum_to_if(sd->gspca_dev.dev, sd->gspca_dev.iface); sd_start()
185 alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt); sd_start()
246 struct sd *sd = (struct sd *) gspca_dev; sd_stopN() local
252 if (sd->snapshot_pressed) { sd_stopN()
255 sd->snapshot_pressed = 0; sd_stopN()
264 struct sd *sd = (struct sd *) gspca_dev; sd_isoc_irq() local
269 PDEBUG(D_PACK, "sd isoc irq"); sd_isoc_irq()
289 sd->last_data_urb = urb; sd_isoc_irq()
294 data_urb = sd->last_data_urb; sd_isoc_irq()
295 sd->last_data_urb = NULL; sd_isoc_irq()
347 if (sd->snapshot_pressed != button_state) { sd_isoc_irq()
352 sd->snapshot_pressed = button_state; sd_isoc_irq()
467 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dsonixj.c35 struct sd { struct
1238 struct sd *sd = (struct sd *) gspca_dev; i2c_w1() local
1244 switch (sd->sensor) { i2c_w1()
1254 gspca_dev->usb_buf[1] = sd->i2c_addr; i2c_w1()
1304 struct sd *sd = (struct sd *) gspca_dev; i2c_r() local
1307 switch (sd->sensor) { i2c_r()
1317 mode[1] = sd->i2c_addr; i2c_r()
1367 struct sd *sd = (struct sd *) gspca_dev; mi0360_probe() local
1405 sd->sensor = SENSOR_MI0360B; mi0360_probe()
1409 sd->sensor = SENSOR_MT9V111; mi0360_probe()
1422 struct sd *sd = (struct sd *) gspca_dev; ov7630_probe() local
1428 sd->i2c_addr = 0x21; ov7630_probe()
1436 sd->sensor = SENSOR_SOI768; ov7630_probe()
1448 struct sd *sd = (struct sd *) gspca_dev; ov7648_probe() local
1454 sd->i2c_addr = 0x21; ov7648_probe()
1467 sd->i2c_addr = 0x6e; ov7648_probe()
1476 sd->sensor = SENSOR_PO1030; ov7648_probe()
1485 struct sd *sd = (struct sd *) gspca_dev; po2030n_probe() local
1492 sd->i2c_addr = 0x21; po2030n_probe()
1499 sd->sensor = SENSOR_GC0307; po2030n_probe()
1506 sd->i2c_addr = 0x6e; po2030n_probe()
1515 /* sd->sensor = SENSOR_PO2030N; */ po2030n_probe()
1525 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
1528 sd->bridge = id->driver_info >> 16; sd_config()
1529 sd->sensor = id->driver_info >> 8; sd_config()
1530 sd->flags = id->driver_info; sd_config()
1533 if (sd->sensor == SENSOR_ADCM1700) { sd_config()
1542 sd->ag_cnt = -1; sd_config()
1543 sd->quality = QUALITY_DEF; sd_config()
1545 INIT_WORK(&sd->work, qual_upd); sd_config()
1553 struct sd *sd = (struct sd *) gspca_dev; sd_init() local
1569 switch (sd->bridge) { sd_init()
1582 switch (sd->sensor) { sd_init()
1597 switch (sd->bridge) { sd_init()
1611 sn9c1xx = sn_tb[sd->sensor]; sd_init()
1612 sd->i2c_addr = sn9c1xx[9]; sd_init()
1626 struct sd *sd = (struct sd *) gspca_dev; sd_init_controls() local
1632 sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1635 sd->contrast = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1638 sd->saturation = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1640 sd->red_bal = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1642 sd->blue_bal = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1645 sd->gamma = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1648 if (sd->sensor == SENSOR_OM6802) sd_init_controls()
1649 sd->sharpness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1652 sd->sharpness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1655 if (sd->flags & F_ILLUM) sd_init_controls()
1656 sd->illum = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1659 if (sd->sensor == SENSOR_PO2030N) { sd_init_controls()
1664 sd->hflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1668 if (sd->sensor != SENSOR_ADCM1700 && sd->sensor != SENSOR_OV7660 && sd_init_controls()
1669 sd->sensor != SENSOR_PO1030 && sd->sensor != SENSOR_SOI768 && sd_init_controls()
1670 sd->sensor != SENSOR_SP80708) sd_init_controls()
1674 if (sd->sensor == SENSOR_HV7131R || sd->sensor == SENSOR_OV7630 || sd_init_controls()
1675 sd->sensor == SENSOR_OV7648 || sd->sensor == SENSOR_PO2030N) sd_init_controls()
1676 sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
1679 if (sd->sensor == SENSOR_OV7630 || sd->sensor == SENSOR_OV7648 || sd_init_controls()
1680 sd->sensor == SENSOR_OV7660) sd_init_controls()
1681 sd->freq = v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops, sd_init_controls()
1691 v4l2_ctrl_cluster(2, &sd->red_bal); sd_init_controls()
1692 if (sd->sensor == SENSOR_PO2030N) { sd_init_controls()
1693 v4l2_ctrl_cluster(2, &sd->vflip); sd_init_controls()
1703 struct sd *sd = (struct sd *) gspca_dev; expo_adjust() local
1705 switch (sd->sensor) { expo_adjust()
1806 struct sd *sd = (struct sd *) gspca_dev; setbrightness() local
1808 int brightness = sd->brightness->val; setbrightness()
1812 switch (sd->sensor) { setbrightness()
1823 sd->exposure = expo_adjust(gspca_dev, expo); setbrightness()
1828 sd->exposure = expo_adjust(gspca_dev, expo); setbrightness()
1832 sd->exposure = expo_adjust(gspca_dev, expo); setbrightness()
1836 sd->exposure = expo_adjust(gspca_dev, expo); setbrightness()
1840 sd->exposure = expo_adjust(gspca_dev, expo); setbrightness()
1844 sd->exposure = expo_adjust(gspca_dev, expo); setbrightness()
1853 struct sd *sd = (struct sd *) gspca_dev; setcontrast() local
1857 k2 = sd->contrast->val * 37 / (CONTRAST_MAX + 1) setcontrast()
1870 struct sd *sd = (struct sd *) gspca_dev; setcolors() local
1883 colors = sd->saturation->val; setcolors()
1884 if (sd->sensor == SENSOR_MI0360B) setcolors()
1898 struct sd *sd = (struct sd *) gspca_dev; setredblue() local
1900 if (sd->sensor == SENSOR_PO2030N) { setredblue()
1905 rg1b[3] = sd->red_bal->val * 2; setredblue()
1906 rg1b[5] = sd->blue_bal->val * 2; setredblue()
1910 reg_w1(gspca_dev, 0x05, sd->red_bal->val); setredblue()
1912 reg_w1(gspca_dev, 0x06, sd->blue_bal->val); setredblue()
1917 struct sd *sd = (struct sd *) gspca_dev; setgamma() local
1926 switch (sd->sensor) { setgamma()
1946 val = sd->gamma->val; setgamma()
1955 struct sd *sd = (struct sd *) gspca_dev; setexposure() local
1957 if (sd->sensor == SENSOR_PO2030N) { setexposure()
1972 struct sd *sd = (struct sd *) gspca_dev; setautogain() local
1974 switch (sd->sensor) { setautogain()
1979 if (sd->sensor == SENSOR_OV7630) setautogain()
1985 i2c_w1(&sd->gspca_dev, 0x13, comb); setautogain()
1990 sd->ag_cnt = AG_CNT_START; setautogain()
1992 sd->ag_cnt = -1; setautogain()
1997 struct sd *sd = (struct sd *) gspca_dev; setgain() local
1999 if (sd->sensor == SENSOR_PO2030N) { setgain()
2010 struct sd *sd = (struct sd *) gspca_dev; sethvflip() local
2013 switch (sd->sensor) { sethvflip()
2016 if (sd->vflip->val) sethvflip()
2022 if (!sd->vflip->val) sethvflip()
2028 if (sd->vflip->val) sethvflip()
2042 if (sd->hflip->val) sethvflip()
2044 if (sd->vflip->val) sethvflip()
2046 i2c_w1(&sd->gspca_dev, 0x1e, comn); sethvflip()
2053 struct sd *sd = (struct sd *) gspca_dev; setsharpness() local
2055 reg_w1(gspca_dev, 0x99, sd->sharpness->val); setsharpness()
2060 struct sd *sd = (struct sd *) gspca_dev; setillum() local
2062 switch (sd->sensor) { setillum()
2065 sd->illum->val ? 0x64 : 0x60); setillum()
2069 sd->illum->val ? 0x77 : 0x74); setillum()
2079 struct sd *sd = (struct sd *) gspca_dev; setfreq() local
2081 if (sd->sensor == SENSOR_OV7660) { setfreq()
2085 switch (sd->freq->val) { setfreq()
2102 switch (sd->sensor) { setfreq()
2113 switch (sd->freq->val) { setfreq()
2134 struct sd *sd = (struct sd *) gspca_dev; setjpegqual() local
2136 jpeg_set_qual(sd->jpeg_hdr, sd->quality); setjpegqual()
2140 memcpy(gspca_dev->usb_buf, &sd->jpeg_hdr[JPEG_QT0_OFFSET], 64); setjpegqual()
2148 memcpy(gspca_dev->usb_buf, &sd->jpeg_hdr[JPEG_QT1_OFFSET], 64); setjpegqual()
2157 sd->reg18 ^= 0x40; setjpegqual()
2158 reg_w1(gspca_dev, 0x18, sd->reg18); setjpegqual()
2165 struct sd *sd = container_of(work, struct sd, work); qual_upd() local
2166 struct gspca_dev *gspca_dev = &sd->gspca_dev; qual_upd()
2170 PDEBUG(D_STREAM, "qual_upd %d%%", sd->quality); qual_upd()
2179 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
2207 jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, sd_start()
2212 sn9c1xx = sn_tb[sd->sensor]; sd_start()
2217 if (sd->flags & F_PDN_INV) sd_start()
2229 switch (sd->sensor) { sd_start()
2249 switch (sd->sensor) { sd_start()
2274 switch (sd->sensor) { sd_start()
2294 i2c_w_seq(gspca_dev, sensor_init[sd->sensor]); sd_start()
2301 if (sd->sensor == SENSOR_ADCM1700) { sd_start()
2310 if (sd->sensor == SENSOR_ADCM1700) { sd_start()
2318 switch (sd->sensor) { sd_start()
2338 switch (sd->sensor) { sd_start()
2373 switch (sd->sensor) { sd_start()
2443 switch (sd->sensor) { sd_start()
2456 switch (sd->sensor) { sd_start()
2477 sd->reg18 = sn9c1xx[0x18] | (mode << 4) | 0x40; sd_start()
2478 reg_w1(gspca_dev, 0x18, sd->reg18); sd_start()
2483 sd->reg01 = reg01; sd_start()
2484 sd->reg17 = reg17; sd_start()
2486 sd->pktsz = sd->npkt = 0; sd_start()
2487 sd->nchg = sd->short_mark = 0; sd_start()
2488 sd->work_thread = create_singlethread_workqueue(MODULE_NAME); sd_start()
2495 struct sd *sd = (struct sd *) gspca_dev; sd_stopN() local
2507 reg01 = sd->reg01; sd_stopN()
2508 reg17 = sd->reg17 & ~SEN_CLK_EN; sd_stopN()
2509 switch (sd->sensor) { sd_stopN()
2570 struct sd *sd = (struct sd *) gspca_dev; sd_stop0() local
2572 if (sd->work_thread != NULL) { sd_stop0()
2574 destroy_workqueue(sd->work_thread); sd_stop0()
2576 sd->work_thread = NULL; sd_stop0()
2582 struct sd *sd = (struct sd *) gspca_dev; do_autogain() local
2589 if (sd->ag_cnt < 0) do_autogain()
2591 if (--sd->ag_cnt >= 0) do_autogain()
2593 sd->ag_cnt = AG_CNT_START; do_autogain()
2595 delta = atomic_read(&sd->avg_lum); do_autogain()
2598 if (sd->sensor == SENSOR_PO2030N) { do_autogain()
2606 switch (sd->sensor) { do_autogain()
2608 expotimes = sd->exposure; do_autogain()
2612 sd->exposure = expo_adjust(gspca_dev, do_autogain()
2616 expotimes = sd->exposure >> 8; do_autogain()
2620 sd->exposure = expo_adjust(gspca_dev, do_autogain()
2625 expotimes = sd->exposure; do_autogain()
2629 sd->exposure = expo_adjust(gspca_dev, do_autogain()
2637 expotimes = sd->exposure; do_autogain()
2641 sd->exposure = expo_adjust(gspca_dev, do_autogain()
2650 static void set_lum(struct sd *sd, set_lum() argument
2669 atomic_set(&sd->avg_lum, avg_lum); set_lum()
2678 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
2698 sd->npkt++; sd_pkt_scan()
2699 sd->pktsz += len; sd_pkt_scan()
2706 i = sd->short_mark; sd_pkt_scan()
2708 sd->short_mark = 0; sd_pkt_scan()
2740 sd->short_mark = -1; sd_pkt_scan()
2743 sd->jpeg_hdr, JPEG_HDR_SZ); sd_pkt_scan()
2769 r = (sd->pktsz * 100) / sd_pkt_scan()
2770 (sd->npkt * sd_pkt_scan()
2778 sd->nchg += new_qual; sd_pkt_scan()
2779 if (sd->nchg < -6 || sd->nchg >= 12) { sd_pkt_scan()
2780 sd->nchg = 0; sd_pkt_scan()
2781 new_qual += sd->quality; sd_pkt_scan()
2786 if (new_qual != sd->quality) { sd_pkt_scan()
2787 sd->quality = new_qual; sd_pkt_scan()
2788 queue_work(sd->work_thread, &sd->work); sd_pkt_scan()
2792 sd->nchg = 0; sd_pkt_scan()
2794 sd->pktsz = sd->npkt = 0; sd_pkt_scan()
2799 sd->short_mark = i + 62 - len; sd_pkt_scan()
2802 if (sd->ag_cnt >= 0) sd_pkt_scan()
2803 set_lum(sd, data + i); sd_pkt_scan()
2811 sd->jpeg_hdr, JPEG_HDR_SZ); sd_pkt_scan()
2976 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dsunplus.c36 struct sd { struct
451 struct sd *sd = (struct sd *) gspca_dev; spca504B_SetSizeType() local
455 switch (sd->bridge) { spca504B_SetSizeType()
485 if (sd->subtype == AiptekMiniPenCam13) { spca504B_SetSizeType()
527 struct sd *sd = (struct sd *) gspca_dev; setbrightness() local
530 reg = sd->bridge == BRIDGE_SPCA536 ? 0x20f0 : 0x21a7; setbrightness()
536 struct sd *sd = (struct sd *) gspca_dev; setcontrast() local
539 reg = sd->bridge == BRIDGE_SPCA536 ? 0x20f1 : 0x21a8; setcontrast()
545 struct sd *sd = (struct sd *) gspca_dev; setcolors() local
548 reg = sd->bridge == BRIDGE_SPCA536 ? 0x20f6 : 0x21ae; setcolors()
554 struct sd *sd = (struct sd *) gspca_dev; init_ctl_reg() local
557 switch (sd->bridge) { init_ctl_reg()
583 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
588 sd->bridge = id->driver_info >> 8; sd_config()
589 sd->subtype = id->driver_info; sd_config()
591 if (sd->subtype == AiptekMiniPenCam13) { sd_config()
600 sd->bridge = BRIDGE_SPCA504B; sd_config()
601 sd->subtype = 0; sd_config()
608 switch (sd->bridge) { sd_config()
618 if (sd->subtype == MegaImageVI) /* 320x240 only */ sd_config()
634 struct sd *sd = (struct sd *) gspca_dev; sd_init() local
636 switch (sd->bridge) { sd_init()
663 if (sd->subtype == LogitechClickSmart420) sd_init()
675 if (sd->subtype == AiptekMiniPenCam13) { sd_init()
714 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
718 jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, sd_start()
721 jpeg_set_qual(sd->jpeg_hdr, QUALITY); sd_start()
723 if (sd->bridge == BRIDGE_SPCA504B) sd_start()
726 switch (sd->bridge) { sd_start()
731 switch (sd->subtype) { sd_start()
748 if (sd->subtype == AiptekMiniPenCam13) { sd_start()
771 if (sd->subtype == LogitechClickSmart420) { sd_start()
779 enable = (sd->autogain ? 0x04 : 0x01); sd_start()
797 struct sd *sd = (struct sd *) gspca_dev; sd_stopN() local
799 switch (sd->bridge) { sd_stopN()
812 if (sd->subtype == AiptekMiniPenCam13) { sd_stopN()
832 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
837 switch (sd->bridge) { sd_pkt_scan()
903 sd->jpeg_hdr, JPEG_HDR_SZ); sd_pkt_scan()
926 struct sd *sd = (struct sd *)gspca_dev; sd_s_ctrl() local
944 sd->autogain = ctrl->val; sd_s_ctrl()
1060 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dt613.c41 struct sd { struct
504 struct sd *sd = (struct sd *) gspca_dev; setawb_n_RGB() local
509 green_gain = sd->gain->val; setawb_n_RGB()
511 red_gain = green_gain + sd->red_balance->val; setawb_n_RGB()
517 blue_gain = green_gain + sd->blue_balance->val; setawb_n_RGB()
526 all_gain_reg[7] = sensor_data[sd->sensor].reg80; setawb_n_RGB()
527 if (!sd->awb->val) setawb_n_RGB()
544 struct sd *sd = (struct sd *) gspca_dev; setfreq() local
548 switch (sd->sensor) { setfreq()
581 struct sd *sd = (struct sd *) gspca_dev; sd_init() local
600 sd->sensor = SENSOR_TAS5130A; sd_init()
604 sd->sensor = SENSOR_LT168G; sd_init()
608 sd->sensor = SENSOR_OTHER; sd_init()
612 sd->sensor = SENSOR_OM6802; sd_init()
619 if (sd->sensor == SENSOR_OM6802) { sd_init()
644 sensor = &sensor_data[sd->sensor]; sd_init()
648 if (sd->sensor == SENSOR_LT168G) { sd_init()
670 if (sd->sensor == SENSOR_LT168G) { sd_init()
752 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
778 switch (sd->sensor) { sd_start()
798 sensor = &sensor_data[sd->sensor]; sd_start()
799 setfreq(gspca_dev, v4l2_ctrl_g_ctrl(sd->freq)); sd_start()
808 if (sd->sensor == SENSOR_OM6802) sd_start()
816 struct sd *sd = (struct sd *) gspca_dev; sd_stopN() local
818 reg_w_buf(gspca_dev, sensor_data[sd->sensor].stream, sd_stopN()
819 sizeof sensor_data[sd->sensor].stream); sd_stopN()
820 reg_w_buf(gspca_dev, sensor_data[sd->sensor].stream, sd_stopN()
821 sizeof sensor_data[sd->sensor].stream); sd_stopN()
822 if (sd->sensor == SENSOR_OM6802) { sd_stopN()
828 if (sd->button_pressed) { sd_stopN()
831 sd->button_pressed = 0; sd_stopN()
840 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
847 if (sd->button_pressed != state) { sd_pkt_scan()
851 sd->button_pressed = state; sd_pkt_scan()
875 struct sd *sd = (struct sd *)gspca_dev; sd_g_volatile_ctrl() local
900 sd->gain->val = green_gain; sd_g_volatile_ctrl()
901 sd->red_balance->val = red_gain - green_gain; sd_g_volatile_ctrl()
902 sd->blue_balance->val = blue_gain - green_gain; sd_g_volatile_ctrl()
960 struct sd *sd = (struct sd *)gspca_dev; sd_init_controls() local
977 if (sd->sensor == SENSOR_TAS5130A) sd_init_controls()
980 sd->awb = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
982 sd->gain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
984 sd->blue_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
986 sd->red_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
998 sd->freq = v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops, sd_init_controls()
1008 v4l2_ctrl_auto_cluster(4, &sd->awb, 0, true); sd_init_controls()
1038 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dvicam.c47 struct sd { struct
183 struct sd *sd = container_of(work, struct sd, work_struct); vicam_dostream() local
184 struct gspca_dev *gspca_dev = &sd->gspca_dev; vicam_dostream()
224 struct sd *sd = (struct sd *)gspca_dev; sd_config() local
232 INIT_WORK(&sd->work_struct, vicam_dostream); sd_config()
274 struct sd *sd = (struct sd *)gspca_dev; sd_start() local
282 sd->work_thread = create_singlethread_workqueue(MODULE_NAME); sd_start()
283 queue_work(sd->work_thread, &sd->work_struct); sd_start()
292 struct sd *dev = (struct sd *)gspca_dev; sd_stop0()
348 sizeof(struct sd), sd_probe()
H A Dpac7311.c76 struct sd { struct
373 struct sd *sd = (struct sd *)gspca_dev; sd_s_ctrl() local
384 sd->autogain_ignore_frames = PAC_AUTOGAIN_IGNORE_FRAMES; sd_s_ctrl()
401 sethvflip(gspca_dev, sd->hflip->val, 1); sd_s_ctrl()
416 struct sd *sd = (struct sd *) gspca_dev; sd_init_controls() local
422 sd->contrast = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
432 sd->hflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
447 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
449 sd->sof_read = 0; sd_start()
453 setcontrast(gspca_dev, v4l2_ctrl_g_ctrl(sd->contrast)); sd_start()
456 sethvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip), 1); sd_start()
477 sd->sof_read = 0; sd_start()
478 sd->autogain_ignore_frames = 0; sd_start()
479 atomic_set(&sd->avg_lum, -1); sd_start()
504 struct sd *sd = (struct sd *) gspca_dev; do_autogain() local
505 int avg_lum = atomic_read(&sd->avg_lum); do_autogain()
514 if (sd->autogain_ignore_frames > 0) do_autogain()
515 sd->autogain_ignore_frames--; do_autogain()
518 sd->autogain_ignore_frames = PAC_AUTOGAIN_IGNORE_FRAMES; do_autogain()
573 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
577 sof = pac_find_sof(gspca_dev, &sd->sof_read, data, len); sd_pkt_scan()
611 atomic_set(&sd->avg_lum, data[-lum_offset] + sd_pkt_scan()
614 atomic_set(&sd->avg_lum, -1); sd_pkt_scan()
684 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dspca561.c37 struct sd { struct
407 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
434 sd->chip_revision = id->driver_info; sd_config()
435 if (sd->chip_revision == Rev012A) { sd_config()
442 sd->expo12a = EXPO12A_DEF; sd_config()
468 struct sd *sd = (struct sd *) gspca_dev; setbrightness() local
471 if (sd->chip_revision == Rev012A) setbrightness()
484 struct sd *sd = (struct sd *) gspca_dev; setwhite() local
491 if (sd->chip_revision == Rev012A) { setwhite()
561 struct sd *sd = (struct sd *) gspca_dev; setautogain() local
564 sd->ag_cnt = AG_CNT_START; setautogain()
566 sd->ag_cnt = -1; setautogain()
604 struct sd *sd = (struct sd *) gspca_dev; sd_start_72a() local
633 setwhite(gspca_dev, v4l2_ctrl_g_ctrl(sd->hue), sd_start_72a()
634 v4l2_ctrl_g_ctrl(sd->contrast)); sd_start_72a()
636 setautogain(gspca_dev, v4l2_ctrl_g_ctrl(sd->autogain)); sd_start_72a()
643 struct sd *sd = (struct sd *) gspca_dev; sd_stopN() local
645 if (sd->chip_revision == Rev012A) { sd_stopN()
657 struct sd *sd = (struct sd *) gspca_dev; do_autogain() local
667 if (sd->ag_cnt < 0) do_autogain()
669 if (--sd->ag_cnt >= 0) do_autogain()
671 sd->ag_cnt = AG_CNT_START; do_autogain()
673 switch (sd->chip_revision) { do_autogain()
726 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
754 if (sd->chip_revision == Rev012A) { sd_pkt_scan()
774 struct sd *sd = (struct sd *)gspca_dev; sd_s_ctrl() local
787 setwhite(gspca_dev, sd->hue->val, ctrl->val); sd_s_ctrl()
834 struct sd *sd = (struct sd *)gspca_dev; sd_init_controls_72a() local
839 sd->contrast = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls_72a()
841 sd->hue = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls_72a()
845 sd->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls_72a()
852 v4l2_ctrl_cluster(2, &sd->contrast); sd_init_controls_72a()
916 sizeof(struct sd), sd_probe()
H A Dtv8532.c30 struct sd { struct
219 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
251 sd->packet = 0; /* ignore the first packets */ sd_start()
265 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
271 sd->packet = gspca_dev->pixfmt.height / 2; sd_pkt_scan()
273 } else if (sd->packet == 0) sd_pkt_scan()
275 sd->packet--; sd_pkt_scan()
276 if (sd->packet == 0) sd_pkt_scan()
363 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dxirlink_cit.c54 struct sd { struct
870 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
873 sd->model = id->driver_info; sd_config()
874 if (sd->model == CIT_MODEL3 && ibm_netcam_pro) sd_config()
875 sd->model = CIT_IBM_NETCAM_PRO; sd_config()
878 switch (sd->model) { sd_config()
882 sd->sof_len = 4; sd_config()
887 sd->sof_len = 4; sd_config()
896 sd->stop_on_control_change = 1; sd_config()
897 sd->sof_len = 4; sd_config()
907 sd->stop_on_control_change = 1; sd_config()
908 sd->sof_len = 4; sd_config()
1134 struct sd *sd = (struct sd *) gspca_dev; sd_init() local
1136 switch (sd->model) { sd_init()
1156 struct sd *sd = (struct sd *) gspca_dev; cit_set_brightness() local
1159 switch (sd->model) { cit_set_brightness()
1196 struct sd *sd = (struct sd *) gspca_dev; cit_set_contrast() local
1198 switch (sd->model) { cit_set_contrast()
1259 struct sd *sd = (struct sd *) gspca_dev; cit_set_hue() local
1261 switch (sd->model) { cit_set_hue()
1311 struct sd *sd = (struct sd *) gspca_dev; cit_set_sharpness() local
1313 switch (sd->model) { cit_set_sharpness()
1379 struct sd *sd = (struct sd *) gspca_dev; cit_set_lighting() local
1381 switch (sd->model) { cit_set_lighting()
1399 struct sd *sd = (struct sd *) gspca_dev; cit_set_hflip() local
1401 switch (sd->model) { cit_set_hflip()
1419 struct sd *sd = (struct sd *) gspca_dev; cit_restart_stream() local
1421 switch (sd->model) { cit_restart_stream()
1441 sd->sof_read = 0; cit_restart_stream()
1542 struct sd *sd = (struct sd *) gspca_dev; cit_start_model1() local
1699 v4l2_ctrl_g_ctrl(sd->lighting)); cit_start_model1()
1744 struct sd *sd = (struct sd *) gspca_dev; cit_start_model2() local
1765 sd->sof_len = 10; cit_start_model2()
1773 sd->sof_len = 2; cit_start_model2()
1781 sd->sof_len = 2; cit_start_model2()
1789 sd->sof_len = 2; cit_start_model2()
1917 cit_model2_Packet1(gspca_dev, 0x0028, v4l2_ctrl_g_ctrl(sd->lighting)); cit_start_model2()
1919 v4l2_ctrl_grab(sd->lighting, true); cit_start_model2()
2160 /* if (sd->input_index) { */ cit_start_model3()
2176 struct sd *sd = (struct sd *) gspca_dev; cit_start_model4() local
2268 sd->sof_len = 2; cit_start_model4()
2323 sd->sof_len = 2; cit_start_model4()
2380 sd->sof_len = 10; cit_start_model4()
2435 sd->sof_len = 2; cit_start_model4()
2490 sd->sof_len = 2; cit_start_model4()
2579 /* if (sd->input_index) { */ cit_start_ibm_netcam_pro()
2596 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
2603 switch (sd->model) { sd_start()
2698 struct sd *sd = (struct sd *) gspca_dev; sd_stop0() local
2703 switch (sd->model) { sd_stop0()
2717 v4l2_ctrl_grab(sd->lighting, false); sd_stop0()
2764 if (sd->button_state) { sd_stop0()
2767 sd->button_state = 0; sd_stop0()
2774 struct sd *sd = (struct sd *) gspca_dev; cit_find_sof() local
2778 switch (sd->model) { cit_find_sof()
2807 if (sd->model <= CIT_MODEL1) cit_find_sof()
2813 if (sd->model == CIT_MODEL0 && sd->sof_read != i) cit_find_sof()
2816 switch (sd->sof_read) { cit_find_sof()
2819 sd->sof_read++; cit_find_sof()
2823 sd->sof_read++; cit_find_sof()
2825 sd->sof_read = 1; cit_find_sof()
2827 sd->sof_read = 0; cit_find_sof()
2831 sd->sof_read++; cit_find_sof()
2833 sd->sof_read = 1; cit_find_sof()
2835 sd->sof_read = 0; cit_find_sof()
2839 sd->sof_read = 0; cit_find_sof()
2840 return data + i + (sd->sof_len - 3); cit_find_sof()
2843 sd->sof_read = 2; cit_find_sof()
2845 sd->sof_read = 1; cit_find_sof()
2847 sd->sof_read = 0; cit_find_sof()
2857 switch (sd->sof_read) { cit_find_sof()
2860 sd->sof_read++; cit_find_sof()
2863 sd->sof_read = 0; cit_find_sof()
2877 return data + i + (sd->sof_len - 1); cit_find_sof()
2890 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
2899 if (n > sd->sof_len) sd_pkt_scan()
2900 n -= sd->sof_len; sd_pkt_scan()
2917 struct sd *sd = (struct sd *)gspca_dev; cit_check_button() local
2919 switch (sd->model) { cit_check_button()
2937 if (sd->button_state != new_button_state) { cit_check_button()
2941 sd->button_state = new_button_state; cit_check_button()
2950 struct sd *sd = (struct sd *)gspca_dev; sd_s_ctrl() local
2957 if (sd->stop_on_control_change) sd_s_ctrl()
2979 if (sd->stop_on_control_change) sd_s_ctrl()
2990 struct sd *sd = (struct sd *)gspca_dev; sd_init_controls() local
3001 switch (sd->model) { sd_init_controls()
3038 sd->lighting = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
3124 return gspca_dev_probe2(intf, id, desc, sizeof(struct sd), THIS_MODULE); sd_probe()
H A Dspca1528.c33 struct sd { struct
255 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
258 jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, sd_start()
263 jpeg_set_qual(sd->jpeg_hdr, 85); sd_start()
275 sd->pkt_seq = 0; sd_start()
313 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
326 sd->pkt_seq = !(data[1] & 1); sd_pkt_scan()
332 if ((data[1] & 1) != sd->pkt_seq) sd_pkt_scan()
336 sd->jpeg_hdr, JPEG_HDR_SZ); sd_pkt_scan()
429 return gspca_dev_probe2(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
H A Dtouptek.c146 struct sd { struct
541 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
544 sd->this_f = 0; sd_start()
560 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
564 if (sd->this_f + len == gspca_dev->pixfmt.sizeimage) { sd_pkt_scan()
567 sd->this_f, gspca_dev->pixfmt.sizeimage, len); sd_pkt_scan()
572 sd->this_f, gspca_dev->pixfmt.sizeimage, len); sd_pkt_scan()
574 sd->this_f = 0; sd_pkt_scan()
576 if (sd->this_f == 0) sd_pkt_scan()
580 sd->this_f += len; sd_pkt_scan()
593 struct sd *sd = (struct sd *) gspca_dev; sd_s_ctrl() local
609 sd->blue->val = ctrl->val; sd_s_ctrl()
610 setbgain(gspca_dev, sd->blue->val, gspca_dev->gain->val); sd_s_ctrl()
613 sd->red->val = ctrl->val; sd_s_ctrl()
614 setrgain(gspca_dev, sd->red->val, gspca_dev->gain->val); sd_s_ctrl()
626 struct sd *sd = (struct sd *) gspca_dev; sd_init_controls() local
638 sd->blue = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
640 sd->red = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd_init_controls()
701 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
/linux-4.1.27/drivers/scsi/aic7xxx/
H A Daic7xxx_93cx6.c101 #define CLOCK_PULSE(sd, rdy) \
102 while ((SEEPROM_STATUS_INB(sd) & rdy) == 0) { \
105 (void)SEEPROM_INB(sd); /* Clear clock */
111 send_seeprom_cmd(struct seeprom_descriptor *sd, const struct seeprom_cmd *cmd) send_seeprom_cmd() argument
117 temp = sd->sd_MS ^ sd->sd_CS; send_seeprom_cmd()
118 SEEPROM_OUTB(sd, temp ^ sd->sd_CK); send_seeprom_cmd()
119 CLOCK_PULSE(sd, sd->sd_RDY); send_seeprom_cmd()
123 temp ^= sd->sd_DO; send_seeprom_cmd()
124 SEEPROM_OUTB(sd, temp); send_seeprom_cmd()
125 CLOCK_PULSE(sd, sd->sd_RDY); send_seeprom_cmd()
126 SEEPROM_OUTB(sd, temp ^ sd->sd_CK); send_seeprom_cmd()
127 CLOCK_PULSE(sd, sd->sd_RDY); send_seeprom_cmd()
129 temp ^= sd->sd_DO; send_seeprom_cmd()
137 reset_seeprom(struct seeprom_descriptor *sd) reset_seeprom() argument
141 temp = sd->sd_MS; reset_seeprom()
142 SEEPROM_OUTB(sd, temp); reset_seeprom()
143 CLOCK_PULSE(sd, sd->sd_RDY); reset_seeprom()
144 SEEPROM_OUTB(sd, temp ^ sd->sd_CK); reset_seeprom()
145 CLOCK_PULSE(sd, sd->sd_RDY); reset_seeprom()
146 SEEPROM_OUTB(sd, temp); reset_seeprom()
147 CLOCK_PULSE(sd, sd->sd_RDY); reset_seeprom()
155 ahc_read_seeprom(struct seeprom_descriptor *sd, uint16_t *buf, ahc_read_seeprom() argument
172 send_seeprom_cmd(sd, &seeprom_read); ahc_read_seeprom()
175 temp = sd->sd_MS ^ sd->sd_CS; ahc_read_seeprom()
176 for (i = (sd->sd_chip - 1); i >= 0; i--) { ahc_read_seeprom()
178 temp ^= sd->sd_DO; ahc_read_seeprom()
179 SEEPROM_OUTB(sd, temp); ahc_read_seeprom()
180 CLOCK_PULSE(sd, sd->sd_RDY); ahc_read_seeprom()
181 SEEPROM_OUTB(sd, temp ^ sd->sd_CK); ahc_read_seeprom()
182 CLOCK_PULSE(sd, sd->sd_RDY); ahc_read_seeprom()
184 temp ^= sd->sd_DO; ahc_read_seeprom()
195 SEEPROM_OUTB(sd, temp); ahc_read_seeprom()
196 CLOCK_PULSE(sd, sd->sd_RDY); ahc_read_seeprom()
198 if (SEEPROM_DATA_INB(sd) & sd->sd_DI) ahc_read_seeprom()
200 SEEPROM_OUTB(sd, temp ^ sd->sd_CK); ahc_read_seeprom()
201 CLOCK_PULSE(sd, sd->sd_RDY); ahc_read_seeprom()
207 reset_seeprom(sd); ahc_read_seeprom()
227 ahc_write_seeprom(struct seeprom_descriptor *sd, uint16_t *buf, ahc_write_seeprom() argument
236 if (sd->sd_chip == C46) { ahc_write_seeprom()
239 } else if (sd->sd_chip == C56_66) { ahc_write_seeprom()
244 sd->sd_chip); ahc_write_seeprom()
248 send_seeprom_cmd(sd, ewen); ahc_write_seeprom()
249 reset_seeprom(sd); ahc_write_seeprom()
252 temp = sd->sd_MS ^ sd->sd_CS; ahc_write_seeprom()
255 send_seeprom_cmd(sd, &seeprom_write); ahc_write_seeprom()
258 for (i = (sd->sd_chip - 1); i >= 0; i--) { ahc_write_seeprom()
260 temp ^= sd->sd_DO; ahc_write_seeprom()
261 SEEPROM_OUTB(sd, temp); ahc_write_seeprom()
262 CLOCK_PULSE(sd, sd->sd_RDY); ahc_write_seeprom()
263 SEEPROM_OUTB(sd, temp ^ sd->sd_CK); ahc_write_seeprom()
264 CLOCK_PULSE(sd, sd->sd_RDY); ahc_write_seeprom()
266 temp ^= sd->sd_DO; ahc_write_seeprom()
273 temp ^= sd->sd_DO; ahc_write_seeprom()
274 SEEPROM_OUTB(sd, temp); ahc_write_seeprom()
275 CLOCK_PULSE(sd, sd->sd_RDY); ahc_write_seeprom()
276 SEEPROM_OUTB(sd, temp ^ sd->sd_CK); ahc_write_seeprom()
277 CLOCK_PULSE(sd, sd->sd_RDY); ahc_write_seeprom()
279 temp ^= sd->sd_DO; ahc_write_seeprom()
283 temp = sd->sd_MS; ahc_write_seeprom()
284 SEEPROM_OUTB(sd, temp); ahc_write_seeprom()
285 CLOCK_PULSE(sd, sd->sd_RDY); ahc_write_seeprom()
286 temp = sd->sd_MS ^ sd->sd_CS; ahc_write_seeprom()
288 SEEPROM_OUTB(sd, temp); ahc_write_seeprom()
289 CLOCK_PULSE(sd, sd->sd_RDY); ahc_write_seeprom()
290 SEEPROM_OUTB(sd, temp ^ sd->sd_CK); ahc_write_seeprom()
291 CLOCK_PULSE(sd, sd->sd_RDY); ahc_write_seeprom()
292 } while ((SEEPROM_DATA_INB(sd) & sd->sd_DI) == 0); ahc_write_seeprom()
294 reset_seeprom(sd); ahc_write_seeprom()
298 send_seeprom_cmd(sd, ewds); ahc_write_seeprom()
299 reset_seeprom(sd); ahc_write_seeprom()
H A Daic7xxx_93cx6.h83 #define SEEPROM_INB(sd) \
84 ahc_inb(sd->sd_ahc, sd->sd_control_offset)
85 #define SEEPROM_OUTB(sd, value) \
87 ahc_outb(sd->sd_ahc, sd->sd_control_offset, value); \
88 ahc_flush_device_writes(sd->sd_ahc); \
91 #define SEEPROM_STATUS_INB(sd) \
92 ahc_inb(sd->sd_ahc, sd->sd_status_offset)
93 #define SEEPROM_DATA_INB(sd) \
94 ahc_inb(sd->sd_ahc, sd->sd_dataout_offset)
96 int ahc_read_seeprom(struct seeprom_descriptor *sd, uint16_t *buf,
98 int ahc_write_seeprom(struct seeprom_descriptor *sd, uint16_t *buf,
H A Daic7xxx_proc.c191 struct seeprom_descriptor sd; ahc_proc_write_seeprom() local
215 sd.sd_ahc = ahc; ahc_proc_write_seeprom()
218 sd.sd_control_offset = SEECTL; ahc_proc_write_seeprom()
219 sd.sd_status_offset = SEECTL; ahc_proc_write_seeprom()
220 sd.sd_dataout_offset = SEECTL; ahc_proc_write_seeprom()
222 sd.sd_chip = C56_66; ahc_proc_write_seeprom()
224 sd.sd_chip = C46; ahc_proc_write_seeprom()
225 sd.sd_MS = SEEMS; ahc_proc_write_seeprom()
226 sd.sd_RDY = SEERDY; ahc_proc_write_seeprom()
227 sd.sd_CS = SEECS; ahc_proc_write_seeprom()
228 sd.sd_CK = SEECK; ahc_proc_write_seeprom()
229 sd.sd_DO = SEEDO; ahc_proc_write_seeprom()
230 sd.sd_DI = SEEDI; ahc_proc_write_seeprom()
231 have_seeprom = ahc_acquire_seeprom(ahc, &sd); ahc_proc_write_seeprom()
235 sd.sd_control_offset = SEECTL_2840; ahc_proc_write_seeprom()
236 sd.sd_status_offset = STATUS_2840; ahc_proc_write_seeprom()
237 sd.sd_dataout_offset = STATUS_2840; ahc_proc_write_seeprom()
238 sd.sd_chip = C46; ahc_proc_write_seeprom()
239 sd.sd_MS = 0; ahc_proc_write_seeprom()
240 sd.sd_RDY = EEPROM_TF; ahc_proc_write_seeprom()
241 sd.sd_CS = CS_2840; ahc_proc_write_seeprom()
242 sd.sd_CK = CK_2840; ahc_proc_write_seeprom()
243 sd.sd_DO = DO_2840; ahc_proc_write_seeprom()
244 sd.sd_DI = DI_2840; ahc_proc_write_seeprom()
267 ahc_write_seeprom(&sd, (u_int16_t *)buffer, start_addr, ahc_proc_write_seeprom()
269 ahc_read_seeprom(&sd, (uint16_t *)ahc->seep_config, ahc_proc_write_seeprom()
273 ahc_release_seeprom(&sd); ahc_proc_write_seeprom()
/linux-4.1.27/kernel/sched/
H A Dstats.c25 struct sched_domain *sd; show_schedstat() local
45 for_each_domain(cpu, sd) { for_each_domain()
49 cpumask_pr_args(sched_domain_span(sd))); for_each_domain()
53 sd->lb_count[itype], for_each_domain()
54 sd->lb_balanced[itype], for_each_domain()
55 sd->lb_failed[itype], for_each_domain()
56 sd->lb_imbalance[itype], for_each_domain()
57 sd->lb_gained[itype], for_each_domain()
58 sd->lb_hot_gained[itype], for_each_domain()
59 sd->lb_nobusyq[itype], for_each_domain()
60 sd->lb_nobusyg[itype]); for_each_domain()
64 sd->alb_count, sd->alb_failed, sd->alb_pushed, for_each_domain()
65 sd->sbe_count, sd->sbe_balanced, sd->sbe_pushed, for_each_domain()
66 sd->sbf_count, sd->sbf_balanced, sd->sbf_pushed, for_each_domain()
67 sd->ttwu_wake_remote, sd->ttwu_move_affine, for_each_domain()
68 sd->ttwu_move_balance); for_each_domain()
/linux-4.1.27/drivers/char/
H A Dsnsc.c41 struct subch_data_s *sd = subch_data; scdrv_interrupt() local
45 spin_lock_irqsave(&sd->sd_rlock, flags); scdrv_interrupt()
46 spin_lock(&sd->sd_wlock); scdrv_interrupt()
47 status = ia64_sn_irtr_intr(sd->sd_nasid, sd->sd_subch); scdrv_interrupt()
51 wake_up(&sd->sd_rq); scdrv_interrupt()
55 (sd->sd_nasid, sd->sd_subch, scdrv_interrupt()
57 wake_up(&sd->sd_wq); scdrv_interrupt()
60 spin_unlock(&sd->sd_wlock); scdrv_interrupt()
61 spin_unlock_irqrestore(&sd->sd_rlock, flags); scdrv_interrupt()
75 struct subch_data_s *sd; scdrv_open() local
82 sd = kzalloc(sizeof (struct subch_data_s), GFP_KERNEL); scdrv_open()
83 if (sd == NULL) { scdrv_open()
90 sd->sd_nasid = scd->scd_nasid; scdrv_open()
91 sd->sd_subch = ia64_sn_irtr_open(scd->scd_nasid); scdrv_open()
93 if (sd->sd_subch < 0) { scdrv_open()
94 kfree(sd); scdrv_open()
99 spin_lock_init(&sd->sd_rlock); scdrv_open()
100 spin_lock_init(&sd->sd_wlock); scdrv_open()
101 init_waitqueue_head(&sd->sd_rq); scdrv_open()
102 init_waitqueue_head(&sd->sd_wq); scdrv_open()
103 sema_init(&sd->sd_rbs, 1); scdrv_open()
104 sema_init(&sd->sd_wbs, 1); scdrv_open()
106 file->private_data = sd; scdrv_open()
111 IRQF_SHARED, SYSCTL_BASENAME, sd); scdrv_open()
113 ia64_sn_irtr_close(sd->sd_nasid, sd->sd_subch); scdrv_open()
114 kfree(sd); scdrv_open()
132 struct subch_data_s *sd = (struct subch_data_s *) file->private_data; scdrv_release() local
136 free_irq(SGI_UART_VECTOR, sd); scdrv_release()
139 rv = ia64_sn_irtr_close(sd->sd_nasid, sd->sd_subch); scdrv_release()
141 kfree(sd); scdrv_release()
153 read_status_check(struct subch_data_s *sd, int *len) read_status_check() argument
155 return ia64_sn_irtr_recv(sd->sd_nasid, sd->sd_subch, sd->sd_rb, len); read_status_check()
164 struct subch_data_s *sd = (struct subch_data_s *) file->private_data; scdrv_read() local
167 if (down_trylock(&sd->sd_rbs)) { scdrv_read()
175 if (down_interruptible(&sd->sd_rbs)) { scdrv_read()
183 spin_lock_irqsave(&sd->sd_rlock, flags); scdrv_read()
184 status = read_status_check(sd, &len); scdrv_read()
191 spin_unlock_irqrestore(&sd->sd_rlock, flags); scdrv_read()
192 up(&sd->sd_rbs); scdrv_read()
198 add_wait_queue(&sd->sd_rq, &wait); scdrv_read()
199 spin_unlock_irqrestore(&sd->sd_rlock, flags); scdrv_read()
203 remove_wait_queue(&sd->sd_rq, &wait); scdrv_read()
206 up(&sd->sd_rbs); scdrv_read()
210 spin_lock_irqsave(&sd->sd_rlock, flags); scdrv_read()
211 status = read_status_check(sd, &len); scdrv_read()
213 spin_unlock_irqrestore(&sd->sd_rlock, flags); scdrv_read()
224 if (copy_to_user(buf, sd->sd_rb, len)) scdrv_read()
231 up(&sd->sd_rbs); scdrv_read()
245 write_status_check(struct subch_data_s *sd, int count) write_status_check() argument
247 return ia64_sn_irtr_send(sd->sd_nasid, sd->sd_subch, sd->sd_wb, count); write_status_check()
256 struct subch_data_s *sd = (struct subch_data_s *) file->private_data; scdrv_write() local
259 if (down_trylock(&sd->sd_wbs)) { scdrv_write()
267 if (down_interruptible(&sd->sd_wbs)) { scdrv_write()
274 if (copy_from_user(sd->sd_wb, buf, count)) { scdrv_write()
275 up(&sd->sd_wbs); scdrv_write()
280 spin_lock_irqsave(&sd->sd_wlock, flags); scdrv_write()
281 status = write_status_check(sd, count); scdrv_write()
288 spin_unlock(&sd->sd_wlock); scdrv_write()
289 up(&sd->sd_wbs); scdrv_write()
294 add_wait_queue(&sd->sd_wq, &wait); scdrv_write()
295 spin_unlock_irqrestore(&sd->sd_wlock, flags); scdrv_write()
299 remove_wait_queue(&sd->sd_wq, &wait); scdrv_write()
302 up(&sd->sd_wbs); scdrv_write()
306 spin_lock_irqsave(&sd->sd_wlock, flags); scdrv_write()
307 status = write_status_check(sd, count); scdrv_write()
309 spin_unlock_irqrestore(&sd->sd_wlock, flags); scdrv_write()
312 up(&sd->sd_wbs); scdrv_write()
329 struct subch_data_s *sd = (struct subch_data_s *) file->private_data; scdrv_poll() local
332 poll_wait(file, &sd->sd_rq, wait); scdrv_poll()
333 poll_wait(file, &sd->sd_wq, wait); scdrv_poll()
335 spin_lock_irqsave(&sd->sd_rlock, flags); scdrv_poll()
336 spin_lock(&sd->sd_wlock); scdrv_poll()
337 status = ia64_sn_irtr_intr(sd->sd_nasid, sd->sd_subch); scdrv_poll()
338 spin_unlock(&sd->sd_wlock); scdrv_poll()
339 spin_unlock_irqrestore(&sd->sd_rlock, flags); scdrv_poll()
H A Dsnsc_event.c42 struct subch_data_s *sd = subch_data; scdrv_event_interrupt() local
46 spin_lock_irqsave(&sd->sd_rlock, flags); scdrv_event_interrupt()
47 status = ia64_sn_irtr_intr(sd->sd_nasid, sd->sd_subch); scdrv_event_interrupt()
52 spin_unlock_irqrestore(&sd->sd_rlock, flags); scdrv_event_interrupt()
240 struct subch_data_s *sd = event_sd; scdrv_event() local
244 spin_lock_irqsave(&sd->sd_rlock, flags); scdrv_event()
245 status = ia64_sn_irtr_recv(sd->sd_nasid, sd->sd_subch, scdrv_event()
246 sd->sd_rb, &len); scdrv_event()
249 spin_unlock_irqrestore(&sd->sd_rlock, flags); scdrv_event()
250 scdrv_dispatch_event(sd->sd_rb, len); scdrv_event()
252 spin_lock_irqsave(&sd->sd_rlock, flags); scdrv_event()
253 status = ia64_sn_irtr_recv(sd->sd_nasid, sd->sd_subch, scdrv_event()
254 sd->sd_rb, &len); scdrv_event()
256 spin_unlock_irqrestore(&sd->sd_rlock, flags); scdrv_event()
/linux-4.1.27/drivers/media/usb/gspca/stv06xx/
H A Dstv06xx_pb0100.c92 struct sd *sd = (struct sd *)gspca_dev; pb0100_s_ctrl() local
93 struct pb0100_ctrls *ctrls = sd->sensor_priv; pb0100_s_ctrl()
119 static int pb0100_init_controls(struct sd *sd) pb0100_init_controls() argument
121 struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler; pb0100_init_controls()
163 sd->sensor_priv = ctrls; pb0100_init_controls()
168 static int pb0100_probe(struct sd *sd) pb0100_probe() argument
173 err = stv06xx_read_sensor(sd, PB_IDENT, &sensor); pb0100_probe()
182 sd->gspca_dev.cam.cam_mode = pb0100_mode; pb0100_probe()
183 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(pb0100_mode); pb0100_probe()
188 static int pb0100_start(struct sd *sd) pb0100_start() argument
193 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; pb0100_start()
194 struct cam *cam = &sd->gspca_dev.cam; pb0100_start()
195 u32 mode = cam->cam_mode[sd->gspca_dev.curr_mode].priv; pb0100_start()
197 intf = usb_ifnum_to_if(sd->gspca_dev.dev, sd->gspca_dev.iface); pb0100_start()
198 alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt); pb0100_start()
204 max_packet_size = sd->sensor->max_packet_size[sd->gspca_dev.curr_mode]; pb0100_start()
206 stv06xx_write_sensor(sd, PB_ROWSPEED, BIT(4)|BIT(3)|BIT(1)); pb0100_start()
208 stv06xx_write_sensor(sd, PB_ROWSPEED, BIT(5)|BIT(3)|BIT(1)); pb0100_start()
212 stv06xx_write_sensor(sd, PB_RSTART, 30); pb0100_start()
213 stv06xx_write_sensor(sd, PB_CSTART, 20); pb0100_start()
214 stv06xx_write_sensor(sd, PB_RWSIZE, 240 - 1); pb0100_start()
215 stv06xx_write_sensor(sd, PB_CWSIZE, 320 - 1); pb0100_start()
217 stv06xx_write_sensor(sd, PB_RSTART, 8); pb0100_start()
218 stv06xx_write_sensor(sd, PB_CSTART, 4); pb0100_start()
219 stv06xx_write_sensor(sd, PB_RWSIZE, 288 - 1); pb0100_start()
220 stv06xx_write_sensor(sd, PB_CWSIZE, 352 - 1); pb0100_start()
224 stv06xx_write_bridge(sd, STV_Y_CTRL, 0x02); /* Wrong, FIXME */ pb0100_start()
225 stv06xx_write_bridge(sd, STV_X_CTRL, 0x06); pb0100_start()
227 stv06xx_write_bridge(sd, STV_SCAN_RATE, 0x10); pb0100_start()
229 stv06xx_write_bridge(sd, STV_Y_CTRL, 0x01); pb0100_start()
230 stv06xx_write_bridge(sd, STV_X_CTRL, 0x0a); pb0100_start()
232 stv06xx_write_bridge(sd, STV_SCAN_RATE, 0x20); pb0100_start()
235 err = stv06xx_write_sensor(sd, PB_CONTROL, BIT(5)|BIT(3)|BIT(1)); pb0100_start()
241 static int pb0100_stop(struct sd *sd) pb0100_stop() argument
243 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; pb0100_stop()
246 err = stv06xx_write_sensor(sd, PB_ABORTFRAME, 1); pb0100_stop()
252 err = stv06xx_write_sensor(sd, PB_CONTROL, BIT(5)|BIT(3)); pb0100_stop()
263 static int pb0100_init(struct sd *sd) pb0100_init() argument
265 stv06xx_write_bridge(sd, STV_REG00, 1); pb0100_init()
266 stv06xx_write_bridge(sd, STV_SCAN_RATE, 0); pb0100_init()
269 stv06xx_write_sensor(sd, PB_RESET, 1); pb0100_init()
270 stv06xx_write_sensor(sd, PB_RESET, 0); pb0100_init()
273 stv06xx_write_sensor(sd, PB_CONTROL, BIT(5)|BIT(3)); pb0100_init()
276 stv06xx_write_sensor(sd, PB_PREADCTRL, BIT(12)|BIT(10)|BIT(6)); pb0100_init()
277 stv06xx_write_sensor(sd, PB_ADCGLOBALGAIN, 12); pb0100_init()
282 stv06xx_write_sensor(sd, PB_R28, 12); pb0100_init()
284 stv06xx_write_sensor(sd, PB_ADCMAXGAIN, 180); pb0100_init()
286 stv06xx_write_sensor(sd, PB_ADCMINGAIN, 12); pb0100_init()
289 stv06xx_write_sensor(sd, PB_R54, 3); pb0100_init()
292 stv06xx_write_sensor(sd, PB_R55, 0); pb0100_init()
293 stv06xx_write_sensor(sd, PB_UPDATEINT, 1); pb0100_init()
295 stv06xx_write_sensor(sd, PB_R15, 800); pb0100_init()
297 stv06xx_write_sensor(sd, PB_R17, 10); pb0100_init()
299 stv06xx_write_sensor(sd, PB_EXPGAIN, 0); pb0100_init()
302 stv06xx_write_sensor(sd, PB_VOFFSET, 0); pb0100_init()
304 stv06xx_write_sensor(sd, PB_ADCGAINH, 11); pb0100_init()
306 stv06xx_write_sensor(sd, PB_ADCGAINL, 0); pb0100_init()
309 stv06xx_write_bridge(sd, STV_REG00, 0x11); pb0100_init()
310 stv06xx_write_bridge(sd, STV_REG03, 0x45); pb0100_init()
311 stv06xx_write_bridge(sd, STV_REG04, 0x07); pb0100_init()
314 stv06xx_write_sensor(sd, PB_ROWSPEED, BIT(4)|BIT(3)|BIT(1)); pb0100_init()
315 stv06xx_write_sensor(sd, PB_CFILLIN, 14); pb0100_init()
316 stv06xx_write_sensor(sd, PB_VBL, 0); pb0100_init()
317 stv06xx_write_sensor(sd, PB_FINTTIME, 0); pb0100_init()
318 stv06xx_write_sensor(sd, PB_RINTTIME, 123); pb0100_init()
320 stv06xx_write_bridge(sd, STV_REG01, 0xc2); pb0100_init()
321 stv06xx_write_bridge(sd, STV_REG02, 0xb0); pb0100_init()
325 static int pb0100_dump(struct sd *sd) pb0100_dump() argument
333 struct sd *sd = (struct sd *) gspca_dev; pb0100_set_gain() local
334 struct pb0100_ctrls *ctrls = sd->sensor_priv; pb0100_set_gain()
336 err = stv06xx_write_sensor(sd, PB_G1GAIN, val); pb0100_set_gain()
338 err = stv06xx_write_sensor(sd, PB_G2GAIN, val); pb0100_set_gain()
352 struct sd *sd = (struct sd *) gspca_dev; pb0100_set_red_balance() local
353 struct pb0100_ctrls *ctrls = sd->sensor_priv; pb0100_set_red_balance()
361 err = stv06xx_write_sensor(sd, PB_RGAIN, val); pb0100_set_red_balance()
370 struct sd *sd = (struct sd *) gspca_dev; pb0100_set_blue_balance() local
371 struct pb0100_ctrls *ctrls = sd->sensor_priv; pb0100_set_blue_balance()
379 err = stv06xx_write_sensor(sd, PB_BGAIN, val); pb0100_set_blue_balance()
387 struct sd *sd = (struct sd *) gspca_dev; pb0100_set_exposure() local
390 err = stv06xx_write_sensor(sd, PB_RINTTIME, val); pb0100_set_exposure()
399 struct sd *sd = (struct sd *) gspca_dev; pb0100_set_autogain() local
400 struct pb0100_ctrls *ctrls = sd->sensor_priv; pb0100_set_autogain()
410 err = stv06xx_write_sensor(sd, PB_EXPGAIN, val); pb0100_set_autogain()
420 struct sd *sd = (struct sd *) gspca_dev; pb0100_set_autogain_target() local
429 err = stv06xx_write_sensor(sd, PB_R21, brightpixels); pb0100_set_autogain_target()
431 err = stv06xx_write_sensor(sd, PB_R22, darkpixels); pb0100_set_autogain_target()
H A Dstv06xx_st6422.c63 static int setbrightness(struct sd *sd, s32 val);
64 static int setcontrast(struct sd *sd, s32 val);
65 static int setgain(struct sd *sd, u8 gain);
66 static int setexposure(struct sd *sd, s16 expo);
72 struct sd *sd = (struct sd *)gspca_dev; st6422_s_ctrl() local
77 err = setbrightness(sd, ctrl->val); st6422_s_ctrl()
80 err = setcontrast(sd, ctrl->val); st6422_s_ctrl()
83 err = setgain(sd, ctrl->val); st6422_s_ctrl()
86 err = setexposure(sd, ctrl->val); st6422_s_ctrl()
92 err = stv06xx_write_bridge(sd, 0x143f, 0x01); st6422_s_ctrl()
93 sd->gspca_dev.usb_err = err; st6422_s_ctrl()
101 static int st6422_init_controls(struct sd *sd) st6422_init_controls() argument
103 struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler; st6422_init_controls()
118 static int st6422_probe(struct sd *sd) st6422_probe() argument
120 if (sd->bridge != BRIDGE_ST6422) st6422_probe()
125 sd->gspca_dev.cam.cam_mode = st6422_mode; st6422_probe()
126 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(st6422_mode); st6422_probe()
130 static int st6422_init(struct sd *sd) st6422_init() argument
208 err = stv06xx_write_bridge(sd, st6422_bridge_init[i][0], st6422_init()
215 static int setbrightness(struct sd *sd, s32 val) setbrightness() argument
218 return stv06xx_write_bridge(sd, 0x1432, val); setbrightness()
221 static int setcontrast(struct sd *sd, s32 val) setcontrast() argument
224 return stv06xx_write_bridge(sd, 0x143a, val | 0xf0); setcontrast()
227 static int setgain(struct sd *sd, u8 gain) setgain() argument
232 err = stv06xx_write_bridge(sd, 0x0509, gain); setgain()
236 err = stv06xx_write_bridge(sd, 0x050a, gain); setgain()
240 err = stv06xx_write_bridge(sd, 0x050b, gain); setgain()
245 err = stv06xx_write_bridge(sd, 0x050c, 0x2a); setgain()
249 return stv06xx_write_bridge(sd, 0x050d, 0x01); setgain()
252 static int setexposure(struct sd *sd, s16 expo) setexposure() argument
256 err = stv06xx_write_bridge(sd, 0x143d, expo & 0xff); setexposure()
260 return stv06xx_write_bridge(sd, 0x143e, expo >> 8); setexposure()
263 static int st6422_start(struct sd *sd) st6422_start() argument
266 struct cam *cam = &sd->gspca_dev.cam; st6422_start()
268 if (cam->cam_mode[sd->gspca_dev.curr_mode].priv) st6422_start()
269 err = stv06xx_write_bridge(sd, 0x1505, 0x0f); st6422_start()
271 err = stv06xx_write_bridge(sd, 0x1505, 0x02); st6422_start()
276 err = stv06xx_write_bridge(sd, 0x143f, 0x01); st6422_start()
280 static int st6422_stop(struct sd *sd) st6422_stop() argument
282 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; st6422_stop()
H A Dstv06xx_vv6410.c78 static int vv6410_probe(struct sd *sd) vv6410_probe() argument
83 err = stv06xx_read_sensor(sd, VV6410_DEVICEH, &data); vv6410_probe()
92 sd->gspca_dev.cam.cam_mode = vv6410_mode; vv6410_probe()
93 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(vv6410_mode); vv6410_probe()
97 static int vv6410_init_controls(struct sd *sd) vv6410_init_controls() argument
99 struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler; vv6410_init_controls()
116 static int vv6410_init(struct sd *sd) vv6410_init() argument
121 stv06xx_write_bridge(sd, stv_bridge_init[i].addr, stv_bridge_init[i].data); vv6410_init()
126 err = stv06xx_write_sensor_bytes(sd, (u8 *) vv6410_sensor_init, vv6410_init()
131 static int vv6410_start(struct sd *sd) vv6410_start() argument
134 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; vv6410_start()
135 struct cam *cam = &sd->gspca_dev.cam; vv6410_start()
136 u32 priv = cam->cam_mode[sd->gspca_dev.curr_mode].priv; vv6410_start()
140 stv06xx_write_bridge(sd, STV_Y_CTRL, 0x02); vv6410_start()
141 stv06xx_write_bridge(sd, STV_X_CTRL, 0x06); vv6410_start()
143 stv06xx_write_bridge(sd, STV_SCAN_RATE, 0x10); vv6410_start()
145 stv06xx_write_bridge(sd, STV_Y_CTRL, 0x01); vv6410_start()
146 stv06xx_write_bridge(sd, STV_X_CTRL, 0x0a); vv6410_start()
147 stv06xx_write_bridge(sd, STV_SCAN_RATE, 0x00); vv6410_start()
152 err = stv06xx_write_bridge(sd, STV_LED_CTRL, LED_ON); vv6410_start()
156 err = stv06xx_write_sensor(sd, VV6410_SETUP0, 0); vv6410_start()
165 static int vv6410_stop(struct sd *sd) vv6410_stop() argument
167 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; vv6410_stop()
171 err = stv06xx_write_bridge(sd, STV_LED_CTRL, LED_OFF); vv6410_stop()
175 err = stv06xx_write_sensor(sd, VV6410_SETUP0, VV6410_LOW_POWER_MODE); vv6410_stop()
184 static int vv6410_dump(struct sd *sd) vv6410_dump() argument
192 err = stv06xx_read_sensor(sd, i, &data); vv6410_dump()
202 struct sd *sd = (struct sd *) gspca_dev; vv6410_set_hflip() local
204 err = stv06xx_read_sensor(sd, VV6410_DATAFORMAT, &i2c_data); vv6410_set_hflip()
214 err = stv06xx_write_sensor(sd, VV6410_DATAFORMAT, i2c_data); vv6410_set_hflip()
223 struct sd *sd = (struct sd *) gspca_dev; vv6410_set_vflip() local
225 err = stv06xx_read_sensor(sd, VV6410_DATAFORMAT, &i2c_data); vv6410_set_vflip()
235 err = stv06xx_write_sensor(sd, VV6410_DATAFORMAT, i2c_data); vv6410_set_vflip()
243 struct sd *sd = (struct sd *) gspca_dev; vv6410_set_analog_gain() local
246 err = stv06xx_write_sensor(sd, VV6410_ANALOGGAIN, 0xf0 | (val & 0xf)); vv6410_set_analog_gain()
254 struct sd *sd = (struct sd *) gspca_dev; vv6410_set_exposure() local
265 err = stv06xx_write_sensor(sd, VV6410_FINEH, fine >> 8); vv6410_set_exposure()
269 err = stv06xx_write_sensor(sd, VV6410_FINEL, fine & 0xff); vv6410_set_exposure()
273 err = stv06xx_write_sensor(sd, VV6410_COARSEH, coarse >> 8); vv6410_set_exposure()
277 err = stv06xx_write_sensor(sd, VV6410_COARSEL, coarse & 0xff); vv6410_set_exposure()
H A Dstv06xx.c42 int stv06xx_write_bridge(struct sd *sd, u16 address, u16 i2c_data) stv06xx_write_bridge() argument
45 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; stv06xx_write_bridge()
46 struct usb_device *udev = sd->gspca_dev.dev; stv06xx_write_bridge()
47 __u8 *buf = sd->gspca_dev.usb_buf; stv06xx_write_bridge()
64 int stv06xx_read_bridge(struct sd *sd, u16 address, u8 *i2c_data) stv06xx_read_bridge() argument
67 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; stv06xx_read_bridge()
68 struct usb_device *udev = sd->gspca_dev.dev; stv06xx_read_bridge()
69 __u8 *buf = sd->gspca_dev.usb_buf; stv06xx_read_bridge()
85 int stv06xx_write_sensor(struct sd *sd, u8 address, u16 value) stv06xx_write_sensor() argument
87 if (sd->sensor->i2c_len == 2) { stv06xx_write_sensor()
89 return stv06xx_write_sensor_words(sd, data, 1); stv06xx_write_sensor()
92 return stv06xx_write_sensor_bytes(sd, data, 1); stv06xx_write_sensor()
96 static int stv06xx_write_sensor_finish(struct sd *sd) stv06xx_write_sensor_finish() argument
100 if (sd->bridge == BRIDGE_STV610) { stv06xx_write_sensor_finish()
101 struct usb_device *udev = sd->gspca_dev.dev; stv06xx_write_sensor_finish()
102 __u8 *buf = sd->gspca_dev.usb_buf; stv06xx_write_sensor_finish()
113 int stv06xx_write_sensor_bytes(struct sd *sd, const u8 *data, u8 len) stv06xx_write_sensor_bytes() argument
116 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; stv06xx_write_sensor_bytes()
117 struct usb_device *udev = sd->gspca_dev.dev; stv06xx_write_sensor_bytes()
118 __u8 *buf = sd->gspca_dev.usb_buf; stv06xx_write_sensor_bytes()
130 buf[0x20] = sd->sensor->i2c_addr; stv06xx_write_sensor_bytes()
140 return stv06xx_write_sensor_finish(sd); stv06xx_write_sensor_bytes()
143 int stv06xx_write_sensor_words(struct sd *sd, const u16 *data, u8 len) stv06xx_write_sensor_words() argument
146 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; stv06xx_write_sensor_words()
147 struct usb_device *udev = sd->gspca_dev.dev; stv06xx_write_sensor_words()
148 __u8 *buf = sd->gspca_dev.usb_buf; stv06xx_write_sensor_words()
162 buf[0x20] = sd->sensor->i2c_addr; stv06xx_write_sensor_words()
172 return stv06xx_write_sensor_finish(sd); stv06xx_write_sensor_words()
175 int stv06xx_read_sensor(struct sd *sd, const u8 address, u16 *value) stv06xx_read_sensor() argument
178 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; stv06xx_read_sensor()
179 struct usb_device *udev = sd->gspca_dev.dev; stv06xx_read_sensor()
180 __u8 *buf = sd->gspca_dev.usb_buf; stv06xx_read_sensor()
182 err = stv06xx_write_bridge(sd, STV_I2C_FLUSH, sd->sensor->i2c_flush); stv06xx_read_sensor()
190 buf[0x20] = sd->sensor->i2c_addr; stv06xx_read_sensor()
205 0x04, 0xc0, 0x1410, 0, buf, sd->sensor->i2c_len, stv06xx_read_sensor()
207 if (sd->sensor->i2c_len == 2) stv06xx_read_sensor()
219 static void stv06xx_dump_bridge(struct sd *sd) stv06xx_dump_bridge() argument
226 stv06xx_read_bridge(sd, i, &data); stv06xx_dump_bridge()
233 stv06xx_read_bridge(sd, i, &data); stv06xx_dump_bridge()
236 stv06xx_write_bridge(sd, i, 0xff); stv06xx_dump_bridge()
237 stv06xx_read_bridge(sd, i, &data); stv06xx_dump_bridge()
246 stv06xx_write_bridge(sd, i, buf); stv06xx_dump_bridge()
253 struct sd *sd = (struct sd *) gspca_dev; stv06xx_init() local
262 err = sd->sensor->init(sd); stv06xx_init()
264 if (dump_sensor && sd->sensor->dump) stv06xx_init()
265 sd->sensor->dump(sd); stv06xx_init()
273 struct sd *sd = (struct sd *) gspca_dev; stv06xx_init_controls() local
278 return sd->sensor->init_controls(sd); stv06xx_init_controls()
284 struct sd *sd = (struct sd *) gspca_dev; stv06xx_start() local
289 intf = usb_ifnum_to_if(sd->gspca_dev.dev, sd->gspca_dev.iface); stv06xx_start()
290 alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt); stv06xx_start()
297 err = stv06xx_write_bridge(sd, STV_ISO_SIZE_L, packet_size); stv06xx_start()
302 err = sd->sensor->start(sd); stv06xx_start()
307 err = stv06xx_write_bridge(sd, STV_ISO_ENABLE, 1); stv06xx_start()
321 struct sd *sd = (struct sd *) gspca_dev; stv06xx_isoc_init() local
326 cpu_to_le16(sd->sensor->max_packet_size[gspca_dev->curr_mode]); stv06xx_isoc_init()
335 struct sd *sd = (struct sd *) gspca_dev; stv06xx_isoc_nego() local
339 min_packet_size = sd->sensor->min_packet_size[gspca_dev->curr_mode]; stv06xx_isoc_nego()
358 struct sd *sd = (struct sd *) gspca_dev; stv06xx_stopN() local
361 err = stv06xx_write_bridge(sd, STV_ISO_ENABLE, 0); stv06xx_stopN()
365 err = sd->sensor->stop(sd); stv06xx_stopN()
390 struct sd *sd = (struct sd *) gspca_dev; stv06xx_pkt_scan() local
422 if (sd->bridge == BRIDGE_ST6422 && (id & 0xff00) == 0x0200) stv06xx_pkt_scan()
431 if (sd->to_skip) { stv06xx_pkt_scan()
432 int skip = (sd->to_skip < chunk_len) ? stv06xx_pkt_scan()
433 sd->to_skip : chunk_len; stv06xx_pkt_scan()
437 sd->to_skip -= skip; stv06xx_pkt_scan()
454 if (sd->bridge == BRIDGE_ST6422) stv06xx_pkt_scan()
455 sd->to_skip = gspca_dev->pixfmt.width * 4; stv06xx_pkt_scan()
547 struct sd *sd = (struct sd *) gspca_dev; stv06xx_config() local
551 sd->bridge = id->driver_info; stv06xx_config()
555 stv06xx_dump_bridge(sd); stv06xx_config()
557 sd->sensor = &stv06xx_sensor_st6422; stv06xx_config()
558 if (!sd->sensor->probe(sd)) stv06xx_config()
561 sd->sensor = &stv06xx_sensor_vv6410; stv06xx_config()
562 if (!sd->sensor->probe(sd)) stv06xx_config()
565 sd->sensor = &stv06xx_sensor_hdcs1x00; stv06xx_config()
566 if (!sd->sensor->probe(sd)) stv06xx_config()
569 sd->sensor = &stv06xx_sensor_hdcs1020; stv06xx_config()
570 if (!sd->sensor->probe(sd)) stv06xx_config()
573 sd->sensor = &stv06xx_sensor_pb0100; stv06xx_config()
574 if (!sd->sensor->probe(sd)) stv06xx_config()
577 sd->sensor = NULL; stv06xx_config()
605 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), sd_probe()
612 struct sd *sd = (struct sd *) gspca_dev; sd_disconnect() local
613 void *priv = sd->sensor_priv; sd_disconnect()
616 sd->sensor = NULL; sd_disconnect()
H A Dstv06xx_hdcs.c95 static int hdcs_reg_write_seq(struct sd *sd, u8 reg, u8 *vals, u8 len) hdcs_reg_write_seq() argument
112 return stv06xx_write_sensor_bytes(sd, regs, len); hdcs_reg_write_seq()
115 static int hdcs_set_state(struct sd *sd, enum hdcs_power_state state) hdcs_set_state() argument
117 struct hdcs *hdcs = sd->sensor_priv; hdcs_set_state()
126 ret = stv06xx_write_sensor(sd, HDCS_REG_CONTROL(sd), 0); hdcs_set_state()
149 ret = stv06xx_write_sensor(sd, HDCS_REG_CONTROL(sd), val); hdcs_set_state()
158 static int hdcs_reset(struct sd *sd) hdcs_reset() argument
160 struct hdcs *hdcs = sd->sensor_priv; hdcs_reset()
163 err = stv06xx_write_sensor(sd, HDCS_REG_CONTROL(sd), 1); hdcs_reset()
167 err = stv06xx_write_sensor(sd, HDCS_REG_CONTROL(sd), 0); hdcs_reset()
176 struct sd *sd = (struct sd *) gspca_dev; hdcs_set_exposure() local
177 struct hdcs *hdcs = sd->sensor_priv; hdcs_set_exposure()
206 if (IS_1020(sd)) { hdcs_set_exposure()
225 if (IS_1020(sd)) { hdcs_set_exposure()
238 err = stv06xx_write_sensor_bytes(sd, exp, 6); hdcs_set_exposure()
254 err = stv06xx_write_sensor_bytes(sd, exp, 7); hdcs_set_exposure()
263 static int hdcs_set_gains(struct sd *sd, u8 g) hdcs_set_gains() argument
277 err = hdcs_reg_write_seq(sd, HDCS_ERECPGA, gains, 4); hdcs_set_gains()
284 return hdcs_set_gains((struct sd *) gspca_dev, hdcs_set_gain()
288 static int hdcs_set_size(struct sd *sd, hdcs_set_size() argument
291 struct hdcs *hdcs = sd->sensor_priv; hdcs_set_size()
303 if (IS_1020(sd)) { hdcs_set_size()
326 err = hdcs_reg_write_seq(sd, HDCS_FWROW, win, 4); hdcs_set_size()
357 static int hdcs_init_controls(struct sd *sd) hdcs_init_controls() argument
359 struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler; hdcs_init_controls()
369 static int hdcs_probe_1x00(struct sd *sd) hdcs_probe_1x00() argument
375 ret = stv06xx_read_sensor(sd, HDCS_IDENT, &sensor); hdcs_probe_1x00()
381 sd->gspca_dev.cam.cam_mode = hdcs1x00_mode; hdcs_probe_1x00()
382 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(hdcs1x00_mode); hdcs_probe_1x00()
419 hdcs->psmp = (sd->bridge == BRIDGE_STV602) ? 20 : 5; hdcs_probe_1x00()
421 sd->sensor_priv = hdcs; hdcs_probe_1x00()
426 static int hdcs_probe_1020(struct sd *sd) hdcs_probe_1020() argument
432 ret = stv06xx_read_sensor(sd, HDCS_IDENT, &sensor); hdcs_probe_1020()
438 sd->gspca_dev.cam.cam_mode = hdcs1020_mode; hdcs_probe_1020()
439 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(hdcs1020_mode); hdcs_probe_1020()
463 sd->sensor_priv = hdcs; hdcs_probe_1020()
468 static int hdcs_start(struct sd *sd) hdcs_start() argument
470 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; hdcs_start()
474 return hdcs_set_state(sd, HDCS_STATE_RUN); hdcs_start()
477 static int hdcs_stop(struct sd *sd) hdcs_stop() argument
479 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; hdcs_stop()
483 return hdcs_set_state(sd, HDCS_STATE_SLEEP); hdcs_stop()
486 static int hdcs_init(struct sd *sd) hdcs_init() argument
488 struct hdcs *hdcs = sd->sensor_priv; hdcs_init()
492 if (sd->bridge == BRIDGE_STV602) hdcs_init()
493 stv06xx_write_bridge(sd, STV_STV0600_EMULATION, 1); hdcs_init()
497 err = stv06xx_write_bridge(sd, stv_bridge_init[i][0], hdcs_init()
504 hdcs_reset(sd); hdcs_init()
508 err = stv06xx_write_sensor(sd, stv_sensor_init[i][0], hdcs_init()
515 err = stv06xx_write_sensor(sd, HDCS_REG_CONFIG(sd), BIT(3)); hdcs_init()
521 if (IS_1020(sd)) hdcs_init()
522 err = stv06xx_write_sensor(sd, HDCS_TCTRL, hdcs_init()
525 err = stv06xx_write_sensor(sd, HDCS_TCTRL, hdcs_init()
530 return hdcs_set_size(sd, hdcs->array.width, hdcs->array.height); hdcs_init()
533 static int hdcs_dump(struct sd *sd) hdcs_dump() argument
540 stv06xx_read_sensor(sd, reg, &val); hdcs_dump()
H A Dstv06xx_sensor.h35 #define IS_1020(sd) ((sd)->sensor == &stv06xx_sensor_hdcs1020)
61 int (*probe)(struct sd *sd);
64 int (*init)(struct sd *sd);
67 int (*init_controls)(struct sd *sd);
70 int (*read_sensor)(struct sd *sd, const u8 address,
74 int (*write_sensor)(struct sd *sd, const u8 address,
78 int (*start)(struct sd *sd);
81 int (*stop)(struct sd *sd);
84 int (*dump)(struct sd *sd);
H A Dstv06xx_st6422.h34 static int st6422_probe(struct sd *sd);
35 static int st6422_start(struct sd *sd);
36 static int st6422_init(struct sd *sd);
37 static int st6422_init_controls(struct sd *sd);
38 static int st6422_stop(struct sd *sd);
H A Dstv06xx.h86 struct sd { struct
107 int stv06xx_write_bridge(struct sd *sd, u16 address, u16 i2c_data);
108 int stv06xx_read_bridge(struct sd *sd, u16 address, u8 *i2c_data);
110 int stv06xx_write_sensor_bytes(struct sd *sd, const u8 *data, u8 len);
111 int stv06xx_write_sensor_words(struct sd *sd, const u16 *data, u8 len);
113 int stv06xx_read_sensor(struct sd *sd, const u8 address, u16 *value);
114 int stv06xx_write_sensor(struct sd *sd, u8 address, u16 value);
H A Dstv06xx_pb0100.h112 static int pb0100_probe(struct sd *sd);
113 static int pb0100_start(struct sd *sd);
114 static int pb0100_init(struct sd *sd);
115 static int pb0100_init_controls(struct sd *sd);
116 static int pb0100_stop(struct sd *sd);
117 static int pb0100_dump(struct sd *sd);
H A Dstv06xx_hdcs.h36 #define HDCS_REG_CONFIG(sd) (IS_1020(sd) ? HDCS20_CONFIG : HDCS00_CONFIG)
37 #define HDCS_REG_CONTROL(sd) (IS_1020(sd) ? HDCS20_CONTROL : HDCS00_CONTROL)
130 static int hdcs_probe_1x00(struct sd *sd);
131 static int hdcs_probe_1020(struct sd *sd);
132 static int hdcs_start(struct sd *sd);
133 static int hdcs_init(struct sd *sd);
134 static int hdcs_init_controls(struct sd *sd);
135 static int hdcs_stop(struct sd *sd);
136 static int hdcs_dump(struct sd *sd);
H A Dstv06xx_vv6410.h178 static int vv6410_probe(struct sd *sd);
179 static int vv6410_start(struct sd *sd);
180 static int vv6410_init(struct sd *sd);
181 static int vv6410_init_controls(struct sd *sd);
182 static int vv6410_stop(struct sd *sd);
183 static int vv6410_dump(struct sd *sd);
/linux-4.1.27/drivers/media/v4l2-core/
H A Dv4l2-device.c106 struct v4l2_subdev *sd, *next; v4l2_device_unregister() local
115 list_for_each_entry_safe(sd, next, &v4l2_dev->subdevs, list) { v4l2_device_unregister()
116 v4l2_device_unregister_subdev(sd); v4l2_device_unregister()
118 if (sd->flags & V4L2_SUBDEV_FL_IS_I2C) { v4l2_device_unregister()
119 struct i2c_client *client = v4l2_get_subdevdata(sd); v4l2_device_unregister()
131 if (sd->flags & V4L2_SUBDEV_FL_IS_SPI) { v4l2_device_unregister()
132 struct spi_device *spi = v4l2_get_subdevdata(sd); v4l2_device_unregister()
146 struct v4l2_subdev *sd) v4l2_device_register_subdev()
149 struct media_entity *entity = &sd->entity; v4l2_device_register_subdev()
154 if (v4l2_dev == NULL || sd == NULL || !sd->name[0]) v4l2_device_register_subdev()
158 WARN_ON(sd->v4l2_dev != NULL); v4l2_device_register_subdev()
167 sd->owner_v4l2_dev = v4l2_dev->dev && v4l2_dev->dev->driver && v4l2_device_register_subdev()
168 sd->owner == v4l2_dev->dev->driver->owner; v4l2_device_register_subdev()
170 if (!sd->owner_v4l2_dev && !try_module_get(sd->owner)) v4l2_device_register_subdev()
173 sd->v4l2_dev = v4l2_dev; v4l2_device_register_subdev()
174 if (sd->internal_ops && sd->internal_ops->registered) { v4l2_device_register_subdev()
175 err = sd->internal_ops->registered(sd); v4l2_device_register_subdev()
181 err = v4l2_ctrl_add_handler(v4l2_dev->ctrl_handler, sd->ctrl_handler, NULL); v4l2_device_register_subdev()
195 list_add_tail(&sd->list, &v4l2_dev->subdevs); v4l2_device_register_subdev()
201 if (sd->internal_ops && sd->internal_ops->unregistered) v4l2_device_register_subdev()
202 sd->internal_ops->unregistered(sd); v4l2_device_register_subdev()
204 if (!sd->owner_v4l2_dev) v4l2_device_register_subdev()
205 module_put(sd->owner); v4l2_device_register_subdev()
206 sd->v4l2_dev = NULL; v4l2_device_register_subdev()
213 struct v4l2_subdev *sd = video_get_drvdata(vdev); v4l2_device_release_subdev_node() local
214 sd->devnode = NULL; v4l2_device_release_subdev_node()
221 struct v4l2_subdev *sd; v4l2_device_register_subdev_nodes() local
227 list_for_each_entry(sd, &v4l2_dev->subdevs, list) { v4l2_device_register_subdev_nodes()
228 if (!(sd->flags & V4L2_SUBDEV_FL_HAS_DEVNODE)) v4l2_device_register_subdev_nodes()
237 video_set_drvdata(vdev, sd); v4l2_device_register_subdev_nodes()
238 strlcpy(vdev->name, sd->name, sizeof(vdev->name)); v4l2_device_register_subdev_nodes()
242 vdev->ctrl_handler = sd->ctrl_handler; v4l2_device_register_subdev_nodes()
244 sd->owner); v4l2_device_register_subdev_nodes()
250 sd->entity.info.dev.major = VIDEO_MAJOR; v4l2_device_register_subdev_nodes()
251 sd->entity.info.dev.minor = vdev->minor; v4l2_device_register_subdev_nodes()
253 sd->devnode = vdev; v4l2_device_register_subdev_nodes()
258 list_for_each_entry(sd, &v4l2_dev->subdevs, list) { v4l2_device_register_subdev_nodes()
259 if (!sd->devnode) v4l2_device_register_subdev_nodes()
261 video_unregister_device(sd->devnode); v4l2_device_register_subdev_nodes()
268 void v4l2_device_unregister_subdev(struct v4l2_subdev *sd) v4l2_device_unregister_subdev() argument
273 if (sd == NULL || sd->v4l2_dev == NULL) v4l2_device_unregister_subdev()
276 v4l2_dev = sd->v4l2_dev; v4l2_device_unregister_subdev()
279 list_del(&sd->list); v4l2_device_unregister_subdev()
282 if (sd->internal_ops && sd->internal_ops->unregistered) v4l2_device_unregister_subdev()
283 sd->internal_ops->unregistered(sd); v4l2_device_unregister_subdev()
284 sd->v4l2_dev = NULL; v4l2_device_unregister_subdev()
288 media_entity_remove_links(&sd->entity); v4l2_device_unregister_subdev()
289 media_device_unregister_entity(&sd->entity); v4l2_device_unregister_subdev()
292 video_unregister_device(sd->devnode); v4l2_device_unregister_subdev()
293 if (!sd->owner_v4l2_dev) v4l2_device_unregister_subdev()
294 module_put(sd->owner); v4l2_device_unregister_subdev()
145 v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, struct v4l2_subdev *sd) v4l2_device_register_subdev() argument
H A Dv4l2-subdev.c35 static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd) subdev_fh_init() argument
38 fh->pad = kzalloc(sizeof(*fh->pad) * sd->entity.num_pads, GFP_KERNEL); subdev_fh_init()
56 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); subdev_open() local
67 ret = subdev_fh_init(subdev_fh, sd); subdev_open()
77 if (sd->v4l2_dev->mdev) { subdev_open()
78 entity = media_entity_get(&sd->entity); subdev_open()
86 if (sd->internal_ops && sd->internal_ops->open) { subdev_open()
87 ret = sd->internal_ops->open(sd, subdev_fh); subdev_open()
109 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); subdev_close() local
113 if (sd->internal_ops && sd->internal_ops->close) subdev_close()
114 sd->internal_ops->close(sd, subdev_fh); subdev_close()
116 if (sd->v4l2_dev->mdev) subdev_close()
117 media_entity_put(&sd->entity); subdev_close()
129 static int check_format(struct v4l2_subdev *sd, check_format() argument
136 if (format->pad >= sd->entity.num_pads) check_format()
142 static int check_crop(struct v4l2_subdev *sd, struct v4l2_subdev_crop *crop) check_crop() argument
148 if (crop->pad >= sd->entity.num_pads) check_crop()
154 static int check_selection(struct v4l2_subdev *sd, check_selection() argument
161 if (sel->pad >= sd->entity.num_pads) check_selection()
167 static int check_edid(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid) check_edid() argument
169 if (edid->pad >= sd->entity.num_pads) check_edid()
182 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); subdev_do_ioctl() local
215 if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS)) subdev_do_ioctl()
221 return v4l2_subdev_call(sd, core, subscribe_event, vfh, arg); subdev_do_ioctl()
224 return v4l2_subdev_call(sd, core, unsubscribe_event, vfh, arg); subdev_do_ioctl()
233 return v4l2_subdev_call(sd, core, g_register, p); subdev_do_ioctl()
241 return v4l2_subdev_call(sd, core, s_register, p); subdev_do_ioctl()
249 sd->name); subdev_do_ioctl()
250 ret = v4l2_subdev_call(sd, core, log_status); subdev_do_ioctl()
252 sd->name); subdev_do_ioctl()
260 rval = check_format(sd, format); subdev_do_ioctl()
264 return v4l2_subdev_call(sd, pad, get_fmt, subdev_fh->pad, format); subdev_do_ioctl()
270 rval = check_format(sd, format); subdev_do_ioctl()
274 return v4l2_subdev_call(sd, pad, set_fmt, subdev_fh->pad, format); subdev_do_ioctl()
281 rval = check_crop(sd, crop); subdev_do_ioctl()
291 sd, pad, get_selection, subdev_fh->pad, &sel); subdev_do_ioctl()
302 rval = check_crop(sd, crop); subdev_do_ioctl()
313 sd, pad, set_selection, subdev_fh->pad, &sel); subdev_do_ioctl()
327 if (code->pad >= sd->entity.num_pads) subdev_do_ioctl()
330 return v4l2_subdev_call(sd, pad, enum_mbus_code, subdev_fh->pad, subdev_do_ioctl()
341 if (fse->pad >= sd->entity.num_pads) subdev_do_ioctl()
344 return v4l2_subdev_call(sd, pad, enum_frame_size, subdev_fh->pad, subdev_do_ioctl()
351 if (fi->pad >= sd->entity.num_pads) subdev_do_ioctl()
354 return v4l2_subdev_call(sd, video, g_frame_interval, arg); subdev_do_ioctl()
360 if (fi->pad >= sd->entity.num_pads) subdev_do_ioctl()
363 return v4l2_subdev_call(sd, video, s_frame_interval, arg); subdev_do_ioctl()
373 if (fie->pad >= sd->entity.num_pads) subdev_do_ioctl()
376 return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh->pad, subdev_do_ioctl()
383 rval = check_selection(sd, sel); subdev_do_ioctl()
388 sd, pad, get_selection, subdev_fh->pad, sel); subdev_do_ioctl()
394 rval = check_selection(sd, sel); subdev_do_ioctl()
399 sd, pad, set_selection, subdev_fh->pad, sel); subdev_do_ioctl()
405 rval = check_edid(sd, edid); subdev_do_ioctl()
409 return v4l2_subdev_call(sd, pad, get_edid, edid); subdev_do_ioctl()
415 rval = check_edid(sd, edid); subdev_do_ioctl()
419 return v4l2_subdev_call(sd, pad, set_edid, edid); subdev_do_ioctl()
425 if (cap->pad >= sd->entity.num_pads) subdev_do_ioctl()
428 return v4l2_subdev_call(sd, pad, dv_timings_cap, cap); subdev_do_ioctl()
434 if (dvt->pad >= sd->entity.num_pads) subdev_do_ioctl()
437 return v4l2_subdev_call(sd, pad, enum_dv_timings, dvt); subdev_do_ioctl()
441 return v4l2_subdev_call(sd, video, query_dv_timings, arg); subdev_do_ioctl()
444 return v4l2_subdev_call(sd, video, g_dv_timings, arg); subdev_do_ioctl()
447 return v4l2_subdev_call(sd, video, s_dv_timings, arg); subdev_do_ioctl()
450 return v4l2_subdev_call(sd, core, ioctl, cmd, arg); subdev_do_ioctl()
467 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); subdev_compat_ioctl32() local
469 return v4l2_subdev_call(sd, core, compat_ioctl32, cmd, arg); subdev_compat_ioctl32()
476 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); subdev_poll() local
479 if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS)) subdev_poll()
502 int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd, v4l2_subdev_link_validate_default() argument
530 struct v4l2_subdev *sd = v4l2_subdev_link_validate_get_format() local
535 return v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt); v4l2_subdev_link_validate_get_format()
574 void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops) v4l2_subdev_init() argument
576 INIT_LIST_HEAD(&sd->list); v4l2_subdev_init()
578 sd->ops = ops; v4l2_subdev_init()
579 sd->v4l2_dev = NULL; v4l2_subdev_init()
580 sd->flags = 0; v4l2_subdev_init()
581 sd->name[0] = '\0'; v4l2_subdev_init()
582 sd->grp_id = 0; v4l2_subdev_init()
583 sd->dev_priv = NULL; v4l2_subdev_init()
584 sd->host_priv = NULL; v4l2_subdev_init()
586 sd->entity.name = sd->name; v4l2_subdev_init()
587 sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV; v4l2_subdev_init()
H A Dv4l2-async.c52 struct v4l2_subdev *sd) v4l2_async_belongs()
82 if (match(sd->dev, asd)) v4l2_async_belongs()
90 struct v4l2_subdev *sd, v4l2_async_test_notify()
97 sd->asd = asd; v4l2_async_test_notify()
98 sd->notifier = notifier; v4l2_async_test_notify()
101 ret = notifier->bound(notifier, sd, asd); v4l2_async_test_notify()
106 list_move(&sd->async_list, &notifier->done); v4l2_async_test_notify()
108 ret = v4l2_device_register_subdev(notifier->v4l2_dev, sd); v4l2_async_test_notify()
111 notifier->unbind(notifier, sd, asd); v4l2_async_test_notify()
121 static void v4l2_async_cleanup(struct v4l2_subdev *sd) v4l2_async_cleanup() argument
123 v4l2_device_unregister_subdev(sd); v4l2_async_cleanup()
125 list_del_init(&sd->async_list); v4l2_async_cleanup()
126 sd->asd = NULL; v4l2_async_cleanup()
127 sd->dev = NULL; v4l2_async_cleanup()
133 struct v4l2_subdev *sd, *tmp; v4l2_async_notifier_register() local
167 list_for_each_entry_safe(sd, tmp, &subdev_list, async_list) { v4l2_async_notifier_register()
170 asd = v4l2_async_belongs(notifier, sd); v4l2_async_notifier_register()
174 ret = v4l2_async_test_notify(notifier, sd, asd); v4l2_async_notifier_register()
189 struct v4l2_subdev *sd, *tmp; v4l2_async_notifier_unregister() local
208 list_for_each_entry_safe(sd, tmp, &notifier->done, async_list) { v4l2_async_notifier_unregister()
211 d = get_device(sd->dev); v4l2_async_notifier_unregister()
213 v4l2_async_cleanup(sd); v4l2_async_notifier_unregister()
219 notifier->unbind(notifier, sd, sd->asd); v4l2_async_notifier_unregister()
265 int v4l2_async_register_subdev(struct v4l2_subdev *sd) v4l2_async_register_subdev() argument
271 INIT_LIST_HEAD(&sd->async_list); v4l2_async_register_subdev()
274 struct v4l2_async_subdev *asd = v4l2_async_belongs(notifier, sd); v4l2_async_register_subdev()
276 int ret = v4l2_async_test_notify(notifier, sd, asd); v4l2_async_register_subdev()
283 list_add(&sd->async_list, &subdev_list); v4l2_async_register_subdev()
291 void v4l2_async_unregister_subdev(struct v4l2_subdev *sd) v4l2_async_unregister_subdev() argument
293 struct v4l2_async_notifier *notifier = sd->notifier; v4l2_async_unregister_subdev()
295 if (!sd->asd) { v4l2_async_unregister_subdev()
296 if (!list_empty(&sd->async_list)) v4l2_async_unregister_subdev()
297 v4l2_async_cleanup(sd); v4l2_async_unregister_subdev()
303 list_add(&sd->asd->list, &notifier->waiting); v4l2_async_unregister_subdev()
305 v4l2_async_cleanup(sd); v4l2_async_unregister_subdev()
308 notifier->unbind(notifier, sd, sd->asd); v4l2_async_unregister_subdev()
51 v4l2_async_belongs(struct v4l2_async_notifier *notifier, struct v4l2_subdev *sd) v4l2_async_belongs() argument
89 v4l2_async_test_notify(struct v4l2_async_notifier *notifier, struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) v4l2_async_test_notify() argument
H A Dv4l2-common.c112 void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client, v4l2_i2c_subdev_init() argument
115 v4l2_subdev_init(sd, ops); v4l2_i2c_subdev_init()
116 sd->flags |= V4L2_SUBDEV_FL_IS_I2C; v4l2_i2c_subdev_init()
118 sd->owner = client->dev.driver->owner; v4l2_i2c_subdev_init()
119 sd->dev = &client->dev; v4l2_i2c_subdev_init()
121 v4l2_set_subdevdata(sd, client); v4l2_i2c_subdev_init()
122 i2c_set_clientdata(client, sd); v4l2_i2c_subdev_init()
124 snprintf(sd->name, sizeof(sd->name), "%s %d-%04x", v4l2_i2c_subdev_init()
135 struct v4l2_subdev *sd = NULL; v4l2_i2c_new_subdev_board() local
162 sd = i2c_get_clientdata(client); v4l2_i2c_new_subdev_board()
166 if (v4l2_device_register_subdev(v4l2_dev, sd)) v4l2_i2c_new_subdev_board()
167 sd = NULL; v4l2_i2c_new_subdev_board()
174 if (client && sd == NULL) v4l2_i2c_new_subdev_board()
176 return sd; v4l2_i2c_new_subdev_board()
197 unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd) v4l2_i2c_subdev_addr() argument
199 struct i2c_client *client = v4l2_get_subdevdata(sd); v4l2_i2c_subdev_addr()
246 void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi, v4l2_spi_subdev_init() argument
249 v4l2_subdev_init(sd, ops); v4l2_spi_subdev_init()
250 sd->flags |= V4L2_SUBDEV_FL_IS_SPI; v4l2_spi_subdev_init()
252 sd->owner = spi->dev.driver->owner; v4l2_spi_subdev_init()
253 sd->dev = &spi->dev; v4l2_spi_subdev_init()
255 v4l2_set_subdevdata(sd, spi); v4l2_spi_subdev_init()
256 spi_set_drvdata(spi, sd); v4l2_spi_subdev_init()
258 strlcpy(sd->name, spi->dev.driver->name, sizeof(sd->name)); v4l2_spi_subdev_init()
265 struct v4l2_subdev *sd = NULL; v4l2_spi_new_subdev() local
281 sd = spi_get_drvdata(spi); v4l2_spi_new_subdev()
285 if (v4l2_device_register_subdev(v4l2_dev, sd)) v4l2_spi_new_subdev()
286 sd = NULL; v4l2_spi_new_subdev()
294 if (spi && sd == NULL) v4l2_spi_new_subdev()
297 return sd; v4l2_spi_new_subdev()
/linux-4.1.27/drivers/media/radio/
H A Dsaa7706h.c129 struct v4l2_subdev sd; member in struct:saa7706h_state
134 static inline struct saa7706h_state *to_state(struct v4l2_subdev *sd) to_state() argument
136 return container_of(sd, struct saa7706h_state, sd); to_state()
156 static int saa7706h_set_reg24(struct v4l2_subdev *sd, u16 reg, u32 val) saa7706h_set_reg24() argument
158 struct i2c_client *client = v4l2_get_subdevdata(sd); saa7706h_set_reg24()
171 static int saa7706h_set_reg24_err(struct v4l2_subdev *sd, u16 reg, u32 val, saa7706h_set_reg24_err() argument
174 return *err ? *err : saa7706h_set_reg24(sd, reg, val); saa7706h_set_reg24_err()
177 static int saa7706h_set_reg16(struct v4l2_subdev *sd, u16 reg, u16 val) saa7706h_set_reg16() argument
179 struct i2c_client *client = v4l2_get_subdevdata(sd); saa7706h_set_reg16()
191 static int saa7706h_set_reg16_err(struct v4l2_subdev *sd, u16 reg, u16 val, saa7706h_set_reg16_err() argument
194 return *err ? *err : saa7706h_set_reg16(sd, reg, val); saa7706h_set_reg16_err()
197 static int saa7706h_get_reg16(struct v4l2_subdev *sd, u16 reg) saa7706h_get_reg16() argument
199 struct i2c_client *client = v4l2_get_subdevdata(sd); saa7706h_get_reg16()
224 static int saa7706h_unmute(struct v4l2_subdev *sd) saa7706h_unmute() argument
226 struct saa7706h_state *state = to_state(sd); saa7706h_unmute()
229 err = saa7706h_set_reg16_err(sd, SAA7706H_REG_CTRL, saa7706h_unmute()
236 err = saa7706h_set_reg16_err(sd, SAA7706H_REG_CTRL, saa7706h_unmute()
239 err = saa7706h_set_reg24_err(sd, SAA7706H_REG_EVALUATION, 0, &err); saa7706h_unmute()
241 err = saa7706h_set_reg24_err(sd, SAA7706H_REG_CL_GEN1, 0x040022, &err); saa7706h_unmute()
243 err = saa7706h_set_reg24_err(sd, SAA7706H_REG_CL_GEN2, saa7706h_unmute()
246 err = saa7706h_set_reg24_err(sd, SAA7706H_REG_CL_GEN4, 0x024080, &err); saa7706h_unmute()
248 err = saa7706h_set_reg24_err(sd, SAA7706H_REG_SEL, 0x200080, &err); saa7706h_unmute()
250 err = saa7706h_set_reg24_err(sd, SAA7706H_REG_IAC, 0xf4caed, &err); saa7706h_unmute()
252 err = saa7706h_set_reg24_err(sd, SAA7706H_REG_CLK_SET, 0x124334, &err); saa7706h_unmute()
254 err = saa7706h_set_reg24_err(sd, SAA7706H_REG_CLK_COEFF, 0x004a1a, saa7706h_unmute()
257 err = saa7706h_set_reg24_err(sd, SAA7706H_REG_INPUT_SENS, 0x0071c7, saa7706h_unmute()
260 err = saa7706h_set_reg24_err(sd, SAA7706H_REG_PHONE_NAV_AUDIO, saa7706h_unmute()
263 err = saa7706h_set_reg24_err(sd, SAA7706H_REG_IO_CONF_DSP2, 0x001ff8, saa7706h_unmute()
266 err = saa7706h_set_reg24_err(sd, SAA7706H_REG_STATUS_DSP2, 0x080003, saa7706h_unmute()
269 err = saa7706h_set_reg24_err(sd, SAA7706H_REG_PC_DSP2, 0x000004, &err); saa7706h_unmute()
271 err = saa7706h_set_reg16_err(sd, SAA7706H_DSP1_MOD0, 0x0c6c, &err); saa7706h_unmute()
273 err = saa7706h_set_reg24_err(sd, SAA7706H_DSP2_MPTR0, 0x000b4b, &err); saa7706h_unmute()
275 err = saa7706h_set_reg24_err(sd, SAA7706H_DSP1_MODPNTR, 0x000600, &err); saa7706h_unmute()
277 err = saa7706h_set_reg24_err(sd, SAA7706H_DSP1_MODPNTR, 0x0000c0, &err); saa7706h_unmute()
279 err = saa7706h_set_reg24_err(sd, SAA7706H_DSP2_XMEM_CONTLLCW, 0x000819, saa7706h_unmute()
282 err = saa7706h_set_reg24_err(sd, SAA7706H_DSP2_XMEM_CONTLLCW, 0x00085a, saa7706h_unmute()
285 err = saa7706h_set_reg24_err(sd, SAA7706H_DSP2_XMEM_BUSAMP, 0x7fffff, saa7706h_unmute()
288 err = saa7706h_set_reg24_err(sd, SAA7706H_DSP2_XMEM_FDACPNTR, 0x2000cb, saa7706h_unmute()
291 err = saa7706h_set_reg24_err(sd, SAA7706H_DSP2_XMEM_IIS1PNTR, 0x2000cb, saa7706h_unmute()
294 err = saa7706h_set_reg16_err(sd, SAA7706H_DSP2_YMEM_PVGA, 0x0f80, &err); saa7706h_unmute()
296 err = saa7706h_set_reg16_err(sd, SAA7706H_DSP2_YMEM_PVAT1, 0x0800, saa7706h_unmute()
299 err = saa7706h_set_reg16_err(sd, SAA7706H_DSP2_YMEM_PVAT, 0x0800, &err); saa7706h_unmute()
301 err = saa7706h_set_reg24_err(sd, SAA7706H_DSP2_XMEM_CONTLLCW, 0x000905, saa7706h_unmute()
308 static int saa7706h_mute(struct v4l2_subdev *sd) saa7706h_mute() argument
310 struct saa7706h_state *state = to_state(sd); saa7706h_mute()
313 err = saa7706h_set_reg16(sd, SAA7706H_REG_CTRL, saa7706h_mute()
329 return saa7706h_mute(&state->sd); saa7706h_s_ctrl()
330 return saa7706h_unmute(&state->sd); saa7706h_s_ctrl()
362 struct v4l2_subdev *sd; saa7706h_probe() local
375 sd = &state->sd; saa7706h_probe()
376 v4l2_i2c_subdev_init(sd, client, &saa7706h_ops); saa7706h_probe()
381 sd->ctrl_handler = &state->hdl; saa7706h_probe()
387 err = saa7706h_get_reg16(sd, SAA7706H_DSP1_ROM_VER); saa7706h_probe()
391 v4l2_warn(sd, "Unknown DSP1 ROM code version: 0x%x\n", err); saa7706h_probe()
395 err = saa7706h_mute(sd); saa7706h_probe()
402 v4l2_device_unregister_subdev(sd); saa7706h_probe()
404 kfree(to_state(sd)); saa7706h_probe()
413 struct v4l2_subdev *sd = i2c_get_clientdata(client); saa7706h_remove() local
414 struct saa7706h_state *state = to_state(sd); saa7706h_remove()
416 saa7706h_mute(sd); saa7706h_remove()
417 v4l2_device_unregister_subdev(sd); saa7706h_remove()
419 kfree(to_state(sd)); saa7706h_remove()
H A Dtef6862.c62 struct v4l2_subdev sd; member in struct:tef6862_state
66 static inline struct tef6862_state *to_state(struct v4l2_subdev *sd) to_state() argument
68 return container_of(sd, struct tef6862_state, sd); to_state()
80 static int tef6862_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *v) tef6862_g_tuner() argument
93 v->signal = tef6862_sigstr(v4l2_get_subdevdata(sd)); tef6862_g_tuner()
98 static int tef6862_s_tuner(struct v4l2_subdev *sd, const struct v4l2_tuner *v) tef6862_s_tuner() argument
103 static int tef6862_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *f) tef6862_s_frequency() argument
105 struct tef6862_state *state = to_state(sd); tef6862_s_frequency()
106 struct i2c_client *client = v4l2_get_subdevdata(sd); tef6862_s_frequency()
129 static int tef6862_g_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f) tef6862_g_frequency() argument
131 struct tef6862_state *state = to_state(sd); tef6862_g_frequency()
160 struct v4l2_subdev *sd; tef6862_probe() local
174 sd = &state->sd; tef6862_probe()
175 v4l2_i2c_subdev_init(sd, client, &tef6862_ops); tef6862_probe()
182 struct v4l2_subdev *sd = i2c_get_clientdata(client); tef6862_remove() local
184 v4l2_device_unregister_subdev(sd); tef6862_remove()
185 kfree(to_state(sd)); tef6862_remove()
/linux-4.1.27/drivers/staging/rts5208/
H A DMakefile6 rtsx_card.o general.o sd.o xd.o ms.o spi.o trace.o
/linux-4.1.27/drivers/gpio/
H A Dgpio-sodaville.c52 struct sdv_gpio_chip_data *sd = gc->private; sdv_gpio_pub_set_type() local
57 type_reg = sd->gpio_pub_base + GPIT1R0; sdv_gpio_pub_set_type()
59 type_reg = sd->gpio_pub_base + GPIT1R1; sdv_gpio_pub_set_type()
82 struct sdv_gpio_chip_data *sd = data; sdv_gpio_pub_irq_handler() local
83 u32 irq_stat = readl(sd->gpio_pub_base + GPSTR); sdv_gpio_pub_irq_handler()
85 irq_stat &= readl(sd->gpio_pub_base + GPIO_INT); sdv_gpio_pub_irq_handler()
93 generic_handle_irq(irq_find_mapping(sd->id, irq_bit)); sdv_gpio_pub_irq_handler()
132 static int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd, sdv_register_irqsupport() argument
138 sd->irq_base = irq_alloc_descs(-1, 0, SDV_NUM_PUB_GPIOS, -1); sdv_register_irqsupport()
139 if (sd->irq_base < 0) sdv_register_irqsupport()
140 return sd->irq_base; sdv_register_irqsupport()
143 writel(0, sd->gpio_pub_base + GPIO_INT); sdv_register_irqsupport()
144 writel((1 << 11) - 1, sd->gpio_pub_base + GPSTR); sdv_register_irqsupport()
147 "sdv_gpio", sd); sdv_register_irqsupport()
156 sd->gc = irq_alloc_generic_chip("sdv-gpio", 1, sd->irq_base, sdv_register_irqsupport()
157 sd->gpio_pub_base, handle_fasteoi_irq); sdv_register_irqsupport()
158 if (!sd->gc) { sdv_register_irqsupport()
163 sd->gc->private = sd; sdv_register_irqsupport()
164 ct = sd->gc->chip_types; sdv_register_irqsupport()
173 irq_setup_generic_chip(sd->gc, IRQ_MSK(SDV_NUM_PUB_GPIOS), sdv_register_irqsupport()
177 sd->id = irq_domain_add_legacy(pdev->dev.of_node, SDV_NUM_PUB_GPIOS, sdv_register_irqsupport()
178 sd->irq_base, 0, &irq_domain_sdv_ops, sd); sdv_register_irqsupport()
179 if (!sd->id) { sdv_register_irqsupport()
185 free_irq(pdev->irq, sd); sdv_register_irqsupport()
187 irq_free_descs(sd->irq_base, SDV_NUM_PUB_GPIOS); sdv_register_irqsupport()
194 struct sdv_gpio_chip_data *sd; sdv_gpio_probe() local
201 sd = kzalloc(sizeof(struct sdv_gpio_chip_data), GFP_KERNEL); sdv_gpio_probe()
202 if (!sd) sdv_gpio_probe()
221 sd->gpio_pub_base = ioremap(addr, pci_resource_len(pdev, GPIO_BAR)); sdv_gpio_probe()
226 writel(mux_val, sd->gpio_pub_base + GPMUXCTL); sdv_gpio_probe()
229 ret = bgpio_init(&sd->bgpio, &pdev->dev, 4, sdv_gpio_probe()
230 sd->gpio_pub_base + GPINR, sd->gpio_pub_base + GPOUTR, sdv_gpio_probe()
231 NULL, sd->gpio_pub_base + GPOER, NULL, 0); sdv_gpio_probe()
234 sd->bgpio.gc.ngpio = SDV_NUM_PUB_GPIOS; sdv_gpio_probe()
236 ret = gpiochip_add(&sd->bgpio.gc); sdv_gpio_probe()
242 ret = sdv_register_irqsupport(sd, pdev); sdv_gpio_probe()
246 pci_set_drvdata(pdev, sd); sdv_gpio_probe()
251 iounmap(sd->gpio_pub_base); sdv_gpio_probe()
257 kfree(sd); sdv_gpio_probe()
263 struct sdv_gpio_chip_data *sd = pci_get_drvdata(pdev); sdv_gpio_remove() local
265 free_irq(pdev->irq, sd); sdv_gpio_remove()
266 irq_free_descs(sd->irq_base, SDV_NUM_PUB_GPIOS); sdv_gpio_remove()
268 gpiochip_remove(&sd->bgpio.gc); sdv_gpio_remove()
270 iounmap(sd->gpio_pub_base); sdv_gpio_remove()
272 kfree(sd); sdv_gpio_remove()
/linux-4.1.27/arch/x86/include/asm/
H A Dpci_64.h9 struct pci_sysdata *sd = bus->sysdata; pci_iommu() local
10 return sd->iommu; pci_iommu()
15 struct pci_sysdata *sd = bus->sysdata; set_pci_iommu() local
16 sd->iommu = val; set_pci_iommu()
/linux-4.1.27/drivers/media/usb/gspca/gl860/
H A Dgl860.c65 struct sd *sd = (struct sd *) gspca_dev; sd_s_ctrl() local
69 sd->vcur.brightness = ctrl->val; sd_s_ctrl()
72 sd->vcur.contrast = ctrl->val; sd_s_ctrl()
75 sd->vcur.saturation = ctrl->val; sd_s_ctrl()
78 sd->vcur.hue = ctrl->val; sd_s_ctrl()
81 sd->vcur.gamma = ctrl->val; sd_s_ctrl()
84 sd->vcur.mirror = ctrl->val; sd_s_ctrl()
87 sd->vcur.flip = ctrl->val; sd_s_ctrl()
90 sd->vcur.AC50Hz = ctrl->val; sd_s_ctrl()
93 sd->vcur.whitebal = ctrl->val; sd_s_ctrl()
96 sd->vcur.sharpness = ctrl->val; sd_s_ctrl()
99 sd->vcur.backlight = ctrl->val; sd_s_ctrl()
106 sd->waitSet = 1; sd_s_ctrl()
117 struct sd *sd = (struct sd *) gspca_dev; sd_init_controls() local
123 if (sd->vmax.brightness) sd_init_controls()
125 0, sd->vmax.brightness, 1, sd_init_controls()
126 sd->vcur.brightness); sd_init_controls()
128 if (sd->vmax.contrast) sd_init_controls()
130 0, sd->vmax.contrast, 1, sd_init_controls()
131 sd->vcur.contrast); sd_init_controls()
133 if (sd->vmax.saturation) sd_init_controls()
135 0, sd->vmax.saturation, 1, sd_init_controls()
136 sd->vcur.saturation); sd_init_controls()
138 if (sd->vmax.hue) sd_init_controls()
140 0, sd->vmax.hue, 1, sd->vcur.hue); sd_init_controls()
142 if (sd->vmax.gamma) sd_init_controls()
144 0, sd->vmax.gamma, 1, sd->vcur.gamma); sd_init_controls()
146 if (sd->vmax.mirror) sd_init_controls()
148 0, sd->vmax.mirror, 1, sd->vcur.mirror); sd_init_controls()
150 if (sd->vmax.flip) sd_init_controls()
152 0, sd->vmax.flip, 1, sd->vcur.flip); sd_init_controls()
154 if (sd->vmax.AC50Hz) sd_init_controls()
157 sd->vmax.AC50Hz, 0, sd->vcur.AC50Hz); sd_init_controls()
159 if (sd->vmax.whitebal) sd_init_controls()
162 0, sd->vmax.whitebal, 1, sd->vcur.whitebal); sd_init_controls()
164 if (sd->vmax.sharpness) sd_init_controls()
166 0, sd->vmax.sharpness, 1, sd_init_controls()
167 sd->vcur.sharpness); sd_init_controls()
169 if (sd->vmax.backlight) sd_init_controls()
172 0, sd->vmax.backlight, 1, sd_init_controls()
173 sd->vcur.backlight); sd_init_controls()
331 struct sd *sd = (struct sd *) gspca_dev; sd_config() local
339 sd->nbRightUp = 1; sd_config()
340 sd->nbIm = -1; sd_config()
342 sd->sensor = 0xff; sd_config()
344 sd->sensor = ID_MI1320; sd_config()
346 sd->sensor = ID_OV2640; sd_config()
348 sd->sensor = ID_OV9655; sd_config()
350 sd->sensor = ID_MI2020; sd_config()
358 switch (sd->sensor) { sd_config()
390 ((struct sd *) gspca_dev)->vcur.AC50Hz = AC50Hz; sd_config()
398 struct sd *sd = (struct sd *) gspca_dev; sd_init() local
400 return sd->dev_init_at_startup(gspca_dev); sd_init()
406 struct sd *sd = (struct sd *) gspca_dev; sd_isoc_init() local
408 return sd->dev_configure_alt(gspca_dev); sd_isoc_init()
414 struct sd *sd = (struct sd *) gspca_dev; sd_start() local
416 return sd->dev_init_pre_alt(gspca_dev); sd_start()
422 struct sd *sd = (struct sd *) gspca_dev; sd_stop0() local
424 if (!sd->gspca_dev.present) sd_stop0()
427 return sd->dev_post_unset_alt(gspca_dev); sd_stop0()
434 struct sd *sd = (struct sd *) gspca_dev; sd_pkt_scan() local
439 sd->swapRB * (gspca_dev->cam.cam_mode[mode].bytesperline + 1); sd_pkt_scan()
446 if (sd->nbIm >= 0 && sd->nbIm < 10) sd_pkt_scan()
447 sd->nbIm++; sd_pkt_scan()
473 struct sd *sd = (struct sd *) gspca_dev; sd_callback() local
486 if (upsideDown && sd->nbRightUp > -4) { sd_callback()
487 if (sd->nbRightUp > 0) sd_callback()
488 sd->nbRightUp = 0; sd_callback()
489 if (sd->nbRightUp == -3) { sd_callback()
490 sd->mirrorMask = 1; sd_callback()
491 sd->waitSet = 1; sd_callback()
493 sd->nbRightUp--; sd_callback()
495 if (!upsideDown && sd->nbRightUp < 4) { sd_callback()
496 if (sd->nbRightUp < 0) sd_callback()
497 sd->nbRightUp = 0; sd_callback()
498 if (sd->nbRightUp == 3) { sd_callback()
499 sd->mirrorMask = 0; sd_callback()
500 sd->waitSet = 1; sd_callback()
502 sd->nbRightUp++; sd_callback()
506 if (sd->waitSet) sd_callback()
507 sd->dev_camera_settings(gspca_dev); sd_callback()
524 &sd_desc_mi1320, sizeof(struct sd), THIS_MODULE); sd_probe()
639 struct sd *sd = (struct sd *) gspca_dev; gl860_guess_sensor() local
643 sd->sensor = ID_MI1320; gl860_guess_sensor()
645 if (sd->sensor == 0xff) { gl860_guess_sensor()
700 sd->sensor = ID_OV2640; gl860_guess_sensor()
708 sd->sensor = ID_OV9655; gl860_guess_sensor()
723 sd->sensor = ID_MI2020; gl860_guess_sensor()
H A Dgl860-mi1320.c187 struct sd *sd = (struct sd *) gspca_dev; mi1320_init_settings() local
189 sd->vcur.backlight = 0; mi1320_init_settings()
190 sd->vcur.brightness = 0; mi1320_init_settings()
191 sd->vcur.sharpness = 6; mi1320_init_settings()
192 sd->vcur.contrast = 10; mi1320_init_settings()
193 sd->vcur.gamma = 20; mi1320_init_settings()
194 sd->vcur.hue = 0; mi1320_init_settings()
195 sd->vcur.saturation = 6; mi1320_init_settings()
196 sd->vcur.whitebal = 0; mi1320_init_settings()
197 sd->vcur.mirror = 0; mi1320_init_settings()
198 sd->vcur.flip = 0; mi1320_init_settings()
199 sd->vcur.AC50Hz = 1; mi1320_init_settings()
201 sd->vmax.backlight = 2; mi1320_init_settings()
202 sd->vmax.brightness = 8; mi1320_init_settings()
203 sd->vmax.sharpness = 7; mi1320_init_settings()
204 sd->vmax.contrast = 0; /* 10 but not working with this driver */ mi1320_init_settings()
205 sd->vmax.gamma = 40; mi1320_init_settings()
206 sd->vmax.hue = 5 + 1; mi1320_init_settings()
207 sd->vmax.saturation = 8; mi1320_init_settings()
208 sd->vmax.whitebal = 2; mi1320_init_settings()
209 sd->vmax.mirror = 1; mi1320_init_settings()
210 sd->vmax.flip = 1; mi1320_init_settings()
211 sd->vmax.AC50Hz = 1; mi1320_init_settings()
213 sd->dev_camera_settings = mi1320_camera_settings; mi1320_init_settings()
214 sd->dev_init_at_startup = mi1320_init_at_startup; mi1320_init_settings()
215 sd->dev_configure_alt = mi1320_configure_alt; mi1320_init_settings()
216 sd->dev_init_pre_alt = mi1320_init_pre_alt; mi1320_init_settings()
217 sd->dev_post_unset_alt = mi1320_post_unset_alt; mi1320_init_settings()
262 struct sd *sd = (struct sd *) gspca_dev; mi1320_init_pre_alt() local
264 sd->mirrorMask = 0; mi1320_init_pre_alt()
266 sd->vold.backlight = -1; mi1320_init_pre_alt()
267 sd->vold.brightness = -1; mi1320_init_pre_alt()
268 sd->vold.sharpness = -1; mi1320_init_pre_alt()
269 sd->vold.contrast = -1; mi1320_init_pre_alt()
270 sd->vold.saturation = -1; mi1320_init_pre_alt()
271 sd->vold.gamma = -1; mi1320_init_pre_alt()
272 sd->vold.hue = -1; mi1320_init_pre_alt()
273 sd->vold.whitebal = -1; mi1320_init_pre_alt()
274 sd->vold.mirror = -1; mi1320_init_pre_alt()
275 sd->vold.flip = -1; mi1320_init_pre_alt()
276 sd->vold.AC50Hz = -1; mi1320_init_pre_alt()
350 struct sd *sd = (struct sd *) gspca_dev; mi1320_camera_settings() local
352 s32 backlight = sd->vcur.backlight; mi1320_camera_settings()
353 s32 bright = sd->vcur.brightness; mi1320_camera_settings()
354 s32 sharp = sd->vcur.sharpness; mi1320_camera_settings()
355 s32 cntr = sd->vcur.contrast; mi1320_camera_settings()
356 s32 gam = sd->vcur.gamma; mi1320_camera_settings()
357 s32 hue = sd->vcur.hue; mi1320_camera_settings()
358 s32 sat = sd->vcur.saturation; mi1320_camera_settings()
359 s32 wbal = sd->vcur.whitebal; mi1320_camera_settings()
360 s32 mirror = (((sd->vcur.mirror > 0) ^ sd->mirrorMask) > 0); mi1320_camera_settings()
361 s32 flip = (((sd->vcur.flip > 0) ^ sd->mirrorMask) > 0); mi1320_camera_settings()
362 s32 freq = (sd->vcur.AC50Hz > 0); mi1320_camera_settings()
365 if (freq != sd->vold.AC50Hz) { mi1320_camera_settings()
366 sd->vold.AC50Hz = freq; mi1320_camera_settings()
375 if (wbal != sd->vold.whitebal) { mi1320_camera_settings()
376 sd->vold.whitebal = wbal; mi1320_camera_settings()
377 if (wbal < 0 || wbal > sd->vmax.whitebal) mi1320_camera_settings()
416 if (bright != sd->vold.brightness) { mi1320_camera_settings()
417 sd->vold.brightness = bright; mi1320_camera_settings()
418 if (bright < 0 || bright > sd->vmax.brightness) mi1320_camera_settings()
428 if (sat != sd->vold.saturation) { mi1320_camera_settings()
429 sd->vold.saturation = sat; mi1320_camera_settings()
430 if (sat < 0 || sat > sd->vmax.saturation) mi1320_camera_settings()
440 if (sharp != sd->vold.sharpness) { mi1320_camera_settings()
441 sd->vold.sharpness = sharp; mi1320_camera_settings()
442 if (sharp < 0 || sharp > sd->vmax.sharpness) mi1320_camera_settings()
451 if (hue != sd->vold.hue) { mi1320_camera_settings()
453 if (hue < 0 || hue > sd->vmax.hue) mi1320_camera_settings()
455 if (hue == sd->vmax.hue) mi1320_camera_settings()
456 sd->swapRB = 1; mi1320_camera_settings()
458 sd->swapRB = 0; mi1320_camera_settings()
467 if (backlight != sd->vold.backlight) { mi1320_camera_settings()
468 sd->vold.backlight = backlight; mi1320_camera_settings()
469 if (backlight < 0 || backlight > sd->vmax.backlight) mi1320_camera_settings()
482 if (hue != sd->vold.hue) { mi1320_camera_settings()
483 sd->vold.hue = hue; mi1320_camera_settings()
492 if (mirror != sd->vold.mirror || flip != sd->vold.flip) { mi1320_camera_settings()
494 sd->vold.mirror = mirror; mi1320_camera_settings()
495 sd->vold.flip = flip; mi1320_camera_settings()
502 if (gam != sd->vold.gamma) { mi1320_camera_settings()
503 sd->vold.gamma = gam; mi1320_camera_settings()
504 if (gam < 0 || gam > sd->vmax.gamma) mi1320_camera_settings()
514 if (cntr != sd->vold.contrast) { mi1320_camera_settings()
515 sd->vold.contrast = cntr; mi1320_camera_settings()
516 if (cntr < 0 || cntr > sd->vmax.contrast) mi1320_camera_settings()
H A Dgl860-ov2640.c185 struct sd *sd = (struct sd *) gspca_dev; ov2640_init_settings() local
187 sd->vcur.backlight = 32; ov2640_init_settings()
188 sd->vcur.brightness = 0; ov2640_init_settings()
189 sd->vcur.sharpness = 6; ov2640_init_settings()
190 sd->vcur.contrast = 0; ov2640_init_settings()
191 sd->vcur.gamma = 32; ov2640_init_settings()
192 sd->vcur.hue = 0; ov2640_init_settings()
193 sd->vcur.saturation = 128; ov2640_init_settings()
194 sd->vcur.whitebal = 64; ov2640_init_settings()
195 sd->vcur.mirror = 0; ov2640_init_settings()
196 sd->vcur.flip = 0; ov2640_init_settings()
198 sd->vmax.backlight = 64; ov2640_init_settings()
199 sd->vmax.brightness = 255; ov2640_init_settings()
200 sd->vmax.sharpness = 31; ov2640_init_settings()
201 sd->vmax.contrast = 255; ov2640_init_settings()
202 sd->vmax.gamma = 64; ov2640_init_settings()
203 sd->vmax.hue = 254 + 2; ov2640_init_settings()
204 sd->vmax.saturation = 255; ov2640_init_settings()
205 sd->vmax.whitebal = 128; ov2640_init_settings()
206 sd->vmax.mirror = 1; ov2640_init_settings()
207 sd->vmax.flip = 1; ov2640_init_settings()
208 sd->vmax.AC50Hz = 0; ov2640_init_settings()
210 sd->dev_camera_settings = ov2640_camera_settings; ov2640_init_settings()
211 sd->dev_init_at_startup = ov2640_init_at_startup; ov2640_init_settings()
212 sd->dev_configure_alt = ov2640_configure_alt; ov2640_init_settings()
213 sd->dev_init_pre_alt = ov2640_init_pre_alt; ov2640_init_settings()
214 sd->dev_post_unset_alt = ov2640_post_unset_alt; ov2640_init_settings()
247 struct sd *sd = (struct sd *) gspca_dev; ov2640_init_pre_alt() local
249 sd->mirrorMask = 0; ov2640_init_pre_alt()
251 sd->vold.backlight = -1; ov2640_init_pre_alt()
252 sd->vold.brightness = -1; ov2640_init_pre_alt()
253 sd->vold.sharpness = -1; ov2640_init_pre_alt()
254 sd->vold.contrast = -1; ov2640_init_pre_alt()
255 sd->vold.saturation = -1; ov2640_init_pre_alt()
256 sd->vold.gamma = -1; ov2640_init_pre_alt()
257 sd->vold.hue = -1; ov2640_init_pre_alt()
258 sd->vold.whitebal = -1; ov2640_init_pre_alt()
259 sd->vold.mirror = -1; ov2640_init_pre_alt()
260 sd->vold.flip = -1; ov2640_init_pre_alt()
349 struct sd *sd = (struct sd *) gspca_dev; ov2640_camera_settings() local
351 s32 backlight = sd->vcur.backlight; ov2640_camera_settings()
352 s32 bright = sd->vcur.brightness; ov2640_camera_settings()
353 s32 sharp = sd->vcur.sharpness; ov2640_camera_settings()
354 s32 gam = sd->vcur.gamma; ov2640_camera_settings()
355 s32 cntr = sd->vcur.contrast; ov2640_camera_settings()
356 s32 sat = sd->vcur.saturation; ov2640_camera_settings()
357 s32 hue = sd->vcur.hue; ov2640_camera_settings()
358 s32 wbal = sd->vcur.whitebal; ov2640_camera_settings()
359 s32 mirror = (((sd->vcur.mirror > 0) ^ sd->mirrorMask) == 0); ov2640_camera_settings()
360 s32 flip = (((sd->vcur.flip > 0) ^ sd->mirrorMask) == 0); ov2640_camera_settings()
362 if (backlight != sd->vold.backlight) { ov2640_camera_settings()
363 /* No sd->vold.backlight=backlight; (to be done again later) */ ov2640_camera_settings()
364 if (backlight < 0 || backlight > sd->vmax.backlight) ov2640_camera_settings()
375 if (bright != sd->vold.brightness) { ov2640_camera_settings()
376 sd->vold.brightness = bright; ov2640_camera_settings()
377 if (bright < 0 || bright > sd->vmax.brightness) ov2640_camera_settings()
385 if (wbal != sd->vold.whitebal) { ov2640_camera_settings()
386 sd->vold.whitebal = wbal; ov2640_camera_settings()
387 if (wbal < 0 || wbal > sd->vmax.whitebal) ov2640_camera_settings()
395 if (cntr != sd->vold.contrast) { ov2640_camera_settings()
396 sd->vold.contrast = cntr; ov2640_camera_settings()
397 if (cntr < 0 || cntr > sd->vmax.contrast) ov2640_camera_settings()
405 if (sat != sd->vold.saturation) { ov2640_camera_settings()
406 sd->vold.saturation = sat; ov2640_camera_settings()
407 if (sat < 0 || sat > sd->vmax.saturation) ov2640_camera_settings()
415 if (sharp != sd->vold.sharpness) { ov2640_camera_settings()
416 sd->vold.sharpness = sharp; ov2640_camera_settings()
417 if (sharp < 0 || sharp > sd->vmax.sharpness) ov2640_camera_settings()
425 if (hue != sd->vold.hue) { ov2640_camera_settings()
426 sd->vold.hue = hue; ov2640_camera_settings()
427 if (hue < 0 || hue > sd->vmax.hue) ov2640_camera_settings()
435 sd->swapRB = 1; ov2640_camera_settings()
437 sd->swapRB = 0; ov2640_camera_settings()
440 if (gam != sd->vold.gamma) { ov2640_camera_settings()
441 sd->vold.gamma = gam; ov2640_camera_settings()
442 if (gam < 0 || gam > sd->vmax.gamma) ov2640_camera_settings()
450 if (mirror != sd->vold.mirror || flip != sd->vold.flip) { ov2640_camera_settings()
451 sd->vold.mirror = mirror; ov2640_camera_settings()
452 sd->vold.flip = flip; ov2640_camera_settings()
469 if (backlight != sd->vold.backlight) { ov2640_camera_settings()
470 sd->vold.backlight = backlight; ov2640_camera_settings()
H A Dgl860-mi2020.c365 struct sd *sd = (struct sd *) gspca_dev; mi2020_init_settings() local
367 sd->vcur.backlight = 0; mi2020_init_settings()
368 sd->vcur.brightness = 70; mi2020_init_settings()
369 sd->vcur.sharpness = 20; mi2020_init_settings()
370 sd->vcur.contrast = 0; mi2020_init_settings()
371 sd->vcur.gamma = 0; mi2020_init_settings()
372 sd->vcur.hue = 0; mi2020_init_settings()
373 sd->vcur.saturation = 60; mi2020_init_settings()
374 sd->vcur.whitebal = 0; /* 50, not done by hardware */ mi2020_init_settings()
375 sd->vcur.mirror = 0; mi2020_init_settings()
376 sd->vcur.flip = 0; mi2020_init_settings()
377 sd->vcur.AC50Hz = 1; mi2020_init_settings()
379 sd->vmax.backlight = 64; mi2020_init_settings()
380 sd->vmax.brightness = 128; mi2020_init_settings()
381 sd->vmax.sharpness = 40; mi2020_init_settings()
382 sd->vmax.contrast = 3; mi2020_init_settings()
383 sd->vmax.gamma = 2; mi2020_init_settings()
384 sd->vmax.hue = 0 + 1; /* 200, not done by hardware */ mi2020_init_settings()
385 sd->vmax.saturation = 0; /* 100, not done by hardware */ mi2020_init_settings()
386 sd->vmax.whitebal = 2; /* 100, not done by hardware */ mi2020_init_settings()
387 sd->vmax.mirror = 1; mi2020_init_settings()
388 sd->vmax.flip = 1; mi2020_init_settings()
389 sd->vmax.AC50Hz = 1; mi2020_init_settings()
391 sd->dev_camera_settings = mi2020_camera_settings; mi2020_init_settings()
392 sd->dev_init_at_startup = mi2020_init_at_startup; mi2020_init_settings()
393 sd->dev_configure_alt = mi2020_configure_alt; mi2020_init_settings()
394 sd->dev_init_pre_alt = mi2020_init_pre_alt; mi2020_init_settings()
395 sd->dev_post_unset_alt = mi2020_post_unset_alt; mi2020_init_settings()
432 struct sd *sd = (struct sd *) gspca_dev; mi2020_init_pre_alt() local
434 sd->mirrorMask = 0; mi2020_init_pre_alt()
435 sd->vold.hue = -1; mi2020_init_pre_alt()
438 sd->vold.brightness = -1; mi2020_init_pre_alt()
439 sd->vold.sharpness = -1; mi2020_init_pre_alt()
442 sd->vold.contrast = 0; mi2020_init_pre_alt()
443 sd->vold.gamma = 0; mi2020_init_pre_alt()
444 sd->vold.backlight = 0; mi2020_init_pre_alt()
453 struct sd *sd = (struct sd *) gspca_dev; mi2020_init_post_alt() local
456 s32 mirror = (((sd->vcur.mirror > 0) ^ sd->mirrorMask) > 0); mi2020_init_post_alt()
457 s32 flip = (((sd->vcur.flip > 0) ^ sd->mirrorMask) > 0); mi2020_init_post_alt()
458 s32 freq = (sd->vcur.AC50Hz > 0); mi2020_init_post_alt()
459 s32 wbal = sd->vcur.whitebal; mi2020_init_post_alt()
471 sd->nbIm = -1; mi2020_init_post_alt()
603 sd->nbIm = 0; mi2020_init_post_alt()
605 sd->vold.mirror = mirror; mi2020_init_post_alt()
606 sd->vold.flip = flip; mi2020_init_post_alt()
607 sd->vold.AC50Hz = freq; mi2020_init_post_alt()
608 sd->vold.whitebal = wbal; mi2020_init_post_alt()
635 struct sd *sd = (struct sd *) gspca_dev; mi2020_camera_settings() local
638 s32 backlight = sd->vcur.backlight; mi2020_camera_settings()
639 s32 bright = sd->vcur.brightness; mi2020_camera_settings()
640 s32 sharp = sd->vcur.sharpness; mi2020_camera_settings()
641 s32 cntr = sd->vcur.contrast; mi2020_camera_settings()
642 s32 gam = sd->vcur.gamma; mi2020_camera_settings()
643 s32 hue = (sd->vcur.hue > 0); mi2020_camera_settings()
644 s32 mirror = (((sd->vcur.mirror > 0) ^ sd->mirrorMask) > 0); mi2020_camera_settings()
645 s32 flip = (((sd->vcur.flip > 0) ^ sd->mirrorMask) > 0); mi2020_camera_settings()
646 s32 freq = (sd->vcur.AC50Hz > 0); mi2020_camera_settings()
647 s32 wbal = sd->vcur.whitebal; mi2020_camera_settings()
661 if (sd->nbIm < 4) { mi2020_camera_settings()
662 sd->waitSet = 1; mi2020_camera_settings()
665 sd->waitSet = 0; mi2020_camera_settings()
667 if (freq != sd->vold.AC50Hz) { mi2020_camera_settings()
668 sd->vold.AC50Hz = freq; mi2020_camera_settings()
676 if (wbal != sd->vold.whitebal) { mi2020_camera_settings()
677 sd->vold.whitebal = wbal; mi2020_camera_settings()
678 if (wbal < 0 || wbal > sd->vmax.whitebal) mi2020_camera_settings()
703 if (mirror != sd->vold.mirror || flip != sd->vold.flip) { mi2020_camera_settings()
704 sd->vold.mirror = mirror; mi2020_camera_settings()
705 sd->vold.flip = flip; mi2020_camera_settings()
732 if (bright != sd->vold.brightness) { mi2020_camera_settings()
733 sd->vold.brightness = bright; mi2020_camera_settings()
734 if (bright < 0 || bright > sd->vmax.brightness) mi2020_camera_settings()
746 if (cntr != sd->vold.contrast || gam != sd->vold.gamma) { mi2020_camera_settings()
747 sd->vold.contrast = cntr; mi2020_camera_settings()
748 if (cntr < 0 || cntr > sd->vmax.contrast) mi2020_camera_settings()
750 sd->vold.gamma = gam; mi2020_camera_settings()
751 if (gam < 0 || gam > sd->vmax.gamma) mi2020_camera_settings()
767 if (backlight != sd->vold.backlight) { mi2020_camera_settings()
768 sd->vold.backlight = backlight; mi2020_camera_settings()
769 if (backlight < 0 || backlight > sd->vmax.backlight) mi2020_camera_settings()
783 if (sharp != sd->vold.sharpness) { mi2020_camera_settings()
784 sd->vold.sharpness = sharp; mi2020_camera_settings()
785 if (sharp < 0 || sharp > sd->vmax.sharpness) mi2020_camera_settings()
792 if (hue != sd->vold.hue) { mi2020_camera_settings()
793 sd->swapRB = hue; mi2020_camera_settings()
794 sd->vold.hue = hue; mi2020_camera_settings()
H A Dgl860-ov9655.c155 struct sd *sd = (struct sd *) gspca_dev; ov9655_init_settings() local
157 sd->vcur.backlight = 0; ov9655_init_settings()
158 sd->vcur.brightness = 128; ov9655_init_settings()
159 sd->vcur.sharpness = 0; ov9655_init_settings()
160 sd->vcur.contrast = 0; ov9655_init_settings()
161 sd->vcur.gamma = 0; ov9655_init_settings()
162 sd->vcur.hue = 0; ov9655_init_settings()
163 sd->vcur.saturation = 0; ov9655_init_settings()
164 sd->vcur.whitebal = 0; ov9655_init_settings()
166 sd->vmax.backlight = 0; ov9655_init_settings()
167 sd->vmax.brightness = 255; ov9655_init_settings()
168 sd->vmax.sharpness = 0; ov9655_init_settings()
169 sd->vmax.contrast = 0; ov9655_init_settings()
170 sd->vmax.gamma = 0; ov9655_init_settings()
171 sd->vmax.hue = 0 + 1; ov9655_init_settings()
172 sd->vmax.saturation = 0; ov9655_init_settings()
173 sd->vmax.whitebal = 0; ov9655_init_settings()
174 sd->vmax.mirror = 0; ov9655_init_settings()
175 sd->vmax.flip = 0; ov9655_init_settings()
176 sd->vmax.AC50Hz = 0; ov9655_init_settings()
178 sd->dev_camera_settings = ov9655_camera_settings; ov9655_init_settings()
179 sd->dev_init_at_startup = ov9655_init_at_startup; ov9655_init_settings()
180 sd->dev_configure_alt = ov9655_configure_alt; ov9655_init_settings()
181 sd->dev_init_pre_alt = ov9655_init_pre_alt; ov9655_init_settings()
182 sd->dev_post_unset_alt = ov9655_post_unset_alt; ov9655_init_settings()
199 struct sd *sd = (struct sd *) gspca_dev; ov9655_init_pre_alt() local
201 sd->vold.brightness = -1; ov9655_init_pre_alt()
202 sd->vold.hue = -1; ov9655_init_pre_alt()
308 struct sd *sd = (struct sd *) gspca_dev; ov9655_camera_settings() local
312 s32 bright = sd->vcur.brightness; ov9655_camera_settings()
313 s32 hue = sd->vcur.hue; ov9655_camera_settings()
315 if (bright != sd->vold.brightness) { ov9655_camera_settings()
316 sd->vold.brightness = bright; ov9655_camera_settings()
317 if (bright < 0 || bright > sd->vmax.brightness) ov9655_camera_settings()
324 if (hue != sd->vold.hue) { ov9655_camera_settings()
325 sd->vold.hue = hue; ov9655_camera_settings()
326 sd->swapRB = (hue != 0); ov9655_camera_settings()
H A Dgl860.h35 #define _MI1320_ (((struct sd *) gspca_dev)->sensor == ID_MI1320)
36 #define _MI2020_ (((struct sd *) gspca_dev)->sensor == ID_MI2020)
37 #define _OV2640_ (((struct sd *) gspca_dev)->sensor == ID_OV2640)
38 #define _OV9655_ (((struct sd *) gspca_dev)->sensor == ID_OV9655)
60 struct sd { struct
/linux-4.1.27/drivers/media/i2c/m5mols/
H A Dm5mols_capture.c40 static int m5mols_read_rational(struct v4l2_subdev *sd, u32 addr_num, m5mols_read_rational() argument
45 int ret = m5mols_read_u32(sd, addr_num, &num); m5mols_read_rational()
47 ret = m5mols_read_u32(sd, addr_den, &den); m5mols_read_rational()
62 struct v4l2_subdev *sd = &info->sd; m5mols_capture_info() local
65 ret = m5mols_read_rational(sd, EXIF_INFO_EXPTIME_NU, m5mols_capture_info()
69 ret = m5mols_read_rational(sd, EXIF_INFO_TV_NU, EXIF_INFO_TV_DE, m5mols_capture_info()
73 ret = m5mols_read_rational(sd, EXIF_INFO_AV_NU, EXIF_INFO_AV_DE, m5mols_capture_info()
77 ret = m5mols_read_rational(sd, EXIF_INFO_BV_NU, EXIF_INFO_BV_DE, m5mols_capture_info()
81 ret = m5mols_read_rational(sd, EXIF_INFO_EBV_NU, EXIF_INFO_EBV_DE, m5mols_capture_info()
86 ret = m5mols_read_u16(sd, EXIF_INFO_ISO, &exif->iso_speed); m5mols_capture_info()
88 ret = m5mols_read_u16(sd, EXIF_INFO_FLASH, &exif->flash); m5mols_capture_info()
90 ret = m5mols_read_u16(sd, EXIF_INFO_SDR, &exif->sdr); m5mols_capture_info()
92 ret = m5mols_read_u16(sd, EXIF_INFO_QVAL, &exif->qval); m5mols_capture_info()
97 ret = m5mols_read_u32(sd, CAPC_IMAGE_SIZE, &info->cap.main); m5mols_capture_info()
99 ret = m5mols_read_u32(sd, CAPC_THUMB_SIZE, &info->cap.thumb); m5mols_capture_info()
109 struct v4l2_subdev *sd = &info->sd; m5mols_start_capture() local
121 ret = m5mols_write(sd, CAPP_YUVOUT_MAIN, REG_JPEG); m5mols_start_capture()
123 ret = m5mols_write(sd, CAPP_MAIN_IMAGE_SIZE, info->resolution); m5mols_start_capture()
125 ret = m5mols_write(sd, CAPP_JPEG_SIZE_MAX, framesize); m5mols_start_capture()
130 ret = m5mols_wait_interrupt(sd, REG_INT_CAPTURE, 2000); m5mols_start_capture()
137 ret = m5mols_write(sd, CAPC_SEL_FRAME, 1); m5mols_start_capture()
139 ret = m5mols_write(sd, CAPC_START, REG_CAP_START_MAIN); m5mols_start_capture()
145 ret = m5mols_wait_interrupt(sd, REG_INT_CAPTURE, 2000); m5mols_start_capture()
151 v4l2_dbg(1, m5mols_debug, sd, "%s: size: %d, thumb.: %d B\n", m5mols_start_capture()
154 v4l2_subdev_notify(sd, S5P_FIMC_TX_END_NOTIFY, &size); m5mols_start_capture()
H A Dm5mols_controls.c135 struct v4l2_subdev *sd = &info->sd; m5mols_do_scenemode() local
144 ret = m5mols_write(sd, AE_EV_PRESET_MONITOR, mode); m5mols_do_scenemode()
146 ret = m5mols_write(sd, AE_EV_PRESET_CAPTURE, mode); m5mols_do_scenemode()
148 ret = m5mols_write(sd, AE_MODE, scenemode.metering); m5mols_do_scenemode()
150 ret = m5mols_write(sd, AE_INDEX, scenemode.ev_bias); m5mols_do_scenemode()
152 ret = m5mols_write(sd, AWB_MODE, scenemode.wb_mode); m5mols_do_scenemode()
154 ret = m5mols_write(sd, AWB_MANUAL, scenemode.wb_preset); m5mols_do_scenemode()
156 ret = m5mols_write(sd, MON_CHROMA_EN, scenemode.chroma_en); m5mols_do_scenemode()
158 ret = m5mols_write(sd, MON_CHROMA_LVL, scenemode.chroma_lvl); m5mols_do_scenemode()
160 ret = m5mols_write(sd, MON_EDGE_EN, scenemode.edge_en); m5mols_do_scenemode()
162 ret = m5mols_write(sd, MON_EDGE_LVL, scenemode.edge_lvl); m5mols_do_scenemode()
164 ret = m5mols_write(sd, AF_MODE, scenemode.af_range); m5mols_do_scenemode()
166 ret = m5mols_write(sd, FD_CTL, scenemode.fd_mode); m5mols_do_scenemode()
168 ret = m5mols_write(sd, MON_TONE_CTL, scenemode.tone); m5mols_do_scenemode()
170 ret = m5mols_write(sd, AE_ISO, scenemode.iso); m5mols_do_scenemode()
174 ret = m5mols_write(sd, CAPP_WDR_EN, scenemode.wdr); m5mols_do_scenemode()
176 ret = m5mols_write(sd, CAPP_MCC_MODE, scenemode.mcc); m5mols_do_scenemode()
178 ret = m5mols_write(sd, CAPP_LIGHT_CTRL, scenemode.light); m5mols_do_scenemode()
180 ret = m5mols_write(sd, CAPP_FLASH_CTRL, scenemode.flash); m5mols_do_scenemode()
182 ret = m5mols_write(sd, CAPC_MODE, scenemode.capt_mode); m5mols_do_scenemode()
197 ret = m5mols_write(&info->sd, AE_LOCK, ae_lock ? m5mols_3a_lock()
207 ret = m5mols_write(&info->sd, AWB_LOCK, awb_lock ? m5mols_3a_lock()
217 ret = m5mols_write(&info->sd, AF_EXECUTE, REG_AF_STOP); m5mols_3a_lock()
238 return m5mols_write(&info->sd, AE_MODE, metering); m5mols_set_metering_mode()
243 struct v4l2_subdev *sd = &info->sd; m5mols_set_exposure() local
255 v4l2_dbg(1, m5mols_debug, sd, m5mols_set_exposure()
260 return m5mols_write(sd, AE_INDEX, info->exposure_bias->val); m5mols_set_exposure()
264 ret = m5mols_write(sd, AE_MODE, REG_AE_OFF); m5mols_set_exposure()
266 ret = m5mols_write(sd, AE_MAN_GAIN_MON, m5mols_set_exposure()
269 ret = m5mols_write(sd, AE_MAN_GAIN_CAP, m5mols_set_exposure()
272 v4l2_dbg(1, m5mols_debug, sd, "%s: exposure: %#x\n", m5mols_set_exposure()
293 struct v4l2_subdev *sd = &info->sd; m5mols_set_white_balance() local
301 v4l2_dbg(1, m5mols_debug, sd, m5mols_set_white_balance()
305 ret = m5mols_write(sd, AWB_MODE, awb ? REG_AWB_AUTO : m5mols_set_white_balance()
311 ret = m5mols_write(sd, AWB_MANUAL, wb[i][1]); m5mols_set_white_balance()
319 int ret = m5mols_write(&info->sd, MON_CHROMA_LVL, val); m5mols_set_saturation()
323 return m5mols_write(&info->sd, MON_CHROMA_EN, REG_CHROMA_ON); m5mols_set_saturation()
331 struct v4l2_subdev *sd = &info->sd; m5mols_set_color_effect() local
351 ret = m5mols_write(sd, PARM_EFFECT, p_effect); m5mols_set_color_effect()
353 ret = m5mols_write(sd, MON_EFFECT, m_effect); m5mols_set_color_effect()
356 ret = m5mols_write(sd, MON_CFIXR, cfix_r); m5mols_set_color_effect()
358 ret = m5mols_write(sd, MON_CFIXB, cfix_b); m5mols_set_color_effect()
361 v4l2_dbg(1, m5mols_debug, sd, m5mols_set_color_effect()
372 return m5mols_write(&info->sd, AE_ISO, iso); m5mols_set_iso()
379 ret = m5mols_write(&info->sd, MON_TONE_CTL, wdr ? 9 : 5); m5mols_set_wdr()
387 return m5mols_write(&info->sd, CAPP_WDR_EN, wdr); m5mols_set_wdr()
392 struct v4l2_subdev *sd = &info->sd; m5mols_set_stabilization() local
396 ret = m5mols_write(sd, AE_EV_PRESET_MONITOR, evp); m5mols_set_stabilization()
400 return m5mols_write(sd, AE_EV_PRESET_CAPTURE, evp); m5mols_set_stabilization()
405 struct v4l2_subdev *sd = to_sd(ctrl); m5mols_g_volatile_ctrl() local
406 struct m5mols_info *info = to_m5mols(sd); m5mols_g_volatile_ctrl()
410 v4l2_dbg(1, m5mols_debug, sd, "%s: ctrl: %s (%d)\n", m5mols_g_volatile_ctrl()
418 ret = m5mols_read_u8(sd, AE_ISO, &status); m5mols_g_volatile_ctrl()
428 ret = m5mols_read_u8(sd, AE_LOCK, &status); m5mols_g_volatile_ctrl()
434 ret = m5mols_read_u8(sd, AWB_LOCK, &status); m5mols_g_volatile_ctrl()
440 ret = m5mols_read_u8(sd, AF_EXECUTE, &status); m5mols_g_volatile_ctrl()
452 struct v4l2_subdev *sd = to_sd(ctrl); m5mols_s_ctrl() local
453 struct m5mols_info *info = to_m5mols(sd); m5mols_s_ctrl()
466 v4l2_dbg(1, m5mols_debug, sd, "%s: %s, val: %d, priv: %p\n", m5mols_s_ctrl()
481 ret = m5mols_write(sd, MON_ZOOM, ctrl->val); m5mols_s_ctrl()
513 ret = m5mols_write(sd, CAPP_JPEG_RATIO, ctrl->val); m5mols_s_ctrl()
540 int m5mols_init_controls(struct v4l2_subdev *sd) m5mols_init_controls() argument
542 struct m5mols_info *info = to_m5mols(sd); m5mols_init_controls()
548 ret = m5mols_read_u16(sd, AE_MAX_GAIN_MON, &exposure_max); m5mols_init_controls()
609 v4l2_err(sd, "Failed to initialize controls: %d\n", ret); m5mols_init_controls()
625 sd->ctrl_handler = &info->handle; m5mols_init_controls()
H A Dm5mols_core.c141 static int m5mols_read(struct v4l2_subdev *sd, u32 size, u32 reg, u32 *val) m5mols_read() argument
143 struct i2c_client *client = v4l2_get_subdevdata(sd); m5mols_read()
144 struct m5mols_info *info = to_m5mols(sd); m5mols_read()
181 v4l2_err(sd, "read failed: size:%d cat:%02x cmd:%02x. %d\n", m5mols_read()
187 int m5mols_read_u8(struct v4l2_subdev *sd, u32 reg, u8 *val) m5mols_read_u8() argument
193 v4l2_err(sd, "Wrong data size\n"); m5mols_read_u8()
197 ret = m5mols_read(sd, I2C_SIZE(reg), reg, &val_32); m5mols_read_u8()
205 int m5mols_read_u16(struct v4l2_subdev *sd, u32 reg, u16 *val) m5mols_read_u16() argument
211 v4l2_err(sd, "Wrong data size\n"); m5mols_read_u16()
215 ret = m5mols_read(sd, I2C_SIZE(reg), reg, &val_32); m5mols_read_u16()
223 int m5mols_read_u32(struct v4l2_subdev *sd, u32 reg, u32 *val) m5mols_read_u32() argument
226 v4l2_err(sd, "Wrong data size\n"); m5mols_read_u32()
230 return m5mols_read(sd, I2C_SIZE(reg), reg, val); m5mols_read_u32()
240 int m5mols_write(struct v4l2_subdev *sd, u32 reg, u32 val) m5mols_write() argument
242 struct i2c_client *client = v4l2_get_subdevdata(sd); m5mols_write()
243 struct m5mols_info *info = to_m5mols(sd); m5mols_write()
256 v4l2_err(sd, "Wrong data size\n"); m5mols_write()
278 v4l2_err(sd, "write failed: cat:%02x cmd:%02x ret:%d\n", m5mols_write()
296 int m5mols_busy_wait(struct v4l2_subdev *sd, u32 reg, u32 value, u32 mask, m5mols_busy_wait() argument
304 int ret = m5mols_read_u8(sd, reg, &status); m5mols_busy_wait()
322 int m5mols_enable_interrupt(struct v4l2_subdev *sd, u8 reg) m5mols_enable_interrupt() argument
324 struct m5mols_info *info = to_m5mols(sd); m5mols_enable_interrupt()
329 ret = m5mols_read_u8(sd, SYSTEM_INT_FACTOR, &dummy); m5mols_enable_interrupt()
331 ret = m5mols_write(sd, SYSTEM_INT_ENABLE, reg & ~mask); m5mols_enable_interrupt()
335 int m5mols_wait_interrupt(struct v4l2_subdev *sd, u8 irq_mask, u32 timeout) m5mols_wait_interrupt() argument
337 struct m5mols_info *info = to_m5mols(sd); m5mols_wait_interrupt()
345 return m5mols_busy_wait(sd, SYSTEM_INT_FACTOR, irq_mask, m5mols_wait_interrupt()
355 static int m5mols_reg_mode(struct v4l2_subdev *sd, u8 mode) m5mols_reg_mode() argument
357 int ret = m5mols_write(sd, SYSTEM_SYSMODE, mode); m5mols_reg_mode()
360 return m5mols_busy_wait(sd, SYSTEM_SYSMODE, mode, 0xff, m5mols_reg_mode()
374 struct v4l2_subdev *sd = &info->sd; m5mols_set_mode() local
381 ret = m5mols_read_u8(sd, SYSTEM_SYSMODE, &reg); m5mols_set_mode()
387 ret = m5mols_reg_mode(sd, REG_MONITOR); m5mols_set_mode()
391 ret = m5mols_reg_mode(sd, REG_CAPTURE); m5mols_set_mode()
396 ret = m5mols_reg_mode(sd, REG_PARAMETER); m5mols_set_mode()
400 ret = m5mols_reg_mode(sd, REG_CAPTURE); m5mols_set_mode()
404 ret = m5mols_reg_mode(sd, REG_MONITOR); m5mols_set_mode()
408 ret = m5mols_reg_mode(sd, REG_PARAMETER); m5mols_set_mode()
412 v4l2_warn(sd, "Wrong mode: %d\n", mode); m5mols_set_mode()
427 static int m5mols_get_version(struct v4l2_subdev *sd) m5mols_get_version() argument
429 struct m5mols_info *info = to_m5mols(sd); m5mols_get_version()
435 ret = m5mols_read_u8(sd, SYSTEM_VER_CUSTOMER, &ver->customer); m5mols_get_version()
437 ret = m5mols_read_u8(sd, SYSTEM_VER_PROJECT, &ver->project); m5mols_get_version()
439 ret = m5mols_read_u16(sd, SYSTEM_VER_FIRMWARE, &ver->fw); m5mols_get_version()
441 ret = m5mols_read_u16(sd, SYSTEM_VER_HARDWARE, &ver->hw); m5mols_get_version()
443 ret = m5mols_read_u16(sd, SYSTEM_VER_PARAMETER, &ver->param); m5mols_get_version()
445 ret = m5mols_read_u16(sd, SYSTEM_VER_AWB, &ver->awb); m5mols_get_version()
447 ret = m5mols_read_u8(sd, AF_VERSION, &ver->af); m5mols_get_version()
452 ret = m5mols_read_u8(sd, SYSTEM_VER_STRING, &str[i]); m5mols_get_version()
457 v4l2_info(sd, "Manufacturer\t[%s]\n", m5mols_get_version()
464 v4l2_info(sd, "Customer/Project\t[0x%02x/0x%02x]\n", m5mols_get_version()
468 v4l2_info(sd, "No support Auto Focus on this firmware\n"); m5mols_get_version()
498 static int __find_resolution(struct v4l2_subdev *sd, __find_resolution() argument
539 return cfg ? v4l2_subdev_get_try_format(&info->sd, cfg, 0) : NULL; __find_format()
544 static int m5mols_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, m5mols_get_fmt() argument
547 struct m5mols_info *info = to_m5mols(sd); m5mols_get_fmt()
563 static int m5mols_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, m5mols_set_fmt() argument
566 struct m5mols_info *info = to_m5mols(sd); m5mols_set_fmt()
573 ret = __find_resolution(sd, format, &type, &resolution); m5mols_set_fmt()
597 static int m5mols_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, m5mols_get_frame_desc() argument
600 struct m5mols_info *info = to_m5mols(sd); m5mols_get_frame_desc()
620 static int m5mols_set_frame_desc(struct v4l2_subdev *sd, unsigned int pad, m5mols_set_frame_desc() argument
623 struct m5mols_info *info = to_m5mols(sd); m5mols_set_frame_desc()
642 static int m5mols_enum_mbus_code(struct v4l2_subdev *sd, m5mols_enum_mbus_code() argument
694 struct v4l2_subdev *sd = &info->sd; m5mols_start_monitor() local
699 ret = m5mols_write(sd, PARM_MON_SIZE, info->resolution); m5mols_start_monitor()
701 ret = m5mols_write(sd, PARM_MON_FPS, REG_FPS_30); m5mols_start_monitor()
710 static int m5mols_s_stream(struct v4l2_subdev *sd, int enable) m5mols_s_stream() argument
712 struct m5mols_info *info = to_m5mols(sd); m5mols_s_stream()
740 struct v4l2_subdev *sd = &info->sd; m5mols_sensor_power() local
741 struct i2c_client *client = v4l2_get_subdevdata(sd); m5mols_sensor_power()
783 int __attribute__ ((weak)) m5mols_update_fw(struct v4l2_subdev *sd, m5mols_update_fw() argument
796 static int m5mols_fw_start(struct v4l2_subdev *sd) m5mols_fw_start() argument
798 struct m5mols_info *info = to_m5mols(sd); m5mols_fw_start()
803 ret = m5mols_busy_wait(sd, FLASH_CAM_START, REG_IN_FLASH_MODE, m5mols_fw_start()
806 ret = m5mols_write(sd, FLASH_CAM_START, REG_START_ARM_BOOT); m5mols_fw_start()
808 ret = m5mols_wait_interrupt(sd, REG_INT_MODE, 2000); m5mols_fw_start()
814 ret = m5mols_get_version(sd); m5mols_fw_start()
816 ret = m5mols_update_fw(sd, m5mols_sensor_power); m5mols_fw_start()
820 v4l2_dbg(1, m5mols_debug, sd, "Success ARM Booting\n"); m5mols_fw_start()
822 ret = m5mols_write(sd, PARM_INTERFACE, REG_INTERFACE_MIPI); m5mols_fw_start()
824 ret = m5mols_enable_interrupt(sd, m5mols_fw_start()
835 ret = m5mols_write(&info->sd, AF_EXECUTE, REG_AF_STOP); m5mols_auto_focus_stop()
837 ret = m5mols_write(&info->sd, AF_MODE, REG_AF_POWEROFF); m5mols_auto_focus_stop()
839 ret = m5mols_busy_wait(&info->sd, SYSTEM_STATUS, REG_AF_IDLE, m5mols_auto_focus_stop()
851 static int m5mols_s_power(struct v4l2_subdev *sd, int on) m5mols_s_power() argument
853 struct m5mols_info *info = to_m5mols(sd); m5mols_s_power()
861 ret = m5mols_fw_start(sd); m5mols_s_power()
868 v4l2_warn(sd, "Soft landing lens failed\n"); m5mols_s_power()
879 static int m5mols_log_status(struct v4l2_subdev *sd) m5mols_log_status() argument
881 struct m5mols_info *info = to_m5mols(sd); m5mols_log_status()
883 v4l2_ctrl_handler_log_status(&info->handle, sd->name); m5mols_log_status()
896 static int m5mols_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) m5mols_open() argument
898 struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(sd, fh->pad, 0); m5mols_open()
930 struct v4l2_subdev *sd; m5mols_probe() local
971 sd = &info->sd; m5mols_probe()
972 v4l2_i2c_subdev_init(sd, client, &m5mols_ops); m5mols_probe()
973 strlcpy(sd->name, MODULE_NAME, sizeof(sd->name)); m5mols_probe()
974 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; m5mols_probe()
976 sd->internal_ops = &m5mols_subdev_internal_ops; m5mols_probe()
978 ret = media_entity_init(&sd->entity, 1, &info->pad, 0); m5mols_probe()
981 sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; m5mols_probe()
987 IRQF_TRIGGER_RISING, MODULE_NAME, sd); m5mols_probe()
1000 ret = m5mols_fw_start(sd); m5mols_probe()
1002 ret = m5mols_init_controls(sd); m5mols_probe()
1008 media_entity_cleanup(&sd->entity); m5mols_probe()
1014 struct v4l2_subdev *sd = i2c_get_clientdata(client); m5mols_remove() local
1016 v4l2_device_unregister_subdev(sd); m5mols_remove()
1017 v4l2_ctrl_handler_free(sd->ctrl_handler); m5mols_remove()
1018 media_entity_cleanup(&sd->entity); m5mols_remove()
/linux-4.1.27/arch/mips/include/asm/
H A Dsim.h57 "sd\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \
58 "sd\t$17,"__str(PT_R17)"($29)\n\t" \
59 "sd\t$18,"__str(PT_R18)"($29)\n\t" \
60 "sd\t$19,"__str(PT_R19)"($29)\n\t" \
61 "sd\t$20,"__str(PT_R20)"($29)\n\t" \
62 "sd\t$21,"__str(PT_R21)"($29)\n\t" \
63 "sd\t$22,"__str(PT_R22)"($29)\n\t" \
64 "sd\t$23,"__str(PT_R23)"($29)\n\t" \
65 "sd\t$30,"__str(PT_R30)"($29)\n\t" \
H A Dstacktrace.h37 "sd $1, %0\n\t" prepare_frametrace()
38 "sd $29, %1\n\t" prepare_frametrace()
39 "sd $31, %2\n\t" prepare_frametrace()
/linux-4.1.27/fs/configfs/
H A Dconfigfs_internal.h81 extern const unsigned char * configfs_get_name(struct configfs_dirent *sd);
82 extern void configfs_drop_dentry(struct configfs_dirent *sd, struct dentry *parent);
112 struct configfs_dirent * sd = dentry->d_fsdata; to_item() local
113 return ((struct config_item *) sd->s_element); to_item()
118 struct configfs_dirent * sd = dentry->d_fsdata; to_attr() local
119 return ((struct configfs_attribute *) sd->s_element); to_attr()
128 struct configfs_dirent * sd = dentry->d_fsdata; configfs_get_config_item() local
129 if (sd->s_type & CONFIGFS_ITEM_LINK) { configfs_get_config_item()
130 struct configfs_symlink * sl = sd->s_element; configfs_get_config_item()
133 item = config_item_get(sd->s_element); configfs_get_config_item()
140 static inline void release_configfs_dirent(struct configfs_dirent * sd) release_configfs_dirent() argument
142 if (!(sd->s_type & CONFIGFS_ROOT)) { release_configfs_dirent()
143 kfree(sd->s_iattr); release_configfs_dirent()
144 kmem_cache_free(configfs_dir_cachep, sd); release_configfs_dirent()
148 static inline struct configfs_dirent * configfs_get(struct configfs_dirent * sd) configfs_get() argument
150 if (sd) { configfs_get()
151 WARN_ON(!atomic_read(&sd->s_count)); configfs_get()
152 atomic_inc(&sd->s_count); configfs_get()
154 return sd; configfs_get()
157 static inline void configfs_put(struct configfs_dirent * sd) configfs_put() argument
159 WARN_ON(!atomic_read(&sd->s_count)); configfs_put()
160 if (atomic_dec_and_test(&sd->s_count)) configfs_put()
161 release_configfs_dirent(sd); configfs_put()
H A Dinode.c60 struct configfs_dirent * sd = dentry->d_fsdata; configfs_setattr() local
65 if (!sd) configfs_setattr()
68 sd_iattr = sd->s_iattr; configfs_setattr()
75 sd_iattr->ia_mode = sd->s_mode; configfs_setattr()
79 sd->s_iattr = sd_iattr; configfs_setattr()
105 sd_iattr->ia_mode = sd->s_mode = mode; configfs_setattr()
127 struct inode *configfs_new_inode(umode_t mode, struct configfs_dirent *sd, configfs_new_inode() argument
136 if (sd->s_iattr) { configfs_new_inode()
141 set_inode_attr(inode, sd->s_iattr); configfs_new_inode()
150 static void configfs_set_inode_lock_class(struct configfs_dirent *sd, configfs_set_inode_lock_class() argument
153 int depth = sd->s_depth; configfs_set_inode_lock_class()
172 static void configfs_set_inode_lock_class(struct configfs_dirent *sd, configfs_set_inode_lock_class() argument
183 struct configfs_dirent *sd; configfs_create() local
192 sd = dentry->d_fsdata; configfs_create()
193 inode = configfs_new_inode(mode, sd, dentry->d_sb); configfs_create()
199 configfs_set_inode_lock_class(sd, inode); configfs_create()
211 const unsigned char * configfs_get_name(struct configfs_dirent *sd) configfs_get_name() argument
215 BUG_ON(!sd || !sd->s_element); configfs_get_name()
218 if (sd->s_type & (CONFIGFS_DIR | CONFIGFS_ITEM_LINK)) configfs_get_name()
219 return sd->s_dentry->d_name.name; configfs_get_name()
221 if (sd->s_type & CONFIGFS_ITEM_ATTR) { configfs_get_name()
222 attr = sd->s_element; configfs_get_name()
233 void configfs_drop_dentry(struct configfs_dirent * sd, struct dentry * parent) configfs_drop_dentry() argument
235 struct dentry * dentry = sd->s_dentry; configfs_drop_dentry()
251 struct configfs_dirent * sd; configfs_hash_and_remove() local
259 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { configfs_hash_and_remove()
260 if (!sd->s_element) configfs_hash_and_remove()
262 if (!strcmp(configfs_get_name(sd), name)) { configfs_hash_and_remove()
264 list_del_init(&sd->s_sibling); configfs_hash_and_remove()
266 configfs_drop_dentry(sd, dir); configfs_hash_and_remove()
267 configfs_put(sd); configfs_hash_and_remove()
H A Ddir.c56 struct configfs_dirent *sd = dentry->d_fsdata; configfs_d_iput() local
58 if (sd) { configfs_d_iput()
62 * sd->s_count and update sd->s_dentry to new allocated one. configfs_d_iput()
63 * Only set sd->dentry to null when this dentry is the only configfs_d_iput()
64 * sd owner. configfs_d_iput()
66 * configfs_attach_attr and set sd->s_dentry to null configfs_d_iput()
69 if (atomic_read(&sd->s_count) <= 2) configfs_d_iput()
70 sd->s_dentry = NULL; configfs_d_iput()
73 configfs_put(sd); configfs_d_iput()
104 static void configfs_init_dirent_depth(struct configfs_dirent *sd) configfs_init_dirent_depth() argument
106 sd->s_depth = -1; configfs_init_dirent_depth()
110 struct configfs_dirent *sd) configfs_set_dir_dirent_depth()
115 sd->s_depth = parent_depth + 1; configfs_set_dir_dirent_depth()
119 configfs_adjust_dir_dirent_depth_before_populate(struct configfs_dirent *sd) configfs_adjust_dir_dirent_depth_before_populate() argument
127 * sd->s_depth == -1 iff we are a non default group. configfs_adjust_dir_dirent_depth_before_populate()
128 * else (we are a default group) sd->s_depth > 0 (see configfs_adjust_dir_dirent_depth_before_populate()
131 if (sd->s_depth == -1) configfs_adjust_dir_dirent_depth_before_populate()
136 sd->s_depth = 0; configfs_adjust_dir_dirent_depth_before_populate()
140 configfs_adjust_dir_dirent_depth_after_populate(struct configfs_dirent *sd) configfs_adjust_dir_dirent_depth_after_populate() argument
143 sd->s_depth = -1; configfs_adjust_dir_dirent_depth_after_populate()
148 static void configfs_init_dirent_depth(struct configfs_dirent *sd) configfs_init_dirent_depth() argument
153 struct configfs_dirent *sd) configfs_set_dir_dirent_depth()
158 configfs_adjust_dir_dirent_depth_before_populate(struct configfs_dirent *sd) configfs_adjust_dir_dirent_depth_before_populate() argument
163 configfs_adjust_dir_dirent_depth_after_populate(struct configfs_dirent *sd) configfs_adjust_dir_dirent_depth_after_populate() argument
175 struct configfs_dirent * sd; configfs_new_dirent() local
177 sd = kmem_cache_zalloc(configfs_dir_cachep, GFP_KERNEL); configfs_new_dirent()
178 if (!sd) configfs_new_dirent()
181 atomic_set(&sd->s_count, 1); configfs_new_dirent()
182 INIT_LIST_HEAD(&sd->s_links); configfs_new_dirent()
183 INIT_LIST_HEAD(&sd->s_children); configfs_new_dirent()
184 sd->s_element = element; configfs_new_dirent()
185 sd->s_type = type; configfs_new_dirent()
186 configfs_init_dirent_depth(sd); configfs_new_dirent()
190 kmem_cache_free(configfs_dir_cachep, sd); configfs_new_dirent()
193 list_add(&sd->s_sibling, &parent_sd->s_children); configfs_new_dirent()
196 return sd; configfs_new_dirent()
209 struct configfs_dirent * sd; configfs_dirent_exists() local
211 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { configfs_dirent_exists()
212 if (sd->s_element) { configfs_dirent_exists()
213 const unsigned char *existing = configfs_get_name(sd); configfs_dirent_exists()
229 struct configfs_dirent * sd; configfs_make_dirent() local
231 sd = configfs_new_dirent(parent_sd, element, type); configfs_make_dirent()
232 if (IS_ERR(sd)) configfs_make_dirent()
233 return PTR_ERR(sd); configfs_make_dirent()
235 sd->s_mode = mode; configfs_make_dirent()
236 sd->s_dentry = dentry; configfs_make_dirent()
238 dentry->d_fsdata = configfs_get(sd); configfs_make_dirent()
295 struct configfs_dirent *sd = dentry->d_fsdata; configfs_create_dir() local
296 if (sd) { configfs_create_dir()
298 list_del_init(&sd->s_sibling); configfs_create_dir()
300 configfs_put(sd); configfs_create_dir()
309 * @sd configfs_dirent of the new directory to validate
313 static void configfs_dir_set_ready(struct configfs_dirent *sd) configfs_dir_set_ready() argument
317 sd->s_type &= ~CONFIGFS_USET_CREATING; configfs_dir_set_ready()
318 list_for_each_entry(child_sd, &sd->s_children, s_sibling) configfs_dir_set_ready()
326 * @sd configfs_dirent of the directory to check
333 int configfs_dirent_is_ready(struct configfs_dirent *sd) configfs_dirent_is_ready() argument
338 ret = !(sd->s_type & CONFIGFS_USET_CREATING); configfs_dirent_is_ready()
356 struct configfs_dirent *sd = dentry->d_fsdata; configfs_create_link() local
357 if (sd) { configfs_create_link()
359 list_del_init(&sd->s_sibling); configfs_create_link()
361 configfs_put(sd); configfs_create_link()
371 struct configfs_dirent * sd; remove_dir() local
373 sd = d->d_fsdata; remove_dir()
375 list_del_init(&sd->s_sibling); remove_dir()
377 configfs_put(sd); remove_dir()
415 static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * dentry) configfs_attach_attr() argument
417 struct configfs_attribute * attr = sd->s_element; configfs_attach_attr()
421 dentry->d_fsdata = configfs_get(sd); configfs_attach_attr()
422 sd->s_dentry = dentry; configfs_attach_attr()
428 configfs_put(sd); configfs_attach_attr()
442 struct configfs_dirent * sd; configfs_lookup() local
458 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { configfs_lookup()
459 if (sd->s_type & CONFIGFS_NOT_PINNED) { configfs_lookup()
460 const unsigned char * name = configfs_get_name(sd); configfs_lookup()
466 err = configfs_attach_attr(sd, dentry); configfs_lookup()
497 struct configfs_dirent *sd; configfs_detach_prep() local
508 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { configfs_detach_prep()
509 if (!sd->s_element || configfs_detach_prep()
510 (sd->s_type & CONFIGFS_NOT_PINNED)) configfs_detach_prep()
512 if (sd->s_type & CONFIGFS_USET_DEFAULT) { configfs_detach_prep()
514 if (sd->s_type & CONFIGFS_USET_IN_MKDIR) { configfs_detach_prep()
516 *wait_mutex = &d_inode(sd->s_dentry)->i_mutex; configfs_detach_prep()
524 ret = configfs_detach_prep(sd->s_dentry, wait_mutex); configfs_detach_prep()
544 struct configfs_dirent *sd; configfs_detach_rollback() local
548 list_for_each_entry(sd, &parent_sd->s_children, s_sibling) configfs_detach_rollback()
549 if (sd->s_type & CONFIGFS_USET_DEFAULT) configfs_detach_rollback()
550 configfs_detach_rollback(sd->s_dentry); configfs_detach_rollback()
557 struct configfs_dirent * sd, * tmp; detach_attrs() local
566 list_for_each_entry_safe(sd, tmp, &parent_sd->s_children, s_sibling) { detach_attrs()
567 if (!sd->s_element || !(sd->s_type & CONFIGFS_NOT_PINNED)) detach_attrs()
570 list_del_init(&sd->s_sibling); detach_attrs()
572 configfs_drop_dentry(sd, dentry); detach_attrs()
573 configfs_put(sd); detach_attrs()
614 struct configfs_dirent *sd, *tmp; detach_groups() local
620 list_for_each_entry_safe(sd, tmp, &parent_sd->s_children, s_sibling) { detach_groups()
621 if (!sd->s_element || detach_groups()
622 !(sd->s_type & CONFIGFS_USET_DEFAULT)) detach_groups()
625 child = sd->s_dentry; detach_groups()
629 configfs_detach_group(sd->s_element); detach_groups()
648 * on the sd->s_type.
657 struct configfs_dirent *sd; create_default_group() local
672 sd = child->d_fsdata; create_default_group()
673 sd->s_type |= CONFIGFS_USET_DEFAULT; create_default_group()
845 struct configfs_dirent *sd; configfs_attach_group() local
849 sd = dentry->d_fsdata; configfs_attach_group()
850 sd->s_type |= CONFIGFS_USET_DIR; configfs_attach_group()
862 configfs_adjust_dir_dirent_depth_before_populate(sd); configfs_attach_group()
869 configfs_adjust_dir_dirent_depth_after_populate(sd); configfs_attach_group()
933 static void configfs_dump_one(struct configfs_dirent *sd, int level) configfs_dump_one() argument
935 pr_info("%*s\"%s\":\n", level, " ", configfs_get_name(sd)); configfs_dump_one()
937 #define type_print(_type) if (sd->s_type & _type) pr_info("%*s %s\n", level, " ", #_type); configfs_dump_one()
948 static int configfs_dump(struct configfs_dirent *sd, int level) configfs_dump() argument
953 configfs_dump_one(sd, level); configfs_dump()
955 if (!(sd->s_type & (CONFIGFS_DIR|CONFIGFS_ROOT))) configfs_dump()
958 list_for_each_entry(child_sd, &sd->s_children, s_sibling) { configfs_dump()
1030 struct configfs_dirent *child_sd, *sd; configfs_depend_prep() local
1034 sd = origin->d_fsdata; configfs_depend_prep()
1036 if (sd->s_element == target) /* Boo-yah */ configfs_depend_prep()
1039 list_for_each_entry(child_sd, &sd->s_children, s_sibling) { configfs_depend_prep()
1134 struct configfs_dirent *sd; configfs_undepend_item() local
1142 sd = target->ci_dentry->d_fsdata; configfs_undepend_item()
1143 BUG_ON(sd->s_dependent_count < 1); configfs_undepend_item()
1145 sd->s_dependent_count -= 1; configfs_undepend_item()
1163 struct configfs_dirent *sd; configfs_mkdir() local
1168 sd = dentry->d_parent->d_fsdata; configfs_mkdir()
1174 if (!configfs_dirent_is_ready(sd)) { configfs_mkdir()
1179 if (!(sd->s_type & CONFIGFS_USET_DIR)) { configfs_mkdir()
1282 sd->s_type |= CONFIGFS_USET_IN_MKDIR; configfs_mkdir()
1291 sd->s_type &= ~CONFIGFS_USET_IN_MKDIR; configfs_mkdir()
1335 struct configfs_dirent *sd; configfs_rmdir() local
1339 sd = dentry->d_fsdata; configfs_rmdir()
1340 if (sd->s_type & CONFIGFS_USET_DEFAULT) configfs_rmdir()
1371 ret = sd->s_dependent_count ? -EBUSY : 0; configfs_rmdir()
1401 if (sd->s_type & CONFIGFS_USET_DIR) { configfs_rmdir()
1520 static inline unsigned char dt_type(struct configfs_dirent *sd) dt_type() argument
1522 return (sd->s_mode >> 12) & 15; dt_type()
1607 struct configfs_dirent *sd = dentry->d_fsdata; configfs_dir_lseek() local
1614 p = sd->s_children.next; configfs_dir_lseek()
1615 while (n && p != &sd->s_children) { configfs_dir_lseek()
1645 struct configfs_dirent *sd; configfs_register_subsystem() local
1654 sd = root->d_fsdata; configfs_register_subsystem()
1655 link_group(to_config_group(sd->s_element), group); configfs_register_subsystem()
1664 err = configfs_attach_group(sd->s_element, &group->cg_item, configfs_register_subsystem()
109 configfs_set_dir_dirent_depth(struct configfs_dirent *parent_sd, struct configfs_dirent *sd) configfs_set_dir_dirent_depth() argument
152 configfs_set_dir_dirent_depth(struct configfs_dirent *parent_sd, struct configfs_dirent *sd) configfs_set_dir_dirent_depth() argument
/linux-4.1.27/arch/mips/netlogic/xlp/
H A Dcop2-ex.c35 "sd $1, 0(%1)\n" nlm_cop2_save()
37 "sd $1, 8(%1)\n" nlm_cop2_save()
39 "sd $1, 16(%1)\n" nlm_cop2_save()
41 "sd $1, 24(%1)\n" nlm_cop2_save()
43 "sd $1, 0(%2)\n" nlm_cop2_save()
45 "sd $1, 8(%2)\n" nlm_cop2_save()
47 "sd $1, 16(%2)\n" nlm_cop2_save()
49 "sd $1, 24(%2)\n" nlm_cop2_save()
/linux-4.1.27/drivers/media/platform/soc_camera/
H A Dsoc_camera_platform.c33 static int soc_camera_platform_s_stream(struct v4l2_subdev *sd, int enable) soc_camera_platform_s_stream() argument
35 struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd); soc_camera_platform_s_stream()
39 static int soc_camera_platform_fill_fmt(struct v4l2_subdev *sd, soc_camera_platform_fill_fmt() argument
42 struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd); soc_camera_platform_fill_fmt()
53 static int soc_camera_platform_s_power(struct v4l2_subdev *sd, int on) soc_camera_platform_s_power() argument
55 struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd); soc_camera_platform_s_power()
64 static int soc_camera_platform_enum_fmt(struct v4l2_subdev *sd, unsigned int index, soc_camera_platform_enum_fmt() argument
67 struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd); soc_camera_platform_enum_fmt()
76 static int soc_camera_platform_g_crop(struct v4l2_subdev *sd, soc_camera_platform_g_crop() argument
79 struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd); soc_camera_platform_g_crop()
90 static int soc_camera_platform_cropcap(struct v4l2_subdev *sd, soc_camera_platform_cropcap() argument
93 struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd); soc_camera_platform_cropcap()
107 static int soc_camera_platform_g_mbus_config(struct v4l2_subdev *sd, soc_camera_platform_g_mbus_config() argument
110 struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd); soc_camera_platform_g_mbus_config()
H A Dsh_mobile_csi2.c48 static int sh_csi2_try_fmt(struct v4l2_subdev *sd, sh_csi2_try_fmt() argument
51 struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev); sh_csi2_try_fmt()
96 static int sh_csi2_s_fmt(struct v4l2_subdev *sd, sh_csi2_s_fmt() argument
99 struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev); sh_csi2_s_fmt()
102 dev_dbg(sd->v4l2_dev->dev, "%s(%u)\n", __func__, mf->code); sh_csi2_s_fmt()
133 static int sh_csi2_g_mbus_config(struct v4l2_subdev *sd, sh_csi2_g_mbus_config() argument
136 struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev); sh_csi2_g_mbus_config()
139 struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd); sh_csi2_g_mbus_config()
192 static int sh_csi2_s_mbus_config(struct v4l2_subdev *sd, sh_csi2_s_mbus_config() argument
195 struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev); sh_csi2_s_mbus_config()
196 struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd); sh_csi2_s_mbus_config()
199 int ret = sh_csi2_g_mbus_config(sd, NULL); sh_csi2_s_mbus_config()
298 static int sh_csi2_s_power(struct v4l2_subdev *sd, int on) sh_csi2_s_power() argument
300 struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev); sh_csi2_s_power()
/linux-4.1.27/arch/mips/kernel/
H A Docteon_switch.S129 sd t0, OCTEON_CP2_CRC_IV(a0)
130 sd t1, OCTEON_CP2_CRC_LENGTH(a0)
133 sd t2, OCTEON_CP2_CRC_POLY(a0)
138 sd t0, OCTEON_CP2_LLM_DAT(a0)
141 sd t1, OCTEON_CP2_LLM_DAT+8(a0)
149 sd t0, OCTEON_CP2_3DES_IV(a0)
151 sd t1, OCTEON_CP2_3DES_KEY(a0)
153 sd t2, OCTEON_CP2_3DES_KEY+8(a0)
155 sd t3, OCTEON_CP2_3DES_KEY+16(a0)
157 sd t0, OCTEON_CP2_3DES_RESULT(a0)
159 sd t1, OCTEON_CP2_AES_INP0(a0) /* only necessary for pass 1 */
161 sd t2, OCTEON_CP2_AES_IV(a0)
163 sd t3, OCTEON_CP2_AES_IV+8(a0)
165 sd t0, OCTEON_CP2_AES_KEY(a0)
167 sd t1, OCTEON_CP2_AES_KEY+8(a0)
169 sd t2, OCTEON_CP2_AES_KEY+16(a0)
171 sd t3, OCTEON_CP2_AES_KEY+24(a0)
173 sd t0, OCTEON_CP2_AES_KEYLEN(a0)
175 sd t1, OCTEON_CP2_AES_RESULT(a0)
178 sd t2, OCTEON_CP2_AES_RESULT+8(a0)
187 sd t1, OCTEON_CP2_HSH_DATW(a0)
189 sd t2, OCTEON_CP2_HSH_DATW+8(a0)
191 sd t3, OCTEON_CP2_HSH_DATW+16(a0)
193 sd t0, OCTEON_CP2_HSH_DATW+24(a0)
195 sd t1, OCTEON_CP2_HSH_DATW+32(a0)
197 sd t2, OCTEON_CP2_HSH_DATW+40(a0)
199 sd t3, OCTEON_CP2_HSH_DATW+48(a0)
201 sd t0, OCTEON_CP2_HSH_DATW+56(a0)
203 sd t1, OCTEON_CP2_HSH_DATW+64(a0)
205 sd t2, OCTEON_CP2_HSH_DATW+72(a0)
207 sd t3, OCTEON_CP2_HSH_DATW+80(a0)
209 sd t0, OCTEON_CP2_HSH_DATW+88(a0)
211 sd t1, OCTEON_CP2_HSH_DATW+96(a0)
213 sd t2, OCTEON_CP2_HSH_DATW+104(a0)
215 sd t3, OCTEON_CP2_HSH_DATW+112(a0)
217 sd t0, OCTEON_CP2_HSH_IVW(a0)
219 sd t1, OCTEON_CP2_HSH_IVW+8(a0)
221 sd t2, OCTEON_CP2_HSH_IVW+16(a0)
223 sd t3, OCTEON_CP2_HSH_IVW+24(a0)
225 sd t0, OCTEON_CP2_HSH_IVW+32(a0)
227 sd t1, OCTEON_CP2_HSH_IVW+40(a0)
229 sd t2, OCTEON_CP2_HSH_IVW+48(a0)
231 sd t3, OCTEON_CP2_HSH_IVW+56(a0)
233 sd t0, OCTEON_CP2_GFM_MULT(a0)
235 sd t1, OCTEON_CP2_GFM_MULT+8(a0)
236 sd t2, OCTEON_CP2_GFM_POLY(a0)
237 sd t3, OCTEON_CP2_GFM_RESULT(a0)
239 sd t0, OCTEON_CP2_GFM_RESULT+8(a0)
243 sd t0, OCTEON_CP2_SHA3(a0)
244 sd t1, OCTEON_CP2_SHA3+8(a0)
254 sd t3, OCTEON_CP2_HSH_DATW(a0)
256 sd t0, OCTEON_CP2_HSH_DATW+8(a0)
258 sd t1, OCTEON_CP2_HSH_DATW+16(a0)
260 sd t2, OCTEON_CP2_HSH_DATW+24(a0)
262 sd t3, OCTEON_CP2_HSH_DATW+32(a0)
264 sd t0, OCTEON_CP2_HSH_DATW+40(a0)
266 sd t1, OCTEON_CP2_HSH_DATW+48(a0)
267 sd t2, OCTEON_CP2_HSH_IVW(a0)
268 sd t3, OCTEON_CP2_HSH_IVW+8(a0)
269 sd t0, OCTEON_CP2_HSH_IVW+16(a0)
462 sd k0, PT_MTP(sp) /* PT_MTP has P0 */
464 sd k1, PT_MTP+8(sp) /* PT_MTP+8 has P1 */
467 sd k0, PT_MTP+16(sp) /* PT_MTP+16 has P2 */
469 sd k1, PT_MPL(sp) /* PT_MPL has MPL0 */
471 sd k0, PT_MPL+8(sp) /* PT_MPL+8 has MPL1 */
473 sd k1, PT_MPL+16(sp) /* PT_MPL+16 has MPL2 */
483 sd $10, PT_MTP+(0*8)(sp) /* store P0 */
485 sd $11, PT_MTP+(1*8)(sp) /* store P1 */
487 sd $12, PT_MTP+(2*8)(sp) /* store P2 */
490 sd $10, PT_MTP+(3*8)(sp) /* store P3 */
492 sd $11, PT_MTP+(4*8)(sp) /* store P4 */
494 sd $12, PT_MTP+(5*8)(sp) /* store P5 */
496 sd $13, PT_MPL+(0*8)(sp) /* store MPL0 */
498 sd $10, PT_MPL+(1*8)(sp) /* store MPL1 */
500 sd $11, PT_MPL+(2*8)(sp) /* store MPL2 */
502 sd $12, PT_MPL+(3*8)(sp) /* store MPL3 */
503 sd $10, PT_MPL+(4*8)(sp) /* store MPL4 */
505 sd $11, PT_MPL+(5*8)(sp) /* store MPL5 */
H A Dscall64-o32.S39 sd t1, PT_EPC(sp)
58 sd a3, PT_R26(sp) # save a3 for syscall restarting
93 sd t0, PT_R7(sp) # set error flag
98 sd t1, PT_R0(sp) # save it for syscall restarting
99 1: sd v0, PT_R2(sp) # result
108 sd a4, PT_R8(sp) # Save argument registers
109 sd a5, PT_R9(sp)
110 sd a6, PT_R10(sp)
111 sd a7, PT_R11(sp) # For indirect syscalls
148 sd t0, PT_R7(sp) # set error flag
153 sd t1, PT_R0(sp) # save it for syscall restarting
154 1: sd v0, PT_R2(sp) # result
165 sd v0, PT_R2(sp)
167 sd t0, PT_R7(sp)
189 sd a0, PT_R2(sp) # call routine directly on restart
198 sd a0, PT_R4(sp) # ... and push back a0 - a3, some
199 sd a1, PT_R5(sp) # syscalls expect them there
200 sd a2, PT_R6(sp)
201 sd a3, PT_R7(sp)
202 sd a3, PT_R26(sp) # update a3 for syscall restarting
/linux-4.1.27/drivers/cpufreq/
H A Dsa1110-cpufreq.c146 sdram_calculate_timing(struct sdram_info *sd, u_int cpu_khz, sdram_calculate_timing() argument
165 sd->mdcnfg = MDCNFG & 0x007f007f; sdram_calculate_timing()
174 sd->mdcnfg |= trp << 8; sdram_calculate_timing()
175 sd->mdcnfg |= trp << 24; sdram_calculate_timing()
176 sd->mdcnfg |= sdram->cas_latency << 12; sdram_calculate_timing()
177 sd->mdcnfg |= sdram->cas_latency << 28; sdram_calculate_timing()
178 sd->mdcnfg |= twr << 14; sdram_calculate_timing()
179 sd->mdcnfg |= twr << 30; sdram_calculate_timing()
181 sd->mdrefr = MDREFR & 0xffbffff0; sdram_calculate_timing()
182 sd->mdrefr |= 7; sdram_calculate_timing()
185 sd->mdrefr |= MDREFR_K1DB2; sdram_calculate_timing()
188 set_mdcas(sd->mdcas, sd_khz >= 62000, sdram_calculate_timing()
193 sd->mdcnfg, sd->mdrefr, sd->mdcas[0], sd->mdcas[1], sdram_calculate_timing()
194 sd->mdcas[2]); sdram_calculate_timing()
235 struct sdram_info sd; sa1110_target() local
239 sdram_calculate_timing(&sd, sa11x0_freq_table[ppcr].frequency, sdram); sa1110_target()
248 sd.mdrefr |= MDREFR_K1DB2; sa1110_target()
249 sd.mdcas[0] = 0xaaaaaa7f; sa1110_target()
251 sd.mdrefr &= ~MDREFR_K1DB2; sa1110_target()
252 sd.mdcas[0] = 0xaaaaaa9f; sa1110_target()
254 sd.mdcas[1] = 0xaaaaaaaa; sa1110_target()
255 sd.mdcas[2] = 0xaaaaaaaa; sa1110_target()
294 : "r" (&MDCNFG), "r" (&PPCR), "0" (sd.mdcnfg), sa1110_target()
295 "r" (sd.mdrefr), "r" (sd.mdcas[0]), sa1110_target()
296 "r" (sd.mdcas[1]), "r" (sd.mdcas[2]), "r" (ppcr)); sa1110_target()
/linux-4.1.27/include/media/
H A Dv4l2-subdev.h148 int (*log_status)(struct v4l2_subdev *sd);
149 int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n,
151 int (*init)(struct v4l2_subdev *sd, u32 val);
152 int (*load_fw)(struct v4l2_subdev *sd);
153 int (*reset)(struct v4l2_subdev *sd, u32 val);
154 int (*s_gpio)(struct v4l2_subdev *sd, u32 val);
155 int (*queryctrl)(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc);
156 int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
157 int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
158 int (*g_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
159 int (*s_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
160 int (*try_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
161 int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
162 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
164 long (*compat_ioctl32)(struct v4l2_subdev *sd, unsigned int cmd,
168 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
169 int (*s_register)(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg);
171 int (*s_power)(struct v4l2_subdev *sd, int on);
172 int (*interrupt_service_routine)(struct v4l2_subdev *sd,
174 int (*subscribe_event)(struct v4l2_subdev *sd, struct v4l2_fh *fh,
176 int (*unsubscribe_event)(struct v4l2_subdev *sd, struct v4l2_fh *fh,
194 int (*s_radio)(struct v4l2_subdev *sd);
195 int (*s_frequency)(struct v4l2_subdev *sd, const struct v4l2_frequency *freq);
196 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
197 int (*enum_freq_bands)(struct v4l2_subdev *sd, struct v4l2_frequency_band *band);
198 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
199 int (*s_tuner)(struct v4l2_subdev *sd, const struct v4l2_tuner *vt);
200 int (*g_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm);
201 int (*s_modulator)(struct v4l2_subdev *sd, const struct v4l2_modulator *vm);
202 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type);
203 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
227 int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
228 int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
229 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
230 int (*s_stream)(struct v4l2_subdev *sd, int enable);
315 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
316 int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags);
317 int (*g_std)(struct v4l2_subdev *sd, v4l2_std_id *norm);
318 int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
319 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);
320 int (*g_std_output)(struct v4l2_subdev *sd, v4l2_std_id *std);
321 int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std);
322 int (*g_tvnorms)(struct v4l2_subdev *sd, v4l2_std_id *std);
323 int (*g_tvnorms_output)(struct v4l2_subdev *sd, v4l2_std_id *std);
324 int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);
325 int (*s_stream)(struct v4l2_subdev *sd, int enable);
326 int (*cropcap)(struct v4l2_subdev *sd, struct v4l2_cropcap *cc);
327 int (*g_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop);
328 int (*s_crop)(struct v4l2_subdev *sd, const struct v4l2_crop *crop);
329 int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
330 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
331 int (*g_frame_interval)(struct v4l2_subdev *sd,
333 int (*s_frame_interval)(struct v4l2_subdev *sd,
335 int (*s_dv_timings)(struct v4l2_subdev *sd,
337 int (*g_dv_timings)(struct v4l2_subdev *sd,
339 int (*query_dv_timings)(struct v4l2_subdev *sd,
341 int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index,
343 int (*g_mbus_fmt)(struct v4l2_subdev *sd,
345 int (*try_mbus_fmt)(struct v4l2_subdev *sd,
347 int (*s_mbus_fmt)(struct v4l2_subdev *sd,
349 int (*g_mbus_config)(struct v4l2_subdev *sd,
351 int (*s_mbus_config)(struct v4l2_subdev *sd,
353 int (*s_rx_buffer)(struct v4l2_subdev *sd, void *buf,
387 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
388 int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
389 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
390 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
391 int (*s_raw_fmt)(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt);
392 int (*g_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
393 int (*s_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
407 int (*g_skip_top_lines)(struct v4l2_subdev *sd, u32 *lines);
408 int (*g_skip_frames)(struct v4l2_subdev *sd, u32 *frames);
465 int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count,
468 int (*rx_g_parameters)(struct v4l2_subdev *sd,
470 int (*rx_s_parameters)(struct v4l2_subdev *sd,
474 int (*tx_write)(struct v4l2_subdev *sd, u8 *buf, size_t count,
477 int (*tx_g_parameters)(struct v4l2_subdev *sd,
479 int (*tx_s_parameters)(struct v4l2_subdev *sd,
502 int (*enum_mbus_code)(struct v4l2_subdev *sd,
505 int (*enum_frame_size)(struct v4l2_subdev *sd,
508 int (*enum_frame_interval)(struct v4l2_subdev *sd,
511 int (*get_fmt)(struct v4l2_subdev *sd,
514 int (*set_fmt)(struct v4l2_subdev *sd,
517 int (*get_selection)(struct v4l2_subdev *sd,
520 int (*set_selection)(struct v4l2_subdev *sd,
523 int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid);
524 int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid);
525 int (*dv_timings_cap)(struct v4l2_subdev *sd,
527 int (*enum_dv_timings)(struct v4l2_subdev *sd,
530 int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link,
534 int (*get_frame_desc)(struct v4l2_subdev *sd, unsigned int pad,
536 int (*set_frame_desc)(struct v4l2_subdev *sd, unsigned int pad,
566 int (*registered)(struct v4l2_subdev *sd);
567 void (*unregistered)(struct v4l2_subdev *sd);
568 int (*open)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
569 int (*close)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
653 fun_name(struct v4l2_subdev *sd, \
657 BUG_ON(pad >= sd->entity.num_pads); \
668 static inline void v4l2_set_subdevdata(struct v4l2_subdev *sd, void *p) v4l2_set_subdevdata() argument
670 sd->dev_priv = p; v4l2_set_subdevdata()
673 static inline void *v4l2_get_subdevdata(const struct v4l2_subdev *sd) v4l2_get_subdevdata() argument
675 return sd->dev_priv; v4l2_get_subdevdata()
678 static inline void v4l2_set_subdev_hostdata(struct v4l2_subdev *sd, void *p) v4l2_set_subdev_hostdata() argument
680 sd->host_priv = p; v4l2_set_subdev_hostdata()
683 static inline void *v4l2_get_subdev_hostdata(const struct v4l2_subdev *sd) v4l2_get_subdev_hostdata() argument
685 return sd->host_priv; v4l2_get_subdev_hostdata()
689 int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd,
695 void v4l2_subdev_init(struct v4l2_subdev *sd,
701 Example: err = v4l2_subdev_call(sd, video, s_std, norm);
703 #define v4l2_subdev_call(sd, o, f, args...) \
704 (!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ? \
705 (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD))
707 #define v4l2_subdev_has_op(sd, o, f) \
708 ((sd)->ops->o && (sd)->ops->o->f)
H A Dv4l2-device.h55 void (*notify)(struct v4l2_subdev *sd,
110 struct v4l2_subdev *sd);
113 void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
122 static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, v4l2_subdev_notify() argument
125 if (sd && sd->v4l2_dev && sd->v4l2_dev->notify) v4l2_subdev_notify()
126 sd->v4l2_dev->notify(sd, notification, arg); v4l2_subdev_notify()
130 #define v4l2_device_for_each_subdev(sd, v4l2_dev) \
131 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list)
136 #define __v4l2_device_call_subdevs_p(v4l2_dev, sd, cond, o, f, args...) \
138 list_for_each_entry((sd), &(v4l2_dev)->subdevs, list) \
139 if ((cond) && (sd)->ops->o && (sd)->ops->o->f) \
140 (sd)->ops->o->f((sd) , ##args); \
155 #define __v4l2_device_call_subdevs_until_err_p(v4l2_dev, sd, cond, o, f, args...) \
159 list_for_each_entry((sd), &(v4l2_dev)->subdevs, list) { \
160 if ((cond) && (sd)->ops->o && (sd)->ops->o->f) \
161 __err = (sd)->ops->o->f((sd) , ##args); \
/linux-4.1.27/drivers/media/platform/exynos4-is/
H A Dfimc-isp.c114 static int fimc_is_subdev_enum_mbus_code(struct v4l2_subdev *sd, fimc_is_subdev_enum_mbus_code() argument
127 static int fimc_isp_subdev_get_fmt(struct v4l2_subdev *sd, fimc_isp_subdev_get_fmt() argument
131 struct fimc_isp *isp = v4l2_get_subdevdata(sd); fimc_isp_subdev_get_fmt()
135 *mf = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); fimc_isp_subdev_get_fmt()
158 isp_dbg(1, sd, "%s: pad%d: fmt: 0x%x, %dx%d\n", __func__, fimc_isp_subdev_get_fmt()
199 static int fimc_isp_subdev_set_fmt(struct v4l2_subdev *sd, fimc_isp_subdev_set_fmt() argument
203 struct fimc_isp *isp = v4l2_get_subdevdata(sd); fimc_isp_subdev_set_fmt()
208 isp_dbg(1, sd, "%s: pad%d: code: 0x%x, %dx%d\n", fimc_isp_subdev_set_fmt()
215 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); fimc_isp_subdev_set_fmt()
227 mf = v4l2_subdev_get_try_format(sd, cfg, pad); fimc_isp_subdev_set_fmt()
232 if (sd->entity.stream_count == 0) { fimc_isp_subdev_set_fmt()
255 static int fimc_isp_subdev_s_stream(struct v4l2_subdev *sd, int on) fimc_isp_subdev_s_stream() argument
257 struct fimc_isp *isp = v4l2_get_subdevdata(sd); fimc_isp_subdev_s_stream()
261 isp_dbg(1, sd, "%s: on: %d\n", __func__, on); fimc_isp_subdev_s_stream()
275 isp_dbg(1, sd, "changing mode to %d\n", is->config_index); fimc_isp_subdev_s_stream()
286 v4l2_err(sd, "stream on timeout\n"); fimc_isp_subdev_s_stream()
295 v4l2_err(sd, "stream off timeout\n"); fimc_isp_subdev_s_stream()
304 static int fimc_isp_subdev_s_power(struct v4l2_subdev *sd, int on) fimc_isp_subdev_s_power() argument
306 struct fimc_isp *isp = v4l2_get_subdevdata(sd); fimc_isp_subdev_s_power()
320 v4l2_err(sd, "firmware booting failed\n"); fimc_isp_subdev_s_power()
335 v4l2_err(sd, "sensor close timeout\n"); fimc_isp_subdev_s_power()
346 v4l2_err(sd, "sub-IP power off timeout\n"); fimc_isp_subdev_s_power()
366 static int fimc_isp_subdev_open(struct v4l2_subdev *sd, fimc_isp_subdev_open() argument
372 format = v4l2_subdev_get_try_format(sd, fh->pad, FIMC_ISP_SD_PAD_SINK); fimc_isp_subdev_open()
381 format = v4l2_subdev_get_try_format(sd, fh->pad, FIMC_ISP_SD_PAD_SRC_FIFO); fimc_isp_subdev_open()
386 format = v4l2_subdev_get_try_format(sd, fh->pad, FIMC_ISP_SD_PAD_SRC_DMA); fimc_isp_subdev_open()
392 static int fimc_isp_subdev_registered(struct v4l2_subdev *sd) fimc_isp_subdev_registered() argument
394 struct fimc_isp *isp = v4l2_get_subdevdata(sd); fimc_isp_subdev_registered()
398 isp->video_capture.ve.pipe = v4l2_get_subdev_hostdata(sd); fimc_isp_subdev_registered()
400 ret = fimc_isp_video_device_register(isp, sd->v4l2_dev, fimc_isp_subdev_registered()
408 static void fimc_isp_subdev_unregistered(struct v4l2_subdev *sd) fimc_isp_subdev_unregistered() argument
410 struct fimc_isp *isp = v4l2_get_subdevdata(sd); fimc_isp_subdev_unregistered()
695 struct v4l2_subdev *sd = &isp->subdev; fimc_isp_subdev_create() local
701 v4l2_subdev_init(sd, &fimc_is_subdev_ops); fimc_isp_subdev_create()
703 sd->owner = THIS_MODULE; fimc_isp_subdev_create()
704 sd->grp_id = GRP_ID_FIMC_IS; fimc_isp_subdev_create()
705 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; fimc_isp_subdev_create()
706 snprintf(sd->name, sizeof(sd->name), "FIMC-IS-ISP"); fimc_isp_subdev_create()
711 ret = media_entity_init(&sd->entity, FIMC_ISP_SD_PADS_NUM, fimc_isp_subdev_create()
761 media_entity_cleanup(&sd->entity); fimc_isp_subdev_create()
768 sd->ctrl_handler = handler; fimc_isp_subdev_create()
769 sd->internal_ops = &fimc_is_subdev_internal_ops; fimc_isp_subdev_create()
770 sd->entity.ops = &fimc_is_subdev_media_ops; fimc_isp_subdev_create()
771 v4l2_set_subdevdata(sd, isp); fimc_isp_subdev_create()
780 struct v4l2_subdev *sd = &isp->subdev; fimc_isp_subdev_destroy() local
782 v4l2_device_unregister_subdev(sd); fimc_isp_subdev_destroy()
783 media_entity_cleanup(&sd->entity); fimc_isp_subdev_destroy()
785 v4l2_set_subdevdata(sd, NULL); fimc_isp_subdev_destroy()
H A Dcommon.c20 struct v4l2_subdev *sd; fimc_find_remote_sensor() local
29 sd = media_entity_to_v4l2_subdev(pad->entity); fimc_find_remote_sensor()
31 if (sd->grp_id == GRP_ID_FIMC_IS_SENSOR || fimc_find_remote_sensor()
32 sd->grp_id == GRP_ID_SENSOR) fimc_find_remote_sensor()
33 return sd; fimc_find_remote_sensor()
35 pad = &sd->entity.pads[0]; fimc_find_remote_sensor()
H A Dfimc-capture.c787 struct v4l2_subdev *sd = p->subdevs[IDX_SENSOR]; fimc_pipeline_try_format() local
796 if (WARN_ON(!sd || !tfmt)) fimc_pipeline_try_format()
803 me = fimc_pipeline_get_head(&sd->entity); fimc_pipeline_try_format()
819 sd = media_entity_to_v4l2_subdev(me); fimc_pipeline_try_format()
822 ret = v4l2_subdev_call(sd, pad, set_fmt, NULL, &sfmt); fimc_pipeline_try_format()
829 ret = v4l2_subdev_call(sd, pad, set_fmt, NULL, fimc_pipeline_try_format()
1083 struct v4l2_subdev *sd; fimc_cap_enum_input() local
1090 sd = __fimc_md_get_subdev(ve->pipe, IDX_SENSOR); fimc_cap_enum_input()
1093 if (sd) fimc_cap_enum_input()
1094 strlcpy(i->name, sd->name, sizeof(i->name)); fimc_cap_enum_input()
1120 struct v4l2_subdev *sd = &vc->subdev; fimc_pipeline_validate() local
1133 for (i = 0; i < sd->entity.num_pads; i++) { fimc_pipeline_validate()
1134 struct media_pad *p = &sd->entity.pads[i]; fimc_pipeline_validate()
1149 if (sd == &vc->subdev) { fimc_pipeline_validate()
1157 ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sink_fmt); fimc_pipeline_validate()
1163 sd = media_entity_to_v4l2_subdev(src_pad->entity); fimc_pipeline_validate()
1166 ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &src_fmt); fimc_pipeline_validate()
1175 if (sd == p->subdevs[IDX_SENSOR] && fimc_pipeline_validate()
1181 ret = fimc_get_sensor_frame_desc(sd, plane_fmt, fimc_pipeline_validate()
1202 struct v4l2_subdev *sd; fimc_cap_streamon() local
1212 sd = __fimc_md_get_subdev(vc->ve.pipe, IDX_SENSOR); fimc_cap_streamon()
1213 if (sd) fimc_cap_streamon()
1214 si = v4l2_get_subdev_hostdata(sd); fimc_cap_streamon()
1395 struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); fimc_link_setup() local
1396 struct fimc_dev *fimc = v4l2_get_subdevdata(sd); fimc_link_setup()
1418 vc->input = sd->grp_id; fimc_link_setup()
1438 * @sd: pointer to a subdev generating the notification
1449 void fimc_sensor_notify(struct v4l2_subdev *sd, unsigned int notification, fimc_sensor_notify() argument
1458 if (sd == NULL) fimc_sensor_notify()
1461 si = v4l2_get_subdev_hostdata(sd); fimc_sensor_notify()
1462 fmd = entity_to_fimc_mdev(&sd->entity); fimc_sensor_notify()
1484 static int fimc_subdev_enum_mbus_code(struct v4l2_subdev *sd, fimc_subdev_enum_mbus_code() argument
1497 static int fimc_subdev_get_fmt(struct v4l2_subdev *sd, fimc_subdev_get_fmt() argument
1501 struct fimc_dev *fimc = v4l2_get_subdevdata(sd); fimc_subdev_get_fmt()
1507 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); fimc_subdev_get_fmt()
1538 static int fimc_subdev_set_fmt(struct v4l2_subdev *sd, fimc_subdev_set_fmt() argument
1542 struct fimc_dev *fimc = v4l2_get_subdevdata(sd); fimc_subdev_set_fmt()
1562 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); fimc_subdev_set_fmt()
1604 static int fimc_subdev_get_selection(struct v4l2_subdev *sd, fimc_subdev_get_selection() argument
1608 struct fimc_dev *fimc = v4l2_get_subdevdata(sd); fimc_subdev_get_selection()
1631 try_sel = v4l2_subdev_get_try_crop(sd, cfg, sel->pad); fimc_subdev_get_selection()
1634 try_sel = v4l2_subdev_get_try_compose(sd, cfg, sel->pad); fimc_subdev_get_selection()
1659 static int fimc_subdev_set_selection(struct v4l2_subdev *sd, fimc_subdev_set_selection() argument
1663 struct fimc_dev *fimc = v4l2_get_subdevdata(sd); fimc_subdev_set_selection()
1678 try_sel = v4l2_subdev_get_try_crop(sd, cfg, sel->pad); fimc_subdev_set_selection()
1681 try_sel = v4l2_subdev_get_try_compose(sd, cfg, sel->pad); fimc_subdev_set_selection()
1834 static int fimc_capture_subdev_registered(struct v4l2_subdev *sd) fimc_capture_subdev_registered() argument
1836 struct fimc_dev *fimc = v4l2_get_subdevdata(sd); fimc_capture_subdev_registered()
1842 ret = fimc_register_m2m_device(fimc, sd->v4l2_dev); fimc_capture_subdev_registered()
1846 fimc->vid_cap.ve.pipe = v4l2_get_subdev_hostdata(sd); fimc_capture_subdev_registered()
1848 ret = fimc_register_capture_device(fimc, sd->v4l2_dev); fimc_capture_subdev_registered()
1857 static void fimc_capture_subdev_unregistered(struct v4l2_subdev *sd) fimc_capture_subdev_unregistered() argument
1859 struct fimc_dev *fimc = v4l2_get_subdevdata(sd); fimc_capture_subdev_unregistered()
1889 struct v4l2_subdev *sd = &fimc->vid_cap.subdev; fimc_initialize_capture_subdev() local
1892 v4l2_subdev_init(sd, &fimc_subdev_ops); fimc_initialize_capture_subdev()
1893 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; fimc_initialize_capture_subdev()
1894 snprintf(sd->name, sizeof(sd->name), "FIMC.%d", fimc->id); fimc_initialize_capture_subdev()
1899 ret = media_entity_init(&sd->entity, FIMC_SD_PADS_NUM, fimc_initialize_capture_subdev()
1904 sd->entity.ops = &fimc_sd_media_ops; fimc_initialize_capture_subdev()
1905 sd->internal_ops = &fimc_capture_sd_internal_ops; fimc_initialize_capture_subdev()
1906 v4l2_set_subdevdata(sd, fimc); fimc_initialize_capture_subdev()
1912 struct v4l2_subdev *sd = &fimc->vid_cap.subdev; fimc_unregister_capture_subdev() local
1914 v4l2_device_unregister_subdev(sd); fimc_unregister_capture_subdev()
1915 media_entity_cleanup(&sd->entity); fimc_unregister_capture_subdev()
1916 v4l2_set_subdevdata(sd, NULL); fimc_unregister_capture_subdev()
H A Dmedia-dev.c71 struct v4l2_subdev *sd; fimc_pipeline_prepare() local
94 sd = media_entity_to_v4l2_subdev(pad->entity); fimc_pipeline_prepare()
96 switch (sd->grp_id) { fimc_pipeline_prepare()
98 sensor = sd; fimc_pipeline_prepare()
101 p->subdevs[IDX_SENSOR] = sd; fimc_pipeline_prepare()
104 p->subdevs[IDX_CSIS] = sd; fimc_pipeline_prepare()
107 p->subdevs[IDX_FLITE] = sd; fimc_pipeline_prepare()
110 p->subdevs[IDX_FIMC] = sd; fimc_pipeline_prepare()
113 p->subdevs[IDX_IS_ISP] = sd; fimc_pipeline_prepare()
118 me = &sd->entity; fimc_pipeline_prepare()
129 * @sd: subdevice to change power state for
132 * Return result of s_power subdev operation or -ENXIO if sd argument
135 static int __subdev_set_power(struct v4l2_subdev *sd, int on) __subdev_set_power() argument
140 if (sd == NULL) __subdev_set_power()
143 use_count = &sd->entity.use_count; __subdev_set_power()
148 ret = v4l2_subdev_call(sd, core, s_power, on); __subdev_set_power()
202 struct v4l2_subdev *sd; __fimc_pipeline_open() local
211 sd = p->subdevs[IDX_SENSOR]; __fimc_pipeline_open()
212 if (sd == NULL) __fimc_pipeline_open()
241 struct v4l2_subdev *sd = p ? p->subdevs[IDX_SENSOR] : NULL; __fimc_pipeline_close() local
245 if (sd == NULL) { __fimc_pipeline_close()
252 fmd = entity_to_fimc_mdev(&sd->entity); __fimc_pipeline_close()
471 struct v4l2_subdev *sd; register_fimc_lite_entity() local
479 sd = &fimc_lite->subdev; register_fimc_lite_entity()
480 sd->grp_id = GRP_ID_FLITE; register_fimc_lite_entity()
486 v4l2_set_subdev_hostdata(sd, ep); register_fimc_lite_entity()
488 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); register_fimc_lite_entity()
499 struct v4l2_subdev *sd; register_fimc_entity() local
506 sd = &fimc->vid_cap.subdev; register_fimc_entity()
507 sd->grp_id = GRP_ID_FIMC; register_fimc_entity()
513 v4l2_set_subdev_hostdata(sd, ep); register_fimc_entity()
515 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); register_fimc_entity()
530 struct v4l2_subdev *sd) register_csis_entity()
540 if (WARN_ON(fmd->csis[id].sd)) register_csis_entity()
543 sd->grp_id = GRP_ID_CSIS; register_csis_entity()
544 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); register_csis_entity()
546 fmd->csis[id].sd = sd; register_csis_entity()
555 struct v4l2_subdev *sd = &is->isp.subdev; register_fimc_is_entity() local
564 v4l2_set_subdev_hostdata(sd, ep); register_fimc_is_entity()
566 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); register_fimc_is_entity()
682 if (fmd->csis[i].sd == NULL) fimc_md_unregister_entities()
684 v4l2_device_unregister_subdev(fmd->csis[i].sd); fimc_md_unregister_entities()
685 fmd->csis[i].sd = NULL; fimc_md_unregister_entities()
869 csis = fmd->csis[pdata->mux_id].sd; fimc_md_create_links()
909 if (fmd->csis[i].sd == NULL) fimc_md_create_links()
912 source = &fmd->csis[i].sd->entity; fimc_md_create_links()
528 register_csis_entity(struct fimc_md *fmd, struct platform_device *pdev, struct v4l2_subdev *sd) register_csis_entity() argument
H A Dfimc-lite.c791 struct v4l2_subdev *sd = &fimc->subdev; fimc_pipeline_validate() local
798 pad = &sd->entity.pads[0]; fimc_pipeline_validate()
802 if (sd == &fimc->subdev) { fimc_pipeline_validate()
810 ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, fimc_pipeline_validate()
821 sd = media_entity_to_v4l2_subdev(pad->entity); fimc_pipeline_validate()
824 ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &src_fmt); fimc_pipeline_validate()
989 struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); fimc_lite_link_setup() local
990 struct fimc_lite *fimc = v4l2_get_subdevdata(sd); fimc_lite_link_setup()
997 v4l2_dbg(1, debug, sd, "%s: %s --> %s, flags: 0x%x. source_id: 0x%x\n", fimc_lite_link_setup()
1009 fimc->source_subdev_grp_id = sd->grp_id; fimc_lite_link_setup()
1037 v4l2_err(sd, "Invalid pad index\n"); fimc_lite_link_setup()
1049 static int fimc_lite_subdev_enum_mbus_code(struct v4l2_subdev *sd, fimc_lite_subdev_enum_mbus_code() argument
1063 struct v4l2_subdev *sd, __fimc_lite_subdev_get_try_fmt()
1069 return v4l2_subdev_get_try_format(sd, cfg, pad); __fimc_lite_subdev_get_try_fmt()
1072 static int fimc_lite_subdev_get_fmt(struct v4l2_subdev *sd, fimc_lite_subdev_get_fmt() argument
1076 struct fimc_lite *fimc = v4l2_get_subdevdata(sd); fimc_lite_subdev_get_fmt()
1081 mf = __fimc_lite_subdev_get_try_fmt(sd, cfg, fmt->pad); fimc_lite_subdev_get_fmt()
1103 static int fimc_lite_subdev_set_fmt(struct v4l2_subdev *sd, fimc_lite_subdev_set_fmt() argument
1107 struct fimc_lite *fimc = v4l2_get_subdevdata(sd); fimc_lite_subdev_set_fmt()
1113 v4l2_dbg(1, debug, sd, "pad%d: code: 0x%x, %dx%d\n", fimc_lite_subdev_set_fmt()
1119 sd->entity.stream_count > 0) || fimc_lite_subdev_set_fmt()
1131 mf = __fimc_lite_subdev_get_try_fmt(sd, cfg, fmt->pad); fimc_lite_subdev_set_fmt()
1136 src_fmt = __fimc_lite_subdev_get_try_fmt(sd, cfg, pad); fimc_lite_subdev_set_fmt()
1163 static int fimc_lite_subdev_get_selection(struct v4l2_subdev *sd, fimc_lite_subdev_get_selection() argument
1167 struct fimc_lite *fimc = v4l2_get_subdevdata(sd); fimc_lite_subdev_get_selection()
1176 sel->r = *v4l2_subdev_get_try_crop(sd, cfg, sel->pad); fimc_lite_subdev_get_selection()
1191 v4l2_dbg(1, debug, sd, "%s: (%d,%d) %dx%d, f_w: %d, f_h: %d\n", fimc_lite_subdev_get_selection()
1198 static int fimc_lite_subdev_set_selection(struct v4l2_subdev *sd, fimc_lite_subdev_set_selection() argument
1202 struct fimc_lite *fimc = v4l2_get_subdevdata(sd); fimc_lite_subdev_set_selection()
1213 *v4l2_subdev_get_try_crop(sd, cfg, sel->pad) = sel->r; fimc_lite_subdev_set_selection()
1225 v4l2_dbg(1, debug, sd, "%s: (%d,%d) %dx%d, f_w: %d, f_h: %d\n", fimc_lite_subdev_set_selection()
1232 static int fimc_lite_subdev_s_stream(struct v4l2_subdev *sd, int on) fimc_lite_subdev_s_stream() argument
1234 struct fimc_lite *fimc = v4l2_get_subdevdata(sd); fimc_lite_subdev_s_stream()
1245 fimc->sensor = fimc_find_remote_sensor(&sd->entity); fimc_lite_subdev_s_stream()
1270 v4l2_err(sd, "s_stream(0) timeout\n"); fimc_lite_subdev_s_stream()
1278 static int fimc_lite_log_status(struct v4l2_subdev *sd) fimc_lite_log_status() argument
1280 struct fimc_lite *fimc = v4l2_get_subdevdata(sd); fimc_lite_log_status()
1286 static int fimc_lite_subdev_registered(struct v4l2_subdev *sd) fimc_lite_subdev_registered() argument
1288 struct fimc_lite *fimc = v4l2_get_subdevdata(sd); fimc_lite_subdev_registered()
1301 vfd->v4l2_dev = sd->v4l2_dev; fimc_lite_subdev_registered()
1330 fimc->ve.pipe = v4l2_get_subdev_hostdata(sd); fimc_lite_subdev_registered()
1339 v4l2_info(sd->v4l2_dev, "Registered %s as /dev/%s\n", fimc_lite_subdev_registered()
1344 static void fimc_lite_subdev_unregistered(struct v4l2_subdev *sd) fimc_lite_subdev_unregistered() argument
1346 struct fimc_lite *fimc = v4l2_get_subdevdata(sd); fimc_lite_subdev_unregistered()
1429 struct v4l2_subdev *sd = &fimc->subdev; fimc_lite_create_capture_subdev() local
1432 v4l2_subdev_init(sd, &fimc_lite_subdev_ops); fimc_lite_create_capture_subdev()
1433 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; fimc_lite_create_capture_subdev()
1434 snprintf(sd->name, sizeof(sd->name), "FIMC-LITE.%d", fimc->index); fimc_lite_create_capture_subdev()
1439 ret = media_entity_init(&sd->entity, FLITE_SD_PADS_NUM, fimc_lite_create_capture_subdev()
1448 media_entity_cleanup(&sd->entity); fimc_lite_create_capture_subdev()
1452 sd->ctrl_handler = handler; fimc_lite_create_capture_subdev()
1453 sd->internal_ops = &fimc_lite_subdev_internal_ops; fimc_lite_create_capture_subdev()
1454 sd->entity.ops = &fimc_lite_subdev_media_ops; fimc_lite_create_capture_subdev()
1455 sd->owner = THIS_MODULE; fimc_lite_create_capture_subdev()
1456 v4l2_set_subdevdata(sd, fimc); fimc_lite_create_capture_subdev()
1463 struct v4l2_subdev *sd = &fimc->subdev; fimc_lite_unregister_capture_subdev() local
1465 v4l2_device_unregister_subdev(sd); fimc_lite_unregister_capture_subdev()
1466 media_entity_cleanup(&sd->entity); fimc_lite_unregister_capture_subdev()
1468 v4l2_set_subdevdata(sd, NULL); fimc_lite_unregister_capture_subdev()
1062 __fimc_lite_subdev_get_try_fmt( struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, unsigned int pad) __fimc_lite_subdev_get_try_fmt() argument
H A Dmipi-csis.c182 * @sd: v4l2_subdev associated with CSIS device instance
206 struct v4l2_subdev sd; member in struct:csis_state
279 return container_of(sdev, struct csis_state, sd); sd_to_csis_state()
337 v4l2_dbg(1, debug, &state->sd, "fmt: %#x, %d x %d\n", __s5pcsis_set_format()
442 v4l2_info(&state->sd, "--- %s ---\n", label); dump_regs()
446 v4l2_info(&state->sd, "%10s: 0x%08x\n", registers[i].name, cfg); dump_regs()
484 v4l2_info(&state->sd, "%s events: %d\n", s5pcsis_log_counters()
494 static int s5pcsis_s_power(struct v4l2_subdev *sd, int on) s5pcsis_s_power() argument
496 struct csis_state *state = sd_to_csis_state(sd); s5pcsis_s_power()
505 static int s5pcsis_s_stream(struct v4l2_subdev *sd, int enable) s5pcsis_s_stream() argument
507 struct csis_state *state = sd_to_csis_state(sd); s5pcsis_s_stream()
510 v4l2_dbg(1, debug, sd, "%s: %d, state: 0x%x\n", s5pcsis_s_stream()
542 static int s5pcsis_enum_mbus_code(struct v4l2_subdev *sd, s5pcsis_enum_mbus_code() argument
575 return cfg ? v4l2_subdev_get_try_format(&state->sd, cfg, 0) : NULL; __s5pcsis_get_format()
580 static int s5pcsis_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, s5pcsis_set_fmt() argument
583 struct csis_state *state = sd_to_csis_state(sd); s5pcsis_set_fmt()
608 static int s5pcsis_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, s5pcsis_get_fmt() argument
611 struct csis_state *state = sd_to_csis_state(sd); s5pcsis_get_fmt()
624 static int s5pcsis_s_rx_buffer(struct v4l2_subdev *sd, void *buf, s5pcsis_s_rx_buffer() argument
627 struct csis_state *state = sd_to_csis_state(sd); s5pcsis_s_rx_buffer()
640 static int s5pcsis_log_status(struct v4l2_subdev *sd) s5pcsis_log_status() argument
642 struct csis_state *state = sd_to_csis_state(sd); s5pcsis_log_status()
652 static int s5pcsis_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) s5pcsis_open() argument
654 struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(sd, fh->pad, 0); s5pcsis_open()
721 v4l2_dbg(2, debug, &state->sd, "%s: %d\n", s5pcsis_irq_handler()
725 v4l2_dbg(2, debug, &state->sd, "status: %08x\n", status); s5pcsis_irq_handler()
855 v4l2_subdev_init(&state->sd, &s5pcsis_subdev_ops); s5pcsis_probe()
856 state->sd.owner = THIS_MODULE; s5pcsis_probe()
857 snprintf(state->sd.name, sizeof(state->sd.name), "%s.%d", s5pcsis_probe()
859 state->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; s5pcsis_probe()
868 ret = media_entity_init(&state->sd.entity, s5pcsis_probe()
874 v4l2_set_subdevdata(&state->sd, pdev); s5pcsis_probe()
877 platform_set_drvdata(pdev, &state->sd); s5pcsis_probe()
893 media_entity_cleanup(&state->sd.entity); s5pcsis_probe()
904 struct v4l2_subdev *sd = platform_get_drvdata(pdev); s5pcsis_pm_suspend() local
905 struct csis_state *state = sd_to_csis_state(sd); s5pcsis_pm_suspend()
908 v4l2_dbg(1, debug, sd, "%s: flags: 0x%x\n", s5pcsis_pm_suspend()
934 struct v4l2_subdev *sd = platform_get_drvdata(pdev); s5pcsis_pm_resume() local
935 struct csis_state *state = sd_to_csis_state(sd); s5pcsis_pm_resume()
938 v4l2_dbg(1, debug, sd, "%s: flags: 0x%x\n", s5pcsis_pm_resume()
995 struct v4l2_subdev *sd = platform_get_drvdata(pdev); s5pcsis_remove() local
996 struct csis_state *state = sd_to_csis_state(sd); s5pcsis_remove()
1004 media_entity_cleanup(&state->sd.entity); s5pcsis_remove()
/linux-4.1.27/drivers/mmc/core/
H A DMakefile7 mmc.o mmc_ops.o sd.o sd_ops.o \
/linux-4.1.27/drivers/media/pci/cx18/
H A Dcx18-gpio.c108 static int gpiomux_log_status(struct v4l2_subdev *sd) gpiomux_log_status() argument
110 struct cx18 *cx = v4l2_get_subdevdata(sd); gpiomux_log_status()
113 CX18_INFO_DEV(sd, "GPIO: direction 0x%08x, value 0x%08x\n", gpiomux_log_status()
119 static int gpiomux_s_radio(struct v4l2_subdev *sd) gpiomux_s_radio() argument
121 struct cx18 *cx = v4l2_get_subdevdata(sd); gpiomux_s_radio()
133 static int gpiomux_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) gpiomux_s_std() argument
135 struct cx18 *cx = v4l2_get_subdevdata(sd); gpiomux_s_std()
158 static int gpiomux_s_audio_routing(struct v4l2_subdev *sd, gpiomux_s_audio_routing() argument
161 struct cx18 *cx = v4l2_get_subdevdata(sd); gpiomux_s_audio_routing()
207 static int resetctrl_log_status(struct v4l2_subdev *sd) resetctrl_log_status() argument
209 struct cx18 *cx = v4l2_get_subdevdata(sd); resetctrl_log_status()
212 CX18_INFO_DEV(sd, "GPIO: direction 0x%08x, value 0x%08x\n", resetctrl_log_status()
218 static int resetctrl_reset(struct v4l2_subdev *sd, u32 val) resetctrl_reset() argument
220 struct cx18 *cx = v4l2_get_subdevdata(sd); resetctrl_reset()
296 struct v4l2_subdev *sd; cx18_gpio_register() local
302 sd = &cx->sd_gpiomux; cx18_gpio_register()
307 sd = &cx->sd_resetctrl; cx18_gpio_register()
315 v4l2_subdev_init(sd, ops); cx18_gpio_register()
316 v4l2_set_subdevdata(sd, cx); cx18_gpio_register()
317 snprintf(sd->name, sizeof(sd->name), "%s %s", cx->v4l2_dev.name, str); cx18_gpio_register()
318 sd->grp_id = hw; cx18_gpio_register()
319 return v4l2_device_register_subdev(&cx->v4l2_dev, sd); cx18_gpio_register()
H A Dcx18-i2c.c113 struct v4l2_subdev *sd; cx18_i2c_register() local
121 sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, cx18_i2c_register()
123 if (sd != NULL) cx18_i2c_register()
124 sd->grp_id = hw; cx18_i2c_register()
125 sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, cx18_i2c_register()
127 if (sd != NULL) cx18_i2c_register()
128 sd->grp_id = hw; cx18_i2c_register()
129 sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, cx18_i2c_register()
131 if (sd != NULL) cx18_i2c_register()
132 sd->grp_id = hw; cx18_i2c_register()
133 return sd != NULL ? 0 : -1; cx18_i2c_register()
144 sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, adap, type, hw_addrs[idx], cx18_i2c_register()
146 if (sd != NULL) cx18_i2c_register()
147 sd->grp_id = hw; cx18_i2c_register()
148 return sd != NULL ? 0 : -1; cx18_i2c_register()
155 struct v4l2_subdev *sd; cx18_find_hw() local
158 v4l2_device_for_each_subdev(sd, &cx->v4l2_dev) { cx18_find_hw()
159 if (sd->grp_id == hw) { cx18_find_hw()
160 result = sd; cx18_find_hw()
H A Dcx18-av-core.c127 static void cx18_av_initialize(struct v4l2_subdev *sd) cx18_av_initialize() argument
129 struct cx18_av_state *state = to_cx18_av_state(sd); cx18_av_initialize()
130 struct cx18 *cx = v4l2_get_subdevdata(sd); cx18_av_initialize()
269 static int cx18_av_reset(struct v4l2_subdev *sd, u32 val) cx18_av_reset() argument
271 cx18_av_initialize(sd); cx18_av_reset()
275 static int cx18_av_load_fw(struct v4l2_subdev *sd) cx18_av_load_fw() argument
277 struct cx18_av_state *state = to_cx18_av_state(sd); cx18_av_load_fw()
282 cx18_av_initialize(sd); cx18_av_load_fw()
290 struct v4l2_subdev *sd = &state->sd; cx18_av_std_setup() local
457 CX18_DEBUG_INFO_DEV(sd, "PLL regs = int: %u, frac: %u, post: %u\n", cx18_av_std_setup()
466 CX18_DEBUG_INFO_DEV(sd, "Video PLL = %d.%06d MHz\n", cx18_av_std_setup()
468 CX18_DEBUG_INFO_DEV(sd, "Pixel rate = %d.%06d Mpixel/sec\n", cx18_av_std_setup()
471 CX18_DEBUG_INFO_DEV(sd, "ADC XTAL/pixel clock decimation ratio " cx18_av_std_setup()
478 CX18_DEBUG_INFO_DEV(sd, cx18_av_std_setup()
482 CX18_DEBUG_INFO_DEV(sd, "hblank %i, hactive %i, vblank %i, " cx18_av_std_setup()
577 static int cx18_av_s_frequency(struct v4l2_subdev *sd, cx18_av_s_frequency() argument
580 struct cx18 *cx = v4l2_get_subdevdata(sd); cx18_av_s_frequency()
589 struct v4l2_subdev *sd = &state->sd; set_input() local
601 CX18_DEBUG_INFO_DEV(sd, "decoder set video input %d, audio input %d\n", set_input()
621 CX18_ERR_DEV(sd, "0x%06x is not a valid video input!\n", set_input()
641 CX18_ERR_DEV(sd, "0x%06x is not a valid video input!\n", set_input()
686 CX18_ERR_DEV(sd, "0x%04x is not a valid audio input!\n", set_input()
758 static int cx18_av_s_video_routing(struct v4l2_subdev *sd, cx18_av_s_video_routing() argument
761 struct cx18_av_state *state = to_cx18_av_state(sd); cx18_av_s_video_routing()
762 struct cx18 *cx = v4l2_get_subdevdata(sd); cx18_av_s_video_routing()
766 static int cx18_av_s_audio_routing(struct v4l2_subdev *sd, cx18_av_s_audio_routing() argument
769 struct cx18_av_state *state = to_cx18_av_state(sd); cx18_av_s_audio_routing()
770 struct cx18 *cx = v4l2_get_subdevdata(sd); cx18_av_s_audio_routing()
774 static int cx18_av_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) cx18_av_g_tuner() argument
776 struct cx18_av_state *state = to_cx18_av_state(sd); cx18_av_g_tuner()
777 struct cx18 *cx = v4l2_get_subdevdata(sd); cx18_av_g_tuner()
811 static int cx18_av_s_tuner(struct v4l2_subdev *sd, const struct v4l2_tuner *vt) cx18_av_s_tuner() argument
813 struct cx18_av_state *state = to_cx18_av_state(sd); cx18_av_s_tuner()
814 struct cx18 *cx = v4l2_get_subdevdata(sd); cx18_av_s_tuner()
856 static int cx18_av_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) cx18_av_s_std() argument
858 struct cx18_av_state *state = to_cx18_av_state(sd); cx18_av_s_std()
859 struct cx18 *cx = v4l2_get_subdevdata(sd); cx18_av_s_std()
894 CX18_DEBUG_INFO_DEV(sd, "changing video std to fmt %i\n", fmt); cx18_av_s_std()
912 static int cx18_av_s_radio(struct v4l2_subdev *sd) cx18_av_s_radio() argument
914 struct cx18_av_state *state = to_cx18_av_state(sd); cx18_av_s_radio()
921 struct v4l2_subdev *sd = to_sd(ctrl); cx18_av_s_ctrl() local
922 struct cx18 *cx = v4l2_get_subdevdata(sd); cx18_av_s_ctrl()
948 static int cx18_av_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) cx18_av_s_mbus_fmt() argument
950 struct cx18_av_state *state = to_cx18_av_state(sd); cx18_av_s_mbus_fmt()
951 struct cx18 *cx = v4l2_get_subdevdata(sd); cx18_av_s_mbus_fmt()
985 CX18_ERR_DEV(sd, "%dx%d is not a valid size!\n", cx18_av_s_mbus_fmt()
1003 CX18_DEBUG_INFO_DEV(sd, cx18_av_s_mbus_fmt()
1019 static int cx18_av_s_stream(struct v4l2_subdev *sd, int enable) cx18_av_s_stream() argument
1021 struct cx18 *cx = v4l2_get_subdevdata(sd); cx18_av_s_stream()
1023 CX18_DEBUG_INFO_DEV(sd, "%s output\n", enable ? "enable" : "disable"); cx18_av_s_stream()
1046 struct v4l2_subdev *sd = &state->sd; log_video_status() local
1052 CX18_INFO_DEV(sd, "Video signal: %spresent\n", log_video_status()
1054 CX18_INFO_DEV(sd, "Detected format: %s\n", log_video_status()
1057 CX18_INFO_DEV(sd, "Specified standard: %s\n", log_video_status()
1063 CX18_INFO_DEV(sd, "Specified video input: Composite %d\n", log_video_status()
1066 CX18_INFO_DEV(sd, "Specified video input: " log_video_status()
1072 CX18_INFO_DEV(sd, "Specified audioclock freq: %d Hz\n", log_video_status()
1079 struct v4l2_subdev *sd = &state->sd; log_audio_status() local
1102 CX18_INFO_DEV(sd, "Detected audio mode: %s\n", p); log_audio_status()
1127 CX18_INFO_DEV(sd, "Detected audio standard: %s\n", p); log_audio_status()
1128 CX18_INFO_DEV(sd, "Audio muted: %s\n", log_audio_status()
1130 CX18_INFO_DEV(sd, "Audio microcontroller: %s\n", log_audio_status()
1152 CX18_INFO_DEV(sd, "Configured audio standard: %s\n", p); log_audio_status()
1166 CX18_INFO_DEV(sd, "Configured audio mode: %s\n", p); log_audio_status()
1184 CX18_INFO_DEV(sd, "Configured audio system: %s\n", p); log_audio_status()
1188 CX18_INFO_DEV(sd, "Specified audio input: Tuner (In%d)\n", log_audio_status()
1191 CX18_INFO_DEV(sd, "Specified audio input: External\n"); log_audio_status()
1204 CX18_INFO_DEV(sd, "Preferred audio mode: %s\n", p); log_audio_status()
1211 CX18_INFO_DEV(sd, "Selected 65 MHz format: %s\n", p); log_audio_status()
1221 CX18_INFO_DEV(sd, "Selected 45 MHz format: %s\n", p); log_audio_status()
1225 static int cx18_av_log_status(struct v4l2_subdev *sd) cx18_av_log_status() argument
1227 struct cx18 *cx = v4l2_get_subdevdata(sd); cx18_av_log_status()
1234 static int cx18_av_g_register(struct v4l2_subdev *sd, cx18_av_g_register() argument
1237 struct cx18 *cx = v4l2_get_subdevdata(sd); cx18_av_g_register()
1246 static int cx18_av_s_register(struct v4l2_subdev *sd, cx18_av_s_register() argument
1249 struct cx18 *cx = v4l2_get_subdevdata(sd); cx18_av_s_register()
1309 struct v4l2_subdev *sd; cx18_av_probe() local
1321 sd = &state->sd; cx18_av_probe()
1322 v4l2_subdev_init(sd, &cx18_av_ops); cx18_av_probe()
1323 v4l2_set_subdevdata(sd, cx); cx18_av_probe()
1324 snprintf(sd->name, sizeof(sd->name), cx18_av_probe()
1326 sd->grp_id = CX18_HW_418_AV; cx18_av_probe()
1352 sd->ctrl_handler = &state->hdl; cx18_av_probe()
1359 err = v4l2_device_register_subdev(&cx->v4l2_dev, sd); cx18_av_probe()
/linux-4.1.27/drivers/media/pci/cx23885/
H A Dcx23888-ir.c126 struct v4l2_subdev sd; member in struct:cx23888_ir_state
142 static inline struct cx23888_ir_state *to_state(struct v4l2_subdev *sd) to_state() argument
144 return v4l2_get_subdevdata(sd); to_state()
529 static int cx23888_ir_irq_handler(struct v4l2_subdev *sd, u32 status, cx23888_ir_irq_handler() argument
532 struct cx23888_ir_state *state = to_state(sd); cx23888_ir_irq_handler()
556 v4l2_dbg(2, ir_888_debug, sd, "IRQ Status: %s %s %s %s %s %s\n", cx23888_ir_irq_handler()
562 v4l2_dbg(2, ir_888_debug, sd, "IRQ Enables: %s %s %s %s\n", cx23888_ir_irq_handler()
583 v4l2_subdev_notify(sd, V4L2_SUBDEV_IR_TX_NOTIFY, &events); cx23888_ir_irq_handler()
621 v4l2_err(sd, "IR receiver software FIFO overrun\n"); cx23888_ir_irq_handler()
630 v4l2_err(sd, "IR receiver hardware FIFO overrun\n"); cx23888_ir_irq_handler()
653 v4l2_subdev_notify(sd, V4L2_SUBDEV_IR_RX_NOTIFY, &events); cx23888_ir_irq_handler()
658 static int cx23888_ir_rx_read(struct v4l2_subdev *sd, u8 *buf, size_t count, cx23888_ir_rx_read() argument
661 struct cx23888_ir_state *state = to_state(sd); cx23888_ir_rx_read()
704 v4l2_dbg(2, ir_888_debug, sd, "rx read: %10u ns %s %s\n", cx23888_ir_rx_read()
707 v4l2_dbg(2, ir_888_debug, sd, "rx read: end of rx\n"); cx23888_ir_rx_read()
712 static int cx23888_ir_rx_g_parameters(struct v4l2_subdev *sd, cx23888_ir_rx_g_parameters() argument
715 struct cx23888_ir_state *state = to_state(sd); cx23888_ir_rx_g_parameters()
722 static int cx23888_ir_rx_shutdown(struct v4l2_subdev *sd) cx23888_ir_rx_shutdown() argument
724 struct cx23888_ir_state *state = to_state(sd); cx23888_ir_rx_shutdown()
743 static int cx23888_ir_rx_s_parameters(struct v4l2_subdev *sd, cx23888_ir_rx_s_parameters() argument
746 struct cx23888_ir_state *state = to_state(sd); cx23888_ir_rx_s_parameters()
752 return cx23888_ir_rx_shutdown(sd); cx23888_ir_rx_s_parameters()
831 static int cx23888_ir_tx_write(struct v4l2_subdev *sd, u8 *buf, size_t count, cx23888_ir_tx_write() argument
834 struct cx23888_ir_state *state = to_state(sd); cx23888_ir_tx_write()
842 static int cx23888_ir_tx_g_parameters(struct v4l2_subdev *sd, cx23888_ir_tx_g_parameters() argument
845 struct cx23888_ir_state *state = to_state(sd); cx23888_ir_tx_g_parameters()
852 static int cx23888_ir_tx_shutdown(struct v4l2_subdev *sd) cx23888_ir_tx_shutdown() argument
854 struct cx23888_ir_state *state = to_state(sd); cx23888_ir_tx_shutdown()
871 static int cx23888_ir_tx_s_parameters(struct v4l2_subdev *sd, cx23888_ir_tx_s_parameters() argument
874 struct cx23888_ir_state *state = to_state(sd); cx23888_ir_tx_s_parameters()
880 return cx23888_ir_tx_shutdown(sd); cx23888_ir_tx_s_parameters()
947 static int cx23888_ir_log_status(struct v4l2_subdev *sd) cx23888_ir_log_status() argument
949 struct cx23888_ir_state *state = to_state(sd); cx23888_ir_log_status()
962 v4l2_info(sd, "IR Receiver:\n"); cx23888_ir_log_status()
963 v4l2_info(sd, "\tEnabled: %s\n", cx23888_ir_log_status()
965 v4l2_info(sd, "\tDemodulation from a carrier: %s\n", cx23888_ir_log_status()
967 v4l2_info(sd, "\tFIFO: %s\n", cx23888_ir_log_status()
986 v4l2_info(sd, "\tPulse timers' start/stop trigger: %s\n", s); cx23888_ir_log_status()
987 v4l2_info(sd, "\tFIFO data on pulse timer overflow: %s\n", cx23888_ir_log_status()
989 v4l2_info(sd, "\tFIFO interrupt watermark: %s\n", cx23888_ir_log_status()
991 v4l2_info(sd, "\tLoopback mode: %s\n", cx23888_ir_log_status()
994 v4l2_info(sd, "\tExpected carrier (16 clocks): %u Hz\n", cx23888_ir_log_status()
1018 v4l2_info(sd, "\tNext carrier edge window: 16 clocks " cx23888_ir_log_status()
1023 v4l2_info(sd, "\tMax measurable pulse width: %u us, %llu ns\n", cx23888_ir_log_status()
1026 v4l2_info(sd, "\tLow pass filter: %s\n", cx23888_ir_log_status()
1029 v4l2_info(sd, "\tMin acceptable pulse width (LPF): %u us, " cx23888_ir_log_status()
1033 v4l2_info(sd, "\tPulse width timer timed-out: %s\n", cx23888_ir_log_status()
1035 v4l2_info(sd, "\tPulse width timer time-out intr: %s\n", cx23888_ir_log_status()
1037 v4l2_info(sd, "\tFIFO overrun: %s\n", cx23888_ir_log_status()
1039 v4l2_info(sd, "\tFIFO overrun interrupt: %s\n", cx23888_ir_log_status()
1041 v4l2_info(sd, "\tBusy: %s\n", cx23888_ir_log_status()
1043 v4l2_info(sd, "\tFIFO service requested: %s\n", cx23888_ir_log_status()
1045 v4l2_info(sd, "\tFIFO service request interrupt: %s\n", cx23888_ir_log_status()
1048 v4l2_info(sd, "IR Transmitter:\n"); cx23888_ir_log_status()
1049 v4l2_info(sd, "\tEnabled: %s\n", cx23888_ir_log_status()
1051 v4l2_info(sd, "\tModulation onto a carrier: %s\n", cx23888_ir_log_status()
1053 v4l2_info(sd, "\tFIFO: %s\n", cx23888_ir_log_status()
1055 v4l2_info(sd, "\tFIFO interrupt watermark: %s\n", cx23888_ir_log_status()
1057 v4l2_info(sd, "\tOutput pin level inversion %s\n", cx23888_ir_log_status()
1059 v4l2_info(sd, "\tCarrier polarity: %s\n", cx23888_ir_log_status()
1063 v4l2_info(sd, "\tCarrier (16 clocks): %u Hz\n", cx23888_ir_log_status()
1065 v4l2_info(sd, "\tCarrier duty cycle: %2u/16\n", cx23888_ir_log_status()
1068 v4l2_info(sd, "\tMax pulse width: %u us, %llu ns\n", cx23888_ir_log_status()
1071 v4l2_info(sd, "\tBusy: %s\n", cx23888_ir_log_status()
1073 v4l2_info(sd, "\tFIFO service requested: %s\n", cx23888_ir_log_status()
1075 v4l2_info(sd, "\tFIFO service request interrupt: %s\n", cx23888_ir_log_status()
1082 static int cx23888_ir_g_register(struct v4l2_subdev *sd, cx23888_ir_g_register() argument
1085 struct cx23888_ir_state *state = to_state(sd); cx23888_ir_g_register()
1097 static int cx23888_ir_s_register(struct v4l2_subdev *sd, cx23888_ir_s_register() argument
1100 struct cx23888_ir_state *state = to_state(sd); cx23888_ir_s_register()
1173 struct v4l2_subdev *sd; cx23888_ir_probe() local
1186 sd = &state->sd; cx23888_ir_probe()
1188 v4l2_subdev_init(sd, &cx23888_ir_controller_ops); cx23888_ir_probe()
1189 v4l2_set_subdevdata(sd, state); cx23888_ir_probe()
1191 snprintf(sd->name, sizeof(sd->name), "%s/888-ir", dev->name); cx23888_ir_probe()
1192 sd->grp_id = CX23885_HW_888_IR; cx23888_ir_probe()
1194 ret = v4l2_device_register_subdev(&dev->v4l2_dev, sd); cx23888_ir_probe()
1205 v4l2_subdev_call(sd, ir, rx_s_parameters, &default_params); cx23888_ir_probe()
1209 v4l2_subdev_call(sd, ir, tx_s_parameters, &default_params); cx23888_ir_probe()
1218 struct v4l2_subdev *sd; cx23888_ir_remove() local
1221 sd = cx23885_find_hw(dev, CX23885_HW_888_IR); cx23888_ir_remove()
1222 if (sd == NULL) cx23888_ir_remove()
1225 cx23888_ir_rx_shutdown(sd); cx23888_ir_remove()
1226 cx23888_ir_tx_shutdown(sd); cx23888_ir_remove()
1228 state = to_state(sd); cx23888_ir_remove()
1229 v4l2_device_unregister_subdev(sd); cx23888_ir_remove()
H A Dcx23885-ir.c72 void cx23885_ir_rx_v4l2_dev_notify(struct v4l2_subdev *sd, u32 events) cx23885_ir_rx_v4l2_dev_notify() argument
74 struct cx23885_dev *dev = to_cx23885(sd->v4l2_dev); cx23885_ir_rx_v4l2_dev_notify()
90 if (sd == dev->sd_cx25840) cx23885_ir_rx_v4l2_dev_notify()
97 void cx23885_ir_tx_v4l2_dev_notify(struct v4l2_subdev *sd, u32 events) cx23885_ir_tx_v4l2_dev_notify() argument
99 struct cx23885_dev *dev = to_cx23885(sd->v4l2_dev); cx23885_ir_tx_v4l2_dev_notify()
109 if (sd == dev->sd_cx25840) cx23885_ir_tx_v4l2_dev_notify()
H A Dcx23885-ir.h21 void cx23885_ir_rx_v4l2_dev_notify(struct v4l2_subdev *sd, u32 events);
22 void cx23885_ir_tx_v4l2_dev_notify(struct v4l2_subdev *sd, u32 events);
/linux-4.1.27/drivers/media/i2c/cx25840/
H A Dcx25840-core.h54 struct v4l2_subdev sd; member in struct:cx25840_state
80 static inline struct cx25840_state *to_state(struct v4l2_subdev *sd) to_state() argument
82 return container_of(sd, struct cx25840_state, sd); to_state()
87 return &container_of(ctrl->handler, struct cx25840_state, hdl)->sd; to_sd()
141 int cx25840_s_clock_freq(struct v4l2_subdev *sd, u32 freq);
147 int cx25840_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt);
148 int cx25840_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
149 int cx25840_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
150 int cx25840_decode_vbi_line(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi);
155 int cx25840_ir_log_status(struct v4l2_subdev *sd);
156 int cx25840_ir_irq_handler(struct v4l2_subdev *sd, u32 status, bool *handled);
157 int cx25840_ir_probe(struct v4l2_subdev *sd);
158 int cx25840_ir_remove(struct v4l2_subdev *sd);
H A Dcx25840-ir.c128 static inline struct cx25840_ir_state *to_ir_state(struct v4l2_subdev *sd) to_ir_state() argument
130 struct cx25840_state *state = to_state(sd); to_ir_state()
498 static inline void irqenable_rx(struct v4l2_subdev *sd, u32 mask) irqenable_rx() argument
500 struct cx25840_state *state = to_state(sd); irqenable_rx()
509 static inline void irqenable_tx(struct v4l2_subdev *sd, u32 mask) irqenable_tx() argument
511 struct cx25840_state *state = to_state(sd); irqenable_tx()
522 int cx25840_ir_irq_handler(struct v4l2_subdev *sd, u32 status, bool *handled) cx25840_ir_irq_handler() argument
524 struct cx25840_state *state = to_state(sd); cx25840_ir_irq_handler()
525 struct cx25840_ir_state *ir_state = to_ir_state(sd); cx25840_ir_irq_handler()
561 v4l2_dbg(2, ir_debug, sd, "IR IRQ Status: %s %s %s %s %s %s\n", cx25840_ir_irq_handler()
567 v4l2_dbg(2, ir_debug, sd, "IR IRQ Enables: %s %s %s %s\n", cx25840_ir_irq_handler()
586 irqenable_tx(sd, 0); cx25840_ir_irq_handler()
588 v4l2_subdev_notify(sd, V4L2_SUBDEV_IR_TX_NOTIFY, &events); cx25840_ir_irq_handler()
626 v4l2_err(sd, "IR receiver software FIFO overrun\n"); cx25840_ir_irq_handler()
635 v4l2_err(sd, "IR receiver hardware FIFO overrun\n"); cx25840_ir_irq_handler()
657 v4l2_subdev_notify(sd, V4L2_SUBDEV_IR_RX_NOTIFY, &events); cx25840_ir_irq_handler()
662 static int cx25840_ir_rx_read(struct v4l2_subdev *sd, u8 *buf, size_t count, cx25840_ir_rx_read() argument
665 struct cx25840_ir_state *ir_state = to_ir_state(sd); cx25840_ir_rx_read()
714 v4l2_dbg(2, ir_debug, sd, "rx read: %10u ns %s %s\n", cx25840_ir_rx_read()
717 v4l2_dbg(2, ir_debug, sd, "rx read: end of rx\n"); cx25840_ir_rx_read()
722 static int cx25840_ir_rx_g_parameters(struct v4l2_subdev *sd, cx25840_ir_rx_g_parameters() argument
725 struct cx25840_ir_state *ir_state = to_ir_state(sd); cx25840_ir_rx_g_parameters()
737 static int cx25840_ir_rx_shutdown(struct v4l2_subdev *sd) cx25840_ir_rx_shutdown() argument
739 struct cx25840_ir_state *ir_state = to_ir_state(sd); cx25840_ir_rx_shutdown()
749 irqenable_rx(sd, 0); cx25840_ir_rx_shutdown()
762 static int cx25840_ir_rx_s_parameters(struct v4l2_subdev *sd, cx25840_ir_rx_s_parameters() argument
765 struct cx25840_ir_state *ir_state = to_ir_state(sd); cx25840_ir_rx_s_parameters()
774 return cx25840_ir_rx_shutdown(sd); cx25840_ir_rx_s_parameters()
793 irqenable_rx(sd, 0); cx25840_ir_rx_s_parameters()
848 irqenable_rx(sd, IRQEN_RSE | IRQEN_RTE | IRQEN_ROE); cx25840_ir_rx_s_parameters()
857 static int cx25840_ir_tx_write(struct v4l2_subdev *sd, u8 *buf, size_t count, cx25840_ir_tx_write() argument
860 struct cx25840_ir_state *ir_state = to_ir_state(sd); cx25840_ir_tx_write()
906 irqenable_tx(sd, IRQEN_TSE); cx25840_ir_tx_write()
912 static int cx25840_ir_tx_g_parameters(struct v4l2_subdev *sd, cx25840_ir_tx_g_parameters() argument
915 struct cx25840_ir_state *ir_state = to_ir_state(sd); cx25840_ir_tx_g_parameters()
927 static int cx25840_ir_tx_shutdown(struct v4l2_subdev *sd) cx25840_ir_tx_shutdown() argument
929 struct cx25840_ir_state *ir_state = to_ir_state(sd); cx25840_ir_tx_shutdown()
939 irqenable_tx(sd, 0); cx25840_ir_tx_shutdown()
950 static int cx25840_ir_tx_s_parameters(struct v4l2_subdev *sd, cx25840_ir_tx_s_parameters() argument
953 struct cx25840_ir_state *ir_state = to_ir_state(sd); cx25840_ir_tx_s_parameters()
962 return cx25840_ir_tx_shutdown(sd); cx25840_ir_tx_s_parameters()
980 irqenable_tx(sd, 0); cx25840_ir_tx_s_parameters()
1026 irqenable_tx(sd, IRQEN_TSE); cx25840_ir_tx_s_parameters()
1038 int cx25840_ir_log_status(struct v4l2_subdev *sd) cx25840_ir_log_status() argument
1040 struct cx25840_state *state = to_state(sd); cx25840_ir_log_status()
1060 v4l2_info(sd, "IR Receiver:\n"); cx25840_ir_log_status()
1061 v4l2_info(sd, "\tEnabled: %s\n", cx25840_ir_log_status()
1063 v4l2_info(sd, "\tDemodulation from a carrier: %s\n", cx25840_ir_log_status()
1065 v4l2_info(sd, "\tFIFO: %s\n", cx25840_ir_log_status()
1084 v4l2_info(sd, "\tPulse timers' start/stop trigger: %s\n", s); cx25840_ir_log_status()
1085 v4l2_info(sd, "\tFIFO data on pulse timer overflow: %s\n", cx25840_ir_log_status()
1087 v4l2_info(sd, "\tFIFO interrupt watermark: %s\n", cx25840_ir_log_status()
1089 v4l2_info(sd, "\tLoopback mode: %s\n", cx25840_ir_log_status()
1092 v4l2_info(sd, "\tExpected carrier (16 clocks): %u Hz\n", cx25840_ir_log_status()
1116 v4l2_info(sd, "\tNext carrier edge window: 16 clocks " cx25840_ir_log_status()
1121 v4l2_info(sd, "\tMax measurable pulse width: %u us, %llu ns\n", cx25840_ir_log_status()
1124 v4l2_info(sd, "\tLow pass filter: %s\n", cx25840_ir_log_status()
1127 v4l2_info(sd, "\tMin acceptable pulse width (LPF): %u us, " cx25840_ir_log_status()
1131 v4l2_info(sd, "\tPulse width timer timed-out: %s\n", cx25840_ir_log_status()
1133 v4l2_info(sd, "\tPulse width timer time-out intr: %s\n", cx25840_ir_log_status()
1135 v4l2_info(sd, "\tFIFO overrun: %s\n", cx25840_ir_log_status()
1137 v4l2_info(sd, "\tFIFO overrun interrupt: %s\n", cx25840_ir_log_status()
1139 v4l2_info(sd, "\tBusy: %s\n", cx25840_ir_log_status()
1141 v4l2_info(sd, "\tFIFO service requested: %s\n", cx25840_ir_log_status()
1143 v4l2_info(sd, "\tFIFO service request interrupt: %s\n", cx25840_ir_log_status()
1146 v4l2_info(sd, "IR Transmitter:\n"); cx25840_ir_log_status()
1147 v4l2_info(sd, "\tEnabled: %s\n", cx25840_ir_log_status()
1149 v4l2_info(sd, "\tModulation onto a carrier: %s\n", cx25840_ir_log_status()
1151 v4l2_info(sd, "\tFIFO: %s\n", cx25840_ir_log_status()
1153 v4l2_info(sd, "\tFIFO interrupt watermark: %s\n", cx25840_ir_log_status()
1155 v4l2_info(sd, "\tCarrier polarity: %s\n", cx25840_ir_log_status()
1159 v4l2_info(sd, "\tCarrier (16 clocks): %u Hz\n", cx25840_ir_log_status()
1161 v4l2_info(sd, "\tCarrier duty cycle: %2u/16\n", cx25840_ir_log_status()
1164 v4l2_info(sd, "\tMax pulse width: %u us, %llu ns\n", cx25840_ir_log_status()
1167 v4l2_info(sd, "\tBusy: %s\n", cx25840_ir_log_status()
1169 v4l2_info(sd, "\tFIFO service requested: %s\n", cx25840_ir_log_status()
1171 v4l2_info(sd, "\tFIFO service request interrupt: %s\n", cx25840_ir_log_status()
1223 int cx25840_ir_probe(struct v4l2_subdev *sd) cx25840_ir_probe() argument
1225 struct cx25840_state *state = to_state(sd); cx25840_ir_probe()
1253 v4l2_subdev_call(sd, ir, rx_s_parameters, &default_params); cx25840_ir_probe()
1257 v4l2_subdev_call(sd, ir, tx_s_parameters, &default_params); cx25840_ir_probe()
1262 int cx25840_ir_remove(struct v4l2_subdev *sd) cx25840_ir_remove() argument
1264 struct cx25840_state *state = to_state(sd); cx25840_ir_remove()
1265 struct cx25840_ir_state *ir_state = to_ir_state(sd); cx25840_ir_remove()
1270 cx25840_ir_rx_shutdown(sd); cx25840_ir_remove()
1271 cx25840_ir_tx_shutdown(sd); cx25840_ir_remove()
H A Dcx25840-vbi.c85 int cx25840_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi) cx25840_g_sliced_fmt() argument
87 struct i2c_client *client = v4l2_get_subdevdata(sd); cx25840_g_sliced_fmt()
88 struct cx25840_state *state = to_state(sd); cx25840_g_sliced_fmt()
127 int cx25840_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt) cx25840_s_raw_fmt() argument
129 struct i2c_client *client = v4l2_get_subdevdata(sd); cx25840_s_raw_fmt()
130 struct cx25840_state *state = to_state(sd); cx25840_s_raw_fmt()
143 int cx25840_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi) cx25840_s_sliced_fmt() argument
145 struct i2c_client *client = v4l2_get_subdevdata(sd); cx25840_s_sliced_fmt()
146 struct cx25840_state *state = to_state(sd); cx25840_s_sliced_fmt()
211 int cx25840_decode_vbi_line(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi) cx25840_decode_vbi_line() argument
213 struct cx25840_state *state = to_state(sd); cx25840_decode_vbi_line()
/linux-4.1.27/fs/sysfs/
H A Ddir.c48 parent = kobj->parent->sd; sysfs_create_dir_ns()
63 kobj->sd = kn; sysfs_create_dir_ns()
77 struct kernfs_node *kn = kobj->sd; sysfs_remove_dir()
84 * control over removal. @kobj->sd may be removed anytime sysfs_remove_dir()
87 * sysfs_symlink_target_lock synchronizes @kobj->sd sysfs_remove_dir()
89 * can safely dereference @kobj->sd. sysfs_remove_dir()
92 kobj->sd = NULL; sysfs_remove_dir()
107 parent = kernfs_get_parent(kobj->sd); sysfs_rename_dir_ns()
108 ret = kernfs_rename_ns(kobj->sd, parent, new_name, new_ns); sysfs_rename_dir_ns()
116 struct kernfs_node *kn = kobj->sd; sysfs_move_dir_ns()
119 new_parent = new_parent_kobj && new_parent_kobj->sd ? sysfs_move_dir_ns()
120 new_parent_kobj->sd : sysfs_root_kn; sysfs_move_dir_ns()
132 struct kernfs_node *kn, *parent = parent_kobj->sd; sysfs_create_mount_point()
153 struct kernfs_node *parent = parent_kobj->sd; sysfs_remove_mount_point()
H A Dsymlink.c35 if (target_kobj->sd) { sysfs_do_create_link_sd()
36 target = target_kobj->sd; sysfs_do_create_link_sd()
75 parent = kobj->sd; sysfs_do_create_link()
131 if (targ->sd && kernfs_ns_enabled(kobj->sd)) sysfs_delete_link()
132 ns = targ->sd->ns; sysfs_delete_link()
134 kernfs_remove_by_name_ns(kobj->sd, name, ns); sysfs_delete_link()
149 parent = kobj->sd; sysfs_remove_link()
175 parent = kobj->sd; sysfs_rename_link_ns()
177 if (targ->sd) sysfs_rename_link_ns()
178 old_ns = targ->sd->ns; sysfs_rename_link_ns()
/linux-4.1.27/drivers/media/platform/s5p-tv/
H A Dsdo_drv.c65 struct v4l2_subdev sd; member in struct:sdo_device
70 static inline struct sdo_device *sd_to_sdev(struct v4l2_subdev *sd) sd_to_sdev() argument
72 return container_of(sd, struct sdo_device, sd); sd_to_sdev()
138 static int sdo_g_tvnorms_output(struct v4l2_subdev *sd, v4l2_std_id *std) sdo_g_tvnorms_output() argument
146 static int sdo_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) sdo_s_std_output() argument
148 struct sdo_device *sdev = sd_to_sdev(sd); sdo_s_std_output()
157 static int sdo_g_std_output(struct v4l2_subdev *sd, v4l2_std_id *std) sdo_g_std_output() argument
159 *std = sd_to_sdev(sd)->fmt->id; sdo_g_std_output()
163 static int sdo_g_mbus_fmt(struct v4l2_subdev *sd, sdo_g_mbus_fmt() argument
166 struct sdo_device *sdev = sd_to_sdev(sd); sdo_g_mbus_fmt()
179 static int sdo_s_power(struct v4l2_subdev *sd, int on) sdo_s_power() argument
181 struct sdo_device *sdev = sd_to_sdev(sd); sdo_s_power()
245 static int sdo_s_stream(struct v4l2_subdev *sd, int on) sdo_s_stream() argument
247 struct sdo_device *sdev = sd_to_sdev(sd); sdo_s_stream()
270 struct v4l2_subdev *sd = dev_get_drvdata(dev); sdo_runtime_suspend() local
271 struct sdo_device *sdev = sd_to_sdev(sd); sdo_runtime_suspend()
282 struct v4l2_subdev *sd = dev_get_drvdata(dev); sdo_runtime_resume() local
283 struct sdo_device *sdev = sd_to_sdev(sd); sdo_runtime_resume()
437 v4l2_subdev_init(&sdev->sd, &sdo_sd_ops); sdo_probe()
438 sdev->sd.owner = THIS_MODULE; sdo_probe()
439 strlcpy(sdev->sd.name, "s5p-sdo", sizeof(sdev->sd.name)); sdo_probe()
446 dev_set_drvdata(dev, &sdev->sd); sdo_probe()
466 struct v4l2_subdev *sd = dev_get_drvdata(&pdev->dev); sdo_remove() local
467 struct sdo_device *sdev = sd_to_sdev(sd); sdo_remove()
H A Dhdmiphy_drv.c34 struct v4l2_subdev sd; member in struct:hdmiphy_ctx
174 static inline struct hdmiphy_ctx *sd_to_ctx(struct v4l2_subdev *sd) sd_to_ctx() argument
176 return container_of(sd, struct hdmiphy_ctx, sd); sd_to_ctx()
188 static int hdmiphy_s_power(struct v4l2_subdev *sd, int on) hdmiphy_s_power() argument
194 static int hdmiphy_s_dv_timings(struct v4l2_subdev *sd, hdmiphy_s_dv_timings() argument
200 struct hdmiphy_ctx *ctx = sd_to_ctx(sd); hdmiphy_s_dv_timings()
201 struct i2c_client *client = v4l2_get_subdevdata(sd); hdmiphy_s_dv_timings()
225 static int hdmiphy_dv_timings_cap(struct v4l2_subdev *sd, hdmiphy_dv_timings_cap() argument
239 static int hdmiphy_s_stream(struct v4l2_subdev *sd, int enable) hdmiphy_s_stream() argument
241 struct i2c_client *client = v4l2_get_subdevdata(sd); hdmiphy_s_stream()
288 v4l2_i2c_subdev_init(&ctx->sd, client, &hdmiphy_ops); hdmiphy_probe()
296 struct v4l2_subdev *sd = i2c_get_clientdata(client); hdmiphy_remove() local
297 struct hdmiphy_ctx *ctx = sd_to_ctx(sd); hdmiphy_remove()
/linux-4.1.27/drivers/target/
H A Dtarget_core_pscsi.c306 struct scsi_device *sd) pscsi_add_device_to_list()
309 struct request_queue *q = sd->request_queue; pscsi_add_device_to_list()
311 pdv->pdv_sd = sd; pscsi_add_device_to_list()
313 if (!sd->queue_depth) { pscsi_add_device_to_list()
314 sd->queue_depth = PSCSI_DEFAULT_QUEUEDEPTH; pscsi_add_device_to_list()
317 " queue_depth to %d\n", sd->channel, sd->id, pscsi_add_device_to_list()
318 sd->lun, sd->queue_depth); pscsi_add_device_to_list()
321 dev->dev_attrib.hw_block_size = sd->sector_size; pscsi_add_device_to_list()
323 min_t(int, sd->host->max_sectors, queue_max_hw_sectors(q)); pscsi_add_device_to_list()
324 dev->dev_attrib.hw_queue_depth = sd->queue_depth; pscsi_add_device_to_list()
329 pscsi_set_inquiry_info(sd, &dev->t10_wwn); pscsi_add_device_to_list()
335 if (!pscsi_get_inquiry_vpd_serial(sd, &dev->t10_wwn)) { pscsi_add_device_to_list()
340 pscsi_get_inquiry_vpd_device_ident(sd, &dev->t10_wwn); pscsi_add_device_to_list()
346 if (sd->type == TYPE_TAPE) pscsi_add_device_to_list()
347 pscsi_tape_read_blocksize(dev, sd); pscsi_add_device_to_list()
369 static int pscsi_create_type_disk(struct se_device *dev, struct scsi_device *sd)
374 struct Scsi_Host *sh = sd->host;
378 if (scsi_device_get(sd)) {
380 sh->host_no, sd->channel, sd->id, sd->lun);
393 scsi_device_put(sd); variable
398 ret = pscsi_add_device_to_list(dev, sd);
401 scsi_device_put(sd); variable
406 phv->phv_host_id, sh->host_no, sd->channel, sd->id, sd->lun);
413 static int pscsi_create_type_rom(struct se_device *dev, struct scsi_device *sd)
417 struct Scsi_Host *sh = sd->host;
420 if (scsi_device_get(sd)) {
422 sh->host_no, sd->channel, sd->id, sd->lun);
428 ret = pscsi_add_device_to_list(dev, sd);
430 scsi_device_put(sd); variable
434 phv->phv_host_id, scsi_device_type(sd->type), sh->host_no,
435 sd->channel, sd->id, sd->lun);
444 struct scsi_device *sd)
448 struct Scsi_Host *sh = sd->host;
452 ret = pscsi_add_device_to_list(dev, sd);
457 phv->phv_host_id, scsi_device_type(sd->type), sh->host_no,
458 sd->channel, sd->id, sd->lun);
466 struct scsi_device *sd; pscsi_configure_device() local
535 list_for_each_entry(sd, &sh->__devices, siblings) { pscsi_configure_device()
536 if ((pdv->pdv_channel_id != sd->channel) || pscsi_configure_device()
537 (pdv->pdv_target_id != sd->id) || pscsi_configure_device()
538 (pdv->pdv_lun_id != sd->lun)) pscsi_configure_device()
545 switch (sd->type) { pscsi_configure_device()
547 ret = pscsi_create_type_disk(dev, sd); pscsi_configure_device()
550 ret = pscsi_create_type_rom(dev, sd); pscsi_configure_device()
553 ret = pscsi_create_type_other(dev, sd); pscsi_configure_device()
588 struct scsi_device *sd = pdv->pdv_sd; pscsi_free_device() local
590 if (sd) { pscsi_free_device()
595 if ((sd->type == TYPE_DISK) && pdv->pdv_bd) { pscsi_free_device()
610 if ((sd->type == TYPE_DISK) || (sd->type == TYPE_ROM)) pscsi_free_device()
611 scsi_device_put(sd); pscsi_free_device()
623 struct scsi_device *sd = pdv->pdv_sd; pscsi_transport_complete() local
665 if (sd->type != TYPE_TAPE || !cmd->data_length) pscsi_transport_complete()
703 sd->sector_size = blocksize; pscsi_transport_complete()
807 struct scsi_device *sd = pdv->pdv_sd; pscsi_show_configfs_dev_params() local
822 if (sd) { pscsi_show_configfs_dev_params()
826 if (ISPRINT(sd->vendor[i])) /* printable character? */ pscsi_show_configfs_dev_params()
827 bl += sprintf(b + bl, "%c", sd->vendor[i]); pscsi_show_configfs_dev_params()
833 if (ISPRINT(sd->model[i])) /* printable character ? */ pscsi_show_configfs_dev_params()
834 bl += sprintf(b + bl, "%c", sd->model[i]); pscsi_show_configfs_dev_params()
840 if (ISPRINT(sd->rev[i])) /* printable character ? */ pscsi_show_configfs_dev_params()
841 bl += sprintf(b + bl, "%c", sd->rev[i]); pscsi_show_configfs_dev_params()
1074 struct scsi_device *sd = pdv->pdv_sd; pscsi_get_device_type() local
1076 return (sd) ? sd->type : TYPE_NO_LUN; pscsi_get_device_type()
305 pscsi_add_device_to_list(struct se_device *dev, struct scsi_device *sd) pscsi_add_device_to_list() argument
/linux-4.1.27/arch/arm/vfp/
H A Dvfpsingle.c69 #define vfp_single_normaliseround(sd,vsd,fpscr,except,func) __vfp_single_normaliseround(sd,vsd,fpscr,except) __vfp_single_normaliseround()
70 u32 __vfp_single_normaliseround(int sd, struct vfp_single *vs, u32 fpscr, u32 exceptions) __vfp_single_normaliseround() argument
72 u32 vfp_single_normaliseround(int sd, struct vfp_single *vs, u32 fpscr, u32 exceptions, const char *func) __vfp_single_normaliseround()
202 sd, d, exceptions); __vfp_single_normaliseround()
204 vfp_put_float(d, sd); __vfp_single_normaliseround()
259 static u32 vfp_single_fabs(int sd, int unused, s32 m, u32 fpscr) vfp_single_fabs() argument
261 vfp_put_float(vfp_single_packed_abs(m), sd); vfp_single_fabs() local
265 static u32 vfp_single_fcpy(int sd, int unused, s32 m, u32 fpscr) vfp_single_fcpy() argument
267 vfp_put_float(m, sd); vfp_single_fcpy()
271 static u32 vfp_single_fneg(int sd, int unused, s32 m, u32 fpscr) vfp_single_fneg() argument
273 vfp_put_float(vfp_single_packed_negate(m), sd); vfp_single_fneg() local
316 static u32 vfp_single_fsqrt(int sd, int unused, s32 m, u32 fpscr) vfp_single_fsqrt() argument
337 vfp_put_float(vfp_single_pack(vsp), sd); vfp_single_fsqrt() local
394 return vfp_single_normaliseround(sd, &vsd, fpscr, 0, "fsqrt"); vfp_single_fsqrt()
403 static u32 vfp_compare(int sd, int signal_on_qnan, s32 m, u32 fpscr) vfp_compare() argument
408 d = vfp_get_float(sd); vfp_compare()
462 static u32 vfp_single_fcmp(int sd, int unused, s32 m, u32 fpscr) vfp_single_fcmp() argument
464 return vfp_compare(sd, 0, m, fpscr); vfp_single_fcmp()
467 static u32 vfp_single_fcmpe(int sd, int unused, s32 m, u32 fpscr) vfp_single_fcmpe() argument
469 return vfp_compare(sd, 1, m, fpscr); vfp_single_fcmpe()
472 static u32 vfp_single_fcmpz(int sd, int unused, s32 m, u32 fpscr) vfp_single_fcmpz() argument
474 return vfp_compare(sd, 0, 0, fpscr); vfp_single_fcmpz()
477 static u32 vfp_single_fcmpez(int sd, int unused, s32 m, u32 fpscr) vfp_single_fcmpez() argument
479 return vfp_compare(sd, 1, 0, fpscr); vfp_single_fcmpez()
525 static u32 vfp_single_fuito(int sd, int unused, s32 m, u32 fpscr) vfp_single_fuito() argument
533 return vfp_single_normaliseround(sd, &vs, fpscr, 0, "fuito"); vfp_single_fuito()
536 static u32 vfp_single_fsito(int sd, int unused, s32 m, u32 fpscr) vfp_single_fsito() argument
544 return vfp_single_normaliseround(sd, &vs, fpscr, 0, "fsito"); vfp_single_fsito()
547 static u32 vfp_single_ftoui(int sd, int unused, s32 m, u32 fpscr) vfp_single_ftoui() argument
615 pr_debug("VFP: ftoui: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions); vfp_single_ftoui()
617 vfp_put_float(d, sd); vfp_single_ftoui()
622 static u32 vfp_single_ftouiz(int sd, int unused, s32 m, u32 fpscr) vfp_single_ftouiz() argument
624 return vfp_single_ftoui(sd, unused, m, FPSCR_ROUND_TOZERO); vfp_single_ftouiz()
627 static u32 vfp_single_ftosi(int sd, int unused, s32 m, u32 fpscr) vfp_single_ftosi() argument
694 pr_debug("VFP: ftosi: d(s%d)=%08x exceptions=%08x\n", sd, d, exceptions); vfp_single_ftosi()
696 vfp_put_float((s32)d, sd); vfp_single_ftosi()
701 static u32 vfp_single_ftosiz(int sd, int unused, s32 m, u32 fpscr) vfp_single_ftosiz() argument
703 return vfp_single_ftosi(sd, unused, m, FPSCR_ROUND_TOZERO); vfp_single_ftosiz()
895 vfp_single_multiply_accumulate(int sd, int sn, s32 m, u32 fpscr, u32 negate, char *func) vfp_single_multiply_accumulate() argument
915 v = vfp_get_float(sd); vfp_single_multiply_accumulate()
916 pr_debug("VFP: s%u = %08x\n", sd, v); vfp_single_multiply_accumulate()
925 return vfp_single_normaliseround(sd, &vsd, fpscr, exceptions, func); vfp_single_multiply_accumulate()
933 * sd = sd + (sn * sm)
935 static u32 vfp_single_fmac(int sd, int sn, s32 m, u32 fpscr) vfp_single_fmac() argument
937 return vfp_single_multiply_accumulate(sd, sn, m, fpscr, 0, "fmac"); vfp_single_fmac()
941 * sd = sd - (sn * sm)
943 static u32 vfp_single_fnmac(int sd, int sn, s32 m, u32 fpscr) vfp_single_fnmac() argument
945 return vfp_single_multiply_accumulate(sd, sn, m, fpscr, NEG_MULTIPLY, "fnmac"); vfp_single_fnmac()
949 * sd = -sd + (sn * sm)
951 static u32 vfp_single_fmsc(int sd, int sn, s32 m, u32 fpscr) vfp_single_fmsc() argument
953 return vfp_single_multiply_accumulate(sd, sn, m, fpscr, NEG_SUBTRACT, "fmsc"); vfp_single_fmsc()
957 * sd = -sd - (sn * sm)
959 static u32 vfp_single_fnmsc(int sd, int sn, s32 m, u32 fpscr) vfp_single_fnmsc() argument
961 return vfp_single_multiply_accumulate(sd, sn, m, fpscr, NEG_SUBTRACT | NEG_MULTIPLY, "fnmsc"); vfp_single_fnmsc()
965 * sd = sn * sm
967 static u32 vfp_single_fmul(int sd, int sn, s32 m, u32 fpscr) vfp_single_fmul() argument
984 return vfp_single_normaliseround(sd, &vsd, fpscr, exceptions, "fmul"); vfp_single_fmul()
988 * sd = -(sn * sm)
990 static u32 vfp_single_fnmul(int sd, int sn, s32 m, u32 fpscr) vfp_single_fnmul() argument
1008 return vfp_single_normaliseround(sd, &vsd, fpscr, exceptions, "fnmul"); vfp_single_fnmul()
1012 * sd = sn + sm
1014 static u32 vfp_single_fadd(int sd, int sn, s32 m, u32 fpscr) vfp_single_fadd() argument
1035 return vfp_single_normaliseround(sd, &vsd, fpscr, exceptions, "fadd"); vfp_single_fadd()
1039 * sd = sn - sm
1041 static u32 vfp_single_fsub(int sd, int sn, s32 m, u32 fpscr) vfp_single_fsub() argument
1046 return vfp_single_fadd(sd, sn, vfp_single_packed_negate(m), fpscr); vfp_single_fsub()
1050 * sd = sn / sm
1052 static u32 vfp_single_fdiv(int sd, int sn, s32 m, u32 fpscr) vfp_single_fdiv() argument
1128 return vfp_single_normaliseround(sd, &vsd, fpscr, 0, "fdiv"); vfp_single_fdiv()
1133 vfp_put_float(vfp_single_pack(&vsd), sd); vfp_single_fdiv() local
1153 vfp_put_float(vfp_single_pack(&vfp_single_default_qnan), sd); vfp_single_fdiv() local
/linux-4.1.27/include/linux/iio/adc/
H A Dad_sigma_delta.h81 static inline int ad_sigma_delta_set_channel(struct ad_sigma_delta *sd, ad_sigma_delta_set_channel() argument
84 if (sd->info->set_channel) ad_sigma_delta_set_channel()
85 return sd->info->set_channel(sd, channel); ad_sigma_delta_set_channel()
90 static inline int ad_sigma_delta_set_mode(struct ad_sigma_delta *sd, ad_sigma_delta_set_mode() argument
93 if (sd->info->set_mode) ad_sigma_delta_set_mode()
94 return sd->info->set_mode(sd, mode); ad_sigma_delta_set_mode()
99 static inline int ad_sigma_delta_postprocess_sample(struct ad_sigma_delta *sd, ad_sigma_delta_postprocess_sample() argument
102 if (sd->info->postprocess_sample) ad_sigma_delta_postprocess_sample()
103 return sd->info->postprocess_sample(sd, raw_sample); ad_sigma_delta_postprocess_sample()
/linux-4.1.27/arch/powerpc/kernel/
H A Ddma-swiotlb.c69 struct dev_archdata *sd; pci_dma_dev_setup_swiotlb() local
72 sd = &pdev->dev.archdata; pci_dma_dev_setup_swiotlb()
73 sd->max_direct_dma_addr = pci_dma_dev_setup_swiotlb()
81 struct dev_archdata *sd; ppc_swiotlb_bus_notify() local
87 sd = &dev->archdata; ppc_swiotlb_bus_notify()
88 sd->max_direct_dma_addr = 0; ppc_swiotlb_bus_notify()
/linux-4.1.27/drivers/media/i2c/s5c73m3/
H A Ds5c73m3-core.c349 static int s5c73m3_load_fw(struct v4l2_subdev *sd) s5c73m3_load_fw() argument
351 struct s5c73m3 *state = sensor_sd_to_s5c73m3(sd); s5c73m3_load_fw()
361 v4l2_err(sd, "Firmware request failed (%s)\n", fw_name); s5c73m3_load_fw()
365 v4l2_info(sd, "Loading firmware (%s, %zu B)\n", fw_name, fw->size); s5c73m3_load_fw()
372 v4l2_err(sd, "SPI write failed\n"); s5c73m3_load_fw()
420 static int __s5c73m3_s_stream(struct s5c73m3 *state, struct v4l2_subdev *sd, __s5c73m3_s_stream() argument
452 v4l2_err(sd, "Error setting frame rate(%d)\n", ret); __s5c73m3_s_stream()
458 static int s5c73m3_oif_s_stream(struct v4l2_subdev *sd, int on) s5c73m3_oif_s_stream() argument
460 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); s5c73m3_oif_s_stream()
464 ret = __s5c73m3_s_stream(state, sd, on); s5c73m3_oif_s_stream()
488 struct v4l2_subdev *sd = &state->sensor_sd; s5c73m3_read_fw_version() local
521 v4l2_info(sd, "Sensor type: %s, FW version: %s\n", s5c73m3_read_fw_version()
528 struct v4l2_subdev *sd = &state->sensor_sd; s5c73m3_fw_update_from() local
533 v4l2_warn(sd, "Updating F-ROM firmware.\n"); s5c73m3_fw_update_from()
546 v4l2_warn(sd, "Updating F-ROM firmware failed.\n"); s5c73m3_fw_update_from()
549 v4l2_warn(sd, "Updating F-ROM firmware finished.\n"); s5c73m3_fw_update_from()
556 v4l2_warn(sd, "Updating F-ROM firmware timed-out.\n"); s5c73m3_fw_update_from()
562 struct v4l2_subdev *sd = &state->sensor_sd; s5c73m3_spi_boot() local
575 v4l2_err(sd, "booting failed: %d\n", ret); s5c73m3_spi_boot()
593 v4l2_err(sd, "SPI not ready: %d\n", ret); s5c73m3_spi_boot()
597 s5c73m3_load_fw(sd); s5c73m3_spi_boot()
667 struct v4l2_subdev *sd = &state->sensor_sd; s5c73m3_get_fw_version() local
680 v4l2_err(sd, "%s: booting failed: %d\n", __func__, ret); s5c73m3_get_fw_version()
704 v4l2_err(sd, "SPI not ready: %d\n", ret); s5c73m3_get_fw_version()
737 struct v4l2_subdev *sd = &state->sensor_sd; s5c73m3_rom_boot() local
749 v4l2_err(sd, "Booting failed: %d\n", ret); s5c73m3_rom_boot()
763 v4l2_err(sd, "Binary read failed: %d\n", ret); s5c73m3_rom_boot()
831 struct v4l2_subdev *sd = &state->sensor_sd; s5c73m3_oif_try_format() local
854 v4l2_subdev_get_try_format(sd, cfg, s5c73m3_oif_try_format()
881 static int s5c73m3_oif_g_frame_interval(struct v4l2_subdev *sd, s5c73m3_oif_g_frame_interval() argument
884 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); s5c73m3_oif_g_frame_interval()
930 static int s5c73m3_oif_s_frame_interval(struct v4l2_subdev *sd, s5c73m3_oif_s_frame_interval() argument
933 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); s5c73m3_oif_s_frame_interval()
939 v4l2_dbg(1, s5c73m3_dbg, sd, "Setting %d/%d frame interval\n", s5c73m3_oif_s_frame_interval()
955 static int s5c73m3_oif_enum_frame_interval(struct v4l2_subdev *sd, s5c73m3_oif_enum_frame_interval() argument
959 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); s5c73m3_oif_enum_frame_interval()
993 static int s5c73m3_get_fmt(struct v4l2_subdev *sd, s5c73m3_get_fmt() argument
997 struct s5c73m3 *state = sensor_sd_to_s5c73m3(sd); s5c73m3_get_fmt()
1002 fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); s5c73m3_get_fmt()
1027 static int s5c73m3_oif_get_fmt(struct v4l2_subdev *sd, s5c73m3_oif_get_fmt() argument
1031 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); s5c73m3_oif_get_fmt()
1036 fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); s5c73m3_oif_get_fmt()
1065 static int s5c73m3_set_fmt(struct v4l2_subdev *sd, s5c73m3_set_fmt() argument
1070 struct s5c73m3 *state = sensor_sd_to_s5c73m3(sd); s5c73m3_set_fmt()
1079 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); s5c73m3_set_fmt()
1104 static int s5c73m3_oif_set_fmt(struct v4l2_subdev *sd, s5c73m3_oif_set_fmt() argument
1109 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); s5c73m3_oif_set_fmt()
1118 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); s5c73m3_oif_set_fmt()
1121 mf = v4l2_subdev_get_try_format(sd, cfg, OIF_SOURCE_PAD); s5c73m3_oif_set_fmt()
1151 static int s5c73m3_oif_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, s5c73m3_oif_get_frame_desc() argument
1154 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); s5c73m3_oif_get_frame_desc()
1169 static int s5c73m3_oif_set_frame_desc(struct v4l2_subdev *sd, unsigned int pad, s5c73m3_oif_set_frame_desc() argument
1172 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); s5c73m3_oif_set_frame_desc()
1192 static int s5c73m3_enum_mbus_code(struct v4l2_subdev *sd, s5c73m3_enum_mbus_code() argument
1208 static int s5c73m3_oif_enum_mbus_code(struct v4l2_subdev *sd, s5c73m3_oif_enum_mbus_code() argument
1223 static int s5c73m3_enum_frame_size(struct v4l2_subdev *sd, s5c73m3_enum_frame_size() argument
1250 static int s5c73m3_oif_enum_frame_size(struct v4l2_subdev *sd, s5c73m3_oif_enum_frame_size() argument
1254 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); s5c73m3_oif_enum_frame_size()
1269 mf = v4l2_subdev_get_try_format(sd, cfg, s5c73m3_oif_enum_frame_size()
1309 static int s5c73m3_oif_log_status(struct v4l2_subdev *sd) s5c73m3_oif_log_status() argument
1311 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); s5c73m3_oif_log_status()
1313 v4l2_ctrl_handler_log_status(sd->ctrl_handler, sd->name); s5c73m3_oif_log_status()
1315 v4l2_info(sd, "power: %d, apply_fmt: %d\n", state->power, s5c73m3_oif_log_status()
1321 static int s5c73m3_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) s5c73m3_open() argument
1325 mf = v4l2_subdev_get_try_format(sd, fh->pad, S5C73M3_ISP_PAD); s5c73m3_open()
1329 mf = v4l2_subdev_get_try_format(sd, fh->pad, S5C73M3_JPEG_PAD); s5c73m3_open()
1336 static int s5c73m3_oif_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) s5c73m3_oif_open() argument
1340 mf = v4l2_subdev_get_try_format(sd, fh->pad, OIF_ISP_PAD); s5c73m3_oif_open()
1344 mf = v4l2_subdev_get_try_format(sd, fh->pad, OIF_JPEG_PAD); s5c73m3_oif_open()
1348 mf = v4l2_subdev_get_try_format(sd, fh->pad, OIF_SOURCE_PAD); s5c73m3_oif_open()
1441 static int s5c73m3_oif_set_power(struct v4l2_subdev *sd, int on) s5c73m3_oif_set_power() argument
1443 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); s5c73m3_oif_set_power()
1461 v4l2_err(sd, "Soft landing lens failed\n"); s5c73m3_oif_set_power()
1466 v4l2_dbg(1, s5c73m3_dbg, sd, "%s: power: %d\n", s5c73m3_oif_set_power()
1473 static int s5c73m3_oif_registered(struct v4l2_subdev *sd) s5c73m3_oif_registered() argument
1475 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); s5c73m3_oif_registered()
1478 ret = v4l2_device_register_subdev(sd->v4l2_dev, &state->sensor_sd); s5c73m3_oif_registered()
1480 v4l2_err(sd->v4l2_dev, "Failed to register %s\n", s5c73m3_oif_registered()
1496 static void s5c73m3_oif_unregistered(struct v4l2_subdev *sd) s5c73m3_oif_unregistered() argument
1498 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); s5c73m3_oif_unregistered()
1663 struct v4l2_subdev *sd; s5c73m3_probe() local
1678 sd = &state->sensor_sd; s5c73m3_probe()
1681 v4l2_subdev_init(sd, &s5c73m3_subdev_ops); s5c73m3_probe()
1682 sd->owner = client->dev.driver->owner; s5c73m3_probe()
1683 v4l2_set_subdevdata(sd, state); s5c73m3_probe()
1684 strlcpy(sd->name, "S5C73M3", sizeof(sd->name)); s5c73m3_probe()
1686 sd->internal_ops = &s5c73m3_internal_ops; s5c73m3_probe()
1687 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; s5c73m3_probe()
1691 sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV; s5c73m3_probe()
1693 ret = media_entity_init(&sd->entity, S5C73M3_NUM_PADS, s5c73m3_probe()
1766 v4l2_info(sd, "%s: completed successfully\n", __func__); s5c73m3_probe()
1772 media_entity_cleanup(&sd->entity); s5c73m3_probe()
/linux-4.1.27/drivers/media/usb/go7007/
H A Ds2250-board.c120 struct v4l2_subdev sd; member in struct:s2250
133 static inline struct s2250 *to_state(struct v4l2_subdev *sd) to_state() argument
135 return container_of(sd, struct s2250, sd); to_state()
327 static int s2250_s_video_routing(struct v4l2_subdev *sd, u32 input, u32 output, s2250_s_video_routing() argument
330 struct s2250 *state = to_state(sd); s2250_s_video_routing()
331 struct i2c_client *client = v4l2_get_subdevdata(sd); s2250_s_video_routing()
352 static int s2250_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) s2250_s_std() argument
354 struct s2250 *state = to_state(sd); s2250_s_std()
355 struct i2c_client *client = v4l2_get_subdevdata(sd); s2250_s_std()
374 struct i2c_client *client = v4l2_get_subdevdata(&state->sd); s2250_s_ctrl()
408 static int s2250_s_mbus_fmt(struct v4l2_subdev *sd, s2250_s_mbus_fmt() argument
411 struct s2250 *state = to_state(sd); s2250_s_mbus_fmt()
412 struct i2c_client *client = v4l2_get_subdevdata(sd); s2250_s_mbus_fmt()
424 static int s2250_s_audio_routing(struct v4l2_subdev *sd, u32 input, u32 output, s2250_s_audio_routing() argument
427 struct s2250 *state = to_state(sd); s2250_s_audio_routing()
447 static int s2250_log_status(struct v4l2_subdev *sd) s2250_log_status() argument
449 struct s2250 *state = to_state(sd); s2250_log_status()
451 v4l2_info(sd, "Standard: %s\n", state->std == V4L2_STD_NTSC ? "NTSC" : s2250_log_status()
455 v4l2_info(sd, "Input: %s\n", state->input == 0 ? "Composite" : s2250_log_status()
458 v4l2_info(sd, "Audio input: %s\n", state->audio_input == 0 ? "Line In" : s2250_log_status()
462 return v4l2_ctrl_subdev_log_status(sd); s2250_log_status()
499 struct v4l2_subdev *sd; s2250_probe() local
514 sd = &state->sd; s2250_probe()
515 v4l2_i2c_subdev_init(sd, client, &s2250_ops); s2250_probe()
517 v4l2_info(sd, "initializing %s at address 0x%x on %s\n", s2250_probe()
529 sd->ctrl_handler = &state->hdl; s2250_probe()
592 v4l2_info(sd, "initialized successfully\n"); s2250_probe()
606 v4l2_device_unregister_subdev(&state->sd); s2250_remove()
/linux-4.1.27/drivers/staging/media/omap4iss/
H A Diss_ipipe.c127 * @sd: ISP IPIPE V4L2 subdevice
130 static int ipipe_set_stream(struct v4l2_subdev *sd, int enable) ipipe_set_stream() argument
132 struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd); ipipe_set_stream()
165 if (omap4iss_module_sync_idle(&sd->entity, &ipipe->wait, ipipe_set_stream()
238 * @sd : pointer to v4l2 subdev structure
243 static int ipipe_enum_mbus_code(struct v4l2_subdev *sd, ipipe_enum_mbus_code() argument
270 static int ipipe_enum_frame_size(struct v4l2_subdev *sd, ipipe_enum_frame_size() argument
274 struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd); ipipe_enum_frame_size()
302 * @sd : ISP IPIPE V4L2 subdevice
309 static int ipipe_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, ipipe_get_format() argument
312 struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd); ipipe_get_format()
325 * @sd : ISP IPIPE V4L2 subdevice
332 static int ipipe_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, ipipe_set_format() argument
335 struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd); ipipe_set_format()
357 static int ipipe_link_validate(struct v4l2_subdev *sd, struct media_link *link, ipipe_link_validate() argument
374 * @sd: ISP IPIPE V4L2 subdevice
381 static int ipipe_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) ipipe_init_formats() argument
391 ipipe_set_format(sd, fh ? fh->pad : NULL, &format); ipipe_init_formats()
438 struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); ipipe_link_setup() local
439 struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd); ipipe_link_setup()
490 struct v4l2_subdev *sd = &ipipe->subdev; ipipe_init_entities() local
492 struct media_entity *me = &sd->entity; ipipe_init_entities()
497 v4l2_subdev_init(sd, &ipipe_v4l2_ops); ipipe_init_entities()
498 sd->internal_ops = &ipipe_v4l2_internal_ops; ipipe_init_entities()
499 strlcpy(sd->name, "OMAP4 ISS ISP IPIPE", sizeof(sd->name)); ipipe_init_entities()
500 sd->grp_id = 1 << 16; /* group ID for iss subdevs */ ipipe_init_entities()
501 v4l2_set_subdevdata(sd, ipipe); ipipe_init_entities()
502 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; ipipe_init_entities()
512 ipipe_init_formats(sd, NULL); ipipe_init_entities()
H A Diss_ipipeif.c303 * @sd: ISP IPIPEIF V4L2 subdevice
306 static int ipipeif_set_stream(struct v4l2_subdev *sd, int enable) ipipeif_set_stream() argument
308 struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ipipeif_set_stream()
346 if (omap4iss_module_sync_idle(&sd->entity, &ipipeif->wait, ipipeif_set_stream()
443 * @sd : pointer to v4l2 subdev structure
448 static int ipipeif_enum_mbus_code(struct v4l2_subdev *sd, ipipeif_enum_mbus_code() argument
452 struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ipipeif_enum_mbus_code()
482 static int ipipeif_enum_frame_size(struct v4l2_subdev *sd, ipipeif_enum_frame_size() argument
486 struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ipipeif_enum_frame_size()
514 * @sd : ISP IPIPEIF V4L2 subdevice
521 static int ipipeif_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, ipipeif_get_format() argument
524 struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ipipeif_get_format()
537 * @sd : ISP IPIPEIF V4L2 subdevice
544 static int ipipeif_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, ipipeif_set_format() argument
547 struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ipipeif_set_format()
577 static int ipipeif_link_validate(struct v4l2_subdev *sd, ipipeif_link_validate() argument
595 * @sd: ISP IPIPEIF V4L2 subdevice
602 static int ipipeif_init_formats(struct v4l2_subdev *sd, ipipeif_init_formats() argument
613 ipipeif_set_format(sd, fh ? fh->pad : NULL, &format); ipipeif_init_formats()
660 struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); ipipeif_link_setup() local
661 struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ipipeif_link_setup()
725 struct v4l2_subdev *sd = &ipipeif->subdev; ipipeif_init_entities() local
727 struct media_entity *me = &sd->entity; ipipeif_init_entities()
732 v4l2_subdev_init(sd, &ipipeif_v4l2_ops); ipipeif_init_entities()
733 sd->internal_ops = &ipipeif_v4l2_internal_ops; ipipeif_init_entities()
734 strlcpy(sd->name, "OMAP4 ISS ISP IPIPEIF", sizeof(sd->name)); ipipeif_init_entities()
735 sd->grp_id = 1 << 16; /* group ID for iss subdevs */ ipipeif_init_entities()
736 v4l2_set_subdevdata(sd, ipipeif); ipipeif_init_entities()
737 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; ipipeif_init_entities()
748 ipipeif_init_formats(sd, NULL); ipipeif_init_entities()
H A Diss_resizer.c351 * @sd: ISP RESIZER V4L2 subdevice
354 static int resizer_set_stream(struct v4l2_subdev *sd, int enable) resizer_set_stream() argument
356 struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd); resizer_set_stream()
401 if (omap4iss_module_sync_idle(&sd->entity, &resizer->wait, resizer_set_stream()
494 * @sd : pointer to v4l2 subdev structure
499 static int resizer_enum_mbus_code(struct v4l2_subdev *sd, resizer_enum_mbus_code() argument
503 struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd); resizer_enum_mbus_code()
544 static int resizer_enum_frame_size(struct v4l2_subdev *sd, resizer_enum_frame_size() argument
548 struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd); resizer_enum_frame_size()
576 * @sd : ISP RESIZER V4L2 subdevice
583 static int resizer_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, resizer_get_format() argument
586 struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd); resizer_get_format()
599 * @sd : ISP RESIZER V4L2 subdevice
606 static int resizer_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, resizer_set_format() argument
609 struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd); resizer_set_format()
632 static int resizer_link_validate(struct v4l2_subdev *sd, resizer_link_validate() argument
650 * @sd: ISP RESIZER V4L2 subdevice
657 static int resizer_init_formats(struct v4l2_subdev *sd, resizer_init_formats() argument
668 resizer_set_format(sd, fh ? fh->pad : NULL, &format); resizer_init_formats()
715 struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); resizer_link_setup() local
716 struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd); resizer_link_setup()
770 struct v4l2_subdev *sd = &resizer->subdev; resizer_init_entities() local
772 struct media_entity *me = &sd->entity; resizer_init_entities()
777 v4l2_subdev_init(sd, &resizer_v4l2_ops); resizer_init_entities()
778 sd->internal_ops = &resizer_v4l2_internal_ops; resizer_init_entities()
779 strlcpy(sd->name, "OMAP4 ISS ISP resizer", sizeof(sd->name)); resizer_init_entities()
780 sd->grp_id = 1 << 16; /* group ID for iss subdevs */ resizer_init_entities()
781 v4l2_set_subdevdata(sd, resizer); resizer_init_entities()
782 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; resizer_init_entities()
792 resizer_init_formats(sd, NULL); resizer_init_entities()
/linux-4.1.27/drivers/media/tuners/
H A Dmsi001.c41 struct v4l2_subdev sd; member in struct:msi001
54 static inline struct msi001 *sd_to_msi001(struct v4l2_subdev *sd) sd_to_msi001() argument
56 return container_of(sd, struct msi001, sd); sd_to_msi001()
281 static int msi001_s_power(struct v4l2_subdev *sd, int on) msi001_s_power() argument
283 struct msi001 *s = sd_to_msi001(sd); msi001_s_power()
300 static int msi001_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *v) msi001_g_tuner() argument
302 struct msi001 *s = sd_to_msi001(sd); msi001_g_tuner()
315 static int msi001_s_tuner(struct v4l2_subdev *sd, const struct v4l2_tuner *v) msi001_s_tuner() argument
317 struct msi001 *s = sd_to_msi001(sd); msi001_s_tuner()
323 static int msi001_g_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f) msi001_g_frequency() argument
325 struct msi001 *s = sd_to_msi001(sd); msi001_g_frequency()
332 static int msi001_s_frequency(struct v4l2_subdev *sd, msi001_s_frequency() argument
335 struct msi001 *s = sd_to_msi001(sd); msi001_s_frequency()
351 static int msi001_enum_freq_bands(struct v4l2_subdev *sd, msi001_enum_freq_bands() argument
354 struct msi001 *s = sd_to_msi001(sd); msi001_enum_freq_bands()
438 v4l2_spi_subdev_init(&s->sd, spi, &msi001_ops); msi001_probe()
460 s->sd.ctrl_handler = &s->hdl; msi001_probe()
472 struct v4l2_subdev *sd = spi_get_drvdata(spi); msi001_remove() local
473 struct msi001 *s = sd_to_msi001(sd); msi001_remove()
481 v4l2_device_unregister_subdev(&s->sd); msi001_remove()
/linux-4.1.27/drivers/media/pci/ivtv/
H A Divtv-gpio.c148 static inline struct ivtv *sd_to_ivtv(struct v4l2_subdev *sd) sd_to_ivtv() argument
150 return container_of(sd, struct ivtv, sd_gpio); sd_to_ivtv()
158 static int subdev_s_clock_freq(struct v4l2_subdev *sd, u32 freq) subdev_s_clock_freq() argument
160 struct ivtv *itv = sd_to_ivtv(sd); subdev_s_clock_freq()
181 static int subdev_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) subdev_g_tuner() argument
183 struct ivtv *itv = sd_to_ivtv(sd); subdev_g_tuner()
195 static int subdev_s_tuner(struct v4l2_subdev *sd, const struct v4l2_tuner *vt) subdev_s_tuner() argument
197 struct ivtv *itv = sd_to_ivtv(sd); subdev_s_tuner()
222 static int subdev_s_radio(struct v4l2_subdev *sd) subdev_s_radio() argument
224 struct ivtv *itv = sd_to_ivtv(sd); subdev_s_radio()
234 static int subdev_s_audio_routing(struct v4l2_subdev *sd, subdev_s_audio_routing() argument
237 struct ivtv *itv = sd_to_ivtv(sd); subdev_s_audio_routing()
262 struct v4l2_subdev *sd = to_sd(ctrl); subdev_s_ctrl() local
263 struct ivtv *itv = sd_to_ivtv(sd); subdev_s_ctrl()
279 static int subdev_log_status(struct v4l2_subdev *sd) subdev_log_status() argument
281 struct ivtv *itv = sd_to_ivtv(sd); subdev_log_status()
286 v4l2_ctrl_handler_log_status(&itv->hdl_gpio, sd->name); subdev_log_status()
290 static int subdev_s_video_routing(struct v4l2_subdev *sd, subdev_s_video_routing() argument
293 struct ivtv *itv = sd_to_ivtv(sd); subdev_s_video_routing()
/linux-4.1.27/fs/
H A Dsplice.c704 * Send 'sd->len' bytes to socket from 'sd->file' at position 'sd->pos'
708 struct pipe_buffer *buf, struct splice_desc *sd) pipe_to_sendpage()
710 struct file *file = sd->u.file; pipe_to_sendpage()
711 loff_t pos = sd->pos; pipe_to_sendpage()
717 more = (sd->flags & SPLICE_F_MORE) ? MSG_MORE : 0; pipe_to_sendpage()
719 if (sd->len < sd->total_len && pipe->nrbufs > 1) pipe_to_sendpage()
723 sd->len, &pos, more); pipe_to_sendpage()
737 * @sd: information to @actor
744 * the pipe or if the requested number of bytes (@sd->total_len)
754 static int splice_from_pipe_feed(struct pipe_inode_info *pipe, struct splice_desc *sd, splice_from_pipe_feed() argument
763 sd->len = buf->len; splice_from_pipe_feed()
764 if (sd->len > sd->total_len) splice_from_pipe_feed()
765 sd->len = sd->total_len; splice_from_pipe_feed()
774 ret = actor(pipe, buf, sd); splice_from_pipe_feed()
781 sd->num_spliced += ret; splice_from_pipe_feed()
782 sd->len -= ret; splice_from_pipe_feed()
783 sd->pos += ret; splice_from_pipe_feed()
784 sd->total_len -= ret; splice_from_pipe_feed()
792 sd->need_wakeup = true; splice_from_pipe_feed()
795 if (!sd->total_len) splice_from_pipe_feed()
805 * @sd: information about the splice operation
812 static int splice_from_pipe_next(struct pipe_inode_info *pipe, struct splice_desc *sd) splice_from_pipe_next() argument
818 if (!pipe->waiting_writers && sd->num_spliced) splice_from_pipe_next()
821 if (sd->flags & SPLICE_F_NONBLOCK) splice_from_pipe_next()
827 if (sd->need_wakeup) { splice_from_pipe_next()
829 sd->need_wakeup = false; splice_from_pipe_next()
840 * @sd: information about the splice operation
845 * initialize the necessary fields of @sd.
847 static void splice_from_pipe_begin(struct splice_desc *sd) splice_from_pipe_begin() argument
849 sd->num_spliced = 0; splice_from_pipe_begin()
850 sd->need_wakeup = false; splice_from_pipe_begin()
856 * @sd: information about the splice operation
863 static void splice_from_pipe_end(struct pipe_inode_info *pipe, struct splice_desc *sd) splice_from_pipe_end() argument
865 if (sd->need_wakeup) splice_from_pipe_end()
872 * @sd: information to @actor
882 ssize_t __splice_from_pipe(struct pipe_inode_info *pipe, struct splice_desc *sd, __splice_from_pipe() argument
887 splice_from_pipe_begin(sd); __splice_from_pipe()
889 ret = splice_from_pipe_next(pipe, sd); __splice_from_pipe()
891 ret = splice_from_pipe_feed(pipe, sd, actor); __splice_from_pipe()
893 splice_from_pipe_end(pipe, sd); __splice_from_pipe()
895 return sd->num_spliced ? sd->num_spliced : ret; __splice_from_pipe()
918 struct splice_desc sd = { splice_from_pipe() local
926 ret = __splice_from_pipe(pipe, &sd, actor); splice_from_pipe()
950 struct splice_desc sd = { iter_file_splice_write() local
966 splice_from_pipe_begin(&sd); iter_file_splice_write()
967 while (sd.total_len) { iter_file_splice_write()
972 ret = splice_from_pipe_next(pipe, &sd); iter_file_splice_write()
988 left = sd.total_len; iter_file_splice_write()
1013 sd.total_len - left); iter_file_splice_write()
1014 ret = vfs_iter_write(out, &from, &sd.pos); iter_file_splice_write()
1018 sd.num_spliced += ret; iter_file_splice_write()
1019 sd.total_len -= ret; iter_file_splice_write()
1020 *ppos = sd.pos; iter_file_splice_write()
1034 sd.need_wakeup = true; iter_file_splice_write()
1044 splice_from_pipe_end(pipe, &sd); iter_file_splice_write()
1048 if (sd.num_spliced) iter_file_splice_write()
1049 ret = sd.num_spliced; iter_file_splice_write()
1057 struct splice_desc *sd) write_pipe_buf()
1061 loff_t tmp = sd->pos; write_pipe_buf()
1064 ret = __kernel_write(sd->u.file, data + buf->offset, sd->len, &tmp); write_pipe_buf()
1150 * @sd: actor information on where to splice to
1160 ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd, splice_direct_to_actor() argument
1203 len = sd->total_len; splice_direct_to_actor()
1204 flags = sd->flags; splice_direct_to_actor()
1209 sd->flags &= ~SPLICE_F_NONBLOCK; splice_direct_to_actor()
1210 more = sd->flags & SPLICE_F_MORE; splice_direct_to_actor()
1214 loff_t pos = sd->pos, prev_pos = pos; splice_direct_to_actor()
1221 sd->total_len = read_len; splice_direct_to_actor()
1229 sd->flags |= SPLICE_F_MORE; splice_direct_to_actor()
1231 sd->flags &= ~SPLICE_F_MORE; splice_direct_to_actor()
1237 ret = actor(pipe, sd); splice_direct_to_actor()
1239 sd->pos = prev_pos; splice_direct_to_actor()
1245 sd->pos = pos; splice_direct_to_actor()
1248 sd->pos = prev_pos + ret; splice_direct_to_actor()
1280 struct splice_desc *sd) direct_splice_actor()
1282 struct file *file = sd->u.file; direct_splice_actor()
1284 return do_splice_from(pipe, file, sd->opos, sd->total_len, direct_splice_actor()
1285 sd->flags); direct_splice_actor()
1307 struct splice_desc sd = { do_splice_direct() local
1327 ret = splice_direct_to_actor(in, &sd, direct_splice_actor); do_splice_direct()
1329 *ppos = sd.pos; do_splice_direct()
1533 struct splice_desc *sd) pipe_to_user()
1535 int n = copy_page_to_iter(buf->page, buf->offset, sd->len, sd->u.data); pipe_to_user()
1536 return n == sd->len ? n : -EFAULT; pipe_to_user()
1547 struct splice_desc sd; vmsplice_to_user() local
1562 sd.total_len = iov_iter_count(&iter); vmsplice_to_user()
1563 sd.len = 0; vmsplice_to_user()
1564 sd.flags = flags; vmsplice_to_user()
1565 sd.u.data = &iter; vmsplice_to_user()
1566 sd.pos = 0; vmsplice_to_user()
1568 if (sd.total_len) { vmsplice_to_user()
1570 ret = __splice_from_pipe(pipe, &sd, pipe_to_user); vmsplice_to_user()
707 pipe_to_sendpage(struct pipe_inode_info *pipe, struct pipe_buffer *buf, struct splice_desc *sd) pipe_to_sendpage() argument
1056 write_pipe_buf(struct pipe_inode_info *pipe, struct pipe_buffer *buf, struct splice_desc *sd) write_pipe_buf() argument
1279 direct_splice_actor(struct pipe_inode_info *pipe, struct splice_desc *sd) direct_splice_actor() argument
1532 pipe_to_user(struct pipe_inode_info *pipe, struct pipe_buffer *buf, struct splice_desc *sd) pipe_to_user() argument
/linux-4.1.27/drivers/block/
H A Dcciss_scsi.c383 struct cciss_scsi_dev_t *sd; cciss_scsi_add_entry() local
405 sd = &ccissscsi[h->ctlr].dev[i]; cciss_scsi_add_entry()
406 memcpy(addr2, sd->scsi3addr, 8); cciss_scsi_add_entry()
410 bus = sd->bus; cciss_scsi_add_entry()
411 target = sd->target; cciss_scsi_add_entry()
418 sd = &ccissscsi[h->ctlr].dev[n]; cciss_scsi_add_entry()
421 &sd->bus, &sd->target, &sd->lun) != 0) cciss_scsi_add_entry()
424 sd->bus = bus; cciss_scsi_add_entry()
425 sd->target = target; cciss_scsi_add_entry()
426 sd->lun = lun; cciss_scsi_add_entry()
428 added[*nadded].bus = sd->bus; cciss_scsi_add_entry()
429 added[*nadded].target = sd->target; cciss_scsi_add_entry()
430 added[*nadded].lun = sd->lun; cciss_scsi_add_entry()
433 memcpy(sd->scsi3addr, device->scsi3addr, 8); cciss_scsi_add_entry()
434 memcpy(sd->vendor, device->vendor, sizeof(sd->vendor)); cciss_scsi_add_entry()
435 memcpy(sd->revision, device->revision, sizeof(sd->revision)); cciss_scsi_add_entry()
436 memcpy(sd->device_id, device->device_id, sizeof(sd->device_id)); cciss_scsi_add_entry()
437 sd->devtype = device->devtype; cciss_scsi_add_entry()
446 scsi_device_type(sd->devtype), hostno, cciss_scsi_add_entry()
447 sd->bus, sd->target, sd->lun); cciss_scsi_add_entry()
457 struct cciss_scsi_dev_t sd; cciss_scsi_remove_entry() local
460 sd = ccissscsi[h->ctlr].dev[entry]; cciss_scsi_remove_entry()
461 removed[*nremoved].bus = sd.bus; cciss_scsi_remove_entry()
462 removed[*nremoved].target = sd.target; cciss_scsi_remove_entry()
463 removed[*nremoved].lun = sd.lun; cciss_scsi_remove_entry()
469 scsi_device_type(sd.devtype), hostno, cciss_scsi_remove_entry()
470 sd.bus, sd.target, sd.lun); cciss_scsi_remove_entry()
522 struct cciss_scsi_dev_t sd[], int nsds) adjust_cciss_scsi_table()
524 /* sd contains scsi3 addresses and devtypes, but adjust_cciss_scsi_table()
526 takes what's in sd to be the current and adjusts adjust_cciss_scsi_table()
527 ccissscsi[] to be in line with what's in sd. */ adjust_cciss_scsi_table()
553 sd[] and remove them from ccissscsi[] */ adjust_cciss_scsi_table()
562 if (SCSI3ADDR_EQ(sd[j].scsi3addr, adjust_cciss_scsi_table()
564 if (device_is_the_same(&sd[j], csd)) adjust_cciss_scsi_table()
585 if (cciss_scsi_add_entry(h, hostno, &sd[j], adjust_cciss_scsi_table()
589 csd->devtype = sd[j].devtype; adjust_cciss_scsi_table()
590 memcpy(csd->device_id, sd[j].device_id, adjust_cciss_scsi_table()
592 memcpy(csd->vendor, sd[j].vendor, adjust_cciss_scsi_table()
594 memcpy(csd->model, sd[j].model, adjust_cciss_scsi_table()
596 memcpy(csd->revision, sd[j].revision, adjust_cciss_scsi_table()
602 /* Now, make sure every device listed in sd[] is also adjust_cciss_scsi_table()
609 if (SCSI3ADDR_EQ(sd[i].scsi3addr, adjust_cciss_scsi_table()
611 if (device_is_the_same(&sd[i], csd)) adjust_cciss_scsi_table()
620 if (cciss_scsi_add_entry(h, hostno, &sd[i], adjust_cciss_scsi_table()
683 struct cciss_scsi_dev_t *sd; lookup_scsi3addr() local
688 sd = &ccissscsi[h->ctlr].dev[i]; lookup_scsi3addr()
689 if (sd->bus == bus && lookup_scsi3addr()
690 sd->target == target && lookup_scsi3addr()
691 sd->lun == lun) { lookup_scsi3addr()
692 memcpy(scsi3addr, &sd->scsi3addr[0], 8); lookup_scsi3addr()
1339 struct cciss_scsi_dev_t *sd = cciss_scsi_show_info() local
1343 sh->host_no, sd->bus, sd->target, sd->lun, cciss_scsi_show_info()
1344 sd->devtype, cciss_scsi_show_info()
1345 sd->scsi3addr[0], sd->scsi3addr[1], cciss_scsi_show_info()
1346 sd->scsi3addr[2], sd->scsi3addr[3], cciss_scsi_show_info()
1347 sd->scsi3addr[4], sd->scsi3addr[5], cciss_scsi_show_info()
1348 sd->scsi3addr[6], sd->scsi3addr[7]); cciss_scsi_show_info()
521 adjust_cciss_scsi_table(ctlr_info_t *h, int hostno, struct cciss_scsi_dev_t sd[], int nsds) adjust_cciss_scsi_table() argument
/linux-4.1.27/drivers/media/i2c/soc_camera/
H A Dov9640.c37 #define to_ov9640_sensor(sd) container_of(sd, struct ov9640_priv, subdev)
264 static int ov9640_s_stream(struct v4l2_subdev *sd, int enable) ov9640_s_stream() argument
291 static int ov9640_get_register(struct v4l2_subdev *sd, ov9640_get_register() argument
294 struct i2c_client *client = v4l2_get_subdevdata(sd); ov9640_get_register()
312 static int ov9640_set_register(struct v4l2_subdev *sd, ov9640_set_register() argument
315 struct i2c_client *client = v4l2_get_subdevdata(sd); ov9640_set_register()
324 static int ov9640_s_power(struct v4l2_subdev *sd, int on) ov9640_s_power() argument
326 struct i2c_client *client = v4l2_get_subdevdata(sd); ov9640_s_power()
328 struct ov9640_priv *priv = to_ov9640_sensor(sd); ov9640_s_power()
484 static int ov9640_s_fmt(struct v4l2_subdev *sd, ov9640_s_fmt() argument
487 struct i2c_client *client = v4l2_get_subdevdata(sd); ov9640_s_fmt()
522 static int ov9640_try_fmt(struct v4l2_subdev *sd, ov9640_try_fmt() argument
543 static int ov9640_enum_fmt(struct v4l2_subdev *sd, unsigned int index, ov9640_enum_fmt() argument
553 static int ov9640_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) ov9640_g_crop() argument
564 static int ov9640_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) ov9640_cropcap() argument
580 struct v4l2_subdev *sd = i2c_get_clientdata(client); ov9640_video_probe() local
581 struct ov9640_priv *priv = to_ov9640_sensor(sd); ov9640_video_probe()
642 static int ov9640_g_mbus_config(struct v4l2_subdev *sd, ov9640_g_mbus_config() argument
645 struct i2c_client *client = v4l2_get_subdevdata(sd); ov9640_g_mbus_config()
723 struct v4l2_subdev *sd = i2c_get_clientdata(client); ov9640_remove() local
724 struct ov9640_priv *priv = to_ov9640_sensor(sd); ov9640_remove()
H A Dimx074.c156 static int imx074_try_fmt(struct v4l2_subdev *sd, imx074_try_fmt() argument
161 dev_dbg(sd->v4l2_dev->dev, "%s(%u)\n", __func__, mf->code); imx074_try_fmt()
175 static int imx074_s_fmt(struct v4l2_subdev *sd, imx074_s_fmt() argument
178 struct i2c_client *client = v4l2_get_subdevdata(sd); imx074_s_fmt()
181 dev_dbg(sd->v4l2_dev->dev, "%s(%u)\n", __func__, mf->code); imx074_s_fmt()
187 imx074_try_fmt(sd, mf); imx074_s_fmt()
194 static int imx074_g_fmt(struct v4l2_subdev *sd, imx074_g_fmt() argument
197 struct i2c_client *client = v4l2_get_subdevdata(sd); imx074_g_fmt()
211 static int imx074_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) imx074_g_crop() argument
224 static int imx074_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) imx074_cropcap() argument
238 static int imx074_enum_fmt(struct v4l2_subdev *sd, unsigned int index, imx074_enum_fmt() argument
248 static int imx074_s_stream(struct v4l2_subdev *sd, int enable) imx074_s_stream() argument
250 struct i2c_client *client = v4l2_get_subdevdata(sd); imx074_s_stream()
256 static int imx074_s_power(struct v4l2_subdev *sd, int on) imx074_s_power() argument
258 struct i2c_client *client = v4l2_get_subdevdata(sd); imx074_s_power()
265 static int imx074_g_mbus_config(struct v4l2_subdev *sd, imx074_g_mbus_config() argument
H A Dmt9m001.c164 static int mt9m001_s_stream(struct v4l2_subdev *sd, int enable) mt9m001_s_stream() argument
166 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9m001_s_stream()
174 static int mt9m001_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) mt9m001_s_crop() argument
176 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9m001_s_crop()
228 static int mt9m001_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) mt9m001_g_crop() argument
230 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9m001_g_crop()
239 static int mt9m001_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) mt9m001_cropcap() argument
253 static int mt9m001_g_fmt(struct v4l2_subdev *sd, mt9m001_g_fmt() argument
256 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9m001_g_fmt()
268 static int mt9m001_s_fmt(struct v4l2_subdev *sd, mt9m001_s_fmt() argument
271 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9m001_s_fmt()
284 ret = mt9m001_s_crop(sd, &a); mt9m001_s_fmt()
296 static int mt9m001_try_fmt(struct v4l2_subdev *sd, mt9m001_try_fmt() argument
299 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9m001_try_fmt()
324 static int mt9m001_g_register(struct v4l2_subdev *sd, mt9m001_g_register() argument
327 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9m001_g_register()
341 static int mt9m001_s_register(struct v4l2_subdev *sd, mt9m001_s_register() argument
344 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9m001_s_register()
356 static int mt9m001_s_power(struct v4l2_subdev *sd, int on) mt9m001_s_power() argument
358 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9m001_s_power()
386 struct v4l2_subdev *sd = &mt9m001->subdev; mt9m001_s_ctrl() local
387 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9m001_s_ctrl()
542 static int mt9m001_g_skip_top_lines(struct v4l2_subdev *sd, u32 *lines) mt9m001_g_skip_top_lines() argument
544 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9m001_g_skip_top_lines()
565 static int mt9m001_enum_fmt(struct v4l2_subdev *sd, unsigned int index, mt9m001_enum_fmt() argument
568 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9m001_enum_fmt()
578 static int mt9m001_g_mbus_config(struct v4l2_subdev *sd, mt9m001_g_mbus_config() argument
581 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9m001_g_mbus_config()
594 static int mt9m001_s_mbus_config(struct v4l2_subdev *sd, mt9m001_s_mbus_config() argument
597 const struct i2c_client *client = v4l2_get_subdevdata(sd); mt9m001_s_mbus_config()
H A Dtw9910.c459 static int tw9910_s_stream(struct v4l2_subdev *sd, int enable) tw9910_s_stream() argument
461 struct i2c_client *client = v4l2_get_subdevdata(sd); tw9910_s_stream()
499 static int tw9910_g_std(struct v4l2_subdev *sd, v4l2_std_id *norm) tw9910_g_std() argument
501 struct i2c_client *client = v4l2_get_subdevdata(sd); tw9910_g_std()
509 static int tw9910_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) tw9910_s_std() argument
511 struct i2c_client *client = v4l2_get_subdevdata(sd); tw9910_s_std()
523 static int tw9910_g_register(struct v4l2_subdev *sd, tw9910_g_register() argument
526 struct i2c_client *client = v4l2_get_subdevdata(sd); tw9910_g_register()
546 static int tw9910_s_register(struct v4l2_subdev *sd, tw9910_s_register() argument
549 struct i2c_client *client = v4l2_get_subdevdata(sd); tw9910_s_register()
559 static int tw9910_s_power(struct v4l2_subdev *sd, int on) tw9910_s_power() argument
561 struct i2c_client *client = v4l2_get_subdevdata(sd); tw9910_s_power()
568 static int tw9910_set_frame(struct v4l2_subdev *sd, u32 *width, u32 *height) tw9910_set_frame() argument
570 struct i2c_client *client = v4l2_get_subdevdata(sd); tw9910_set_frame()
653 static int tw9910_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) tw9910_g_crop() argument
655 struct i2c_client *client = v4l2_get_subdevdata(sd); tw9910_g_crop()
672 static int tw9910_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) tw9910_cropcap() argument
674 struct i2c_client *client = v4l2_get_subdevdata(sd); tw9910_cropcap()
694 static int tw9910_g_fmt(struct v4l2_subdev *sd, tw9910_g_fmt() argument
697 struct i2c_client *client = v4l2_get_subdevdata(sd); tw9910_g_fmt()
715 static int tw9910_s_fmt(struct v4l2_subdev *sd, tw9910_s_fmt() argument
732 ret = tw9910_set_frame(sd, &width, &height); tw9910_s_fmt()
740 static int tw9910_try_fmt(struct v4l2_subdev *sd, tw9910_try_fmt() argument
743 struct i2c_client *client = v4l2_get_subdevdata(sd); tw9910_try_fmt()
824 static int tw9910_enum_fmt(struct v4l2_subdev *sd, unsigned int index, tw9910_enum_fmt() argument
834 static int tw9910_g_mbus_config(struct v4l2_subdev *sd, tw9910_g_mbus_config() argument
837 struct i2c_client *client = v4l2_get_subdevdata(sd); tw9910_g_mbus_config()
850 static int tw9910_s_mbus_config(struct v4l2_subdev *sd, tw9910_s_mbus_config() argument
853 struct i2c_client *client = v4l2_get_subdevdata(sd); tw9910_s_mbus_config()
873 static int tw9910_g_tvnorms(struct v4l2_subdev *sd, v4l2_std_id *norm) tw9910_g_tvnorms() argument
H A Dmt9t031.c164 static int mt9t031_s_stream(struct v4l2_subdev *sd, int enable) mt9t031_s_stream() argument
166 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9t031_s_stream()
297 static int mt9t031_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) mt9t031_s_crop() argument
300 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9t031_s_crop()
315 static int mt9t031_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) mt9t031_g_crop() argument
317 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9t031_g_crop()
326 static int mt9t031_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) mt9t031_cropcap() argument
340 static int mt9t031_g_fmt(struct v4l2_subdev *sd, mt9t031_g_fmt() argument
343 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9t031_g_fmt()
355 static int mt9t031_s_fmt(struct v4l2_subdev *sd, mt9t031_s_fmt() argument
358 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9t031_s_fmt()
381 static int mt9t031_try_fmt(struct v4l2_subdev *sd, mt9t031_try_fmt() argument
395 static int mt9t031_g_register(struct v4l2_subdev *sd, mt9t031_g_register() argument
398 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9t031_g_register()
412 static int mt9t031_s_register(struct v4l2_subdev *sd, mt9t031_s_register() argument
415 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9t031_s_register()
450 struct v4l2_subdev *sd = &mt9t031->subdev; mt9t031_s_ctrl() local
451 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9t031_s_ctrl()
552 struct v4l2_subdev *sd = soc_camera_vdev_to_subdev(vdev); mt9t031_runtime_resume() local
553 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9t031_runtime_resume()
585 static int mt9t031_s_power(struct v4l2_subdev *sd, int on) mt9t031_s_power() argument
587 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9t031_s_power()
652 static int mt9t031_g_skip_top_lines(struct v4l2_subdev *sd, u32 *lines) mt9t031_g_skip_top_lines() argument
654 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9t031_g_skip_top_lines()
675 static int mt9t031_enum_fmt(struct v4l2_subdev *sd, unsigned int index, mt9t031_enum_fmt() argument
685 static int mt9t031_g_mbus_config(struct v4l2_subdev *sd, mt9t031_g_mbus_config() argument
688 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9t031_g_mbus_config()
700 static int mt9t031_s_mbus_config(struct v4l2_subdev *sd, mt9t031_s_mbus_config() argument
703 struct i2c_client *client = v4l2_get_subdevdata(sd); mt9t031_s_mbus_config()
H A Dov9740.c23 #define to_ov9740(sd) container_of(sd, struct ov9740_priv, subdev)
505 static int ov9740_s_stream(struct v4l2_subdev *sd, int enable) ov9740_s_stream() argument
507 struct i2c_client *client = v4l2_get_subdevdata(sd); ov9740_s_stream()
508 struct ov9740_priv *priv = to_ov9740(sd); ov9740_s_stream()
671 static int ov9740_s_fmt(struct v4l2_subdev *sd, ov9740_s_fmt() argument
674 struct i2c_client *client = v4l2_get_subdevdata(sd); ov9740_s_fmt()
675 struct ov9740_priv *priv = to_ov9740(sd); ov9740_s_fmt()
707 static int ov9740_try_fmt(struct v4l2_subdev *sd, ov9740_try_fmt() argument
719 static int ov9740_enum_fmt(struct v4l2_subdev *sd, unsigned int index, ov9740_enum_fmt() argument
730 static int ov9740_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) ov9740_cropcap() argument
744 static int ov9740_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) ov9740_g_crop() argument
775 static int ov9740_s_power(struct v4l2_subdev *sd, int on) ov9740_s_power() argument
777 struct i2c_client *client = v4l2_get_subdevdata(sd); ov9740_s_power()
779 struct ov9740_priv *priv = to_ov9740(sd); ov9740_s_power()
788 ov9740_s_fmt(sd, &priv->current_mf); ov9740_s_power()
789 ov9740_s_stream(sd, 1); ov9740_s_power()
793 ov9740_s_stream(sd, 0); ov9740_s_power()
804 static int ov9740_get_register(struct v4l2_subdev *sd, ov9740_get_register() argument
807 struct i2c_client *client = v4l2_get_subdevdata(sd); ov9740_get_register()
825 static int ov9740_set_register(struct v4l2_subdev *sd, ov9740_set_register() argument
828 struct i2c_client *client = v4l2_get_subdevdata(sd); ov9740_set_register()
839 struct v4l2_subdev *sd = i2c_get_clientdata(client); ov9740_video_probe() local
840 struct ov9740_priv *priv = to_ov9740(sd); ov9740_video_probe()
890 static int ov9740_g_mbus_config(struct v4l2_subdev *sd, ov9740_g_mbus_config() argument
893 struct i2c_client *client = v4l2_get_subdevdata(sd); ov9740_g_mbus_config()
/linux-4.1.27/drivers/iio/adc/
H A Dad7791.c148 struct ad_sigma_delta sd; member in struct:ad7791_state
156 static struct ad7791_state *ad_sigma_delta_to_ad7791(struct ad_sigma_delta *sd) ad_sigma_delta_to_ad7791() argument
158 return container_of(sd, struct ad7791_state, sd); ad_sigma_delta_to_ad7791()
161 static int ad7791_set_channel(struct ad_sigma_delta *sd, unsigned int channel) ad7791_set_channel() argument
163 ad_sd_set_comm(sd, channel); ad7791_set_channel()
168 static int ad7791_set_mode(struct ad_sigma_delta *sd, ad7791_set_mode() argument
171 struct ad7791_state *st = ad_sigma_delta_to_ad7791(sd); ad7791_set_mode()
189 return ad_sd_write_reg(sd, AD7791_REG_MODE, sizeof(st->mode), st->mode); ad7791_set_mode()
290 ad_sd_write_reg(&st->sd, AD7791_REG_FILTER, ad7791_write_frequency()
350 return ad_sd_write_reg(&st->sd, AD7791_REG_MODE, sizeof(st->mode), ad7791_setup()
381 ad_sd_init(&st->sd, indio_dev, spi, &ad7791_sigma_delta_info); ad7791_probe()
/linux-4.1.27/drivers/media/usb/pvrusb2/
H A Dpvrusb2-wm8775.c38 void pvr2_wm8775_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) pvr2_wm8775_subdev_update() argument
56 sd->ops->audio->s_routing(sd, input, 0, 0); pvr2_wm8775_subdev_update()
H A Dpvrusb2-cx2584x-v4l.c125 void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) pvr2_cx25840_subdev_update() argument
151 sd->ops->video->s_routing(sd, (u32)vid_input, 0, 0); pvr2_cx25840_subdev_update()
152 sd->ops->audio->s_routing(sd, (u32)aud_input, 0, 0); pvr2_cx25840_subdev_update()
/linux-4.1.27/drivers/staging/media/davinci_vpfe/
H A Ddm365_resizer.c1204 * @sd: pointer to v4l2 subdev structure
1208 static long resizer_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) resizer_ioctl() argument
1210 struct vpfe_resizer_device *resizer = v4l2_get_subdevdata(sd); resizer_ioctl()
1215 if (&resizer->crop_resizer.subdev != sd) resizer_ioctl()
1260 * @sd: pointer to v4l2 subdev structure
1263 static int resizer_set_stream(struct v4l2_subdev *sd, int enable) resizer_set_stream() argument
1265 struct vpfe_resizer_device *resizer = v4l2_get_subdevdata(sd); resizer_set_stream()
1267 if (&resizer->crop_resizer.subdev != sd) resizer_set_stream()
1290 * @sd: pointer to subdev.
1297 __resizer_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, __resizer_get_format() argument
1300 struct vpfe_resizer_device *resizer = v4l2_get_subdevdata(sd); __resizer_get_format()
1303 return v4l2_subdev_get_try_format(sd, cfg, pad); __resizer_get_format()
1304 if (&resizer->crop_resizer.subdev == sd) __resizer_get_format()
1306 if (&resizer->resizer_a.subdev == sd) __resizer_get_format()
1308 if (&resizer->resizer_b.subdev == sd) __resizer_get_format()
1315 * @sd: pointer to subdev.
1322 resizer_try_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, resizer_try_format() argument
1326 struct vpfe_resizer_device *resizer = v4l2_get_subdevdata(sd); resizer_try_format()
1331 if ((&resizer->resizer_a.subdev == sd && pad == RESIZER_PAD_SINK) || resizer_try_format()
1332 (&resizer->resizer_b.subdev == sd && pad == RESIZER_PAD_SINK) || resizer_try_format()
1333 (&resizer->crop_resizer.subdev == sd && resizer_try_format()
1348 } else if (&resizer->resizer_a.subdev == sd && resizer_try_format()
1366 } else if (&resizer->resizer_b.subdev == sd && resizer_try_format()
1389 * @sd: pointer to v4l2 subdev structure
1394 static int resizer_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, resizer_set_format() argument
1397 struct vpfe_resizer_device *resizer = v4l2_get_subdevdata(sd); resizer_set_format()
1400 format = __resizer_get_format(sd, cfg, fmt->pad, fmt->which); resizer_set_format()
1404 resizer_try_format(sd, cfg, fmt->pad, &fmt->format, fmt->which); resizer_set_format()
1410 if (&resizer->crop_resizer.subdev == sd) { resizer_set_format()
1426 } else if (&resizer->resizer_a.subdev == sd) { resizer_set_format()
1433 } else if (&resizer->resizer_b.subdev == sd) { resizer_set_format()
1449 * @sd: pointer to v4l2 subdev structure.
1454 static int resizer_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, resizer_get_format() argument
1459 format = __resizer_get_format(sd, cfg, fmt->pad, fmt->which); resizer_get_format()
1470 * @sd: Pointer to subdevice.
1474 static int resizer_enum_frame_size(struct v4l2_subdev *sd, resizer_enum_frame_size() argument
1486 resizer_try_format(sd, cfg, fse->pad, &format, fse->which); resizer_enum_frame_size()
1496 resizer_try_format(sd, cfg, fse->pad, &format, fse->which); resizer_enum_frame_size()
1505 * @sd: Pointer to subdevice.
1509 static int resizer_enum_mbus_code(struct v4l2_subdev *sd, resizer_enum_mbus_code() argument
1530 * @sd: Pointer to subdevice.
1536 static int resizer_init_formats(struct v4l2_subdev *sd, resizer_init_formats() argument
1540 struct vpfe_resizer_device *resizer = v4l2_get_subdevdata(sd); resizer_init_formats()
1543 if (&resizer->crop_resizer.subdev == sd) { resizer_init_formats()
1550 resizer_set_format(sd, fh->pad, &format); resizer_init_formats()
1558 resizer_set_format(sd, fh->pad, &format); resizer_init_formats()
1566 resizer_set_format(sd, fh->pad, &format); resizer_init_formats()
1567 } else if (&resizer->resizer_a.subdev == sd) { resizer_init_formats()
1574 resizer_set_format(sd, fh->pad, &format); resizer_init_formats()
1582 resizer_set_format(sd, fh->pad, &format); resizer_init_formats()
1583 } else if (&resizer->resizer_b.subdev == sd) { resizer_init_formats()
1590 resizer_set_format(sd, fh->pad, &format); resizer_init_formats()
1598 resizer_set_format(sd, fh->pad, &format); resizer_init_formats()
1650 struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); resizer_link_setup() local
1651 struct vpfe_resizer_device *resizer = v4l2_get_subdevdata(sd); resizer_link_setup()
1656 if (&resizer->crop_resizer.subdev == sd) { resizer_link_setup()
1705 } else if (&resizer->resizer_a.subdev == sd) { resizer_link_setup()
1730 } else if (&resizer->resizer_b.subdev == sd) { resizer_link_setup()
1881 struct v4l2_subdev *sd = &vpfe_rsz->crop_resizer.subdev; vpfe_resizer_init() local
1883 struct media_entity *me = &sd->entity; vpfe_resizer_init()
1901 v4l2_subdev_init(sd, &resizer_v4l2_ops); vpfe_resizer_init()
1902 sd->internal_ops = &resizer_v4l2_internal_ops; vpfe_resizer_init()
1903 strlcpy(sd->name, "DAVINCI RESIZER CROP", sizeof(sd->name)); vpfe_resizer_init()
1904 sd->grp_id = 1 << 16; /* group ID for davinci subdevs */ vpfe_resizer_init()
1905 v4l2_set_subdevdata(sd, vpfe_rsz); vpfe_resizer_init()
1906 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; vpfe_resizer_init()
1921 sd = &vpfe_rsz->resizer_a.subdev; vpfe_resizer_init()
1923 me = &sd->entity; vpfe_resizer_init()
1925 v4l2_subdev_init(sd, &resizer_v4l2_ops); vpfe_resizer_init()
1926 sd->internal_ops = &resizer_v4l2_internal_ops; vpfe_resizer_init()
1927 strlcpy(sd->name, "DAVINCI RESIZER A", sizeof(sd->name)); vpfe_resizer_init()
1928 sd->grp_id = 1 << 16; /* group ID for davinci subdevs */ vpfe_resizer_init()
1929 v4l2_set_subdevdata(sd, vpfe_rsz); vpfe_resizer_init()
1930 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; vpfe_resizer_init()
1943 sd = &vpfe_rsz->resizer_b.subdev; vpfe_resizer_init()
1945 me = &sd->entity; vpfe_resizer_init()
1947 v4l2_subdev_init(sd, &resizer_v4l2_ops); vpfe_resizer_init()
1948 sd->internal_ops = &resizer_v4l2_internal_ops; vpfe_resizer_init()
1949 strlcpy(sd->name, "DAVINCI RESIZER B", sizeof(sd->name)); vpfe_resizer_init()
1950 sd->grp_id = 1 << 16; /* group ID for davinci subdevs */ vpfe_resizer_init()
1951 v4l2_set_subdevdata(sd, vpfe_rsz); vpfe_resizer_init()
1952 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; vpfe_resizer_init()
H A Ddm365_ipipeif.c184 * @sd: pointer to v4l2 subdev structure
187 static int ipipeif_hw_setup(struct v4l2_subdev *sd) ipipeif_hw_setup() argument
189 struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ipipeif_hw_setup()
212 dev_err(&sd->devnode->dev, "ipipeif: links setup required"); ipipeif_hw_setup()
378 ipipeif_set_config(struct v4l2_subdev *sd, struct ipipeif_params *config) ipipeif_set_config() argument
380 struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ipipeif_set_config()
421 ipipeif_get_config(struct v4l2_subdev *sd, void __user *arg) ipipeif_get_config() argument
423 struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ipipeif_get_config()
458 * @sd: pointer to v4l2 subdev structure
462 static long ipipeif_ioctl(struct v4l2_subdev *sd, ipipeif_ioctl() argument
470 ret = ipipeif_set_config(sd, config); ipipeif_ioctl()
474 ret = ipipeif_get_config(sd, arg); ipipeif_ioctl()
525 * @sd: pointer to v4l2 subdev structure
528 static int ipipeif_set_stream(struct v4l2_subdev *sd, int enable) ipipeif_set_stream() argument
530 struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ipipeif_set_stream()
537 ret = ipipeif_hw_setup(sd); ipipeif_set_stream()
546 * @sd: pointer to v4l2 subdev structure
551 static int ipipeif_enum_mbus_code(struct v4l2_subdev *sd, ipipeif_enum_mbus_code() argument
579 * @sd: pointer to v4l2 subdev structure
584 ipipeif_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, ipipeif_get_format() argument
587 struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ipipeif_get_format()
592 fmt->format = *(v4l2_subdev_get_try_format(sd, cfg, fmt->pad)); ipipeif_get_format()
644 ipipeif_enum_frame_size(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, ipipeif_enum_frame_size() argument
647 struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ipipeif_enum_frame_size()
694 * @sd: pointer to v4l2 subdev structure
700 ipipeif_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, ipipeif_set_format() argument
703 struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ipipeif_set_format()
754 * @sd: VPFE ipipeif V4L2 subdevice
761 ipipeif_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) ipipeif_init_formats() argument
763 struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ipipeif_init_formats()
772 ipipeif_set_format(sd, fh->pad, &format); ipipeif_init_formats()
780 ipipeif_set_format(sd, fh->pad, &format); ipipeif_init_formats()
885 struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); ipipeif_link_setup() local
886 struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ipipeif_link_setup()
992 struct v4l2_subdev *sd = &ipipeif->subdev; vpfe_ipipeif_init() local
994 struct media_entity *me = &sd->entity; vpfe_ipipeif_init()
1014 v4l2_subdev_init(sd, &ipipeif_v4l2_ops); vpfe_ipipeif_init()
1016 sd->internal_ops = &ipipeif_v4l2_internal_ops; vpfe_ipipeif_init()
1017 strlcpy(sd->name, "DAVINCI IPIPEIF", sizeof(sd->name)); vpfe_ipipeif_init()
1018 sd->grp_id = 1 << 16; /* group ID for davinci subdevs */ vpfe_ipipeif_init()
1020 v4l2_set_subdevdata(sd, ipipeif); vpfe_ipipeif_init()
1022 sd->flags |= V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_HAS_DEVNODE; vpfe_ipipeif_init()
1039 sd->ctrl_handler = &ipipeif->ctrls; vpfe_ipipeif_init()
/linux-4.1.27/drivers/media/radio/si4713/
H A Dsi4713.c66 #define to_si4713_device(sd) container_of(sd, struct si4713_device, sd)
189 v4l2_dbg(2, debug, &sdev->sd, si4713_handler()
210 struct i2c_client *client = v4l2_get_subdevdata(&sdev->sd); si4713_send_command()
221 DBG_BUFFER(&sdev->sd, "Parameters", data1, argn + 1); si4713_send_command()
225 v4l2_err(&sdev->sd, "Error while sending command 0x%02x\n", si4713_send_command()
236 v4l2_warn(&sdev->sd, si4713_send_command()
244 v4l2_err(&sdev->sd, si4713_send_command()
250 DBG_BUFFER(&sdev->sd, "Response", response, respn); si4713_send_command()
295 v4l2_dbg(1, debug, &sdev->sd, si4713_read_property()
335 v4l2_dbg(1, debug, &sdev->sd, si4713_write_property()
355 struct i2c_client *client = v4l2_get_subdevdata(&sdev->sd); si4713_powerup()
373 v4l2_err(&sdev->sd, "Failed to enable vdd: %d\n", err); si4713_powerup()
381 v4l2_err(&sdev->sd, "Failed to enable vio: %d\n", err); si4713_powerup()
400 v4l2_dbg(1, debug, &sdev->sd, "Powerup response: 0x%02x\n", si4713_powerup()
402 v4l2_dbg(1, debug, &sdev->sd, "Device in power up mode\n"); si4713_powerup()
416 v4l2_err(&sdev->sd, "Failed to disable vdd: %d\n", err); si4713_powerup()
422 v4l2_err(&sdev->sd, "Failed to disable vio: %d\n", err); si4713_powerup()
446 v4l2_dbg(1, debug, &sdev->sd, "Power down response: 0x%02x\n", si4713_powerdown()
448 v4l2_dbg(1, debug, &sdev->sd, "Device in reset mode\n"); si4713_powerdown()
455 v4l2_err(&sdev->sd, si4713_powerdown()
463 v4l2_err(&sdev->sd, si4713_powerdown()
479 struct i2c_client *client = v4l2_get_subdevdata(&sdev->sd); si4713_checkrev()
492 v4l2_info(&sdev->sd, "chip found @ 0x%02x (%s)\n", si4713_checkrev()
495 v4l2_err(&sdev->sd, "Invalid product number 0x%X\n", resp[1]); si4713_checkrev()
509 struct i2c_client *client = v4l2_get_subdevdata(&sdev->sd); si4713_wait_stc()
516 v4l2_warn(&sdev->sd, si4713_wait_stc()
528 v4l2_dbg(1, debug, &sdev->sd, si4713_wait_stc()
573 v4l2_dbg(1, debug, &sdev->sd, si4713_tx_tune_freq()
624 v4l2_dbg(1, debug, &sdev->sd, si4713_tx_tune_power()
673 v4l2_dbg(1, debug, &sdev->sd, si4713_tx_tune_measure()
712 v4l2_dbg(1, debug, &sdev->sd, si4713_tx_tune_status()
719 v4l2_dbg(1, debug, &sdev->sd, "%s: response: %d x 10 kHz " si4713_tx_tune_status()
758 v4l2_dbg(1, debug, &sdev->sd, si4713_tx_rds_buff()
761 v4l2_dbg(1, debug, &sdev->sd, "%s: response: interrupts" si4713_tx_rds_buff()
797 v4l2_dbg(1, debug, &sdev->sd, "%s: status=0x%02x\n", __func__, val[0]); si4713_tx_rds_ps()
1060 static int si4713_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *f);
1061 static int si4713_s_modulator(struct v4l2_subdev *sd, const struct v4l2_modulator *);
1076 rval = si4713_s_frequency(&sdev->sd, &f); si4713_setup()
1085 si4713_s_modulator(&sdev->sd, &vm); si4713_setup()
1233 static long si4713_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) si4713_ioctl() argument
1235 struct si4713_device *sdev = to_si4713_device(sd); si4713_ioctl()
1269 static int si4713_g_modulator(struct v4l2_subdev *sd, struct v4l2_modulator *vm) si4713_g_modulator() argument
1271 struct si4713_device *sdev = to_si4713_device(sd); si4713_g_modulator()
1315 static int si4713_s_modulator(struct v4l2_subdev *sd, const struct v4l2_modulator *vm) si4713_s_modulator() argument
1317 struct si4713_device *sdev = to_si4713_device(sd); si4713_s_modulator()
1360 static int si4713_g_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f) si4713_g_frequency() argument
1362 struct si4713_device *sdev = to_si4713_device(sd); si4713_g_frequency()
1385 static int si4713_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequency *f) si4713_s_frequency() argument
1387 struct si4713_device *sdev = to_si4713_device(sd); si4713_s_frequency()
1490 v4l2_i2c_subdev_init(&sdev->sd, client, &si4713_subdev_ops); si4713_probe()
1587 sdev->sd.ctrl_handler = hdl; si4713_probe()
1594 v4l2_err(&sdev->sd, "Could not request IRQ\n"); si4713_probe()
1597 v4l2_dbg(1, debug, &sdev->sd, "IRQ requested.\n"); si4713_probe()
1599 v4l2_warn(&sdev->sd, "IRQ not configured. Using timeouts.\n"); si4713_probe()
1604 v4l2_err(&sdev->sd, "Failed to probe device information.\n"); si4713_probe()
1631 v4l2_device_unregister_subdev(&sdev->sd); si4713_probe()
1641 struct v4l2_subdev *sd = i2c_get_clientdata(client); si4713_remove() local
1642 struct si4713_device *sdev = to_si4713_device(sd); si4713_remove()
1649 v4l2_device_unregister_subdev(sd); si4713_remove()
1650 v4l2_ctrl_handler_free(sd->ctrl_handler); si4713_remove()
/linux-4.1.27/drivers/media/pci/saa7134/
H A Dsaa7134-go7007.c58 struct v4l2_subdev sd; member in struct:saa7134_go7007
66 static inline struct saa7134_go7007 *to_state(struct v4l2_subdev *sd) to_state() argument
68 return container_of(sd, struct saa7134_go7007, sd); to_state()
392 static int saa7134_go7007_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) saa7134_go7007_s_std() argument
395 struct saa7134_go7007 *saa = to_state(sd); saa7134_go7007_s_std()
421 struct v4l2_subdev *sd; saa7134_go7007_init() local
443 sd = &saa->sd; saa7134_go7007_init()
444 v4l2_subdev_init(sd, &saa7134_go7007_sd_ops); saa7134_go7007_init()
445 v4l2_set_subdevdata(sd, saa); saa7134_go7007_init()
446 strncpy(sd->name, "saa7134-go7007", sizeof(sd->name)); saa7134_go7007_init()
467 if (v4l2_device_register_subdev(&go->v4l2_dev, sd) < 0) saa7134_go7007_init()
501 v4l2_device_unregister_subdev(&saa->sd); saa7134_go7007_fini()
/linux-4.1.27/drivers/pinctrl/mvebu/
H A Dpinctrl-armada-39x.c140 MPP_VAR_FUNCTION(4, "sd", "cmd", V_88F6920_PLUS),
156 MPP_VAR_FUNCTION(4, "sd", "d4", V_88F6920_PLUS),
163 MPP_VAR_FUNCTION(4, "sd", "d5", V_88F6920_PLUS),
169 MPP_VAR_FUNCTION(4, "sd", "d6", V_88F6920_PLUS),
175 MPP_VAR_FUNCTION(4, "sd", "d7", V_88F6920_PLUS),
180 MPP_VAR_FUNCTION(4, "sd", "clk", V_88F6920_PLUS),
215 MPP_VAR_FUNCTION(4, "sd", "d3", V_88F6920_PLUS),
221 MPP_VAR_FUNCTION(4, "sd", "d0", V_88F6920_PLUS),
228 MPP_VAR_FUNCTION(4, "sd", "d1", V_88F6920_PLUS),
235 MPP_VAR_FUNCTION(4, "sd", "d2", V_88F6920_PLUS),
286 MPP_VAR_FUNCTION(5, "sd", "d4", V_88F6920_PLUS),
293 MPP_VAR_FUNCTION(5, "sd", "d5", V_88F6920_PLUS),
300 MPP_VAR_FUNCTION(5, "sd", "cmd", V_88F6920_PLUS),
313 MPP_VAR_FUNCTION(5, "sd", "d6", V_88F6920_PLUS),
321 MPP_VAR_FUNCTION(5, "sd", "d7", V_88F6920_PLUS),
328 MPP_VAR_FUNCTION(5, "sd", "d3", V_88F6920_PLUS),
334 MPP_VAR_FUNCTION(5, "sd", "d0", V_88F6920_PLUS),
346 MPP_VAR_FUNCTION(5, "sd", "clk", V_88F6920_PLUS),
353 MPP_VAR_FUNCTION(5, "sd", "d1", V_88F6920_PLUS),
360 MPP_VAR_FUNCTION(5, "sd", "d2", V_88F6920_PLUS)),
/linux-4.1.27/include/media/davinci/
H A Dvpbe_osd.h330 int (*initialize)(struct osd_state *sd);
331 int (*request_layer)(struct osd_state *sd, enum osd_layer layer);
332 void (*release_layer)(struct osd_state *sd, enum osd_layer layer);
333 int (*enable_layer)(struct osd_state *sd, enum osd_layer layer,
335 void (*disable_layer)(struct osd_state *sd, enum osd_layer layer);
336 int (*set_layer_config)(struct osd_state *sd, enum osd_layer layer,
338 void (*get_layer_config)(struct osd_state *sd, enum osd_layer layer,
340 void (*start_layer)(struct osd_state *sd, enum osd_layer layer,
343 void (*set_left_margin)(struct osd_state *sd, u32 val);
344 void (*set_top_margin)(struct osd_state *sd, u32 val);
345 void (*set_interpolation_filter)(struct osd_state *sd, int filter);
346 int (*set_vid_expansion)(struct osd_state *sd,
349 void (*get_vid_expansion)(struct osd_state *sd,
352 void (*set_zoom)(struct osd_state *sd, enum osd_layer layer,

Completed in 3170 milliseconds

123