blob: e8a6ab438adf102c057c882230e4f04f6ac8c2a9 [file] [log] [blame]
Ajay Singh Parmar0e187812016-05-16 17:45:31 -07001/*
Padmanabhan Komandurudbd2fb02016-12-02 15:18:49 +05302 * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
Ajay Singh Parmar0e187812016-05-16 17:45:31 -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 _DSI_CATALOG_H_
16#define _DSI_CATALOG_H_
17
18#include "dsi_ctrl_hw.h"
19#include "dsi_phy_hw.h"
20
21/**
22 * dsi_catalog_ctrl_setup() - return catalog info for dsi controller
23 * @ctrl: Pointer to DSI controller hw object.
24 * @version: DSI controller version.
25 * @index: DSI controller instance ID.
26 *
27 * This function setups the catalog information in the dsi_ctrl_hw object.
28 *
29 * return: error code for failure and 0 for success.
30 */
31int dsi_catalog_ctrl_setup(struct dsi_ctrl_hw *ctrl,
32 enum dsi_ctrl_version version,
33 u32 index);
34
35/**
36 * dsi_catalog_phy_setup() - return catalog info for dsi phy hardware
Padmanabhan Komanduru56611ef2016-12-19 12:21:11 +053037 * @phy: Pointer to DSI PHY hw object.
Ajay Singh Parmar0e187812016-05-16 17:45:31 -070038 * @version: DSI PHY version.
39 * @index: DSI PHY instance ID.
40 *
41 * This function setups the catalog information in the dsi_phy_hw object.
42 *
43 * return: error code for failure and 0 for success.
44 */
45int dsi_catalog_phy_setup(struct dsi_phy_hw *phy,
46 enum dsi_phy_version version,
47 u32 index);
48
Padmanabhan Komanduru56611ef2016-12-19 12:21:11 +053049/**
50 * dsi_phy_timing_calc_init() - initialize info for DSI PHY timing calculations
51 * @phy: Pointer to DSI PHY hw object.
52 * @version: DSI PHY version.
53 *
54 * This function setups the catalog information in the dsi_phy_hw object.
55 *
56 * return: error code for failure and 0 for success.
57 */
58int dsi_phy_timing_calc_init(struct dsi_phy_hw *phy,
59 enum dsi_phy_version version);
Ajay Singh Parmar0e187812016-05-16 17:45:31 -070060
Padmanabhan Komanduru56611ef2016-12-19 12:21:11 +053061/**
62 * dsi_phy_hw_calculate_timing_params() - DSI PHY timing parameter calculations
63 * @phy: Pointer to DSI PHY hw object.
64 * @mode: DSI mode information.
65 * @host: DSI host configuration.
66 * @timing: DSI phy lane configurations.
67 *
68 * This function setups the catalog information in the dsi_phy_hw object.
69 *
70 * return: error code for failure and 0 for success.
71 */
72int dsi_phy_hw_calculate_timing_params(struct dsi_phy_hw *phy,
73 struct dsi_mode_info *mode,
74 struct dsi_host_common_cfg *host,
75 struct dsi_phy_per_lane_cfgs *timing);
76
77/* Definitions for 14nm PHY hardware driver */
78void dsi_phy_hw_v2_0_regulator_enable(struct dsi_phy_hw *phy,
79 struct dsi_phy_per_lane_cfgs *cfg);
80void dsi_phy_hw_v2_0_regulator_disable(struct dsi_phy_hw *phy);
81void dsi_phy_hw_v2_0_enable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
82void dsi_phy_hw_v2_0_disable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
83void dsi_phy_hw_v2_0_idle_on(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
84void dsi_phy_hw_v2_0_idle_off(struct dsi_phy_hw *phy);
Padmanabhan Komanduruee89d212016-12-19 12:51:31 +053085int dsi_phy_hw_timing_val_v2_0(struct dsi_phy_per_lane_cfgs *timing_cfg,
86 u32 *timing_val, u32 size);
Padmanabhan Komanduru56611ef2016-12-19 12:21:11 +053087
88/* Definitions for 10nm PHY hardware driver */
89void dsi_phy_hw_v3_0_regulator_enable(struct dsi_phy_hw *phy,
90 struct dsi_phy_per_lane_cfgs *cfg);
91void dsi_phy_hw_v3_0_regulator_disable(struct dsi_phy_hw *phy);
92void dsi_phy_hw_v3_0_enable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
93void dsi_phy_hw_v3_0_disable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
94int dsi_phy_hw_v3_0_wait_for_lane_idle(struct dsi_phy_hw *phy, u32 lanes);
95void dsi_phy_hw_v3_0_ulps_request(struct dsi_phy_hw *phy,
96 struct dsi_phy_cfg *cfg, u32 lanes);
97void dsi_phy_hw_v3_0_ulps_exit(struct dsi_phy_hw *phy,
98 struct dsi_phy_cfg *cfg, u32 lanes);
99u32 dsi_phy_hw_v3_0_get_lanes_in_ulps(struct dsi_phy_hw *phy);
Veera Sundaram Sankaranbb3680f2017-04-21 13:20:46 -0700100bool dsi_phy_hw_v3_0_is_lanes_in_ulps(u32 lanes, u32 ulps_lanes);
Padmanabhan Komanduruee89d212016-12-19 12:51:31 +0530101int dsi_phy_hw_timing_val_v3_0(struct dsi_phy_per_lane_cfgs *timing_cfg,
102 u32 *timing_val, u32 size);
103
Padmanabhan Komanduru8ee8ee52016-12-19 12:10:51 +0530104/* DSI controller common ops */
105u32 dsi_ctrl_hw_cmn_get_interrupt_status(struct dsi_ctrl_hw *ctrl);
106void dsi_ctrl_hw_cmn_clear_interrupt_status(struct dsi_ctrl_hw *ctrl, u32 ints);
107void dsi_ctrl_hw_cmn_enable_status_interrupts(struct dsi_ctrl_hw *ctrl,
108 u32 ints);
109
110u64 dsi_ctrl_hw_cmn_get_error_status(struct dsi_ctrl_hw *ctrl);
111void dsi_ctrl_hw_cmn_clear_error_status(struct dsi_ctrl_hw *ctrl, u64 errors);
112void dsi_ctrl_hw_cmn_enable_error_interrupts(struct dsi_ctrl_hw *ctrl,
113 u64 errors);
114
115void dsi_ctrl_hw_cmn_video_test_pattern_setup(struct dsi_ctrl_hw *ctrl,
116 enum dsi_test_pattern type,
117 u32 init_val);
118void dsi_ctrl_hw_cmn_cmd_test_pattern_setup(struct dsi_ctrl_hw *ctrl,
119 enum dsi_test_pattern type,
120 u32 init_val,
121 u32 stream_id);
122void dsi_ctrl_hw_cmn_test_pattern_enable(struct dsi_ctrl_hw *ctrl, bool enable);
123void dsi_ctrl_hw_cmn_trigger_cmd_test_pattern(struct dsi_ctrl_hw *ctrl,
124 u32 stream_id);
125
126void dsi_ctrl_hw_cmn_host_setup(struct dsi_ctrl_hw *ctrl,
Ajay Singh Parmar0e187812016-05-16 17:45:31 -0700127 struct dsi_host_common_cfg *config);
Padmanabhan Komanduru8ee8ee52016-12-19 12:10:51 +0530128void dsi_ctrl_hw_cmn_video_engine_en(struct dsi_ctrl_hw *ctrl, bool on);
129void dsi_ctrl_hw_cmn_video_engine_setup(struct dsi_ctrl_hw *ctrl,
Ajay Singh Parmar0e187812016-05-16 17:45:31 -0700130 struct dsi_host_common_cfg *common_cfg,
131 struct dsi_video_engine_cfg *cfg);
Padmanabhan Komanduru8ee8ee52016-12-19 12:10:51 +0530132void dsi_ctrl_hw_cmn_set_video_timing(struct dsi_ctrl_hw *ctrl,
Ajay Singh Parmar0e187812016-05-16 17:45:31 -0700133 struct dsi_mode_info *mode);
134
Padmanabhan Komanduru8ee8ee52016-12-19 12:10:51 +0530135void dsi_ctrl_hw_cmn_cmd_engine_setup(struct dsi_ctrl_hw *ctrl,
Ajay Singh Parmar0e187812016-05-16 17:45:31 -0700136 struct dsi_host_common_cfg *common_cfg,
137 struct dsi_cmd_engine_cfg *cfg);
138
Padmanabhan Komanduru8ee8ee52016-12-19 12:10:51 +0530139void dsi_ctrl_hw_cmn_ctrl_en(struct dsi_ctrl_hw *ctrl, bool on);
140void dsi_ctrl_hw_cmn_cmd_engine_en(struct dsi_ctrl_hw *ctrl, bool on);
Ajay Singh Parmar0e187812016-05-16 17:45:31 -0700141
Padmanabhan Komanduru8ee8ee52016-12-19 12:10:51 +0530142void dsi_ctrl_hw_cmn_setup_cmd_stream(struct dsi_ctrl_hw *ctrl,
Alexander Beykunac182352017-02-27 17:46:51 -0500143 struct dsi_mode_info *mode,
Ajay Singh Parmaraa9152d2016-05-16 18:02:07 -0700144 u32 h_stride,
Lloyd Atkinson16e96de2017-04-19 11:18:14 -0400145 u32 vc_id,
146 struct dsi_rect *roi);
Padmanabhan Komanduru8ee8ee52016-12-19 12:10:51 +0530147void dsi_ctrl_hw_cmn_phy_sw_reset(struct dsi_ctrl_hw *ctrl);
148void dsi_ctrl_hw_cmn_soft_reset(struct dsi_ctrl_hw *ctrl);
Ajay Singh Parmar0e187812016-05-16 17:45:31 -0700149
Rajkumar Subbiah01e6dd642017-07-05 14:47:47 -0400150void dsi_ctrl_hw_cmn_setup_misr(struct dsi_ctrl_hw *ctrl,
151 enum dsi_op_mode panel_mode,
152 bool enable, u32 frame_count);
153u32 dsi_ctrl_hw_cmn_collect_misr(struct dsi_ctrl_hw *ctrl,
154 enum dsi_op_mode panel_mode);
155
Padmanabhan Komanduru8ee8ee52016-12-19 12:10:51 +0530156void dsi_ctrl_hw_cmn_kickoff_command(struct dsi_ctrl_hw *ctrl,
Ajay Singh Parmar0e187812016-05-16 17:45:31 -0700157 struct dsi_ctrl_cmd_dma_info *cmd,
158 u32 flags);
159
Padmanabhan Komanduru8ee8ee52016-12-19 12:10:51 +0530160void dsi_ctrl_hw_cmn_kickoff_fifo_command(struct dsi_ctrl_hw *ctrl,
Ajay Singh Parmar0e187812016-05-16 17:45:31 -0700161 struct dsi_ctrl_cmd_dma_fifo_info *cmd,
162 u32 flags);
Padmanabhan Komanduru8ee8ee52016-12-19 12:10:51 +0530163void dsi_ctrl_hw_cmn_reset_cmd_fifo(struct dsi_ctrl_hw *ctrl);
164void dsi_ctrl_hw_cmn_trigger_command_dma(struct dsi_ctrl_hw *ctrl);
165void dsi_ctrl_hw_dln0_phy_err(struct dsi_ctrl_hw *ctrl);
166void dsi_ctrl_hw_cmn_phy_reset_config(struct dsi_ctrl_hw *ctrl,
167 bool enable);
Shashank Babu Chinta Venkataafef8202017-04-21 13:49:56 -0700168void dsi_ctrl_hw_22_phy_reset_config(struct dsi_ctrl_hw *ctrl,
169 bool enable);
Padmanabhan Komanduru8ee8ee52016-12-19 12:10:51 +0530170
171/* Definitions specific to 1.4 DSI controller hardware */
172int dsi_ctrl_hw_14_wait_for_lane_idle(struct dsi_ctrl_hw *ctrl, u32 lanes);
173void dsi_ctrl_hw_14_setup_lane_map(struct dsi_ctrl_hw *ctrl,
174 struct dsi_lane_map *lane_map);
Ajay Singh Parmar0e187812016-05-16 17:45:31 -0700175void dsi_ctrl_hw_14_ulps_request(struct dsi_ctrl_hw *ctrl, u32 lanes);
176void dsi_ctrl_hw_14_ulps_exit(struct dsi_ctrl_hw *ctrl, u32 lanes);
Ajay Singh Parmar0e187812016-05-16 17:45:31 -0700177u32 dsi_ctrl_hw_14_get_lanes_in_ulps(struct dsi_ctrl_hw *ctrl);
178
179void dsi_ctrl_hw_14_clamp_enable(struct dsi_ctrl_hw *ctrl,
180 u32 lanes,
181 bool enable_ulps);
182
183void dsi_ctrl_hw_14_clamp_disable(struct dsi_ctrl_hw *ctrl,
184 u32 lanes,
185 bool disable_ulps);
Ajay Singh Parmar48ea4272016-06-27 11:44:34 -0700186ssize_t dsi_ctrl_hw_14_reg_dump_to_buffer(struct dsi_ctrl_hw *ctrl,
187 char *buf,
188 u32 size);
Padmanabhan Komanduru8ee8ee52016-12-19 12:10:51 +0530189
190/* Definitions specific to 2.0 DSI controller hardware */
191void dsi_ctrl_hw_20_setup_lane_map(struct dsi_ctrl_hw *ctrl,
192 struct dsi_lane_map *lane_map);
193int dsi_ctrl_hw_20_wait_for_lane_idle(struct dsi_ctrl_hw *ctrl, u32 lanes);
194ssize_t dsi_ctrl_hw_20_reg_dump_to_buffer(struct dsi_ctrl_hw *ctrl,
195 char *buf,
196 u32 size);
197
Ajay Singh Parmar0e187812016-05-16 17:45:31 -0700198#endif /* _DSI_CATALOG_H_ */