Skip to content

Commit 7418148

Browse files
committedApr 25, 2024
Merge branch 'linux-6.6-trunk/at91/drm' into linux-6.6-mchp
2 parents 7097d13 + afde659 commit 7418148

File tree

6 files changed

+725
-2
lines changed

6 files changed

+725
-2
lines changed
 

‎MAINTAINERS

+7
Original file line numberDiff line numberDiff line change
@@ -14138,6 +14138,13 @@ S: Supported
1413814138
F: Documentation/devicetree/bindings/display/bridge/microchip,sam9x7-lvds.yaml
1413914139
F: drivers/gpu/drm/bridge/microchip-lvds.c
1414014140

14141+
DRM DRIVER FOR MICROCHIP SAM9X7-COMPATIBLE MIPI DSI HOST CONTROLLER
14142+
M: Manikandan Muralidharan <manikandan.m@microchip.com>
14143+
S: Supported
14144+
T: git git://anongit.freedesktop.org/drm/drm-misc
14145+
F: Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-mipi-dsi.yaml
14146+
F: drivers/gpu/drm/bridge/dw-mipi-dsi-mchp.c
14147+
1414114148
MICROCHIP SPI DRIVER
1414214149
M: Ryan Wanner <ryan.wanner@microchip.com>
1414314150
S: Supported

‎drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,14 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
163163

164164
if (div_low >= 2 &&
165165
((prate / div_low >= mode_rate) &&
166-
(prate / div < mode_rate)))
166+
(prate / div < mode_rate))) {
167167
div = div_low;
168+
} else {
169+
if (is_xlcdc) {
170+
cfg |= ATMEL_XLCDC_CLKBYP;
171+
mask |= ATMEL_XLCDC_CLKBYP;
172+
}
173+
}
168174
}
169175
cfg |= ATMEL_HLCDC_CLKDIV(div);
170176
}

‎drivers/gpu/drm/bridge/Kconfig

+8
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ config DRM_MICROCHIP_LVDS_SERIALIZER
180180
help
181181
Support for Microchip's LVDS serializer.
182182

183+
config DRM_MICROCHIP_DW_MIPI_DSI
184+
tristate "Microchip specific extensions for Synopsys DW MIPI DSI"
185+
depends on DRM_ATMEL_HLCDC
186+
select DRM_DW_MIPI_DSI
187+
help
188+
This selects support for Microchip's SoC specific extensions
189+
for the Synopsys DesignWare dsi driver.
190+
183191
config DRM_NWL_MIPI_DSI
184192
tristate "Northwest Logic MIPI DSI Host controller"
185193
depends on DRM

‎drivers/gpu/drm/bridge/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
1212
obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
1313
obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) += megachips-stdpxxxx-ge-b850v3-fw.o
1414
obj-$(CONFIG_DRM_MICROCHIP_LVDS_SERIALIZER) += microchip-lvds.o
15+
obj-$(CONFIG_DRM_MICROCHIP_DW_MIPI_DSI) += dw-mipi-dsi-mchp.o
1516
obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
1617
obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
1718
obj-$(CONFIG_DRM_PARADE_PS8640) += parade-ps8640.o

‎drivers/gpu/drm/bridge/dw-mipi-dsi-mchp.c

+549
Large diffs are not rendered by default.

‎drivers/gpu/drm/panel/panel-himax-hx8394.c

+153-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#define HX8394_CMD_SETGIP1 0xd5
5353
#define HX8394_CMD_SETGIP2 0xd6
5454
#define HX8394_CMD_SETGPO 0xd6
55+
#define HX8394_CMD_SETGIP3 0xd8
5556
#define HX8394_CMD_SETSCALING 0xdd
5657
#define HX8394_CMD_SETIDLE 0xdf
5758
#define HX8394_CMD_SETGAMMA 0xe0
@@ -203,6 +204,156 @@ static const struct hx8394_panel_desc hsd060bhw4_desc = {
203204
.init_sequence = hsd060bhw4_init_sequence,
204205
};
205206

207+
static int mchp_ac40t08a_init_sequence(struct hx8394 *ctx)
208+
{
209+
struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
210+
211+
/* DCS commands do not seem to be sent correclty with out this delay */
212+
msleep(20);
213+
214+
/* 5.19.8 SETEXTC: Set extension command (B9h) */
215+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETEXTC,
216+
0xff, 0x83, 0x94);
217+
218+
/* 5.19.9 SETMIPI: Set MIPI control (BAh) */
219+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETMIPI,
220+
0x63, 0x03, 0x68, 0x6b, 0xb2, 0xc0);
221+
222+
/* 5.19.2 SETPOWER: Set power (B1h) */
223+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER,
224+
0x48, 0x12, 0x72, 0x09, 0x32, 0x54,
225+
0x71, 0x71, 0x57, 0x47);
226+
227+
/* 5.19.3 SETDISP: Set display related register (B2h) */
228+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETDISP,
229+
0x00, 0x80, 0x64, 0x0c, 0x0d, 0x2f);
230+
231+
/* 5.19.4 SETCYC: Set display waveform cycles (B4h) */
232+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETCYC,
233+
0x73, 0x74, 0x73, 0x74, 0x73, 0x74,
234+
0x01, 0x0C, 0x86, 0x75, 0x00, 0x3F,
235+
0x73, 0x74, 0x73, 0x74, 0x73, 0x74,
236+
0x01, 0x0C, 0x86);
237+
238+
/* 5.19.5 SETVCOM: Set VCOM voltage (B6h) */
239+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETVCOM,
240+
0x6e, 0x6e);
241+
242+
/* 5.19.19 SETGIP0: Set GIP Option0 (D3h) */
243+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP0,
244+
0x00, 0x00, 0x07, 0x07, 0x40, 0x07,
245+
0x0c, 0x00, 0x08, 0x10, 0x08, 0x00,
246+
0x08, 0x54, 0x15, 0x0a, 0x05, 0x0a,
247+
0x02, 0x15, 0x06, 0x05, 0x06, 0x47,
248+
0x44, 0x0a, 0x0a, 0x4b, 0x10, 0x07,
249+
0x07, 0x0c, 0x40);
250+
251+
/* 5.19.20 Set GIP Option1 (D5h) */
252+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP1,
253+
0x1C, 0x1C, 0x1D, 0x1D, 0x00, 0x01,
254+
0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
255+
0x08, 0x09, 0x0A, 0x0B, 0x24, 0x25,
256+
0x18, 0x18, 0x26, 0x27, 0x18, 0x18,
257+
0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
258+
0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
259+
0x18, 0x18, 0x20, 0x21, 0x18, 0x18,
260+
0x18, 0x18);
261+
262+
/* 5.19.21 Set GIP Option2 (D6h) */
263+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP2,
264+
0x1C, 0x1C, 0x1D, 0x1D, 0x07, 0x06,
265+
0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
266+
0x0B, 0x0A, 0x09, 0x08, 0x21, 0x20,
267+
0x18, 0x18, 0x27, 0x26, 0x18, 0x18,
268+
0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
269+
0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
270+
0x18, 0x18, 0x25, 0x24, 0x18, 0x18,
271+
0x18, 0x18);
272+
273+
/* 5.19.25 SETGAMMA: Set gamma curve related setting (E0h) */
274+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGAMMA,
275+
0x00, 0x0A, 0x15, 0x1B, 0x1E, 0x21,
276+
0x24, 0x22, 0x47, 0x56, 0x65, 0x66,
277+
0x6E, 0x82, 0x88, 0x8B, 0x9A, 0x9D,
278+
0x98, 0xA8, 0xB9, 0x5D, 0x5C, 0x61,
279+
0x66, 0x6A, 0x6F, 0x7F, 0x7F, 0x00,
280+
0x0A, 0x15, 0x1B, 0x1E, 0x21, 0x24,
281+
0x22, 0x47, 0x56, 0x65, 0x65, 0x6E,
282+
0x81, 0x87, 0x8B, 0x98, 0x9D, 0x99,
283+
0xA8, 0xBA, 0x5D, 0x5D, 0x62, 0x67,
284+
0x6B, 0x72, 0x7F, 0x7F);
285+
286+
/* Unknown command, not listed in the HX8394-F datasheet (C0H) */
287+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN1,
288+
0x1f, 0x73);
289+
290+
/* Set CABC control (C9h)*/
291+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETCABC,
292+
0x76, 0x00, 0x30);
293+
294+
/* 5.19.17 SETPANEL (CCh) */
295+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPANEL,
296+
0x0b);
297+
298+
/* Unknown command, not listed in the HX8394-F datasheet (D4h) */
299+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN3,
300+
0x02);
301+
302+
/* 5.19.11 Set register bank (BDh) */
303+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
304+
0x02);
305+
306+
/* 5.19.11 Set register bank (D8h) */
307+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP3,
308+
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
309+
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF);
310+
311+
/* 5.19.11 Set register bank (BDh) */
312+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
313+
0x00);
314+
315+
/* 5.19.11 Set register bank (BDh) */
316+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
317+
0x01);
318+
319+
/* 5.19.2 SETPOWER: Set power (B1h) */
320+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER,
321+
0x00);
322+
323+
/* 5.19.11 Set register bank (BDh) */
324+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK,
325+
0x00);
326+
327+
/* Unknown command, not listed in the HX8394-F datasheet (C6h) */
328+
mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN2,
329+
0xed);
330+
331+
return 0;
332+
}
333+
334+
static const struct drm_display_mode mchp_ac40t08a_mode = {
335+
.hdisplay = 720,
336+
.hsync_start = 720 + 12,
337+
.hsync_end = 720 + 12 + 24,
338+
.htotal = 720 + 12 + 12 + 24,
339+
.vdisplay = 1280,
340+
.vsync_start = 1280 + 13,
341+
.vsync_end = 1280 + 14,
342+
.vtotal = 1280 + 14 + 13,
343+
.clock = 60226,
344+
.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
345+
.width_mm = 76,
346+
.height_mm = 132,
347+
};
348+
349+
static const struct hx8394_panel_desc mchp_ac40t08a_desc = {
350+
.mode = &mchp_ac40t08a_mode,
351+
.lanes = 4,
352+
.mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST,
353+
.format = MIPI_DSI_FMT_RGB888,
354+
.init_sequence = mchp_ac40t08a_init_sequence,
355+
};
356+
206357
static int hx8394_enable(struct drm_panel *panel)
207358
{
208359
struct hx8394 *ctx = panel_to_hx8394(panel);
@@ -353,7 +504,7 @@ static int hx8394_probe(struct mipi_dsi_device *dsi)
353504
if (!ctx)
354505
return -ENOMEM;
355506

356-
ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
507+
ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
357508
if (IS_ERR(ctx->reset_gpio))
358509
return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
359510
"Failed to get reset gpio\n");
@@ -431,6 +582,7 @@ static void hx8394_remove(struct mipi_dsi_device *dsi)
431582

432583
static const struct of_device_id hx8394_of_match[] = {
433584
{ .compatible = "hannstar,hsd060bhw4", .data = &hsd060bhw4_desc },
585+
{ .compatible = "microchip,ac40t08a-mipi-panel", .data = &mchp_ac40t08a_desc },
434586
{ /* sentinel */ }
435587
};
436588
MODULE_DEVICE_TABLE(of, hx8394_of_match);

0 commit comments

Comments
 (0)
Please sign in to comment.