blob: 9d17fb3e5586b7ce9813bcecf83cad414b4227a6 [file] [log] [blame]
Clarence Ip32bcb002017-03-13 12:26:44 -07001/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
Narendra Muppalla1b0b3352015-09-29 10:16:51 -07002 *
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;
Clarence Ip32bcb002017-03-13 12:26:44 -070065 * @catalog: back pointer to catalog
66 * @mdp: pointer to associated mdp portion of the catalog
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070067 * @idx
68 * @wb_hw_caps
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070069 * @ops
Alan Kwong3232ca52016-07-29 02:27:47 -040070 * @hw_mdp: MDP top level hardware block
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070071 */
72struct sde_hw_wb {
73 /* base */
74 struct sde_hw_blk_reg_map hw;
Clarence Ip32bcb002017-03-13 12:26:44 -070075 struct sde_mdss_cfg *catalog;
76 struct sde_mdp_cfg *mdp;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070077
78 /* wb path */
79 int idx;
80 const struct sde_wb_cfg *caps;
81
82 /* ops */
83 struct sde_hw_wb_ops ops;
Alan Kwong3232ca52016-07-29 02:27:47 -040084
Alan Kwong3232ca52016-07-29 02:27:47 -040085 struct sde_hw_mdp *hw_mdp;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070086};
87
88/**
Alan Kwong3232ca52016-07-29 02:27:47 -040089 * sde_hw_wb_init(): Initializes and return writeback hw driver object.
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070090 * @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 Kwong3232ca52016-07-29 02:27:47 -040093 * @hw_mdp: pointer to mdp top hw driver object
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070094 */
95struct sde_hw_wb *sde_hw_wb_init(enum sde_wb idx,
96 void __iomem *addr,
Alan Kwong3232ca52016-07-29 02:27:47 -040097 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 */
104void sde_hw_wb_destroy(struct sde_hw_wb *hw_wb);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700105
106#endif /*_SDE_HW_WB_H */