int i, j;
unsigned int index;
+ if (lcd_debug_print_flag)
+ LCDPR("%s\n", __func__);
+
if (child == NULL) {
LCDPR("error: failed to get %s\n", pconf->lcd_propname);
return -1;
index = lcd_power->power_on_step[i].index;
switch (lcd_power->power_on_step[i].type) {
case LCD_POWER_TYPE_CPU:
+ case LCD_POWER_TYPE_WAIT_GPIO:
if (index < LCD_CPU_GPIO_NUM_MAX)
lcd_cpu_gpio_probe(index);
break;
index = lcd_power->power_off_step[i].index;
switch (lcd_power->power_off_step[i].type) {
case LCD_POWER_TYPE_CPU:
+ case LCD_POWER_TYPE_WAIT_GPIO:
if (index < LCD_CPU_GPIO_NUM_MAX)
lcd_cpu_gpio_probe(index);
break;
/* power: (5byte * n) */
p = buf + len;
- if (lcd_debug_print_flag)
- LCDPR("power_on step:\n");
i = 0;
while (i < LCD_PWR_STEP_MAX) {
pconf->lcd_power->power_on_step_max = i;
index = pconf->lcd_power->power_on_step[i].index;
switch (pconf->lcd_power->power_on_step[i].type) {
case LCD_POWER_TYPE_CPU:
+ case LCD_POWER_TYPE_WAIT_GPIO:
if (index < LCD_CPU_GPIO_NUM_MAX)
lcd_cpu_gpio_probe(index);
break;
index = pconf->lcd_power->power_off_step[j].index;
switch (pconf->lcd_power->power_off_step[j].type) {
case LCD_POWER_TYPE_CPU:
+ case LCD_POWER_TYPE_WAIT_GPIO:
if (index < LCD_CPU_GPIO_NUM_MAX)
lcd_cpu_gpio_probe(index);
break;
switch (power_step->type) {
case LCD_POWER_TYPE_CPU:
case LCD_POWER_TYPE_PMU:
+ case LCD_POWER_TYPE_WAIT_GPIO:
n = lcd_debug_info_len(len + offset);
len += snprintf((buf+len), n,
"%d: type=%d, index=%d, value=%d, delay=%d\n",
struct class_attribute *attr, const char *buf, size_t count)
{
int ret = 0;
- unsigned int i, delay;
+ unsigned int i;
+ unsigned int tmp[2];
struct aml_lcd_drv_s *lcd_drv = aml_lcd_get_driver();
struct lcd_power_ctrl_s *lcd_power_step;
lcd_power_step = lcd_drv->lcd_config->lcd_power;
switch (buf[1]) {
case 'n': /* on */
- ret = sscanf(buf, "on %d %d", &i, &delay);
- if (ret == 2) {
+ ret = sscanf(buf, "on %d %d %d", &i, &tmp[0], &tmp[1]);
+ if (ret == 3) {
+ if (i >= lcd_power_step->power_on_step_max) {
+ pr_info("invalid power_on step: %d, step_max: %d\n",
+ i, lcd_power_step->power_on_step_max);
+ return -EINVAL;
+ }
+ lcd_power_step->power_on_step[i].value = tmp[0];
+ lcd_power_step->power_on_step[i].delay = tmp[1];
+ pr_info(
+ "set power_on step %d value %d delay: %dms\n",
+ i, tmp[0], tmp[1]);
+ } else if (ret == 2) {
if (i >= lcd_power_step->power_on_step_max) {
pr_info("invalid power_on step: %d\n", i);
return -EINVAL;
}
- lcd_power_step->power_on_step[i].delay = delay;
+ lcd_power_step->power_on_step[i].delay = tmp[0];
pr_info("set power_on step %d delay: %dms\n",
- i, delay);
+ i, tmp[0]);
} else {
pr_info("invalid data\n");
return -EINVAL;
}
break;
case 'f': /* off */
- ret = sscanf(buf, "off %d %d", &i, &delay);
- if (ret == 1) {
+ ret = sscanf(buf, "off %d %d %d\n", &i, &tmp[0], &tmp[1]);
+ if (ret == 3) {
+ if (i >= lcd_power_step->power_off_step_max) {
+ pr_info("invalid power_off step: %d\n", i);
+ return -EINVAL;
+ }
+ lcd_power_step->power_off_step[i].value = tmp[0];
+ lcd_power_step->power_off_step[i].delay = tmp[1];
+ pr_info(
+ "set power_off step %d value %d delay: %dms\n",
+ i, tmp[0], tmp[1]);
+ } else if (ret == 2) {
if (i >= lcd_power_step->power_off_step_max) {
pr_info("invalid power_off step: %d\n", i);
return -EINVAL;
}
- lcd_power_step->power_off_step[i].delay = delay;
+ lcd_power_step->power_off_step[i].delay = tmp[0];
pr_info("set power_off step %d delay: %dms\n",
- i, delay);
+ i, tmp[0]);
} else {
pr_info("invalid data\n");
return -EINVAL;
#ifdef CONFIG_AMLOGIC_LCD_EXTERN
struct aml_lcd_extern_driver_s *ext_drv;
#endif
- unsigned int i, index, value, temp;
+ unsigned int i, index, wait, temp;
+ int value = -1;
int ret = 0;
LCDPR("%s: %d\n", __func__, status);
break;
if (lcd_debug_print_flag) {
LCDPR("power_ctrl: %d, step %d\n", status, i);
- LCDPR("type=%d, index=%d, value=%d, delay=%d\n",
- power_step->type, power_step->index,
+ LCDPR("%s: type=%d, index=%d, value=%d, delay=%d\n",
+ __func__, power_step->type, power_step->index,
power_step->value, power_step->delay);
}
switch (power_step->type) {
break;
#endif
case LCD_POWER_TYPE_WAIT_GPIO:
+ index = power_step->index;
+ lcd_cpu_gpio_set(index, LCD_GPIO_INPUT);
+ LCDPR("lcd_power_type_wait_gpio wait\n");
+ for (wait = 0; wait < power_step->delay; wait++) {
+ value = lcd_cpu_gpio_get(index);
+ if (value == power_step->value) {
+ LCDPR("wait_gpio %d ok\n", value);
+ break;
+ }
+ mdelay(1);
+ }
+ if (wait == power_step->delay)
+ LCDERR("wait_gpio %d timeout!\n", value);
break;
case LCD_POWER_TYPE_CLK_SS:
temp = lcd_driver->lcd_config->lcd_timing.ss_level;
default:
break;
}
- if (power_step->delay)
+ if ((power_step->type != LCD_POWER_TYPE_WAIT_GPIO) &&
+ (power_step->delay > 0))
mdelay(power_step->delay);
i++;
}
-
if (lcd_debug_print_flag)
LCDPR("%s: %d finished\n", __func__, status);
}