Пример #1
0
static bool isl29023_read_lux(struct i2c_client *client, int *lux, int *lux2)
{
	int lux_data;
	int lux_data_remaing;
	struct isl29023_chip *chip = i2c_get_clientdata(client);

	lux_data = isl29023_read_sensor_input(client, COMMMAND1_OPMODE_ALS_ONCE);
	if (lux_data > 0) {
		*lux = (lux_data * chip->range) >> chip->adc_bit;
		check_proper_range(chip, *lux);
		lux_data_remaing=(((lux_data * chip->range) & 0xffff)*10) >> chip->adc_bit;
		*lux2 = lux_data_remaing>9?9:lux_data_remaing;
                if (machine_is_avalon() || machine_is_sphinx())
                {
                    if ( *lux < 1 )
                    {
                        if ( *lux2 <= 5 )
                        {
                            if ( ast_mt9d115_led_get_state () > 0 )
                                *lux2 = 0;
                        }
                            
                    }
                }
		return true;
	}
Пример #2
0
static bool isl29023_read_lux(struct i2c_client *client, int *lux, int *lux2)
{
	int lux_data;
	int lux_data_remaing;
	struct isl29023_chip *chip = i2c_get_clientdata(client);

	lux_data = isl29023_read_sensor_input(client, COMMMAND1_OPMODE_ALS_ONCE);
	if (lux_data > 0) {
		*lux = (lux_data * chip->range) >> chip->adc_bit;
		check_proper_range(chip, *lux);
		lux_data_remaing=(((lux_data * chip->range) & 0xffff)*10) >> chip->adc_bit;
		*lux2 = lux_data_remaing>9?9:lux_data_remaing;
#if 0                
                if ( *lux < 1 )
                {
                    if ( *lux2 <= 5 )
                    {
                        if ( ast_mt9d115_led_get_state () > 0 )
                            *lux2 = 0;
                    }

                }
#endif                
                chip->next_timer = get_jiffies_64() + CONVERSION_TIME_MS * HZ / 1000;
                chip->event_ready = 1;
		return true;
	}