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
37struct 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 unsigned int PANEL_PWRSEQ_REF_DIV2;
43};
44
45struct panel_cntl_funcs {
46 void (*destroy)(struct panel_cntl **panel_cntl);
47 uint32_t (*hw_init)(struct panel_cntl *panel_cntl);
48 bool (*is_panel_backlight_on)(struct panel_cntl *panel_cntl);
49 bool (*is_panel_powered_on)(struct panel_cntl *panel_cntl);
50 void (*store_backlight_level)(struct panel_cntl *panel_cntl);
51 void (*driver_set_backlight)(struct panel_cntl *panel_cntl,
52 uint32_t backlight_pwm_u16_16);
53 uint32_t (*get_current_backlight)(struct panel_cntl *panel_cntl);
54};
55
56struct panel_cntl_init_data {
57 struct dc_context *ctx;
58 uint32_t inst;
59};
60
61struct panel_cntl {
62 const struct panel_cntl_funcs *funcs;
63 struct dc_context *ctx;
64 uint32_t inst;
65 /* registers setting needs to be saved and restored at InitBacklight */
66 struct panel_cntl_backlight_registers stored_backlight_registers;
67};
68
69#endif /* DC_PANEL_CNTL_H_ */
70

source code of linux/drivers/gpu/drm/amd/display/dc/inc/hw/panel_cntl.h