Esempio n. 1
0
static void lm3533_backlight_on(struct i2c_client *client, int level)
{
	struct lm3533_device *dev = i2c_get_clientdata(client);

	dev_dbg(&client->dev, "backlight on...\n");

	lm3533_hw_reset(dev);

	lm3533_bl_write_reg(client, 0x10, 0x0); //HVLED 1 & 2 are controlled by Bank A

#if defined(ENABLE_PWM_SIGNAL)        
	lm3533_bl_write_reg(client, 0x14, 0x1); //                                                                 
#else
	lm3533_bl_write_reg(client, 0x14, 0x0); //PWM input is disabled for CABC
#endif
	lm3533_bl_write_reg(client, 0x1A, 0x2); //Linear & Control Bank A is configured for register Current control
	lm3533_bl_write_reg(client, 0x27, 0x1); //Control Bank A is enable
#if !defined(CONFIG_MACH_HD5_LGD)        
	lm3533_bl_write_reg(client, 0x2C, 0x0A); //                                                                                   
#else
	lm3533_bl_write_reg(client, 0x2C, 0x0C); //Active High, OVP(24V), Boost Frequency(500 khz)  
#endif

	lm3533_set_main_current_level(client, level);

	//                                                                                          
		
	dev->bl_status = BL_ON;

	return;
}
Esempio n. 2
0
static int bl_set_intensity(struct backlight_device *bd)
{

	struct i2c_client *client = to_i2c_client(bd->dev.parent);

	lm3533_set_main_current_level(client, bd->props.brightness);
	cur_main_lcd_level = bd->props.brightness;

	return 0;
}
Esempio n. 3
0
static void lm3533_lcd_backlight_set_maxcurrent(struct i2c_client *client,
		int level)
{
	struct lm3533_device *dev = i2c_get_clientdata(client);

	if (level > LM3533_BL_MAX_MAXCURRENT)
		level = LM3533_BL_MAX_MAXCURRENT;
	if (level < LM3533_BL_MIN_MAXCURRENT)
		level = LM3533_BL_MIN_MAXCURRENT;

	dev->cur_maxcurrent = level;
	lm3533_set_main_current_level(client, dev->saved_main_lcd_level);
}
Esempio n. 4
0
static void leds_brightness_set(struct led_classdev *led_cdev, enum led_brightness value)
{
	struct lm3533_device *drvdata = dev_get_drvdata(led_cdev->dev->parent);

	if (!drvdata) {
		printk("Error getting drvier data\n");
		return;
	}

	mutex_lock(&lm3533dev->bl_mutex_saved);
	drvdata->saved_main_lcd_level = value;
	lm3533_set_main_current_level(drvdata->client, value);
	mutex_unlock(&lm3533dev->bl_mutex_saved);
}
Esempio n. 5
0
void lm3533_backlight_off(struct early_suspend * h)
#endif
{
	int gpio = main_lm3533_dev->gpio;

	if (backlight_status == BL_OFF)
		return;
	saved_main_lcd_level = cur_main_lcd_level;
	lm3533_set_main_current_level(main_lm3533_dev->client, 0);
	backlight_status = BL_OFF;

	gpio_direction_output(gpio, 0);
	msleep(6);

	return;
}
Esempio n. 6
0
void lm3533_backlight_on(int level)
{

#if defined(CONFIG_HAS_EARLYSUSPEND) && \
	(defined(CONFIG_FB_MSM_MIPI_LGIT_CMD_WVGA_INVERSE_PT_PANEL) || \
	defined(CONFIG_FB_MSM_MIPI_LGIT_VIDEO_WVGA_INVERSE_PT_PANEL))

	if(is_early_suspended)
	{
		requested_in_early_suspend_lcd_level = level;
		return;
	}
#endif /* CONFIG_HAS_EARLYSUSPEND */
	if (backlight_status == BL_OFF) {

		lm3533_hw_reset();
		lm3533_write_reg(main_lm3533_dev->client, 0x10, 0x0); /* HVLED 1 & 2 are controlled by Bank A */

/*           
                                                           
                                      
  */
#if defined(CONFIG_LGE_BACKLIGHT_CABC)
		lm3533_write_reg(main_lm3533_dev->client, 0x14, 0x1); 	/* PWM input is enabled */
#else
		lm3533_write_reg(main_lm3533_dev->client, 0x14, 0x0); 	/* PWM input is disabled */
#endif
		lm3533_write_reg(main_lm3533_dev->client, 0x1A, 0x00);	/* Linear & Control Bank A is configured for register Current control */
		lm3533_write_reg(main_lm3533_dev->client, 0x1F, 0x13); /* Full-Scale Current (20.2mA) */
		lm3533_write_reg(main_lm3533_dev->client, 0x27, 0x1); 	/* Control Bank A is enable */
#if defined(CONFIG_FB_MSM_MIPI_LGIT_CMD_WVGA_INVERSE_PT_PANEL) || \
	defined(CONFIG_FB_MSM_MIPI_LGIT_VIDEO_WVGA_INVERSE_PT_PANEL)
		lm3533_write_reg(main_lm3533_dev->client, 0x2C, 0xC); /* Active High, OVP(32V), Boost Frequency(500khz) */
		lm3533_write_reg(main_lm3533_dev->client, 0x12, 0x9); /* START UP/SHUTDOWN TRANSITION */
		lm3533_write_reg(main_lm3533_dev->client, 0x13, 0x9); /* RUN-TIME TRANSITION */
#else
		lm3533_write_reg(main_lm3533_dev->client, 0x2C, 0xE); /*Active High, OVP(40V), Boost Frequency(500khz) */
#endif

	}

	lm3533_set_main_current_level(main_lm3533_dev->client, level);
	backlight_status = BL_ON;

	return;
}
Esempio n. 7
0
static ssize_t lcd_backlight_store_level(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
	int level;
	struct i2c_client *client = to_i2c_client(dev);

	if (!count)
		return -EINVAL;

	level = simple_strtoul(buf, NULL, 10);

	if (level > MAX_BRIGHTNESS_lm3533)
		level = MAX_BRIGHTNESS_lm3533;

	lm3533_set_main_current_level(client, level);
	cur_main_lcd_level = level;

	return count;
}
Esempio n. 8
0
static void lm3533_backlight_off(struct i2c_client *client)
{
	struct lm3533_device *dev = i2c_get_clientdata(client);
	int gpio = dev->hwen_gpio;

	if (dev->bl_status == BL_OFF) {
		dev_dbg(&client->dev, "Already turned off\n");
		return;
	}

	dev_dbg(&client->dev, "backlight off...\n");

	lm3533_set_main_current_level(client, 0);

	gpio_set_value(gpio, 0);

	dev->bl_status = BL_OFF;

	mdelay(10);
}
Esempio n. 9
0
static void lm3533_backlight_on(struct i2c_client *client, int level)
{
	struct lm3533_device *dev = i2c_get_clientdata(client);

	dev_dbg(&client->dev, "backlight on...\n");

	lm3533_hw_reset(dev);

	lm3533_bl_write_reg(client, 0x10, 0x0); //HVLED 1 & 2 are controlled by Bank A

	lm3533_bl_write_reg(client, 0x14, 0x0); //PWM input is disabled for CABC
	lm3533_bl_write_reg(client, 0x1A, 0x2); //Linear & Control Bank A is configured for register Current control
	lm3533_bl_write_reg(client, 0x1F, dev->cur_maxcurrent); //Full-Scale Current (default 20.2mA)
	lm3533_bl_write_reg(client, 0x27, 0x1); //Control Bank A is enable
	lm3533_bl_write_reg(client, 0x2C, 0x0A); //Active High, OVP(24V), Boost Frequency(500 khz)

	lm3533_set_main_current_level(client, level);

	dev->bl_status = BL_ON;

	return;
}
Esempio n. 10
0
void lm3533_backlight_off(struct early_suspend * h)
#endif
{
	int gpio = main_lm3533_dev->gpio;

	pr_info("%s, on: %d\n", __func__, backlight_status);

	mutex_lock(&backlight_mtx);
	if (backlight_status == BL_OFF){
		mutex_unlock(&backlight_mtx);
		return;
	}
	saved_main_lcd_level = cur_main_lcd_level;
	lm3533_set_main_current_level(main_lm3533_dev->client, 0);
	backlight_status = BL_OFF;

	gpio_direction_output(gpio, 0);
	msleep(6);
	mutex_unlock(&backlight_mtx);

	return;
}