summaryrefslogtreecommitdiff
path: root/drivers/video/starfive/sf_vop.h
blob: fffcde1605e1ac477c137b4515892788f3f506a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
 */

#ifndef __RK_VOP_H__
#define __RK_VOP_H__
#include <clk.h>
#include <reset.h>

#define AQ_INTR_ACKNOWLEDGE				0x0010
#define AQ_INTR_ENBL					0x0014
#define DC_HW_REVISION					0x0024
#define DC_HW_CHIP_CID					0x0030

#define DC_REG_BASE						0x0800
#define DC_REG_RANGE					0x2000
#define DC_SEC_REG_OFFSET				0x100000

 //define power management i2c cmd(reg+data)
#define POWER_SW_0_REG                           (0x00+0x80)
#define POWER_SW_0_VDD18_HDMI                    0
#define POWER_SW_0_VDD18_MIPITX                  1
#define POWER_SW_0_VDD18_MIPIRX                  2
#define POWER_SW_0_VDD09_HDMI                    3
#define POWER_SW_0_VDD09_MIPITX                  4
#define POWER_SW_0_VDD09_MIPIRX                  5

enum vop_modes {
	VOP_MODE_EDP = 0,
	VOP_MODE_MIPI,
	VOP_MODE_HDMI,
	VOP_MODE_LVDS,
	VOP_MODE_DP,
};

struct sf_vop_priv {
	void __iomem * regs_hi;
	void __iomem * regs_low;
	struct udevice *conn_dev;
	struct display_timing timings;

	struct clk disp_axi;
	struct clk vout_src;
	struct clk top_vout_axi;
	struct clk top_vout_ahb;

	struct clk dc_pix0;
	struct clk dc_pix1;
	struct clk dc_axi;
	struct clk dc_core;
	struct clk dc_ahb;

	struct clk top_vout_lcd;
	struct clk hdmitx0_pixelclk;
	struct clk dc_pix_src;
	struct clk dc_pix0_out;
	struct clk dc_pix1_out;

	struct reset_ctl vout_resets;

//20221014
	struct reset_ctl dc8200_rst_axi;
	struct reset_ctl dc8200_rst_core;
	struct reset_ctl dc8200_rst_ahb;

	struct reset_ctl rst_vout_src;
	struct reset_ctl noc_disp;
	bool   mipi_logo;
	bool   hdmi_logo;
};

enum vop_features {
	VOP_FEATURE_OUTPUT_10BIT = (1 << 0),
};

struct rkvop_driverdata {
	/* configuration */
	u32 features;
	/* block-specific setters/getters */
	void (*set_pin_polarity)(struct udevice *, enum vop_modes, u32);
};

/**
 * rk_vop_probe() - common probe implementation
 *
 * Performs the rk_display_init on each port-subnode until finding a
 * working port (or returning an error if none of the ports could be
 * successfully initialised).
 *
 * @dev:	device
 * @return 0 if OK, -ve if something went wrong
 */
int rk_vop_probe(struct udevice *dev);

/**
 * rk_vop_bind() - common bind implementation
 *
 * Sets the plat->size field to the amount of memory to be reserved for
 * the framebuffer: this is always
 *     (32 BPP) x VIDEO_ROCKCHIP_MAX_XRES x VIDEO_ROCKCHIP_MAX_YRES
 *
 * @dev:	device
 * @return 0 (always OK)
 */
int rk_vop_bind(struct udevice *dev);

/**
 * rk_vop_probe_regulators() - probe (autoset + enable) regulators
 *
 * Probes a list of regulators by performing autoset and enable
 * operations on them.  The list of regulators is an array of string
 * pointers and any individual regulator-probe may fail without
 * counting as an error.
 *
 * @dev:	device
 * @names:	array of string-pointers to regulator names to probe
 * @cnt:	number of elements in the 'names' array
 */
void rk_vop_probe_regulators(struct udevice *dev,
			     const char * const *names, int cnt);

#endif