• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
4  */
5 
6 #ifndef __EDP_CONNECTOR_H__
7 #define __EDP_CONNECTOR_H__
8 
9 #include <linux/i2c.h>
10 #include <linux/interrupt.h>
11 #include <linux/kernel.h>
12 #include <linux/platform_device.h>
13 #include <drm/drm_bridge.h>
14 #include <drm/drm_crtc.h>
15 #include <drm/drm_dp_helper.h>
16 
17 #include "msm_drv.h"
18 
19 #define edp_read(offset) msm_readl((offset))
20 #define edp_write(offset, data) msm_writel((data), (offset))
21 
22 struct edp_ctrl;
23 struct edp_aux;
24 struct edp_phy;
25 
26 struct msm_edp {
27 	struct drm_device *dev;
28 	struct platform_device *pdev;
29 
30 	struct drm_connector *connector;
31 	struct drm_bridge *bridge;
32 
33 	/* the encoder we are hooked to (outside of eDP block) */
34 	struct drm_encoder *encoder;
35 
36 	struct edp_ctrl *ctrl;
37 
38 	int irq;
39 };
40 
41 /* eDP bridge */
42 struct drm_bridge *msm_edp_bridge_init(struct msm_edp *edp);
43 void edp_bridge_destroy(struct drm_bridge *bridge);
44 
45 /* eDP connector */
46 struct drm_connector *msm_edp_connector_init(struct msm_edp *edp);
47 
48 /* AUX */
49 void *msm_edp_aux_init(struct device *dev, void __iomem *regbase,
50 			struct drm_dp_aux **drm_aux);
51 void msm_edp_aux_destroy(struct device *dev, struct edp_aux *aux);
52 irqreturn_t msm_edp_aux_irq(struct edp_aux *aux, u32 isr);
53 void msm_edp_aux_ctrl(struct edp_aux *aux, int enable);
54 
55 /* Phy */
56 bool msm_edp_phy_ready(struct edp_phy *phy);
57 void msm_edp_phy_ctrl(struct edp_phy *phy, int enable);
58 void msm_edp_phy_vm_pe_init(struct edp_phy *phy);
59 void msm_edp_phy_vm_pe_cfg(struct edp_phy *phy, u32 v0, u32 v1);
60 void msm_edp_phy_lane_power_ctrl(struct edp_phy *phy, bool up, u32 max_lane);
61 void *msm_edp_phy_init(struct device *dev, void __iomem *regbase);
62 
63 /* Ctrl */
64 irqreturn_t msm_edp_ctrl_irq(struct edp_ctrl *ctrl);
65 void msm_edp_ctrl_power(struct edp_ctrl *ctrl, bool on);
66 int msm_edp_ctrl_init(struct msm_edp *edp);
67 void msm_edp_ctrl_destroy(struct edp_ctrl *ctrl);
68 bool msm_edp_ctrl_panel_connected(struct edp_ctrl *ctrl);
69 int msm_edp_ctrl_get_panel_info(struct edp_ctrl *ctrl,
70 	struct drm_connector *connector, struct edid **edid);
71 int msm_edp_ctrl_timing_cfg(struct edp_ctrl *ctrl,
72 				const struct drm_display_mode *mode,
73 				const struct drm_display_info *info);
74 /* @pixel_rate is in kHz */
75 bool msm_edp_ctrl_pixel_clock_valid(struct edp_ctrl *ctrl,
76 	u32 pixel_rate, u32 *pm, u32 *pn);
77 
78 #endif /* __EDP_CONNECTOR_H__ */
79