static int Test_Al3010_SensorI2C(struct i2c_client *apClient)
{
	int err = 0;
	int lnResult = I2C_TEST_PASS;

	i2c_log_in_test_case("Test_Al3010_SensorI2C++\n");
	
	if( g_AlsP01ProbeError == 0 && g_bIsP01Attached )	{
		set_current_state(TASK_INTERRUPTIBLE);
		schedule_timeout(msecs_to_jiffies(100));

		if (!g_HAL_als_switch_on)	{
			err = set_als_power_state_of_P01(1);
			if ( err < 0 )	{
				i2c_log_in_test_case("Fail to turn on al3010 lsensor\n");
				lnResult = I2C_TEST_FAIL_SENSOR;
			}
			err = al3010_get_adc_value(apClient);
			if ( err < 0 )	{
				i2c_log_in_test_case("Fail to read al3010 data\n");
				lnResult = I2C_TEST_FAIL_SENSOR;
			}
			else	{
				err = set_als_power_state_of_P01(0);
				if ( err < 0 )	{
					i2c_log_in_test_case("Fail to turn off al3010 lsensor\n");
					lnResult = I2C_TEST_FAIL_SENSOR;
				}
			}
		}
		else	{
			err = al3010_get_adc_value(apClient);
			if ( err < 0 )	{
				i2c_log_in_test_case("Fail to read al3010 data\n");
				lnResult = I2C_TEST_FAIL_SENSOR;
			}
			else	{
				err = set_als_power_state_of_P01(0);
				if ( err < 0 )	{
					i2c_log_in_test_case("Fail to turn off al3010 lsensor\n");
					lnResult = I2C_TEST_FAIL_SENSOR;
				}
			}
		}
	}else	{
		i2c_log_in_test_case("Fail to lsensor test\n");
		lnResult = I2C_TEST_FAIL_SENSOR;
	}

	i2c_log_in_test_case("Test_Al3010_SensorI2C--\n");

	return lnResult;
};
static void  al3010_poll_data(struct work_struct * work)
{
	int lux = al3010_get_adc_value(al3010_client);
	//printk("FOR TEST , al3010_poll_data light sensor lux = %d\n",lux);
	if(poll_mode ==0)
		msleep(5);

	queue_delayed_work(sensor_work_queue, &al3010_poll_data_work, poll_mode);
}
/* lux */
static ssize_t al3010_show_lux(struct device *dev,
				 struct device_attribute *attr, char *buf)
{
	struct i2c_client *client = to_i2c_client(dev);

	al3010_later_init(client);

	return sprintf(buf, "%d\n", al3010_get_adc_value(client));
}
/* default lux */
static ssize_t al3010_show_default_lux(struct device *dev,
				 struct device_attribute *attr, char *buf)
{
	struct i2c_client *client = to_i2c_client(dev);

        al3010_later_init(client);
    int show_lux_value = al3010_get_adc_value(client);
    int show_default_lux_value = (show_lux_value*calibration_regs)/default_calibration_regs;
	return sprintf(buf, "%d\n", show_default_lux_value);
}
// for none parallel light
static ssize_t al3010_show_revise_lux(struct device *dev,
				 struct device_attribute *attr, char *buf)
{
	struct i2c_client *client = to_i2c_client(dev);
	if (al3010_get_power_state(client) != 0x01){
		int ret = al3010_later_init(client);
		if(ret != 0){
			return sprintf(buf, "%d\n", -1);
		}
	}

	//+++ wait al3010 wake up
	if(light_sensor_ready == false){
		int tmp_lux = al3010_get_adc_value(client);
		if( tmp_lux > 0){
			light_sensor_ready = true;
			catch_first_poll_time = true;
		}else if(catch_first_poll_time == false){
			do_gettimeofday(&t_first_poll_time);
			catch_first_poll_time = true;
			printk("light sensor debug : al3010 first poll timestamp , tv_sec = %d\n",t_first_poll_time.tv_sec);
			printk("light sensor debug : al3010 first poll timestamp , tv_usec = %d\n",t_first_poll_time.tv_usec);
			return sprintf(buf, "%d\n", -1);
		}else{
			struct timeval t_current_time;
			int diff_time = 0;
			do_gettimeofday(&t_current_time);

			printk("light sensor debug : al3010 current timestamp , tv_sec = %d\n",t_current_time.tv_sec);
			printk("light sensor debug : al3010 current timestamp , tv_usec = %d\n",t_current_time.tv_usec);

			diff_time = ( (t_current_time.tv_sec-t_first_poll_time.tv_sec)*1000000 + (t_current_time.tv_usec-t_first_poll_time.tv_usec) )/1000;
			if(diff_time > time_for_sensor_ready){
				light_sensor_ready = true;
			}else{
				return sprintf(buf, "%d\n", -1);
			}
		}
	}
	//---
	int revise_lux = al3010_get_adc_value(client)*2;
	//+++ filter noise value in range lux < 10
	if( (last_revise_lux >= 0) && (last_revise_lux < 10) ){
		bool is_noise = true;
		if( (revise_lux >= 10) && (revise_lux <= 30) ){
			// check first time & check require update lux
			if(catch_first_poll_noise_time){
				struct timeval t_current_noise_time;
				int diff_noise_time = 0;
				do_gettimeofday(&t_current_noise_time);
				diff_noise_time = ( (t_current_noise_time.tv_sec-t_first_poll_noise_time.tv_sec)*1000000 +
						(t_current_noise_time.tv_usec-t_first_poll_noise_time.tv_usec) )/1000;
				if( diff_noise_time > noise_waiting_time ){
					is_noise  = false;
				}
			}else{
				catch_first_poll_noise_time = true;
				do_gettimeofday(&t_first_poll_noise_time);
			}

			if( is_noise ){
				revise_lux = last_revise_lux;
			}
		}else{
			if( revise_lux > 30 ){
				printk("light sensor debug : al3010 stop filter noise lux > 30 , lux = %d\n",revise_lux);
			}
			// reset first time check
			catch_first_poll_noise_time = false;
		}

	}
        //---
	last_revise_lux = revise_lux;
	//+++ add thresholds for reading light sensor event
	if ( last_report_lux > -1 ){
		int diffValue = revise_lux - last_report_lux;
		if( revise_lux < 100 ){
			if( (diffValue < 5) && (diffValue > -5) )
				revise_lux = last_report_lux;
		}else if( revise_lux >= 100 && revise_lux < 1000 ){
			if( (diffValue < 50) && (diffValue > -50) )
				revise_lux = last_report_lux;
		}else if( revise_lux >= 1000 && revise_lux < 10000 ){
			if( (diffValue < 100) && (diffValue > -100) )
				revise_lux = last_report_lux;
		}else if( revise_lux >= 10000 ){
			if( (diffValue < 500) && (diffValue > -500) )
				revise_lux = last_report_lux;
		}
	}
	last_report_lux = revise_lux;
	//---
	return sprintf(buf, "%d\n", revise_lux );
}