simplefb.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * simplefb.h - Simple Framebuffer Device
  3. *
  4. * Copyright (C) 2013 David Herrmann <dh.herrmann@gmail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #ifndef __PLATFORM_DATA_SIMPLEFB_H__
  12. #define __PLATFORM_DATA_SIMPLEFB_H__
  13. #include <drm/drm_fourcc.h>
  14. #include <linux/fb.h>
  15. #include <linux/kernel.h>
  16. /* format array, use it to initialize a "struct simplefb_format" array */
  17. #define SIMPLEFB_FORMATS \
  18. { \
  19. { "r5g6b5", 16, {11, 5}, {5, 6}, {0, 5}, {0, 0}, DRM_FORMAT_RGB565 }, \
  20. }
  21. /*
  22. * Data-Format for Simple-Framebuffers
  23. * @name: unique 0-terminated name that can be used to identify the mode
  24. * @red,green,blue: Offsets and sizes of the single RGB parts
  25. * @transp: Offset and size of the alpha bits. length=0 means no alpha
  26. * @fourcc: 32bit DRM four-CC code (see drm_fourcc.h)
  27. */
  28. struct simplefb_format {
  29. const char *name;
  30. u32 bits_per_pixel;
  31. struct fb_bitfield red;
  32. struct fb_bitfield green;
  33. struct fb_bitfield blue;
  34. struct fb_bitfield transp;
  35. u32 fourcc;
  36. };
  37. /*
  38. * Simple-Framebuffer description
  39. * If the arch-boot code creates simple-framebuffers without DT support, it
  40. * can pass the width, height, stride and format via this platform-data object.
  41. * The framebuffer location must be given as IORESOURCE_MEM resource.
  42. * @format must be a format as described in "struct simplefb_format" above.
  43. */
  44. struct simplefb_platform_data {
  45. u32 width;
  46. u32 height;
  47. u32 stride;
  48. const char *format;
  49. };
  50. #endif /* __PLATFORM_DATA_SIMPLEFB_H__ */