// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
/*
 * MediaTek Panel driver
 *
 * Copyright (c) 2020 MediaTek Inc.
 * Author Yu-Jen.Huang <yu-jen.huang@mediatek.com>
 */

#ifndef _MTK_PNL_OUT_IF_H_
#define _MTK_PNL_OUT_IF_H_


#define SUPPORT_OVERDRIVE                   1
#define SUPPORT_PCID_LINEOD                 1
#define SUPPORT_VAC_256                     1
#define ENABLE_PNL_GAMMA_AUTODOWNLOAD      (TRUE)//FIXME
#define ENABLE_OD_AUTODOWNLOAD             (TRUE)
#define ENABLE_PCID_AUTODOWNLOAD           (TRUE)
#define ENABLE_VAC_AUTODOWNLOAD            (TRUE)

typedef enum {
	E_BOOT_PNL_OUTPUT_LANE0,
	E_BOOT_PNL_OUTPUT_LANE1,
	E_BOOT_PNL_OUTPUT_LANE2,
	E_BOOT_PNL_OUTPUT_LANE3,
	E_BOOT_PNL_OUTPUT_LANE4,
	E_BOOT_PNL_OUTPUT_LANE5,
	E_BOOT_PNL_OUTPUT_LANE6,
	E_BOOT_PNL_OUTPUT_LANE7,
	E_BOOT_PNL_OUTPUT_LANE8,
	E_BOOT_PNL_OUTPUT_LANE9,
	E_BOOT_PNL_OUTPUT_LANE10,
	E_BOOT_PNL_OUTPUT_LANE11,
	E_BOOT_PNL_OUTPUT_LANE12,
	E_BOOT_PNL_OUTPUT_LANE13,
	E_BOOT_PNL_OUTPUT_LANE14,
	E_BOOT_PNL_OUTPUT_LANE15,
	E_BOOT_PNL_OUTPUT_LANE16,
	E_BOOT_PNL_OUTPUT_LANE17,
	E_BOOT_PNL_OUTPUT_LANE18,
	E_BOOT_PNL_OUTPUT_LANE19,
	E_BOOT_PNL_OUTPUT_LANE20,
	E_BOOT_PNL_OUTPUT_LANE21,
	E_BOOT_PNL_OUTPUT_LANE22,
	E_BOOT_PNL_OUTPUT_LANE23,
	E_BOOT_PNL_OUTPUT_LANE24,
	E_BOOT_PNL_OUTPUT_LANE25,
	E_BOOT_PNL_OUTPUT_LANE26,
	E_BOOT_PNL_OUTPUT_LANE27,
	E_BOOT_PNL_OUTPUT_LANE28,
	E_BOOT_PNL_OUTPUT_LANE29,
	E_BOOT_PNL_OUTPUT_LANE30,
	E_BOOT_PNL_OUTPUT_LANE31,
	E_BOOT_PNL_OUTPUT_LANE32,
	E_BOOT_PNL_OUTPUT_LANE33,
	E_BOOT_PNL_OUTPUT_LANE34,
	E_BOOT_PNL_OUTPUT_LANE35,
	E_BOOT_PNL_OUTPUT_LANE36,
	E_BOOT_PNL_OUTPUT_LANE37,
	E_BOOT_PNL_OUTPUT_LANE38,
	E_BOOT_PNL_OUTPUT_LANE39,
	E_BOOT_PNL_OUTPUT_LANE40,
	E_BOOT_PNL_OUTPUT_LANE41,
	E_BOOT_PNL_OUTPUT_LANE42,
	E_BOOT_PNL_OUTPUT_LANE43,
	E_BOOT_PNL_OUTPUT_LANE44,
	E_BOOT_PNL_OUTPUT_LANE45,
	E_BOOT_PNL_OUTPUT_LANE46,
	E_BOOT_PNL_OUTPUT_LANE47,
	E_BOOT_PNL_OUTPUT_LANE48,
	E_BOOT_PNL_OUTPUT_LANE49,
	E_BOOT_PNL_OUTPUT_LANE50,
	E_BOOT_PNL_OUTPUT_LANE51,
	E_BOOT_PNL_OUTPUT_LANE52,
	E_BOOT_PNL_OUTPUT_LANE53,
	E_BOOT_PNL_OUTPUT_LANE54,
	E_BOOT_PNL_OUTPUT_LANE55,
	E_BOOT_PNL_OUTPUT_LANE56,
	E_BOOT_PNL_OUTPUT_LANE57,
	E_BOOT_PNL_OUTPUT_LANE58,
	E_BOOT_PNL_OUTPUT_LANE59,
	E_BOOT_PNL_OUTPUT_LANE60,
	E_BOOT_PNL_OUTPUT_LANE61,
	E_BOOT_PNL_OUTPUT_LANE62,
	E_BOOT_PNL_OUTPUT_LANE63,
	E_BOOT_PNL_OUTPUT_LANE_MAX,
} en_boot_pnl_output_lane_config;

typedef enum {
    E_BOOT_TEST_PATTERN_NONE,
    E_BOOT_TEST_PATTERN_TCON,
    E_BOOT_TEST_PATTERN_PAFRC_POST,
    E_BOOT_TEST_PATTERN_MOD_H_HALF,
    E_BOOT_TEST_PATTERN_MOD_H_HALF_INV,
    E_BOOT_TEST_PATTERN_MOD_V_HALF,
    E_BOOT_TEST_PATTERN_MOD_V_HALF_INV,
    E_BOOT_TEST_PATTERN_MOD_FULL,
    E_BOOT_TEST_PATTERN_MAX,
}en_boot_test_pattern_config;

int mtk_tgen_init(struct udevice *dev);
int mtk_delta_tgen_setting(struct udevice *dev);
int mtk_out_if_init(struct udevice *dev); //vby1 setting.
int mtk_ext_video_out_if_init(struct udevice *dev); //vby1 setting for ext_video
int mtk_gfx_out_if_init(struct udevice *dev); //vby1 setting for gfx path
void mtk_out_if_hbkproch_protect_init(struct udevice *dev);
void mtk_ext_video_out_if_delta_hbkproch_protect_init(struct udevice *dev);
void mtk_gfx_out_if_hbkproch_protect_init(struct udevice *dev);
void mtk_pnl_out_en(struct udevice *dev, bool en);
void mtk_extv_out_en(struct udevice *dev, bool en);
void mtk_gfx_out_en(struct udevice *dev, bool en);
void mtk_pnl_mute_en(struct udevice *dev, bool en);
void mtk_extv_mute_en(struct udevice *dev, bool en);
void mtk_gfx_mute_en(struct udevice *dev, bool en);
void mtk_pnl_set_vby1_mft_hmirror(struct udevice *dev);
bool mtk_dump_tcon_efuse(uint32_t hwVersion);
void vby1_set_pn_swap(uint32_t pnl_lib_version);
void mtk_pre_emphasis_setting(struct udevice *dev);
void mtk_swing_level_setting(struct udevice *dev);
void mtk_SSC_control(struct udevice *dev);
void mtk_dump_mod_efuse(struct udevice *dev);
void mtk_pnl_controlbit_init(struct udevice *dev);
void mtk_extv_controlbit_init(struct udevice *dev);
void mtk_gfx_controlbit_init(struct udevice *dev);
void mtk_dither_setting(struct udevice *dev);
void mtk_pnl_set_panel_SCDISP_Path_Sel(struct udevice *dev);
void efuse_set_lpllsetting(uint32_t hwVersion);
void Init_TCON_Panel(struct udevice *dev);
void Init_TCON_Path(struct udevice *dev, bool dlg_mode);
bool mtk_pnl_autodownload_init(struct udevice *dev);
void mtk_panelgamma_setting(struct udevice *dev, bool dlg_mode);
void mtk_overdrive_setting(struct udevice *dev);
bool mtk_pnl_get_property(struct udevice *dev, int enType, int *pVal);
void mtk_testpattern_settings(struct udevice *dev);
bool mtk_pnl_set_property(struct udevice *dev, int enType, uint8_t *pVal);
#endif
