• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017 Advanced Micro Devices, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  */
23 /*
24  * panel_cntl.h
25  *
26  *  Created on: Oct 6, 2015
27  *      Author: yonsun
28  */
29 
30 #ifndef DC_PANEL_CNTL_H_
31 #define DC_PANEL_CNTL_H_
32 
33 #include "dc_types.h"
34 
35 #define MAX_BACKLIGHT_LEVEL 0xFFFF
36 
37 struct panel_cntl_backlight_registers {
38 	unsigned int BL_PWM_CNTL;
39 	unsigned int BL_PWM_CNTL2;
40 	unsigned int BL_PWM_PERIOD_CNTL;
41 	unsigned int LVTMA_PWRSEQ_REF_DIV_BL_PWM_REF_DIV;
42 };
43 
44 struct panel_cntl_funcs {
45 	void (*destroy)(struct panel_cntl **panel_cntl);
46 	uint32_t (*hw_init)(struct panel_cntl *panel_cntl);
47 	bool (*is_panel_backlight_on)(struct panel_cntl *panel_cntl);
48 	bool (*is_panel_powered_on)(struct panel_cntl *panel_cntl);
49 	void (*store_backlight_level)(struct panel_cntl *panel_cntl);
50 	void (*driver_set_backlight)(struct panel_cntl *panel_cntl,
51 			uint32_t backlight_pwm_u16_16);
52 	uint32_t (*get_current_backlight)(struct panel_cntl *panel_cntl);
53 };
54 
55 struct panel_cntl_init_data {
56 	struct dc_context *ctx;
57 	uint32_t inst;
58 };
59 
60 struct panel_cntl {
61 	const struct panel_cntl_funcs *funcs;
62 	struct dc_context *ctx;
63 	uint32_t inst;
64 	/* registers setting needs to be saved and restored at InitBacklight */
65 	struct panel_cntl_backlight_registers stored_backlight_registers;
66 };
67 
68 #endif /* DC_PANEL_CNTL_H_ */
69