Skip to content

Commit c941aec

Browse files
committed
raspberry-pi/4: Add tc358743 option
1 parent 684ae16 commit c941aec

File tree

2 files changed

+212
-0
lines changed

2 files changed

+212
-0
lines changed

raspberry-pi/4/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
imports = [
55
./dwc2.nix
66
./modesetting.nix
7+
./tc358743.nix
78
];
89

910
boot = {

raspberry-pi/4/tc358743.nix

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
{ config, lib, ... }:
2+
3+
let
4+
cfg = config.hardware.raspberry-pi."4".tc358743;
5+
in
6+
{
7+
options.hardware = {
8+
raspberry-pi."4".tc358743 = {
9+
enable = lib.mkEnableOption ''
10+
Enable support for the Toshiba TC358743 HDMI-to-CSI-2 converter.
11+
12+
This can be tested with a plugged in converter device and for example
13+
running ustreamer (which starts webservice providing a camera stream):
14+
''${pkgs.ustreamer}/bin/ustreamer --persistent --dv-timings
15+
'';
16+
};
17+
};
18+
19+
config = lib.mkIf cfg.enable {
20+
hardware.deviceTree.overlays = [
21+
{
22+
name = "tc358743-overlay";
23+
dtsText = ''
24+
/dts-v1/;
25+
26+
/ {
27+
compatible = "brcm,bcm2711";
28+
29+
fragment@0 {
30+
target = <0xffffffff>;
31+
32+
__overlay__ {
33+
#address-cells = <0x01>;
34+
#size-cells = <0x00>;
35+
status = "okay";
36+
37+
tc358743@0f {
38+
compatible = "toshiba,tc358743";
39+
reg = <0x0f>;
40+
status = "okay";
41+
clocks = <0x01>;
42+
clock-names = "refclk";
43+
44+
port {
45+
46+
endpoint {
47+
remote-endpoint = <0x02>;
48+
clock-lanes = <0x00>;
49+
clock-noncontinuous;
50+
link-frequencies = <0x00 0x1cf7c580>;
51+
phandle = <0x03>;
52+
};
53+
};
54+
};
55+
};
56+
};
57+
58+
fragment@1 {
59+
target = <0xffffffff>;
60+
61+
__overlay__ {
62+
status = "okay";
63+
64+
port {
65+
66+
endpoint {
67+
remote-endpoint = <0x03>;
68+
phandle = <0x02>;
69+
};
70+
};
71+
};
72+
};
73+
74+
fragment@2 {
75+
target = <0x03>;
76+
77+
__overlay__ {
78+
data-lanes = <0x01 0x02>;
79+
};
80+
};
81+
82+
fragment@3 {
83+
target = <0x03>;
84+
85+
__dormant__ {
86+
data-lanes = <0x01 0x02 0x03 0x04>;
87+
};
88+
};
89+
90+
fragment@4 {
91+
target = <0xffffffff>;
92+
93+
__overlay__ {
94+
status = "okay";
95+
};
96+
};
97+
98+
fragment@5 {
99+
target = <0xffffffff>;
100+
101+
__overlay__ {
102+
status = "okay";
103+
};
104+
};
105+
106+
fragment@6 {
107+
target-path = [2f 00];
108+
109+
__overlay__ {
110+
111+
bridge-clk {
112+
compatible = "fixed-clock";
113+
#clock-cells = <0x00>;
114+
clock-frequency = <0x19bfcc0>;
115+
phandle = <0x01>;
116+
};
117+
};
118+
};
119+
120+
fragment@7 {
121+
target = <0x02>;
122+
123+
__overlay__ {
124+
data-lanes = <0x01 0x02>;
125+
};
126+
};
127+
128+
fragment@8 {
129+
target = <0x02>;
130+
131+
__dormant__ {
132+
data-lanes = <0x01 0x02 0x03 0x04>;
133+
};
134+
};
135+
136+
__overrides__ {
137+
4lane = "\0\0\0\0-2+3-7+8";
138+
link-frequency = [00 00 00 03 6c 69 6e 6b 2d 66 72 65 71 75 65 6e 63 69 65 73 23 30 00];
139+
};
140+
141+
__symbols__ {
142+
tc358743 = "/fragment@0/__overlay__/tc358743@0f/port/endpoint";
143+
csi1_ep = "/fragment@1/__overlay__/port/endpoint";
144+
tc358743_clk = "/fragment@6/__overlay__/bridge-clk";
145+
};
146+
147+
__fixups__ {
148+
i2c_csi_dsi = "/fragment@0:target:0";
149+
csi1 = "/fragment@1:target:0";
150+
i2c0if = "/fragment@4:target:0";
151+
i2c0mux = "/fragment@5:target:0";
152+
};
153+
154+
__local_fixups__ {
155+
156+
fragment@0 {
157+
158+
__overlay__ {
159+
160+
tc358743@0f {
161+
clocks = <0x00>;
162+
163+
port {
164+
165+
endpoint {
166+
remote-endpoint = <0x00>;
167+
};
168+
};
169+
};
170+
};
171+
};
172+
173+
fragment@1 {
174+
175+
__overlay__ {
176+
177+
port {
178+
179+
endpoint {
180+
remote-endpoint = <0x00>;
181+
};
182+
};
183+
};
184+
};
185+
186+
fragment@2 {
187+
target = <0x00>;
188+
};
189+
190+
fragment@3 {
191+
target = <0x00>;
192+
};
193+
194+
fragment@7 {
195+
target = <0x00>;
196+
};
197+
198+
fragment@8 {
199+
target = <0x00>;
200+
};
201+
202+
__overrides__ {
203+
link-frequency = <0x00>;
204+
};
205+
};
206+
};
207+
'';
208+
}
209+
];
210+
};
211+
}

0 commit comments

Comments
 (0)