v5:
Remove ddr_edge_sel and use output_fmts to determine
which edge to be set.
v4:
Use output_fmts to determine whether it is dual edge.
Rebase to v5.13-rc1
v3:
Modify clock rate for dual edge setting.
Add more bridge function.
v2:
Modify unused code
v1:
DPI can sample on falling, rising or both edge.
When DPI sample the data both rising and falling edge.
It can reduce half data io pins.
Rex-BC Chen (3):
[v5] drm/mediatek: dpi dual edge sample mode support
[v5] drm/mediatek: config driver data to support dual edge sample
[v5] drm/mediatek: dpi: add bus format negotiation
drivers/gpu/drm/mediatek/mtk_dpi.c | 130 +++++++++++++++++++++++++++--
1 file changed, 124 insertions(+), 6 deletions(-)
--
2.18.0
DPI can sample on falling, rising or both edge.
When DPI sample the data both rising and falling edge.
It can reduce half data io pins.
Use num_output_fmts to determine whether it is dual edge mode.
Signed-off-by: Jitao Shi <[email protected]>
Signed-off-by: Rex-BC Chen <[email protected]>
---
drivers/gpu/drm/mediatek/mtk_dpi.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index bea91c81626e..f034ebd12fa6 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -83,6 +83,7 @@ struct mtk_dpi {
struct pinctrl *pinctrl;
struct pinctrl_state *pins_gpio;
struct pinctrl_state *pins_dpi;
+ unsigned int output_fmt;
int refcount;
};
@@ -381,6 +382,20 @@ static void mtk_dpi_config_color_format(struct mtk_dpi *dpi,
}
}
+static void mtk_dpi_dual_edge(struct mtk_dpi *dpi)
+{
+ if ((dpi->output_fmt == MEDIA_BUS_FMT_RGB888_2X12_LE) ||
+ (dpi->output_fmt == MEDIA_BUS_FMT_RGB888_2X12_BE)) {
+ mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE,
+ DDR_EN | DDR_4PHASE);
+ mtk_dpi_mask(dpi, DPI_OUTPUT_SETTING,
+ dpi->output_fmt == MEDIA_BUS_FMT_RGB888_2X12_LE ?
+ EDGE_SEL : 0, EDGE_SEL);
+ } else {
+ mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE, 0);
+ }
+}
+
static void mtk_dpi_power_off(struct mtk_dpi *dpi)
{
if (WARN_ON(dpi->refcount == 0))
@@ -455,7 +470,13 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
pll_rate = clk_get_rate(dpi->tvd_clk);
vm.pixelclock = pll_rate / factor;
- clk_set_rate(dpi->pixel_clk, vm.pixelclock);
+ if ((dpi->output_fmt == MEDIA_BUS_FMT_RGB888_2X12_LE) ||
+ (dpi->output_fmt == MEDIA_BUS_FMT_RGB888_2X12_BE))
+ clk_set_rate(dpi->pixel_clk, vm.pixelclock * 2);
+ else
+ clk_set_rate(dpi->pixel_clk, vm.pixelclock);
+
+
vm.pixelclock = clk_get_rate(dpi->pixel_clk);
dev_dbg(dpi->dev, "Got PLL %lu Hz, pixel clock %lu Hz\n",
@@ -519,6 +540,7 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
mtk_dpi_config_yc_map(dpi, dpi->yc_map);
mtk_dpi_config_color_format(dpi, dpi->color_format);
mtk_dpi_config_2n_h_fre(dpi);
+ mtk_dpi_dual_edge(dpi);
mtk_dpi_config_disable_edge(dpi);
mtk_dpi_sw_reset(dpi, false);
@@ -800,6 +822,8 @@ static int mtk_dpi_probe(struct platform_device *pdev)
return ret;
}
+ dpi->output_fmt = MEDIA_BUS_FMT_RGB888_1X24;
+
return 0;
}
--
2.18.0
Hi, Rex:
For this series, applied to mediatek-drm-next [1], thanks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next
Regards,
Chun-Kuang.
Rex-BC Chen <[email protected]> 於 2021年5月26日 週三 下午4:52寫道:
>
> v5:
> Remove ddr_edge_sel and use output_fmts to determine
> which edge to be set.
>
> v4:
> Use output_fmts to determine whether it is dual edge.
> Rebase to v5.13-rc1
>
> v3:
> Modify clock rate for dual edge setting.
> Add more bridge function.
>
> v2:
> Modify unused code
>
> v1:
> DPI can sample on falling, rising or both edge.
> When DPI sample the data both rising and falling edge.
> It can reduce half data io pins.
>
> Rex-BC Chen (3):
> [v5] drm/mediatek: dpi dual edge sample mode support
> [v5] drm/mediatek: config driver data to support dual edge sample
> [v5] drm/mediatek: dpi: add bus format negotiation
>
> drivers/gpu/drm/mediatek/mtk_dpi.c | 130 +++++++++++++++++++++++++++--
> 1 file changed, 124 insertions(+), 6 deletions(-)
>
> --
> 2.18.0
>