//Main jobs: // 1.check for device-specified errors, device not ready. // 2.Initialize the device if it is opened for the first time. // 3.Update f_op pointer. // 4.Fill data structures into private_data //CAM_RESET static int AF_Open(struct inode * a_pstInode, struct file * a_pstFile) { LOG_INF("Start \n"); if(g_s4AF_Opened) { LOG_INF("The device is opened \n"); return -EBUSY; } spin_lock(&g_AF_SpinLock); g_s4AF_Opened = 1; spin_unlock(&g_AF_SpinLock); I2C_func_POFF_____( ); // reset the IC I2C_func_PON______( ); // Power ON func_INITIALIZE( ); // initialize the IC func_ReLOAD_FACT_DATA( ); // ReLoad Adjustment Data I2C_func_DSP_START( ); // CLAF Function Enable EQ_CONTROL( 0x0004 ); LOG_INF("End \n"); return 0; }
void init_drv(void) { I2C_func_POFF_____( ); // reset the IC I2C_func_PON______( ); // Power ON func_INITIALIZE( ); // initialize the IC func_ReLOAD_FACT_DATA( ); // ReLoad Adjustment Data I2C_func_DSP_START( ); // CLAF Function Enable EQ_CONTROL( 0x0004 ); }