1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
7 #include "cros_camera.h"
9 int check_cros_camera_info(const struct cros_camera_info
*info
)
11 if (memcmp(info
->magic
, CROS_CAMERA_INFO_MAGIC
, sizeof(info
->magic
))) {
12 printk(BIOS_ERR
, "Invalid magic in camera info\n");
16 const uint8_t *ptr
= (void *)(&info
->crc16
+ 1);
18 while (ptr
< (uint8_t *)info
+ sizeof(struct cros_camera_info
))
19 crc16
= crc16_byte(crc16
, *ptr
++);
21 if (info
->crc16
!= crc16
) {
22 printk(BIOS_ERR
, "Incorrect CRC16: expected %#06x, got %#06x\n",
27 if (info
->version
!= CROS_CAMERA_INFO_VERSION
) {
28 printk(BIOS_ERR
, "Unknown camera info version: %u\n",
32 if (info
->size
< CROS_CAMERA_INFO_SIZE_MIN
) {
33 printk(BIOS_ERR
, "Size of camera info is too small: %u\n",