178c77382SAnthony Koo /*
278c77382SAnthony Koo  * Copyright 2016 Advanced Micro Devices, Inc.
378c77382SAnthony Koo  *
478c77382SAnthony Koo  * Permission is hereby granted, free of charge, to any person obtaining a
578c77382SAnthony Koo  * copy of this software and associated documentation files (the "Software"),
678c77382SAnthony Koo  * to deal in the Software without restriction, including without limitation
778c77382SAnthony Koo  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
878c77382SAnthony Koo  * and/or sell copies of the Software, and to permit persons to whom the
978c77382SAnthony Koo  * Software is furnished to do so, subject to the following conditions:
1078c77382SAnthony Koo  *
1178c77382SAnthony Koo  * The above copyright notice and this permission notice shall be included in
1278c77382SAnthony Koo  * all copies or substantial portions of the Software.
1378c77382SAnthony Koo  *
1478c77382SAnthony Koo  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1578c77382SAnthony Koo  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1678c77382SAnthony Koo  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1778c77382SAnthony Koo  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
1878c77382SAnthony Koo  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1978c77382SAnthony Koo  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2078c77382SAnthony Koo  * OTHER DEALINGS IN THE SOFTWARE.
2178c77382SAnthony Koo  *
2278c77382SAnthony Koo  * Authors: AMD
2378c77382SAnthony Koo  *
2478c77382SAnthony Koo  */
2578c77382SAnthony Koo 
2678c77382SAnthony Koo #include "dce110/dce110_hw_sequencer.h"
2778c77382SAnthony Koo #include "dcn10/dcn10_hw_sequencer.h"
2878c77382SAnthony Koo #include "dcn20_hwseq.h"
2978c77382SAnthony Koo 
3064cf26f0SIsabella Basso #include "dcn20_init.h"
3164cf26f0SIsabella Basso 
3278c77382SAnthony Koo static const struct hw_sequencer_funcs dcn20_funcs = {
3378c77382SAnthony Koo 	.program_gamut_remap = dcn10_program_gamut_remap,
3478c77382SAnthony Koo 	.init_hw = dcn10_init_hw,
35ca751df2SSung Lee 	.power_down_on_boot =  dcn10_power_down_on_boot,
3678c77382SAnthony Koo 	.apply_ctx_to_hw = dce110_apply_ctx_to_hw,
3778c77382SAnthony Koo 	.apply_ctx_for_surface = NULL,
3878c77382SAnthony Koo 	.program_front_end_for_ctx = dcn20_program_front_end_for_ctx,
3981b437f5SAlvin Lee 	.wait_for_pending_cleared = dcn10_wait_for_pending_cleared,
40bbf5f6c3SAnthony Koo 	.post_unlock_program_front_end = dcn20_post_unlock_program_front_end,
4178c77382SAnthony Koo 	.update_plane_addr = dcn20_update_plane_addr,
4278c77382SAnthony Koo 	.update_dchub = dcn10_update_dchub,
4378c77382SAnthony Koo 	.update_pending_status = dcn10_update_pending_status,
4478c77382SAnthony Koo 	.program_output_csc = dcn20_program_output_csc,
4578c77382SAnthony Koo 	.enable_accelerated_mode = dce110_enable_accelerated_mode,
4678c77382SAnthony Koo 	.enable_timing_synchronization = dcn10_enable_timing_synchronization,
4777a2b726SVladimir Stempen 	.enable_vblanks_synchronization = dcn10_enable_vblanks_synchronization,
4878c77382SAnthony Koo 	.enable_per_frame_crtc_position_reset = dcn10_enable_per_frame_crtc_position_reset,
4978c77382SAnthony Koo 	.update_info_frame = dce110_update_info_frame,
5078c77382SAnthony Koo 	.send_immediate_sdp_message = dcn10_send_immediate_sdp_message,
5178c77382SAnthony Koo 	.enable_stream = dcn20_enable_stream,
5278c77382SAnthony Koo 	.disable_stream = dce110_disable_stream,
5378c77382SAnthony Koo 	.unblank_stream = dcn20_unblank_stream,
5478c77382SAnthony Koo 	.blank_stream = dce110_blank_stream,
5578c77382SAnthony Koo 	.enable_audio_stream = dce110_enable_audio_stream,
5678c77382SAnthony Koo 	.disable_audio_stream = dce110_disable_audio_stream,
5778c77382SAnthony Koo 	.disable_plane = dcn20_disable_plane,
5878c77382SAnthony Koo 	.pipe_control_lock = dcn20_pipe_control_lock,
59009114f6SAnthony Koo 	.interdependent_update_lock = dcn10_lock_all_pipes,
601e461c37SAric Cyr 	.cursor_lock = dcn10_cursor_lock,
6178c77382SAnthony Koo 	.prepare_bandwidth = dcn20_prepare_bandwidth,
6278c77382SAnthony Koo 	.optimize_bandwidth = dcn20_optimize_bandwidth,
6378c77382SAnthony Koo 	.update_bandwidth = dcn20_update_bandwidth,
6478c77382SAnthony Koo 	.set_drr = dcn10_set_drr,
6578c77382SAnthony Koo 	.get_position = dcn10_get_position,
6678c77382SAnthony Koo 	.set_static_screen_control = dcn10_set_static_screen_control,
6778c77382SAnthony Koo 	.setup_stereo = dcn10_setup_stereo,
6878c77382SAnthony Koo 	.set_avmute = dce110_set_avmute,
6978c77382SAnthony Koo 	.log_hw_state = dcn10_log_hw_state,
7078c77382SAnthony Koo 	.get_hw_state = dcn10_get_hw_state,
7178c77382SAnthony Koo 	.clear_status_bits = dcn10_clear_status_bits,
7278c77382SAnthony Koo 	.wait_for_mpcc_disconnect = dcn10_wait_for_mpcc_disconnect,
73099303e9SPeikang Zhang 	.edp_backlight_control = dce110_edp_backlight_control,
7478c77382SAnthony Koo 	.edp_power_control = dce110_edp_power_control,
7578c77382SAnthony Koo 	.edp_wait_for_hpd_ready = dce110_edp_wait_for_hpd_ready,
7678c77382SAnthony Koo 	.set_cursor_position = dcn10_set_cursor_position,
7778c77382SAnthony Koo 	.set_cursor_attribute = dcn10_set_cursor_attribute,
7878c77382SAnthony Koo 	.set_cursor_sdr_white_level = dcn10_set_cursor_sdr_white_level,
7978c77382SAnthony Koo 	.setup_periodic_interrupt = dcn10_setup_periodic_interrupt,
8078c77382SAnthony Koo 	.set_clock = dcn10_set_clock,
8178c77382SAnthony Koo 	.get_clock = dcn10_get_clock,
82f42ea55bSAnthony Koo 	.program_triplebuffer = dcn20_program_triple_buffer,
83f42ea55bSAnthony Koo 	.enable_writeback = dcn20_enable_writeback,
84f42ea55bSAnthony Koo 	.disable_writeback = dcn20_disable_writeback,
85f42ea55bSAnthony Koo 	.dmdata_status_done = dcn20_dmdata_status_done,
86f42ea55bSAnthony Koo 	.program_dmdata_engine = dcn20_program_dmdata_engine,
87f42ea55bSAnthony Koo 	.set_dmdata_attributes = dcn20_set_dmdata_attributes,
88f42ea55bSAnthony Koo 	.init_sys_ctx = dcn20_init_sys_ctx,
89f42ea55bSAnthony Koo 	.init_vm_ctx = dcn20_init_vm_ctx,
90f42ea55bSAnthony Koo 	.set_flip_control_gsl = dcn20_set_flip_control_gsl,
91f42ea55bSAnthony Koo 	.get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync,
9263731e73SNicholas Kazlauskas 	.calc_vupdate_position = dcn10_calc_vupdate_position,
934b0e95d1SYongqiang Sun 	.set_backlight_level = dce110_set_backlight_level,
943ba01817SYongqiang Sun 	.set_abm_immediate_disable = dce110_set_abm_immediate_disable,
95474ac4a8SYongqiang Sun 	.set_pipe = dce110_set_pipe,
96cc0f379dSReza Amini #ifndef TRIM_FSFT
97cc0f379dSReza Amini 	.optimize_timing_for_fsft = dcn20_optimize_timing_for_fsft,
98cc0f379dSReza Amini #endif
999c75891fSWenjing Liu 	.enable_lvds_link_output = dce110_enable_lvds_link_output,
1009c75891fSWenjing Liu 	.enable_tmds_link_output = dce110_enable_tmds_link_output,
1019c75891fSWenjing Liu 	.enable_dp_link_output = dce110_enable_dp_link_output,
1029c75891fSWenjing Liu 	.disable_link_output = dce110_disable_link_output,
103dbf5256bSJoshua Aberback 	.set_disp_pattern_generator = dcn20_set_disp_pattern_generator,
104712343cdSVictor Lu 	.get_dcc_en_bits = dcn10_get_dcc_en_bits,
105*d205a800SLeo (Hanghong) Ma 	.update_visual_confirm_color = dcn10_update_visual_confirm_color,
106f42ea55bSAnthony Koo };
107f42ea55bSAnthony Koo 
108f42ea55bSAnthony Koo static const struct hwseq_private_funcs dcn20_private_funcs = {
109f42ea55bSAnthony Koo 	.init_pipes = dcn10_init_pipes,
110f42ea55bSAnthony Koo 	.update_plane_addr = dcn20_update_plane_addr,
111f42ea55bSAnthony Koo 	.plane_atomic_disconnect = dcn10_plane_atomic_disconnect,
112f42ea55bSAnthony Koo 	.update_mpcc = dcn20_update_mpcc,
113f42ea55bSAnthony Koo 	.set_input_transfer_func = dcn20_set_input_transfer_func,
114f42ea55bSAnthony Koo 	.set_output_transfer_func = dcn20_set_output_transfer_func,
115f42ea55bSAnthony Koo 	.power_down = dce110_power_down,
116f42ea55bSAnthony Koo 	.enable_display_power_gating = dcn10_dummy_display_power_gating,
117f42ea55bSAnthony Koo 	.blank_pixel_data = dcn20_blank_pixel_data,
118f42ea55bSAnthony Koo 	.reset_hw_ctx_wrap = dcn20_reset_hw_ctx_wrap,
119f42ea55bSAnthony Koo 	.enable_stream_timing = dcn20_enable_stream_timing,
120f42ea55bSAnthony Koo 	.edp_backlight_control = dce110_edp_backlight_control,
121f42ea55bSAnthony Koo 	.disable_stream_gating = dcn20_disable_stream_gating,
122f42ea55bSAnthony Koo 	.enable_stream_gating = dcn20_enable_stream_gating,
123f42ea55bSAnthony Koo 	.setup_vupdate_interrupt = dcn20_setup_vupdate_interrupt,
12478c77382SAnthony Koo 	.did_underflow_occur = dcn10_did_underflow_occur,
12578c77382SAnthony Koo 	.init_blank = dcn20_init_blank,
12678c77382SAnthony Koo 	.disable_vga = dcn20_disable_vga,
12778c77382SAnthony Koo 	.bios_golden_init = dcn10_bios_golden_init,
12878c77382SAnthony Koo 	.plane_atomic_disable = dcn20_plane_atomic_disable,
12978c77382SAnthony Koo 	.plane_atomic_power_down = dcn10_plane_atomic_power_down,
13078c77382SAnthony Koo 	.enable_power_gating_plane = dcn20_enable_power_gating_plane,
13178c77382SAnthony Koo 	.dpp_pg_control = dcn20_dpp_pg_control,
13278c77382SAnthony Koo 	.hubp_pg_control = dcn20_hubp_pg_control,
13378c77382SAnthony Koo 	.update_odm = dcn20_update_odm,
13478c77382SAnthony Koo 	.dsc_pg_control = dcn20_dsc_pg_control,
13578c77382SAnthony Koo 	.set_hdr_multiplier = dcn10_set_hdr_multiplier,
13678c77382SAnthony Koo 	.verify_allow_pstate_change_high = dcn10_verify_allow_pstate_change_high,
13778c77382SAnthony Koo 	.wait_for_blank_complete = dcn20_wait_for_blank_complete,
13878c77382SAnthony Koo 	.dccg_init = dcn20_dccg_init,
13978c77382SAnthony Koo 	.set_blend_lut = dcn20_set_blend_lut,
14078c77382SAnthony Koo 	.set_shaper_3dlut = dcn20_set_shaper_3dlut,
14178c77382SAnthony Koo };
14278c77382SAnthony Koo 
dcn20_hw_sequencer_construct(struct dc * dc)14378c77382SAnthony Koo void dcn20_hw_sequencer_construct(struct dc *dc)
14478c77382SAnthony Koo {
14578c77382SAnthony Koo 	dc->hwss = dcn20_funcs;
146f42ea55bSAnthony Koo 	dc->hwseq->funcs = dcn20_private_funcs;
14778c77382SAnthony Koo 
14878c77382SAnthony Koo }
149