Files
OpenTXW81X/sdk/lib/bus/iic/sensor/sensor_sp0828.c
T
divadiow 05bd1742cd Improve HI704, SP0A20, SP0828 sensor drivers (#3)
* add sp0a20 support

* HI704: use validated factory table

Replace the init data with the byte-exact 704-byte FTY/X5/X6 sequence and align the descriptor and formatting with the Taixin sensor drivers.

* SP0A20: use validated factory table

Replace the malformed mixed data with the byte-exact 724-byte HQT6 sequence and align the descriptor and formatting with the Taixin sensor drivers.

* SP0828: use validated factory table

Replace the main init data with the byte-exact 458-byte FTY/X5/X6 24 MHz sequence, retain the existing probe prewrite, and align the driver with Taixin formatting.
2026-08-11 00:42:37 +03:00

281 lines
3.7 KiB
C

#include "sys_config.h"
#include "typesdef.h"
#include "lib/video/dvp/cmos_sensor/csi.h"
#include "tx_platform.h"
#include "list.h"
#include "dev.h"
#include "hal/i2c.h"
#if DEV_SENSOR_SP0828
SENSOR_INIT_SECTION static const unsigned char SP0828InitTable[CMOS_INIT_LEN]=
{
0xfd,0x00,
0x1c,0x00,
0x30,0x00,
0x0f,0x2f,
0x10,0x2f,
0x12,0x7f,
0x13,0x2f,
0x15,0x7f,
0x16,0x0f,
0x22,0xe0,
0x26,0x08,
0x27,0xe8,
0x28,0x0b,
0x32,0x00,
0xfd,0x00,
0x31,0x10,
0xd8,0x58,
0xd9,0x58,
0xda,0x58,
0xdb,0x58,
0x36,0x00,
0x5f,0x11,
0xe0,0x00,
0xe1,0xdc,
0xe2,0xb0,
0xe3,0x00,
0xe4,0x2e,
0xe5,0x00,
0xe6,0x2b,
0xb7,0x3c,
0xb8,0x50,
0xfd,0x01,
0x25,0x1a,
0x26,0xfb,
0x28,0x61,
0x29,0x49,
0x31,0x64,
0x32,0x18,
0x4d,0xdc,
0x4e,0x53,
0x41,0x8c,
0x42,0x57,
0x55,0xff,
0x56,0x00,
0x59,0x82,
0x5a,0x00,
0x5d,0xff,
0x5e,0x6f,
0x57,0xff,
0x58,0x00,
0x5b,0xff,
0x5c,0xa8,
0x5f,0x75,
0x60,0x00,
0x2d,0x00,
0x2e,0x00,
0x2f,0x00,
0x30,0x00,
0x33,0x00,
0x34,0x00,
0x37,0x00,
0x38,0x00,
0x39,0x01,
0x3a,0x07,
0xfd,0x00,
0x33,0x0f,
0x51,0x3f,
0x52,0x09,
0x53,0x00,
0x54,0x00,
0x55,0x10,
0x4f,0x08,
0x50,0x08,
0x56,0x70,
0x57,0x10,
0x58,0x10,
0x59,0x10,
0x5a,0x02,
0x5b,0x02,
0x5c,0x20,
0x65,0x03,
0x66,0x01,
0x67,0x03,
0x68,0x46,
0x69,0x7f,
0x6a,0x01,
0x6b,0x04,
0x6c,0x01,
0x6d,0x03,
0x6e,0x46,
0x6f,0x7f,
0x70,0x01,
0x71,0x05,
0x72,0x01,
0x73,0x03,
0x74,0x46,
0x75,0x7f,
0x76,0x01,
0x7f,0xa0,
0x80,0x00,
0x81,0xe0,
0x82,0xed,
0x83,0xa6,
0x84,0xed,
0x85,0xfa,
0x86,0xba,
0x87,0xcc,
0x88,0x30,
0x89,0x33,
0x8a,0x0f,
0x8b,0x00,
0x8c,0x1a,
0x8d,0x29,
0x8e,0x41,
0x8f,0x62,
0x90,0x7c,
0x91,0x90,
0x92,0xa2,
0x93,0xaf,
0x94,0xba,
0x95,0xc4,
0x96,0xce,
0x97,0xd6,
0x98,0xdd,
0x99,0xe4,
0x9a,0xea,
0x9b,0xf1,
0xfd,0x01,
0x8d,0xf8,
0x8e,0xff,
0xfd,0x00,
0xca,0xcf,
0xcb,0x07,
0xcc,0x04,
0xce,0xff,
0xcf,0x10,
0xd0,0x20,
0xd1,0x00,
0xd2,0x1c,
0xd3,0x16,
0xd4,0x00,
0xd6,0x1c,
0xd7,0x16,
0xdd,0x6c,
0xde,0xa0,
0xb9,0x00,
0xba,0x04,
0xbb,0x08,
0xbc,0x10,
0xbd,0x20,
0xbe,0x30,
0xbf,0x40,
0xc0,0x50,
0xc1,0x60,
0xc2,0x70,
0xc3,0x80,
0xc4,0x90,
0xc5,0xa0,
0xc6,0xb0,
0xc7,0xc0,
0xc8,0xd0,
0xc9,0xe0,
0xfd,0x01,
0x89,0xf0,
0x8a,0xff,
0xfd,0x00,
0xe8,0x30,
0xe9,0x30,
0xea,0x40,
0xf4,0x1b,
0xf5,0x97,
0xec,0x53,
0xed,0x78,
0xee,0x47,
0xef,0x6c,
0xf7,0x70,
0xf8,0x5b,
0xf9,0x64,
0xfa,0x4f,
0xfd,0x01,
0x09,0x31,
0x0a,0x85,
0x0b,0x0b,
0x14,0x20,
0x15,0x0f,
0xfd,0x00,
0x05,0x00,
0x06,0xfe,
0x09,0x02,
0x0a,0x4d,
0xf0,0x47,
0xf1,0x00,
0xf2,0x59,
0xf5,0x72,
0xfd,0x01,
0x00,0xac,
0x0f,0x5a,
0x16,0x5a,
0x17,0x9c,
0x18,0xa4,
0x1b,0x5a,
0x1c,0xa4,
0xb4,0x21,
0xb5,0x3b,
0xb6,0x43,
0xb9,0x40,
0xba,0x4f,
0xbb,0x47,
0xbc,0x45,
0xbd,0x43,
0xbe,0x42,
0xbf,0x42,
0xc0,0x42,
0xc1,0x41,
0xc2,0x41,
0xc3,0x41,
0xc4,0x41,
0xc5,0x70,
0xc6,0x41,
0xca,0x70,
0xcb,0x0c,
0xfd,0x00,
0xfd,0x00,
0x31,0x10,
0x32,0x15,
0x34,0x66,
0x35,0x40,
0x1b,0x07,
0xff,0xff,
};
//Sensor prewrite sequence
SENSOR_INIT_SECTION static const unsigned char SP0828prewriteInitTable[CMOS_INIT_LEN]=
{
0xfd,0x00,
0x1c,0x00,
0x30,0x00,
0x31,0x00,
0xff,0xff,
};
SENSOR_OP_SECTION const _Sensor_Adpt_ sp0828_cmd=
{
.typ = 1, //YUV
.pixelw = 240,
.pixelh= 320,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)SP0828InitTable,
.preset = (uint8 *)SP0828prewriteInitTable,
.rotate_adapt = {0},
.hvb_adapt = {0x80,0x0a,0x80,0x0a},
.mclk = 24000000,
.p_fun_adapt = {NULL,NULL,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ sp0828_init=
{
//id, w_cmd, r_cmd, addr_num, data_num, id_reg
0x0c,0x30,0x31,0x01,0x01,0x02
};
#endif