Files
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

402 lines
5.0 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_SP0A20
SENSOR_INIT_SECTION static const unsigned char SP0A20InitTable[CMOS_INIT_LEN]=
{
0xfd,0x00,
0x1d,0x1f,
0x0c,0x01,
0x1b,0x27,
0x12,0x02,
0x13,0x2f,
0x6d,0x32,
0x6c,0x32,
0x6f,0x33,
0x6e,0x34,
0x16,0x38,
0x17,0x38,
0x70,0x3a,
0x14,0x02,
0x15,0x20,
0x71,0x23,
0x69,0x25,
0x6a,0x1a,
0x72,0x1c,
0x75,0x1e,
0x73,0x3c,
0x74,0x21,
0x79,0x00,
0x77,0x10,
0x1a,0x4d,
0x1c,0x07,
0x1e,0x15,
0x21,0x08,
0x22,0x28,
0x26,0x66,
0x28,0x0b,
0x37,0x7a,
0xfd,0x02,
0x01,0x80,
0x52,0x10,
0x54,0x00,
0xfd,0x01,
0x41,0x00,
0x42,0x00,
0x43,0x00,
0x44,0x00,
0xfd,0x00,
0x03,0x01,
0x04,0xc2,
0x05,0x00,
0x06,0x00,
0x07,0x00,
0x08,0x00,
0x09,0x02,
0x0a,0xf4,
0xfd,0x01,
0xf0,0x00,
0xf7,0x4b,
0x02,0x0e,
0x03,0x01,
0x06,0x4b,
0x07,0x00,
0x08,0x01,
0x09,0x00,
0xfd,0x02,
0xbe,0x1a,
0xbf,0x04,
0xd0,0x1a,
0xd1,0x04,
0xfd,0x01,
0x5a,0x40,
0xfd,0x02,
0xbc,0x70,
0xbd,0x50,
0xb8,0x66,
0xb9,0x88,
0xba,0x30,
0xbb,0x45,
0xfd,0x01,
0xe0,0x7c,
0xe1,0x60,
0xe2,0x54,
0xe3,0x4c,
0xe4,0x4c,
0xe5,0x48,
0xe6,0x48,
0xe7,0x44,
0xe8,0x44,
0xe9,0x44,
0xea,0x40,
0xf3,0x40,
0xf4,0x40,
0xfd,0x01,
0x04,0xc8,
0x05,0x40,
0x0a,0xc8,
0x0b,0x40,
0xfd,0x01,
0xeb,0x80,
0xec,0x68,
0xed,0x05,
0xee,0x0c,
0xfd,0x01,
0xf2,0x4d,
0xfd,0x02,
0x5b,0x05,
0x5c,0xa0,
0xfd,0x01,
0x26,0x80,
0x27,0x4f,
0x28,0x00,
0x29,0x20,
0x2a,0x00,
0x2b,0x03,
0x2c,0x00,
0x2d,0x20,
0x30,0x00,
0x31,0x00,
0xfd,0x01,
0xa1,0x1b,
0xa2,0x16,
0xa3,0x09,
0xa4,0x1a,
0xa5,0x1a,
0xa6,0x16,
0xa7,0x0c,
0xa8,0x1b,
0xa9,0x15,
0xaa,0x12,
0xab,0x07,
0xac,0x18,
0xad,0x05,
0xae,0x07,
0xaf,0x06,
0xb0,0x05,
0xb1,0x00,
0xb2,0x00,
0xb3,0x02,
0xb4,0x01,
0xb5,0x02,
0xb6,0x03,
0xb7,0x04,
0xb8,0x02,
0xfd,0x02,
0x08,0x00,
0x09,0x06,
0x1d,0x03,
0x1f,0x05,
0xfd,0x01,
0x32,0x00,
0xfd,0x02,
0x26,0xbf,
0x27,0xa3,
0xfd,0x00,
0xe7,0x03,
0xe7,0x00,
0xfd,0x02,
0x10,0xd3,
0x11,0xd3,
0x1b,0x80,
0x1a,0x80,
0x18,0x27,
0x19,0x26,
0x2a,0x00,
0x2b,0x00,
0x28,0xf8,
0x29,0x08,
0x66,0x4a,
0x67,0x6c,
0x68,0xd4,
0x69,0xf4,
0x6a,0xa5,
0x7c,0x30,
0x7d,0x4b,
0x7e,0xf7,
0x7f,0x13,
0x80,0xa6,
0x70,0x26,
0x71,0x4a,
0x72,0x25,
0x73,0x46,
0x74,0xaa,
0x6b,0x0a,
0x6c,0x31,
0x6d,0x2e,
0x6e,0x52,
0x6f,0xaa,
0x61,0xff,
0x62,0x18,
0x63,0x40,
0x64,0x6a,
0x65,0x6a,
0x75,0x80,
0x76,0x09,
0x77,0x02,
0x24,0x25,
0x0e,0x16,
0x3b,0x09,
0xfd,0x02,
0xde,0x0f,
0xd7,0x08,
0xd8,0x08,
0xd9,0x10,
0xda,0x14,
0xe8,0x20,
0xe9,0x20,
0xea,0x20,
0xeb,0x20,
0xec,0x28,
0xed,0x28,
0xee,0x20,
0xef,0x20,
0xd3,0x20,
0xd4,0x48,
0xd5,0x20,
0xd6,0x08,
0xfd,0x01,
0xd1,0x20,
0xfd,0x02,
0xdc,0x05,
0x05,0x20,
0xfd,0x02,
0x81,0x00,
0xfd,0x01,
0xfc,0x00,
0x7d,0x05,
0x7e,0x05,
0x7f,0x09,
0x80,0x08,
0xfd,0x02,
0xdd,0x0f,
0xfd,0x01,
0x6d,0x08,
0x6e,0x0f,
0x6f,0x20,
0x70,0x28,
0x86,0x28,
0x71,0x06,
0x72,0x07,
0x73,0x10,
0x74,0x14,
0x75,0x08,
0x76,0x08,
0x77,0x06,
0x78,0x06,
0x79,0x25,
0x7a,0x13,
0x7b,0x12,
0x7c,0x00,
0x81,0x0d,
0x82,0x18,
0x83,0x20,
0x84,0x24,
0xfd,0x02,
0x83,0x12,
0x84,0x14,
0x86,0x04,
0xfd,0x01,
0x61,0x60,
0x62,0x28,
0x8a,0x10,
0xfd,0x01,
0x8b,0x00,
0x8c,0x00,
0x8d,0x16,
0x8e,0x23,
0x8f,0x2f,
0x90,0x44,
0x91,0x57,
0x92,0x66,
0x93,0x73,
0x94,0x8b,
0x95,0x9e,
0x96,0xaf,
0x97,0xbd,
0x98,0xc8,
0x99,0xd1,
0x9a,0xd7,
0x9b,0xdd,
0x9c,0xe1,
0x9d,0xe5,
0x9e,0xe8,
0x9f,0xe9,
0xa0,0xeb,
0xfd,0x02,
0x15,0xc0,
0x16,0x8c,
0xa0,0x8a,
0xa1,0xf6,
0xa2,0x00,
0xa3,0x15,
0xa4,0x73,
0xa5,0xf7,
0xa6,0x18,
0xa7,0xcf,
0xa8,0x99,
0xa9,0x0c,
0xaa,0x30,
0xab,0x0c,
0xac,0x93,
0xad,0xe7,
0xae,0x06,
0xaf,0xda,
0xb0,0xcc,
0xb1,0xda,
0xb2,0xda,
0xb3,0xda,
0xb4,0xcc,
0xb5,0x0c,
0xb6,0x33,
0xb7,0x0f,
0xfd,0x01,
0xd3,0x80,
0xd4,0x80,
0xd5,0x70,
0xd6,0x50,
0xd7,0x80,
0xd8,0x80,
0xd9,0x70,
0xda,0x50,
0xfd,0x01,
0xdd,0x30,
0xde,0x10,
0xdf,0xff,
0x00,0x00,
0xfd,0x01,
0xc2,0xaa,
0xc3,0x77,
0xc4,0x77,
0xc5,0x66,
0xfd,0x01,
0xcd,0x10,
0xce,0x1f,
0xcf,0x30,
0xd0,0x45,
0xfd,0x02,
0x31,0x60,
0x32,0x60,
0x33,0xc0,
0x35,0x60,
0x37,0x13,
0xfd,0x01,
0x0e,0x80,
0x0f,0x20,
0x10,0x70,
0x11,0x70,
0x12,0x78,
0x13,0x78,
0x14,0xa8,
0x15,0xa0,
0x16,0xa0,
0x17,0xa0,
0xfd,0x00,
0x31,0x01,
0xfd,0x01,
0x32,0x15,
0x33,0xef,
0x34,0x07,
0xd2,0x01,
0xfb,0x25,
0xf2,0x49,
0x35,0x40,
0x5d,0x11,
0xfd,0x00,
0xfd,0x00,
0x1b,0x20,
0xff,0xff,
};
SENSOR_OP_SECTION const _Sensor_Adpt_ sp0a20_cmd=
{
.typ = 1, //YUV
.pixelw = 640,
.pixelh= 480,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)SP0A20InitTable,
.rotate_adapt = {0},
.hvb_adapt = {0},
.mclk = 24000000,
.p_fun_adapt = {NULL,NULL,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ sp0a20_init=
{
//id, w_cmd, r_cmd, addr_num, data_num, id_reg
0x2b,0x42,0x43,0x01,0x01,0x02
};
#endif