blob: 7359a77bc95457c3bd573c0b2192467d0e1e8b4c [file] [log] [blame]
Abhijit Kulkarni94954d52016-06-24 18:27:48 -04001/* 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 Ipc475b082016-06-26 09:27:23 -040013#ifndef _SDE_HW_TOP_H
14#define _SDE_HW_TOP_H
Abhijit Kulkarni94954d52016-06-24 18:27:48 -040015
16#include "sde_hw_catalog.h"
17#include "sde_hw_mdss.h"
Clarence Ipc475b082016-06-26 09:27:23 -040018#include "sde_hw_util.h"
Abhijit Kulkarni94954d52016-06-24 18:27:48 -040019
20struct sde_hw_mdp;
21
22/**
Alan Kwong3232ca52016-07-29 02:27:47 -040023 * 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 */
30struct 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 Kulkarni94954d52016-06-24 18:27:48 -040039 * struct split_pipe_cfg - pipe configuration for dual display panels
40 * @en : Enable/disable dual pipe confguration
41 * @mode : Panel interface mode
Abhijit Kulkarni43eafcc2016-06-28 17:48:41 -040042 * @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 Kulkarni94954d52016-06-24 18:27:48 -040046 */
47struct split_pipe_cfg {
48 bool en;
49 enum sde_intf_mode mode;
Abhijit Kulkarni43eafcc2016-06-28 17:48:41 -040050 enum sde_intf intf;
51 bool pp_split;
52 bool split_flush_en;
Abhijit Kulkarni94954d52016-06-24 18:27:48 -040053};
54
55/**
Alan Kwongdcc96ff2016-07-29 03:06:44 -040056 * struct cdm_output_cfg: output configuration for cdm
57 * @wb_en : enable/disable writeback output
58 * @intf_en : enable/disable interface output
59 */
60struct cdm_output_cfg {
61 bool wb_en;
62 bool intf_en;
63};
64
65/**
Abhijit Kulkarni94954d52016-06-24 18:27:48 -040066 * 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 Kwongdcc96ff2016-07-29 03:06:44 -040069 * @setup_cdm_output : programs cdm control
Alan Kwong3232ca52016-07-29 02:27:47 -040070 * @setup_traffic_shaper : programs traffic shaper control
Abhijit Kulkarni94954d52016-06-24 18:27:48 -040071 */
72struct sde_hw_mdp_ops {
Abhijit Kulkarni43eafcc2016-06-28 17:48:41 -040073 /** 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 Kulkarni94954d52016-06-24 18:27:48 -040078 void (*setup_split_pipe)(struct sde_hw_mdp *mdp,
79 struct split_pipe_cfg *p);
Alan Kwong3232ca52016-07-29 02:27:47 -040080
81 /**
Alan Kwongdcc96ff2016-07-29 03:06:44 -040082 * 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 Kwong3232ca52016-07-29 02:27:47 -040090 * 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 Kwong5d324e42016-07-28 22:56:18 -040096
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 Kulkarni94954d52016-06-24 18:27:48 -0400106};
107
108struct 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 */
126struct sde_hw_mdp *sde_hw_mdptop_init(enum sde_mdp idx,
127 void __iomem *addr,
128 const struct sde_mdss_cfg *m);
129
130void sde_hw_mdp_destroy(struct sde_hw_mdp *mdp);
131
Clarence Ipc475b082016-06-26 09:27:23 -0400132#endif /*_SDE_HW_TOP_H */