Permalink
Browse files

rotate is now an angle

fbtft previously used the rotation values 0-3. This was how fbcon did it.

include/uapi/linux/fb.h has this to say:
__u32 rotate;                   /* angle we rotate counter clockwise */
  • Loading branch information...
1 parent c965d56 commit cd9162535e018da30a842e122ee427b99956beab @notro committed Aug 18, 2013
Showing with 45 additions and 40 deletions.
  1. +3 −3 fb_hx8340bn.c
  2. +6 −6 fb_ili9320.c
  3. +6 −6 fb_ili9325.c
  4. +3 −3 fb_ili9341.c
  5. +6 −6 fb_ssd1289.c
  6. +3 −3 fb_st7735r.c
  7. +3 −3 fbtft-core.c
  8. +9 −4 fbtft_device.c
  9. +6 −6 flexfb.c
View
@@ -131,13 +131,13 @@ static int set_var(struct fbtft_par *par)
case 0:
write_reg(par, 0x36, (par->bgr << 3));
break;
- case 1:
+ case 270:
write_reg(par, 0x36, MX | MV | (par->bgr << 3));
break;
- case 2:
+ case 180:
write_reg(par, 0x36, MX | MY | (par->bgr << 3));
break;
- case 3:
+ case 90:
write_reg(par, 0x36, MY | MV | (par->bgr << 3));
break;
}
View
@@ -132,15 +132,15 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
write_reg(par, 0x0020, xs);
write_reg(par, 0x0021, ys);
break;
- case 2:
+ case 180:
write_reg(par, 0x0020, WIDTH - 1 - xs);
write_reg(par, 0x0021, HEIGHT - 1 - ys);
break;
- case 1:
+ case 270:
write_reg(par, 0x0020, WIDTH - 1 - ys);
write_reg(par, 0x0021, xs);
break;
- case 3:
+ case 90:
write_reg(par, 0x0020, ys);
write_reg(par, 0x0021, HEIGHT - 1 - xs);
break;
@@ -156,13 +156,13 @@ static int set_var(struct fbtft_par *par)
case 0:
write_reg(par, 0x3, (par->bgr << 12) | 0x30);
break;
- case 1:
+ case 270:
write_reg(par, 0x3, (par->bgr << 12) | 0x28);
break;
- case 2:
+ case 180:
write_reg(par, 0x3, (par->bgr << 12) | 0x00);
break;
- case 3:
+ case 90:
write_reg(par, 0x3, (par->bgr << 12) | 0x18);
break;
}
View
@@ -185,15 +185,15 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
write_reg(par, 0x0020, xs);
write_reg(par, 0x0021, ys);
break;
- case 2:
+ case 180:
write_reg(par, 0x0020, WIDTH - 1 - xs);
write_reg(par, 0x0021, HEIGHT - 1 - ys);
break;
- case 1:
+ case 270:
write_reg(par, 0x0020, WIDTH - 1 - ys);
write_reg(par, 0x0021, xs);
break;
- case 3:
+ case 90:
write_reg(par, 0x0020, ys);
write_reg(par, 0x0021, HEIGHT - 1 - xs);
break;
@@ -210,13 +210,13 @@ static int set_var(struct fbtft_par *par)
case 0:
write_reg(par, 0x03, 0x0030 | (par->bgr << 12));
break;
- case 2:
+ case 180:
write_reg(par, 0x03, 0x0000 | (par->bgr << 12));
break;
- case 1:
+ case 270:
write_reg(par, 0x03, 0x0028 | (par->bgr << 12));
break;
- case 3:
+ case 90:
write_reg(par, 0x03, 0x0018 | (par->bgr << 12));
break;
}
View
@@ -111,14 +111,14 @@ static int set_var(struct fbtft_par *par)
case 0:
write_reg(par, 0x36, (1 << MEM_X) | (par->bgr << MEM_BGR));
break;
- case 1:
+ case 270:
write_reg(par, 0x36,
(1<<MEM_V) | (1 << MEM_L) | (par->bgr << MEM_BGR));
break;
- case 2:
+ case 180:
write_reg(par, 0x36, (1 << MEM_Y) | (par->bgr << MEM_BGR));
break;
- case 3:
+ case 90:
write_reg(par, 0x36, (1 << MEM_Y) | (1 << MEM_X) |
(1 << MEM_V) | (par->bgr << MEM_BGR));
break;
View
@@ -94,15 +94,15 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
write_reg(par, 0x4e, xs);
write_reg(par, 0x4f, ys);
break;
- case 2:
+ case 180:
write_reg(par, 0x4e, par->info->var.xres - 1 - xs);
write_reg(par, 0x4f, par->info->var.yres - 1 - ys);
break;
- case 1:
+ case 270:
write_reg(par, 0x4e, par->info->var.yres - 1 - ys);
write_reg(par, 0x4f, xs);
break;
- case 3:
+ case 90:
write_reg(par, 0x4e, ys);
write_reg(par, 0x4f, par->info->var.xres - 1 - xs);
break;
@@ -128,13 +128,13 @@ static int set_var(struct fbtft_par *par)
case 0:
write_reg(par, 0x11, reg11 | 0b110000);
break;
- case 1:
+ case 270:
write_reg(par, 0x11, reg11 | 0b101000);
break;
- case 2:
+ case 180:
write_reg(par, 0x11, reg11 | 0b000000);
break;
- case 3:
+ case 90:
write_reg(par, 0x11, reg11 | 0b011000);
break;
}
View
@@ -126,13 +126,13 @@ static int set_var(struct fbtft_par *par)
case 0:
write_reg(par, 0x36, MX | MY | (par->bgr << 3));
break;
- case 1:
+ case 270:
write_reg(par, 0x36, MY | MV | (par->bgr << 3));
break;
- case 2:
+ case 180:
write_reg(par, 0x36, (par->bgr << 3));
break;
- case 3:
+ case 90:
write_reg(par, 0x36, MX | MV | (par->bgr << 3));
break;
}
View
@@ -649,7 +649,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
fps = pdata->fps;
if (pdata->txbuflen)
txbuflen = pdata->txbuflen;
- rotate = pdata->rotate & 3;
+ rotate = pdata->rotate;
bgr = pdata->bgr;
startbyte = pdata->startbyte;
if (pdata->display.init_sequence)
@@ -666,8 +666,8 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
fbtft_expand_debug_value(&display->debug);
switch (rotate) {
- case 1:
- case 3:
+ case 90:
+ case 270:
width = display->height;
height = display->width;
break;
View
@@ -39,8 +39,8 @@ MODULE_PARM_DESC(name, "Devicename (required). " \
static unsigned rotate;
module_param(rotate, uint, 0);
-MODULE_PARM_DESC(rotate, "Rotate display 0=normal, 1=clockwise, " \
-"2=upside down, 3=counterclockwise (not supported by all drivers)");
+MODULE_PARM_DESC(rotate,
+"Angle to rotate display counter clockwise: 0, 90, 180, 270");
static unsigned busnum;
module_param(busnum, uint, 0);
@@ -736,8 +736,13 @@ static int __init fbtft_device_init(void)
pr_debug(DRVNAME": name='%s', busnum=%d, cs=%d\n", name, busnum, cs);
- if (rotate > 3) {
- pr_warn("argument 'rotate' illegal value: %d (0-3). Setting it to 0.\n",
+ if (rotate > 0 && rotate < 4) {
+ rotate = (4 - rotate) * 90;
+ pr_warn("argument 'rotate' should be an angle. Values 1-3 is deprecated. Setting it to %d.\n",
+ rotate);
+ }
+ if (rotate != 0 && rotate != 90 && rotate != 180 && rotate != 270) {
+ pr_warn("argument 'rotate' illegal value: %d. Setting it to 0.\n",
rotate);
rotate = 0;
}
View
@@ -143,15 +143,15 @@ static void flexfb_set_addr_win_1(struct fbtft_par *par, int xs, int ys, int xe,
write_reg(par, 0x0020, xs);
write_reg(par, 0x0021, ys);
break;
- case 2:
+ case 180:
write_reg(par, 0x0020, width - 1 - xs);
write_reg(par, 0x0021, height - 1 - ys);
break;
- case 1:
+ case 270:
write_reg(par, 0x0020, width - 1 - ys);
write_reg(par, 0x0021, xs);
break;
- case 3:
+ case 90:
write_reg(par, 0x0020, ys);
write_reg(par, 0x0021, height - 1 - xs);
break;
@@ -171,15 +171,15 @@ static void flexfb_set_addr_win_2(struct fbtft_par *par, int xs, int ys, int xe,
write_reg(par, 0x4e, xs);
write_reg(par, 0x4f, ys);
break;
- case 2:
+ case 180:
write_reg(par, 0x4e, par->info->var.xres - 1 - xs);
write_reg(par, 0x4f, par->info->var.yres - 1 - ys);
break;
- case 1:
+ case 270:
write_reg(par, 0x4e, par->info->var.yres - 1 - ys);
write_reg(par, 0x4f, xs);
break;
- case 3:
+ case 90:
write_reg(par, 0x4e, ys);
write_reg(par, 0x4f, par->info->var.xres - 1 - xs);
break;

0 comments on commit cd91625

Please sign in to comment.