Esempio n. 1
0
void ce131_sensor_power_init(void)
{
	u8 data;

	if (!lp8720_init()) {
		data = 0x5;	
		lp8720_write(lp8720_i2c_client, GENERAL_SETTINGS_REG, data);
		data = 0x79;	
		lp8720_write(lp8720_i2c_client, LDO1_SETTINGS_REG, data);		
		data = 0x79;	
		lp8720_write(lp8720_i2c_client, LDO2_SETTINGS_REG, data);	
		data = 0x6c;
		lp8720_write(lp8720_i2c_client, LDO3_SETTINGS_REG, data);	
		data = 0x71;
		lp8720_write(lp8720_i2c_client, LDO4_SETTINGS_REG, data);	
		data = 0x7d;	
		lp8720_write(lp8720_i2c_client, LDO5_SETTINGS_REG, data);	
		data = 0xb;	
		lp8720_write(lp8720_i2c_client, BUCK_SETTINGS1_REG, data);	
		data = 0x9;	
		lp8720_write(lp8720_i2c_client, BUCK_SETTINGS2_REG, data);	
		data = 0xbf;
		lp8720_write(lp8720_i2c_client, ENABLE_BITS_REG, data);	
		data = 0x3f;
		lp8720_write(lp8720_i2c_client, PULLDOWN_BITS_REG, data);	
		data = 0x03;
		lp8720_write(lp8720_i2c_client, INTERRUPT_MASK_REG, data);	
	}
}
static int __init lp8720_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
	if (i2c_get_clientdata(client))
		return -EBUSY;

	lp8720_client = client;
	lp8720_init(client);

    return 0;
}
static int lp8720_resume(struct i2c_client *client)
{
	/*if sdcard is inserted, power must be alive*/
	if (lp8720_output_status & 0x01) {
		return 0;
	}

	lp8720_init();

	return 0;
}
Esempio n. 4
0
static int lp8720_resume(struct i2c_client *client)
{
#if !defined(CONFIG_PRODUCT_LGE_KU5900)&& !defined(CONFIG_PRODUCT_LGE_LS855)
	/*if sdcard is inserted, power must be alive*/
	if (lp8720_output_status & 0x01) {
		return 0;
	}

	lp8720_init();
#endif

	return 0;
}
static int __init lp8720_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
	struct lp8720_platform_data *pdata;

	if (i2c_get_clientdata(client))
		return -EBUSY;

	pdata = client->dev.platform_data;
	gpio_request(pdata->en_gpio_num, "lp8720");

	lp8720_client = client;
	lp8720_init();

	printk("$$$$$$$$$$$$$$$ lp8720 $$$$$$$$$$$$\n");

	return 0;
}
void subpm_output_enable(void)
{
	u8 data;
	struct lp8720_platform_data *pdata;

	if(lp8720_client == NULL)
	{
		printk(KERN_ERR "%s lp8720_client NULL\n", __func__);
		return;
	}

	pdata = lp8720_client->dev.platform_data;

#if 0
	lp8720_read_reg(lp8720_client, LP8720_GENERAL_SETTING, &data);
	printk(KERN_ERR "%s GENERAL_SETTING %02x\n", __func__, data);
	lp8720_read_reg(lp8720_client, LP8720_OUTPUT_ENABLE, &data);
	printk(KERN_ERR "%s OUTPUT_ENABLE %02x\n", __func__, data);
	lp8720_read_reg(lp8720_client, LP8720_LDO1_SETTING, &data);
	printk(KERN_ERR "%s LDO1_SETTING %02x\n", __func__, data);
	lp8720_read_reg(lp8720_client, LP8720_LDO2_SETTING, &data);
	printk(KERN_ERR "%s LDO2_SETTING %02x\n", __func__, data);
	lp8720_read_reg(lp8720_client, LP8720_LDO3_SETTING, &data);
	printk(KERN_ERR "%s LDO3_SETTING %02x\n", __func__, data);
	lp8720_read_reg(lp8720_client, LP8720_LDO4_SETTING, &data);
	printk(KERN_ERR "%s LDO4_SETTING %02x\n", __func__, data);
	lp8720_read_reg(lp8720_client, LP8720_LDO5_SETTING, &data);
	printk(KERN_ERR "%s LDO5_SETTING %02x\n", __func__, data);
	lp8720_read_reg(lp8720_client, LP8720_BUCK_SETTING1, &data);
	printk(KERN_ERR "%s BUCK_SETTING1 %02x\n", __func__, data);
	lp8720_read_reg(lp8720_client, LP8720_BUCK_SETTING2, &data);
	printk(KERN_ERR "%s BUCK_SETTING2 %02x\n", __func__, data);
#endif

	lp8720_write_reg(lp8720_client, LP8720_OUTPUT_ENABLE, 0x80 | lp8720_output_status);

	/* <*****@*****.**> recover settings after thermal shutdown or any reset */
#if 0
	lp8720_read_reg(lp8720_client, LP8720_LDO5_SETTING, &data);
	//printk(KERN_ERR "LP8720_LDO5_SETTING %02x\n", data);
	if (data == 0xff) {
		lp8720_init();
		printk(KERN_ERR "%s LP8720 registers recovered.\n", __func__);
	}
#endif
}
Esempio n. 7
0
void subpm_set_output(subpm_output_enum outnum, int onoff)
{
  
	struct lp8720_platform_data *pdata;

	if(lp8720_client == NULL)
	{
		printk(KERN_ERR "[lp8720] %s lp8720_client NULL\n", __func__);
		return;
	}
  
	if(outnum > 5) {
		dev_err(&lp8720_client->dev, "[lp8720] outnum error\n");
		return;
	}  

	if(onoff == 0)
		lp8720_output_status &= ~(1<<outnum);
	else
		lp8720_output_status |= (1<<outnum);


	pdata = lp8720_client->dev.platform_data;
	lp8720_write_reg(lp8720_client, LP8720_OUTPUT_ENABLE, 0x80 | lp8720_output_status);
  udelay(10);

/*                                                                            */
#if 0
	lp8720_read_reg(lp8720_client, LP8720_LDO5_SETTING, &data);
	//printk(KERN_ERR "LP8720_LDO5_SETTING %02x\n", data);
	if (data == 0xff) {
		lp8720_init();
		printk(KERN_ERR "%s LP8720 registers recovered.\n", __func__);
	}
#endif

}
Esempio n. 8
0
void subpm_set_gpio(int onoff)
{
  struct lp8720_platform_data *pdata = lp8720_client->dev.platform_data;
  
  if(onoff == 0 && lp8720_gpio_status == 1)
  {    
    gpio_direction_output(pdata->en_gpio_num, 0);
    udelay(10);
    gpio_set_value(pdata->en_gpio_num, 0);     
    lp8720_gpio_status = 0;
    pr_info("[lp8720] power off\n");
    udelay(100);
  }
  else if(onoff == 1 && lp8720_gpio_status == 0)
  {
    gpio_direction_output(pdata->en_gpio_num, 1);
    udelay(10);
    gpio_set_value(pdata->en_gpio_num, 1); 
    lp8720_gpio_status = 1;
    pr_info("[lp8720] power on\n");
    udelay(100);
    lp8720_init();
  }
}
Esempio n. 9
0
void lp8720_reinit()
{
    printk(KERN_INFO "$$$$$$$$$$$$$$$ lp8720_reinit $$$$$$$$$$$$\n");	
	 lp8720_init();

}