aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@free-electrons.com>2013-04-22 06:02:24 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-05-28 07:41:58 -0400
commit3394e645a88c722396fc1b03c31a3ffc158744ad (patch)
tree46855f8b010a676d7d659e6f206599f971fc6605
parent9f7714d4638382d5f84fefd322983925935da742 (diff)
video: ssd1307fb: Speed up the communication with the controller
The code until now was sending only 1pixel-wide page segment at once, and started a new transfer every time. It has proven very inefficient, because for one byte to display on the screen, we had to actually send 3 bytes over I2C: the address, the type of data that was going to the controller, and then the actual data. This patches changes that by sending a whole page at once, avoiding most of this expensive overhead. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--drivers/video/ssd1307fb.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/video/ssd1307fb.c b/drivers/video/ssd1307fb.c
index 9daf058917a7..04a435886855 100644
--- a/drivers/video/ssd1307fb.c
+++ b/drivers/video/ssd1307fb.c
@@ -168,23 +168,28 @@ static void ssd1307fb_update_display(struct ssd1307fb_par *par)
168 */ 168 */
169 169
170 for (i = 0; i < (par->height / 8); i++) { 170 for (i = 0; i < (par->height / 8); i++) {
171 struct ssd1307fb_array *array;
171 ssd1307fb_write_cmd(par->client, 172 ssd1307fb_write_cmd(par->client,
172 SSD1307FB_START_PAGE_ADDRESS + i + par->page_offset); 173 SSD1307FB_START_PAGE_ADDRESS + i + par->page_offset);
173 ssd1307fb_write_cmd(par->client, 0x00); 174 ssd1307fb_write_cmd(par->client, 0x00);
174 ssd1307fb_write_cmd(par->client, 0x10); 175 ssd1307fb_write_cmd(par->client, 0x10);
175 176
177 array = ssd1307fb_alloc_array(par->width, SSD1307FB_DATA);
178
176 for (j = 0; j < par->width; j++) { 179 for (j = 0; j < par->width; j++) {
177 u8 buf = 0; 180 array->data[j] = 0;
178 for (k = 0; k < 8; k++) { 181 for (k = 0; k < 8; k++) {
179 u32 page_length = par->width * i; 182 u32 page_length = par->width * i;
180 u32 index = page_length + (par->width * k + j) / 8; 183 u32 index = page_length + (par->width * k + j) / 8;
181 u8 byte = *(vmem + index); 184 u8 byte = *(vmem + index);
182 u8 bit = byte & (1 << (j % 8)); 185 u8 bit = byte & (1 << (j % 8));
183 bit = bit >> (j % 8); 186 bit = bit >> (j % 8);
184 buf |= bit << k; 187 array->data[j] |= bit << k;
185 } 188 }
186 ssd1307fb_write_data(par->client, buf);
187 } 189 }
190
191 ssd1307fb_write_array(par->client, array, par->width);
192 kfree(array);
188 } 193 }
189} 194}
190 195