Clarence Ip | 32bcb00 | 2017-03-13 12:26:44 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [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 | |
| 13 | #ifndef _SDE_HW_WB_H |
| 14 | #define _SDE_HW_WB_H |
| 15 | |
| 16 | #include "sde_hw_catalog.h" |
| 17 | #include "sde_hw_mdss.h" |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 18 | #include "sde_hw_top.h" |
Clarence Ip | c475b08 | 2016-06-26 09:27:23 -0400 | [diff] [blame] | 19 | #include "sde_hw_util.h" |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 20 | |
| 21 | struct sde_hw_wb; |
| 22 | |
| 23 | struct sde_hw_wb_cfg { |
Lloyd Atkinson | fa2489c | 2016-05-25 15:16:03 -0400 | [diff] [blame] | 24 | struct sde_hw_fmt_layout dest; |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 25 | enum sde_intf_mode intf_mode; |
| 26 | struct traffic_shaper_cfg ts_cfg; |
abeykun | f1539f7 | 2016-08-24 16:08:03 -0400 | [diff] [blame] | 27 | struct sde_rect roi; |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 28 | bool is_secure; |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 29 | }; |
| 30 | |
| 31 | /** |
| 32 | * |
| 33 | * struct sde_hw_wb_ops : Interface to the wb Hw driver functions |
| 34 | * Assumption is these functions will be called after clocks are enabled |
| 35 | */ |
| 36 | struct sde_hw_wb_ops { |
| 37 | void (*setup_csc_data)(struct sde_hw_wb *ctx, |
| 38 | struct sde_csc_cfg *data); |
| 39 | |
| 40 | void (*setup_outaddress)(struct sde_hw_wb *ctx, |
| 41 | struct sde_hw_wb_cfg *wb); |
| 42 | |
| 43 | void (*setup_outformat)(struct sde_hw_wb *ctx, |
| 44 | struct sde_hw_wb_cfg *wb); |
| 45 | |
| 46 | void (*setup_rotator)(struct sde_hw_wb *ctx, |
| 47 | struct sde_hw_wb_cfg *wb); |
| 48 | |
| 49 | void (*setup_dither)(struct sde_hw_wb *ctx, |
| 50 | struct sde_hw_wb_cfg *wb); |
| 51 | |
| 52 | void (*setup_cdwn)(struct sde_hw_wb *ctx, |
| 53 | struct sde_hw_wb_cfg *wb); |
| 54 | |
| 55 | void (*setup_trafficshaper)(struct sde_hw_wb *ctx, |
| 56 | struct sde_hw_wb_cfg *wb); |
abeykun | f1539f7 | 2016-08-24 16:08:03 -0400 | [diff] [blame] | 57 | |
| 58 | void (*setup_roi)(struct sde_hw_wb *ctx, |
| 59 | struct sde_hw_wb_cfg *wb); |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | /** |
| 63 | * struct sde_hw_wb : WB driver object |
| 64 | * @struct sde_hw_blk_reg_map *hw; |
Clarence Ip | 32bcb00 | 2017-03-13 12:26:44 -0700 | [diff] [blame] | 65 | * @catalog: back pointer to catalog |
| 66 | * @mdp: pointer to associated mdp portion of the catalog |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 67 | * @idx |
| 68 | * @wb_hw_caps |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 69 | * @ops |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 70 | * @hw_mdp: MDP top level hardware block |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 71 | */ |
| 72 | struct sde_hw_wb { |
| 73 | /* base */ |
| 74 | struct sde_hw_blk_reg_map hw; |
Clarence Ip | 32bcb00 | 2017-03-13 12:26:44 -0700 | [diff] [blame] | 75 | struct sde_mdss_cfg *catalog; |
| 76 | struct sde_mdp_cfg *mdp; |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 77 | |
| 78 | /* wb path */ |
| 79 | int idx; |
| 80 | const struct sde_wb_cfg *caps; |
| 81 | |
| 82 | /* ops */ |
| 83 | struct sde_hw_wb_ops ops; |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 84 | |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 85 | struct sde_hw_mdp *hw_mdp; |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 86 | }; |
| 87 | |
| 88 | /** |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 89 | * sde_hw_wb_init(): Initializes and return writeback hw driver object. |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 90 | * @idx: wb_path index for which driver object is required |
| 91 | * @addr: mapped register io address of MDP |
| 92 | * @m : pointer to mdss catalog data |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 93 | * @hw_mdp: pointer to mdp top hw driver object |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 94 | */ |
| 95 | struct sde_hw_wb *sde_hw_wb_init(enum sde_wb idx, |
| 96 | void __iomem *addr, |
Alan Kwong | 3232ca5 | 2016-07-29 02:27:47 -0400 | [diff] [blame] | 97 | struct sde_mdss_cfg *m, |
| 98 | struct sde_hw_mdp *hw_mdp); |
| 99 | |
| 100 | /** |
| 101 | * sde_hw_wb_destroy(): Destroy writeback hw driver object. |
| 102 | * @hw_wb: Pointer to writeback hw driver object |
| 103 | */ |
| 104 | void sde_hw_wb_destroy(struct sde_hw_wb *hw_wb); |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 105 | |
| 106 | #endif /*_SDE_HW_WB_H */ |