Example #1
0
static ssize_t lm3533_bl_store_on_off(struct device *dev, 
				      struct device_attribute *attr,
				      const char *buf, 
				      size_t count)
{
	int on_off;
	struct i2c_client *client = to_i2c_client(dev); 
	struct lm3533_device *lm3533_dev = i2c_get_clientdata(client);

	if (!count) {
		dev_err(&client->dev, "Invalide arguemnt..\n");
		return -EINVAL;
	}
	
	dev_dbg(&client->dev, "previous backlight_status: %s\n", 
			lm3533_dev->bl_status ? "On" : "Off");
	
	on_off = simple_strtoul(buf, NULL, 10);
	
	dev_dbg(&client->dev, "stored argument is %d", on_off);
	
	if (on_off == 1) {
		mutex_lock(&lm3533dev->bl_mutex_saved);
		lm3533_backlight_on(client, lm3533_dev->saved_main_lcd_level);
		mutex_unlock(&lm3533dev->bl_mutex_saved);
	}
	else if (on_off == 0) {
		lm3533_backlight_off(client);
	}
	
	return count;

}
Example #2
0
static int lm3533_bl_resume(struct i2c_client *client)
{
#if defined(CONFIG_FB_MSM_MIPI_LGIT_CMD_WVGA_INVERSE_PT_PANEL) || \
    defined(CONFIG_FB_MSM_MIPI_LGIT_VIDEO_WVGA_INVERSE_PT_PANEL)
	lm3533_lcd_backlight_set_level(saved_main_lcd_level);
#else
    lm3533_backlight_on(saved_main_lcd_level);
#endif
    return 0;
}
static void lm3533_lcd_backlight_set_level(struct i2c_client *client, int level)
{
	if (level > LM3533_BL_MAX_BRIGHTNESS)
		level = LM3533_BL_MAX_BRIGHTNESS;

	if (client != NULL) {
		if (level == 0) {
			lm3533_backlight_off(client);
		} else {
			lm3533_backlight_on(client, level);
		}
	} else {
		printk("%s : No i2c client\n", __func__);
	}
}
Example #4
0
int lm3533_bl_onoff_ForHM(struct device *dev,int on_off)
{
	int ret=0;
	struct i2c_client *client = to_i2c_client(dev);
	struct lm3533_device *lm3533_dev = i2c_get_clientdata(client);

	if ((on_off == 1) && (lm3533_dev->bl_status == BL_OFF)) {
		lm3533_backlight_on(client, saved_level_for_ssd2825);
		ret=2;
	}
	else if ((on_off == 0) && (lm3533_dev->bl_status == BL_ON)) {
		saved_level_for_ssd2825=lm3533_dev->saved_main_lcd_level;
		lm3533_backlight_off(client);
		ret=1;
	}
	else if ((on_off == 0) && (lm3533_dev->bl_status == BL_OFF)) ret=0;
	else if ((on_off == 1) && (lm3533_dev->bl_status == BL_ON)) ret=0;

	return ret;
}
int lm3533_bl_custom_on_off(struct device *dev,int on_off)
{
	int ret = 0;
	struct i2c_client *client = to_i2c_client(dev);
	struct lm3533_device *lm3533_dev = i2c_get_clientdata(client);

	if ((on_off == 1) && (lm3533_dev->bl_status == BL_OFF)) {
		mutex_lock(&lm3533dev->bl_mutex_saved);
		lm3533_backlight_on(client, lm3533_dev->saved_main_lcd_level);
		mutex_unlock(&lm3533dev->bl_mutex_saved);
		ret = 2;
	} else if ((on_off == 0) && (lm3533_dev->bl_status == BL_ON)) {
		lm3533_backlight_off(client);
		ret = 1;
	}
	else if ((on_off == 0) && (lm3533_dev->bl_status == BL_OFF)) ret = 0;
	else if ((on_off == 1) && (lm3533_dev->bl_status == BL_ON)) ret = 0;

	return ret;
}
Example #6
0
void lm3533_lcd_backlight_set_level(int level)
{
	if (level > MAX_BRIGHTNESS_lm3533)
		level = MAX_BRIGHTNESS_lm3533;

	if (lm3533_i2c_client != NULL) {
		if (level == 0) {
#if defined(CONFIG_FB_MSM_MIPI_LGIT_CMD_WVGA_INVERSE_PT_PANEL) || \
    defined(CONFIG_FB_MSM_MIPI_LGIT_VIDEO_WVGA_INVERSE_PT_PANEL) || \
    !defined(CONFIG_HAS_EARLYSUSPEND)
			lm3533_backlight_off();
#else
			lm3533_backlight_off(h);
#endif
		} else {
			lm3533_backlight_on(level);
		}
	} else {
		pr_err("%s(): No client\n", __func__);
	}
}
Example #7
0
int lm3533_bl_onoff_ForHM(struct device *dev,int on_off)
{
	int ret=0;
	struct i2c_client *client = to_i2c_client(dev);
	struct lm3533_device *lm3533_dev = i2c_get_clientdata(client);

	//printk("%s *** on_off : %d , lm3533_dev->bl_status:%d , current level:%d, saved level:%d \n",
	//__func__, on_off, lm3533_dev->bl_status,lm3533_dev->cur_main_lcd_level,lm3533_dev->saved_main_lcd_level);
	if ((on_off == 1) && (lm3533_dev->bl_status == BL_OFF)) {
		lm3533_backlight_on(client, saved_level_for_ssd2825);
		ret=2;
	}
	else if ((on_off == 0) && (lm3533_dev->bl_status == BL_ON)) {
		saved_level_for_ssd2825=lm3533_dev->saved_main_lcd_level;
		lm3533_backlight_off(client);
		ret=1;
	}
	else if ((on_off == 0) && (lm3533_dev->bl_status == BL_OFF)) ret=0;
	else if ((on_off == 1) && (lm3533_dev->bl_status == BL_ON)) ret=0;

	return ret;
}