Esempio n. 1
0
/*
 * Module initialization
 */
static S32 __init CamacqCoreInit(void)
{
    int iRet = 0;
    CamacqTraceIN();

    CreateCamacqSensorManager( &g_pstCamacqSensorManager );

#if (CAM_SENSOR_NUM==2)//swsw_dual
    g_pstCamacqSensorManager->SetSensor( g_pstCamacqSensorManager, CAMACQ_SENSOR_SUB );
	//g_pstCamacqSensorManager->SetSensor( g_pstCamacqSensorManager, CAMACQ_SENSOR_MAIN ); //Test purpose only
   // iRet = i2c_add_driver( &CamacqSubDriver );
	printk("i2c add sub\n");
	iRet = i2c_add_driver( &CamacqSubDriver ); //test purpose only
    CamacqTraceDbg( " : sub iRet[%d]", iRet );
#endif /* CAMACQ_SENSOR_MAX==2 */
    g_pstCamacqSensorManager->SetSensor( g_pstCamacqSensorManager, CAMACQ_SENSOR_MAIN );
    CamacqTraceDbg( "driver_name=%s", CamacqMainDriver.driver.name);
    iRet = i2c_add_driver( &CamacqMainDriver );
    CamacqTraceDbg( " :main iRet[%d]", iRet );


	// attach pxa950_camera.c
    ccic_sensor_attach( g_pstCamacqSensorManager );
	
    CamacqTraceOUT();
Esempio n. 2
0
static int __devinit CamacqCoreProbe( struct i2c_client *pClient, const struct i2c_device_id * d )
{
    int iRet;
    _stCamacqSensor* pstSensor = g_pstCamacqSensorManager->GetSensor( g_pstCamacqSensorManager, 
                                                                    g_pstCamacqSensorManager->m_uiSelectedSensor );

    CamacqTraceIN();

    // 0. set up i2c client
    pstSensor->m_pI2cClient = pClient;
    CamacqTraceDbg( "pClient : %x, name : %s", (U32)pClient, pClient->name );

    // 1. detect sensor	
    iRet = pstSensor->m_pstAPIs->Detect( pstSensor );
    if( iRet )
    {
        CamacqTraceErr( " : fail to detect sensor !!!!!" );
        iRet = -ENODEV;
    }
    else 
    {
        CamacqTraceDbg( " : success to detect sensor !!!!!" );
    }

    CamacqTraceOUT();

    return 0;
}
static void __exit CamacqCoreExit(void)
{
    CamacqTraceIN();

    i2c_del_driver(&CamacqMainDriver);

#if (CAMACQ_SENSOR_MAX==2)
    i2c_del_driver(&CamacqSubDriver);
#endif /* CAMACQ_SENSOR_MAX==2 */

    CamacqTraceOUT();
}
static int __devinit CamacqCoreProbe( struct i2c_client *pClient, const struct i2c_device_id * d )
{
    int iRet;
    _stCamacqSensor* pstSensor = g_pstCamacqSensorManager->GetSensor( g_pstCamacqSensorManager, 
                                                                    g_pstCamacqSensorManager->m_uiSelectedSensor );
		int retry = 0;
    CamacqTraceIN();

    // 0. set up i2c client
    pstSensor->m_pI2cClient = pClient;
    CamacqTraceDbg( "pClient : %x, name : %s", (U32)pClient, pClient->name );
LABEL_RETRY:
// #if (CAMACQ_MAIN_FS_MODE == 0)
    // 1. detect sensor	
    iRet = pstSensor->m_pstAPIs->Detect( pstSensor );
    if( iRet )
    {
        CamacqTraceErr( " : fail to detect sensor !!!!!" );
#ifdef _CAM_DEBUG_V4L2OPEN_
	g_cam_cdev.detect_fail++;
#endif
	retry++;
	if (retry < 10) {
		goto LABEL_RETRY;
	}
        //force_v4l2_unregister();
        
        iRet = -ENODEV;
    }
    else 
    {
        CamacqTraceDbg( " : success to detect sensor !!!!!" );
    }
// #endif

    CamacqTraceOUT();

    return 0;
}
/*
 * Module initialization
 */
static S32 __init CamacqCoreInit(void)
{
    int iRet = 0;
    CamacqTraceIN();

    CreateCamacqSensorManager( &g_pstCamacqSensorManager );

    // attach pxa950_camera.c
    ccic_sensor_attach( g_pstCamacqSensorManager );

#if (CAMACQ_SENSOR_MAX==2)
    g_pstCamacqSensorManager->SetSensor( g_pstCamacqSensorManager, CAMACQ_SENSOR_SUB );
    iRet = i2c_add_driver( &CamacqSubDriver );
    CamacqTraceDbg( " : iRet[%d]", iRet );
#endif /* CAMACQ_SENSOR_MAX==2 */

    g_pstCamacqSensorManager->SetSensor( g_pstCamacqSensorManager, CAMACQ_SENSOR_MAIN );
    iRet = i2c_add_driver( &CamacqMainDriver );
    CamacqTraceDbg( " : iRet[%d]", iRet );

    CamacqTraceOUT();

    return iRet;
}
static int CamacqCoreRemove( struct i2c_client *pClient )
{
	CamacqTraceIN();
	CamacqTraceOUT();
	return 0;	//TODO
}