mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: CK Hu <ck.hu@mediatek.com>
To: Bo-Chen Chen <rex-bc.chen@mediatek.com>,
	<chunkuang.hu@kernel.org>, <p.zabel@pengutronix.de>,
	<daniel@ffwll.ch>, <robh+dt@kernel.org>,
	<krzysztof.kozlowski+dt@linaro.org>, <matthias.bgg@gmail.com>,
	<airlied@linux.ie>
Cc: <msp@baylibre.com>, <granquet@baylibre.com>,
	<jitao.shi@mediatek.com>, <wenst@chromium.org>,
	<angelogioacchino.delregno@collabora.com>,
	<dri-devel@lists.freedesktop.org>,
	<linux-mediatek@lists.infradead.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<Project_Global_Chrome_Upstream_Group@mediatek.com>
Subject: Re: [PATCH v12 10/14] drm/mediatek: dpi: Add dpintf support
Date: Tue, 21 Jun 2022 10:32:30 +0800	[thread overview]
Message-ID: <0862532b568f7e13b89b6537928efd518a2971a3.camel@mediatek.com> (raw)
In-Reply-To: <20220620121028.29234-11-rex-bc.chen@mediatek.com>

Hi, Bo-Chen:

On Mon, 2022-06-20 at 20:10 +0800, Bo-Chen Chen wrote:
> From: Guillaume Ranquet <granquet@baylibre.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@mediatek.com>.
> 
> Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
> Signed-off-by: Guillaume Ranquet <granquet@baylibre.com>
> [Bo-Chen: Modify reviewers' comments.]
> Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.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.

> +
>  	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.

> +		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 */
> 


  reply	other threads:[~2022-06-21  2:32 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 12:10 [PATCH v12 00/14] drm/mediatek: Add MT8195 dp_intf driver Bo-Chen Chen
2022-06-20 12:10 ` [PATCH v12 01/14] dt-bindings: mediatek,dpi: Add DP_INTF compatible Bo-Chen Chen
2022-06-20 12:25   ` Maxime Ripard
2022-06-20 12:33     ` Rex-BC Chen
2022-06-20 12:10 ` [PATCH v12 02/14] drm/mediatek: dpi: Add support for quantization range Bo-Chen Chen
2022-06-21  1:40   ` CK Hu
2022-06-20 12:10 ` [PATCH v12 03/14] drm/mediatek: dpi: implement a CK/DE pol toggle in SoC config Bo-Chen Chen
2022-06-20 12:10 ` [PATCH v12 04/14] drm/mediatek: dpi: implement a swap_input " Bo-Chen Chen
2022-06-21  1:44   ` CK Hu
2022-06-20 12:10 ` [PATCH v12 05/14] drm/mediatek: dpi: move dimension mask to " Bo-Chen Chen
2022-06-20 12:10 ` [PATCH v12 06/14] drm/mediatek: dpi: move hvsize_mask " Bo-Chen Chen
2022-06-20 12:10 ` [PATCH v12 07/14] drm/mediatek: dpi: move swap_shift " Bo-Chen Chen
2022-06-20 12:10 ` [PATCH v12 08/14] drm/mediatek: dpi: move the yuv422_en_bit " Bo-Chen Chen
2022-06-20 12:10 ` [PATCH v12 09/14] drm/mediatek: dpi: move the csc_enable bit " Bo-Chen Chen
2022-06-20 12:10 ` [PATCH v12 10/14] drm/mediatek: dpi: Add dpintf support Bo-Chen Chen
2022-06-21  2:32   ` CK Hu [this message]
2022-06-21  8:46     ` Rex-BC Chen
2022-06-20 12:10 ` [PATCH v12 11/14] drm/mediatek: dpi: Add tvd_clk enable/disable flow Bo-Chen Chen
2022-06-21  2:55   ` CK Hu
2022-06-21  3:11     ` Rex-BC Chen
2022-06-21  3:45       ` CK Hu
2022-06-21  3:50         ` Rex-BC Chen
2022-06-21  4:08           ` CK Hu
2022-06-21  5:47             ` Rex-BC Chen
2022-06-21  5:54               ` CK Hu
2022-06-21  5:59                 ` Rex-BC Chen
2022-06-20 12:10 ` [PATCH v12 12/14] drm/mediatek: dpi: Add YUV422 output support Bo-Chen Chen
2022-06-21  3:04   ` CK Hu
2022-06-21  8:39     ` Rex-BC Chen
2022-06-20 12:10 ` [PATCH v12 13/14] drm/mediatek: dpi: Only enable dpi after the bridge is enabled Bo-Chen Chen
2022-06-21  3:18   ` CK Hu
2022-06-21  6:02     ` Rex-BC Chen
2022-06-20 12:10 ` [PATCH v12 14/14] drm/mediatek: dpi: Add matrix_sel helper Bo-Chen Chen
2022-06-21  3:33   ` CK Hu
2022-06-21  8:41     ` Rex-BC Chen
2022-06-21  9:12       ` CK Hu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0862532b568f7e13b89b6537928efd518a2971a3.camel@mediatek.com \
    --to=ck.hu@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=airlied@linux.ie \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=granquet@baylibre.com \
    --cc=jitao.shi@mediatek.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=msp@baylibre.com \
    --cc=p.zabel@pengutronix.de \
    --cc=rex-bc.chen@mediatek.com \
    --cc=robh+dt@kernel.org \
    --cc=wenst@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®