xref: /OK3568_Linux_fs/kernel/drivers/media/i2c/it66353/it66353.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (c) 2022 Rockchip Electronics Co. Ltd.
4  *
5  * it66353 HDMI 3 in 1 out driver.
6  *
7  * Author: Kenneth.Hung@ite.com.tw
8  * 	   Wangqiang Guo <kay.guo@rock-chips.com>
9  * Version: IT66353_SAMPLE_1.08
10  *
11  */
12 #ifndef _IT66353_H_
13 #define _IT66353_H_
14 
15 typedef struct {
16 	u8 EnRxDDCBypass;
17 	u8 EnableAutoEQ;
18 } IT6635_DEVICE_OPTION;
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 // ------------------------------
25 // APIs:
26 
27 char *it66353_get_lib_version(void);
28 
29 void it66353_setup_edid_ram_phyaddr(u8 *edid, u8 block);
30 void it66353_set_internal_EDID(u8 block, u8 *edid, u8 target_port);
31 void it66353_get_internal_EDID(u8 block, u8 *edid, u8 target_port);
32 void it66353_parse_edid_for_phyaddr(u8 *edid);
33 bool it66353_read_one_block_edid(u8 block, u8 *edid_buffer);
34 
35 #define SW_HPD_LOW 0
36 #define SW_HPD_AUTO 1
37 void it66353_force_rx_hpd(u8 hpd_state);
38 
39 void it66353_set_option(IT6635_DEVICE_OPTION *Opts);
40 void it66353_get_option(IT6635_DEVICE_OPTION *Opts);
41 
42 u8 it66353_get_RS(void);
43 void it66353_set_RS(u8 rs_idx0, u8 rs_idx1, u8 rs_idx2);
44 void it66353_set_ch_RS(u8 ch, u8 rs_index);
45 
46 void it66353_dump_register_all(void);
47 void it66353_dump_opts(void);
48 
49 u8 it66353_get_active_port(void);
50 bool it66353_set_active_port(u8 port);
51 
52 void it66353_change_default_RS(u8 port, u8 new_rs_idx0,
53 u8 new_rs_idx1, u8 new_rs_idx2, u8 update_hw);
54 
55 void it66353_set_rx_hpd(u8 hpd_value);
56 void it66353_set_tx_5v(u8 output_value);
57 bool it66353_toggle_hpd(u16 ms_duration);
58 
59 bool it66353_auto_eq_adjust(void);
60 
61 void it66353_dev_restart(void);
62 void it66353_vars_init(void);
63 void it66353_options_init(void);
64 
65 /*
66  * it6635 event handler:
67  */
68 // static void it66353_dev_loop(void);
69 
70 /*
71  * platform dependent functions: (needs implementation)
72  * u8 it66353_i2c_write(u8 addr, u8 offset, u8 length, u8 *buffer);
73  * u8 it66353_i2c_read(u8 addr, u8 offset, u8 length, u8 *buffer);
74  * static void it66353_i2c_read(u8 i2c_addr, u16 reg, u8 n, u8 *val);
75  */
76 void delay1ms(u16 ms);
77 __tick get_tick_count(void);
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif
84