Lines Matching refs:pdev
95 static int recv_control_msg(struct pwc_device *pdev, in recv_control_msg() argument
100 rc = usb_control_msg(pdev->udev, usb_rcvctrlpipe(pdev->udev, 0), in recv_control_msg()
103 value, pdev->vcinterface, in recv_control_msg()
104 pdev->ctrl_buf, recv_count, USB_CTRL_GET_TIMEOUT); in recv_control_msg()
111 static inline int send_video_command(struct pwc_device *pdev, in send_video_command() argument
116 memcpy(pdev->ctrl_buf, buf, buflen); in send_video_command()
118 rc = usb_control_msg(pdev->udev, usb_sndctrlpipe(pdev->udev, 0), in send_video_command()
122 pdev->ctrl_buf, buflen, USB_CTRL_SET_TIMEOUT); in send_video_command()
124 memcpy(pdev->cmd_buf, buf, buflen); in send_video_command()
131 int send_control_msg(struct pwc_device *pdev, in send_control_msg() argument
134 return usb_control_msg(pdev->udev, usb_sndctrlpipe(pdev->udev, 0), in send_control_msg()
137 value, pdev->vcinterface, in send_control_msg()
141 static int set_video_mode_Nala(struct pwc_device *pdev, int size, int pixfmt, in set_video_mode_Nala() argument
181 ret = send_video_command(pdev, pdev->vendpoint, in set_video_mode_Nala()
187 pwc_dec1_init(pdev, pEntry->mode); in set_video_mode_Nala()
190 pdev->pixfmt = pixfmt; in set_video_mode_Nala()
191 pdev->vframes = frames; in set_video_mode_Nala()
192 pdev->valternate = pEntry->alternate; in set_video_mode_Nala()
193 pdev->width = pwc_image_sizes[size][0]; in set_video_mode_Nala()
194 pdev->height = pwc_image_sizes[size][1]; in set_video_mode_Nala()
195 pdev->frame_size = (pdev->width * pdev->height * 3) / 2; in set_video_mode_Nala()
197 if (pdev->release < 5) { /* 4 fold compression */ in set_video_mode_Nala()
198 pdev->vbandlength = 528; in set_video_mode_Nala()
199 pdev->frame_size /= 4; in set_video_mode_Nala()
202 pdev->vbandlength = 704; in set_video_mode_Nala()
203 pdev->frame_size /= 3; in set_video_mode_Nala()
207 pdev->vbandlength = 0; in set_video_mode_Nala()
216 static int set_video_mode_Timon(struct pwc_device *pdev, int size, int pixfmt, in set_video_mode_Timon() argument
244 ret = send_video_command(pdev, pdev->vendpoint, in set_video_mode_Timon()
250 pwc_dec23_init(pdev, pChoose->mode); in set_video_mode_Timon()
253 pdev->pixfmt = pixfmt; in set_video_mode_Timon()
254 pdev->vframes = (fps + 1) * 5; in set_video_mode_Timon()
255 pdev->valternate = pChoose->alternate; in set_video_mode_Timon()
256 pdev->width = pwc_image_sizes[size][0]; in set_video_mode_Timon()
257 pdev->height = pwc_image_sizes[size][1]; in set_video_mode_Timon()
258 pdev->vbandlength = pChoose->bandlength; in set_video_mode_Timon()
260 pdev->frame_size = (pChoose->bandlength * pdev->height) / 4; in set_video_mode_Timon()
262 pdev->frame_size = (pdev->width * pdev->height * 12) / 8; in set_video_mode_Timon()
267 static int set_video_mode_Kiara(struct pwc_device *pdev, int size, int pixfmt, in set_video_mode_Kiara() argument
296 ret = send_video_command(pdev, 4, pChoose->mode, 12); in set_video_mode_Kiara()
301 pwc_dec23_init(pdev, pChoose->mode); in set_video_mode_Kiara()
304 pdev->pixfmt = pixfmt; in set_video_mode_Kiara()
305 pdev->vframes = (fps + 1) * 5; in set_video_mode_Kiara()
306 pdev->valternate = pChoose->alternate; in set_video_mode_Kiara()
307 pdev->width = pwc_image_sizes[size][0]; in set_video_mode_Kiara()
308 pdev->height = pwc_image_sizes[size][1]; in set_video_mode_Kiara()
309 pdev->vbandlength = pChoose->bandlength; in set_video_mode_Kiara()
310 if (pdev->vbandlength > 0) in set_video_mode_Kiara()
311 pdev->frame_size = (pdev->vbandlength * pdev->height) / 4; in set_video_mode_Kiara()
313 pdev->frame_size = (pdev->width * pdev->height * 12) / 8; in set_video_mode_Kiara()
315 pdev->frame_size, pdev->vframes, size, pdev->vbandlength); in set_video_mode_Kiara()
319 int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, in pwc_set_video_mode() argument
326 size = pwc_get_size(pdev, width, height); in pwc_set_video_mode()
329 if (DEVICE_USE_CODEC1(pdev->type)) { in pwc_set_video_mode()
330 ret = set_video_mode_Nala(pdev, size, pixfmt, frames, in pwc_set_video_mode()
332 } else if (DEVICE_USE_CODEC3(pdev->type)) { in pwc_set_video_mode()
333 ret = set_video_mode_Kiara(pdev, size, pixfmt, frames, in pwc_set_video_mode()
336 ret = set_video_mode_Timon(pdev, size, pixfmt, frames, in pwc_set_video_mode()
343 pdev->frame_total_size = pdev->frame_size + pdev->frame_header_size + pdev->frame_trailer_size; in pwc_set_video_mode()
344 PWC_DEBUG_SIZE("Set resolution to %dx%d\n", pdev->width, pdev->height); in pwc_set_video_mode()
348 static unsigned int pwc_get_fps_Nala(struct pwc_device *pdev, unsigned int index, unsigned int size) in pwc_get_fps_Nala() argument
360 static unsigned int pwc_get_fps_Kiara(struct pwc_device *pdev, unsigned int index, unsigned int siz… in pwc_get_fps_Kiara() argument
372 static unsigned int pwc_get_fps_Timon(struct pwc_device *pdev, unsigned int index, unsigned int siz… in pwc_get_fps_Timon() argument
384 unsigned int pwc_get_fps(struct pwc_device *pdev, unsigned int index, unsigned int size) in pwc_get_fps() argument
388 if (DEVICE_USE_CODEC1(pdev->type)) { in pwc_get_fps()
389 ret = pwc_get_fps_Nala(pdev, index, size); in pwc_get_fps()
391 } else if (DEVICE_USE_CODEC3(pdev->type)) { in pwc_get_fps()
392 ret = pwc_get_fps_Kiara(pdev, index, size); in pwc_get_fps()
395 ret = pwc_get_fps_Timon(pdev, index, size); in pwc_get_fps()
401 int pwc_get_u8_ctrl(struct pwc_device *pdev, u8 request, u16 value, int *data) in pwc_get_u8_ctrl() argument
405 ret = recv_control_msg(pdev, request, value, 1); in pwc_get_u8_ctrl()
409 *data = pdev->ctrl_buf[0]; in pwc_get_u8_ctrl()
413 int pwc_set_u8_ctrl(struct pwc_device *pdev, u8 request, u16 value, u8 data) in pwc_set_u8_ctrl() argument
417 pdev->ctrl_buf[0] = data; in pwc_set_u8_ctrl()
418 ret = send_control_msg(pdev, request, value, pdev->ctrl_buf, 1); in pwc_set_u8_ctrl()
425 int pwc_get_s8_ctrl(struct pwc_device *pdev, u8 request, u16 value, int *data) in pwc_get_s8_ctrl() argument
429 ret = recv_control_msg(pdev, request, value, 1); in pwc_get_s8_ctrl()
433 *data = ((s8 *)pdev->ctrl_buf)[0]; in pwc_get_s8_ctrl()
437 int pwc_get_u16_ctrl(struct pwc_device *pdev, u8 request, u16 value, int *data) in pwc_get_u16_ctrl() argument
441 ret = recv_control_msg(pdev, request, value, 2); in pwc_get_u16_ctrl()
445 *data = (pdev->ctrl_buf[1] << 8) | pdev->ctrl_buf[0]; in pwc_get_u16_ctrl()
449 int pwc_set_u16_ctrl(struct pwc_device *pdev, u8 request, u16 value, u16 data) in pwc_set_u16_ctrl() argument
453 pdev->ctrl_buf[0] = data & 0xff; in pwc_set_u16_ctrl()
454 pdev->ctrl_buf[1] = data >> 8; in pwc_set_u16_ctrl()
455 ret = send_control_msg(pdev, request, value, pdev->ctrl_buf, 2); in pwc_set_u16_ctrl()
462 int pwc_button_ctrl(struct pwc_device *pdev, u16 value) in pwc_button_ctrl() argument
466 ret = send_control_msg(pdev, SET_STATUS_CTL, value, NULL, 0); in pwc_button_ctrl()
474 void pwc_camera_power(struct pwc_device *pdev, int power) in pwc_camera_power() argument
478 if (!pdev->power_save) in pwc_camera_power()
481 if (pdev->type < 675 || (pdev->type < 730 && pdev->release < 6)) in pwc_camera_power()
485 pdev->ctrl_buf[0] = 0x00; /* active */ in pwc_camera_power()
487 pdev->ctrl_buf[0] = 0xFF; /* power save */ in pwc_camera_power()
488 r = send_control_msg(pdev, SET_STATUS_CTL, in pwc_camera_power()
489 SET_POWER_SAVE_MODE_FORMATTER, pdev->ctrl_buf, 1); in pwc_camera_power()
495 int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value) in pwc_set_leds() argument
499 if (pdev->type < 730) in pwc_set_leds()
512 pdev->ctrl_buf[0] = on_value; in pwc_set_leds()
513 pdev->ctrl_buf[1] = off_value; in pwc_set_leds()
515 r = send_control_msg(pdev, in pwc_set_leds()
516 SET_STATUS_CTL, LED_FORMATTER, pdev->ctrl_buf, 2); in pwc_set_leds()
524 int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor) in pwc_get_cmos_sensor() argument
528 if (pdev->type < 675) in pwc_get_cmos_sensor()
530 else if (pdev->type < 730) in pwc_get_cmos_sensor()
535 ret = recv_control_msg(pdev, GET_STATUS_CTL, request, 1); in pwc_get_cmos_sensor()
538 if (pdev->type < 675) in pwc_get_cmos_sensor()
539 *sensor = pdev->ctrl_buf[0] | 0x100; in pwc_get_cmos_sensor()
541 *sensor = pdev->ctrl_buf[0]; in pwc_get_cmos_sensor()