These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / fbtft / fb_ssd1306.c
index 15ee44d..e0b34a4 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>
@@ -30,7 +26,6 @@
 #define WIDTH          128
 #define HEIGHT         64
 
-
 /*
   write_reg() caveat:
 
@@ -45,8 +40,6 @@
 /* Init sequence taken from the Adafruit SSD1306 Arduino library */
 static int init_display(struct fbtft_par *par)
 {
-       fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__);
-
        par->fbtftops.reset(par);
 
        if (par->gamma.curves[0] == 0) {
@@ -132,9 +125,6 @@ static int init_display(struct fbtft_par *par)
 
 static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
 {
-       fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par,
-               "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye);
-
        /* Set Lower Column Start Address for Page Addressing Mode */
        write_reg(par, 0x00 | 0x0);
        /* Set Higher Column Start Address for Page Addressing Mode */
@@ -158,8 +148,6 @@ static int blank(struct fbtft_par *par, bool on)
 /* Gamma is used to control Contrast */
 static int set_gamma(struct fbtft_par *par, unsigned long *curves)
 {
-       fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__);
-
        /* apply mask */
        curves[0] &= 0xFF;
 
@@ -172,18 +160,18 @@ static int set_gamma(struct fbtft_par *par, unsigned long *curves)
 
 static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
 {
-       u16 *vmem16 = (u16 *)par->info->screen_base;
+       u16 *vmem16 = (u16 *)par->info->screen_buffer;
        u8 *buf = par->txbuf.buf;
        int x, y, i;
        int ret = 0;
 
-       fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__);
-
        for (x = 0; x < par->info->var.xres; x++) {
                for (y = 0; y < par->info->var.yres/8; y++) {
                        *buf = 0x00;
                        for (i = 0; i < 8; i++)
-                               *buf |= (vmem16[(y*8+i)*par->info->var.xres+x] ? 1 : 0) << i;
+                               *buf |= (vmem16[(y * 8 + i) *
+                                               par->info->var.xres + x] ?
+                                        1 : 0) << i;
                        buf++;
                }
        }
@@ -191,7 +179,8 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
        /* Write data */
        gpio_set_value(par->gpio.dc, 1);
        ret = par->fbtftops.write(par, par->txbuf.buf,
-                               par->info->var.xres*par->info->var.yres/8);
+                                 par->info->var.xres * par->info->var.yres /
+                                 8);
        if (ret < 0)
                dev_err(par->info->device, "write failed and returned: %d\n",
                        ret);
@@ -199,7 +188,6 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
        return ret;
 }
 
-
 static struct fbtft_display display = {
        .regwidth = 8,
        .width = WIDTH,
@@ -216,7 +204,6 @@ static struct fbtft_display display = {
        },
 };
 
-
 FBTFT_REGISTER_DRIVER(DRVNAME, "solomon,ssd1306", &display);
 
 MODULE_ALIAS("spi:" DRVNAME);