Deleted Added
full compact
bcm2835_fbd.c (239922) bcm2835_fbd.c (243423)
1/*-
2 * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 */
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 */
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c 239922 2012-08-30 20:59:37Z gonzo $");
28__FBSDID("$FreeBSD: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c 243423 2012-11-23 04:30:54Z gonzo $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bio.h>
33#include <sys/bus.h>
34#include <sys/conf.h>
35#include <sys/endian.h>
36#include <sys/kernel.h>

--- 26 unchanged lines hidden (view full) ---

63#include <dev/fb/fbreg.h>
64#include <dev/syscons/syscons.h>
65
66#include <arm/broadcom/bcm2835/bcm2835_mbox.h>
67#include <arm/broadcom/bcm2835/bcm2835_vcbus.h>
68
69#define BCMFB_FONT_HEIGHT 16
70
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/bio.h>
33#include <sys/bus.h>
34#include <sys/conf.h>
35#include <sys/endian.h>
36#include <sys/kernel.h>

--- 26 unchanged lines hidden (view full) ---

63#include <dev/fb/fbreg.h>
64#include <dev/syscons/syscons.h>
65
66#include <arm/broadcom/bcm2835/bcm2835_mbox.h>
67#include <arm/broadcom/bcm2835/bcm2835_vcbus.h>
68
69#define BCMFB_FONT_HEIGHT 16
70
71struct argb {
72 uint8_t a;
73 uint8_t r;
74 uint8_t g;
75 uint8_t b;
76};
77
78static struct argb bcmfb_palette[16] = {
79 {0x00, 0x00, 0x00, 0x00},
80 {0x00, 0x00, 0x00, 0xaa},
81 {0x00, 0x00, 0xaa, 0x00},
82 {0x00, 0x00, 0xaa, 0xaa},
83 {0x00, 0xaa, 0x00, 0x00},
84 {0x00, 0xaa, 0x00, 0xaa},
85 {0x00, 0xaa, 0x55, 0x00},
86 {0x00, 0xaa, 0xaa, 0xaa},
87 {0x00, 0x55, 0x55, 0x55},
88 {0x00, 0x55, 0x55, 0xff},
89 {0x00, 0x55, 0xff, 0x55},
90 {0x00, 0x55, 0xff, 0xff},
91 {0x00, 0xff, 0x55, 0x55},
92 {0x00, 0xff, 0x55, 0xff},
93 {0x00, 0xff, 0xff, 0x55},
94 {0x00, 0xff, 0xff, 0xff}
95};
96
71#define FB_WIDTH 640
72#define FB_HEIGHT 480
97#define FB_WIDTH 640
98#define FB_HEIGHT 480
99#define FB_DEPTH 24
73
74struct bcm_fb_config {
75 uint32_t xres;
76 uint32_t yres;
77 uint32_t vxres;
78 uint32_t vyres;
79 uint32_t pitch;
80 uint32_t bpp;

--- 21 unchanged lines hidden (view full) ---

102 video_adapter_t va;
103 int console;
104
105 intptr_t fb_addr;
106 unsigned int fb_size;
107
108 unsigned int height;
109 unsigned int width;
100
101struct bcm_fb_config {
102 uint32_t xres;
103 uint32_t yres;
104 uint32_t vxres;
105 uint32_t vyres;
106 uint32_t pitch;
107 uint32_t bpp;

--- 21 unchanged lines hidden (view full) ---

129 video_adapter_t va;
130 int console;
131
132 intptr_t fb_addr;
133 unsigned int fb_size;
134
135 unsigned int height;
136 unsigned int width;
137 unsigned int depth;
110 unsigned int stride;
111
112 unsigned int xmargin;
113 unsigned int ymargin;
114
115 unsigned char *font;
116 int initialized;
117};
118
119static struct bcmsc_softc *bcmsc_softc;
120static struct video_adapter_softc va_softc;
121
122#define bcm_fb_lock(_sc) mtx_lock(&(_sc)->mtx)
123#define bcm_fb_unlock(_sc) mtx_unlock(&(_sc)->mtx)
124#define bcm_fb_lock_assert(sc) mtx_assert(&(_sc)->mtx, MA_OWNED)
125
126static int bcm_fb_probe(device_t);
127static int bcm_fb_attach(device_t);
128static void bcm_fb_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err);
138 unsigned int stride;
139
140 unsigned int xmargin;
141 unsigned int ymargin;
142
143 unsigned char *font;
144 int initialized;
145};
146
147static struct bcmsc_softc *bcmsc_softc;
148static struct video_adapter_softc va_softc;
149
150#define bcm_fb_lock(_sc) mtx_lock(&(_sc)->mtx)
151#define bcm_fb_unlock(_sc) mtx_unlock(&(_sc)->mtx)
152#define bcm_fb_lock_assert(sc) mtx_assert(&(_sc)->mtx, MA_OWNED)
153
154static int bcm_fb_probe(device_t);
155static int bcm_fb_attach(device_t);
156static void bcm_fb_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err);
157static void bcmfb_update_margins(video_adapter_t *adp);
158static int bcmfb_configure(int);
129
130static void
131bcm_fb_init(void *arg)
132{
133 struct bcmsc_softc *sc = arg;
134 struct video_adapter_softc *va_sc = &va_softc;
135 int err;
136 volatile struct bcm_fb_config* fb_config = sc->fb_config;
159
160static void
161bcm_fb_init(void *arg)
162{
163 struct bcmsc_softc *sc = arg;
164 struct video_adapter_softc *va_sc = &va_softc;
165 int err;
166 volatile struct bcm_fb_config* fb_config = sc->fb_config;
167 phandle_t node;
168 pcell_t cell;
137
169
138 /* TODO: replace it with FDT stuff */
139 fb_config->xres = FB_WIDTH;
140 fb_config->yres = FB_HEIGHT;
170 node = ofw_bus_get_node(sc->dev);
171
172 fb_config->xres = 0;
173 fb_config->yres = 0;
174 fb_config->bpp = 0;
175
176 if ((OF_getprop(node, "broadcom,width", &cell, sizeof(cell))) > 0)
177 fb_config->xres = (int)fdt32_to_cpu(cell);
178 if (fb_config->xres == 0)
179 fb_config->xres = FB_WIDTH;
180
181 if ((OF_getprop(node, "broadcom,height", &cell, sizeof(cell))) > 0)
182 fb_config->yres = (uint32_t)fdt32_to_cpu(cell);
183 if (fb_config->yres == 0)
184 fb_config->yres = FB_HEIGHT;
185
186 if ((OF_getprop(node, "broadcom,depth", &cell, sizeof(cell))) > 0)
187 fb_config->bpp = (uint32_t)fdt32_to_cpu(cell);
188 if (fb_config->bpp == 0)
189 fb_config->bpp = FB_DEPTH;
190
141 fb_config->vxres = 0;
142 fb_config->vyres = 0;
143 fb_config->xoffset = 0;
144 fb_config->yoffset = 0;
191 fb_config->vxres = 0;
192 fb_config->vyres = 0;
193 fb_config->xoffset = 0;
194 fb_config->yoffset = 0;
145 fb_config->bpp = 24;
146 fb_config->base = 0;
147 fb_config->pitch = 0;
148 fb_config->screen_size = 0;
149
150 bus_dmamap_sync(sc->dma_tag, sc->dma_map,
151 BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
152 bcm_mbox_write(BCM2835_MBOX_CHAN_FB, sc->fb_config_phys);
153 bcm_mbox_read(BCM2835_MBOX_CHAN_FB, &err);
154 bus_dmamap_sync(sc->dma_tag, sc->dma_map,
155 BUS_DMASYNC_POSTREAD);
156
195 fb_config->base = 0;
196 fb_config->pitch = 0;
197 fb_config->screen_size = 0;
198
199 bus_dmamap_sync(sc->dma_tag, sc->dma_map,
200 BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
201 bcm_mbox_write(BCM2835_MBOX_CHAN_FB, sc->fb_config_phys);
202 bcm_mbox_read(BCM2835_MBOX_CHAN_FB, &err);
203 bus_dmamap_sync(sc->dma_tag, sc->dma_map,
204 BUS_DMASYNC_POSTREAD);
205
157 if (err == 0) {
206 if (fb_config->base != 0) {
158 device_printf(sc->dev, "%dx%d(%dx%d@%d,%d) %dbpp\n",
159 fb_config->xres, fb_config->yres,
160 fb_config->vxres, fb_config->vyres,
161 fb_config->xoffset, fb_config->yoffset,
162 fb_config->bpp);
163
164
165 device_printf(sc->dev, "pitch %d, base 0x%08x, screen_size %d\n",
166 fb_config->pitch, fb_config->base,
167 fb_config->screen_size);
168
207 device_printf(sc->dev, "%dx%d(%dx%d@%d,%d) %dbpp\n",
208 fb_config->xres, fb_config->yres,
209 fb_config->vxres, fb_config->vyres,
210 fb_config->xoffset, fb_config->yoffset,
211 fb_config->bpp);
212
213
214 device_printf(sc->dev, "pitch %d, base 0x%08x, screen_size %d\n",
215 fb_config->pitch, fb_config->base,
216 fb_config->screen_size);
217
169 if (fb_config->base) {
170 va_sc->fb_addr = (intptr_t)pmap_mapdev(fb_config->base, fb_config->screen_size);
171 va_sc->fb_size = fb_config->screen_size;
172 va_sc->stride = fb_config->pitch;
173 }
218 va_sc->fb_addr = (intptr_t)pmap_mapdev(fb_config->base, fb_config->screen_size);
219 va_sc->fb_size = fb_config->screen_size;
220 va_sc->depth = fb_config->bpp;
221 va_sc->stride = fb_config->pitch;
222
223 va_sc->width = fb_config->xres;
224 va_sc->height = fb_config->yres;
225 bcmfb_update_margins(&va_sc->va);
174 }
226 }
175 else
227 else {
176 device_printf(sc->dev, "Failed to set framebuffer info\n");
228 device_printf(sc->dev, "Failed to set framebuffer info\n");
229 return;
230 }
177
178 config_intrhook_disestablish(&sc->init_hook);
179}
180
181static int
182bcm_fb_probe(device_t dev)
183{
231
232 config_intrhook_disestablish(&sc->init_hook);
233}
234
235static int
236bcm_fb_probe(device_t dev)
237{
184 int error;
238 int error = 0;
185
186 if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-fb"))
187 return (ENXIO);
188
189 device_set_desc(dev, "BCM2835 framebuffer device");
190
191 error = sc_probe_unit(device_get_unit(dev),
192 device_get_flags(dev) | SC_AUTODETECT_KBD);
239
240 if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-fb"))
241 return (ENXIO);
242
243 device_set_desc(dev, "BCM2835 framebuffer device");
244
245 error = sc_probe_unit(device_get_unit(dev),
246 device_get_flags(dev) | SC_AUTODETECT_KBD);
193
194 if (error != 0)
195 return (error);
196
247 if (error != 0)
248 return (error);
249
250
197 return (BUS_PROBE_DEFAULT);
198}
199
200static int
201bcm_fb_attach(device_t dev)
202{
203 struct bcmsc_softc *sc = device_get_softc(dev);
204 int dma_size = sizeof(struct bcm_fb_config);

--- 83 unchanged lines hidden (view full) ---

288static devclass_t bcm_fb_devclass;
289
290static driver_t bcm_fb_driver = {
291 "fb",
292 bcm_fb_methods,
293 sizeof(struct bcmsc_softc),
294};
295
251 return (BUS_PROBE_DEFAULT);
252}
253
254static int
255bcm_fb_attach(device_t dev)
256{
257 struct bcmsc_softc *sc = device_get_softc(dev);
258 int dma_size = sizeof(struct bcm_fb_config);

--- 83 unchanged lines hidden (view full) ---

342static devclass_t bcm_fb_devclass;
343
344static driver_t bcm_fb_driver = {
345 "fb",
346 bcm_fb_methods,
347 sizeof(struct bcmsc_softc),
348};
349
296DRIVER_MODULE(bcm2835fb, simplebus, bcm_fb_driver, bcm_fb_devclass, 0, 0);
350DRIVER_MODULE(bcm2835fb, fdtbus, bcm_fb_driver, bcm_fb_devclass, 0, 0);
297
298/*
299 * Video driver routines and glue.
300 */
351
352/*
353 * Video driver routines and glue.
354 */
301static int bcmfb_configure(int);
302static vi_probe_t bcmfb_probe;
303static vi_init_t bcmfb_init;
304static vi_get_info_t bcmfb_get_info;
305static vi_query_mode_t bcmfb_query_mode;
306static vi_set_mode_t bcmfb_set_mode;
307static vi_save_font_t bcmfb_save_font;
308static vi_load_font_t bcmfb_load_font;
309static vi_show_font_t bcmfb_show_font;

--- 59 unchanged lines hidden (view full) ---

369
370extern sc_rndr_sw_t txtrndrsw;
371RENDERER(bcmfb, 0, txtrndrsw, gfb_set);
372RENDERER_MODULE(bcmfb, gfb_set);
373
374static uint16_t bcmfb_static_window[ROW*COL];
375extern u_char dflt_font_16[];
376
355static vi_probe_t bcmfb_probe;
356static vi_init_t bcmfb_init;
357static vi_get_info_t bcmfb_get_info;
358static vi_query_mode_t bcmfb_query_mode;
359static vi_set_mode_t bcmfb_set_mode;
360static vi_save_font_t bcmfb_save_font;
361static vi_load_font_t bcmfb_load_font;
362static vi_show_font_t bcmfb_show_font;

--- 59 unchanged lines hidden (view full) ---

422
423extern sc_rndr_sw_t txtrndrsw;
424RENDERER(bcmfb, 0, txtrndrsw, gfb_set);
425RENDERER_MODULE(bcmfb, gfb_set);
426
427static uint16_t bcmfb_static_window[ROW*COL];
428extern u_char dflt_font_16[];
429
430/*
431 * Update videoadapter settings after changing resolution
432 */
433static void
434bcmfb_update_margins(video_adapter_t *adp)
435{
436 struct video_adapter_softc *sc;
437 video_info_t *vi;
438
439 sc = (struct video_adapter_softc *)adp;
440 vi = &adp->va_info;
441
442 sc->xmargin = (sc->width - (vi->vi_width * vi->vi_cwidth)) / 2;
443 sc->ymargin = (sc->height - (vi->vi_height * vi->vi_cheight))/2;
444}
445
377static int
378bcmfb_configure(int flags)
379{
446static int
447bcmfb_configure(int flags)
448{
380 struct video_adapter_softc *sc;
449 struct video_adapter_softc *va_sc;
381
450
382 sc = &va_softc;
451 va_sc = &va_softc;
452 phandle_t display, root;
453 pcell_t cell;
383
454
384 if (sc->initialized)
385 return 0;
455 if (va_sc->initialized)
456 return (0);
386
457
387 sc->height = FB_HEIGHT;
388 sc->width = FB_WIDTH;
458 va_sc->width = 0;
459 va_sc->height = 0;
389
460
390 bcmfb_init(0, &sc->va, 0);
461 /*
462 * It seems there is no way to let syscons framework know
463 * that framebuffer resolution has changed. So just try
464 * to fetch data from FDT and go with defaults if failed
465 */
466 root = OF_finddevice("/");
467 if ((root != 0) &&
468 (display = fdt_find_compatible(root, "broadcom,bcm2835-fb", 1))) {
469 if ((OF_getprop(display, "broadcom,width",
470 &cell, sizeof(cell))) > 0)
471 va_sc->width = (int)fdt32_to_cpu(cell);
391
472
392 sc->initialized = 1;
473 if ((OF_getprop(display, "broadcom,height",
474 &cell, sizeof(cell))) > 0)
475 va_sc->height = (int)fdt32_to_cpu(cell);
476 }
393
477
478 if (va_sc->width == 0)
479 va_sc->width = FB_WIDTH;
480 if (va_sc->height == 0)
481 va_sc->height = FB_HEIGHT;
482
483 bcmfb_init(0, &va_sc->va, 0);
484
485 va_sc->initialized = 1;
486
394 return (0);
395}
396
397static int
398bcmfb_probe(int unit, video_adapter_t **adp, void *arg, int flags)
399{
400
401 return (0);

--- 8 unchanged lines hidden (view full) ---

410 sc = (struct video_adapter_softc *)adp;
411 vi = &adp->va_info;
412
413 vid_init_struct(adp, "bcmfb", -1, unit);
414
415 sc->font = dflt_font_16;
416 vi->vi_cheight = BCMFB_FONT_HEIGHT;
417 vi->vi_cwidth = 8;
487 return (0);
488}
489
490static int
491bcmfb_probe(int unit, video_adapter_t **adp, void *arg, int flags)
492{
493
494 return (0);

--- 8 unchanged lines hidden (view full) ---

503 sc = (struct video_adapter_softc *)adp;
504 vi = &adp->va_info;
505
506 vid_init_struct(adp, "bcmfb", -1, unit);
507
508 sc->font = dflt_font_16;
509 vi->vi_cheight = BCMFB_FONT_HEIGHT;
510 vi->vi_cwidth = 8;
511
418 vi->vi_width = sc->width/8;
419 vi->vi_height = sc->height/vi->vi_cheight;
420
421 /*
422 * Clamp width/height to syscons maximums
423 */
424 if (vi->vi_width > COL)
425 vi->vi_width = COL;
426 if (vi->vi_height > ROW)
427 vi->vi_height = ROW;
428
429 sc->xmargin = (sc->width - (vi->vi_width * vi->vi_cwidth)) / 2;
430 sc->ymargin = (sc->height - (vi->vi_height * vi->vi_cheight))/2;
431
512 vi->vi_width = sc->width/8;
513 vi->vi_height = sc->height/vi->vi_cheight;
514
515 /*
516 * Clamp width/height to syscons maximums
517 */
518 if (vi->vi_width > COL)
519 vi->vi_width = COL;
520 if (vi->vi_height > ROW)
521 vi->vi_height = ROW;
522
523 sc->xmargin = (sc->width - (vi->vi_width * vi->vi_cwidth)) / 2;
524 sc->ymargin = (sc->height - (vi->vi_height * vi->vi_cheight))/2;
525
526
432 adp->va_window = (vm_offset_t) bcmfb_static_window;
433 adp->va_flags |= V_ADP_FONT /* | V_ADP_COLOR | V_ADP_MODECHANGE */;
434
435 vid_register(&sc->va);
436
437 return (0);
438}
439

--- 96 unchanged lines hidden (view full) ---

536{
537 return (0);
538}
539
540static int
541bcmfb_blank_display(video_adapter_t *adp, int mode)
542{
543
527 adp->va_window = (vm_offset_t) bcmfb_static_window;
528 adp->va_flags |= V_ADP_FONT /* | V_ADP_COLOR | V_ADP_MODECHANGE */;
529
530 vid_register(&sc->va);
531
532 return (0);
533}
534

--- 96 unchanged lines hidden (view full) ---

631{
632 return (0);
633}
634
635static int
636bcmfb_blank_display(video_adapter_t *adp, int mode)
637{
638
639 struct video_adapter_softc *sc;
640
641 sc = (struct video_adapter_softc *)adp;
642 if (sc && sc->fb_addr)
643 memset((void*)sc->fb_addr, 0, sc->fb_size);
644
544 return (0);
545}
546
547static int
548bcmfb_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr,
549 int prot, vm_memattr_t *memattr)
550{
551 struct video_adapter_softc *sc;

--- 81 unchanged lines hidden (view full) ---

633{
634 struct video_adapter_softc *sc;
635 int row;
636 int col;
637 int i, j, k;
638 uint8_t *addr;
639 u_char *p;
640 uint8_t fg, bg, color;
645 return (0);
646}
647
648static int
649bcmfb_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr,
650 int prot, vm_memattr_t *memattr)
651{
652 struct video_adapter_softc *sc;

--- 81 unchanged lines hidden (view full) ---

734{
735 struct video_adapter_softc *sc;
736 int row;
737 int col;
738 int i, j, k;
739 uint8_t *addr;
740 u_char *p;
741 uint8_t fg, bg, color;
742 uint16_t rgb;
641
642 sc = (struct video_adapter_softc *)adp;
643
644 if (sc->fb_addr == 0)
645 return (0);
646
647 row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight;
648 col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth;
649 p = sc->font + c*BCMFB_FONT_HEIGHT;
650 addr = (uint8_t *)sc->fb_addr
651 + (row + sc->ymargin)*(sc->stride)
652 + 3 * (col + sc->xmargin);
653
743
744 sc = (struct video_adapter_softc *)adp;
745
746 if (sc->fb_addr == 0)
747 return (0);
748
749 row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight;
750 col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth;
751 p = sc->font + c*BCMFB_FONT_HEIGHT;
752 addr = (uint8_t *)sc->fb_addr
753 + (row + sc->ymargin)*(sc->stride)
754 + 3 * (col + sc->xmargin);
755
654 /*
655 * FIXME: hardcoded
656 */
657 bg = 0x00;
658 fg = 0x80;
756 fg = a & 0xf ;
757 bg = (a >> 8) & 0xf;
659
660 for (i = 0; i < BCMFB_FONT_HEIGHT; i++) {
661 for (j = 0, k = 7; j < 8; j++, k--) {
662 if ((p[i] & (1 << k)) == 0)
663 color = bg;
664 else
665 color = fg;
666
758
759 for (i = 0; i < BCMFB_FONT_HEIGHT; i++) {
760 for (j = 0, k = 7; j < 8; j++, k--) {
761 if ((p[i] & (1 << k)) == 0)
762 color = bg;
763 else
764 color = fg;
765
667 addr[3*j] = color;
668 addr[3*j+1] = color;
669 addr[3*j+2] = color;
766 switch (sc->depth) {
767 case 32:
768 addr[4*j+0] = bcmfb_palette[color].r;
769 addr[4*j+1] = bcmfb_palette[color].g;
770 addr[4*j+2] = bcmfb_palette[color].b;
771 addr[4*j+3] = bcmfb_palette[color].a;
772 break;
773 case 24:
774 addr[3*j] = bcmfb_palette[color].r;
775 addr[3*j+1] = bcmfb_palette[color].g;
776 addr[3*j+2] = bcmfb_palette[color].b;
777 break;
778 case 16:
779 rgb = (bcmfb_palette[color].r >> 3) << 10;
780 rgb |= (bcmfb_palette[color].g >> 3) << 5;
781 rgb |= (bcmfb_palette[color].b >> 3);
782 addr[2*j] = (rgb >> 8) & 0xff;
783 addr[2*j + 1] = rgb & 0xff;
784 default:
785 /* Not supported yet */
786 break;
787 }
670 }
671
672 addr += (sc->stride);
673 }
674
675 return (0);
676}
677

--- 37 unchanged lines hidden ---
788 }
789
790 addr += (sc->stride);
791 }
792
793 return (0);
794}
795

--- 37 unchanged lines hidden ---