aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/arm/malidp_hw.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/arm/malidp_hw.h')
-rw-r--r--drivers/gpu/drm/arm/malidp_hw.h65
1 files changed, 39 insertions, 26 deletions
diff --git a/drivers/gpu/drm/arm/malidp_hw.h b/drivers/gpu/drm/arm/malidp_hw.h
index 849ad9a30c3a..b0690ebb3565 100644
--- a/drivers/gpu/drm/arm/malidp_hw.h
+++ b/drivers/gpu/drm/arm/malidp_hw.h
@@ -120,18 +120,14 @@ struct malidp_hw_regmap {
120/* Unlike DP550/650, DP500 has 3 stride registers in its video layer. */ 120/* Unlike DP550/650, DP500 has 3 stride registers in its video layer. */
121#define MALIDP_DEVICE_LV_HAS_3_STRIDES BIT(0) 121#define MALIDP_DEVICE_LV_HAS_3_STRIDES BIT(0)
122 122
123struct malidp_hw_device { 123struct malidp_hw_device;
124 const struct malidp_hw_regmap map;
125 void __iomem *regs;
126 124
127 /* APB clock */ 125/*
128 struct clk *pclk; 126 * Static structure containing hardware specific data and pointers to
129 /* AXI clock */ 127 * functions that behave differently between various versions of the IP.
130 struct clk *aclk; 128 */
131 /* main clock for display core */ 129struct malidp_hw {
132 struct clk *mclk; 130 const struct malidp_hw_regmap map;
133 /* pixel clock for display core */
134 struct clk *pxlclk;
135 131
136 /* 132 /*
137 * Validate the driver instance against the hardware bits 133 * Validate the driver instance against the hardware bits
@@ -182,15 +178,6 @@ struct malidp_hw_device {
182 struct videomode *vm); 178 struct videomode *vm);
183 179
184 u8 features; 180 u8 features;
185
186 u8 min_line_size;
187 u16 max_line_size;
188
189 /* track the device PM state */
190 bool pm_suspended;
191
192 /* size of memory used for rotating layers, up to two banks available */
193 u32 rotation_memory[2];
194}; 181};
195 182
196/* Supported variants of the hardware */ 183/* Supported variants of the hardware */
@@ -202,7 +189,33 @@ enum {
202 MALIDP_MAX_DEVICES 189 MALIDP_MAX_DEVICES
203}; 190};
204 191
205extern const struct malidp_hw_device malidp_device[MALIDP_MAX_DEVICES]; 192extern const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES];
193
194/*
195 * Structure used by the driver during runtime operation.
196 */
197struct malidp_hw_device {
198 struct malidp_hw *hw;
199 void __iomem *regs;
200
201 /* APB clock */
202 struct clk *pclk;
203 /* AXI clock */
204 struct clk *aclk;
205 /* main clock for display core */
206 struct clk *mclk;
207 /* pixel clock for display core */
208 struct clk *pxlclk;
209
210 u8 min_line_size;
211 u16 max_line_size;
212
213 /* track the device PM state */
214 bool pm_suspended;
215
216 /* size of memory used for rotating layers, up to two banks available */
217 u32 rotation_memory[2];
218};
206 219
207static inline u32 malidp_hw_read(struct malidp_hw_device *hwdev, u32 reg) 220static inline u32 malidp_hw_read(struct malidp_hw_device *hwdev, u32 reg)
208{ 221{
@@ -240,9 +253,9 @@ static inline u32 malidp_get_block_base(struct malidp_hw_device *hwdev,
240{ 253{
241 switch (block) { 254 switch (block) {
242 case MALIDP_SE_BLOCK: 255 case MALIDP_SE_BLOCK:
243 return hwdev->map.se_base; 256 return hwdev->hw->map.se_base;
244 case MALIDP_DC_BLOCK: 257 case MALIDP_DC_BLOCK:
245 return hwdev->map.dc_base; 258 return hwdev->hw->map.dc_base;
246 } 259 }
247 260
248 return 0; 261 return 0;
@@ -275,7 +288,7 @@ u8 malidp_hw_get_format_id(const struct malidp_hw_regmap *map,
275static inline bool malidp_hw_pitch_valid(struct malidp_hw_device *hwdev, 288static inline bool malidp_hw_pitch_valid(struct malidp_hw_device *hwdev,
276 unsigned int pitch) 289 unsigned int pitch)
277{ 290{
278 return !(pitch & (hwdev->map.bus_align_bytes - 1)); 291 return !(pitch & (hwdev->hw->map.bus_align_bytes - 1));
279} 292}
280 293
281/* U16.16 */ 294/* U16.16 */
@@ -308,8 +321,8 @@ static inline void malidp_se_set_enh_coeffs(struct malidp_hw_device *hwdev)
308 }; 321 };
309 u32 val = MALIDP_SE_SET_ENH_LIMIT_LOW(MALIDP_SE_ENH_LOW_LEVEL) | 322 u32 val = MALIDP_SE_SET_ENH_LIMIT_LOW(MALIDP_SE_ENH_LOW_LEVEL) |
310 MALIDP_SE_SET_ENH_LIMIT_HIGH(MALIDP_SE_ENH_HIGH_LEVEL); 323 MALIDP_SE_SET_ENH_LIMIT_HIGH(MALIDP_SE_ENH_HIGH_LEVEL);
311 u32 image_enh = hwdev->map.se_base + 324 u32 image_enh = hwdev->hw->map.se_base +
312 ((hwdev->map.features & MALIDP_REGMAP_HAS_CLEARIRQ) ? 325 ((hwdev->hw->map.features & MALIDP_REGMAP_HAS_CLEARIRQ) ?
313 0x10 : 0xC) + MALIDP_SE_IMAGE_ENH; 326 0x10 : 0xC) + MALIDP_SE_IMAGE_ENH;
314 u32 enh_coeffs = image_enh + MALIDP_SE_ENH_COEFF0; 327 u32 enh_coeffs = image_enh + MALIDP_SE_ENH_COEFF0;
315 int i; 328 int i;