Gopikrishnaiah Anandan | e0e5e0c | 2016-05-25 11:05:33 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 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 | |
| 13 | #ifndef _SDE_HW_LM_H |
| 14 | #define _SDE_HW_LM_H |
| 15 | |
| 16 | #include "sde_hw_mdss.h" |
Clarence Ip | c475b08 | 2016-06-26 09:27:23 -0400 | [diff] [blame] | 17 | #include "sde_hw_util.h" |
Lloyd Atkinson | 652e59b | 2017-05-03 11:20:30 -0400 | [diff] [blame] | 18 | #include "sde_hw_blk.h" |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 19 | |
| 20 | struct sde_hw_mixer; |
| 21 | |
| 22 | struct sde_hw_mixer_cfg { |
| 23 | u32 out_width; |
| 24 | u32 out_height; |
| 25 | bool right_mixer; |
| 26 | int flags; |
| 27 | }; |
| 28 | |
| 29 | struct sde_hw_color3_cfg { |
| 30 | u8 keep_fg[SDE_STAGE_MAX]; |
| 31 | }; |
| 32 | |
| 33 | /** |
| 34 | * |
| 35 | * struct sde_hw_lm_ops : Interface to the mixer Hw driver functions |
| 36 | * Assumption is these functions will be called after clocks are enabled |
| 37 | */ |
| 38 | struct sde_hw_lm_ops { |
| 39 | /* |
| 40 | * Sets up mixer output width and height |
| 41 | * and border color if enabled |
| 42 | */ |
| 43 | void (*setup_mixer_out)(struct sde_hw_mixer *ctx, |
| 44 | struct sde_hw_mixer_cfg *cfg); |
| 45 | |
| 46 | /* |
| 47 | * Alpha blending configuration |
| 48 | * for the specified stage |
| 49 | */ |
Dhaval Patel | 48c7602 | 2016-09-01 17:51:23 -0700 | [diff] [blame] | 50 | void (*setup_blend_config)(struct sde_hw_mixer *ctx, uint32_t stage, |
| 51 | uint32_t fg_alpha, uint32_t bg_alpha, uint32_t blend_op); |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 52 | |
| 53 | /* |
| 54 | * Alpha color component selection from either fg or bg |
| 55 | */ |
Dhaval Patel | 48c7602 | 2016-09-01 17:51:23 -0700 | [diff] [blame] | 56 | void (*setup_alpha_out)(struct sde_hw_mixer *ctx, uint32_t mixer_op); |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 57 | |
| 58 | /** |
| 59 | * setup_border_color : enable/disable border color |
| 60 | */ |
| 61 | void (*setup_border_color)(struct sde_hw_mixer *ctx, |
| 62 | struct sde_mdss_color *color, |
| 63 | u8 border_en); |
Gopikrishnaiah Anandan | e0e5e0c | 2016-05-25 11:05:33 -0700 | [diff] [blame] | 64 | /** |
| 65 | * setup_gc : enable/disable gamma correction feature |
| 66 | */ |
| 67 | void (*setup_gc)(struct sde_hw_mixer *mixer, |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 68 | void *cfg); |
| 69 | |
Veera Sundaram Sankaran | 3171ff8 | 2017-01-04 14:34:47 -0800 | [diff] [blame] | 70 | /** |
| 71 | * setup_dim_layer: configure dim layer settings |
| 72 | * @ctx: Pointer to layer mixer context |
| 73 | * @dim_layer: dim layer configs |
| 74 | */ |
| 75 | void (*setup_dim_layer)(struct sde_hw_mixer *ctx, |
| 76 | struct sde_hw_dim_layer *dim_layer); |
| 77 | |
| 78 | /** |
| 79 | * clear_dim_layer: clear dim layer settings |
| 80 | * @ctx: Pointer to layer mixer context |
| 81 | */ |
| 82 | void (*clear_dim_layer)(struct sde_hw_mixer *ctx); |
Dhaval Patel | f9245d6 | 2017-03-28 16:24:00 -0700 | [diff] [blame] | 83 | |
| 84 | /* setup_misr: enables/disables MISR in HW register */ |
| 85 | void (*setup_misr)(struct sde_hw_mixer *ctx, |
| 86 | bool enable, u32 frame_count); |
| 87 | |
| 88 | /* collect_misr: reads and stores MISR data from HW register */ |
| 89 | u32 (*collect_misr)(struct sde_hw_mixer *ctx); |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | struct sde_hw_mixer { |
Lloyd Atkinson | 652e59b | 2017-05-03 11:20:30 -0400 | [diff] [blame] | 93 | struct sde_hw_blk base; |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 94 | struct sde_hw_blk_reg_map hw; |
| 95 | |
| 96 | /* lm */ |
| 97 | enum sde_lm idx; |
| 98 | const struct sde_lm_cfg *cap; |
| 99 | const struct sde_mdp_cfg *mdp; |
| 100 | const struct sde_ctl_cfg *ctl; |
| 101 | |
| 102 | /* ops */ |
| 103 | struct sde_hw_lm_ops ops; |
Gopikrishnaiah Anandan | 9ba4378 | 2017-01-31 18:23:08 -0800 | [diff] [blame] | 104 | |
| 105 | /* store mixer info specific to display */ |
| 106 | struct sde_hw_mixer_cfg cfg; |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 107 | }; |
| 108 | |
| 109 | /** |
Lloyd Atkinson | ccb5621 | 2017-05-19 16:18:05 -0400 | [diff] [blame] | 110 | * to_sde_hw_mixer - convert base object sde_hw_base to container |
| 111 | * @hw: Pointer to base hardware block |
| 112 | * return: Pointer to hardware block container |
| 113 | */ |
| 114 | static inline struct sde_hw_mixer *to_sde_hw_mixer(struct sde_hw_blk *hw) |
| 115 | { |
| 116 | return container_of(hw, struct sde_hw_mixer, base); |
| 117 | } |
| 118 | |
| 119 | /** |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 120 | * sde_hw_lm_init(): Initializes the mixer hw driver object. |
| 121 | * should be called once before accessing every mixer. |
| 122 | * @idx: mixer index for which driver object is required |
| 123 | * @addr: mapped register io address of MDP |
| 124 | * @m : pointer to mdss catalog data |
| 125 | */ |
| 126 | struct sde_hw_mixer *sde_hw_lm_init(enum sde_lm idx, |
| 127 | void __iomem *addr, |
| 128 | struct sde_mdss_cfg *m); |
| 129 | |
Lloyd Atkinson | 6b3b9dd | 2016-08-10 18:45:31 -0400 | [diff] [blame] | 130 | /** |
| 131 | * sde_hw_lm_destroy(): Destroys layer mixer driver context |
| 132 | * @lm: Pointer to LM driver context |
| 133 | */ |
| 134 | void sde_hw_lm_destroy(struct sde_hw_mixer *lm); |
| 135 | |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 136 | #endif /*_SDE_HW_LM_H */ |