static int sp0821_i2c_write(struct sp0821 *sp0821,
unsigned char reg_addr, unsigned char reg_data)
{
int ret = -1;
unsigned char cnt = 0;
while (cnt < 1) {
ret = i2c_smbus_write_byte_data(sp0821->i2c_client,
reg_addr, reg_data);
if (ret < 0) {
qvga_dev_err(sp0821->dev,
"%s: i2c_write cnt=%d error=%d\n", __func__,
cnt, ret);
} else {
break;
}
cnt++;
msleep(2);
}
return ret;
}static int sp0821_i2c_read(struct sp0821 *sp0821,
unsigned char reg_addr, unsigned char *reg_data)
{
int ret = -1;
unsigned char cnt = 0;
while (cnt < 1) {
ret = i2c_smbus_read_byte_data(sp0821->i2c_client, reg_addr);
if (ret < 0) {
qvga_dev_err(sp0821->dev,
"%s: i2c_read cnt=%d error=%d\n", __func__,
cnt, ret);
} else {
*reg_data = ret;
break;
}
cnt++;
msleep(2);
}
return ret;
}#if 1
void sp0821_Init(struct sp0821 *sp0821)
{
/*SYS*/
sp0821_i2c_write(sp0821, 0x30, 0x00);
qvga_dev_info(sp0821->dev, "%s zho0 sp0821 reg[0x30]\n", __func__);
sp0821_i2c_write(sp0821, 0x32, 0x00);
sp0821_i2c_write(sp0821, 0x03, 0x01);
sp0821_i2c_write(sp0821, 0x04, 0x2c);
sp0821_i2c_write(sp0821, 0x24, 0x80);
sp0821_i2c_write(sp0821, 0x9b, 0x32);
sp0821_i2c_write(sp0821, 0xd7, 0x00);
sp0821_i2c_write(sp0821, 0xc5, 0xc7);
sp0821_i2c_write(sp0821, 0xc6, 0xe2);
sp0821_i2c_write(sp0821, 0xe7, 0x03);
qvga_dev_info(sp0821->dev, "%s zho1 sp0821 reg[0xe7]\n", __func__);
sp0821_i2c_write(sp0821, 0x32, 0x00);
sp0821_i2c_write(sp0821, 0x32, 0x01);
sp0821_i2c_write(sp0821, 0x32, 0x00);
sp0821_i2c_write(sp0821, 0xbf, 0x0f);
sp0821_i2c_write(sp0821, 0xba, 0x5a);
sp0821_i2c_write(sp0821, 0xbb, 0x69);
sp0821_i2c_write(sp0821, 0xe7, 0x00);
sp0821_i2c_write(sp0821, 0x32, 0x07);
sp0821_i2c_write(sp0821, 0x31, 0x03);
sp0821_i2c_write(sp0821, 0x19, 0x04);
sp0821_i2c_write(sp0821, 0x2c, 0x0f);
sp0821_i2c_write(sp0821, 0x2e, 0x7c);
qvga_dev_info(sp0821->dev, "%s zho2 sp0821 reg[0x2e]\n", __func__);
sp0821_i2c_write(sp0821, 0x30, 0x00);
sp0821_i2c_write(sp0821, 0x28, 0x2e);
sp0821_i2c_write(sp0821, 0x29, 0x1f);
sp0821_i2c_write(sp0821, 0x0f, 0x30);
sp0821_i2c_write(sp0821, 0x14, 0xb0);
sp0821_i2c_write(sp0821, 0x38, 0x50);
sp0821_i2c_write(sp0821, 0x39, 0x52);
sp0821_i2c_write(sp0821, 0x3a, 0x60);
sp0821_i2c_write(sp0821, 0x3b, 0x10);
sp0821_i2c_write(sp0821, 0x3c, 0xe0);
sp0821_i2c_write(sp0821, 0x85, 0x01);
sp0821_i2c_write(sp0821, 0xe0, 0x02);
qvga_dev_info(sp0821->dev, "%s zho3 sp0821 reg[0xe0]\n", __func__);
sp0821_i2c_write(sp0821, 0xe5, 0x60);
sp0821_i2c_write(sp0821, 0xf5, 0x02);
sp0821_i2c_write(sp0821, 0xf1, 0x03);
sp0821_i2c_write(sp0821, 0xf3, 0x40);
sp0821_i2c_write(sp0821, 0x41, 0x00);
sp0821_i2c_write(sp0821, 0x05, 0x00);
sp0821_i2c_write(sp0821, 0x06, 0x00);
sp0821_i2c_write(sp0821, 0x07, 0x00);
sp0821_i2c_write(sp0821, 0x08, 0x00);
sp0821_i2c_write(sp0821, 0x09, 0x00);
sp0821_i2c_write(sp0821, 0x0a, 0x34);
sp0821_i2c_write(sp0821, 0x0D, 0x01);
sp0821_i2c_write(sp0821, 0xc8, 0x10);
sp0821_i2c_write(sp0821, 0x29, 0x1e);
qvga_dev_info(sp0821->dev, "%s zho4 sp0821 reg[0x29]\n", __func__);
sp0821_i2c_write(sp0821, 0xa2, 0x26);
sp0821_i2c_write(sp0821, 0xa3, 0x02);
sp0821_i2c_write(sp0821, 0xa4, 0x32);
sp0821_i2c_write(sp0821, 0xa5, 0x00);
sp0821_i2c_write(sp0821, 0xa8, 0x32);
sp0821_i2c_write(sp0821, 0xa9, 0x00);
sp0821_i2c_write(sp0821, 0xaa, 0x01);
sp0821_i2c_write(sp0821, 0xab, 0x00);
sp0821_i2c_write(sp0821, 0x4c, 0x80);
sp0821_i2c_write(sp0821, 0x4d, 0x80);
sp0821_i2c_write(sp0821, 0xa6, 0xf0);
sp0821_i2c_write(sp0821, 0xa7, 0x20);
sp0821_i2c_write(sp0821, 0xac, 0xf0);
sp0821_i2c_write(sp0821, 0xad, 0x20);
sp0821_i2c_write(sp0821, 0x8a, 0x3e);
qvga_dev_info(sp0821->dev, "%s zho5 sp0821 reg[0x8a]\n", __func__);
sp0821_i2c_write(sp0821, 0x8b, 0x30);
sp0821_i2c_write(sp0821, 0x8c, 0x2a);
sp0821_i2c_write(sp0821, 0x8d, 0x26);
sp0821_i2c_write(sp0821, 0x8e, 0x26);
sp0821_i2c_write(sp0821, 0x8f, 0x24);
sp0821_i2c_write(sp0821, 0x90, 0x24);
sp0821_i2c_write(sp0821, 0x91, 0x22);
sp0821_i2c_write(sp0821, 0x92, 0x22);
sp0821_i2c_write(sp0821, 0x93, 0x22);
sp0821_i2c_write(sp0821, 0x94, 0x20);
sp0821_i2c_write(sp0821, 0x95, 0x20);
sp0821_i2c_write(sp0821, 0x96, 0x20);
sp0821_i2c_write(sp0821, 0x17, 0x88);
sp0821_i2c_write(sp0821, 0x18, 0x80);
sp0821_i2c_write(sp0821, 0x4e, 0x78);
sp0821_i2c_write(sp0821, 0x4f, 0x78);
sp0821_i2c_write(sp0821, 0x58, 0x8a);
sp0821_i2c_write(sp0821, 0x59, 0xa8);
sp0821_i2c_write(sp0821, 0x5a, 0x80);
qvga_dev_info(sp0821->dev, "%s zho6 sp0821 reg[0x5a]\n", __func__);
sp0821_i2c_write(sp0821, 0xca, 0x00);
sp0821_i2c_write(sp0821, 0x86, 0x08);
sp0821_i2c_write(sp0821, 0x87, 0x0f);
sp0821_i2c_write(sp0821, 0x88, 0x30);
sp0821_i2c_write(sp0821, 0x89, 0x45);
sp0821_i2c_write(sp0821, 0x9e, 0x94);
sp0821_i2c_write(sp0821, 0x9f, 0x88);
sp0821_i2c_write(sp0821, 0x97, 0x84);
sp0821_i2c_write(sp0821, 0x98, 0x88);
sp0821_i2c_write(sp0821, 0x99, 0x74);
sp0821_i2c_write(sp0821, 0x9a, 0x84);
sp0821_i2c_write(sp0821, 0xa0, 0x7c);
sp0821_i2c_write(sp0821, 0xa1, 0x78);
sp0821_i2c_write(sp0821, 0x9d, 0x09);
sp0821_i2c_write(sp0821, 0xB1, 0x04);
sp0821_i2c_write(sp0821, 0xb3, 0x00);
qvga_dev_info(sp0821->dev, "%s zho7 sp0821 reg[0xb3]\n", __func__);
sp0821_i2c_write(sp0821, 0x47, 0x40);
sp0821_i2c_write(sp0821, 0xb8, 0x04);
sp0821_i2c_write(sp0821, 0xb9, 0x28);
sp0821_i2c_write(sp0821, 0x3f, 0x18);
sp0821_i2c_write(sp0821, 0xc1, 0xff);
sp0821_i2c_write(sp0821, 0xc2, 0x40);
sp0821_i2c_write(sp0821, 0xc3, 0xff);
sp0821_i2c_write(sp0821, 0xc4, 0x40);
sp0821_i2c_write(sp0821, 0xc5, 0xc7);
sp0821_i2c_write(sp0821, 0xc6, 0xe2);
sp0821_i2c_write(sp0821, 0xc7, 0xef);
sp0821_i2c_write(sp0821, 0xc8, 0x10);
sp0821_i2c_write(sp0821, 0x50, 0x2a);
sp0821_i2c_write(sp0821, 0x51, 0x2a);
sp0821_i2c_write(sp0821, 0x52, 0x2f);
sp0821_i2c_write(sp0821, 0x53, 0xcf);
sp0821_i2c_write(sp0821, 0x54, 0xd0);
qvga_dev_info(sp0821->dev, "%s zho8 sp0821 reg[0x54]\n", __func__);
sp0821_i2c_write(sp0821, 0x5c, 0x1e);
sp0821_i2c_write(sp0821, 0x5d, 0x21);
sp0821_i2c_write(sp0821, 0x5e, 0x1a);
sp0821_i2c_write(sp0821, 0x5f, 0xe9);
sp0821_i2c_write(sp0821, 0x60, 0x98);
sp0821_i2c_write(sp0821, 0xcb, 0x3f);
sp0821_i2c_write(sp0821, 0xcc, 0x3f);
sp0821_i2c_write(sp0821, 0xcd, 0x3f);
sp0821_i2c_write(sp0821, 0xce, 0x85);
sp0821_i2c_write(sp0821, 0xcf, 0xff);
sp0821_i2c_write(sp0821, 0x79, 0x5a);
sp0821_i2c_write(sp0821, 0x7a, 0xDC);
sp0821_i2c_write(sp0821, 0x7b, 0x0A);
sp0821_i2c_write(sp0821, 0x7c, 0xFD);
sp0821_i2c_write(sp0821, 0x7d, 0x46);
sp0821_i2c_write(sp0821, 0x7e, 0xFD);
sp0821_i2c_write(sp0821, 0x7f, 0xFD);
sp0821_i2c_write(sp0821, 0x80, 0xEF);
sp0821_i2c_write(sp0821, 0x81, 0x54);
qvga_dev_info(sp0821->dev, "%s zho9 sp0821 reg[0x81]\n", __func__);
sp0821_i2c_write(sp0821, 0x1b, 0x0a);
sp0821_i2c_write(sp0821, 0x1c, 0x0f);
sp0821_i2c_write(sp0821, 0x1d, 0x15);
sp0821_i2c_write(sp0821, 0x1e, 0x15);
sp0821_i2c_write(sp0821, 0x1f, 0x15);
sp0821_i2c_write(sp0821, 0x20, 0x1f);
sp0821_i2c_write(sp0821, 0x21, 0x2a);
sp0821_i2c_write(sp0821, 0x22, 0x2a);
sp0821_i2c_write(sp0821, 0x56, 0x49);
sp0821_i2c_write(sp0821, 0x1a, 0x14);
sp0821_i2c_write(sp0821, 0x34, 0x1f);
sp0821_i2c_write(sp0821, 0x82, 0x10);
sp0821_i2c_write(sp0821, 0x83, 0x00);
qvga_dev_info(sp0821->dev, "%s zho10 sp0821 reg[0x83]\n", __func__);
sp0821_i2c_write(sp0821, 0x84, 0xff);
sp0821_i2c_write(sp0821, 0xd7, 0x50);
sp0821_i2c_write(sp0821, 0xd8, 0x1a);
sp0821_i2c_write(sp0821, 0xd9, 0x20);
sp0821_i2c_write(sp0821, 0xc9, 0x1f);
sp0821_i2c_write(sp0821, 0xbf, 0x33);
sp0821_i2c_write(sp0821, 0xba, 0x37);
sp0821_i2c_write(sp0821, 0xbb, 0x38);
qvga_dev_info(sp0821->dev, "%s zho11 sp0821 reg[0xbb]\n", __func__);
} /* sensor_init */
#endifint sp0821_GetSensorID(struct sp0821 *sp0821)
{
int retry = 5;
int len;
unsigned char reg_data = 0x00;
//check if sensor ID correct
do {
len = sp0821_i2c_read(sp0821, 0x02, ®_data);
qvga_dev_err(sp0821->dev, "drv-%s: Read MSB Sensor ID sucess = 0x%02x\n", __func__, reg_data);
// if (reg_data == SP0821_SENSOR_ID) {
if (1) {
qvga_dev_err(sp0821->dev, "drv-%s: Read Sensor ID sucess = 0x%02x\n", __func__, reg_data);
driver_flag = 1;
return 0;
} else {
qvga_dev_err(sp0821->dev, "rv-%s: Read Sensor ID Fail = 0x%02x\n", __func__, reg_data);
driver_flag = 0;
}
mdelay(10);
retry--;
} while (retry > 0);
return -1;
}
static void sp0821_hw_on_reset(struct sp0821 *sp0821)
{
qvga_dev_info(sp0821->dev, "%s enter\n", __func__);
if (gpio_is_valid(sp0821->reset_gpio)) {
gpio_set_value_cansleep(sp0821->reset_gpio, 0);
udelay(50);
gpio_set_value_cansleep(sp0821->reset_gpio, 1);
udelay(100);
gpio_set_value_cansleep(sp0821->reset_gpio, 0);
}
}static ssize_t sp0821_get_light(struct device *dev,
struct device_attribute *attr, char *buf)
{
ssize_t len = 0;
unsigned char reg_data = 0x00;
int length;
//struct sp0821 *sp0821 = dev_get_drvdata(dev);
length = sp0821_i2c_read(g_sp0821, 0xb0, ®_data);
len += snprintf(buf + len, PAGE_SIZE - len, "%d\n",
reg_data);
return len;
}这几个函数老是导致编译报下面这个错误
/work/oppo_V08200385/code/AB5_24053_0704/source/vnd/kernel-5.15
"CONFIG_MICROTRUST_TEE_SUPPORT=m"
"CONFIG_MICROTRUST_TZ_DRIVER=m"
"CONFIG_MICROTRUST_VFS_DRIVER=m"
"CONFIG_MICROTRUST_FP_DRIVER=m"
"CONFIG_MICROTRUST_DEBUG="
"CONFIG_MICROTRUST_TEST_DRIVERS="
"-----------CONFIG_MTPROF=m"
"-----------MICROTRUST_TZ_DRIVER_MTK_BOOTPROF="
"whf src=drivers/tee/teei/500"
"whf subdir-ccflags-y=-I/work/oppo_V08200385/code/AB5_24053_0704/source/vnd/kernel-5.15/drivers/tee/teei/500/common/include"
"whf ccflags-y="
"=----------------1---------------------------"
"=----------------2---------------------------"
imgsensor-virt-sensor-objs : imgsensor-glue.o
/work/oppo_V08200385/code/AB5_24053_0704/source/vnd/kernel-5.15/drivers/misc/mediatek/imgsensor/qvga_cam/sp0821/sp_sp0821_yuv.c:671:50: error: too few arguments to function call, expected 3, have 2
reg_data = sp0821_i2c_read(g_sp0821, databuf[0]);
~~~~~~~~~~~~~~~ ^
/work/oppo_V08200385/code/AB5_24053_0704/source/vnd/kernel-5.15/drivers/misc/mediatek/imgsensor/qvga_cam/sp0821/sp_sp0821_yuv.c:157:12: note: 'sp0821_i2c_read' declared here
static int sp0821_i2c_read(struct sp0821 *sp0821,
^
1 error generated.
make[4]: *** [/work/oppo_V08200385/code/AB5_24053_0704/source/vnd/kernel-5.15/scripts/Makefile.build:296: drivers/misc/mediatek/imgsensor/qvga_cam/sp0821/sp_sp0821_yuv.o] Error 1
make[3]: *** [/work/oppo_V08200385/code/AB5_24053_0704/source/vnd/kernel-5.15/scripts/Makefile.build:569: drivers/misc/mediatek/imgsensor/qvga_cam/sp0821] Error 2
make[3]: *** 正在等待未完成的任务....
make[2]: *** [/work/oppo_V08200385/code/AB5_24053_0704/source/vnd/kernel-5.15/scripts/Makefile.build:569: drivers/misc/mediatek] Error 2
make[1]: *** [/work/oppo_V08200385/code/AB5_24053_0704/source/vnd/kernel-5.15/scripts/Makefile.build:569: drivers/misc] Error 2
make: *** [/work/oppo_V08200385/code/AB5_24053_0704/source/vnd/kernel-5.15/Makefile:1984: drivers] Error 2
ninja: remote build result sql [INSERT INTO ninja_remote_build (host_name, start_time,end_time,target_product, aosp_build_id,component_name,time_cost,remote_hit,remote_build,remote_fail,total_edge,slow_edge,ip,fs_type,end_reason) VALUES ('dg03podv08200385jxpc','2025-07-05 20:50:00','2025-07-05 20:52:21','krn_mgk_64_entry_level_k515','TP1A.220905.001','todo','141','0','0','0','97','1','地址:10.234.69.157','ext4','fail')]
ninja: build stopped: subcommand failed.
SCM.IT: make krn_images ... failed, result is 1.
SCM.IT: mk_android runtime: 00:02:25
SCM.IT: ####### mk_android ####### END
parse_log:151 -INFO: ===== OPLUS TRACES START ====
Traceback (most recent call last):
File "/work/oppo_V08200385/code/AB5_24053_0704/source/vnd/vendor/oplus/build/ci/trace/parse_error.py", line 210, in <module>
main()
File "/work/oppo_V08200385/code/AB5_24053_0704/source/vnd/vendor/oplus/build/ci/trace/parse_error.py", line 202, in main
parse_log()
File "/work/oppo_V08200385/code/AB5_24053_0704/source/vnd/vendor/oplus/build/ci/trace/parse_error.py", line 155, in parse_log
commit.setCommit(item)
File "/work/oppo_V08200385/code/AB5_24053_0704/source/vnd/vendor/oplus/build/ci/trace/commitInfo.py", line 98, in setCommit
requestCommit = self.requestCommitData(local_commit)
File "/work/oppo_V08200385/code/AB5_24053_0704/source/vnd/vendor/oplus/build/ci/trace/commitInfo.py", line 225, in requestCommitData
comment_list = json.loads(comment_data)
File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
SCM.IT: mk_android failed, result is 1.
V08200385@dg03podv08200385jxpc:~/code/AB5_24053_0704/source/vnd$ ^C
V08200385@dg03podv08200385jxpc:~/code/AB5_24053_0704/source/vnd$ 怎么解决?