// SPDX-License-Identifier: GPL-2.0-or-later /* Driver for Philips webcam Functions that send various control messages to the webcam, including video modes. (C) 1999-2003 Nemosoft Unv. (C) 2004-2006 Luc Saillard (luc@saillard.org) (C) 2011 Hans de Goede <hdegoede@redhat.com>
NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx driver and thus may have bugs that are not present in the original version. Please send bug reports and support requests to <luc@saillard.org>.
NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx driver and thus may have bugs that are not present in the original version. Please send bug reports and support requests to <luc@saillard.org>. The decompression routines have been implemented by reverse-engineering the Nemosoft binary pwcx module. Caveat emptor.
*/
/* Changes 2001/08/03 Alvarado Added methods for changing white balance and red/green gains
*/
/* Control functions for the cam; brightness, contrast, video mode, etc. */
/* Let pwc-if.c:isoc_init know we don't support higher compression */
*compression = 3;
return 0;
}
staticint set_video_mode_Timon(struct pwc_device *pdev, int size, int pixfmt, int frames, int *compression, int send_to_cam)
{ conststruct Timon_table_entry *pChoose; int fps, ret = 0;
staticint set_video_mode_Kiara(struct pwc_device *pdev, int size, int pixfmt, int frames, int *compression, int send_to_cam)
{ conststruct Kiara_table_entry *pChoose; int fps, ret = 0;
/* Find a supported framerate with progressively higher compression */ do {
pChoose = &Kiara_table[size][fps][*compression]; if (pChoose->alternate != 0) break;
(*compression)++;
} while (*compression <= 3);
if (pChoose->alternate == 0) return -ENOENT; /* Not supported. */
/* Firmware bug: video endpoint is 5, but commands are sent to endpoint 4 */ if (send_to_cam)
ret = send_video_command(pdev, 4, pChoose->mode, 12); if (ret < 0) return ret;
if (pChoose->bandlength > 0 && pixfmt == V4L2_PIX_FMT_YUV420)
pwc_dec23_init(pdev, pChoose->mode);
int pwc_set_u16_ctrl(struct pwc_device *pdev, u8 request, u16 value, u16 data)
{ int ret;
pdev->ctrl_buf[0] = data & 0xff;
pdev->ctrl_buf[1] = data >> 8;
ret = send_control_msg(pdev, request, value, pdev->ctrl_buf, 2); if (ret < 0) return ret;
return 0;
}
int pwc_button_ctrl(struct pwc_device *pdev, u16 value)
{ int ret;
ret = send_control_msg(pdev, SET_STATUS_CTL, value, NULL, 0); if (ret < 0) return ret;
return 0;
}
/* POWER */ void pwc_camera_power(struct pwc_device *pdev, int power)
{ int r;
if (!pdev->power_save) return;
if (pdev->type < 675 || (pdev->type < 730 && pdev->release < 6)) return; /* Not supported by Nala or Timon < release 6 */
if (power)
pdev->ctrl_buf[0] = 0x00; /* active */ else
pdev->ctrl_buf[0] = 0xFF; /* power save */
r = send_control_msg(pdev, SET_STATUS_CTL,
SET_POWER_SAVE_MODE_FORMATTER, pdev->ctrl_buf, 1); if (r < 0)
PWC_ERROR("Failed to power %s camera (%d)\n",
power ? "on" : "off", r);
}
int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value)
{ int r;
if (pdev->type < 730) return 0;
on_value /= 100;
off_value /= 100; if (on_value < 0)
on_value = 0; if (on_value > 0xff)
on_value = 0xff; if (off_value < 0)
off_value = 0; if (off_value > 0xff)
off_value = 0xff;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.