rockchip_drm_drv.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
  3. * Author:Mark Yao <mark.yao@rock-chips.com>
  4. *
  5. * based on exynos_drm_drv.h
  6. *
  7. * This software is licensed under the terms of the GNU General Public
  8. * License version 2, as published by the Free Software Foundation, and
  9. * may be copied, distributed, and modified under those terms.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. */
  16. #ifndef _ROCKCHIP_DRM_DRV_H
  17. #define _ROCKCHIP_DRM_DRV_H
  18. #include <drm/drm_fb_helper.h>
  19. #include <drm/drm_gem.h>
  20. #include <linux/module.h>
  21. #include <linux/component.h>
  22. #define ROCKCHIP_MAX_FB_BUFFER 3
  23. #define ROCKCHIP_MAX_CONNECTOR 2
  24. #define ROCKCHIP_MAX_CRTC 2
  25. struct drm_device;
  26. struct drm_connector;
  27. /*
  28. * Rockchip drm private crtc funcs.
  29. * @enable_vblank: enable crtc vblank irq.
  30. * @disable_vblank: disable crtc vblank irq.
  31. */
  32. struct rockchip_crtc_funcs {
  33. int (*enable_vblank)(struct drm_crtc *crtc);
  34. void (*disable_vblank)(struct drm_crtc *crtc);
  35. };
  36. /*
  37. * Rockchip drm private structure.
  38. *
  39. * @crtc: array of enabled CRTCs, used to map from "pipe" to drm_crtc.
  40. * @num_pipe: number of pipes for this device.
  41. */
  42. struct rockchip_drm_private {
  43. struct drm_fb_helper fbdev_helper;
  44. struct drm_gem_object *fbdev_bo;
  45. const struct rockchip_crtc_funcs *crtc_funcs[ROCKCHIP_MAX_CRTC];
  46. };
  47. int rockchip_register_crtc_funcs(struct drm_device *dev,
  48. const struct rockchip_crtc_funcs *crtc_funcs,
  49. int pipe);
  50. void rockchip_unregister_crtc_funcs(struct drm_device *dev, int pipe);
  51. int rockchip_drm_encoder_get_mux_id(struct device_node *node,
  52. struct drm_encoder *encoder);
  53. int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc, int connector_type,
  54. int out_mode);
  55. int rockchip_drm_dma_attach_device(struct drm_device *drm_dev,
  56. struct device *dev);
  57. void rockchip_drm_dma_detach_device(struct drm_device *drm_dev,
  58. struct device *dev);
  59. #endif /* _ROCKCHIP_DRM_DRV_H_ */