Ejemplo n.º 1
0
int main(int argc, char **argv)
{
	char line[8];
	short int number;

	si2c_init();
	si2c_start();
	puts("ready");

	while (fgets(line, 8, stdin) != NULL) {
		if (sscanf(line, "%hi\n", &number) == 1) {
			if ((number >= 0) && (number <= 255)) {
				puts("tx");
				si2c_tx_byte(number);
			}
		}
		if (strcmp(line, "push\n") == 0) {
			puts("sig");
			si2c_stop();
		}
	}

	si2c_stop();
	si2c_deinit();
	return 0;
}
int mt9d113_sensor_init(struct msm_sensor_ctrl_t *s_ctrl)
{
	int rc = 0;
	//uint8_t data_buf[4];

	SKYCDBG("%s: E\n",__func__);



#if 1//needtocheck
	//sensor_mode = ??;//SENSOR_PREVIEW_MODE;

//	memset(mt9d113_params, 0, sizeof(mt9d113_params));

    //s_ctrl->sensor_i2c_client->client->adapter,
//	rc = si2c_init(s5k6aafx13_client->adapter, s5k6aafx13_const_params, s5k6aafx13_params);

#if 0
    rc = si2c_init(mt9d113_client->adapter, 
            mt9d113_const_params, mt9d113_params);
    
	if (!mt9d113_ctrl) {
		SKYCDBG("%s err(-ENOMEM)\n", __func__);
		goto sensor_init_fail;
	}
#endif


    rc = si2c_write_param(SI2C_SA, SI2C_INIT, mt9d113_params);
SKYCDBG("%s: si2c_write_param / rc:%d \n",__func__, rc);
    if (rc < 0)
        goto sensor_init_fail;

#endif
    sensor_mode = 1;

    SKYCDBG("%s: X\n",__func__);    
    return rc;
    
#if 1//needtocheck    
sensor_init_fail:

#if 0
	if (mt9d113_ctrl) {
		kfree(mt9d113_ctrl);
		mt9d113_ctrl = NULL;
	}
	(void)mt9d113_power_off();
	svreg_release(svregs, CAMV_MAX);
	sgpio_release(sgpios, CAMIO_MAX);
#endif    
SKYCDBG("%s: sensor_init_fail / si2c_release(); \n",__func__);
    si2c_release();
    
	SKYCDBG("%s err(%d)\n", __func__, rc);
	return rc;
#endif    
}
//mt9d113_sensor_power_up
int32_t mt9d113_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl)
{
    int32_t rc = 0;
    CDBG("%s E\n", __func__);

#if 1//
        memset(mt9d113_params, 0, sizeof(mt9d113_params));
    
        rc = si2c_init(mt9d113_client->adapter, 
                mt9d113_const_params, mt9d113_params);
    
#else
        mt9d113_ctrl = kzalloc(sizeof(mt9d113_ctrl_t), GFP_KERNEL);
        if (!mt9d113_ctrl) {
            pr_err("%s err(-ENOMEM)\n", __func__);
        }
        mt9d113_ctrl->sinfo = s_ctrl->sensordata;
#endif

    rc = msm_sensor_power_up(s_ctrl);
    CDBG(" %s : msm_sensor_power_up : rc = %d E\n",__func__, rc);  

    mt9d113_vreg_init();

    if (sgpio_ctrl(sgpios, CAMIO_R_RST_N, 0) < 0)	rc = -EIO;
    if (sgpio_ctrl(sgpios, CAMIO_R_STB_N, 0) < 0)	rc = -EIO;
    mdelay(1);

    if (sgpio_ctrl(sgpios, CAMIO_F_STB, 0) < 0)	rc = -EIO;
    if (sgpio_ctrl(sgpios, CAMIO_F_RST_N, 1) < 0)	rc = -EIO;
    mdelay(1);

    if (svreg_ctrl(svregs, CAMV_IO_1P8V, 1) < 0)	rc = -EIO;
    mdelay(2); /* > 1ms */
    if (svreg_ctrl(svregs, CAMV_CORE_1P8V, 1) < 0)	rc = -EIO;
    mdelay(1);
    //msm_camio_clk_rate_set(24000000);     //build error : undefined reference
#if 1
pr_err("%s: [wsyang_debug] msm_cam_clk_enable() / 1 \n", __func__);

msm_cam_clk_enable(&s_ctrl->sensor_i2c_client->client->dev,
    cam_mclk_info, &s_ctrl->cam_clk, ARRAY_SIZE(cam_mclk_info), 1);
#endif
    msleep(10); /* > 1 clk (approx. 0.042us) */
    if (sgpio_ctrl(sgpios, CAMIO_F_RST_N, 0) < 0)	rc = -EIO;
    /*PANTECH_CAMERA_TODO, reset was grounded with 10uF cap in WS20*/
    mdelay(10); /* > 10 clks (approx. 0.42us) */
    if (sgpio_ctrl(sgpios, CAMIO_F_RST_N, 1) < 0)	rc = -EIO;
    mdelay(1); /* > 1 clk (apporx. 0.042us) */
    if (svreg_ctrl(svregs, CAMV_A_2P8V, 1) < 0)	rc = -EIO;
    mdelay(2); /* > 6000 clks (approx. 252us) */

    current_fps = 31;

    CDBG("%s X (%d)\n", __func__, rc);
    return rc;
}
Ejemplo n.º 4
0
int mt9v113_sensor_init(struct msm_sensor_ctrl_t *s_ctrl)
{
	int rc = 0;

	memset(mt9v113_params, 0, sizeof(mt9v113_params));
	
	rc = si2c_init(s_ctrl->sensor_i2c_client->client->adapter, mt9v113_const_params, mt9v113_params);
	if (rc < 0) {
		printk("%s err(%d)\n", __func__, rc);
		si2c_release();		
		return rc;
	}	
	
	rc = si2c_write_param(SI2C_SA, SI2C_INIT, mt9v113_params);
	if (rc < 0) {
		printk("%s err(%d)\n", __func__, rc);
		si2c_release();		
		return rc;
	}	
	
	return rc;	
}
Ejemplo n.º 5
0
int s5k6aafx13_sensor_init(const struct msm_camera_sensor_info *sinfo)
{
	int rc = 0;

	CDBG("%s E\n", __func__);

	config_csi_done = false;
	sensor_mode = SENSOR_PREVIEW_MODE;

	memset(s5k6aafx13_params, 0, sizeof(s5k6aafx13_params));
#ifdef CONFIG_PANTECH_CAMERA_TUNER
	memset(s5k6aafx13_tuner_params, 0, sizeof(s5k6aafx13_tuner_params));
#endif

	//PANTECH_CAMERA_TODO, adapter 설정과 param 설정을 분리할 것. ugly 하다...
	rc = si2c_init(s5k6aafx13_client->adapter, 
			s5k6aafx13_const_params, s5k6aafx13_params);
	if (rc < 0)
		goto sensor_init_fail;

	s5k6aafx13_ctrl = kzalloc(sizeof(s5k6aafx13_ctrl_t), GFP_KERNEL);
	if (!s5k6aafx13_ctrl) {
		CERR("%s err(-ENOMEM)\n", __func__);
		goto sensor_init_fail;
	}

	if (sinfo)
		s5k6aafx13_ctrl->sinfo = sinfo;

	rc = sgpio_init(sgpios, CAMIO_MAX);
	if (rc < 0)
		goto sensor_init_fail;

	rc = svreg_init(svregs, CAMV_MAX);
	if (rc < 0)
		goto sensor_init_fail;

	rc = s5k6aafx13_power_on();
	if (rc < 0)
		goto sensor_init_fail;

#ifdef CONFIG_PANTECH_CAMERA_TUNER
	CERR("%s tuner is enabled, skip writing INIT param!\n", __func__);
#else
	rc = si2c_write_param(SI2C_SA, SI2C_INIT, s5k6aafx13_params);
	if (rc < 0)
		goto sensor_init_fail;
#endif

	CDBG("%s X\n", __func__);
	return 0;

sensor_init_fail:

	if (s5k6aafx13_ctrl) {
		kfree(s5k6aafx13_ctrl);
		s5k6aafx13_ctrl = NULL;
	}
	(void)s5k6aafx13_power_off();
	svreg_release(svregs, CAMV_MAX);
	sgpio_release(sgpios, CAMIO_MAX);
	si2c_release();

	CERR("%s err(%d)\n", __func__, rc);
	return rc;
}