Commit | Line | Data |
---|---|---|
904fb6e0 AK |
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 | /* | |
d4caa72e | 24 | * panel_cntl.h |
904fb6e0 AK |
25 | * |
26 | * Created on: Oct 6, 2015 | |
27 | * Author: yonsun | |
28 | */ | |
29 | ||
d4caa72e AK |
30 | #ifndef DC_PANEL_CNTL_H_ |
31 | #define DC_PANEL_CNTL_H_ | |
904fb6e0 AK |
32 | |
33 | #include "dc_types.h" | |
34 | ||
3ba01817 YS |
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; | |
a91b402d | 42 | unsigned int PANEL_PWRSEQ_REF_DIV2; |
ee8ed250 | 43 | unsigned int USER_LEVEL; |
3ba01817 YS |
44 | }; |
45 | ||
d4caa72e AK |
46 | struct panel_cntl_funcs { |
47 | void (*destroy)(struct panel_cntl **panel_cntl); | |
3ba01817 | 48 | uint32_t (*hw_init)(struct panel_cntl *panel_cntl); |
d4caa72e AK |
49 | bool (*is_panel_backlight_on)(struct panel_cntl *panel_cntl); |
50 | bool (*is_panel_powered_on)(struct panel_cntl *panel_cntl); | |
3ba01817 YS |
51 | void (*store_backlight_level)(struct panel_cntl *panel_cntl); |
52 | void (*driver_set_backlight)(struct panel_cntl *panel_cntl, | |
53 | uint32_t backlight_pwm_u16_16); | |
ccc87505 | 54 | uint32_t (*get_current_backlight)(struct panel_cntl *panel_cntl); |
904fb6e0 AK |
55 | }; |
56 | ||
d4caa72e | 57 | struct panel_cntl_init_data { |
904fb6e0 AK |
58 | struct dc_context *ctx; |
59 | uint32_t inst; | |
4e738260 | 60 | uint32_t eng_id; |
904fb6e0 AK |
61 | }; |
62 | ||
d4caa72e AK |
63 | struct panel_cntl { |
64 | const struct panel_cntl_funcs *funcs; | |
904fb6e0 AK |
65 | struct dc_context *ctx; |
66 | uint32_t inst; | |
b17ef04b | 67 | uint32_t pwrseq_inst; |
3ba01817 YS |
68 | /* registers setting needs to be saved and restored at InitBacklight */ |
69 | struct panel_cntl_backlight_registers stored_backlight_registers; | |
904fb6e0 AK |
70 | }; |
71 | ||
d4caa72e | 72 | #endif /* DC_PANEL_CNTL_H_ */ |