Skip to content

Commit 4a6fd8d

Browse files
Martijn VersteeghMartijn Versteegh
authored andcommitted
fbtft: Implement the scroll_pos sysfs param for the HX8357D fbtft driver.
1 parent 66c0930 commit 4a6fd8d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

drivers/staging/fbtft/fb_hx8357d.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ static int init_display(struct fbtft_par *par)
127127
/* tear line */
128128
write_reg(par, MIPI_DCS_SET_TEAR_SCANLINE, 0x00, 0x02);
129129

130+
/* set scrolling are to whole screen*/
131+
write_reg(par, HX8357D_VSCRDEF, 0x00, 0x00, 0x1, 0xE0, 0x00, 0x00);
132+
130133
/* Exit Sleep */
131134
write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);
132135
msleep(150);
@@ -182,9 +185,16 @@ static int set_var(struct fbtft_par *par)
182185
/* Memory Access Control */
183186
write_reg(par, MIPI_DCS_SET_ADDRESS_MODE, val);
184187

188+
write_reg(par, HX8357D_VSCRADD, ((par->scroll_pos) >> 8) & 0xFF, (par->scroll_pos) & 0xFF);
189+
185190
return 0;
186191
}
187192

193+
static void set_scroll(struct fbtft_par *par)
194+
{
195+
write_reg(par, HX8357D_VSCRADD, ((par->scroll_pos) >> 8) & 0xFF, (par->scroll_pos) & 0xFF);
196+
}
197+
188198
static struct fbtft_display display = {
189199
.regwidth = 8,
190200
.width = WIDTH,
@@ -195,6 +205,7 @@ static struct fbtft_display display = {
195205
.init_display = init_display,
196206
.set_addr_win = set_addr_win,
197207
.set_var = set_var,
208+
.set_scroll = set_scroll,
198209
},
199210
};
200211

drivers/staging/fbtft/fb_hx8357d.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
#define HX8357_TFTWIDTH 320
2323
#define HX8357_TFTHEIGHT 480
2424

25+
#define HX8357D_VSCRDEF 0x33
26+
#define HX8357D_VSCRADD 0x37
27+
2528
#define HX8357_SETOSC 0xB0
2629
#define HX8357_SETPWR1 0xB1
2730
#define HX8357B_SETDISPLAY 0xB2

0 commit comments

Comments
 (0)