blob: 52a5ee5b06a507e4f4ba6c4c64705365931556b7 [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;
abeykunf1539f72016-08-24 16:08:03 -040027 struct sde_rect roi;
Alan Kwong3232ca52016-07-29 02:27:47 -040028 bool is_secure;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070029};
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 */
36struct 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);
abeykunf1539f72016-08-24 16:08:03 -040057
58 void (*setup_roi)(struct sde_hw_wb *ctx,
59 struct sde_hw_wb_cfg *wb);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070060};
61
62/**
63 * struct sde_hw_wb : WB driver object
64 * @struct sde_hw_blk_reg_map *hw;
65 * @idx
66 * @wb_hw_caps
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070067 * @ops
Alan Kwong3232ca52016-07-29 02:27:47 -040068 * @highest_bank_bit: GPU highest memory bank bit used
69 * @hw_mdp: MDP top level hardware block
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070070 */
71struct sde_hw_wb {
72 /* base */
73 struct sde_hw_blk_reg_map hw;
74
75 /* wb path */
76 int idx;
77 const struct sde_wb_cfg *caps;
78
79 /* ops */
80 struct sde_hw_wb_ops ops;
Alan Kwong3232ca52016-07-29 02:27:47 -040081
82 u32 highest_bank_bit;
83
84 struct sde_hw_mdp *hw_mdp;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070085};
86
87/**
Alan Kwong3232ca52016-07-29 02:27:47 -040088 * sde_hw_wb_init(): Initializes and return writeback hw driver object.
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070089 * @idx: wb_path index for which driver object is required
90 * @addr: mapped register io address of MDP
91 * @m : pointer to mdss catalog data
Alan Kwong3232ca52016-07-29 02:27:47 -040092 * @hw_mdp: pointer to mdp top hw driver object
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070093 */
94struct sde_hw_wb *sde_hw_wb_init(enum sde_wb idx,
95 void __iomem *addr,
Alan Kwong3232ca52016-07-29 02:27:47 -040096 struct sde_mdss_cfg *m,
97 struct sde_hw_mdp *hw_mdp);
98
99/**
100 * sde_hw_wb_destroy(): Destroy writeback hw driver object.
101 * @hw_wb: Pointer to writeback hw driver object
102 */
103void sde_hw_wb_destroy(struct sde_hw_wb *hw_wb);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700104
105#endif /*_SDE_HW_WB_H */