blob: 8a146bd225a1d5b0beef8a25ce5bc39077316a49 [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"
Lloyd Atkinson652e59b2017-05-03 11:20:30 -040018#include "sde_hw_blk.h"
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070019
20struct sde_hw_mixer;
21
22struct sde_hw_mixer_cfg {
23 u32 out_width;
24 u32 out_height;
25 bool right_mixer;
26 int flags;
27};
28
29struct 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 */
38struct 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 Patel48c76022016-09-01 17:51:23 -070050 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 Muppalla1b0b3352015-09-29 10:16:51 -070052
53 /*
54 * Alpha color component selection from either fg or bg
55 */
Dhaval Patel48c76022016-09-01 17:51:23 -070056 void (*setup_alpha_out)(struct sde_hw_mixer *ctx, uint32_t mixer_op);
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070057
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 Anandane0e5e0c2016-05-25 11:05:33 -070064 /**
65 * setup_gc : enable/disable gamma correction feature
66 */
67 void (*setup_gc)(struct sde_hw_mixer *mixer,
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070068 void *cfg);
69
Veera Sundaram Sankaran3171ff82017-01-04 14:34:47 -080070 /**
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 Patelf9245d62017-03-28 16:24:00 -070083
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 Muppalla1b0b3352015-09-29 10:16:51 -070090};
91
92struct sde_hw_mixer {
Lloyd Atkinson652e59b2017-05-03 11:20:30 -040093 struct sde_hw_blk base;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -070094 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 Anandan9ba43782017-01-31 18:23:08 -0800104
105 /* store mixer info specific to display */
106 struct sde_hw_mixer_cfg cfg;
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700107};
108
109/**
Lloyd Atkinsonccb56212017-05-19 16:18:05 -0400110 * 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 */
114static 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 Muppalla1b0b3352015-09-29 10:16:51 -0700120 * 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 */
126struct sde_hw_mixer *sde_hw_lm_init(enum sde_lm idx,
127 void __iomem *addr,
128 struct sde_mdss_cfg *m);
129
Lloyd Atkinson6b3b9dd2016-08-10 18:45:31 -0400130/**
131 * sde_hw_lm_destroy(): Destroys layer mixer driver context
132 * @lm: Pointer to LM driver context
133 */
134void sde_hw_lm_destroy(struct sde_hw_mixer *lm);
135
Narendra Muppalla1b0b3352015-09-29 10:16:51 -0700136#endif /*_SDE_HW_LM_H */