Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [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 | |
Clarence Ip | c475b08 | 2016-06-26 09:27:23 -0400 | [diff] [blame] | 13 | #ifndef _SDE_HW_UTIL_H |
| 14 | #define _SDE_HW_UTIL_H |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 15 | |
| 16 | #include <linux/io.h> |
| 17 | #include <linux/slab.h> |
| 18 | #include "sde_hw_mdss.h" |
| 19 | |
| 20 | /* |
| 21 | * This is the common struct maintained by each sub block |
| 22 | * for mapping the register offsets in this block to the |
| 23 | * absoulute IO address |
| 24 | * @base_off: mdp register mapped offset |
| 25 | * @blk_off: pipe offset relative to mdss offset |
| 26 | * @length length of register block offset |
| 27 | * @hwversion mdss hw version number |
| 28 | */ |
| 29 | struct sde_hw_blk_reg_map { |
| 30 | void __iomem *base_off; |
| 31 | u32 blk_off; |
| 32 | u32 length; |
| 33 | u32 hwversion; |
Clarence Ip | 4ce5932 | 2016-06-26 22:27:51 -0400 | [diff] [blame] | 34 | u32 log_mask; |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 35 | }; |
| 36 | |
Clarence Ip | 4ce5932 | 2016-06-26 22:27:51 -0400 | [diff] [blame] | 37 | u32 *sde_hw_util_get_log_mask_ptr(void); |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 38 | |
Lloyd Atkinson | 7a7c431 | 2016-05-30 13:49:12 -0400 | [diff] [blame] | 39 | void sde_reg_write(struct sde_hw_blk_reg_map *c, |
| 40 | u32 reg_off, |
| 41 | u32 val, |
| 42 | const char *name); |
| 43 | int sde_reg_read(struct sde_hw_blk_reg_map *c, u32 reg_off); |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 44 | |
Lloyd Atkinson | 7a7c431 | 2016-05-30 13:49:12 -0400 | [diff] [blame] | 45 | #define SDE_REG_WRITE(c, off, val) sde_reg_write(c, off, val, #off) |
| 46 | #define SDE_REG_READ(c, off) sde_reg_read(c, off) |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 47 | |
Clarence Ip | 4ce5932 | 2016-06-26 22:27:51 -0400 | [diff] [blame] | 48 | void *sde_hw_util_get_dir(void); |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 49 | |
| 50 | void sde_hw_csc_setup(struct sde_hw_blk_reg_map *c, |
| 51 | u32 csc_reg_off, |
| 52 | struct sde_csc_cfg *data); |
| 53 | |
Clarence Ip | c475b08 | 2016-06-26 09:27:23 -0400 | [diff] [blame] | 54 | #endif /* _SDE_HW_UTIL_H */ |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 55 | |