blob: 3b650fea53ae2d6687be2ffdf7e043de47317d40 [file] [log] [blame]
Alan Kwonga62eeb82017-04-19 08:57:55 -07001/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
Alan Kwong5d324e42016-07-28 22:56:18 -04002 *
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_VBIF_H
14#define _SDE_HW_VBIF_H
15
16#include "sde_hw_catalog.h"
17#include "sde_hw_mdss.h"
18#include "sde_hw_util.h"
19
20struct sde_hw_vbif;
21
22/**
23 * struct sde_hw_vbif_ops : Interface to the VBIF hardware driver functions
24 * Assumption is these functions will be called after clocks are enabled
25 */
26struct sde_hw_vbif_ops {
27 /**
28 * set_limit_conf - set transaction limit config
29 * @vbif: vbif context driver
30 * @xin_id: client interface identifier
31 * @rd: true for read limit; false for write limit
32 * @limit: outstanding transaction limit
33 */
34 void (*set_limit_conf)(struct sde_hw_vbif *vbif,
35 u32 xin_id, bool rd, u32 limit);
36
37 /**
38 * get_limit_conf - get transaction limit config
39 * @vbif: vbif context driver
40 * @xin_id: client interface identifier
41 * @rd: true for read limit; false for write limit
42 * @return: outstanding transaction limit
43 */
44 u32 (*get_limit_conf)(struct sde_hw_vbif *vbif,
45 u32 xin_id, bool rd);
46
47 /**
48 * set_halt_ctrl - set halt control
49 * @vbif: vbif context driver
50 * @xin_id: client interface identifier
51 * @enable: halt control enable
52 */
53 void (*set_halt_ctrl)(struct sde_hw_vbif *vbif,
54 u32 xin_id, bool enable);
55
56 /**
57 * get_halt_ctrl - get halt control
58 * @vbif: vbif context driver
59 * @xin_id: client interface identifier
60 * @return: halt control enable
61 */
62 bool (*get_halt_ctrl)(struct sde_hw_vbif *vbif,
63 u32 xin_id);
Alan Kwonga62eeb82017-04-19 08:57:55 -070064
65 /**
66 * set_qos_remap - set QoS priority remap
67 * @vbif: vbif context driver
68 * @xin_id: client interface identifier
69 * @level: priority level
70 * @remap_level: remapped level
71 */
72 void (*set_qos_remap)(struct sde_hw_vbif *vbif,
73 u32 xin_id, u32 level, u32 remap_level);
Clarence Ip7f0de632017-05-31 14:59:14 -040074
75 /**
76 * set_mem_type - set memory type
77 * @vbif: vbif context driver
78 * @xin_id: client interface identifier
79 * @value: memory type value
80 */
81 void (*set_mem_type)(struct sde_hw_vbif *vbif,
82 u32 xin_id, u32 value);
Veera Sundaram Sankaran79525402017-07-31 14:17:23 -070083
84 /**
Clarence Ip980405d2017-08-08 18:33:44 -040085 * clear_errors - clear any vbif errors
86 * This function clears any detected pending/source errors
87 * on the VBIF interface, and optionally returns the detected
88 * error mask(s).
89 * @vbif: vbif context driver
90 * @pnd_errors: pointer to pending error reporting variable
91 * @src_errors: pointer to source error reporting variable
92 */
93 void (*clear_errors)(struct sde_hw_vbif *vbif,
94 u32 *pnd_errors, u32 *src_errors);
95
96 /**
Veera Sundaram Sankaran79525402017-07-31 14:17:23 -070097 * set_write_gather_en - set write_gather enable
98 * @vbif: vbif context driver
99 * @xin_id: client interface identifier
100 */
101 void (*set_write_gather_en)(struct sde_hw_vbif *vbif, u32 xin_id);
Alan Kwong5d324e42016-07-28 22:56:18 -0400102};
103
104struct sde_hw_vbif {
105 /* base */
106 struct sde_hw_blk_reg_map hw;
107
108 /* vbif */
109 enum sde_vbif idx;
110 const struct sde_vbif_cfg *cap;
111
112 /* ops */
113 struct sde_hw_vbif_ops ops;
Lloyd Atkinson1753a982017-11-30 15:32:47 -0500114
115 /*
116 * vbif is common across all displays, lock to serialize access.
117 * must be take by client before using any ops
118 */
119 struct mutex mutex;
Alan Kwong5d324e42016-07-28 22:56:18 -0400120};
121
122/**
123 * sde_hw_vbif_init - initializes the vbif driver for the passed interface idx
124 * @idx: Interface index for which driver object is required
125 * @addr: Mapped register io address of MDSS
126 * @m: Pointer to mdss catalog data
127 */
128struct sde_hw_vbif *sde_hw_vbif_init(enum sde_vbif idx,
129 void __iomem *addr,
130 const struct sde_mdss_cfg *m);
131
132void sde_hw_vbif_destroy(struct sde_hw_vbif *vbif);
133
134#endif /*_SDE_HW_VBIF_H */