1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * SN9C2028 common functions
5 * Copyright (C) 2009 Theodore Kilgore <kilgota@auburn,edu>
7 * Based closely upon the file gspca/pac_common.h
10 static const unsigned char sn9c2028_sof_marker
[] = {
11 0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96,
16 0x00, /* avg luminance lower 8 bit */
17 0x00, /* avg luminance higher 8 bit */
20 static unsigned char *sn9c2028_find_sof(struct gspca_dev
*gspca_dev
,
21 unsigned char *m
, int len
)
23 struct sd
*sd
= (struct sd
*) gspca_dev
;
26 /* Search for the SOF marker (fixed part) in the header */
27 for (i
= 0; i
< len
; i
++) {
28 if ((m
[i
] == sn9c2028_sof_marker
[sd
->sof_read
]) ||
31 if (sd
->sof_read
== 11)
33 if (sd
->sof_read
== 12)
34 sd
->avg_lum
= (m
[i
] << 8) + sd
->avg_lum_l
;
35 if (sd
->sof_read
== sizeof(sn9c2028_sof_marker
)) {
36 gspca_dbg(gspca_dev
, D_FRAM
,
37 "SOF found, bytes to analyze: %u - Frame starts at byte #%u\n",