static int camdrv_ss_sr030pc50_get_iso_speed_rate(struct v4l2_subdev *sd)
{
    struct i2c_client *client = v4l2_get_subdevdata(sd);
    unsigned short read_value = 0;
    int GainValue = 0;
	 unsigned char read_chvalue=0;
    int isospeedrating = 100;
 //   int rows_num_=0;

    camdrv_ss_i2c_write_2_bytes(client, 0x03, 0x20);
     camdrv_ss_i2c_read_1_byte(client, 0xb0, &read_chvalue);
    read_value = (unsigned short)read_chvalue;
//    camdrv_ss_i2c_read_1_byte(client, 0xb0, &read_value);

    CAM_INFO_PRINTK("%s, read_value =%x \n",__func__,read_value);

    GainValue = read_value / 16;

    CAM_INFO_PRINTK("%s, read_value =%d, GainValue = %d \n",__func__,read_value, GainValue);

    if(GainValue < 0.875)
    {
        isospeedrating = 50;
    }
    else if(GainValue < 1.75)
    {
        isospeedrating = 100;
    }
    else if(GainValue < 4.625)
    {
        isospeedrating = 200;
    }
    else if(GainValue < 6.9375)
    {
        isospeedrating = 400;
    }
    else if(GainValue < 13.875)
    {
        isospeedrating = 800;
    }
    else
    {
        isospeedrating = 1600;
    }

    CAM_INFO_PRINTK("camdrv_ss_sr030pc50_get_iso_speed_rate, GainValue =%d, isospeedrating =%d\n", GainValue, isospeedrating );       

    return isospeedrating;
		}
static float camdrv_ss_sr030pc50_get_exposureTime(struct v4l2_subdev *sd)
{
    struct i2c_client *client = v4l2_get_subdevdata(sd);
    unsigned int read_value1=0,read_value2=0,read_value3=0;
    int exposureTime = 0;

    camdrv_ss_i2c_write_2_bytes(client, 0x03, 0x20);

    camdrv_ss_i2c_read_1_byte(client, 0x80, &read_value1);
    camdrv_ss_i2c_read_1_byte(client, 0x81, &read_value2);
    camdrv_ss_i2c_read_1_byte(client, 0x82, &read_value3);

    exposureTime = (read_value1 << 19 | read_value2 << 11 | read_value3<<3);
    CAM_INFO_PRINTK("%s, exposureTime =%d \n",__func__,exposureTime);
    return exposureTime;
		}
int camdrv_ss_sr030pc50_set_preview_start(struct v4l2_subdev *sd)
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct camdrv_ss_state *state = to_state(sd);
	int err = 0;

	unsigned int read_value1=0,read_value2=0,read_value3=0,read_value4=0,read_value5=0,read_value6=0;
	unsigned char read_chvalue1=0,read_chvalue2=0,read_chvalue3=0,read_chvalue4=0,read_chvalue5=0,read_chvalue6=0;
	int Exptime=0,Expmax=0;

	CAM_INFO_PRINTK( "%s :\n", __func__);

	if (!state->pix.width || !state->pix.height) {
		CAM_ERROR_PRINTK( "%s : width or height is NULL!!!\n",__func__);
		return -EINVAL;
	}

	if (state->mode_switch == PICTURE_CAPTURE_TO_CAMERA_PREVIEW_RETURN) {
        // do nothing
	}

	if(state->mode_switch == CAMERA_PREVIEW_TO_CAMCORDER_PREVIEW)
	{
/*
			if ( (ARRAY_SIZE(sr030pc50_fps_auto_normal_regs) != NULL ) ||(ARRAY_SIZE(sr030pc50_fps_auto_Dark_regs) != NULL))
				{
				camdrv_ss_i2c_write_2_bytes(client, 0x03, 0x20);
				 camdrv_ss_i2c_write_2_bytes(client, 0x10, 0x1C);
		 
	    		 camdrv_ss_i2c_read_1_byte(client, 0x80, &read_value1);
          	    	 camdrv_ss_i2c_read_1_byte(client, 0x81, &read_value2);
               		camdrv_ss_i2c_read_1_byte(client, 0x82, &read_value3);
		        Exptime = (read_value1) << 16 | (read_value2)<<8 | read_value3;
	
	        
    			 camdrv_ss_i2c_read_1_byte(client, 0xA0, &read_value4);
			 camdrv_ss_i2c_read_1_byte(client, 0xA1, &read_value5);
    			 camdrv_ss_i2c_read_1_byte(client, 0xA2, &read_value6);	
			 Expmax = (read_value4) << 16 |(read_value5)<<8 | read_value6; // 50 hz

		if( Exptime <  Expmax )
		{
			err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_auto_normal_regs, ARRAY_SIZE(sr030pc50_fps_auto_normal_regs), "fps_auto_normal_regs");
		}		
		else
		{
			err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_auto_Dark_regs, ARRAY_SIZE(sr030pc50_fps_auto_Dark_regs), "fps_auto_Dark_regs");
		}

		//err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_auto_regs, ARRAY_SIZE(sr030pc50_fps_auto_regs), "fps_auto_regs");
		if (err < 0) {
			CAM_ERROR_PRINTK( "%s :sr030pc50_fps_auto_regs IS FAILED\n",__func__);
			return -EIO;
		}
				}*/
        // do nothing
       		 /* Fixed FPS */
//			if (ARRAY_SIZE(sr030pc50_fps_auto_regs)!= NULL)
//				err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_auto_regs, ARRAY_SIZE(sr030pc50_fps_auto_regs), "fps_auto_regs");			
		//	else if (ARRAY_SIZE(sr030pc50_fps_30_regs) != NULL)
		//		err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_30_regs, ARRAY_SIZE(sr030pc50_fps_30_regs), "fps_30_regs");
		if (ARRAY_SIZE(sr030pc50_fps_25_regs) != (int)NULL)
				err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_25_regs, ARRAY_SIZE(sr030pc50_fps_25_regs), "fps_25_regs");
			else if (ARRAY_SIZE(sr030pc50_fps_20_regs) !=(int) NULL)
				err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_20_regs, ARRAY_SIZE(sr030pc50_fps_20_regs), "fps_20_regs");
			else if (ARRAY_SIZE(sr030pc50_fps_15_regs) !=(int) NULL)
				err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_15_regs, ARRAY_SIZE(sr030pc50_fps_15_regs), "fps_15_regs");
			else
				CAM_ERROR_PRINTK("%s : Fixed FPS setting is not supported for 30,25,20,15 fps !!\n", __func__);

			if (err < 0) {
				CAM_ERROR_PRINTK("%s : Fixed FPS setting is FAILED !!\n", __func__);
				return -EIO;
			}
	}
	else if(state->mode_switch == INIT_DONE_TO_CAMCORDER_PREVIEW)
	{
        // do nothing
	}
	else if(state->mode_switch == CAMCORDER_PREVIEW_TO_CAMERA_PREVIEW)
	{
		camdrv_ss_i2c_write_2_bytes(client, 0x03, 0x20);
		 camdrv_ss_i2c_write_2_bytes(client, 0x10, 0x1C);
		 
    		  camdrv_ss_i2c_read_1_byte(client, 0x80, &read_chvalue1);
          	    	 camdrv_ss_i2c_read_1_byte(client, 0x81, &read_chvalue2);
               		camdrv_ss_i2c_read_1_byte(client, 0x82, &read_chvalue3);
			
			read_value1 = (unsigned short)read_chvalue1;
			read_value2 = (unsigned short)read_chvalue2;
			read_value3 = (unsigned short)read_chvalue3;
	        Exptime = (read_value1) << 16 | (read_value2)<<8 | read_value3;
	
	        
    			 camdrv_ss_i2c_read_1_byte(client, 0xA0, &read_chvalue4);
			 camdrv_ss_i2c_read_1_byte(client, 0xA1, &read_chvalue5);
    			 camdrv_ss_i2c_read_1_byte(client, 0xA2, &read_chvalue6);

		read_value4 = (unsigned short)read_chvalue4;
		read_value5 = (unsigned short)read_chvalue5;
		read_value6 = (unsigned short)read_chvalue6;
		 			 	
		 Expmax = (read_value4) << 16 |(read_value5)<<8 | read_value6; // 50 hz

		if( Exptime <  Expmax )
		{
			err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_auto_normal_regs, ARRAY_SIZE(sr030pc50_fps_auto_normal_regs), "fps_auto_normal_regs");
		}		
		else
		{
			err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_auto_Dark_regs, ARRAY_SIZE(sr030pc50_fps_auto_Dark_regs), "fps_auto_Dark_regs");
		}

		//err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_auto_regs, ARRAY_SIZE(sr030pc50_fps_auto_regs), "fps_auto_regs");
		if (err < 0) {
			CAM_ERROR_PRINTK( "%s :sr030pc50_fps_auto_regs IS FAILED\n",__func__);
			return -EIO;
		}
		
		
	}

/*
	err = camdrv_ss_set_preview_size(sd);
	if (err < 0) {
		CAM_ERROR_PRINTK( "%s : camdrv_ss_set_preview_size is FAILED !!\n", __func__);
		return -EIO;
	}
	
*/
	state->camera_flash_fire = 0;
	state->camera_af_flash_checked = 0;

	if (state->check_dataline) { /* Output Test Pattern */
		err = camdrv_ss_set_dataline_onoff(sd, 1);
		if (err < 0) {
			CAM_ERROR_PRINTK( "%s : check_dataline is FAILED !!\n", __func__);
			return -EIO;
		}
	}

	return 0;
}