blob: ca671f89d6f6ea1e51b603e423fe541e2090bc68 [file] [log] [blame]
Gopikrishnaiah Anandane0e5e0c2016-05-25 11:05:33 -07001/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
Narendra Muppalla1b0b3352015-09-29 10:16:51 -07002 *
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 Ipc475b082016-06-26 09:27:23 -040017#include "sde_hw_util.h"
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070018
19struct sde_hw_mixer;
20
21struct sde_hw_mixer_cfg {
22 u32 out_width;
23 u32 out_height;
24 bool right_mixer;
25 int flags;
26};
27
28struct 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 */
37struct 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 Patel48c76022016-09-01 17:51:23 -070049 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 Muppalla1b0b3352015-09-29 10:16:51 -070051
52 /*
53 * Alpha color component selection from either fg or bg
54 */
Dhaval Patel48c76022016-09-01 17:51:23 -070055 void (*setup_alpha_out)(struct sde_hw_mixer *ctx, uint32_t mixer_op);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070056
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 Anandane0e5e0c2016-05-25 11:05:33 -070063 /**
64 * setup_gc : enable/disable gamma correction feature
65 */
66 void (*setup_gc)(struct sde_hw_mixer *mixer,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070067 void *cfg);
68
69};
70
71struct 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 */
92struct sde_hw_mixer *sde_hw_lm_init(enum sde_lm idx,
93 void __iomem *addr,
94 struct sde_mdss_cfg *m);
95
Lloyd Atkinson6b3b9dd2016-08-10 18:45:31 -040096/**
97 * sde_hw_lm_destroy(): Destroys layer mixer driver context
98 * @lm: Pointer to LM driver context
99 */
100void sde_hw_lm_destroy(struct sde_hw_mixer *lm);
101
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700102#endif /*_SDE_HW_LM_H */