blob: e01750baf950b2dddb7d9285d7398c81f7a95c0e [file] [log] [blame]
Narendra Muppalla1b0b3352015-09-29 10:16:51 -07001/* 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
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 Kwong3232ca52016-07-29 02:27:47 -040018#include "sde_hw_top.h"
Clarence Ipc475b082016-06-26 09:27:23 -040019#include "sde_hw_util.h"
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070020
21struct sde_hw_wb;
22
23struct sde_hw_wb_cfg {
Lloyd Atkinsonfa2489c2016-05-25 15:16:03 -040024 struct sde_hw_fmt_layout dest;
Alan Kwong3232ca52016-07-29 02:27:47 -040025 enum sde_intf_mode intf_mode;
26 struct traffic_shaper_cfg ts_cfg;
27 bool is_secure;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070028};
29
30/**
31 *
32 * struct sde_hw_wb_ops : Interface to the wb Hw driver functions
33 * Assumption is these functions will be called after clocks are enabled
34 */
35struct sde_hw_wb_ops {
36 void (*setup_csc_data)(struct sde_hw_wb *ctx,
37 struct sde_csc_cfg *data);
38
39 void (*setup_outaddress)(struct sde_hw_wb *ctx,
40 struct sde_hw_wb_cfg *wb);
41
42 void (*setup_outformat)(struct sde_hw_wb *ctx,
43 struct sde_hw_wb_cfg *wb);
44
45 void (*setup_rotator)(struct sde_hw_wb *ctx,
46 struct sde_hw_wb_cfg *wb);
47
48 void (*setup_dither)(struct sde_hw_wb *ctx,
49 struct sde_hw_wb_cfg *wb);
50
51 void (*setup_cdwn)(struct sde_hw_wb *ctx,
52 struct sde_hw_wb_cfg *wb);
53
54 void (*setup_trafficshaper)(struct sde_hw_wb *ctx,
55 struct sde_hw_wb_cfg *wb);
56};
57
58/**
59 * struct sde_hw_wb : WB driver object
60 * @struct sde_hw_blk_reg_map *hw;
61 * @idx
62 * @wb_hw_caps
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070063 * @ops
Alan Kwong3232ca52016-07-29 02:27:47 -040064 * @highest_bank_bit: GPU highest memory bank bit used
65 * @hw_mdp: MDP top level hardware block
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070066 */
67struct sde_hw_wb {
68 /* base */
69 struct sde_hw_blk_reg_map hw;
70
71 /* wb path */
72 int idx;
73 const struct sde_wb_cfg *caps;
74
75 /* ops */
76 struct sde_hw_wb_ops ops;
Alan Kwong3232ca52016-07-29 02:27:47 -040077
78 u32 highest_bank_bit;
79
80 struct sde_hw_mdp *hw_mdp;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070081};
82
83/**
Alan Kwong3232ca52016-07-29 02:27:47 -040084 * sde_hw_wb_init(): Initializes and return writeback hw driver object.
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070085 * @idx: wb_path index for which driver object is required
86 * @addr: mapped register io address of MDP
87 * @m : pointer to mdss catalog data
Alan Kwong3232ca52016-07-29 02:27:47 -040088 * @hw_mdp: pointer to mdp top hw driver object
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070089 */
90struct sde_hw_wb *sde_hw_wb_init(enum sde_wb idx,
91 void __iomem *addr,
Alan Kwong3232ca52016-07-29 02:27:47 -040092 struct sde_mdss_cfg *m,
93 struct sde_hw_mdp *hw_mdp);
94
95/**
96 * sde_hw_wb_destroy(): Destroy writeback hw driver object.
97 * @hw_wb: Pointer to writeback hw driver object
98 */
99void sde_hw_wb_destroy(struct sde_hw_wb *hw_wb);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700100
101#endif /*_SDE_HW_WB_H */