[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7a581fd59a68a292a0acc0c17173cc3ae62612f0.camel@mediatek.com>
Date: Tue, 21 Jun 2022 16:46:53 +0800
From: Rex-BC Chen <rex-bc.chen@...iatek.com>
To: CK Hu <ck.hu@...iatek.com>, <chunkuang.hu@...nel.org>,
<p.zabel@...gutronix.de>, <daniel@...ll.ch>, <robh+dt@...nel.org>,
<krzysztof.kozlowski+dt@...aro.org>, <matthias.bgg@...il.com>,
<airlied@...ux.ie>
CC: <msp@...libre.com>, <granquet@...libre.com>,
<jitao.shi@...iatek.com>, <wenst@...omium.org>,
<angelogioacchino.delregno@...labora.com>,
<dri-devel@...ts.freedesktop.org>,
<linux-mediatek@...ts.infradead.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<Project_Global_Chrome_Upstream_Group@...iatek.com>
Subject: Re: [PATCH v12 10/14] drm/mediatek: dpi: Add dpintf support
On Tue, 2022-06-21 at 10:32 +0800, CK Hu wrote:
> Hi, Bo-Chen:
>
> On Mon, 2022-06-20 at 20:10 +0800, Bo-Chen Chen wrote:
> > From: Guillaume Ranquet <granquet@...libre.com>
> >
> > dpintf is the displayport interface hardware unit. This unit is
> > similar
> > to dpi and can reuse most of the code.
> >
> > This patch adds support for mt8195-dpintf to this dpi driver. Main
> > differences are:
> > - 4 pixels for one round for dp_intf while dpi is 1 pixel for one
> > round.
> > Therefore, pixel clock and timing parameter should be divided by
> > 4
> > for
> > dp_intf.
> > - Some features/functional components are not available for dpintf
> > which are now excluded from code execution once is_dpintf is
> > set.
> > The main difference is some parts of hardware design between
> > dp_intf
> > and dpi.
> > - Some register contents differ slightly between the two
> > components.
> > To
> > work around this I added register bits/masks with a DPINTF_
> > prefix
> > and use them where different.
> >
> > Based on a separate driver for dpintf created by
> > Jitao shi <jitao.shi@...iatek.com>.
> >
> > Signed-off-by: Markus Schneider-Pargmann <msp@...libre.com>
> > Signed-off-by: Guillaume Ranquet <granquet@...libre.com>
> > [Bo-Chen: Modify reviewers' comments.]
> > Signed-off-by: Bo-Chen Chen <rex-bc.chen@...iatek.com>
> > ---
> > drivers/gpu/drm/mediatek/mtk_dpi.c | 65
> > +++++++++++++++++++--
> > drivers/gpu/drm/mediatek/mtk_dpi_regs.h | 13 +++++
> > drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 4 ++
> > drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 1 +
> > drivers/gpu/drm/mediatek/mtk_drm_drv.c | 3 +
> > 5 files changed, 82 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > index e186870ba3bc..2717b1741b7a 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > @@ -126,6 +126,7 @@ struct mtk_dpi_conf {
> > const u32 *output_fmts;
> > u32 num_output_fmts;
> > bool is_ck_de_pol;
> > + bool is_dpintf;
> > bool swap_input_support;
> > /* Mask used for HWIDTH, HPORCH, VSYNC_WIDTH and VSYNC_PORCH
> > (no shift) */
> > u32 dimension_mask;
> > @@ -513,6 +514,14 @@ static int mtk_dpi_set_display_mode(struct
> > mtk_dpi *dpi,
> > pll_rate = clk_get_rate(dpi->tvd_clk);
> >
> > vm.pixelclock = pll_rate / factor;
> > +
> > + /*
> > + * For dp_intf, we need to divide clock by 4 because it's
> > + * 4 pixels for one round while dpi is 1 pixel for one round.
> > + */
> > + if (dpi->conf->is_dpintf)
> > + vm.pixelclock /= 4;
>
> I this this should define dpi->conf->round_pixels rather than dpi-
> > conf->is_dpintf.
ok, I will use this config and drop is_dpintf.
> > +
> > 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);
> > @@ -534,6 +543,17 @@ static int mtk_dpi_set_display_mode(struct
> > mtk_dpi *dpi,
> > hsync.sync_width = vm.hsync_len;
> > hsync.back_porch = vm.hback_porch;
> > hsync.front_porch = vm.hfront_porch;
> > +
> > + /*
> > + * For dp_intf, we need to divide everything by 4 because it's
> > + * 4 pixels for one round while dpi is 1 pixel for one round.
> > + */
> > + if (dpi->conf->is_dpintf) {
> > + hsync.sync_width = vm.hsync_len / 4;
> > + hsync.back_porch = vm.hback_porch / 4;
> > + hsync.front_porch = vm.hfront_porch / 4;
> > + }
>
> Ditto.
>
> > +
> > hsync.shift_half_line = false;
> > vsync_lodd.sync_width = vm.vsync_len;
> > vsync_lodd.back_porch = vm.vback_porch;
> > @@ -575,11 +595,16 @@ static int mtk_dpi_set_display_mode(struct
> > mtk_dpi *dpi,
> > mtk_dpi_config_channel_limit(dpi);
> > mtk_dpi_config_bit_num(dpi, dpi->bit_num);
> > mtk_dpi_config_channel_swap(dpi, dpi->channel_swap);
> > - 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);
> > + if (dpi->conf->is_dpintf) {
>
> Separate this to an independent patch and give a better config name
> rather than dpi->conf->is_dpintf.
>
this is separate config.
I will modify like this:
add new config "input_2pixel" for input two pixels in this patch:
mtk_dpi_mask(dpi, DPI_CON, DPINTF_INPUT_2P_EN,
DPINTF_INPUT_2P_EN);
and create another patch to add config "support_direct_pin"
this config is only used for dpi which could be directly connect to
pins while dp_intf is not.
+ if (dpi->conf->support_direct_pin) {
+ mtk_dpi_config_yc_map(dpi, dpi->yc_map);
+ mtk_dpi_config_2n_h_fre(dpi);
+ mtk_dpi_dual_edge(dpi);
+ mtk_dpi_config_disable_edge(dpi);
+ }
BRs,
Bo-Chen
> > + mtk_dpi_mask(dpi, DPI_CON, DPINTF_INPUT_2P_EN,
> > + DPINTF_INPUT_2P_EN);
> > + } else {
> > + mtk_dpi_config_yc_map(dpi, dpi->yc_map);
> > + mtk_dpi_config_2n_h_fre(dpi);
> > + mtk_dpi_dual_edge(dpi);
> > + mtk_dpi_config_disable_edge(dpi);
> > + }
> > mtk_dpi_sw_reset(dpi, false);
> >
> > return 0;
> > @@ -817,6 +842,16 @@ static unsigned int
> > mt8183_calculate_factor(int
> > clock)
> > return 2;
> > }
> >
>
> [snip]
>
> >
> > #define EDGE_SEL_EN BIT(5)
> > #define H_FRE_2N BIT(25)
> > +
>
> This seems not related to dpintf support.
>
> Regards,
> CK
>
> > #endif /* __MTK_DPI_REGS_H */
> >
>
>
Powered by blists - more mailing lists