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" |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 18 | |
| 19 | struct sde_hw_mixer; |
| 20 | |
| 21 | struct sde_hw_mixer_cfg { |
| 22 | u32 out_width; |
| 23 | u32 out_height; |
| 24 | bool right_mixer; |
| 25 | int flags; |
| 26 | }; |
| 27 | |
| 28 | struct sde_hw_color3_cfg { |
| 29 | u8 keep_fg[SDE_STAGE_MAX]; |
| 30 | }; |
| 31 | |
| 32 | /** |
| 33 | * |
| 34 | * struct sde_hw_lm_ops : Interface to the mixer Hw driver functions |
| 35 | * Assumption is these functions will be called after clocks are enabled |
| 36 | */ |
| 37 | struct sde_hw_lm_ops { |
| 38 | /* |
| 39 | * Sets up mixer output width and height |
| 40 | * and border color if enabled |
| 41 | */ |
| 42 | void (*setup_mixer_out)(struct sde_hw_mixer *ctx, |
| 43 | struct sde_hw_mixer_cfg *cfg); |
| 44 | |
| 45 | /* |
| 46 | * Alpha blending configuration |
| 47 | * for the specified stage |
| 48 | */ |
Dhaval Patel | 48c7602 | 2016-09-01 17:51:23 -0700 | [diff] [blame] | 49 | void (*setup_blend_config)(struct sde_hw_mixer *ctx, uint32_t stage, |
| 50 | uint32_t fg_alpha, uint32_t bg_alpha, uint32_t blend_op); |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 51 | |
| 52 | /* |
| 53 | * Alpha color component selection from either fg or bg |
| 54 | */ |
Dhaval Patel | 48c7602 | 2016-09-01 17:51:23 -0700 | [diff] [blame] | 55 | 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] | 56 | |
| 57 | /** |
| 58 | * setup_border_color : enable/disable border color |
| 59 | */ |
| 60 | void (*setup_border_color)(struct sde_hw_mixer *ctx, |
| 61 | struct sde_mdss_color *color, |
| 62 | u8 border_en); |
Gopikrishnaiah Anandan | e0e5e0c | 2016-05-25 11:05:33 -0700 | [diff] [blame] | 63 | /** |
| 64 | * setup_gc : enable/disable gamma correction feature |
| 65 | */ |
| 66 | void (*setup_gc)(struct sde_hw_mixer *mixer, |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 67 | void *cfg); |
| 68 | |
| 69 | }; |
| 70 | |
| 71 | struct sde_hw_mixer { |
| 72 | /* base */ |
| 73 | struct sde_hw_blk_reg_map hw; |
| 74 | |
| 75 | /* lm */ |
| 76 | enum sde_lm idx; |
| 77 | const struct sde_lm_cfg *cap; |
| 78 | const struct sde_mdp_cfg *mdp; |
| 79 | const struct sde_ctl_cfg *ctl; |
| 80 | |
| 81 | /* ops */ |
| 82 | struct sde_hw_lm_ops ops; |
| 83 | }; |
| 84 | |
| 85 | /** |
| 86 | * sde_hw_lm_init(): Initializes the mixer hw driver object. |
| 87 | * should be called once before accessing every mixer. |
| 88 | * @idx: mixer index for which driver object is required |
| 89 | * @addr: mapped register io address of MDP |
| 90 | * @m : pointer to mdss catalog data |
| 91 | */ |
| 92 | struct sde_hw_mixer *sde_hw_lm_init(enum sde_lm idx, |
| 93 | void __iomem *addr, |
| 94 | struct sde_mdss_cfg *m); |
| 95 | |
Lloyd Atkinson | 6b3b9dd | 2016-08-10 18:45:31 -0400 | [diff] [blame] | 96 | /** |
| 97 | * sde_hw_lm_destroy(): Destroys layer mixer driver context |
| 98 | * @lm: Pointer to LM driver context |
| 99 | */ |
| 100 | void sde_hw_lm_destroy(struct sde_hw_mixer *lm); |
| 101 | |
Narendra Muppalla | 1b0b335 | 2015-09-29 10:16:51 -0700 | [diff] [blame] | 102 | #endif /*_SDE_HW_LM_H */ |