162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2015, The Linux Foundation. All rights reserved.
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef __MSM_DSI_CFG_H__
762306a36Sopenharmony_ci#define __MSM_DSI_CFG_H__
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include "dsi.h"
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#define MSM_DSI_VER_MAJOR_V2	0x02
1262306a36Sopenharmony_ci#define MSM_DSI_VER_MAJOR_6G	0x03
1362306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V1_0	0x10000000
1462306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V1_0_2	0x10000002
1562306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V1_1	0x10010000
1662306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V1_1_1	0x10010001
1762306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V1_2	0x10020000
1862306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V1_3	0x10030000
1962306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V1_3_1	0x10030001
2062306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V1_4_1	0x10040001
2162306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V1_4_2	0x10040002
2262306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V2_1_0	0x20010000
2362306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V2_2_0	0x20000000
2462306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V2_2_1	0x20020001
2562306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V2_3_0	0x20030000
2662306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V2_4_0	0x20040000
2762306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V2_4_1	0x20040001
2862306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V2_5_0	0x20050000
2962306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V2_6_0	0x20060000
3062306a36Sopenharmony_ci#define MSM_DSI_6G_VER_MINOR_V2_7_0	0x20070000
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#define MSM_DSI_V2_VER_MINOR_8064	0x0
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define DSI_6G_REG_SHIFT	4
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci/* Maximum number of configurations matched against the same hw revision */
3762306a36Sopenharmony_ci#define VARIANTS_MAX			2
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_cistruct msm_dsi_config {
4062306a36Sopenharmony_ci	u32 io_offset;
4162306a36Sopenharmony_ci	const struct regulator_bulk_data *regulator_data;
4262306a36Sopenharmony_ci	int num_regulators;
4362306a36Sopenharmony_ci	const char * const *bus_clk_names;
4462306a36Sopenharmony_ci	const int num_bus_clks;
4562306a36Sopenharmony_ci	const resource_size_t io_start[VARIANTS_MAX][DSI_MAX];
4662306a36Sopenharmony_ci};
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_cistruct msm_dsi_host_cfg_ops {
4962306a36Sopenharmony_ci	int (*link_clk_set_rate)(struct msm_dsi_host *msm_host);
5062306a36Sopenharmony_ci	int (*link_clk_enable)(struct msm_dsi_host *msm_host);
5162306a36Sopenharmony_ci	void (*link_clk_disable)(struct msm_dsi_host *msm_host);
5262306a36Sopenharmony_ci	int (*clk_init_ver)(struct msm_dsi_host *msm_host);
5362306a36Sopenharmony_ci	int (*tx_buf_alloc)(struct msm_dsi_host *msm_host, int size);
5462306a36Sopenharmony_ci	void* (*tx_buf_get)(struct msm_dsi_host *msm_host);
5562306a36Sopenharmony_ci	void (*tx_buf_put)(struct msm_dsi_host *msm_host);
5662306a36Sopenharmony_ci	int (*dma_base_get)(struct msm_dsi_host *msm_host, uint64_t *iova);
5762306a36Sopenharmony_ci	int (*calc_clk_rate)(struct msm_dsi_host *msm_host, bool is_bonded_dsi);
5862306a36Sopenharmony_ci};
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_cistruct msm_dsi_cfg_handler {
6162306a36Sopenharmony_ci	u32 major;
6262306a36Sopenharmony_ci	u32 minor;
6362306a36Sopenharmony_ci	const struct msm_dsi_config *cfg;
6462306a36Sopenharmony_ci	const struct msm_dsi_host_cfg_ops *ops;
6562306a36Sopenharmony_ci};
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ciconst struct msm_dsi_cfg_handler *msm_dsi_cfg_get(u32 major, u32 minor);
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci#endif /* __MSM_DSI_CFG_H__ */
7062306a36Sopenharmony_ci
71