void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...) { va_list args; int i, ret; int pad = 0; u16 *buf = (u16 *)par->buf; if (unlikely(par->debug & DEBUG_WRITE_REGISTER)) { va_start(args, len); for (i = 0; i < len; i++) *(((u8 *)buf) + i) = (u8)va_arg(args, unsigned int); va_end(args); fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, par->info->device, u8, buf, len, "%s: ", __func__); }
static void write_reg8_bus8(struct fbtft_par *par, int len, ...) { va_list args; int i, ret; u8 *buf = par->buf; va_start(args, len); for (i = 0; i < len; i++) *buf++ = (u8)va_arg(args, unsigned int); va_end(args); fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, par->info->device, u8, par->buf, len, "%s: ", __func__); ret = par->fbtftops.write(par, par->buf, len); if (ret < 0) { dev_err(par->info->device, "%s: write() failed and returned %d\n", __func__, ret); return; } }
/* * Option to use direct gpio access to speed up display refresh * */ static int fbtft_ili9327_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len) { u8 data; static u8 prev_data = 0xff; #ifdef BYPASS_GPIOLIB unsigned int set = 0; unsigned int reset = 0; #else int i; #endif fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, "%s-OPTIMIZED(len=%d): ", __func__, len); #ifdef BYPASS_GPIOLIB while (len--) { data = *(u8 *) buf; if (data != prev_data) { /* Set data */ GPIOSET(par->gpio.db[0], (data&0x01)); GPIOSET(par->gpio.db[1], (data&0x02)); GPIOSET(par->gpio.db[2], (data&0x04)); GPIOSET(par->gpio.db[3], (data&0x08)); GPIOSET(par->gpio.db[4], (data&0x10)); GPIOSET(par->gpio.db[5], (data&0x20)); GPIOSET(par->gpio.db[6], (data&0x40)); GPIOSET(par->gpio.db[7], (data&0x80)); writel(set, __io_address(GPIO_BASE+0x1C)); writel(reset, __io_address(GPIO_BASE+0x28)); } /* Pulse /WR low */ writel((1<<par->gpio.wr), __io_address(GPIO_BASE+0x28)); writel(0, __io_address(GPIO_BASE+0x28)); /* used as a delay */ writel((1<<par->gpio.wr), __io_address(GPIO_BASE+0x1C)); set = 0; reset = 0; prev_data = data; buf++; } #else while (len--) { data = *(u8 *) buf; /* Start writing by pulling down /WR */ gpio_set_value(par->gpio.wr, 0); /* Set data */ #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO if (data == prev_data) { gpio_set_value(par->gpio.wr, 0); /* used as delay */ } else { for (i = 0; i < 8; i++) { if ((data & 1) != (prev_data & 1)) gpio_set_value(par->gpio.db[i], data & 1); data >>= 1; prev_data >>= 1; } } #else for (i = 0; i < 8; i++) { gpio_set_value(par->gpio.db[i], data & 1); data >>= 1; } #endif /* Pullup /WR */ gpio_set_value(par->gpio.wr, 1); #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO prev_data = *(u8 *) buf; #endif buf++; } #endif return 0; }