blob: 4181472c2a8c3544a53a05e14b2d34002369db0d [file] [log] [blame]
Ajay Singh Parmar0d6250b2017-04-02 14:08:51 -07001/*
Narender Ankam96d70542019-12-12 14:42:59 +05302 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
Ajay Singh Parmar0d6250b2017-04-02 14:08:51 -07003 *
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 */
14
15#ifndef _DP_DRM_H_
16#define _DP_DRM_H_
17
18#include <linux/types.h>
19#include <drm/drmP.h>
20#include <drm/drm_crtc.h>
21#include <drm/drm_crtc_helper.h>
22
23#include "msm_drv.h"
24#include "dp_display.h"
25
26struct dp_bridge {
27 struct drm_bridge base;
28 u32 id;
29
30 struct dp_display *display;
31 struct dp_display_mode dp_mode;
32};
33
34/**
Ajay Singh Parmar87af50b2017-12-22 22:22:55 -080035 * dp_connector_config_hdr - callback to configure HDR
Ajay Singh Parmar9c842d42017-09-21 13:02:05 -070036 * @display: Pointer to private display handle
Ajay Singh Parmar87af50b2017-12-22 22:22:55 -080037 * @c_state: connect state data
Ajay Singh Parmar9c842d42017-09-21 13:02:05 -070038 * Returns: Zero on success
39 */
Ajay Singh Parmar87af50b2017-12-22 22:22:55 -080040int dp_connector_config_hdr(void *display,
41 struct sde_connector_state *c_state);
Ajay Singh Parmar9c842d42017-09-21 13:02:05 -070042
43/**
Ajay Singh Parmar0d6250b2017-04-02 14:08:51 -070044 * dp_connector_post_init - callback to perform additional initialization steps
45 * @connector: Pointer to drm connector structure
Ajay Singh Parmar0d6250b2017-04-02 14:08:51 -070046 * @display: Pointer to private display handle
47 * Returns: Zero on success
48 */
Alan Kwong769fba92017-11-13 16:50:36 -050049int dp_connector_post_init(struct drm_connector *connector, void *display);
Ajay Singh Parmar0d6250b2017-04-02 14:08:51 -070050
51/**
52 * dp_connector_detect - callback to determine if connector is connected
53 * @connector: Pointer to drm connector structure
54 * @force: Force detect setting from drm framework
55 * @display: Pointer to private display handle
56 * Returns: Connector 'is connected' status
57 */
58enum drm_connector_status dp_connector_detect(struct drm_connector *conn,
59 bool force,
60 void *display);
61
62/**
63 * dp_connector_get_modes - callback to add drm modes via drm_mode_probed_add()
64 * @connector: Pointer to drm connector structure
65 * @display: Pointer to private display handle
66 * Returns: Number of modes added
67 */
68int dp_connector_get_modes(struct drm_connector *connector,
69 void *display);
70
71/**
72 * dp_connector_mode_valid - callback to determine if specified mode is valid
73 * @connector: Pointer to drm connector structure
74 * @mode: Pointer to drm mode structure
75 * @display: Pointer to private display handle
76 * Returns: Validity status for specified mode
77 */
78enum drm_mode_status dp_connector_mode_valid(struct drm_connector *connector,
79 struct drm_display_mode *mode,
80 void *display);
81
Tatenda Chipeperekwa9f2abe12017-05-25 12:06:22 -070082/**
Jeykumar Sankaran446a5f12017-05-09 20:30:39 -070083 * dp_connector_get_mode_info - retrieve information of the mode selected
Tatenda Chipeperekwa9f2abe12017-05-25 12:06:22 -070084 * @drm_mode: Display mode set for the display
Jeykumar Sankaran446a5f12017-05-09 20:30:39 -070085 * @mode_info: Out parameter. Information of the mode
Tatenda Chipeperekwa9f2abe12017-05-25 12:06:22 -070086 * @max_mixer_width: max width supported by HW layer mixer
Alan Kwongb1bca602017-09-18 17:28:45 -040087 * @display: Pointer to private display structure
Tatenda Chipeperekwa9f2abe12017-05-25 12:06:22 -070088 * Returns: zero on success
89 */
Jeykumar Sankaran446a5f12017-05-09 20:30:39 -070090int dp_connector_get_mode_info(const struct drm_display_mode *drm_mode,
91 struct msm_mode_info *mode_info,
Alan Kwongb1bca602017-09-18 17:28:45 -040092 u32 max_mixer_width, void *display);
Tatenda Chipeperekwa9f2abe12017-05-25 12:06:22 -070093
Ajay Singh Parmar0d6250b2017-04-02 14:08:51 -070094int dp_connector_get_info(struct msm_display_info *info, void *display);
95
Ajay Singh Parmar315e5852017-11-23 21:47:32 -080096/**
97 * dp_connector_post_open - handle the post open functionalites
98 * @display: Pointer to private display structure
99 */
100void dp_connector_post_open(void *display);
Padmanabhan Komanduru71aec2d2017-08-30 20:07:59 +0530101
Narender Ankam96d70542019-12-12 14:42:59 +0530102/**
103 * dp_conn_set_info_blob - callback to perform info blob initialization
104 * @connector: Pointer to drm connector structure
105 * @info: Pointer to sde connector info structure
106 * @display: Pointer to private display handle
107 * @mode_info: Pointer to mode info structure
108 * Returns: Zero on success
109 */
110int dp_connnector_set_info_blob(struct drm_connector *connector,
111 void *info, void *display, struct msm_mode_info *mode_info);
112
Ajay Singh Parmar0d6250b2017-04-02 14:08:51 -0700113int dp_drm_bridge_init(void *display,
114 struct drm_encoder *encoder);
115
116void dp_drm_bridge_deinit(void *display);
117#endif /* _DP_DRM_H_ */
118