mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
ODROID-N2:Added force64b parameter to fbtft&spicc to increase the refresh-rate.
Ex) modprobe spi_meson_spicc force64b=1 modprobe fbtft_device name=odroid35 rotate=90 force64b=1 Change-Id: I9545740a633f2289648e5bcf72e55fbc23aecebf
This commit is contained in:
@@ -542,6 +542,11 @@
|
||||
function = "gpio_periphs";
|
||||
};
|
||||
};
|
||||
spicc0_pins_x: spicc0_pins_x {
|
||||
mux {
|
||||
drive-strength = <3>;
|
||||
};
|
||||
};
|
||||
spicc0_to_gpiox: spicc0_gpiox {
|
||||
mux {
|
||||
groups = "GPIOX_8",
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#endif
|
||||
|
||||
#include <linux/swab.h>
|
||||
|
||||
/*
|
||||
* The Meson SPICC controller could support DMA based transfers, but is not
|
||||
* implemented by the vendor code, and while having the registers documentation
|
||||
@@ -40,6 +42,12 @@
|
||||
* to have a CS go down over the full transfer
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
|
||||
static unsigned int force64b;
|
||||
module_param(force64b, uint, 0000);
|
||||
MODULE_PARM_DESC(force64b, "force 64bits fb data");
|
||||
#endif
|
||||
|
||||
/* Register Map */
|
||||
#define SPICC_RXDATA 0x00
|
||||
|
||||
@@ -479,10 +487,20 @@ static void meson_spicc_setup_pio_burst(struct meson_spicc_device *spicc)
|
||||
{
|
||||
unsigned int burst_len;
|
||||
|
||||
burst_len = min_t(unsigned int,
|
||||
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
|
||||
if (force64b)
|
||||
burst_len = min_t(unsigned int,
|
||||
spicc->xfer_remain / spicc->bytes_per_word,
|
||||
spicc->data->fifo_size << 1);
|
||||
else
|
||||
burst_len = min_t(unsigned int,
|
||||
spicc->xfer_remain / spicc->bytes_per_word,
|
||||
spicc->data->fifo_size);
|
||||
|
||||
#else
|
||||
burst_len = min_t(unsigned int,
|
||||
spicc->xfer_remain / spicc->bytes_per_word,
|
||||
spicc->data->fifo_size);
|
||||
#endif
|
||||
/* Setup Xfer variables */
|
||||
spicc->tx_remain = burst_len;
|
||||
spicc->rx_remain = burst_len;
|
||||
@@ -587,6 +605,12 @@ static int meson_spicc_transfer_one(struct spi_master *master,
|
||||
spicc->rx_buf = (u8 *)xfer->rx_buf;
|
||||
spicc->xfer_remain = xfer->len;
|
||||
|
||||
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
|
||||
if (force64b && (xfer->len >= 64)) {
|
||||
if ((xfer->bits_per_word == 8) && ((xfer->len % 8) == 0))
|
||||
xfer->bits_per_word = 64;
|
||||
}
|
||||
#endif
|
||||
/* Pre-calculate word size */
|
||||
spicc->bytes_per_word =
|
||||
DIV_ROUND_UP(spicc->xfer->bits_per_word, 8);
|
||||
@@ -1094,6 +1118,8 @@ static int meson_spicc_probe(struct platform_device *pdev)
|
||||
spicc->pinctrl = NULL;
|
||||
dev_err(&pdev->dev, "spi pinmux : can't get spicc_pins\n");
|
||||
}
|
||||
if (force64b)
|
||||
dev_info(&pdev->dev, "*** force64b flags is true ***\n");
|
||||
#endif
|
||||
|
||||
device_reset_optional(&pdev->dev);
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
#include <linux/spi/spi.h>
|
||||
#include "fbtft.h"
|
||||
|
||||
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
|
||||
unsigned int force64b_enable;
|
||||
EXPORT_SYMBOL(force64b_enable);
|
||||
#endif
|
||||
|
||||
int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len)
|
||||
{
|
||||
struct spi_transfer t = {
|
||||
@@ -15,6 +20,24 @@ int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len)
|
||||
fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len,
|
||||
"%s(len=%d): ", __func__, len);
|
||||
|
||||
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
|
||||
if (force64b_enable && ((len >= 64) && ((len % 8) == 0))) {
|
||||
unsigned int i;
|
||||
unsigned char tmp;
|
||||
unsigned char *txbuf = (unsigned char *)buf;
|
||||
|
||||
for (i = 0; i < len; i += 8) {
|
||||
tmp = txbuf[i + 0]; txbuf[i + 0] = txbuf[i + 7];
|
||||
txbuf[i + 7] = tmp;
|
||||
tmp = txbuf[i + 1]; txbuf[i + 1] = txbuf[i + 6];
|
||||
txbuf[i + 6] = tmp;
|
||||
tmp = txbuf[i + 2]; txbuf[i + 2] = txbuf[i + 5];
|
||||
txbuf[i + 5] = tmp;
|
||||
tmp = txbuf[i + 3]; txbuf[i + 3] = txbuf[i + 4];
|
||||
txbuf[i + 4] = tmp;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!par->spi) {
|
||||
dev_err(par->info->device,
|
||||
"%s: par->spi is unexpectedly NULL\n", __func__);
|
||||
|
||||
@@ -284,6 +284,7 @@ int fbtft_write_gpio16_wr_latched(struct fbtft_par *par, void *buf, size_t len);
|
||||
|
||||
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
|
||||
int fbtft_write_reg_wr(struct fbtft_par *par, void *buf, size_t len);
|
||||
extern unsigned int force64b_enable;
|
||||
#endif
|
||||
|
||||
/* fbtft-bus.c */
|
||||
|
||||
@@ -111,6 +111,12 @@ module_param(verbose, uint, 0);
|
||||
MODULE_PARM_DESC(verbose,
|
||||
"0 silent, >0 show gpios, >1 show devices, >2 show devices before (default=3)");
|
||||
|
||||
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
|
||||
static unsigned int force64b;
|
||||
module_param(force64b, uint, 0000);
|
||||
MODULE_PARM_DESC(force64b, "override force 64bits fb data");
|
||||
#endif
|
||||
|
||||
struct fbtft_device_display {
|
||||
char *name;
|
||||
struct spi_board_info *spi;
|
||||
@@ -985,7 +991,7 @@ static struct fbtft_device_display displays[] = {
|
||||
.name = "odroid35",
|
||||
.spi = &(struct spi_board_info) {
|
||||
.modalias = "fb_ili9486",
|
||||
.max_speed_hz = 150000000,
|
||||
.max_speed_hz = 100000000,
|
||||
.mode = SPI_MODE_0,
|
||||
.platform_data = &(struct fbtft_platform_data) {
|
||||
.display = {
|
||||
@@ -1522,6 +1528,9 @@ static int fbtft_device_spi_device_register(struct spi_board_info *spi)
|
||||
dev_err(&master->dev, "spi_new_device() returned NULL\n");
|
||||
return -EPERM;
|
||||
}
|
||||
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
|
||||
force64b_enable = force64b;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user