1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
4 * Copyright (c) 2015 Google, Inc
5 * Copyright 2014 Rockchip Inc.
14 #include <asm/arch-rockchip/hardware.h>
18 DECLARE_GLOBAL_DATA_PTR;
20 static void rk3399_set_pin_polarity(struct udevice *dev,
21 enum vop_modes mode, u32 polarity)
23 struct rk_vop_priv *priv = dev_get_priv(dev);
24 struct rk3288_vop *regs = priv->regs;
27 * The RK3399 VOPs (v3.5 and v3.6) require a per-mode setting of
28 * the polarity configuration (in ctrl1).
32 clrsetbits_le32(®s->dsp_ctrl1,
33 M_RK3399_DSP_HDMI_POL,
34 V_RK3399_DSP_HDMI_POL(polarity));
38 clrsetbits_le32(®s->dsp_ctrl1,
40 V_RK3399_DSP_EDP_POL(polarity));
44 clrsetbits_le32(®s->dsp_ctrl1,
45 M_RK3399_DSP_MIPI_POL,
46 V_RK3399_DSP_MIPI_POL(polarity));
50 debug("%s: unsupported output mode %x\n", __func__, mode);
55 * Try some common regulators. We should really get these from the
56 * device tree somehow.
58 static const char * const rk3399_regulator_names[] = {
62 static int rk3399_vop_probe(struct udevice *dev)
64 /* Before relocation we don't need to do anything */
65 if (!(gd->flags & GD_FLG_RELOC))
68 /* Probe regulators required for the RK3399 VOP */
69 rk_vop_probe_regulators(dev, rk3399_regulator_names,
70 ARRAY_SIZE(rk3399_regulator_names));
72 return rk_vop_probe(dev);
75 struct rkvop_driverdata rk3399_lit_driverdata = {
76 .set_pin_polarity = rk3399_set_pin_polarity,
79 struct rkvop_driverdata rk3399_big_driverdata = {
80 .features = VOP_FEATURE_OUTPUT_10BIT,
81 .set_pin_polarity = rk3399_set_pin_polarity,
84 static const struct udevice_id rk3399_vop_ids[] = {
85 { .compatible = "rockchip,rk3399-vop-big",
86 .data = (ulong)&rk3399_big_driverdata },
87 { .compatible = "rockchip,rk3399-vop-lit",
88 .data = (ulong)&rk3399_lit_driverdata },
92 static const struct video_ops rk3399_vop_ops = {
95 U_BOOT_DRIVER(rk3399_vop) = {
98 .of_match = rk3399_vop_ids,
99 .ops = &rk3399_vop_ops,
101 .probe = rk3399_vop_probe,
102 .priv_auto_alloc_size = sizeof(struct rk_vop_priv),