These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / fbtft / fb_uc1701.c
index 26d669b..212908e 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>
@@ -33,7 +29,7 @@
 #define DRVNAME        "fb_uc1701"
 #define WIDTH    102
 #define HEIGHT  64
-#define PAGES    (HEIGHT/8)
+#define PAGES    (HEIGHT / 8)
 
 /* 1: Display on/off */
 #define LCD_DISPLAY_ENABLE    0xAE
 /* column offset for bottom view orientation */
 #define SHIFT_ADDR_TOPVIEW    30
 
-
 static int init_display(struct fbtft_par *par)
 {
-       fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__);
-
        par->fbtftops.reset(par);
 
        /* softreset of LCD */
@@ -121,7 +114,7 @@ static int init_display(struct fbtft_par *par)
 
        /* advanced program control */
        write_reg(par, LCD_ADV_PROG_CTRL);
-       write_reg(par, LCD_ADV_PROG_CTRL2|LCD_TEMPCOMP_HIGH);
+       write_reg(par, LCD_ADV_PROG_CTRL2 | LCD_TEMPCOMP_HIGH);
 
        /* enable display */
        write_reg(par, LCD_DISPLAY_ENABLE | 1);
@@ -131,8 +124,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);
-
        /* goto address */
        /* LCD_PAGE_ADDRESS | ((page) & 0x1F),
         (((col)+SHIFT_ADDR_NORMAL) & 0x0F),
@@ -150,25 +141,25 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
 
 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 (y = 0; y < PAGES; y++) {
                buf = par->txbuf.buf;
                for (x = 0; x < WIDTH; x++) {
                        *buf = 0x00;
                        for (i = 0; i < 8; i++)
-                               *buf |= (vmem16[((y*8*WIDTH)+(i*WIDTH))+x] ? 1 : 0) << i;
+                               *buf |= (vmem16[((y * 8 * WIDTH) +
+                                                (i * WIDTH)) + x] ?
+                                        1 : 0) << i;
                        buf++;
                }
                /* LCD_PAGE_ADDRESS | ((page) & 0x1F),
                 (((col)+SHIFT_ADDR_NORMAL) & 0x0F),
                  LCD_COL_ADDRESS | ((((col)+SHIFT_ADDR_NORMAL)>>4) & 0x0F) */
-               write_reg(par, LCD_PAGE_ADDRESS|(u8)y);
+               write_reg(par, LCD_PAGE_ADDRESS | (u8)y);
                /* LCD_PAGE_ADDRESS | ((page) & 0x1F),
                 (((col)+SHIFT_ADDR_NORMAL) & 0x0F),
                  LCD_COL_ADDRESS | ((((col)+SHIFT_ADDR_NORMAL)>>4) & 0x0F) */
@@ -189,7 +180,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,
@@ -201,6 +191,7 @@ static struct fbtft_display display = {
        },
        .backlight = 1,
 };
+
 FBTFT_REGISTER_DRIVER(DRVNAME, "UltraChip,uc1701", &display);
 
 MODULE_ALIAS("spi:" DRVNAME);