Skip to content

Commit 0c79971

Browse files
committed
Merge tag 'mediatek-drm-next-5.13' of https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux into drm-next
Mediatek DRM Next for Linux 5.13 1. Fine tune the line time for EOTp. 2. Add support mt8192 dpi. 3. Make crtc config-updating atomic. 4. Don't support hdmi connector creation. From: Chun-Kuang Hu <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Dave Airlie <[email protected]>
2 parents 1539f71 + 2e47739 commit 0c79971

File tree

9 files changed

+130
-126
lines changed

9 files changed

+130
-126
lines changed

Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ properties:
2222
- mediatek,mt7623-dpi
2323
- mediatek,mt8173-dpi
2424
- mediatek,mt8183-dpi
25+
- mediatek,mt8192-dpi
2526

2627
reg:
2728
maxItems: 1
@@ -50,15 +51,10 @@ properties:
5051
- const: sleep
5152

5253
port:
53-
type: object
54+
$ref: /schemas/graph.yaml#/properties/port
5455
description:
55-
Output port node with endpoint definitions as described in
56-
Documentation/devicetree/bindings/graph.txt. This port should be connected
57-
to the input port of an attached HDMI or LVDS encoder chip.
58-
59-
properties:
60-
endpoint:
61-
type: object
56+
Output port node. This port should be connected to the input port of an
57+
attached HDMI or LVDS encoder chip.
6258

6359
required:
6460
- compatible

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5978,6 +5978,7 @@ DRM DRIVERS FOR MEDIATEK
59785978
M: Chun-Kuang Hu <[email protected]>
59795979
M: Philipp Zabel <[email protected]>
59805980
5981+
L: [email protected] (moderated for non-subscribers)
59815982
S: Supported
59825983
F: Documentation/devicetree/bindings/display/mediatek/
59835984
F: drivers/gpu/drm/mediatek/

drivers/gpu/drm/mediatek/mtk_cec.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/delay.h>
88
#include <linux/io.h>
99
#include <linux/interrupt.h>
10+
#include <linux/module.h>
1011
#include <linux/mod_devicetable.h>
1112
#include <linux/platform_device.h>
1213

@@ -208,10 +209,8 @@ static int mtk_cec_probe(struct platform_device *pdev)
208209
}
209210

210211
cec->irq = platform_get_irq(pdev, 0);
211-
if (cec->irq < 0) {
212-
dev_err(dev, "Failed to get cec irq: %d\n", cec->irq);
212+
if (cec->irq < 0)
213213
return cec->irq;
214-
}
215214

216215
ret = devm_request_threaded_irq(dev, cec->irq, NULL,
217216
mtk_cec_htplg_isr_thread,
@@ -247,6 +246,7 @@ static const struct of_device_id mtk_cec_of_ids[] = {
247246
{ .compatible = "mediatek,mt8173-cec", },
248247
{}
249248
};
249+
MODULE_DEVICE_TABLE(of, mtk_cec_of_ids);
250250

251251
struct platform_driver mtk_cec_driver = {
252252
.probe = mtk_cec_probe,

drivers/gpu/drm/mediatek/mtk_dpi.c

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ struct mtk_dpi_yc_limit {
120120
struct mtk_dpi_conf {
121121
unsigned int (*cal_factor)(int clock);
122122
u32 reg_h_fre_con;
123+
u32 max_clock_khz;
123124
bool edge_sel_en;
124125
};
125126

@@ -557,9 +558,23 @@ static void mtk_dpi_bridge_enable(struct drm_bridge *bridge)
557558
mtk_dpi_set_display_mode(dpi, &dpi->mode);
558559
}
559560

561+
static enum drm_mode_status
562+
mtk_dpi_bridge_mode_valid(struct drm_bridge *bridge,
563+
const struct drm_display_info *info,
564+
const struct drm_display_mode *mode)
565+
{
566+
struct mtk_dpi *dpi = bridge_to_dpi(bridge);
567+
568+
if (mode->clock > dpi->conf->max_clock_khz)
569+
return MODE_CLOCK_HIGH;
570+
571+
return MODE_OK;
572+
}
573+
560574
static const struct drm_bridge_funcs mtk_dpi_bridge_funcs = {
561575
.attach = mtk_dpi_bridge_attach,
562576
.mode_set = mtk_dpi_bridge_mode_set,
577+
.mode_valid = mtk_dpi_bridge_mode_valid,
563578
.disable = mtk_dpi_bridge_disable,
564579
.enable = mtk_dpi_bridge_enable,
565580
};
@@ -668,17 +683,26 @@ static unsigned int mt8183_calculate_factor(int clock)
668683
static const struct mtk_dpi_conf mt8173_conf = {
669684
.cal_factor = mt8173_calculate_factor,
670685
.reg_h_fre_con = 0xe0,
686+
.max_clock_khz = 300000,
671687
};
672688

673689
static const struct mtk_dpi_conf mt2701_conf = {
674690
.cal_factor = mt2701_calculate_factor,
675691
.reg_h_fre_con = 0xb0,
676692
.edge_sel_en = true,
693+
.max_clock_khz = 150000,
677694
};
678695

679696
static const struct mtk_dpi_conf mt8183_conf = {
680697
.cal_factor = mt8183_calculate_factor,
681698
.reg_h_fre_con = 0xe0,
699+
.max_clock_khz = 100000,
700+
};
701+
702+
static const struct mtk_dpi_conf mt8192_conf = {
703+
.cal_factor = mt8183_calculate_factor,
704+
.reg_h_fre_con = 0xe0,
705+
.max_clock_khz = 150000,
682706
};
683707

684708
static int mtk_dpi_probe(struct platform_device *pdev)
@@ -751,10 +775,8 @@ static int mtk_dpi_probe(struct platform_device *pdev)
751775
}
752776

753777
dpi->irq = platform_get_irq(pdev, 0);
754-
if (dpi->irq <= 0) {
755-
dev_err(dev, "Failed to get irq: %d\n", dpi->irq);
778+
if (dpi->irq <= 0)
756779
return -EINVAL;
757-
}
758780

759781
ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
760782
NULL, &dpi->next_bridge);
@@ -801,8 +823,12 @@ static const struct of_device_id mtk_dpi_of_ids[] = {
801823
{ .compatible = "mediatek,mt8183-dpi",
802824
.data = &mt8183_conf,
803825
},
826+
{ .compatible = "mediatek,mt8192-dpi",
827+
.data = &mt8192_conf,
828+
},
804829
{ },
805830
};
831+
MODULE_DEVICE_TABLE(of, mtk_dpi_of_ids);
806832

807833
struct platform_driver mtk_dpi_driver = {
808834
.probe = mtk_dpi_probe,

drivers/gpu/drm/mediatek/mtk_drm_crtc.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ struct mtk_drm_crtc {
6161

6262
/* lock for display hardware access */
6363
struct mutex hw_lock;
64+
bool config_updating;
6465
};
6566

6667
struct mtk_crtc_state {
@@ -97,7 +98,7 @@ static void mtk_drm_crtc_finish_page_flip(struct mtk_drm_crtc *mtk_crtc)
9798
static void mtk_drm_finish_page_flip(struct mtk_drm_crtc *mtk_crtc)
9899
{
99100
drm_crtc_handle_vblank(&mtk_crtc->base);
100-
if (mtk_crtc->pending_needs_vblank) {
101+
if (!mtk_crtc->config_updating && mtk_crtc->pending_needs_vblank) {
101102
mtk_drm_crtc_finish_page_flip(mtk_crtc);
102103
mtk_crtc->pending_needs_vblank = false;
103104
}
@@ -425,7 +426,8 @@ static void mtk_crtc_ddp_config(struct drm_crtc *crtc,
425426
}
426427
}
427428

428-
static void mtk_drm_crtc_hw_config(struct mtk_drm_crtc *mtk_crtc)
429+
static void mtk_drm_crtc_update_config(struct mtk_drm_crtc *mtk_crtc,
430+
bool needs_vblank)
429431
{
430432
#if IS_REACHABLE(CONFIG_MTK_CMDQ)
431433
struct cmdq_pkt *cmdq_handle;
@@ -436,6 +438,10 @@ static void mtk_drm_crtc_hw_config(struct mtk_drm_crtc *mtk_crtc)
436438
int i;
437439

438440
mutex_lock(&mtk_crtc->hw_lock);
441+
mtk_crtc->config_updating = true;
442+
if (needs_vblank)
443+
mtk_crtc->pending_needs_vblank = true;
444+
439445
for (i = 0; i < mtk_crtc->layer_nr; i++) {
440446
struct drm_plane *plane = &mtk_crtc->planes[i];
441447
struct mtk_plane_state *plane_state;
@@ -472,6 +478,7 @@ static void mtk_drm_crtc_hw_config(struct mtk_drm_crtc *mtk_crtc)
472478
cmdq_pkt_flush_async(cmdq_handle, ddp_cmdq_cb, cmdq_handle);
473479
}
474480
#endif
481+
mtk_crtc->config_updating = false;
475482
mutex_unlock(&mtk_crtc->hw_lock);
476483
}
477484

@@ -532,7 +539,7 @@ void mtk_drm_crtc_async_update(struct drm_crtc *crtc, struct drm_plane *plane,
532539
return;
533540

534541
plane_helper_funcs->atomic_update(plane, state);
535-
mtk_drm_crtc_hw_config(mtk_crtc);
542+
mtk_drm_crtc_update_config(mtk_crtc, false);
536543
}
537544

538545
static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
@@ -582,7 +589,7 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
582589
}
583590
mtk_crtc->pending_planes = true;
584591

585-
mtk_drm_crtc_hw_config(mtk_crtc);
592+
mtk_drm_crtc_update_config(mtk_crtc, false);
586593
/* Wait for planes to be disabled */
587594
drm_crtc_wait_one_vblank(crtc);
588595

@@ -618,14 +625,12 @@ static void mtk_drm_crtc_atomic_flush(struct drm_crtc *crtc,
618625
struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
619626
int i;
620627

621-
if (mtk_crtc->event)
622-
mtk_crtc->pending_needs_vblank = true;
623628
if (crtc->state->color_mgmt_changed)
624629
for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) {
625630
mtk_ddp_gamma_set(mtk_crtc->ddp_comp[i], crtc->state);
626631
mtk_ddp_ctm_set(mtk_crtc->ddp_comp[i], crtc->state);
627632
}
628-
mtk_drm_crtc_hw_config(mtk_crtc);
633+
mtk_drm_crtc_update_config(mtk_crtc, !!mtk_crtc->event);
629634
}
630635

631636
static const struct drm_crtc_funcs mtk_crtc_funcs = {

drivers/gpu/drm/mediatek/mtk_drm_drv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ static const struct of_device_id mtk_drm_of_ids[] = {
470470
.data = &mt8183_mmsys_driver_data},
471471
{ }
472472
};
473+
MODULE_DEVICE_TABLE(of, mtk_drm_of_ids);
473474

474475
static int mtk_drm_probe(struct platform_device *pdev)
475476
{

drivers/gpu/drm/mediatek/mtk_dsi.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,11 @@ static void mtk_dsi_rxtx_control(struct mtk_dsi *dsi)
401401
break;
402402
}
403403

404-
tmp_reg |= (dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) << 6;
405-
tmp_reg |= (dsi->mode_flags & MIPI_DSI_MODE_EOT_PACKET) >> 3;
404+
if (dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS)
405+
tmp_reg |= HSTX_CKLP_EN;
406+
407+
if (!(dsi->mode_flags & MIPI_DSI_MODE_EOT_PACKET))
408+
tmp_reg |= DIS_EOT;
406409

407410
writel(tmp_reg, dsi->regs + DSI_TXRX_CTRL);
408411
}
@@ -478,6 +481,7 @@ static void mtk_dsi_config_vdo_timing(struct mtk_dsi *dsi)
478481
timing->da_hs_zero + timing->da_hs_exit + 3;
479482

480483
delta = dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST ? 18 : 12;
484+
delta += dsi->mode_flags & MIPI_DSI_MODE_EOT_PACKET ? 2 : 0;
481485

482486
horizontal_frontporch_byte = vm->hfront_porch * dsi_tmp_buf_bpp;
483487
horizontal_front_back_byte = horizontal_frontporch_byte + horizontal_backporch_byte;
@@ -1141,6 +1145,7 @@ static const struct of_device_id mtk_dsi_of_match[] = {
11411145
.data = &mt8183_dsi_driver_data },
11421146
{ },
11431147
};
1148+
MODULE_DEVICE_TABLE(of, mtk_dsi_of_match);
11441149

11451150
struct platform_driver mtk_dsi_driver = {
11461151
.probe = mtk_dsi_probe,

0 commit comments

Comments
 (0)