void amoled_brightness_set(struct led_classdev *led_cdev,
			enum led_brightness val)
{
	led_cdev->brightness = val;

	mutex_lock(&panel_lock);
	new_val = val;
	amoled_set_gamma_val(new_val);
	mutex_unlock(&panel_lock);
}
static int amoled_panel_unblank(struct msm_lcdc_panel_ops *panel_data)
{
	LCMDBG("%s\n", __func__);

	wake_lock(&panel_idle_lock);
	mutex_lock(&panel_lock);
	amoled_set_gamma_val(last_level);
	/* Display on */
	qspi_send_9bit(&unblank_msg);
	mutex_unlock(&panel_lock);
	wake_unlock(&panel_idle_lock);

	LCMDBG("%s: last_level = %d\n", __func__, last_level);
	led_trigger_event(amoled_lcd_backlight, LED_FULL);
	return 0;
}
static int amoled_panel_unblank(struct platform_device *pdev)
{
	LCMDBG("%s\n", __func__);

        if (samsung_oled_panel_init())
          printk(KERN_ERR "samsung_oled_panel_init failed\n");

	wake_lock(&panel_idle_lock);
	mutex_lock(&panel_lock);
	amoled_set_gamma_val(last_level);
	/* Display on */
	qspi_send_9bit(&unblank_msg);
	mutex_unlock(&panel_lock);
	wake_unlock(&panel_idle_lock);

	LCMDBG("%s: last_level = %d\n", __func__, last_level);
	led_trigger_event(amoled_lcd_backlight, LED_FULL);
	return 0;
}
void samsung_brightness_set(struct led_classdev *led_cdev,
			enum led_brightness val)
{
	uint8_t new_level;
	if(val < 30)
		new_level = 0;
	else if (val <= LED_FULL / (SAMSUNG_OLED_NUM_LEVELS - 1))
		new_level = 1;
	else
		new_level = (val * (SAMSUNG_OLED_NUM_LEVELS - 1)) / LED_FULL;

	if(last_level == new_level)
		return;
	else {
		LCMDBG("set brightness = (%d, %d)\n", new_level, val);
		mutex_lock(&panel_lock);
		amoled_set_gamma_val(new_level);
		mutex_unlock(&panel_lock);
	}
}
static int amoled_panel_unblank(struct msm_lcdc_panel_ops *panel_data)
{
	LCMDBG("%s\n", __func__);

	wake_lock(&panel_idle_lock);

	table_sel_idx = 0;
	mutex_lock(&panel_lock);
	gamma_table_bank_select();
	amoled_set_gamma_val(last_val);
	qspi_send(0, 0xef);
	qspi_send(1, 0xd0);
	qspi_send(1, 0xe8);
	lcm_write_cmd(0x14, 0x03);
	mutex_unlock(&panel_lock);
	wake_unlock(&panel_idle_lock);

	LCMDBG("%s: last_val = %d\n", __func__,last_val);
	led_trigger_event(amoled_lcd_backlight, LED_FULL);
	return 0;
}
static int amoled_panel_unblank(struct platform_device *pdev)
{
    LCMDBG("%s\n", __func__);


    if (samsung_oled_panel_init())
        printk(KERN_ERR "samsung_oled_panel_init failed\n");

    wake_lock(&panel_idle_lock);
    mutex_lock(&panel_lock);
    table_sel_idx = 0;
    gamma_table_bank_select();
    amoled_set_gamma_val(last_val);
    qspi_send(0, 0xef);
    qspi_send(1, 0xd0);
    qspi_send(1, 0xe8);
    lcm_write_cmd(0x14, 0x03);
    mutex_unlock(&panel_lock);
    wake_unlock(&panel_idle_lock);

    LCMDBG("%s: last_val = %d\n", __func__,last_val);
    led_trigger_event(amoled_lcd_backlight, LED_FULL);
    return 0;
}