Exemple #1
0
static void lm3530_backlight_on(struct i2c_client *client, int level)
{
	struct lm3530_device *dev = i2c_get_clientdata(client);

	mutex_lock(&backlight_mtx);
	if (backlight_status == BL_OFF) {
		pr_info("%s, ++ lm3530_backlight_on  \n",__func__);
		lm3530_hw_reset(client);

		lm3530_write_reg(dev->client, 0xA0, 0x00);
		lm3530_write_reg(dev->client, 0x10, 
			(pwm_status == BL_OFF) ? dev->max_current & 0x1F 
                               : dev->max_current );
	}

	if (first_boot) {
		lm3530_write_reg(dev->client, 0x10, 
			(pwm_status == BL_OFF) ? dev->max_current & 0x1F 
                               : dev->max_current );
		first_boot = false;
	}

	lm3530_set_main_current_level(dev->client, level);
	backlight_status = BL_ON;
	mutex_unlock(&backlight_mtx);
}
static void lm3530_wakeup(struct lm3530_driver_data *drvdata)
{
//	unsigned int lm3530_intensity;

	if (!drvdata || drvdata->state == NORMAL_STATE)
		return;

	dprintk("operation mode is %s\n", (drvdata->mode == NORMAL_MODE) ? "normal_mode" : "alc_mode");

	bl_config_gpio(1);
	lm3530_hw_reset(drvdata);

	if (drvdata->state == POWEROFF_STATE) {
		lm3530_poweron(drvdata);
		/* LGE_CHANGE
		 * Because the lm3530_go_opmode is called in the lm3530_poweron above, so I remove below function.
		 * If it is called two times when the previous state of AAT2862 is POWEROFF_STATE, it causes malfucction.
		 * 2010-07-31. [email protected]
		 */
		//lm3530_go_opmode(drvdata);
	} else if (drvdata->state == SLEEP_STATE) {
		if (drvdata->mode == NORMAL_MODE) {
				lm3530_set_table(drvdata, drvdata->cmds.normal);
				lm3530_write(drvdata->client, drvdata->reg_addrs.bl_m, drvdata->intensity);
			drvdata->state = NORMAL_STATE;
		} else if (drvdata->mode == ALC_MODE) {
			/* LGE_CHANGE
			 * Remove ALC mode
			 * 2010-07-26. [email protected]
			 */
			//lm3530_set_table(drvdata, drvdata->cmds.alc);
			//drvdata->state = NORMAL_STATE;
		}
	}
}
void lm3530_backlight_on(int level)
{

	if (backlight_status == BL_OFF) {
		msleep(17);
		printk("%s, ++ lm3530_backlight_on  \n",__func__);
		lm3530_hw_reset();

		lm3530_write_reg(main_lm3530_dev->client, 0xA0, 0x00);
		/* reset 0 brightness */
		lm3530_write_reg(main_lm3530_dev->client, 0x10,
				main_lm3530_dev->max_current);
		lm3530_write_reg(main_lm3530_dev->client, 0x30, 0x00);
		/* fade in, out */

		/* msleep(100); */
	}

	/* printk("%s received (prev backlight_status: %s)\n",
	 * __func__, backlight_status?"ON":"OFF");*/
	lm3530_set_main_current_level(main_lm3530_dev->client, level);
	backlight_status = BL_ON;

	return;
}
Exemple #4
0
static int lm3530_probe(struct i2c_client *i2c_dev, const struct i2c_device_id *id)
{
	struct backlight_platform_data *pdata;
	struct lm3530_device *dev;
	struct backlight_device *bl_dev;
	struct backlight_properties props;
	int err;

	printk(KERN_INFO"%s: i2c probe start\n", __func__);

	pdata = i2c_dev->dev.platform_data;
	lm3530_i2c_client = i2c_dev;

	dev = kzalloc(sizeof(struct lm3530_device), GFP_KERNEL);
	if(dev == NULL) {
		dev_err(&i2c_dev->dev,"fail alloc for lm3530_device\n");
		return 0;
	}

	main_lm3530_dev = dev;

	memset(&props, 0, sizeof(struct backlight_properties));
	props.max_brightness = MAX_LEVEL_BL;

	props.type = BACKLIGHT_PLATFORM;

	bl_dev = backlight_device_register(I2C_BL_NAME, &i2c_dev->dev, NULL, &lm3530_bl_ops, &props);
	bl_dev->props.max_brightness = MAX_LEVEL_BL;
	bl_dev->props.brightness = DEFAULT_LEVEL;
	bl_dev->props.power = FB_BLANK_UNBLANK;

	dev->bl_dev = bl_dev;
	dev->client = i2c_dev;
	dev->gpio = pdata->gpio;
	dev->max_current = pdata->max_current;
	dev->min_brightness = pdata->min_brightness;
	dev->max_brightness = pdata->max_brightness;
	i2c_set_clientdata(i2c_dev, dev);

	if(dev->gpio && gpio_request(dev->gpio, "lm3530 reset") != 0) {
		return -ENODEV;
	}
	mutex_init(&dev->bl_mutex);


	err = device_create_file(&i2c_dev->dev, &dev_attr_lm3530_level);
	err = device_create_file(&i2c_dev->dev, &dev_attr_lm3530_backlight_on_off);

#ifdef CONFIG_HAS_EARLYSUSPEND
        lm3530_suspension.bl_lm3530_early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB;
        lm3530_suspension.bl_lm3530_early_suspend.suspend = bl_early_suspend;
        lm3530_suspension.bl_lm3530_early_suspend.resume = bl_early_resume;
        register_early_suspend(&lm3530_suspension.bl_lm3530_early_suspend);
	lm3530_suspension.suspended = 0;
#endif

	lm3530_hw_reset();
	return 0;
}
Exemple #5
0
void lm3530_backlight_on(int level)
{
	if (backlight_status == LM3530_BL_OFF) {
		lm3530_hw_reset();
		lm3530_write_reg(main_lm3530_dev->client, 0x10, 0xB5);
		lm3530_write_reg(main_lm3530_dev->client, 0x30, 0x09); 
	}
	backlight_status = LM3530_BL_ON;
	return;
}
static void lm3530_device_init(struct lm3530_driver_data *drvdata)
{
/* LGE_CHANGE.
  * Do not initialize aat28xx when system booting. The aat28xx is already initialized in oemsbl or LK !!
  * 2010-08-16, [email protected]
  */
	if (system_state == SYSTEM_BOOTING) {
		lm3530_go_opmode(drvdata);
		return;
	}
	lm3530_hw_reset(drvdata);
	lm3530_go_opmode(drvdata);
}
Exemple #7
0
void lm3530_backlight_on(int level)
{
	if (lm3530_suspension.suspended)
		return;

	if(backlight_status == BL_OFF){
		lm3530_hw_reset();

		lm3530_write_reg(main_lm3530_dev->client, 0xA0, 0x00); //reset 0 brightness
		lm3530_write_reg(main_lm3530_dev->client, 0x10, main_lm3530_dev->max_current);
#ifndef CONFIG_LGIT_VIDEO_CABC
		lm3530_write_reg(main_lm3530_dev->client, 0x30, 0x2d); //fade in, out
#endif
	}

	lm3530_set_main_current_level(main_lm3530_dev->client, level);
	backlight_status = BL_ON;

	return;
}