From b4b7ff4b08e691656c9d77c758fc355833128ac0 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Wed, 20 Jan 2016 14:01:31 -0300 Subject: Linux-libre 4.4-gnu --- drivers/staging/fbtft/fb_watterott.c | 38 ++++++++---------------------------- 1 file changed, 8 insertions(+), 30 deletions(-) (limited to 'drivers/staging/fbtft/fb_watterott.c') diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c index 8eae6ef25..f8cb610a7 100644 --- a/drivers/staging/fbtft/fb_watterott.c +++ b/drivers/staging/fbtft/fb_watterott.c @@ -12,10 +12,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -43,7 +39,6 @@ #define COLOR_RGB233 10 #define COLOR_RGB565 16 - static short mode = 565; module_param(mode, short, 0); MODULE_PARM_DESC(mode, "RGB color transfer mode: 332, 565 (default)"); @@ -73,14 +68,12 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...) static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) { unsigned start_line, end_line; - u16 *vmem16 = (u16 *)(par->info->screen_base + offset); + u16 *vmem16 = (u16 *)(par->info->screen_buffer + offset); u16 *pos = par->txbuf.buf + 1; u16 *buf16 = par->txbuf.buf + 10; int i, j; int ret = 0; - fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__); - start_line = offset / par->info->fix.line_length; end_line = start_line + (len / par->info->fix.line_length) - 1; @@ -112,14 +105,12 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) static int write_vmem_8bit(struct fbtft_par *par, size_t offset, size_t len) { unsigned start_line, end_line; - u16 *vmem16 = (u16 *)(par->info->screen_base + offset); + u16 *vmem16 = (u16 *)(par->info->screen_buffer + offset); u16 *pos = par->txbuf.buf + 1; u8 *buf8 = par->txbuf.buf + 10; int i, j; int ret = 0; - fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__); - start_line = offset / par->info->fix.line_length; end_line = start_line + (len / par->info->fix.line_length) - 1; @@ -164,8 +155,6 @@ static int init_display(struct fbtft_par *par) unsigned version; u8 save_mode; - fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); - /* enable SPI interface by having CS and MOSI low during reset */ save_mode = par->spi->mode; par->spi->mode |= SPI_CS_HIGH; @@ -205,8 +194,6 @@ static int set_var(struct fbtft_par *par) { u8 rotate; - fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); - /* this controller rotates clock wise */ switch (par->info->var.rotate) { case 90: @@ -257,31 +244,22 @@ static int backlight_chip_update_status(struct backlight_device *bd) return 0; } +static const struct backlight_ops bl_ops = { + .update_status = backlight_chip_update_status, +}; + static void register_chip_backlight(struct fbtft_par *par) { struct backlight_device *bd; struct backlight_properties bl_props = { 0, }; - struct backlight_ops *bl_ops; - fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s()\n", __func__); - - bl_ops = devm_kzalloc(par->info->device, sizeof(struct backlight_ops), - GFP_KERNEL); - if (!bl_ops) { - dev_err(par->info->device, - "%s: could not allocate memory for backlight operations.\n", - __func__); - return; - } - - bl_ops->update_status = backlight_chip_update_status; bl_props.type = BACKLIGHT_RAW; bl_props.power = FB_BLANK_POWERDOWN; bl_props.max_brightness = 100; bl_props.brightness = DEFAULT_BRIGHTNESS; bd = backlight_device_register(dev_driver_string(par->info->device), - par->info->device, par, bl_ops, &bl_props); + par->info->device, par, &bl_ops, &bl_props); if (IS_ERR(bd)) { dev_err(par->info->device, "cannot register backlight device (%ld)\n", @@ -297,7 +275,6 @@ static void register_chip_backlight(struct fbtft_par *par) #define register_chip_backlight NULL #endif - static struct fbtft_display display = { .regwidth = 8, .buswidth = 8, @@ -315,6 +292,7 @@ static struct fbtft_display display = { .register_backlight = register_chip_backlight, }, }; + FBTFT_REGISTER_DRIVER(DRVNAME, "watterott,openlcd", &display); MODULE_ALIAS("spi:" DRVNAME); -- cgit v1.2.3-54-g00ecf