Beispiel #1
0
static int lcd_extern_power_cmd(unsigned char *init_table)
{
	int i = 0, len, gpio;
	int ret = 0;

	len = ext_config->cmd_size;
	if (len < 1) {
		EXTERR("%s: cmd_size %d is invalid\n", __func__, len);
		return -1;
	}
	if (len == LCD_EXTERN_DYNAMIC_LEN) {
		EXTPR("%s: cmd_size dynamic length to do\n", __func__);
		return -1;
	}

	while (i <= LCD_EXTERN_INIT_TABLE_MAX) {
		if (init_table[i] == LCD_EXTERN_INIT_END) {
			break;
		} else if (init_table[i] == LCD_EXTERN_INIT_NONE) {
			//do nothing, only for delay
		} else if (init_table[i] == LCD_EXTERN_INIT_GPIO) {
			gpio = aml_lcd_extern_get_gpio(init_table[i+1]);
			if (gpio < LCD_GPIO_MAX)
				aml_lcd_gpio_set(gpio, init_table[i+2]);
		} else if (init_table[i] == LCD_EXTERN_INIT_CMD) {
			ret = lcd_extern_spi_write(&init_table[i+1], (len-2));
		} else {
			EXTERR("%s(%d: %s): pwoer_type %d is invalid\n",
				__func__, ext_config->index,
				ext_config->name, ext_config->type);
		}
		if (init_table[i+len-1] > 0)
			mdelay(init_table[i+len-1]);
		i += len;
	}

	return ret;
}
static void lcd_extern_set_sda(unsigned v)
{
	aml_lcd_gpio_set(ext_config->spi_data, v);
	udelay(SPI_DELAY);
}