diff options
Diffstat (limited to 'drivers/staging/fbtft/fbtft-core.c')
-rw-r--r-- | drivers/staging/fbtft/fbtft-core.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index b1e45161e..0c1a77caf 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -35,6 +35,7 @@ #include <linux/dma-mapping.h> #include <linux/of.h> #include <linux/of_gpio.h> +#include <video/mipi_display.h> #include "fbtft.h" #include "internal.h" @@ -129,7 +130,8 @@ static int fbtft_request_gpios(struct fbtft_par *par) while (gpio->name[0]) { flags = FBTFT_GPIO_NO_MATCH; /* if driver provides match function, try it first, - if no match use our own */ + * if no match use our own + */ if (par->fbtftops.request_gpios_match) flags = par->fbtftops.request_gpios_match(par, gpio); if (flags == FBTFT_GPIO_NO_MATCH) @@ -319,16 +321,13 @@ EXPORT_SYMBOL(fbtft_unregister_backlight); static void fbtft_set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) { - /* Column address set */ - write_reg(par, 0x2A, - (xs >> 8) & 0xFF, xs & 0xFF, (xe >> 8) & 0xFF, xe & 0xFF); + write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS, + (xs >> 8) & 0xFF, xs & 0xFF, (xe >> 8) & 0xFF, xe & 0xFF); - /* Row address set */ - write_reg(par, 0x2B, - (ys >> 8) & 0xFF, ys & 0xFF, (ye >> 8) & 0xFF, ye & 0xFF); + write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS, + (ys >> 8) & 0xFF, ys & 0xFF, (ye >> 8) & 0xFF, ye & 0xFF); - /* Memory write */ - write_reg(par, 0x2C); + write_reg(par, MIPI_DCS_WRITE_MEMORY_START); } static void fbtft_reset(struct fbtft_par *par) @@ -520,8 +519,7 @@ static ssize_t fbtft_fb_write(struct fb_info *info, const char __user *buf, "%s: count=%zd, ppos=%llu\n", __func__, count, *ppos); res = fb_sys_write(info, buf, count, ppos); - /* TODO: only mark changed area - update all for now */ + /* TODO: only mark changed area update all for now */ par->fbtftops.mkdirty(info, -1, 0); return res; @@ -738,8 +736,11 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, goto alloc_fail; if (display->gamma_num && display->gamma_len) { - gamma_curves = devm_kzalloc(dev, display->gamma_num * display->gamma_len * sizeof(gamma_curves[0]), - GFP_KERNEL); + gamma_curves = devm_kcalloc(dev, + display->gamma_num * + display->gamma_len, + sizeof(gamma_curves[0]), + GFP_KERNEL); if (!gamma_curves) goto alloc_fail; } @@ -987,10 +988,6 @@ int fbtft_register_framebuffer(struct fb_info *fb_info) reg_fail: if (par->fbtftops.unregister_backlight) par->fbtftops.unregister_backlight(par); - if (spi) - spi_set_drvdata(spi, NULL); - if (par->pdev) - platform_set_drvdata(par->pdev, NULL); return ret; } @@ -1008,12 +1005,7 @@ EXPORT_SYMBOL(fbtft_register_framebuffer); int fbtft_unregister_framebuffer(struct fb_info *fb_info) { struct fbtft_par *par = fb_info->par; - struct spi_device *spi = par->spi; - if (spi) - spi_set_drvdata(spi, NULL); - if (par->pdev) - platform_set_drvdata(par->pdev, NULL); if (par->fbtftops.unregister_backlight) par->fbtftops.unregister_backlight(par); fbtft_sysfs_exit(par); |