edp.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
  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 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef __EDP_CONNECTOR_H__
  14. #define __EDP_CONNECTOR_H__
  15. #include <linux/i2c.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/kernel.h>
  18. #include <linux/platform_device.h>
  19. #include "drm_crtc.h"
  20. #include "drm_dp_helper.h"
  21. #include "msm_drv.h"
  22. #define edp_read(offset) msm_readl((offset))
  23. #define edp_write(offset, data) msm_writel((data), (offset))
  24. struct edp_ctrl;
  25. struct edp_aux;
  26. struct edp_phy;
  27. struct msm_edp {
  28. struct drm_device *dev;
  29. struct platform_device *pdev;
  30. struct drm_connector *connector;
  31. struct drm_bridge *bridge;
  32. /* the encoder we are hooked to (outside of eDP block) */
  33. struct drm_encoder *encoder;
  34. struct edp_ctrl *ctrl;
  35. int irq;
  36. };
  37. /* eDP bridge */
  38. struct drm_bridge *msm_edp_bridge_init(struct msm_edp *edp);
  39. void edp_bridge_destroy(struct drm_bridge *bridge);
  40. /* eDP connector */
  41. struct drm_connector *msm_edp_connector_init(struct msm_edp *edp);
  42. /* AUX */
  43. void *msm_edp_aux_init(struct device *dev, void __iomem *regbase,
  44. struct drm_dp_aux **drm_aux);
  45. void msm_edp_aux_destroy(struct device *dev, struct edp_aux *aux);
  46. irqreturn_t msm_edp_aux_irq(struct edp_aux *aux, u32 isr);
  47. void msm_edp_aux_ctrl(struct edp_aux *aux, int enable);
  48. /* Phy */
  49. bool msm_edp_phy_ready(struct edp_phy *phy);
  50. void msm_edp_phy_ctrl(struct edp_phy *phy, int enable);
  51. void msm_edp_phy_vm_pe_init(struct edp_phy *phy);
  52. void msm_edp_phy_vm_pe_cfg(struct edp_phy *phy, u32 v0, u32 v1);
  53. void msm_edp_phy_lane_power_ctrl(struct edp_phy *phy, bool up, u32 max_lane);
  54. void *msm_edp_phy_init(struct device *dev, void __iomem *regbase);
  55. /* Ctrl */
  56. irqreturn_t msm_edp_ctrl_irq(struct edp_ctrl *ctrl);
  57. void msm_edp_ctrl_power(struct edp_ctrl *ctrl, bool on);
  58. int msm_edp_ctrl_init(struct msm_edp *edp);
  59. void msm_edp_ctrl_destroy(struct edp_ctrl *ctrl);
  60. bool msm_edp_ctrl_panel_connected(struct edp_ctrl *ctrl);
  61. int msm_edp_ctrl_get_panel_info(struct edp_ctrl *ctrl,
  62. struct drm_connector *connector, struct edid **edid);
  63. int msm_edp_ctrl_timing_cfg(struct edp_ctrl *ctrl,
  64. const struct drm_display_mode *mode,
  65. const struct drm_display_info *info);
  66. /* @pixel_rate is in kHz */
  67. bool msm_edp_ctrl_pixel_clock_valid(struct edp_ctrl *ctrl,
  68. u32 pixel_rate, u32 *pm, u32 *pn);
  69. #endif /* __EDP_CONNECTOR_H__ */