Message ID | 20230720082604.18618-4-shuijing.li@mediatek.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2979399vqt; Thu, 20 Jul 2023 01:58:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlGwJHviT1c4lwK/xP/Q7cDkqatZm8OO7bgwwOeWup9xopzVFhEtlBYYkRIJKaF4STDCxbPx X-Received: by 2002:aa7:d384:0:b0:514:a110:6bed with SMTP id x4-20020aa7d384000000b00514a1106bedmr4972728edq.27.1689843519719; Thu, 20 Jul 2023 01:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689843519; cv=none; d=google.com; s=arc-20160816; b=kEjttNRl5EgrCpadIZ/sKHUgFPlrJ1qT1AI6L5jlKrIDThyOx8aBICfeVTw6/Qap0n 0KgWdvJ6ziEt5XgekvqUHQgj7mmJIh5lojVFF7rLSBQnM2dHRgOOZhCZtIZZtrksQSHp 8y8UtX8bGFi3xeJ3UKKpi+ZJdWwls5qiOsDjTT0URyvBrHDxMpBYL076MCN16vkpQZSF EVsaMg2Y+xecoNjqC70jeMrwJ3LsNlZZ/70cWz/qw/oGZarUaUp2vKdFDgmaA4xmIL4R +FLDLuYdZUcqTkUujFXFep5QIenNOUEGpp0Avxz/3vkNe+0NmfE3IN71GhhnlvXDtGnI queg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=x3Ef2HXAMqtZCcHsQB0m7y6VJp+SmT8fZ8z5MnEgAEo=; fh=/A7E3z20mAl6r3QJXD/kIpFEDa9Yx6cY1u+S4GtH8aM=; b=ejJdfLHzgQHZhVk4MKt2zmv+25IJ7nhS3KMM78jyOhBYBQLvfdtJ+x6vlFIQiGm1dD YqkpU+NxllYX4Uz7tVBtEHwigGdH03XCji6beiKpbHD90izdDrjSwt0QbUXXNxOWjC2P 1otFFULhCgpOsZzpmkpFKLa0MrA1a0fB/Etpy9EsTK64Vs6j7L3pd8+sDsNVLlkSNYhJ lVz6JDUui8fHk1dz06RP/kJ1r/xgUt7ylAMO/4lHRUwAPZi9ATONGYGBR7W4uQpCQEYC HbV/I6M2FlK4kjgmqTlJU/012J9dXemsEdzyhQfOgH/+badMiLjror2uFsSKDRcEzBaI 8fJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=myAoEOP6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020aa7d404000000b00521d2baf613si525370edq.400.2023.07.20.01.58.14; Thu, 20 Jul 2023 01:58:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=myAoEOP6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231656AbjGTI0I (ORCPT <rfc822;chrisben.tianve@gmail.com> + 99 others); Thu, 20 Jul 2023 04:26:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231617AbjGTI0F (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 20 Jul 2023 04:26:05 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D93132686; Thu, 20 Jul 2023 01:26:03 -0700 (PDT) X-UUID: 0e4addd626d711ee9cb5633481061a41-20230720 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=x3Ef2HXAMqtZCcHsQB0m7y6VJp+SmT8fZ8z5MnEgAEo=; b=myAoEOP6zzVpJrsuN0V6Rj6/JaKVz7fURFpK9Ifj58uLnwbfPZ4rgOgfKbiH4Q9g8KfRzhRC3z3oVaqn2Vs6OhZpxBowGzfFpsxjbGvkQy3C21P+FqUjs4ksQzvuo3mqHoKVdsmYH/tOcHV/tvVcYZbddE91WZbbNWDFUhzfJMs=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.28,REQID:0fcc76b0-74bd-46a0-9c94-9952dd5c21c8,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:176cd25,CLOUDID:f039d0dc-dc79-4898-9235-1134b97257a8,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO,DKR:0,DKP:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_ULN,TF_CID_SPAM_SNR X-UUID: 0e4addd626d711ee9cb5633481061a41-20230720 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from <shuijing.li@mediatek.com>) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 9689820; Thu, 20 Jul 2023 16:25:59 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 20 Jul 2023 16:25:58 +0800 Received: from mszsdhlt06.gcn.mediatek.inc (10.16.6.206) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Thu, 20 Jul 2023 16:25:57 +0800 From: Shuijing Li <shuijing.li@mediatek.com> To: <chunkuang.hu@kernel.org>, <p.zabel@pengutronix.de>, <airlied@gmail.com>, <daniel@ffwll.ch>, <robh+dt@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <conor+dt@kernel.org>, <matthias.bgg@gmail.com>, <angelogioacchino.delregno@collabora.com>, <jitao.shi@mediatek.com> CC: <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>, Shuijing Li <shuijing.li@mediatek.com> Subject: [PATCH v3,3/3] drm/mediatek: dp: Add the audio divider to mtk_dp_data struct Date: Thu, 20 Jul 2023 16:26:04 +0800 Message-ID: <20230720082604.18618-4-shuijing.li@mediatek.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230720082604.18618-1-shuijing.li@mediatek.com> References: <20230720082604.18618-1-shuijing.li@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771929358470045430 X-GMAIL-MSGID: 1771929358470045430 |
Series |
Add compatible to increase MT8188 audio control
|
|
Commit Message
Shuijing Li
July 20, 2023, 8:26 a.m. UTC
Due to the difference of HW, different dividers need to be set. Signed-off-by: Shuijing Li <shuijing.li@mediatek.com> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com> --- Changes in v3: Separate these two things into two different patches. per suggestion from the previous thread: https://lore.kernel.org/lkml/e2ad22bcba31797f38a12a488d4246a01bf0cb2e.camel@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 | 7 ++++++- drivers/gpu/drm/mediatek/mtk_dp_reg.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)
Comments
Il 20/07/23 10:26, Shuijing Li ha scritto: > Due to the difference of HW, different dividers need to be set. > > Signed-off-by: Shuijing Li <shuijing.li@mediatek.com> > Signed-off-by: Jitao Shi <jitao.shi@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
On 20/07/2023 10:26, Shuijing Li wrote: > Due to the difference of HW, different dividers need to be set. > > Signed-off-by: Shuijing Li <shuijing.li@mediatek.com> > Signed-off-by: Jitao Shi <jitao.shi@mediatek.com> > --- > Changes in v3: > Separate these two things into two different patches. > per suggestion from the previous thread: > https://lore.kernel.org/lkml/e2ad22bcba31797f38a12a488d4246a01bf0cb2e.camel@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 | 7 ++++++- > drivers/gpu/drm/mediatek/mtk_dp_reg.h | 1 + > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c > index d8cda83d6fef..8e1a13ab2ba2 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dp.c > +++ b/drivers/gpu/drm/mediatek/mtk_dp.c > @@ -140,6 +140,7 @@ struct mtk_dp_data { > 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] = { > @@ -648,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); > } > > @@ -2636,6 +2637,7 @@ static const struct mtk_dp_data mt8188_edp_data = { > .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 = { > @@ -2644,6 +2646,7 @@ static const struct mtk_dp_data mt8188_dp_data = { > .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 = { > @@ -2652,6 +2655,7 @@ static const struct mtk_dp_data mt8195_edp_data = { > .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 = { > @@ -2660,6 +2664,7 @@ static const struct mtk_dp_data mt8195_dp_data = { > .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[] = { > diff --git a/drivers/gpu/drm/mediatek/mtk_dp_reg.h b/drivers/gpu/drm/mediatek/mtk_dp_reg.h > index f38d6ff12afe..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) IMO, it's a bit weird to have SoC specific define in the generic header. Are you sure this bit is only available for MT8188 ? > #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) Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Il 20/07/23 12:14, Alexandre Mergnat ha scritto: > > > On 20/07/2023 10:26, Shuijing Li wrote: >> Due to the difference of HW, different dividers need to be set. >> >> Signed-off-by: Shuijing Li <shuijing.li@mediatek.com> >> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com> >> --- >> Changes in v3: >> Separate these two things into two different patches. >> per suggestion from the previous thread: >> https://lore.kernel.org/lkml/e2ad22bcba31797f38a12a488d4246a01bf0cb2e.camel@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 | 7 ++++++- >> drivers/gpu/drm/mediatek/mtk_dp_reg.h | 1 + >> 2 files changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c >> index d8cda83d6fef..8e1a13ab2ba2 100644 >> --- a/drivers/gpu/drm/mediatek/mtk_dp.c >> +++ b/drivers/gpu/drm/mediatek/mtk_dp.c >> @@ -140,6 +140,7 @@ struct mtk_dp_data { >> 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] = { >> @@ -648,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); >> } >> @@ -2636,6 +2637,7 @@ static const struct mtk_dp_data mt8188_edp_data = { >> .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 = { >> @@ -2644,6 +2646,7 @@ static const struct mtk_dp_data mt8188_dp_data = { >> .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 = { >> @@ -2652,6 +2655,7 @@ static const struct mtk_dp_data mt8195_edp_data = { >> .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 = { >> @@ -2660,6 +2664,7 @@ static const struct mtk_dp_data mt8195_dp_data = { >> .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[] = { >> diff --git a/drivers/gpu/drm/mediatek/mtk_dp_reg.h >> b/drivers/gpu/drm/mediatek/mtk_dp_reg.h >> index f38d6ff12afe..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) > > IMO, it's a bit weird to have SoC specific define in the generic header. > Are you sure this bit is only available for MT8188 ? > Eh, the P0_DIV2 bit is 5<<8 for MT8195, while for 8188 it's 4<<8, clearly :-) >> #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) > > Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> >
On 20/07/2023 13:54, AngeloGioacchino Del Regno wrote: > Il 20/07/23 12:14, Alexandre Mergnat ha scritto: >> >> >> On 20/07/2023 10:26, Shuijing Li wrote: >>> Due to the difference of HW, different dividers need to be set. >>> >>> Signed-off-by: Shuijing Li <shuijing.li@mediatek.com> >>> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com> >>> --- >>> Changes in v3: >>> Separate these two things into two different patches. >>> per suggestion from the previous thread: >>> https://lore.kernel.org/lkml/e2ad22bcba31797f38a12a488d4246a01bf0cb2e.camel@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 | 7 ++++++- >>> drivers/gpu/drm/mediatek/mtk_dp_reg.h | 1 + >>> 2 files changed, 7 insertions(+), 1 deletion(-) >>> ... >>> b/drivers/gpu/drm/mediatek/mtk_dp_reg.h >>> index f38d6ff12afe..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) >> >> IMO, it's a bit weird to have SoC specific define in the generic header. >> Are you sure this bit is only available for MT8188 ? >> > > Eh, the P0_DIV2 bit is 5<<8 for MT8195, while for 8188 it's 4<<8, > clearly :-) > Ok then, to avoid this kind of issue for other SoCs in the future, is that make sense for you to do a SoC specific header file beside the generic one? >>> #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) >> >> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> >> > >
Il 20/07/23 14:07, Alexandre Mergnat ha scritto: > > > On 20/07/2023 13:54, AngeloGioacchino Del Regno wrote: >> Il 20/07/23 12:14, Alexandre Mergnat ha scritto: >>> >>> >>> On 20/07/2023 10:26, Shuijing Li wrote: >>>> Due to the difference of HW, different dividers need to be set. >>>> >>>> Signed-off-by: Shuijing Li <shuijing.li@mediatek.com> >>>> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com> >>>> --- >>>> Changes in v3: >>>> Separate these two things into two different patches. >>>> per suggestion from the previous thread: >>>> https://lore.kernel.org/lkml/e2ad22bcba31797f38a12a488d4246a01bf0cb2e.camel@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 | 7 ++++++- >>>> drivers/gpu/drm/mediatek/mtk_dp_reg.h | 1 + >>>> 2 files changed, 7 insertions(+), 1 deletion(-) >>>> > ... >>>> b/drivers/gpu/drm/mediatek/mtk_dp_reg.h >>>> index f38d6ff12afe..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) >>> >>> IMO, it's a bit weird to have SoC specific define in the generic header. >>> Are you sure this bit is only available for MT8188 ? >>> >> >> Eh, the P0_DIV2 bit is 5<<8 for MT8195, while for 8188 it's 4<<8, clearly :-) >> > > Ok then, to avoid this kind of issue for other SoCs in the future, is that make > sense for you to do a SoC specific header file beside the generic one? > For just one definition? That's a bit overkill :-) >>>> #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) >>> >>> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> >>> >> >> >
On 20/07/2023 14:08, AngeloGioacchino Del Regno wrote: > Il 20/07/23 14:07, Alexandre Mergnat ha scritto: >> >> >> On 20/07/2023 13:54, AngeloGioacchino Del Regno wrote: >>> Il 20/07/23 12:14, Alexandre Mergnat ha scritto: >>>> >>>> >>>> On 20/07/2023 10:26, Shuijing Li wrote: >>>>> Due to the difference of HW, different dividers need to be set. >>>>> >>>>> Signed-off-by: Shuijing Li <shuijing.li@mediatek.com> >>>>> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com> >>>>> --- >>>>> Changes in v3: >>>>> Separate these two things into two different patches. >>>>> per suggestion from the previous thread: >>>>> https://lore.kernel.org/lkml/e2ad22bcba31797f38a12a488d4246a01bf0cb2e.camel@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 | 7 ++++++- >>>>> drivers/gpu/drm/mediatek/mtk_dp_reg.h | 1 + >>>>> 2 files changed, 7 insertions(+), 1 deletion(-) >>>>> >> ... >>>>> b/drivers/gpu/drm/mediatek/mtk_dp_reg.h >>>>> index f38d6ff12afe..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) >>>> >>>> IMO, it's a bit weird to have SoC specific define in the generic >>>> header. >>>> Are you sure this bit is only available for MT8188 ? >>>> >>> >>> Eh, the P0_DIV2 bit is 5<<8 for MT8195, while for 8188 it's 4<<8, >>> clearly :-) >>> >> >> Ok then, to avoid this kind of issue for other SoCs in the future, is >> that make sense for you to do a SoC specific header file beside the >> generic one? >> > > For just one definition? That's a bit overkill :-) > You're right, but we must start somewhere ^^, and show the proper way for future patches. Actually, I gave my Reviewed-by because it's only one definition. This will be fixed later (I hope). >>>>> #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) >>>> >>>> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> >>>> >>> >>> >> > >
Il 20/07/23 14:29, Alexandre Mergnat ha scritto: > > > On 20/07/2023 14:08, AngeloGioacchino Del Regno wrote: >> Il 20/07/23 14:07, Alexandre Mergnat ha scritto: >>> >>> >>> On 20/07/2023 13:54, AngeloGioacchino Del Regno wrote: >>>> Il 20/07/23 12:14, Alexandre Mergnat ha scritto: >>>>> >>>>> >>>>> On 20/07/2023 10:26, Shuijing Li wrote: >>>>>> Due to the difference of HW, different dividers need to be set. >>>>>> >>>>>> Signed-off-by: Shuijing Li <shuijing.li@mediatek.com> >>>>>> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com> >>>>>> --- >>>>>> Changes in v3: >>>>>> Separate these two things into two different patches. >>>>>> per suggestion from the previous thread: >>>>>> https://lore.kernel.org/lkml/e2ad22bcba31797f38a12a488d4246a01bf0cb2e.camel@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 | 7 ++++++- >>>>>> drivers/gpu/drm/mediatek/mtk_dp_reg.h | 1 + >>>>>> 2 files changed, 7 insertions(+), 1 deletion(-) >>>>>> >>> ... >>>>>> b/drivers/gpu/drm/mediatek/mtk_dp_reg.h >>>>>> index f38d6ff12afe..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) >>>>> >>>>> IMO, it's a bit weird to have SoC specific define in the generic header. >>>>> Are you sure this bit is only available for MT8188 ? >>>>> >>>> >>>> Eh, the P0_DIV2 bit is 5<<8 for MT8195, while for 8188 it's 4<<8, clearly :-) >>>> >>> >>> Ok then, to avoid this kind of issue for other SoCs in the future, is that make >>> sense for you to do a SoC specific header file beside the generic one? >>> >> >> For just one definition? That's a bit overkill :-) >> > > You're right, but we must start somewhere ^^, and show the proper way for future > patches. Actually, I gave my Reviewed-by because it's only one definition. This > will be fixed later (I hope). > I'm confident that *if* and when "a bunch" of SoC-specific definitions will appear, those will be splitted in different headers. :-) >>>>>> #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) >>>>> >>>>> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> >>>>> >>>> >>>> >>> >> >> >
Hi, Shuijing: On Thu, 2023-07-20 at 16:26 +0800, Shuijing Li wrote: > Due to the difference of HW, different dividers need to be set. > > Signed-off-by: Shuijing Li <shuijing.li@mediatek.com> > Signed-off-by: Jitao Shi <jitao.shi@mediatek.com> > --- > Changes in v3: > Separate these two things into two different patches. > per suggestion from the previous thread: > https://lore.kernel.org/lkml/e2ad22bcba31797f38a12a488d4246a01bf0cb2e.camel@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 | 7 ++++++- > drivers/gpu/drm/mediatek/mtk_dp_reg.h | 1 + > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c > b/drivers/gpu/drm/mediatek/mtk_dp.c > index d8cda83d6fef..8e1a13ab2ba2 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dp.c > +++ b/drivers/gpu/drm/mediatek/mtk_dp.c > @@ -140,6 +140,7 @@ struct mtk_dp_data { > 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] = { > @@ -648,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); > } > > @@ -2636,6 +2637,7 @@ static const struct mtk_dp_data mt8188_edp_data > = { > .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 = { > @@ -2644,6 +2646,7 @@ static const struct mtk_dp_data mt8188_dp_data > = { > .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 = { > @@ -2652,6 +2655,7 @@ static const struct mtk_dp_data mt8195_edp_data > = { > .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 = { > @@ -2660,6 +2664,7 @@ static const struct mtk_dp_data mt8195_dp_data > = { > .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[] = { > diff --git a/drivers/gpu/drm/mediatek/mtk_dp_reg.h > b/drivers/gpu/drm/mediatek/mtk_dp_reg.h > index f38d6ff12afe..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) For AUDIO_M_CODE_MULT_DIV_SEL_DP_ENC0_P0_*, add prefix 'MT8195_'. And list all configuration for MT8188. Regards, CK > #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)
diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c index d8cda83d6fef..8e1a13ab2ba2 100644 --- a/drivers/gpu/drm/mediatek/mtk_dp.c +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -140,6 +140,7 @@ struct mtk_dp_data { 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] = { @@ -648,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); } @@ -2636,6 +2637,7 @@ static const struct mtk_dp_data mt8188_edp_data = { .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 = { @@ -2644,6 +2646,7 @@ static const struct mtk_dp_data mt8188_dp_data = { .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 = { @@ -2652,6 +2655,7 @@ static const struct mtk_dp_data mt8195_edp_data = { .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 = { @@ -2660,6 +2664,7 @@ static const struct mtk_dp_data mt8195_dp_data = { .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[] = { diff --git a/drivers/gpu/drm/mediatek/mtk_dp_reg.h b/drivers/gpu/drm/mediatek/mtk_dp_reg.h index f38d6ff12afe..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)