staging/fbtft : Remove unicode characters
[deliverable/linux.git] / drivers / staging / fbtft / fb_ili9481.c
CommitLineData
d416d5c0
TP
1/*
2 * FB driver for the ILI9481 LCD Controller
3 *
4 * Copyright (c) 2014 Petr Olivka
5 * Copyright (c) 2013 Noralf Tronnes
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
d416d5c0
TP
16 */
17
18#include <linux/module.h>
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/delay.h>
22
23#include "fbtft.h"
24
25#define DRVNAME "fb_ili9481"
26#define WIDTH 320
27#define HEIGHT 480
28
29static int default_init_sequence[] = {
30
31 /* SLP_OUT - Sleep out */
32 -1, 0x11,
33 -2, 50,
34 /* Power setting */
35 -1, 0xD0, 0x07, 0x42, 0x18,
36 /* VCOM */
37 -1, 0xD1, 0x00, 0x07, 0x10,
38 /* Power setting for norm. mode */
39 -1, 0xD2, 0x01, 0x02,
40 /* Panel driving setting */
41 -1, 0xC0, 0x10, 0x3B, 0x00, 0x02, 0x11,
42 /* Frame rate & inv. */
43 -1, 0xC5, 0x03,
44 /* Pixel format */
45 -1, 0x3A, 0x55,
46 /* Gamma */
47 -1, 0xC8, 0x00, 0x32, 0x36, 0x45, 0x06, 0x16,
48 0x37, 0x75, 0x77, 0x54, 0x0C, 0x00,
49 /* DISP_ON */
50 -1, 0x29,
51 -3
52};
53
54static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
55{
d416d5c0
TP
56 /* column address */
57 write_reg(par, 0x2a, xs >> 8, xs & 0xff, xe >> 8, xe & 0xff);
58
92def781 59 /* Row address */
d416d5c0
TP
60 write_reg(par, 0x2b, ys >> 8, ys & 0xff, ye >> 8, ye & 0xff);
61
62 /* memory write */
63 write_reg(par, 0x2c);
64}
65
66#define HFLIP 0x01
67#define VFLIP 0x02
68#define ROWxCOL 0x20
69static int set_var(struct fbtft_par *par)
70{
71 fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__);
72
73 switch (par->info->var.rotate) {
74 case 270:
75 write_reg(par, 0x36, ROWxCOL | HFLIP | VFLIP | (par->bgr << 3));
76 break;
77 case 180:
78 write_reg(par, 0x36, VFLIP | (par->bgr << 3));
79 break;
80 case 90:
81 write_reg(par, 0x36, ROWxCOL | (par->bgr << 3));
82 break;
83 default:
84 write_reg(par, 0x36, HFLIP | (par->bgr << 3));
85 break;
86 }
87
88 return 0;
89}
90
91static struct fbtft_display display = {
92 .regwidth = 8,
93 .width = WIDTH,
94 .height = HEIGHT,
95 .init_sequence = default_init_sequence,
96 .fbtftops = {
97 .set_addr_win = set_addr_win,
98 .set_var = set_var,
99 },
100};
101FBTFT_REGISTER_DRIVER(DRVNAME, "ilitek,ili9481", &display);
102
103MODULE_ALIAS("spi:" DRVNAME);
104MODULE_ALIAS("platform:" DRVNAME);
105MODULE_ALIAS("spi:ili9481");
106MODULE_ALIAS("platform:ili9481");
107
108MODULE_DESCRIPTION("FB driver for the ILI9481 LCD Controller");
109MODULE_AUTHOR("Petr Olivka");
110MODULE_LICENSE("GPL");
This page took 0.086631 seconds and 5 git commands to generate.