Alan Kwong | 5d324e4 | 2016-07-28 22:56:18 -0400 | [diff] [blame] | 1 | /* 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_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 | |
| 20 | struct 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 | */ |
| 26 | struct 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); |
| 64 | }; |
| 65 | |
| 66 | struct sde_hw_vbif { |
| 67 | /* base */ |
| 68 | struct sde_hw_blk_reg_map hw; |
| 69 | |
| 70 | /* vbif */ |
| 71 | enum sde_vbif idx; |
| 72 | const struct sde_vbif_cfg *cap; |
| 73 | |
| 74 | /* ops */ |
| 75 | struct sde_hw_vbif_ops ops; |
| 76 | }; |
| 77 | |
| 78 | /** |
| 79 | * sde_hw_vbif_init - initializes the vbif driver for the passed interface idx |
| 80 | * @idx: Interface index for which driver object is required |
| 81 | * @addr: Mapped register io address of MDSS |
| 82 | * @m: Pointer to mdss catalog data |
| 83 | */ |
| 84 | struct sde_hw_vbif *sde_hw_vbif_init(enum sde_vbif idx, |
| 85 | void __iomem *addr, |
| 86 | const struct sde_mdss_cfg *m); |
| 87 | |
| 88 | void sde_hw_vbif_destroy(struct sde_hw_vbif *vbif); |
| 89 | |
| 90 | #endif /*_SDE_HW_VBIF_H */ |