hc
2024-03-22 a0752693d998599af469473b8dc239ef973a012f
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
// SPDX-License-Identifier: GPL-2.0+
/*
 * (C) Copyright 2022 Rockchip Electronics Co., Ltd
 */
 
#include <common.h>
#include <dm.h>
#include <errno.h>
#include <i2c.h>
#include <max96745.h>
#include <video_bridge.h>
 
#include "rockchip_bridge.h"
#include "rockchip_display.h"
#include "rockchip_panel.h"
 
static void max96745_bridge_enable(struct rockchip_bridge *bridge)
{
   struct udevice *dev = bridge->dev;
 
   dm_i2c_reg_clrset(dev->parent, 0x0100, VID_TX_EN,
             FIELD_PREP(VID_TX_EN, 1));
}
 
static void max96745_bridge_disable(struct rockchip_bridge *bridge)
{
   struct udevice *dev = bridge->dev;
 
   dm_i2c_reg_clrset(dev->parent, 0x0100, VID_TX_EN,
             FIELD_PREP(VID_TX_EN, 0));
}
 
static const struct rockchip_bridge_funcs max96745_bridge_funcs = {
   .enable = max96745_bridge_enable,
   .disable = max96745_bridge_disable,
};
 
static int max96745_bridge_probe(struct udevice *dev)
{
   struct rockchip_bridge *bridge;
 
   dm_i2c_reg_write(dev->parent, 0x7019, 0x00);
   dm_i2c_reg_write(dev->parent, 0x70a0, 0x04);
   dm_i2c_reg_write(dev->parent, 0x7074, 0x14);
   dm_i2c_reg_write(dev->parent, 0x7070, 0x04);
   dm_i2c_reg_write(dev->parent, 0x7000, 0x01);
 
   bridge = calloc(1, sizeof(*bridge));
   if (!bridge)
       return -ENOMEM;
 
   dev->driver_data = (ulong)bridge;
   bridge->dev = dev;
   bridge->funcs = &max96745_bridge_funcs;
 
   return 0;
}
 
static const struct udevice_id max96745_bridge_of_match[] = {
   { .compatible = "maxim,max96745-bridge", },
   { }
};
 
U_BOOT_DRIVER(max96745_bridge) = {
   .name = "max96745_bridge",
   .id = UCLASS_VIDEO_BRIDGE,
   .of_match = max96745_bridge_of_match,
   .probe = max96745_bridge_probe,
};