// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2020, Pixelworks, Inc.
 *
 * These files contain modifications made by Pixelworks, Inc., in 2019-2020.
 */
#include <drm/drm_mipi_dsi.h>
#include <video/mipi_display.h>
#include "dsi_iris5_api.h"
#include "dsi_iris5_lightup.h"

//#define IRIS_DSC
//#define IRIS_PARTIAL_UPDATE
char iris_panel_off_cmds0_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x05, 0x28, 0x00, 0x03,
};
char iris_panel_off_cmds1_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x05, 0x10, 0x00, 0x03,
};

char iris_mipi_rx_phy_cmds_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x08, 0x00, 0x04, 0xf0, 0x80, 0x02, 0x5c, 0x00, 0x08, 0x08, 0x04, 0xf0,
	0x00, 0x02, 0x02, 0x0e, 0x10, 0x09, 0x04, 0xf0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x04, 0xf0,
	0x60, 0x00, 0x00, 0x00, 0x04, 0x0a, 0x04, 0xf0, 0x4e, 0x00, 0x02, 0x00, 0x10, 0x0a, 0x04, 0xf0,
	0x4e, 0x00, 0x02, 0x00, 0x18, 0x0a, 0x04, 0xf0, 0x4e, 0x00, 0x02, 0x00, 0x20, 0x0a, 0x04, 0xf0,
	0x4e, 0x00, 0x02, 0x00, 0x28, 0x0a, 0x04, 0xf0, 0x4e, 0x00, 0x16, 0x00,
};

char iris_sys_cmds0_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0xf0, 0x0f, 0x82, 0x02, 0x00, 0x00, 0x00, 0x00, 0xf0,
	0xf9, 0x00, 0x00, 0x00,
};

char iris_sys_cmds1_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0x00, 0x00, 0x00,
};

char iris_sys_cmds2_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0xf0,
	0x2d, 0x58, 0xa1, 0x00, 0x64, 0x00, 0x00, 0xf0, 0x0b, 0x06, 0x00, 0x00, 0x18, 0x00, 0x00, 0xf0,
	0x17, 0x80, 0x0a, 0x00, 0x14, 0x00, 0x00, 0xf0, 0xf1, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0xf0,
	0xf8, 0x00, 0x00, 0x00,
};

char iris_sys_cmds3_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x14, 0x00, 0x00, 0xf0, 0xf0, 0x00, 0x00, 0x00,
};

char iris_sys_cmds4_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x14, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x02, 0x00,
};

char iris_sys_cmds5_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0xf0, 0x2d, 0x5c, 0xa1, 0x00, 0x1c, 0x00, 0x00, 0xf0,
	0x18, 0xf0, 0xe0, 0x01, 0x14, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x02, 0x00, 0x14, 0x00, 0x00, 0xf0,
	0x00, 0x00, 0x02, 0x00, 0x1c, 0x00, 0x00, 0xf0, 0x18, 0xf8, 0xe0, 0x01, 0x1c, 0x00, 0x00, 0xf0,
	0x18, 0xf0, 0xe0, 0x01,
};

char iris_sys_cmds6_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0xf0, 0x19, 0x78, 0xa2, 0x00, 0x64, 0x00, 0x00, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xfc, 0x00, 0x02, 0x00,
};

char iris_sys_misc_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x28, 0x00, 0x00, 0xf0, 0x08, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0xf0,
	0x3f, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0xf0, 0x80, 0x81, 0x00, 0x00, 0x4c, 0x00, 0x00, 0xf0,
	0x00, 0xd4, 0x00, 0x00,
};

char iris_sys_te_dly_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x48, 0x00, 0x00, 0xf0, 0x80, 0x81, 0x00, 0x00, 0x4c, 0x00, 0x00, 0xf0,
	0x00, 0xd4, 0x00, 0x00, 0x74, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0x5c,
};

char iris_mipi_rx_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x38, 0x02, 0x04, 0xf0, 0x00, 0x00, 0x77, 0x00, 0x00, 0x03, 0x04, 0xf0,
	0x00, 0x00, 0xdf, 0x01, 0x04, 0x03, 0x04, 0xf0, 0x00, 0x00, 0x55, 0x03, 0x04, 0x18, 0x04, 0xf0,
	0x80, 0x07, 0x00, 0x00, 0x04, 0x01, 0x04, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x44, 0x01, 0x04, 0xf0,
	0xf0, 0x00, 0x10, 0x00, 0x48, 0x01, 0x04, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x80, 0x00, 0x04, 0xf0,
	0x00, 0x00, 0x00, 0x00,
};

char iris_mipi_tx_phy_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x00, 0x02, 0xd0, 0xf0, 0x60, 0x00, 0x00, 0x00, 0x04, 0x00, 0xd0, 0xf0,
	0x04, 0x03, 0x41, 0x00, 0x1c, 0x00, 0xd0, 0xf0, 0x0c, 0x00, 0x00, 0x00,
};

char iris_mipi_tx_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x50, 0x00, 0xc0, 0xf0, 0x06, 0x00, 0x03, 0x3c, 0x54, 0x00, 0xc0, 0xf0,
	0x08, 0x24, 0x09, 0x24, 0x58, 0x00, 0xc0, 0xf0, 0x08, 0x20, 0x09, 0x24, 0x04, 0x00, 0xc0, 0xf0,
	0x01, 0x02, 0x00, 0x00, 0x18, 0x00, 0xc0, 0xf0, 0x02, 0x01, 0x4e, 0x03, 0x24, 0x00, 0xc0, 0xf0,
	0xff, 0x2f, 0x75, 0x00, 0x28, 0x00, 0xc0, 0xf0, 0x17, 0xff, 0xff, 0x00, 0x2c, 0x00, 0xc0, 0xf0,
	0x80, 0x07, 0x8c, 0x0a, 0x30, 0x00, 0xc0, 0xf0, 0xc4, 0x60, 0x01, 0x00, 0x44, 0x00, 0xc0, 0xf0,
	0x18, 0x00, 0x00, 0x00, 0x10, 0x00, 0xc0, 0xf0, 0x1c, 0x02, 0x10, 0x00, 0x14, 0x00, 0xc0, 0xf0,
	0x1c, 0x02, 0x00, 0x00, 0x08, 0x00, 0xc0, 0xf0, 0x11, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0xf0,
	0x38, 0x04, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xf0, 0x39, 0xc1, 0x01, 0x02,
};

char iris_mipi_tx_te_dly_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x18, 0x00, 0xc0, 0xf0, 0x02, 0x01, 0x4e, 0x03,
};

char iris_dtg_init_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x00, 0x00, 0x20, 0xf0, 0x13, 0x00, 0x00, 0x00, 0x04, 0x00, 0x20, 0xf0,
	0x46, 0x00, 0x00, 0x00, 0x08, 0x00, 0x20, 0xf0, 0x38, 0x04, 0x00, 0x00, 0x0c, 0x00, 0x20, 0xf0,
	0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x20, 0xf0, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x20, 0xf0,
	0x04, 0x00, 0x00, 0x00, 0x18, 0x00, 0x20, 0xf0, 0x80, 0x07, 0x00, 0x00, 0x1c, 0x00, 0x20, 0xf0,
	0x12, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0xf0, 0x2b, 0x00, 0x00, 0x00, 0x24, 0x00, 0x20, 0xf0,
	0x01, 0x0f, 0x00, 0x00, 0x28, 0x00, 0x20, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x20, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x20, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0xf0,
	0x01, 0x00, 0x00, 0x00,
};

char iris_dtg_te_dly_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x28, 0x00, 0x20, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x20, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0xf0, 0x01, 0x00, 0x00, 0x00,
};

char iris_dport_init_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x00, 0x00, 0x22, 0xf0, 0x07, 0x80, 0x00, 0xe0, 0x04, 0x00, 0x22, 0xf0,
	0x03, 0x08, 0x00, 0x21, 0x08, 0x00, 0x22, 0xf0, 0x38, 0x04, 0x80, 0x47, 0x0c, 0x00, 0x22, 0xf0,
	0x00, 0x08, 0x00, 0x06, 0x10, 0x00, 0x22, 0xf0, 0x02, 0x18, 0x08, 0x06, 0x14, 0x00, 0x22, 0xf0,
	0x00, 0x01, 0x04, 0x00, 0x28, 0x00, 0x22, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x22, 0xf0,
	0x01, 0x00, 0x00, 0x00,
};

char iris_scaler_init_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x00, 0x00, 0xa2, 0xf0, 0x60, 0x66, 0x00, 0x00, 0x04, 0x00, 0xa2, 0xf0,
	0x41, 0x04, 0x00, 0x00, 0x08, 0x00, 0xa2, 0xf0, 0xee, 0x8e, 0x03, 0x00, 0x0c, 0x00, 0xa2, 0xf0,
	0xee, 0x8e, 0x03, 0x00, 0x10, 0x00, 0xa2, 0xf0, 0x00, 0x64, 0x00, 0x00, 0x14, 0x00, 0xa2, 0xf0,
	0x80, 0x07, 0x80, 0x07, 0x18, 0x00, 0xa2, 0xf0, 0x03, 0x00, 0x06, 0x00, 0x1c, 0x00, 0xa2, 0xf0,
	0x03, 0x00, 0x06, 0x00, 0x20, 0x00, 0xa2, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0xa2, 0xf0,
	0x16, 0x00, 0x00, 0x00, 0x28, 0x00, 0xa2, 0xf0, 0x38, 0x04, 0x38, 0x04, 0x2c, 0x00, 0xa2, 0xf0,
	0x38, 0x8e, 0x03, 0x00, 0x30, 0x00, 0xa2, 0xf0, 0x38, 0x8e, 0x03, 0x00, 0x34, 0x00, 0xa2, 0xf0,
	0x03, 0x00, 0x06, 0x00, 0x38, 0x00, 0xa2, 0xf0, 0x03, 0x00, 0x06, 0x00, 0x3c, 0x00, 0xa2, 0xf0,
	0x0a, 0x64, 0x00, 0x00, 0x40, 0x00, 0xa2, 0xf0, 0x00, 0x00, 0x00, 0x00,
};

char iris_pwil_init_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x00, 0x00, 0x24, 0xf0, 0x94, 0x02, 0xa0, 0x00, 0x04, 0x00, 0x24, 0xf0,
	0x3e, 0x00, 0x40, 0x00, 0x08, 0x00, 0x24, 0xf0, 0x38, 0x04, 0x80, 0x07, 0x0c, 0x00, 0x24, 0xf0,
	0xf0, 0x00, 0xf0, 0x00, 0x10, 0x00, 0x24, 0xf0, 0xf0, 0x00, 0xf0, 0x00, 0x14, 0x00, 0x24, 0xf0,
	0xe0, 0x01, 0x56, 0x03, 0x18, 0x00, 0x24, 0xf0, 0x10, 0x00, 0x10, 0xe4, 0x1c, 0x00, 0x24, 0xf0,
	0xaa, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x24, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x24, 0xf0,
	0xe0, 0x01, 0x56, 0x03, 0x28, 0x00, 0x24, 0xf0, 0xe0, 0x01, 0x56, 0x03, 0x2c, 0x00, 0x24, 0xf0,
	0xe0, 0x01, 0x56, 0x03,
};

char iris_pwil_timeout_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x84, 0x00, 0x24, 0xf0, 0xff, 0xff, 0xff, 0xff,
};

char iris_pwil_ctrl_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x40, 0x01, 0x24, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x44, 0x01, 0x24, 0xf0,
	0x00, 0x00, 0x55, 0x03, 0x48, 0x01, 0x24, 0xf0, 0x00, 0x00, 0xdf, 0x01,
};

char iris_pwil_update_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x4c, 0x01, 0x24, 0xf0, 0x01, 0x00, 0x00, 0x00,
};

char iris_dsc_dec_init_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x00, 0x00, 0x68, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x68, 0xf0,
	0x00, 0x00, 0x00, 0x00,
};

char iris_dsc_dec_pps_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x0c, 0x00, 0x68, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x68, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x68, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x68, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x68, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x68, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x68, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x68, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x68, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x68, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x68, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x68, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x68, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x68, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x68, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x68, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x68, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x68, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x68, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x58, 0x00, 0x68, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x68, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x68, 0xf0,
	0x00, 0x00, 0x00, 0x00,
};
char iris_dsc_dec_update_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x00, 0xff, 0x69, 0xf0, 0x01, 0x00, 0x00, 0x00,
};

char iris_dsc_enc_init_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x00, 0x00, 0x60, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x60, 0xf0,
	0x02, 0x00, 0x00, 0x00,
};

char iris_dsc_enc_pps_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x64, 0x00, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x60, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x60, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x60, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x60, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x60, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x60, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x94, 0x00, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x60, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x60, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x60, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x60, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x60, 0xf0,
	0x00, 0x00, 0x00, 0x00,
};

char iris_dsc_enc_init_0_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x08, 0x00, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x60, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x60, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x60, 0xf0,
	0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x60, 0xf0,
	0x00, 0x00, 0x00, 0x00,
};

char iris_dsc_enc_update_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x14, 0x01, 0x60, 0xf0, 0x04, 0x00, 0x00, 0x00,
};

char iris_dpp_init_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x14, 0x00, 0x58, 0xf0, 0x1c, 0x00, 0x00, 0x00, 0xd0, 0x01, 0x58, 0xf0,
	0x02, 0x00, 0x00, 0x00,
};

char panel_cmds0_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x05, 0x29, 0x00, 0x03,
};
char panel_cmds1_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x05, 0x11, 0x00, 0x03,
};
char panel_cmds2_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x15, 0x35, 0x00, 0x03,
};
char panel_cmds3_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x15, 0x53, 0x20, 0x03,
};
char panel_cmds4_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x29, 0x03, 0x00, 0x07, 0x14, 0xc0, 0xc1, 0xf0,
	0xfc, 0x5a, 0x5a, 0x00,
};
char panel_cmds5_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x15, 0xb0, 0x1e, 0x03,
};
char panel_cmds6_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x15, 0xfd, 0x9e, 0x03,
};
char panel_cmds7_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x15, 0xb0, 0x10, 0x03,
};
char panel_cmds8_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x15, 0xb6, 0x54, 0x03,
};
char panel_cmds9_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x29, 0x03, 0x00, 0x07, 0x14, 0xc0, 0xc1, 0xf0,
	0xfc, 0xa5, 0xa5, 0x00,
};
char panel_cmds10_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x29, 0x02, 0x00, 0x07, 0x14, 0xc0, 0xc1, 0xf0,
	0x51, 0xff, 0x00, 0x00,
};
char panel_cmds11_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x15, 0x3a, 0x77, 0x03,
};
char panel_cmds12_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x15, 0x35, 0x00, 0x03,
};
char panel_cmds13_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x39, 0x05, 0x00, 0x07, 0x14, 0xc0, 0xc1, 0xf0,
	0x2a, 0x00, 0x00, 0x04, 0x14, 0xc0, 0xc1, 0xf0, 0x37, 0x00, 0x00, 0x00,
};

char panel_cmds14_payload[] = {
	0xf4, 0xff, 0xff, 0xff, 0x10, 0xc0, 0xc1, 0xf0, 0x39, 0x05, 0x00, 0x07, 0x14, 0xc0, 0xc1, 0xf0,
	0x2b, 0x00, 0x00, 0x07, 0x14, 0xc0, 0xc1, 0xf0, 0x7f, 0x00, 0x00, 0x00,
};

struct dsi_cmd_desc iris_lightup_cmds[] = {
	//mipi rx phy
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_mipi_rx_phy_cmds_payload)/sizeof(char), iris_mipi_rx_phy_cmds_payload, 0, NULL}, 1, 0x11},
	//sys
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_sys_cmds0_payload)/sizeof(char), iris_sys_cmds0_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_sys_cmds1_payload)/sizeof(char), iris_sys_cmds1_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_sys_cmds2_payload)/sizeof(char), iris_sys_cmds2_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_sys_cmds3_payload)/sizeof(char), iris_sys_cmds3_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_sys_cmds4_payload)/sizeof(char), iris_sys_cmds4_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_sys_cmds5_payload)/sizeof(char), iris_sys_cmds5_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_sys_cmds6_payload)/sizeof(char), iris_sys_cmds6_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_sys_misc_payload)/sizeof(char), iris_sys_misc_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_sys_te_dly_payload)/sizeof(char), iris_sys_te_dly_payload, 0, NULL}, 1, 0x11},
	//mipi rx
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_mipi_rx_payload)/sizeof(char), iris_mipi_rx_payload, 0, NULL}, 1, 0x11},
	//mipi tx
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_mipi_tx_phy_payload)/sizeof(char), iris_mipi_tx_phy_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_mipi_tx_payload)/sizeof(char), iris_mipi_tx_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_mipi_tx_te_dly_payload)/sizeof(char), iris_mipi_tx_te_dly_payload, 0, NULL}, 1, 0x11},
	//dtg
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_dtg_init_payload), iris_dtg_init_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_dtg_te_dly_payload), iris_dtg_te_dly_payload, 0, NULL}, 1, 0x11},
	//dport
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_dport_init_payload), iris_dport_init_payload, 0, NULL}, 1, 0x11},
	//scaler 1d
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_scaler_init_payload), iris_scaler_init_payload, 0, NULL}, 1, 0x11},
	//pwil
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_pwil_init_payload), iris_pwil_init_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_pwil_timeout_payload), iris_pwil_timeout_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_pwil_ctrl_payload), iris_pwil_ctrl_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_pwil_update_payload), iris_pwil_update_payload, 0, NULL}, 1, 0x11},
	//dsc_decoder
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_dsc_dec_init_payload), iris_dsc_dec_init_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_dsc_dec_pps_payload), iris_dsc_dec_pps_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_dsc_dec_update_payload), iris_dsc_dec_update_payload, 0, NULL}, 1, 0x11},
	//dsc encoder
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_dsc_enc_init_payload), iris_dsc_enc_init_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_dsc_enc_pps_payload), iris_dsc_enc_pps_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_dsc_enc_init_0_payload), iris_dsc_enc_init_0_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_dsc_enc_update_payload), iris_dsc_enc_update_payload, 0, NULL}, 1, 0x11},
	//dpp
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_dpp_init_payload), iris_dpp_init_payload, 0, NULL}, 1, 0x11},
	//panel command
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(panel_cmds0_payload), panel_cmds0_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(panel_cmds1_payload), panel_cmds1_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(panel_cmds2_payload), panel_cmds2_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(panel_cmds3_payload), panel_cmds3_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(panel_cmds4_payload), panel_cmds4_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(panel_cmds5_payload), panel_cmds5_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(panel_cmds6_payload), panel_cmds6_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(panel_cmds7_payload), panel_cmds7_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(panel_cmds8_payload), panel_cmds8_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(panel_cmds9_payload), panel_cmds9_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(panel_cmds10_payload), panel_cmds10_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(panel_cmds11_payload), panel_cmds11_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(panel_cmds12_payload), panel_cmds12_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(panel_cmds13_payload), panel_cmds13_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(panel_cmds14_payload), panel_cmds14_payload, 0, NULL}, 1, 0x11},
};

char link_state_array[] = {
	//mipi rx phy
	0,
	//sys
	0, 0, 0, 0, 0, 0, 0, 0, 0,
	//mipi rx
	0,
	//mipi tx
	0, 0, 0,
	//dtg
	0, 0,
	//dport
	0,
	//scaler1d
	0,
	//pwil
	0, 0, 0, 0,
	//dsc_decoder
	0, 0, 0,
	//dsc encoder
	0, 0, 0, 0,
	//dpp
	0,
	//panel command
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0,
};

struct dsi_cmd_desc iris_lightoff_cmds[] = {
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_panel_off_cmds0_payload)/sizeof(char), iris_panel_off_cmds0_payload, 0, NULL}, 1, 0x11},
	{{0, MIPI_DSI_GENERIC_LONG_WRITE, 0, 0, 0, sizeof(iris_panel_off_cmds1_payload)/sizeof(char), iris_panel_off_cmds1_payload, 0, NULL}, 1, 0x11},
};


char lightoff_link_state_array[] = {
	1, 1,
};



static struct dsi_panel_cmd_set iris_panel_cmds;
static struct dsi_panel_cmd_set iris_panel_off_cmds;

int iris_init_cmds(void)
{
	int ls_arr_cnt = 0;
	int cmds_arr_cnt = 0;

	ls_arr_cnt = ARRAY_SIZE(link_state_array);
	cmds_arr_cnt = ARRAY_SIZE(iris_lightup_cmds);
	if (ls_arr_cnt  != cmds_arr_cnt) {
		pr_err("the cmds_arr_cnt %0x != ls_arr_cnt %0x\n", cmds_arr_cnt, ls_arr_cnt);
		return -EINVAL;
	}

	iris_panel_cmds.cmds = iris_lightup_cmds;
	iris_panel_cmds.count = cmds_arr_cnt;

	ls_arr_cnt = ARRAY_SIZE(iris_lightoff_cmds);
	cmds_arr_cnt = ARRAY_SIZE(lightoff_link_state_array);
	if (ls_arr_cnt != cmds_arr_cnt) {
		pr_err("lightoff the cmds_arr_cnt %0x != ls_arr_cnt %0x\n", cmds_arr_cnt, ls_arr_cnt);
		return -EINVAL;
	}
	iris_panel_off_cmds.cmds = iris_lightoff_cmds;
	iris_panel_off_cmds.count = cmds_arr_cnt;

	return 0;
}

void iris_get_cmds(struct dsi_panel_cmd_set *cmds, char **ls_arr)
{
	cmds->cmds = iris_panel_cmds.cmds;
	cmds->count = iris_panel_cmds.count;
	*ls_arr = link_state_array;
}

void iris_get_lightoff_cmds(struct dsi_panel_cmd_set *cmds, char **ls_arr)
{
	cmds->cmds = iris_panel_off_cmds.cmds;
	cmds->count = iris_panel_off_cmds.count;
	*ls_arr = lightoff_link_state_array;
}
