armada_drm.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (C) 2012 Russell King
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef ARMADA_DRM_H
  9. #define ARMADA_DRM_H
  10. #include <linux/kfifo.h>
  11. #include <linux/io.h>
  12. #include <linux/workqueue.h>
  13. #include <drm/drmP.h>
  14. struct armada_crtc;
  15. struct armada_gem_object;
  16. struct clk;
  17. struct drm_fb_helper;
  18. static inline void
  19. armada_updatel(uint32_t val, uint32_t mask, void __iomem *ptr)
  20. {
  21. uint32_t ov, v;
  22. ov = v = readl_relaxed(ptr);
  23. v = (v & ~mask) | val;
  24. if (ov != v)
  25. writel_relaxed(v, ptr);
  26. }
  27. static inline uint32_t armada_pitch(uint32_t width, uint32_t bpp)
  28. {
  29. uint32_t pitch = bpp != 4 ? width * ((bpp + 7) / 8) : width / 2;
  30. /* 88AP510 spec recommends pitch be a multiple of 128 */
  31. return ALIGN(pitch, 128);
  32. }
  33. struct armada_private;
  34. struct armada_variant {
  35. bool has_spu_adv_reg;
  36. int (*init)(struct armada_crtc *, struct device *);
  37. int (*compute_clock)(struct armada_crtc *,
  38. const struct drm_display_mode *,
  39. uint32_t *);
  40. void (*disable)(struct armada_crtc *);
  41. void (*enable)(struct armada_crtc *, const struct drm_display_mode *);
  42. };
  43. /* Variant ops */
  44. extern const struct armada_variant armada510_ops;
  45. struct armada_private {
  46. struct drm_device drm;
  47. struct drm_fb_helper *fbdev;
  48. struct armada_crtc *dcrtc[2];
  49. struct drm_mm linear; /* protected by linear_lock */
  50. struct mutex linear_lock;
  51. struct drm_property *colorkey_prop;
  52. struct drm_property *colorkey_min_prop;
  53. struct drm_property *colorkey_max_prop;
  54. struct drm_property *colorkey_val_prop;
  55. struct drm_property *colorkey_alpha_prop;
  56. struct drm_property *colorkey_mode_prop;
  57. struct drm_property *brightness_prop;
  58. struct drm_property *contrast_prop;
  59. struct drm_property *saturation_prop;
  60. #ifdef CONFIG_DEBUG_FS
  61. struct dentry *de;
  62. #endif
  63. };
  64. int armada_fbdev_init(struct drm_device *);
  65. void armada_fbdev_fini(struct drm_device *);
  66. int armada_overlay_plane_create(struct drm_device *, unsigned long);
  67. int armada_drm_debugfs_init(struct drm_minor *);
  68. #endif