These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / fbtft / fb_watterott.c
index 88fb2c0..f8cb610 100644 (file)
  * 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 <linux/module.h>
@@ -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,12 +155,10 @@ 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;
-       ret = par->spi->master->setup(par->spi); /* set CS inactive low */
+       ret = spi_setup(par->spi); /* set CS inactive low */
        if (ret) {
                dev_err(par->info->device, "Could not set SPI_CS_HIGH\n");
                return ret;
@@ -180,7 +169,7 @@ static int init_display(struct fbtft_par *par)
        par->fbtftops.reset(par);
        mdelay(1000);
        par->spi->mode = save_mode;
-       ret = par->spi->master->setup(par->spi);
+       ret = spi_setup(par->spi);
        if (ret) {
                dev_err(par->info->device, "Could not restore SPI mode\n");
                return ret;
@@ -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);