Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 1 | /* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. |
| 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" |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 19 | |
| 20 | struct sde_hw_mdp; |
| 21 | |
| 22 | /** |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 23 | * struct traffic_shaper_cfg: traffic shaper configuration |
| 24 | * @en : enable/disable traffic shaper |
| 25 | * @rd_client : true if read client; false if write client |
| 26 | * @client_id : client identifier |
| 27 | * @bpc_denom : denominator of byte per clk |
| 28 | * @bpc_numer : numerator of byte per clk |
| 29 | */ |
| 30 | struct traffic_shaper_cfg { |
| 31 | bool en; |
| 32 | bool rd_client; |
| 33 | u32 client_id; |
| 34 | u32 bpc_denom; |
| 35 | u64 bpc_numer; |
| 36 | }; |
| 37 | |
| 38 | /** |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 39 | * struct split_pipe_cfg - pipe configuration for dual display panels |
| 40 | * @en : Enable/disable dual pipe confguration |
| 41 | * @mode : Panel interface mode |
Abhijit Kulkarni | 43eafcc | 2016-06-28 17:48:41 -0400 | [diff] [blame] | 42 | * @intf : Interface id for main control path |
| 43 | * @pp_split : Ping pong split is enabled or disabled |
| 44 | * @split_flush_en: Allows both the paths to be flushed when master path is |
| 45 | * flushed |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 46 | */ |
| 47 | struct split_pipe_cfg { |
| 48 | bool en; |
| 49 | enum sde_intf_mode mode; |
Abhijit Kulkarni | 43eafcc | 2016-06-28 17:48:41 -0400 | [diff] [blame] | 50 | enum sde_intf intf; |
| 51 | bool pp_split; |
| 52 | bool split_flush_en; |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | /** |
Alan Kwong | dcc96ff | 2016-07-29 03:06:44 -0400 | [diff] [blame] | 56 | * struct cdm_output_cfg: output configuration for cdm |
| 57 | * @wb_en : enable/disable writeback output |
| 58 | * @intf_en : enable/disable interface output |
| 59 | */ |
| 60 | struct cdm_output_cfg { |
| 61 | bool wb_en; |
| 62 | bool intf_en; |
| 63 | }; |
| 64 | |
| 65 | /** |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 66 | * struct sde_hw_mdp_ops - interface to the MDP TOP Hw driver functions |
| 67 | * Assumption is these functions will be called after clocks are enabled. |
| 68 | * @setup_split_pipe : Programs the pipe control registers |
Alan Kwong | dcc96ff | 2016-07-29 03:06:44 -0400 | [diff] [blame] | 69 | * @setup_cdm_output : programs cdm control |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 70 | * @setup_traffic_shaper : programs traffic shaper control |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 71 | */ |
| 72 | struct sde_hw_mdp_ops { |
Abhijit Kulkarni | 43eafcc | 2016-06-28 17:48:41 -0400 | [diff] [blame] | 73 | /** setup_split_pipe() : Regsiters are not double buffered, thisk |
| 74 | * function should be called before timing control enable |
| 75 | * @mdp : mdp top context driver |
| 76 | * @cfg : upper and lower part of pipe configuration |
| 77 | */ |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 78 | void (*setup_split_pipe)(struct sde_hw_mdp *mdp, |
| 79 | struct split_pipe_cfg *p); |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 80 | |
| 81 | /** |
Alan Kwong | dcc96ff | 2016-07-29 03:06:44 -0400 | [diff] [blame] | 82 | * setup_cdm_output() : Setup selection control of the cdm data path |
| 83 | * @mdp : mdp top context driver |
| 84 | * @cfg : cdm output configuration |
| 85 | */ |
| 86 | void (*setup_cdm_output)(struct sde_hw_mdp *mdp, |
| 87 | struct cdm_output_cfg *cfg); |
| 88 | |
| 89 | /** |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 90 | * setup_traffic_shaper() : Setup traffic shaper control |
| 91 | * @mdp : mdp top context driver |
| 92 | * @cfg : traffic shaper configuration |
| 93 | */ |
| 94 | void (*setup_traffic_shaper)(struct sde_hw_mdp *mdp, |
| 95 | struct traffic_shaper_cfg *cfg); |
Alan Kwong | 5d324e4 | 2016-07-28 22:56:18 -0400 | [diff] [blame] | 96 | |
| 97 | /** |
| 98 | * setup_clk_force_ctrl - set clock force control |
| 99 | * @mdp: mdp top context driver |
| 100 | * @clk_ctrl: clock to be controlled |
| 101 | * @enable: force on enable |
| 102 | * @return: if the clock is forced-on by this function |
| 103 | */ |
| 104 | bool (*setup_clk_force_ctrl)(struct sde_hw_mdp *mdp, |
| 105 | enum sde_clk_ctrl_type clk_ctrl, bool enable); |
Abhijit Kulkarni | 94954d5 | 2016-06-24 18:27:48 -0400 | [diff] [blame] | 106 | }; |
| 107 | |
| 108 | struct sde_hw_mdp { |
| 109 | /* base */ |
| 110 | struct sde_hw_blk_reg_map hw; |
| 111 | |
| 112 | /* intf */ |
| 113 | enum sde_mdp idx; |
| 114 | const struct sde_mdp_cfg *cap; |
| 115 | |
| 116 | /* ops */ |
| 117 | struct sde_hw_mdp_ops ops; |
| 118 | }; |
| 119 | |
| 120 | /** |
| 121 | * sde_hw_intf_init - initializes the intf driver for the passed interface idx |
| 122 | * @idx: Interface index for which driver object is required |
| 123 | * @addr: Mapped register io address of MDP |
| 124 | * @m: Pointer to mdss catalog data |
| 125 | */ |
| 126 | struct sde_hw_mdp *sde_hw_mdptop_init(enum sde_mdp idx, |
| 127 | void __iomem *addr, |
| 128 | const struct sde_mdss_cfg *m); |
| 129 | |
| 130 | void sde_hw_mdp_destroy(struct sde_hw_mdp *mdp); |
| 131 | |
Clarence Ip | c475b08 | 2016-06-26 09:27:23 -0400 | [diff] [blame] | 132 | #endif /*_SDE_HW_TOP_H */ |