Jeykumar Sankaran | 5c2f070 | 2017-03-09 18:03:15 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
Clarence Ip | c475b08 | 2016-06-26 09:27:23 -0400 | [diff] [blame] | 13 | #ifndef _SDE_HW_TOP_H |
| 14 | #define _SDE_HW_TOP_H |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 15 | |
| 16 | #include "sde_hw_catalog.h" |
| 17 | #include "sde_hw_mdss.h" |
Clarence Ip | c475b08 | 2016-06-26 09:27:23 -0400 | [diff] [blame] | 18 | #include "sde_hw_util.h" |
Lloyd Atkinson | 652e59b | 2017-05-03 11:20:30 -0400 | [diff] [blame^] | 19 | #include "sde_hw_blk.h" |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 20 | |
| 21 | struct sde_hw_mdp; |
| 22 | |
| 23 | /** |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 24 | * struct traffic_shaper_cfg: traffic shaper configuration |
| 25 | * @en : enable/disable traffic shaper |
| 26 | * @rd_client : true if read client; false if write client |
| 27 | * @client_id : client identifier |
| 28 | * @bpc_denom : denominator of byte per clk |
| 29 | * @bpc_numer : numerator of byte per clk |
| 30 | */ |
| 31 | struct traffic_shaper_cfg { |
| 32 | bool en; |
| 33 | bool rd_client; |
| 34 | u32 client_id; |
| 35 | u32 bpc_denom; |
| 36 | u64 bpc_numer; |
| 37 | }; |
| 38 | |
| 39 | /** |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 40 | * struct split_pipe_cfg - pipe configuration for dual display panels |
| 41 | * @en : Enable/disable dual pipe confguration |
| 42 | * @mode : Panel interface mode |
Abhijit Kulkarni | 43eafcc | 2016-06-28 17:48:41 -0400 | [diff] [blame] | 43 | * @intf : Interface id for main control path |
Clarence Ip | 8e69ad0 | 2016-12-09 09:43:57 -0500 | [diff] [blame] | 44 | * @pp_split_slave: Slave interface for ping pong split, INTF_MAX to disable |
| 45 | * @pp_split_idx: Ping pong index for ping pong split |
Abhijit Kulkarni | 43eafcc | 2016-06-28 17:48:41 -0400 | [diff] [blame] | 46 | * @split_flush_en: Allows both the paths to be flushed when master path is |
| 47 | * flushed |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 48 | */ |
| 49 | struct split_pipe_cfg { |
| 50 | bool en; |
| 51 | enum sde_intf_mode mode; |
Abhijit Kulkarni | 43eafcc | 2016-06-28 17:48:41 -0400 | [diff] [blame] | 52 | enum sde_intf intf; |
Clarence Ip | 8e69ad0 | 2016-12-09 09:43:57 -0500 | [diff] [blame] | 53 | enum sde_intf pp_split_slave; |
| 54 | u32 pp_split_index; |
Abhijit Kulkarni | 43eafcc | 2016-06-28 17:48:41 -0400 | [diff] [blame] | 55 | bool split_flush_en; |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | /** |
Alan Kwong | dcc96ff | 2016-07-29 03:06:44 -0400 | [diff] [blame] | 59 | * struct cdm_output_cfg: output configuration for cdm |
| 60 | * @wb_en : enable/disable writeback output |
| 61 | * @intf_en : enable/disable interface output |
| 62 | */ |
| 63 | struct cdm_output_cfg { |
| 64 | bool wb_en; |
| 65 | bool intf_en; |
| 66 | }; |
| 67 | |
| 68 | /** |
Alan Kwong | f0fd851 | 2016-10-24 21:39:26 -0400 | [diff] [blame] | 69 | * struct sde_danger_safe_status: danger and safe status signals |
| 70 | * @mdp: top level status |
| 71 | * @sspp: source pipe status |
| 72 | * @wb: writebck output status |
| 73 | */ |
| 74 | struct sde_danger_safe_status { |
| 75 | u8 mdp; |
| 76 | u8 sspp[SSPP_MAX]; |
| 77 | u8 wb[WB_MAX]; |
| 78 | }; |
| 79 | |
| 80 | /** |
Narendra Muppalla | d4081e1 | 2017-04-20 19:24:08 -0700 | [diff] [blame] | 81 | * struct sde_watchdog_te_status - configure watchdog timer to generate TE |
| 82 | * @pp_count: number of ping pongs active |
| 83 | * @frame_rate: Display frame rate |
Lloyd Atkinson | 5d1c951 | 2017-05-26 15:42:26 -0400 | [diff] [blame] | 84 | * @ppnumber: ping pong index array |
Narendra Muppalla | d4081e1 | 2017-04-20 19:24:08 -0700 | [diff] [blame] | 85 | */ |
| 86 | struct sde_watchdog_te_status { |
| 87 | u32 pp_count; |
| 88 | u32 frame_rate; |
Lloyd Atkinson | 5d1c951 | 2017-05-26 15:42:26 -0400 | [diff] [blame] | 89 | u32 ppnumber[PINGPONG_MAX]; |
Narendra Muppalla | d4081e1 | 2017-04-20 19:24:08 -0700 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | /** |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 93 | * struct sde_hw_mdp_ops - interface to the MDP TOP Hw driver functions |
| 94 | * Assumption is these functions will be called after clocks are enabled. |
| 95 | * @setup_split_pipe : Programs the pipe control registers |
Clarence Ip | 8e69ad0 | 2016-12-09 09:43:57 -0500 | [diff] [blame] | 96 | * @setup_pp_split : Programs the pp split control registers |
Alan Kwong | dcc96ff | 2016-07-29 03:06:44 -0400 | [diff] [blame] | 97 | * @setup_cdm_output : programs cdm control |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 98 | * @setup_traffic_shaper : programs traffic shaper control |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 99 | */ |
| 100 | struct sde_hw_mdp_ops { |
Abhijit Kulkarni | 43eafcc | 2016-06-28 17:48:41 -0400 | [diff] [blame] | 101 | /** setup_split_pipe() : Regsiters are not double buffered, thisk |
| 102 | * function should be called before timing control enable |
| 103 | * @mdp : mdp top context driver |
| 104 | * @cfg : upper and lower part of pipe configuration |
| 105 | */ |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 106 | void (*setup_split_pipe)(struct sde_hw_mdp *mdp, |
| 107 | struct split_pipe_cfg *p); |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 108 | |
Clarence Ip | 8e69ad0 | 2016-12-09 09:43:57 -0500 | [diff] [blame] | 109 | /** setup_pp_split() : Configure pp split related registers |
| 110 | * @mdp : mdp top context driver |
| 111 | * @cfg : upper and lower part of pipe configuration |
| 112 | */ |
| 113 | void (*setup_pp_split)(struct sde_hw_mdp *mdp, |
| 114 | struct split_pipe_cfg *cfg); |
| 115 | |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 116 | /** |
Alan Kwong | dcc96ff | 2016-07-29 03:06:44 -0400 | [diff] [blame] | 117 | * setup_cdm_output() : Setup selection control of the cdm data path |
| 118 | * @mdp : mdp top context driver |
| 119 | * @cfg : cdm output configuration |
| 120 | */ |
| 121 | void (*setup_cdm_output)(struct sde_hw_mdp *mdp, |
| 122 | struct cdm_output_cfg *cfg); |
| 123 | |
| 124 | /** |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 125 | * setup_traffic_shaper() : Setup traffic shaper control |
| 126 | * @mdp : mdp top context driver |
| 127 | * @cfg : traffic shaper configuration |
| 128 | */ |
| 129 | void (*setup_traffic_shaper)(struct sde_hw_mdp *mdp, |
| 130 | struct traffic_shaper_cfg *cfg); |
Alan Kwong | 5d324e4 | 2016-07-28 22:56:18 -0400 | [diff] [blame] | 131 | |
| 132 | /** |
| 133 | * setup_clk_force_ctrl - set clock force control |
| 134 | * @mdp: mdp top context driver |
| 135 | * @clk_ctrl: clock to be controlled |
| 136 | * @enable: force on enable |
| 137 | * @return: if the clock is forced-on by this function |
| 138 | */ |
| 139 | bool (*setup_clk_force_ctrl)(struct sde_hw_mdp *mdp, |
| 140 | enum sde_clk_ctrl_type clk_ctrl, bool enable); |
Alan Kwong | f0fd851 | 2016-10-24 21:39:26 -0400 | [diff] [blame] | 141 | |
| 142 | /** |
Jeykumar Sankaran | 5c2f070 | 2017-03-09 18:03:15 -0800 | [diff] [blame] | 143 | * setup_dce - set DCE mux for DSC ctrl path |
| 144 | * @mdp: mdp top context driver |
| 145 | * @dce_sel: dce_mux value |
| 146 | */ |
| 147 | void (*setup_dce)(struct sde_hw_mdp *mdp, u32 dce_sel); |
| 148 | |
| 149 | /** |
Alan Kwong | f0fd851 | 2016-10-24 21:39:26 -0400 | [diff] [blame] | 150 | * get_danger_status - get danger status |
| 151 | * @mdp: mdp top context driver |
| 152 | * @status: Pointer to danger safe status |
| 153 | */ |
| 154 | void (*get_danger_status)(struct sde_hw_mdp *mdp, |
| 155 | struct sde_danger_safe_status *status); |
| 156 | |
| 157 | /** |
Narendra Muppalla | d4081e1 | 2017-04-20 19:24:08 -0700 | [diff] [blame] | 158 | * setup_vsync_sel - get vsync configuration details |
| 159 | * @mdp: mdp top context driver |
| 160 | * @cfg: watchdog timer configuration |
| 161 | * @watchdog_te: watchdog timer enable |
| 162 | */ |
| 163 | void (*setup_vsync_sel)(struct sde_hw_mdp *mdp, |
| 164 | struct sde_watchdog_te_status *cfg, bool watchdog_te); |
| 165 | |
| 166 | /** |
Alan Kwong | f0fd851 | 2016-10-24 21:39:26 -0400 | [diff] [blame] | 167 | * get_safe_status - get safe status |
| 168 | * @mdp: mdp top context driver |
| 169 | * @status: Pointer to danger safe status |
| 170 | */ |
| 171 | void (*get_safe_status)(struct sde_hw_mdp *mdp, |
| 172 | struct sde_danger_safe_status *status); |
Clarence Ip | 3534826 | 2017-04-28 16:10:46 -0700 | [diff] [blame] | 173 | |
| 174 | /** |
| 175 | * reset_ubwc - reset top level UBWC configuration |
| 176 | * @mdp: mdp top context driver |
| 177 | * @m: pointer to mdss catalog data |
| 178 | */ |
| 179 | void (*reset_ubwc)(struct sde_hw_mdp *mdp, struct sde_mdss_cfg *m); |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 180 | }; |
| 181 | |
| 182 | struct sde_hw_mdp { |
Lloyd Atkinson | 652e59b | 2017-05-03 11:20:30 -0400 | [diff] [blame^] | 183 | struct sde_hw_blk base; |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 184 | struct sde_hw_blk_reg_map hw; |
| 185 | |
| 186 | /* intf */ |
| 187 | enum sde_mdp idx; |
| 188 | const struct sde_mdp_cfg *cap; |
| 189 | |
| 190 | /* ops */ |
| 191 | struct sde_hw_mdp_ops ops; |
| 192 | }; |
| 193 | |
| 194 | /** |
| 195 | * sde_hw_intf_init - initializes the intf driver for the passed interface idx |
| 196 | * @idx: Interface index for which driver object is required |
| 197 | * @addr: Mapped register io address of MDP |
| 198 | * @m: Pointer to mdss catalog data |
| 199 | */ |
| 200 | struct sde_hw_mdp *sde_hw_mdptop_init(enum sde_mdp idx, |
| 201 | void __iomem *addr, |
| 202 | const struct sde_mdss_cfg *m); |
| 203 | |
| 204 | void sde_hw_mdp_destroy(struct sde_hw_mdp *mdp); |
| 205 | |
Clarence Ip | c475b08 | 2016-06-26 09:27:23 -0400 | [diff] [blame] | 206 | #endif /*_SDE_HW_TOP_H */ |