Exemple #1
0
static ssize_t hub_proxi_onoff_store(struct device *dev,  struct device_attribute *attr,  const char *buf, size_t count)
{
	int val;
	int ret;
	struct hub_proxi_data* data = dev_get_drvdata(dev);

	val = simple_strtoul(buf, NULL, 10);
	sscanf(buf, "%d", &ret);

	//sprintf(buf, "%d\n", atomic_read(&proxi_status));

	if(ret)	{
		hub_proxi_enable(data->client);
	//	enable_irq(data->client->irq);
		enable_irq_wake(gpio_to_irq(PROXI_OUT));
	}
	else {
	//	disable_irq(data->client->irq);
		disable_irq_wake(gpio_to_irq(PROXI_OUT));
		hub_proxi_disable(data->client);		
	}

	data->wakeup_while_sleep = (bool)ret;

	return 0;
}
Exemple #2
0
// 20100827 [email protected] [START_LGE]
int hub_proximity_check(void)
{
	int proximity_status;
	alarm_flip = ALARM_FLIP_ACTIVE;
	
//--[[ LGE_UBIQUIX_MODIFIED_START : [email protected] [2011.07.16] - flip_mode is added.
	int flip_mode = 0;

	if(!enabled) 
	{
		flip_mode = 1;
		hub_proxi_enable(hub_proximity_client);
		disable_irq(hub_proximity_client->irq);
	}
//--]] LGE_UBIQUIX_MODIFIED_END : [email protected] [2011.07.16]- flip_mode is added.
	proximity_status = hub_read_vo_bit(hub_proximity_client);

/* LGE_CHANGE_S, [email protected], 2011-04-06, Disable Proximity Log */
	//printk(KERN_DEBUG"[!]%s() - proximity status : %d\n", __func__, proximity_status);
/* LGE_CHANGE_E, [email protected], 2011-04-06, Disable Proximity Log */

//--[[ LGE_UBIQUIX_MODIFIED_START : [email protected] [2011.07.16] - proximity mode is added.
	if(flip_mode && proxi_mode == MODE_DEACTIVE)
//--]] LGE_UBIQUIX_MODIFIED_END : [email protected] [2011.07.16]- proximity mode is added.
		hub_proxi_disable(hub_proximity_client);	

//--[[ LGE_UBIQUIX_MODIFIED_START : [email protected] [2011.07.16] - proximity mode is added.
	flip_mode = 0;
//--]] LGE_UBIQUIX_MODIFIED_END : [email protected] [2011.07.16]- proximity mode is added.
	alarm_flip = ALARM_FLIP_DEACTIVE;
	
	return proximity_status;
}
Exemple #3
0
static ssize_t hub_proxi_onoff_store(struct device *dev,  struct device_attribute *attr,  const char *buf, size_t count)
{
	int val;
	int ret;
	struct hub_proxi_data* data = dev_get_drvdata(dev);

	val = simple_strtoul(buf, NULL, 10);
	sscanf(buf, "%d", &ret);

	//sprintf(buf, "%d\n", atomic_read(&proxi_status));

	if(ret)	{
		hub_proxi_enable(data->client);
		enable_irq(data->client->irq);
//--[[ LGE_UBIQUIX_MODIFIED_START : [email protected] [2011.07.16] - proximity_mode is added.
		proxi_mode = MODE_ACTIVE;
//--]] LGE_UBIQUIX_MODIFIED_END : [email protected] [2011.07.16]- proximity_mode is added.
	}
	else {
		disable_irq(data->client->irq);
		hub_proxi_disable(data->client);		
//--[[ LGE_UBIQUIX_MODIFIED_START : [email protected] [2011.07.16] - proximity_mode is added.
		proxi_mode = MODE_DEACTIVE;
//--]] LGE_UBIQUIX_MODIFIED_END : [email protected] [2011.07.16]- proximity_mode is added.
	}

	data->wakeup_while_sleep = (bool)ret;

	return count;
}
Exemple #4
0
// 20100827 [email protected] [START_LGE]
int hub_proximity_check(void)
{
	int proximity_status;
	alarm_flip = ALARM_FLIP_ACTIVE;
	
	hub_proxi_enable(hub_proximity_client);
	disable_irq(hub_proximity_client->irq);

	proximity_status = hub_read_vo_bit(hub_proximity_client);

	printk(KERN_DEBUG"[!]%s() - proximity status : %d\n", __func__, proximity_status);

	hub_proxi_disable(hub_proximity_client);	
	alarm_flip = ALARM_FLIP_DEACTIVE;
	
	return proximity_status;
}
Exemple #5
0
static int hub_proxi_suspend(struct i2c_client *client, pm_message_t mesg)
{
	struct hub_proxi_data *data = i2c_get_clientdata(client);

	if (!enabled) return 0;
	printk("%s\n", __FUNCTION__);
	if (atomic_read(&proxi_status)) return 0;
#if 0
	if (hrtimer_try_to_cancel(&data->timer) > 0) //timer is active
		hrtimer_cancel(&data->timer);
#endif
	if (data->wakeup_while_sleep)
	{
		printk("%s() wakeup_while_sleep.\n", __FUNCTION__);
		//		enable_irq(client->irq);
	}	
	else
		hub_proxi_disable(client);
	return 0;
}
Exemple #6
0
static int hub_proxi_remove(struct i2c_client *client)
{
	struct hub_proxi_data *data = i2c_get_clientdata(client);

	hub_proxi_disable(client);

	if (client->irq) {
		free_irq(client->irq, &client->dev);
		gpio_free(PROXI_OUT);
	}

	sysfs_remove_group(&client->dev.kobj, &hub_proxi_group);
	input_unregister_device(data->input_dev);
	kfree(data);
	i2c_set_clientdata(client, NULL);
/*LGE_CHANGE_S [[email protected]] 2010-01-04, ldoc control*/
#if defined(CONFIG_MACH_LGE_HEAVEN_REV_A) || defined(CONFIG_MACH_LGE_HUB)
	regulator_put(reg);
#endif
/*LGE_CHANGE_S [[email protected]] 2010-01-04, ldoc control*/
	return 0;
}
Exemple #7
0
static int hub_proxi_suspend(struct i2c_client *client, pm_message_t mesg)
{
	struct hub_proxi_data *data = i2c_get_clientdata(client);

	if (!enabled) return 0;
/* LGE_CHANGE_S, [email protected], 2011-04-06, Disable Proximity Log */
	//printk("%s\n", __FUNCTION__);
/* LGE_CHANGE_E, [email protected], 2011-04-06, Disable Proximity Log */
	if (atomic_read(&proxi_status)) return 0;
#if 0
	if (hrtimer_try_to_cancel(&data->timer) > 0) //timer is active
		hrtimer_cancel(&data->timer);
#endif
	if (data->wakeup_while_sleep)
	{
		printk("%s() wakeup_while_sleep.\n", __FUNCTION__);
		//		enable_irq(client->irq);
	}	
	else
		hub_proxi_disable(client);
	return 0;
}