Linux Audio

Check our new training course

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