blob: 46f9a24de5cf460cef3f1148b447adb05453ab4e [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_CTL_H
14#define _SDE_HW_CTL_H
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070015
16#include "sde_hw_mdss.h"
Clarence Ipc475b082016-06-26 09:27:23 -040017#include "sde_hw_util.h"
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070018#include "sde_hw_catalog.h"
19
Lloyd Atkinson5d722782016-05-30 14:09:41 -040020/**
21 * sde_ctl_mode_sel: Interface mode selection
22 * SDE_CTL_MODE_SEL_VID: Video mode interface
23 * SDE_CTL_MODE_SEL_CMD: Command mode interface
24 */
25enum sde_ctl_mode_sel {
26 SDE_CTL_MODE_SEL_VID = 0,
27 SDE_CTL_MODE_SEL_CMD
28};
29
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070030struct sde_hw_ctl;
31/**
32 * struct sde_hw_stage_cfg - blending stage cfg
33 * @stage
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070034 */
35struct sde_hw_stage_cfg {
Dhaval Patel48c76022016-09-01 17:51:23 -070036 enum sde_sspp stage[CRTC_DUAL_MIXERS][SDE_STAGE_MAX][PIPES_PER_STAGE];
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070037};
38
39/**
Lloyd Atkinson5d722782016-05-30 14:09:41 -040040 * struct sde_hw_intf_cfg :Describes how the SDE writes data to output interface
Abhijit Kulkarni3e3e0d22016-06-24 17:56:13 -040041 * @intf : Interface id
Lloyd Atkinson5d722782016-05-30 14:09:41 -040042 * @wb: Writeback id
Abhijit Kulkarni3e3e0d22016-06-24 17:56:13 -040043 * @mode_3d: 3d mux configuration
Lloyd Atkinson5d722782016-05-30 14:09:41 -040044 * @intf_mode_sel: Interface mode, cmd / vid
45 * @stream_sel: Stream selection for multi-stream interfaces
Abhijit Kulkarni3e3e0d22016-06-24 17:56:13 -040046 */
47struct sde_hw_intf_cfg {
48 enum sde_intf intf;
49 enum sde_wb wb;
50 enum sde_3d_blend_mode mode_3d;
Lloyd Atkinson5d722782016-05-30 14:09:41 -040051 enum sde_ctl_mode_sel intf_mode_sel;
52 int stream_sel;
Abhijit Kulkarni3e3e0d22016-06-24 17:56:13 -040053};
54
55/**
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070056 * struct sde_hw_ctl_ops - Interface to the wb Hw driver functions
57 * Assumption is these functions will be called after clocks are enabled
58 */
59struct sde_hw_ctl_ops {
Abhijit Kulkarni3e3e0d22016-06-24 17:56:13 -040060 /**
61 * kickoff hw operation for Sw controlled interfaces
62 * DSI cmd mode and WB interface are SW controlled
63 * @ctx : ctl path ctx pointer
64 */
Lloyd Atkinson5d722782016-05-30 14:09:41 -040065 void (*trigger_start)(struct sde_hw_ctl *ctx);
Abhijit Kulkarni3e3e0d22016-06-24 17:56:13 -040066
67 /**
Lloyd Atkinson5d722782016-05-30 14:09:41 -040068 * Clear the value of the cached pending_flush_mask
69 * No effect on hardware
70 * @ctx : ctl path ctx pointer
71 */
72 void (*clear_pending_flush)(struct sde_hw_ctl *ctx);
73
74 /**
75 * OR in the given flushbits to the cached pending_flush_mask
76 * No effect on hardware
Abhijit Kulkarni3e3e0d22016-06-24 17:56:13 -040077 * @ctx : ctl path ctx pointer
78 * @flushbits : module flushmask
79 */
Lloyd Atkinson5d722782016-05-30 14:09:41 -040080 void (*update_pending_flush)(struct sde_hw_ctl *ctx,
81 u32 flushbits);
82
83 /**
84 * Write the value of the pending_flush_mask to hardware
85 * @ctx : ctl path ctx pointer
86 */
87 void (*trigger_flush)(struct sde_hw_ctl *ctx);
Abhijit Kulkarni3e3e0d22016-06-24 17:56:13 -040088
89 /**
90 * Setup ctl_path interface config
91 * @ctx
92 * @cfg : interface config structure pointer
93 */
94 void (*setup_intf_cfg)(struct sde_hw_ctl *ctx,
95 struct sde_hw_intf_cfg *cfg);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070096
97 int (*reset)(struct sde_hw_ctl *c);
98
Dhaval Patel48c76022016-09-01 17:51:23 -070099 uint32_t (*get_bitmask_sspp)(struct sde_hw_ctl *ctx,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700100 enum sde_sspp blk);
101
Dhaval Patel48c76022016-09-01 17:51:23 -0700102 uint32_t (*get_bitmask_mixer)(struct sde_hw_ctl *ctx,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700103 enum sde_lm blk);
104
105 int (*get_bitmask_dspp)(struct sde_hw_ctl *ctx,
106 u32 *flushbits,
107 enum sde_dspp blk);
108
109 int (*get_bitmask_intf)(struct sde_hw_ctl *ctx,
110 u32 *flushbits,
111 enum sde_intf blk);
112
113 int (*get_bitmask_cdm)(struct sde_hw_ctl *ctx,
114 u32 *flushbits,
115 enum sde_cdm blk);
116
Alan Kwong3232ca52016-07-29 02:27:47 -0400117 int (*get_bitmask_wb)(struct sde_hw_ctl *ctx,
118 u32 *flushbits,
119 enum sde_wb blk);
120
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700121 void (*setup_blendstage)(struct sde_hw_ctl *ctx,
Dhaval Patel44f12472016-08-29 12:19:47 -0700122 enum sde_lm lm, struct sde_hw_stage_cfg *cfg, u32 index);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700123};
124
125/**
126 * struct sde_hw_ctl : CTL PATH driver object
Lloyd Atkinson5d722782016-05-30 14:09:41 -0400127 * @hw: block register map object
128 * @idx: control path index
129 * @ctl_hw_caps: control path capabilities
130 * @mixer_count: number of mixers
131 * @mixer_hw_caps: mixer hardware capabilities
132 * @pending_flush_mask: storage for pending ctl_flush managed via ops
133 * @ops: operation list
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700134 */
135struct sde_hw_ctl {
136 /* base */
137 struct sde_hw_blk_reg_map hw;
138
139 /* ctl path */
140 int idx;
141 const struct sde_ctl_cfg *caps;
142 int mixer_count;
143 const struct sde_lm_cfg *mixer_hw_caps;
Lloyd Atkinson5d722782016-05-30 14:09:41 -0400144 u32 pending_flush_mask;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700145
146 /* ops */
147 struct sde_hw_ctl_ops ops;
148};
149
150/**
151 * sde_hw_ctl_init(): Initializes the ctl_path hw driver object.
Abhijit Kulkarni3e3e0d22016-06-24 17:56:13 -0400152 * should be called before accessing every ctl path registers.
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700153 * @idx: ctl_path index for which driver object is required
154 * @addr: mapped register io address of MDP
155 * @m : pointer to mdss catalog data
156 */
157struct sde_hw_ctl *sde_hw_ctl_init(enum sde_ctl idx,
158 void __iomem *addr,
159 struct sde_mdss_cfg *m);
160
Abhijit Kulkarni3e3e0d22016-06-24 17:56:13 -0400161/**
162 * sde_hw_ctl_destroy(): Destroys ctl driver context
163 * should be called to free the context
164 */
165void sde_hw_ctl_destroy(struct sde_hw_ctl *ctx);
166
Clarence Ipc475b082016-06-26 09:27:23 -0400167#endif /*_SDE_HW_CTL_H */