blob: a4d8be9de90709526cb307ebd18caf5d21b0ca2b [file] [log] [blame]
Narendra Muppalla1b0b3352015-09-29 10:16:51 -07001/* 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_UTIL_H
14#define _SDE_HW_UTIL_H
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070015
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 */
29struct sde_hw_blk_reg_map {
30 void __iomem *base_off;
31 u32 blk_off;
32 u32 length;
33 u32 hwversion;
Clarence Ip4ce59322016-06-26 22:27:51 -040034 u32 log_mask;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070035};
36
Clarence Ip4ce59322016-06-26 22:27:51 -040037u32 *sde_hw_util_get_log_mask_ptr(void);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070038
Lloyd Atkinson7a7c4312016-05-30 13:49:12 -040039void sde_reg_write(struct sde_hw_blk_reg_map *c,
40 u32 reg_off,
41 u32 val,
42 const char *name);
43int sde_reg_read(struct sde_hw_blk_reg_map *c, u32 reg_off);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070044
Lloyd Atkinson7a7c4312016-05-30 13:49:12 -040045#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 Muppalla1b0b3352015-09-29 10:16:51 -070047
Clarence Ip4ce59322016-06-26 22:27:51 -040048void *sde_hw_util_get_dir(void);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070049
50void sde_hw_csc_setup(struct sde_hw_blk_reg_map *c,
51 u32 csc_reg_off,
52 struct sde_csc_cfg *data);
53
Clarence Ipc475b082016-06-26 09:27:23 -040054#endif /* _SDE_HW_UTIL_H */
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070055