blob: 69349abe59f2a4a614a9a9379b5c26f232087a3c [file] [log] [blame]
Stephane Viau2e362e12014-11-18 12:49:48 -05001/*
2 * Copyright (c) 2014 The Linux Foundation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef __MDP5_CFG_H__
15#define __MDP5_CFG_H__
16
17#include "msm_drv.h"
18
19/*
20 * mdp5_cfg
21 *
22 * This module configures the dynamic offsets used by mdp5.xml.h
23 * (initialized in mdp5_cfg.c)
24 */
25extern const struct mdp5_cfg_hw *mdp5_cfg;
26
Stephane Viau0deed252014-11-18 12:49:49 -050027#define MAX_CTL 8
Stephane Viau2e362e12014-11-18 12:49:48 -050028#define MAX_BASES 8
29#define MAX_SMP_BLOCKS 44
30#define MAX_CLIENTS 32
31
32typedef DECLARE_BITMAP(mdp5_smp_state_t, MAX_SMP_BLOCKS);
33
34#define MDP5_SUB_BLOCK_DEFINITION \
35 int count; \
36 uint32_t base[MAX_BASES]
37
38struct mdp5_sub_block {
39 MDP5_SUB_BLOCK_DEFINITION;
40};
41
42struct mdp5_lm_block {
43 MDP5_SUB_BLOCK_DEFINITION;
44 uint32_t nb_stages; /* number of stages per blender */
45};
46
Stephane Viau389b09a2015-03-13 15:49:33 -040047struct mdp5_ctl_block {
48 MDP5_SUB_BLOCK_DEFINITION;
49 uint32_t flush_hw_mask; /* FLUSH register's hardware mask */
50};
51
Stephane Viau2e362e12014-11-18 12:49:48 -050052struct mdp5_smp_block {
53 int mmb_count; /* number of SMP MMBs */
54 int mmb_size; /* MMB: size in bytes */
Stephane Viau6fa6acd2015-03-09 09:11:06 -040055 uint32_t clients[MAX_CLIENTS]; /* SMP port allocation /pipe */
Stephane Viau2e362e12014-11-18 12:49:48 -050056 mdp5_smp_state_t reserved_state;/* SMP MMBs statically allocated */
57 int reserved[MAX_CLIENTS]; /* # of MMBs allocated per client */
58};
59
Stephane Viau67ac0a22015-03-13 15:49:34 -040060#define MDP5_INTF_NUM_MAX 5
61
Stephane Viaufe344642015-04-30 13:45:52 -040062struct mdp5_intf_block {
63 uint32_t base[MAX_BASES];
64 u32 connect[MDP5_INTF_NUM_MAX]; /* array of enum mdp5_intf_type */
65};
66
Stephane Viau2e362e12014-11-18 12:49:48 -050067struct mdp5_cfg_hw {
68 char *name;
69
Stephane Viauf5253812015-03-09 09:11:04 -040070 struct mdp5_sub_block mdp;
Stephane Viau2e362e12014-11-18 12:49:48 -050071 struct mdp5_smp_block smp;
Stephane Viau389b09a2015-03-13 15:49:33 -040072 struct mdp5_ctl_block ctl;
Stephane Viau2e362e12014-11-18 12:49:48 -050073 struct mdp5_sub_block pipe_vig;
74 struct mdp5_sub_block pipe_rgb;
75 struct mdp5_sub_block pipe_dma;
76 struct mdp5_lm_block lm;
77 struct mdp5_sub_block dspp;
78 struct mdp5_sub_block ad;
Hai Li38305902015-03-05 15:20:47 -050079 struct mdp5_sub_block pp;
Stephane Viaufe344642015-04-30 13:45:52 -040080 struct mdp5_intf_block intf;
Stephane Viau67ac0a22015-03-13 15:49:34 -040081
Stephane Viau2e362e12014-11-18 12:49:48 -050082 uint32_t max_clk;
83};
84
85/* platform config data (ie. from DT, or pdata) */
86struct mdp5_cfg_platform {
87 struct iommu_domain *iommu;
88};
89
90struct mdp5_cfg {
91 const struct mdp5_cfg_hw *hw;
92 struct mdp5_cfg_platform platform;
93};
94
95struct mdp5_kms;
Rob Clark42238da2014-11-18 14:28:43 -050096struct mdp5_cfg_handler;
Stephane Viau2e362e12014-11-18 12:49:48 -050097
Rob Clark42238da2014-11-18 14:28:43 -050098const struct mdp5_cfg_hw *mdp5_cfg_get_hw_config(struct mdp5_cfg_handler *cfg_hnd);
99struct mdp5_cfg *mdp5_cfg_get_config(struct mdp5_cfg_handler *cfg_hnd);
100int mdp5_cfg_get_hw_rev(struct mdp5_cfg_handler *cfg_hnd);
Stephane Viau2e362e12014-11-18 12:49:48 -0500101
Stephane Viaud145dd72015-03-13 15:49:32 -0400102#define mdp5_cfg_intf_is_virtual(intf_type) ({ \
103 typeof(intf_type) __val = (intf_type); \
104 (__val) >= INTF_VIRTUAL ? true : false; })
105
Rob Clark42238da2014-11-18 14:28:43 -0500106struct mdp5_cfg_handler *mdp5_cfg_init(struct mdp5_kms *mdp5_kms,
107 uint32_t major, uint32_t minor);
108void mdp5_cfg_destroy(struct mdp5_cfg_handler *cfg_hnd);
Stephane Viau2e362e12014-11-18 12:49:48 -0500109
110#endif /* __MDP5_CFG_H__ */