1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
9 #include <linux/platform_device.h>
10 #include <linux/phy/phy.h>
11 #include <linux/phy/phy-dp.h>
15 #define DP_LABEL "MDSS DP DISPLAY"
16 #define DP_MAX_PIXEL_CLK_KHZ 675000
17 #define DP_MAX_NUM_DP_LANES 4
18 #define DP_LINK_RATE_HBR2 540000 /* kbytes */
28 struct dss_io_region {
34 struct dss_io_region ahb;
35 struct dss_io_region aux;
36 struct dss_io_region link;
37 struct dss_io_region p0;
40 static inline const char *dp_parser_pm_name(enum dp_pm_type module)
43 case DP_CORE_PM: return "DP_CORE_PM";
44 case DP_CTRL_PM: return "DP_CTRL_PM";
45 case DP_STREAM_PM: return "DP_STREAM_PM";
46 case DP_PHY_PM: return "DP_PHY_PM";
47 default: return "???";
52 * struct dp_display_data - display related device tree data.
54 * @ctrl_node: referece to controller device
55 * @phy_node: reference to phy device
56 * @is_active: is the controller currently active
57 * @name: name of the display
58 * @display_type: type of the display
60 struct dp_display_data {
61 struct device_node *ctrl_node;
62 struct device_node *phy_node;
65 const char *display_type;
69 * struct dp_ctrl_resource - controller's IO related data
71 * @dp_controller: Display Port controller mapped memory address
72 * @phy_io: phy's mapped memory address
75 struct dss_io_data dp_controller;
77 union phy_configure_opts phy_opts;
81 * struct dp_pinctrl - DP's pin control
83 * @pin: pin-controller's instance
84 * @state_active: active state pin control
85 * @state_hpd_active: hpd active state pin control
86 * @state_suspend: suspend state pin control
90 struct pinctrl_state *state_active;
91 struct pinctrl_state *state_hpd_active;
92 struct pinctrl_state *state_suspend;
95 /* Regulators for DP devices */
102 struct dss_module_power {
103 unsigned int num_clk;
104 struct clk_bulk_data *clocks;
108 * struct dp_parser - DP parser's data exposed to clients
110 * @pdev: platform data of the client
111 * @mp: gpio, regulator and clock related data
112 * @pinctrl: pin-control related data
113 * @disp_data: controller's display related data
114 * @parse: function to be called by client to parse device tree.
117 struct platform_device *pdev;
118 struct dss_module_power mp[DP_MAX_PM];
119 struct dp_pinctrl pinctrl;
121 struct dp_display_data disp_data;
123 u32 max_dp_link_rate;
124 struct drm_bridge *next_bridge;
126 int (*parse)(struct dp_parser *parser);
130 * dp_parser_get() - get the DP's device tree parser module
132 * @pdev: platform data of the client
133 * return: pointer to dp_parser structure.
135 * This function provides client capability to parse the
136 * device tree and populate the data structures. The data
137 * related to clock, regulators, pin-control and other
138 * can be parsed using this module.
140 struct dp_parser *dp_parser_get(struct platform_device *pdev);
143 * devm_dp_parser_find_next_bridge() - find an additional bridge to DP
145 * @dev: device to tie bridge lifetime to
146 * @parser: dp_parser data from client
148 * This function is used to find any additional bridge attached to
149 * the DP controller. The eDP interface requires a panel bridge.
151 * Return: 0 if able to get the bridge, otherwise negative errno for failure.
153 int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser);