• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18 #ifndef __DRV_HDMI_INTF_H__
19 #define __DRV_HDMI_INTF_H__
20 
21 #include "hi_type.h"
22 #include "hdmi_hal.h"
23 #include "drv_hdmi_common.h"
24 #include "drv_hdmi_ioctl.h"
25 #include "drv_hdmi_edid.h"
26 #include "drv_hdmi_event.h"
27 #ifdef HDMI_FRL_SUPPORT
28 #include "drv_hdmi_frl.h"
29 #endif
30 
31 typedef struct {
32     hdmi_thread_state thread_timer_sate;
33     osal_task_t      *thread_timer;
34     hi_bool           thread_run;
35     hi_bool           thread_exit;
36     osal_wait_t       wait_destroy;
37 } hdmi_thread_info;
38 
39 typedef struct {
40     hi_bool         attr_busy;
41     hi_bool         attr_set;
42     osal_spinlock_t attr_spin;
43 } hdmi_hdr_mutex;
44 
45 typedef struct {
46     hi_u32                 hdmi_dev_id;
47     hi_u32                 kernel_cnt;
48     hi_u32                 user_cnt;
49     hi_u32                 user_callback_cnt;
50     hi_bool                emi_enable;
51     hi_bool                hpd_detected;
52     hi_bool                hpd_notified;
53     hdmi_run_state         run_state;
54     hdmi_transition_state  transition_state;
55     hdmi_tmds_mode         tmds_mode;
56     hdmi_callback          k_callback;
57     hdmi_thread_info       thread_info;
58     hdmi_edid_info         edid_info;
59     hdmi_infoframe_type    info_frame;
60     hdmi_attr              attr;
61     hdmi_delay             delay;
62     hdmi_hal              *hal;
63     hdmi_debug             debug;
64     osal_semaphore_t       mutex_thread;
65     osal_semaphore_t       mutex_proc;
66 #ifdef HDMI_HDR_SUPPORT
67     drv_hdmi_hdr_info      hdr_info;
68     hdmi_hdr_mutex         hdr_mutex;
69 #endif
70 #ifdef HDMI_FRL_SUPPORT
71     hdmi_frl_info          frl_info;
72 #endif
73     hdmi_mode_param        mode_param;
74     hdmi_csc_attr          csc_param;
75     hdmi_user_vsif_content vendor_data;
76 } hdmi_device;
77 
78 hi_s32 drv_hdmi_init(hi_void);
79 
80 hi_s32 drv_hdmi_deinit(hi_void);
81 
82 hi_s32 drv_hdmi_open(hdmi_device *hdmi_dev, hi_bool user);
83 
84 hi_s32 drv_hdmi_close(hdmi_device *hdmi_dev, hi_bool user);
85 
86 hi_s32 drv_hdmi_start(hdmi_device *hdmi_dev);
87 
88 hi_s32 drv_hdmi_stop(hdmi_device *hdmi_dev);
89 
90 hi_s32 drv_hdmi_deep_color_set(hdmi_device *hdmi_dev, hdmi_deep_color deep_color);
91 
92 hi_s32 drv_hdmi_deep_color_get(hdmi_device *hdmi_dev, hdmi_deep_color *deep_color);
93 
94 hi_s32 drv_hdmi_xvycc_mode_set(hdmi_device *hdmi_dev, hi_bool enable);
95 
96 hi_void drv_hdmi_avmute_set(const hdmi_device *hdmi_dev, hi_bool av_mute);
97 
98 hi_s32 drv_hdmi_vo_attr_set(hdmi_device *hdmi_dev, const hdmi_vo_attr *vo_attr);
99 
100 hi_s32 drv_hdmi_play_status_get(const hdmi_device *hdmi_dev, hi_u32 *status);
101 
102 hi_s32 drv_hdmi_ao_attr_set(hdmi_device *hdmi_dev, const hdmi_ao_attr *ao_attr);
103 
104 hi_s32 drv_hdmi_ao_attr_get(const hdmi_device *hdmi_dev, hdmi_ao_attr *ao_attr);
105 
106 hi_void drv_hdmi_audio_path_enable(const hdmi_device *hdmi_dev, hi_bool enable);
107 
108 hi_s32 drv_hdmi_audio_output_enable_set(const hdmi_device *hdmi_dev, hi_bool mute);
109 
110 hi_s32 drv_hdmi_attr_get(const hdmi_device *hdmi_dev, hdmi_attr *attr);
111 
112 hi_s32 drv_hdmi_attr_set(hdmi_device *hdmi_dev, hdmi_attr *attr);
113 
114 hi_s32 drv_hdmi_infoframe_get(const hdmi_device *hdmi_dev, hdmi_infoframe_id infoframe_id, hdmi_infoframe *info_frame);
115 
116 hi_s32 drv_hdmi_infoframe_set(hdmi_device *hdmi_dev, hdmi_infoframe_id infoframe_id, hdmi_infoframe *info_frame);
117 
118 hi_s32 drv_hdmi_cmd_process(unsigned int cmd, hi_void *arg, hi_bool user);
119 
120 hdmi_video_timing disp_fmt_to_hdmi_timing(hdmi_device *hdmi_dev, hi_u32 disp_fmt);
121 
122 hdmi_device *get_hdmi_device(hdmi_device_id hdmi_id);
123 
124 hi_s32 get_hdmi_default_action_set(hdmi_device *hdmi_dev, hdmi_default_action action);
125 
126 hi_s32 get_hdmi_thread_state_set(hdmi_device *hdmi_dev, hdmi_thread_state state);
127 
128 hi_s32 get_hdmi_delay_get(const hdmi_device *hdmi_dev, hdmi_delay *delay);
129 
130 hi_s32 get_hdmi_delay_set(hdmi_device *hdmi_dev, hdmi_delay *delay);
131 
132 hi_s32 hdmi_mode_strategy(hdmi_device *hdmi_dev);
133 
134 hi_s32 get_global_hdmi_irq_timer(hi_void);
135 
136 #endif /* __DRV_HDMI_INTF_H__ */
137 
138