rcar_du_drv.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * rcar_du_drv.h -- R-Car Display Unit DRM driver
  3. *
  4. * Copyright (C) 2013 Renesas Corporation
  5. *
  6. * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. */
  13. #ifndef __RCAR_DU_DRV_H__
  14. #define __RCAR_DU_DRV_H__
  15. #include <linux/kernel.h>
  16. #include <linux/mutex.h>
  17. #include <linux/platform_data/rcar-du.h>
  18. #include "rcar_du_crtc.h"
  19. #include "rcar_du_plane.h"
  20. struct clk;
  21. struct device;
  22. struct drm_device;
  23. struct rcar_du_device {
  24. struct device *dev;
  25. const struct rcar_du_platform_data *pdata;
  26. void __iomem *mmio;
  27. struct clk *clock;
  28. unsigned int use_count;
  29. struct drm_device *ddev;
  30. struct rcar_du_crtc crtcs[2];
  31. unsigned int used_crtcs;
  32. unsigned int num_crtcs;
  33. struct {
  34. struct rcar_du_plane planes[RCAR_DU_NUM_SW_PLANES];
  35. unsigned int free;
  36. struct mutex lock;
  37. struct drm_property *alpha;
  38. struct drm_property *colorkey;
  39. struct drm_property *zpos;
  40. } planes;
  41. };
  42. int rcar_du_get(struct rcar_du_device *rcdu);
  43. void rcar_du_put(struct rcar_du_device *rcdu);
  44. static inline u32 rcar_du_read(struct rcar_du_device *rcdu, u32 reg)
  45. {
  46. return ioread32(rcdu->mmio + reg);
  47. }
  48. static inline void rcar_du_write(struct rcar_du_device *rcdu, u32 reg, u32 data)
  49. {
  50. iowrite32(data, rcdu->mmio + reg);
  51. }
  52. #endif /* __RCAR_DU_DRV_H__ */