/* Using for CABC Key String */
static ssize_t store_cabc(struct device *dev,
			    struct device_attribute *dev_attr,
			    const char *buf, size_t count)
{
	int ret;
	unsigned int value;

	ret = kstrtouint(buf, 10, &value);

	if (ret)
		return ret;

	if (!get_panel_power_state()) {
		pr_info("%s : Panel is off state", __func__);
		return count;
	}

	if (value == CABC_OFF) {
		cabc_tun_state.auto_br = CABC_AUTO_BR_OFF;
	} else if (value == CABC_ON) {
		cabc_tun_state.auto_br = CABC_AUTO_BR_ON;
		cabc_tun_state.luxvalue = CABC_LUX_1;
	} else {
		pr_err("Undefied CABC On/Off value : %d\n\n", value);
		return count;
	}

	CABC_Set_Mode();

	return count;
}
static ssize_t accessibility_store(struct device *dev,
			struct device_attribute *attr,
			const char *buf, size_t size)
{
	int cmd_value;

	sscanf(buf, "%d", &cmd_value);

	switch (cmd_value) {
	case ACCESSIBILITY_OFF :
		cabc_tun_state.negative = CABC_NEGATIVE_OFF;
		break;
	case NEGATIVE :
		cabc_tun_state.negative = CABC_NEGATIVE_ON;
		break;
	default :
		pr_info("%s Undefined Command (%d)", __func__, cmd_value);
		return size;
	}

	pr_info("%s cmd_value : %d size : %d", __func__, cmd_value, size);

	CABC_Set_Mode();
	return size;
}
static int mdss_dsi_panel_on(struct mdss_panel_data *pdata)
{
	struct mipi_panel_info *mipi;
	struct mdss_dsi_ctrl_pdata *ctrl = NULL;
	static int first_boot=1;

	if (pdata == NULL) {
		pr_err("%s: Invalid input data\n", __func__);
		return -EINVAL;
	}

	ctrl = container_of(pdata, struct mdss_dsi_ctrl_pdata,
				panel_data);

	mipi  = &pdata->panel_info.mipi;

	pr_info("%s: ctrl index=%d ++ \n", __func__, ctrl->ndx);



	if (ctrl->ndx == DSI_CTRL_1) {
		if (ctrl->on_cmds.cmd_cnt) {
			mdss_dsi_panel_cmds_send(ctrl, &ctrl->on_cmds);
		}
		panel_power_state = 1;

		if(bl_backup)
			mdss_dsi_panel_bl_ctrl(pdata, bl_backup);

		pwm_backlight_enable();

		if(first_boot) {
			pr_info("%s: first backlight set to 150 level \n",
				__func__);
			mdss_dsi_panel_bl_ctrl(pdata, 150);
			first_boot=0;
		}
		if (msd.dstat.recovery_boot_mode) {
			pr_info("%s: Recovery Mode backlight set to 180 level \n",
				__func__);
			msd.dstat.bright_level = RECOVERY_BRIGHTNESS;
			mdss_dsi_panel_bl_ctrl(pdata, RECOVERY_BRIGHTNESS);
		} else {
#if defined(CONFIG_CABC_TUNING)
			CABC_Set_Mode();
#endif
		}
	}

	pr_info("%s: ctrl index=%d -- \n", __func__, ctrl->ndx);

	return 0;
}
void update_lux(unsigned int input_lux)
{
	unsigned int value;

	value = lux_to_value(input_lux);

	pr_info("%s : Input Lux=%d Lux Value=%d\n", __func__, input_lux, value);

	if (value >= CABC_LUX_MAX) {
		pr_err("Undefied  CABC lux value : %d\n\n", value);
		return;
	}
	if (value != cabc_tun_state.luxvalue) {
		cabc_tun_state.luxvalue = value;
		CABC_Set_Mode();
	}
}
static ssize_t store_mode(struct device *dev,
			    struct device_attribute *dev_attr,
			    const char *buf, size_t count)
{
	int ret;
	unsigned int value;

	ret = kstrtouint(buf, 10, &value);

	if (ret)
		return ret;

	if (value >= CABC_MODE_MAX) {
		pr_err("Undefied CABC MODE value : %d\n\n", value);
		return count;
	}
	if (value != cabc_tun_state.mode) {
		cabc_tun_state.mode = value;
		CABC_Set_Mode();
	}

	return count;
}