// SPDX-License-Identifier: GPL-2.0-or-later
/*
* SPCA500 chip based cameras initialization data
*
* V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#define MODULE_NAME "spca500"
#include "gspca.h"
#include "jpeg.h"
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver");
MODULE_LICENSE("GPL");
#define QUALITY 85
/* specific webcam descriptor */
struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */
char subtype;
#define AgfaCl20 0
#define AiptekPocketDV 1
#define BenqDC1016 2
#define CreativePCCam300 3
#define DLinkDSC350 4
#define Gsmartmini 5
#define IntelPocketPCCamera 6
#define KodakEZ200 7
#define LogitechClickSmart310 8
#define LogitechClickSmart510 9
#define LogitechTraveler 10
#define MustekGsmart300 11
#define Optimedia 12
#define PalmPixDC85 13
#define ToptroIndus 14
u8 jpeg_hdr[JPEG_HDR_SZ];
};
static const struct v4l2_pix_format vga_mode[] = {
{320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
.bytesperline = 320,
.sizeimage = 320 * 240 * 3 / 8 + 590,
.colorspace = V4L2_COLORSPACE_JPEG,
.priv = 1},
{640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
.bytesperline = 640,
.sizeimage = 640 * 480 * 3 / 8 + 590,
.colorspace = V4L2_COLORSPACE_JPEG,
.priv = 0},
};
static const struct v4l2_pix_format sif_mode[] = {
{176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
.bytesperline = 176,
.sizeimage = 176 * 144 * 3 / 8 + 590,
.colorspace = V4L2_COLORSPACE_JPEG,
.priv = 1},
{352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
.bytesperline = 352,
.sizeimage = 352 * 288 * 3 / 8 + 590,
.colorspace = V4L2_COLORSPACE_JPEG,
.priv = 0},
};
/* Frame packet header offsets for the spca500 */
#define SPCA500_OFFSET_PADDINGLB 2
#define SPCA500_OFFSET_PADDINGHB 3
#define SPCA500_OFFSET_MODE 4
#define SPCA500_OFFSET_IMGWIDTH 5
#define SPCA500_OFFSET_IMGHEIGHT 6
#define SPCA500_OFFSET_IMGMODE 7
#define SPCA500_OFFSET_QTBLINDEX 8
#define SPCA500_OFFSET_FRAMSEQ 9
#define SPCA500_OFFSET_CDSPINFO 10
#define SPCA500_OFFSET_GPIO 11
#define SPCA500_OFFSET_AUGPIO 12
#define SPCA500_OFFSET_DATA 16
static const __u16 spca500_visual_defaults[][3] = {
{0x00, 0x0003, 0x816b}, /* SSI not active sync with vsync,
* hue (H byte) = 0,
* saturation/hue enable,
* brightness/contrast enable.
*/
{0x00, 0x0000, 0x8167}, /* brightness = 0 */
{0x00, 0x0020, 0x8168}, /* contrast = 0 */
{0x00, 0x0003, 0x816b}, /* SSI not active sync with vsync,
* hue (H byte) = 0, saturation/hue enable,
* brightness/contrast enable.
* was 0x0003, now 0x0000.
*/
{0x00, 0x0000, 0x816a}, /* hue (L byte) = 0 */
{0x00, 0x0020, 0x8169}, /* saturation = 0x20 */
{0x00, 0x0050, 0x8157}, /* edge gain high threshold */
{0x00, 0x0030, 0x8158}, /* edge gain low threshold */
{0x00, 0x0028, 0x8159}, /* edge bandwidth high threshold */
{0x00, 0x000a, 0x815a}, /* edge bandwidth low threshold */
{0x00, 0x0001, 0x8202}, /* clock rate compensation = 1/25 sec/frame */
{0x0c, 0x0004, 0x0000},
/* set interface */
{}
};
static const __u16 Clicksmart510_defaults[][3] = {
{0x00, 0x00, 0x8211},
{0x00, 0x01, 0x82c0},
{0x00, 0x10, 0x82cb},
{0x00, 0x0f, 0x800d},
{0x00, 0x82, 0x8225},
{0x00, 0x21, 0x8228},
{0x00, 0x00, 0x8203},
{0x00, 0x00, 0x8204},
{0x00, 0x08, 0x8205},
{0x00, 0xf8, 0x8206},
{0x00, 0x28, 0x8207},
{0x00, 0xa0, 0x8208},
{0x00, 0x08, 0x824a},
{0x00, 0x08, 0x8214},
{0x00, 0x80, 0x82c1},
{0x00, 0x00, 0x82c2},
{0x00, 0x00, 0x82ca},
{0x00, 0x80, 0x82c1},
{0x00, 0x04, 0x82c2},
{0x00, 0x00, 0x82ca},
{0x00, 0xfc, 0x8100},
{0x00, 0xfc, 0x8105},
{0x00, 0x30, 0x8101},
{0x00, 0x00, 0x8102},
{0x00, 0x00, 0x8103},
{0x00, 0x66, 0x8107},
{0x00, 0x00, 0x816b},
{0x00, 0x00, 0x8155},
{0x00, 0x01, 0x8156},
{0x00, 0x60, 0x8157},
{0x00, 0x40, 0x8158},
{0x00, 0x0a, 0x8159},
{0x00, 0x06, 0x815a},
{0x00, 0x00, 0x813f},
{0x00, 0x00, 0x8200},
{0x00, 0x19, 0x8201},
{0x00, 0x00, 0x82c1},
{0x00, 0xa0, 0x82c2},
{0x00, 0x00, 0x82ca},
{0x00, 0x00, 0x8117},
{0x00, 0x00, 0x8118},
{0x00, 0x65, 0x8119},
{0x00, 0x00, 0x811a},
{0x00, 0x00, 0x811b},
{0x00, 0x55, 0x811c},
{0x00, 0x65, 0x811d},
{0x00, 0x55, 0x811e},
{0x00, 0x16, 0x811f},
{0x00, 0x19, 0x8120},
{0x00, 0x80, 0x8103},
{0x00, 0x83, 0x816b},
{0x00, 0x25, 0x8168},
{0x00, 0x01, 0x820f},
{0x00, 0xff, 0x8115},
{0x00, 0x48, 0x8116},
{0x00, 0x50, 0x8151},
{0x00, 0x40, 0x8152},
{0x00, 0x78, 0x8153},
{0x00, 0x40, 0x8154},
{0x00, 0x00, 0x8167},
{0x00, 0x20, 0x8168},
{0x00, 0x00