linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: xinlei.lee <xinlei.lee@mediatek.com>
To: "CK Hu (胡俊光)" <ck.hu@mediatek.com>,
	"Jason-JH Lin (林睿祥)" <Jason-JH.Lin@mediatek.com>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"daniel@ffwll.ch" <daniel@ffwll.ch>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"airlied@linux.ie" <airlied@linux.ie>,
	"Rex-BC Chen (陳柏辰)" <Rex-BC.Chen@mediatek.com>,
	"angelogioacchino.delregno@collabora.com"
	<angelogioacchino.delregno@collabora.com>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"Jitao Shi (石记涛)" <jitao.shi@mediatek.com>
Subject: Re: [PATCH v8,2/3]drm: mediatek: Adjust the dpi output format to MT8186
Date: Fri, 23 Sep 2022 14:57:03 +0800	[thread overview]
Message-ID: <2941a6e319e80c489bd2872efd836063f4984b86.camel@mediatek.com> (raw)
In-Reply-To: <a137c801f5263abaef8a13a14a1f4b24a5bcdf1b.camel@mediatek.com>

On Fri, 2022-09-23 at 13:59 +0800, CK Hu (胡俊光) wrote:
> Hi, Xinlei:
> 
> From the code you modify, I do not understand why the title is
> "Adjust
> the dpi output format to MT8186". You just call mmsys driver function
> to set single edge or dual edge, but single edge or dual edge already
> exist in other SoC and is not special in MT8186. So I think you
> should
> change the title to 'Set dpi format in mmsys'
> 
> 
> On Thu, 2022-09-22 at 20:45 +0800, xinlei.lee@mediatek.com wrote:
> > From: Xinlei Lee <xinlei.lee@mediatek.com>
> > 
> > Due to the mt8186  hardware changes, we need to modify the dpi
> > output 
> > format corresponding to the mmsys register(mmsys_base+0x400).
> > 
> 
> The below description is not related to this patch and it's common
> with
> mt8183, so I think we don't need below description.
> 
> > Because different sink ICs may support other output formats.
> > The current DRM architecture supports retrieving the output format
> > of
> > all bridges (eg dpi is implemented via DRM's .atomic_check and
> > .atomic_get_output_bus_fmts and .atomic_get_input_bus_fmts).
> > If no unified output format is found, the default soc format
> > (MEDIA_BUS_FMT_RGB888_2X12_LE in mt8186) is used.
> > 
> > Therefore, if there are other format sink ICs
> > (RGB888_DDR/RGB888_SDR)
> > in
> > the future, the sink IC needs to add the func implementation
> > mentioned
> > above needs to be added. 
> > And the drm architecture will select the appropriate format to
> > change
> > the dpi output.
> > 
> > Co-developed-by: Jitao Shi <jitao.shi@mediatek.com>
> > Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> > Signed-off-by: Xinlei Lee <xinlei.lee@mediatek.com>
> > ---
> >  drivers/gpu/drm/mediatek/mtk_dpi.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > index 630a4e301ef6..bd1870a8504a 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > @@ -15,6 +15,7 @@
> >  #include <linux/of_graph.h>
> >  #include <linux/pinctrl/consumer.h>
> >  #include <linux/platform_device.h>
> > +#include <linux/soc/mediatek/mtk-mmsys.h>
> >  #include <linux/types.h>
> >  
> >  #include <video/videomode.h>
> > @@ -30,6 +31,7 @@
> >  #include "mtk_disp_drv.h"
> >  #include "mtk_dpi_regs.h"
> >  #include "mtk_drm_ddp_comp.h"
> > +#include "mtk_drm_drv.h"
> >  
> >  enum mtk_dpi_out_bit_num {
> >  	MTK_DPI_OUT_BIT_NUM_8BITS,
> > @@ -82,6 +84,7 @@ struct mtk_dpi {
> >  	struct pinctrl_state *pins_dpi;
> >  	u32 output_fmt;
> >  	int refcount;
> > +	struct device *mmsys_dev;
> >  };
> >  
> >  static inline struct mtk_dpi *bridge_to_dpi(struct drm_bridge *b)
> > @@ -135,6 +138,7 @@ struct mtk_dpi_yc_limit {
> >   * @yuv422_en_bit: Enable bit of yuv422.
> >   * @csc_enable_bit: Enable bit of CSC.
> >   * @pixels_per_iter: Quantity of transferred pixels per iteration.
> > + * @edge_cfg_in_mmsys: If the edge configuration for DPI's output
> > needs to be set in MMSYS.
> >   */
> >  struct mtk_dpi_conf {
> >  	unsigned int (*cal_factor)(int clock);
> > @@ -153,6 +157,7 @@ struct mtk_dpi_conf {
> >  	u32 yuv422_en_bit;
> >  	u32 csc_enable_bit;
> >  	u32 pixels_per_iter;
> > +	bool edge_cfg_in_mmsys;
> >  };
> >  
> >  static void mtk_dpi_mask(struct mtk_dpi *dpi, u32 offset, u32 val,
> > u32 mask)
> > @@ -449,8 +454,12 @@ static void mtk_dpi_dual_edge(struct mtk_dpi
> > *dpi)
> >  		mtk_dpi_mask(dpi, DPI_OUTPUT_SETTING,
> >  			     dpi->output_fmt ==
> > MEDIA_BUS_FMT_RGB888_2X12_LE ?
> >  			     EDGE_SEL : 0, EDGE_SEL);
> > +		if (dpi->conf->edge_cfg_in_mmsys)
> > +			mtk_mmsys_ddp_dpi_fmt_config(dpi->mmsys_dev,
> > MTK_DPI_RGB888_DDR_CON);
> >  	} else {
> >  		mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE,
> > 0);
> > +		if (dpi->conf->edge_cfg_in_mmsys)
> > +			mtk_mmsys_ddp_dpi_fmt_config(dpi->mmsys_dev,
> > MTK_DPI_RGB888_SDR_CON);
> >  	}
> >  }
> >  
> > @@ -778,8 +787,10 @@ static int mtk_dpi_bind(struct device *dev,
> > struct device *master, void *data)
> >  {
> >  	struct mtk_dpi *dpi = dev_get_drvdata(dev);
> >  	struct drm_device *drm_dev = data;
> > +	struct mtk_drm_private *priv = drm_dev->dev_private;
> >  	int ret;
> >  
> > +	dpi->mmsys_dev = priv->mmsys_dev;
> >  	ret = drm_simple_encoder_init(drm_dev, &dpi->encoder,
> >  				      DRM_MODE_ENCODER_TMDS);
> >  	if (ret) {

Hi CK:

Thanks for your suggestion.

I will revise the next edition as you suggested.

Best Regards!
xinlei


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-09-23  7:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 12:44 [PATCH v8,0/3] Add dpi output format control for MT8186 xinlei.lee
2022-09-22 12:45 ` [PATCH v8,1/3] soc: mediatek: Add all settings to mtk_mmsys_ddp_dpi_fmt_config func xinlei.lee
2022-09-23  9:13   ` AngeloGioacchino Del Regno
2022-09-22 12:45 ` [PATCH v8,2/3]drm: mediatek: Adjust the dpi output format to MT8186 xinlei.lee
2022-09-23  5:59   ` CK Hu (胡俊光)
2022-09-23  6:57     ` xinlei.lee [this message]
2022-09-23  9:16   ` AngeloGioacchino Del Regno
2022-09-22 12:45 ` [PATCH v8,3/3] drm: mediatek: Add mt8186 dpi compatibles and platform data xinlei.lee
2022-09-23  6:05   ` CK Hu (胡俊光)
2022-09-23  9:13   ` AngeloGioacchino Del Regno

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=2941a6e319e80c489bd2872efd836063f4984b86.camel@mediatek.com \
    --to=xinlei.lee@mediatek.com \
    --cc=Jason-JH.Lin@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=Rex-BC.Chen@mediatek.com \
    --cc=airlied@linux.ie \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=ck.hu@mediatek.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jitao.shi@mediatek.com \
    --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=p.zabel@pengutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).