meson-canvas.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2018 BayLibre, SAS
  4. */
  5. #ifndef __SOC_MESON_CANVAS_H
  6. #define __SOC_MESON_CANVAS_H
  7. #include <linux/kernel.h>
  8. #define MESON_CANVAS_WRAP_NONE 0x00
  9. #define MESON_CANVAS_WRAP_X 0x01
  10. #define MESON_CANVAS_WRAP_Y 0x02
  11. #define MESON_CANVAS_BLKMODE_LINEAR 0x00
  12. #define MESON_CANVAS_BLKMODE_32x32 0x01
  13. #define MESON_CANVAS_BLKMODE_64x64 0x02
  14. #define MESON_CANVAS_ENDIAN_SWAP16 0x1
  15. #define MESON_CANVAS_ENDIAN_SWAP32 0x3
  16. #define MESON_CANVAS_ENDIAN_SWAP64 0x7
  17. #define MESON_CANVAS_ENDIAN_SWAP128 0xf
  18. struct device;
  19. struct meson_canvas;
  20. /**
  21. * meson_canvas_get() - get a canvas provider instance
  22. *
  23. * @dev: consumer device pointer
  24. */
  25. struct meson_canvas *meson_canvas_get(struct device *dev);
  26. /**
  27. * meson_canvas_alloc() - take ownership of a canvas
  28. *
  29. * @canvas: canvas provider instance retrieved from meson_canvas_get()
  30. * @canvas_index: will be filled with the canvas ID
  31. */
  32. int meson_canvas_alloc(struct meson_canvas *canvas, u8 *canvas_index);
  33. /**
  34. * meson_canvas_free() - remove ownership from a canvas
  35. *
  36. * @canvas: canvas provider instance retrieved from meson_canvas_get()
  37. * @canvas_index: canvas ID that was obtained via meson_canvas_alloc()
  38. */
  39. int meson_canvas_free(struct meson_canvas *canvas, u8 canvas_index);
  40. /**
  41. * meson_canvas_config() - configure a canvas
  42. *
  43. * @canvas: canvas provider instance retrieved from meson_canvas_get()
  44. * @canvas_index: canvas ID that was obtained via meson_canvas_alloc()
  45. * @addr: physical address to the pixel buffer
  46. * @stride: width of the buffer
  47. * @height: height of the buffer
  48. * @wrap: undocumented
  49. * @blkmode: block mode (linear, 32x32, 64x64)
  50. * @endian: byte swapping (swap16, swap32, swap64, swap128)
  51. */
  52. int meson_canvas_config(struct meson_canvas *canvas, u8 canvas_index,
  53. u32 addr, u32 stride, u32 height,
  54. unsigned int wrap, unsigned int blkmode,
  55. unsigned int endian);
  56. #endif