Files
OpenTXW81X/sdk/lib/bus/iic/sensor/sensor_hi704.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

392 lines
4.9 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_HI704
SENSOR_INIT_SECTION static const unsigned char HI704InitTable[CMOS_INIT_LEN]=
{
0x03,0x00,
0x01,0xf1,
0x01,0xf3,
0x01,0xf1,
0x03,0x00,
0x10,0x08,
0x11,0x90,
0x12,0x04,
0x20,0x00,
0x21,0x04,
0x22,0x00,
0x23,0x04,
0x40,0x01,
0x41,0x58,
0x42,0x00,
0x43,0x64,
0x45,0x01,
0x46,0x08,
0x47,0xf5,
0x80,0x2e,
0x81,0x7e,
0x82,0x90,
0x83,0x30,
0x84,0x2c,
0x85,0x4b,
0x89,0x48,
0x90,0x0c,
0x91,0x0c,
0x92,0x48,
0x93,0x40,
0x98,0x38,
0x99,0x40,
0xa0,0x00,
0xa8,0x40,
0x03,0x02,
0x13,0x40,
0x14,0x04,
0x1a,0x00,
0x1b,0x08,
0x20,0x33,
0x21,0xaa,
0x22,0xa7,
0x23,0x32,
0x3b,0x48,
0x50,0x21,
0x52,0xa2,
0x53,0x0a,
0x54,0x30,
0x55,0x10,
0x56,0x0c,
0x59,0x0f,
0x60,0xca,
0x61,0xdb,
0x62,0xca,
0x63,0xda,
0x64,0xca,
0x65,0xda,
0x72,0xcb,
0x73,0xd8,
0x74,0xcb,
0x75,0xd8,
0x80,0x02,
0x81,0xbd,
0x82,0x24,
0x83,0x3e,
0x84,0x24,
0x85,0x3e,
0x92,0x72,
0x93,0x8c,
0x94,0x72,
0x95,0x8c,
0xa0,0x03,
0xa1,0xbb,
0xa4,0xbb,
0xa5,0x03,
0xa8,0x44,
0xa9,0x6a,
0xaa,0x92,
0xab,0xb7,
0xb8,0xc9,
0xb9,0xd0,
0xbc,0x20,
0xbd,0x28,
0xc0,0xde,
0xc1,0xec,
0xc2,0xde,
0xc3,0xec,
0xc4,0xe0,
0xc5,0xea,
0xc6,0xe0,
0xc7,0xea,
0xc8,0xe1,
0xc9,0xe8,
0xca,0xe1,
0xcb,0xe8,
0xcc,0xe2,
0xcd,0xe7,
0xce,0xe2,
0xcf,0xe7,
0xd0,0xc8,
0xd1,0xef,
0x03,0x10,
0x10,0x03,
0x11,0x43,
0x40,0x80,
0x41,0x00,
0x48,0x90,
0x50,0x48,
0x60,0x7f,
0x61,0x00,
0x62,0x9a,
0x63,0x90,
0x64,0x48,
0x66,0x90,
0x67,0x9e,
0x03,0x11,
0x10,0x25,
0x11,0x1f,
0x20,0x00,
0x21,0x38,
0x23,0x0a,
0x60,0x10,
0x61,0x82,
0x62,0x00,
0x63,0x83,
0x64,0x83,
0x67,0xf0,
0x68,0x30,
0x69,0x10,
0x03,0x12,
0x40,0xe9,
0x41,0x09,
0x50,0x18,
0x51,0x24,
0x70,0x1f,
0x71,0x00,
0x72,0x00,
0x73,0x00,
0x74,0x10,
0x75,0x10,
0x76,0x20,
0x77,0x80,
0x78,0x88,
0x79,0x18,
0xb0,0x7d,
0x03,0x13,
0x10,0x01,
0x11,0x89,
0x12,0x14,
0x13,0x19,
0x14,0x08,
0x20,0x04,
0x21,0x04,
0x23,0x30,
0x24,0x33,
0x25,0x08,
0x26,0x18,
0x27,0x00,
0x28,0x08,
0x29,0x90,
0x2a,0xe0,
0x2b,0x10,
0x2c,0x28,
0x2d,0x40,
0x2e,0x00,
0x2f,0x00,
0x30,0x11,
0x80,0x03,
0x81,0x07,
0x90,0x04,
0x91,0x04,
0x92,0x00,
0x93,0x20,
0x94,0x42,
0x95,0x60,
0x03,0x14,
0x10,0x01,
0x20,0x60,
0x21,0x80,
0x22,0x66,
0x23,0x50,
0x24,0x44,
0x03,0x15,
0x10,0x03,
0x14,0x3c,
0x16,0x2c,
0x17,0x2f,
0x30,0xcb,
0x31,0x61,
0x32,0x16,
0x33,0x23,
0x34,0xce,
0x35,0x2b,
0x36,0x01,
0x37,0x34,
0x38,0x75,
0x40,0x87,
0x41,0x18,
0x42,0x91,
0x43,0x94,
0x44,0x9f,
0x45,0x33,
0x46,0x00,
0x47,0x94,
0x48,0x14,
0x03,0x16,
0x30,0x00,
0x31,0x0a,
0x32,0x1b,
0x33,0x2e,
0x34,0x5c,
0x35,0x79,
0x36,0x97,
0x37,0xa7,
0x38,0xb5,
0x39,0xc3,
0x3a,0xcf,
0x3b,0xe1,
0x3c,0xf2,
0x3d,0xff,
0x3e,0xff,
0x03,0x17,
0xc4,0x3c,
0xc5,0x32,
0x03,0x20,
0x10,0x0c,
0x11,0x04,
0x20,0x01,
0x28,0x27,
0x29,0xa1,
0x2a,0xf0,
0x2b,0x34,
0x2c,0x2b,
0x30,0x78,
0x39,0x22,
0x3a,0xde,
0x3b,0x22,
0x3c,0xde,
0x60,0x95,
0x68,0x3c,
0x69,0x64,
0x6a,0x28,
0x6b,0xc8,
0x70,0x4a,
0x76,0x22,
0x77,0x02,
0x78,0x12,
0x79,0x27,
0x7a,0x23,
0x7c,0x1d,
0x7d,0x22,
0x83,0x00,
0x84,0xaf,
0x85,0xc8,
0x86,0x00,
0x87,0xfa,
0x88,0x02,
0x89,0xbf,
0x8a,0x20,
0x8b,0x3a,
0x8c,0x98,
0x8d,0x30,
0x8e,0xd4,
0x91,0x04,
0x92,0x91,
0x93,0xec,
0x94,0x01,
0x95,0xb7,
0x96,0x74,
0x98,0x8c,
0x99,0x23,
0x9c,0x06,
0x9d,0xd6,
0x9e,0x00,
0x9f,0xfa,
0xb1,0x14,
0xb2,0x50,
0xb4,0x14,
0xb5,0x38,
0xb6,0x26,
0xb7,0x20,
0xb8,0x1d,
0xb9,0x1b,
0xba,0x1a,
0xbb,0x19,
0xbc,0x19,
0xbd,0x18,
0xc0,0x1a,
0xc3,0x48,
0xc4,0x48,
0x03,0x22,
0x10,0xe2,
0x11,0x26,
0x20,0x34,
0x21,0x40,
0x30,0x80,
0x31,0x80,
0x38,0x12,
0x39,0x33,
0x40,0xf0,
0x41,0x55,
0x42,0x33,
0x43,0xf3,
0x44,0x88,
0x45,0x66,
0x46,0x02,
0x03,0x22,
0x10,0x6a,
0x80,0x38,
0x81,0x20,
0x82,0x30,
0x83,0x36,
0x84,0x30,
0x85,0x50,
0x86,0x44,
0x87,0x4d,
0x88,0x38,
0x89,0x3e,
0x8a,0x29,
0x8b,0x02,
0x8d,0x22,
0x8e,0x71,
0x8f,0x63,
0x90,0x60,
0x91,0x5c,
0x92,0x56,
0x93,0x52,
0x94,0x4c,
0x95,0x36,
0x96,0x31,
0x97,0x2e,
0x98,0x2a,
0x99,0x29,
0x9a,0x26,
0x9b,0x09,
0x03,0x22,
0x10,0xfb,
0x03,0x20,
0x10,0x9c,
0x03,0x22,
0x10,0x6a,
0x80,0x48,
0x81,0x20,
0x82,0x40,
0x83,0x58,
0x84,0x10,
0x85,0x70,
0x86,0x10,
0x10,0xea,
0x03,0x00,
0x01,0xf0,
0xff,0xff,
};
SENSOR_OP_SECTION const _Sensor_Adpt_ hi704_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 *)HI704InitTable,
.rotate_adapt = {0},
.hvb_adapt = {0},
.mclk = 24000000,
.p_fun_adapt = {NULL,NULL,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ hi704_init=
{
//id, w_cmd, r_cmd, addr_num, data_num, id_reg
0x96,0x60,0x61,0x01,0x01,0x04
};
#endif