xref: /openbsd-src/sys/dev/pci/drm/amd/display/dc/inc/hw/abm.h (revision c1e59e835f1fb66bbe12c60d616bda3abd0aa208)
1fb4d8502Sjsg /* Copyright 2012-15 Advanced Micro Devices, Inc.
2fb4d8502Sjsg  *
3fb4d8502Sjsg  * Permission is hereby granted, free of charge, to any person obtaining a
4fb4d8502Sjsg  * copy of this software and associated documentation files (the "Software"),
5fb4d8502Sjsg  * to deal in the Software without restriction, including without limitation
6fb4d8502Sjsg  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7fb4d8502Sjsg  * and/or sell copies of the Software, and to permit persons to whom the
8fb4d8502Sjsg  * Software is furnished to do so, subject to the following conditions:
9fb4d8502Sjsg  *
10fb4d8502Sjsg  * The above copyright notice and this permission notice shall be included in
11fb4d8502Sjsg  * all copies or substantial portions of the Software.
12fb4d8502Sjsg  *
13fb4d8502Sjsg  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14fb4d8502Sjsg  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15fb4d8502Sjsg  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
16fb4d8502Sjsg  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
17fb4d8502Sjsg  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
18fb4d8502Sjsg  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
19fb4d8502Sjsg  * OTHER DEALINGS IN THE SOFTWARE.
20fb4d8502Sjsg  *
21fb4d8502Sjsg  * Authors: AMD
22fb4d8502Sjsg  *
23fb4d8502Sjsg  */
24fb4d8502Sjsg 
25fb4d8502Sjsg #ifndef __DC_ABM_H__
26fb4d8502Sjsg #define __DC_ABM_H__
27fb4d8502Sjsg 
28fb4d8502Sjsg #include "dm_services_types.h"
29fb4d8502Sjsg 
30f005ef32Sjsg struct abm_save_restore;
31f005ef32Sjsg 
32fb4d8502Sjsg struct abm {
33fb4d8502Sjsg 	struct dc_context *ctx;
34fb4d8502Sjsg 	const struct abm_funcs *funcs;
35c349dbc7Sjsg 	bool dmcu_is_running;
36fb4d8502Sjsg };
37fb4d8502Sjsg 
38fb4d8502Sjsg struct abm_funcs {
39ad8b1aafSjsg 	void (*abm_init)(struct abm *abm, uint32_t back_light);
40fb4d8502Sjsg 	bool (*set_abm_level)(struct abm *abm, unsigned int abm_level);
41ad8b1aafSjsg 	bool (*set_abm_immediate_disable)(struct abm *abm, unsigned int panel_inst);
42ad8b1aafSjsg 	bool (*set_pipe)(struct abm *abm, unsigned int controller_id, unsigned int panel_inst);
43c349dbc7Sjsg 
44c349dbc7Sjsg 	/* backlight_pwm_u16_16 is unsigned 32 bit,
45c349dbc7Sjsg 	 * 16 bit integer + 16 fractional, where 1.0 is max backlight value.
46c349dbc7Sjsg 	 */
47c349dbc7Sjsg 	bool (*set_backlight_level_pwm)(struct abm *abm,
48c349dbc7Sjsg 			unsigned int backlight_pwm_u16_16,
49fb4d8502Sjsg 			unsigned int frame_ramp,
50fb4d8502Sjsg 			unsigned int controller_id,
51ad8b1aafSjsg 			unsigned int panel_inst);
52c349dbc7Sjsg 
53c349dbc7Sjsg 	unsigned int (*get_current_backlight)(struct abm *abm);
54c349dbc7Sjsg 	unsigned int (*get_target_backlight)(struct abm *abm);
55ad8b1aafSjsg 	bool (*init_abm_config)(struct abm *abm,
56ad8b1aafSjsg 			const char *src,
575ca02815Sjsg 			unsigned int bytes,
585ca02815Sjsg 			unsigned int inst);
591bb76ff1Sjsg 	bool (*set_abm_pause)(struct abm *abm, bool pause, unsigned int panel_inst, unsigned int otg_inst);
60f005ef32Sjsg 	bool (*save_restore)(
61f005ef32Sjsg 			struct abm *abm,
62f005ef32Sjsg 			unsigned int panel_inst,
63f005ef32Sjsg 			struct abm_save_restore *pData);
64f005ef32Sjsg 	bool (*set_pipe_ex)(struct abm *abm,
65f005ef32Sjsg 			unsigned int otg_inst,
66f005ef32Sjsg 			unsigned int option,
67*c1e59e83Sjsg 			unsigned int panel_inst,
68*c1e59e83Sjsg 			unsigned int pwrseq_inst);
69fb4d8502Sjsg };
70fb4d8502Sjsg 
71fb4d8502Sjsg #endif
72