mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Shuijing Li (李水静)" <Shuijing.Li@mediatek.com>
To: "robh+dt@kernel.org" <robh+dt@kernel.org>,
	"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
	"Jitao Shi (石记涛)" <jitao.shi@mediatek.com>,
	"daniel@ffwll.ch" <daniel@ffwll.ch>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"CK Hu (胡俊光)" <ck.hu@mediatek.com>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"airlied@gmail.com" <airlied@gmail.com>,
	"krzysztof.kozlowski+dt@linaro.org"
	<krzysztof.kozlowski+dt@linaro.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"angelogioacchino.delregno@collabora.com"
	<angelogioacchino.delregno@collabora.com>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org" 
	<linux-mediatek@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Project_Global_Chrome_Upstream_Group 
	<Project_Global_Chrome_Upstream_Group@mediatek.com>
Subject: Re: [PATCH v2, 2/2] drm/mediatek: dp: Add the audio control to mtk_dp_data struct
Date: Thu, 20 Jul 2023 08:22:34 +0000	[thread overview]
Message-ID: <4eb44b4f2389ef9f011f5ae3fc4e664fd3b1260d.camel@mediatek.com> (raw)
In-Reply-To: <e2ad22bcba31797f38a12a488d4246a01bf0cb2e.camel@mediatek.com>

Hi CK,

>Is g1200 a dp receiver? If g1200 is a dp reveiver, I think you should
> also fix this for mt8195.

==>g1200 is MediaTek Genio 1200, you can understand it as MT8195, you
can refer to the link below for detail information.
https://www.mediatek.tw/products/aiot/mediatek-genio-1200
This patch is for MT8188 hw design change, MT8195 has not changed, so
MT8195 does not need modify.

>Separate these two things into two different patches.

==>I will Separate these two things into two different patches in the
next version.


Best Regards,
Shuijing

On Thu, 2023-07-06 at 05:35 +0000, CK Hu (胡俊光) wrote:
> Hi, Shuijing:
> 
> On Thu, 2023-07-06 at 10:14 +0800, Shuijing Li wrote:
> > Mainly add the following two flag:
> > 
> > 1.The audio packet arrangement function is to only arrange audio
> > packets into the Hblanking area. In order to align with the HW
> > default setting of g1200, this function needs to be turned off.
> 
> Is g1200 a dp receiver? If g1200 is a dp reveiver, I think you should
> also fix this for mt8195.
> 
> > 
> > 2.Due to the difference of HW, different dividers need to be set.
> 
> Separate these two things into two different patches.
> 
> Regards,
> CK
> 
> > 
> > Signed-off-by: Shuijing Li <shuijing.li@mediatek.com>
> > Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> > ---
> > Changes in v2:
> > - change the variables' name to be more descriptive
> > - add a comment that describes the function of
> > mtk_dp_audio_sample_arrange
> > - reduce indentation by doing the inverse check
> > - add a definition of some bits
> > - add support for mediatek, mt8188-edp-tx
> > per suggestion from the previous thread:
> > 
> 
> 
https://lore.kernel.org/lkml/ac0fcec9-a2fe-06cc-c727-189ef7babe9c@collabora.com/
> > ---
> >  drivers/gpu/drm/mediatek/mtk_dp.c     | 47
> > ++++++++++++++++++++++++++-
> >  drivers/gpu/drm/mediatek/mtk_dp_reg.h |  6 ++++
> >  2 files changed, 52 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c
> > b/drivers/gpu/drm/mediatek/mtk_dp.c
> > index 64eee77452c0..8e1a13ab2ba2 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dp.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dp.c
> > @@ -139,6 +139,8 @@ struct mtk_dp_data {
> >  	unsigned int smc_cmd;
> >  	const struct mtk_dp_efuse_fmt *efuse_fmt;
> >  	bool audio_supported;
> > +	bool audio_pkt_in_hblank_area;
> > +	u16 audio_m_div2_bit;
> >  };
> >  
> >  static const struct mtk_dp_efuse_fmt
> > mt8195_edp_efuse_fmt[MTK_DP_CAL_MAX] = {
> > @@ -647,7 +649,7 @@ static void
> > mtk_dp_audio_sdp_asp_set_channels(struct mtk_dp *mtk_dp,
> >  static void mtk_dp_audio_set_divider(struct mtk_dp *mtk_dp)
> >  {
> >  	mtk_dp_update_bits(mtk_dp, MTK_DP_ENC0_P0_30BC,
> > -			   AUDIO_M_CODE_MULT_DIV_SEL_DP_ENC0_P0_DIV_2,
> > +			   mtk_dp->data->audio_m_div2_bit,
> >  			   AUDIO_M_CODE_MULT_DIV_SEL_DP_ENC0_P0_MASK);
> >  }
> >  
> > @@ -1362,6 +1364,18 @@ static void
> > mtk_dp_sdp_set_down_cnt_init_in_hblank(struct mtk_dp *mtk_dp)
> >  			   SDP_DOWN_CNT_INIT_IN_HBLANK_DP_ENC1_P0_MASK)
> > ;
> >  }
> >  
> > +static void mtk_dp_audio_sample_arrange(struct mtk_dp *mtk_dp)
> > +{
> > +	/* arrange audio packets into the Hblanking and Vblanking area
> > */
> > +	if (!mtk_dp->data->audio_pkt_in_hblank_area)
> > +		return;
> > +
> > +	mtk_dp_update_bits(mtk_dp, MTK_DP_ENC1_P0_3374, 0,
> > +			   SDP_ASP_INSERT_IN_HBLANK_DP_ENC1_P0_MASK);
> > +	mtk_dp_update_bits(mtk_dp, MTK_DP_ENC1_P0_3374, 0,
> > +			   SDP_DOWN_ASP_CNT_INIT_DP_ENC1_P0_MASK);
> > +}
> > +
> >  static void mtk_dp_setup_tu(struct mtk_dp *mtk_dp)
> >  {
> >  	u32 sram_read_start = min_t(u32,
> > MTK_DP_TBC_BUF_READ_START_ADDR,
> > @@ -1371,6 +1385,7 @@ static void mtk_dp_setup_tu(struct mtk_dp
> > *mtk_dp)
> >  				    MTK_DP_PIX_PER_ADDR);
> >  	mtk_dp_set_sram_read_start(mtk_dp, sram_read_start);
> >  	mtk_dp_setup_encoder(mtk_dp);
> > +	mtk_dp_audio_sample_arrange(mtk_dp);
> >  	mtk_dp_sdp_set_down_cnt_init_in_hblank(mtk_dp);
> >  	mtk_dp_sdp_set_down_cnt_init(mtk_dp, sram_read_start);
> >  }
> > @@ -2616,11 +2631,31 @@ static int mtk_dp_resume(struct device
> > *dev)
> >  
> >  static SIMPLE_DEV_PM_OPS(mtk_dp_pm_ops, mtk_dp_suspend,
> > mtk_dp_resume);
> >  
> > +static const struct mtk_dp_data mt8188_edp_data = {
> > +	.bridge_type = DRM_MODE_CONNECTOR_eDP,
> > +	.smc_cmd = MTK_DP_SIP_ATF_EDP_VIDEO_UNMUTE,
> > +	.efuse_fmt = mt8195_edp_efuse_fmt,
> > +	.audio_supported = false,
> > +	.audio_pkt_in_hblank_area = false,
> > +	.audio_m_div2_bit =
> > MT8188_AUDIO_M_CODE_MULT_DIV_SEL_DP_ENC0_P0_DIV_2,
> > +};
> > +
> > +static const struct mtk_dp_data mt8188_dp_data = {
> > +	.bridge_type = DRM_MODE_CONNECTOR_DisplayPort,
> > +	.smc_cmd = MTK_DP_SIP_ATF_VIDEO_UNMUTE,
> > +	.efuse_fmt = mt8195_dp_efuse_fmt,
> > +	.audio_supported = true,
> > +	.audio_pkt_in_hblank_area = true,
> > +	.audio_m_div2_bit =
> > MT8188_AUDIO_M_CODE_MULT_DIV_SEL_DP_ENC0_P0_DIV_2,
> > +};
> > +
> >  static const struct mtk_dp_data mt8195_edp_data = {
> >  	.bridge_type = DRM_MODE_CONNECTOR_eDP,
> >  	.smc_cmd = MTK_DP_SIP_ATF_EDP_VIDEO_UNMUTE,
> >  	.efuse_fmt = mt8195_edp_efuse_fmt,
> >  	.audio_supported = false,
> > +	.audio_pkt_in_hblank_area = false,
> > +	.audio_m_div2_bit = AUDIO_M_CODE_MULT_DIV_SEL_DP_ENC0_P0_DIV_2,
> >  };
> >  
> >  static const struct mtk_dp_data mt8195_dp_data = {
> > @@ -2628,9 +2663,19 @@ static const struct mtk_dp_data
> > mt8195_dp_data
> > = {
> >  	.smc_cmd = MTK_DP_SIP_ATF_VIDEO_UNMUTE,
> >  	.efuse_fmt = mt8195_dp_efuse_fmt,
> >  	.audio_supported = true,
> > +	.audio_pkt_in_hblank_area = false,
> > +	.audio_m_div2_bit = AUDIO_M_CODE_MULT_DIV_SEL_DP_ENC0_P0_DIV_2,
> >  };
> >  
> >  static const struct of_device_id mtk_dp_of_match[] = {
> > +	{
> > +		.compatible = "mediatek,mt8188-edp-tx",
> > +		.data = &mt8188_edp_data,
> > +	},
> > +	{
> > +		.compatible = "mediatek,mt8188-dp-tx",
> > +		.data = &mt8188_dp_data,
> > +	},
> >  	{
> >  		.compatible = "mediatek,mt8195-edp-tx",
> >  		.data = &mt8195_edp_data,
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dp_reg.h
> > b/drivers/gpu/drm/mediatek/mtk_dp_reg.h
> > index 84e38cef03c2..6d7f0405867e 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dp_reg.h
> > +++ b/drivers/gpu/drm/mediatek/mtk_dp_reg.h
> > @@ -162,6 +162,7 @@
> >  #define AUDIO_M_CODE_MULT_DIV_SEL_DP_ENC0_P0_MUL_2	(1 << 8)
> >  #define AUDIO_M_CODE_MULT_DIV_SEL_DP_ENC0_P0_MUL_4	(2 << 8)
> >  #define AUDIO_M_CODE_MULT_DIV_SEL_DP_ENC0_P0_MUL_8	(3 << 8)
> > +#define MT8188_AUDIO_M_CODE_MULT_DIV_SEL_DP_ENC0_P0_DIV_2	(4 <<
> > 8)
> >  #define AUDIO_M_CODE_MULT_DIV_SEL_DP_ENC0_P0_DIV_2	(5 << 8)
> >  #define AUDIO_M_CODE_MULT_DIV_SEL_DP_ENC0_P0_DIV_4	(6 << 8)
> >  #define AUDIO_M_CODE_MULT_DIV_SEL_DP_ENC0_P0_DIV_8	(7 << 8)
> > @@ -228,6 +229,11 @@
> >  							 VIDEO_STABLE_C
> > NT_THRD_DP_ENC1_P0 | \
> >  							 SDP_DP13_EN_DP
> > _ENC1_P0 | \
> >  							 BS2BS_MODE_DP_
> > ENC1_P0)
> > +
> > +#define MTK_DP_ENC1_P0_3374			0x3374
> > +#define SDP_ASP_INSERT_IN_HBLANK_DP_ENC1_P0_MASK	BIT(12)
> > +#define SDP_DOWN_ASP_CNT_INIT_DP_ENC1_P0_MASK		GENMASK
> > (11, 0)
> > +
> >  #define MTK_DP_ENC1_P0_33F4			0x33f4
> >  #define DP_ENC_DUMMY_RW_1_AUDIO_RST_EN			BIT(0)
> >  #define DP_ENC_DUMMY_RW_1				BIT(9)

  reply	other threads:[~2023-07-20  8:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-06  2:14 [PATCH v2,0/2] Add compatible to increase MT8188 audio control Shuijing Li
2023-07-06  2:14 ` [PATCH v2,1/2] dt-bindings: display: mediatek: dp: Add compatible for MediaTek MT8188 Shuijing Li
2023-07-06  8:58   ` Krzysztof Kozlowski
2023-07-06 10:14   ` AngeloGioacchino Del Regno
2023-07-06  2:14 ` [PATCH v2,2/2] drm/mediatek: dp: Add the audio control to mtk_dp_data struct Shuijing Li
2023-07-06  5:35   ` [PATCH v2, 2/2] " CK Hu (胡俊光)
2023-07-20  8:22     ` Shuijing Li (李水静) [this message]
2023-07-06 10:26   ` [PATCH v2,2/2] " 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=4eb44b4f2389ef9f011f5ae3fc4e664fd3b1260d.camel@mediatek.com \
    --to=shuijing.li@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=airlied@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=ck.hu@mediatek.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --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=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.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®