From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: "CK Hu (胡俊光)" <ck.hu@mediatek.com>,
"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"kernel@collabora.com" <kernel@collabora.com>,
"daniel@ffwll.ch" <daniel@ffwll.ch>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"airlied@gmail.com" <airlied@gmail.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>
Subject: Re: [PATCH v3 1/7] drm/mediatek: dsi: Use GENMASK() for register mask definitions
Date: Tue, 6 Feb 2024 14:27:11 +0100 [thread overview]
Message-ID: <4fe9947f-b190-4dcc-8d1e-f532e6dcb827@collabora.com> (raw)
In-Reply-To: <082bc4d9efd0746d7ec25eab0b3bf96018e997e5.camel@mediatek.com>
Il 06/02/24 09:57, CK Hu (胡俊光) ha scritto:
> Hi, Angelo:
>
> On Wed, 2024-01-31 at 12:34 +0100, AngeloGioacchino Del Regno wrote:
>> Change magic numerical masks with usage of the GENMASK() macro
>> to improve readability.
>>
>> While at it, also fix the DSI_PS_SEL mask to include all bits instead
>> of just a subset of them.
>>
>> This commit brings no functional changes.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <
>> angelogioacchino.delregno@collabora.com>
>> ---
>> drivers/gpu/drm/mediatek/mtk_dsi.c | 45 +++++++++++++++-------------
>> --
>> 1 file changed, 23 insertions(+), 22 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c
>> b/drivers/gpu/drm/mediatek/mtk_dsi.c
>> index a2fdfc8ddb15..3b7392c03b4d 100644
>> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
>> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
>> @@ -58,18 +58,18 @@
>>
>> #define DSI_TXRX_CTRL 0x18
>> #define VC_NUM BIT(1)
>> -#define LANE_NUM (0xf << 2)
>> +#define LANE_NUM GENMASK(5, 2)
>> #define DIS_EOT BIT(6)
>> #define NULL_EN BIT(7)
>> #define TE_FREERUN BIT(8)
>> #define EXT_TE_EN BIT(9)
>> #define EXT_TE_EDGE BIT(10)
>> -#define MAX_RTN_SIZE (0xf << 12)
>> +#define MAX_RTN_SIZE GENMASK(15, 12)
>> #define HSTX_CKLP_EN BIT(16)
>>
>> #define DSI_PSCTRL 0x1c
>> -#define DSI_PS_WC 0x3fff
>> -#define DSI_PS_SEL (3 << 16)
>> +#define DSI_PS_WC GENMASK(14, 0)
>> +#define DSI_PS_SEL GENMASK(19, 16)
>
> The original definition of DSI_PS_WC/DSI_PS_SEL is correct in MT8173.
> So both need two definition and let each SoC select its own definition.
>
The additional bits are unused on older SoCs and, if set, will be simply ignored;
if we want to prevent setting bits that don't exist on the old ones, that should
be done as a later commit introducing SoC capabilities for those and when the new
capabilities for the new SoCs are introduced anyway.
As of now, this doesn't break anything.
Regards,
Angelo
next prev parent reply other threads:[~2024-02-06 13:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-31 11:34 [PATCH v3 0/7] MediaTek DRM - DSI driver cleanups AngeloGioacchino Del Regno
2024-01-31 11:34 ` [PATCH v3 1/7] drm/mediatek: dsi: Use GENMASK() for register mask definitions AngeloGioacchino Del Regno
2024-02-06 8:57 ` CK Hu (胡俊光)
2024-02-06 13:27 ` AngeloGioacchino Del Regno [this message]
2024-02-07 8:21 ` CK Hu (胡俊光)
2024-01-31 11:34 ` [PATCH v3 2/7] drm/mediatek: dsi: Cleanup functions mtk_dsi_ps_control{_vact}() AngeloGioacchino Del Regno
2024-02-06 9:50 ` CK Hu (胡俊光)
2024-02-06 11:24 ` AngeloGioacchino Del Regno
2024-01-31 11:34 ` [PATCH v3 3/7] drm/mediatek: dsi: Use bitfield macros where useful AngeloGioacchino Del Regno
2024-01-31 11:34 ` [PATCH v3 4/7] drm/mediatek: dsi: Replace open-coded instance of HZ_PER_MHZ AngeloGioacchino Del Regno
2024-01-31 11:34 ` [PATCH v3 5/7] drm/mediatek: dsi: Register DSI host after acquiring clocks and PHY AngeloGioacchino Del Regno
2024-01-31 11:34 ` [PATCH v3 6/7] drm/mediatek: dsi: Simplify with dev_err_probe and remove gotos AngeloGioacchino Del Regno
2024-01-31 11:34 ` [PATCH v3 7/7] drm/mediatek: dsi: Compress of_device_id entries and add sentinel 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=4fe9947f-b190-4dcc-8d1e-f532e6dcb827@collabora.com \
--to=angelogioacchino.delregno@collabora.com \
--cc=airlied@gmail.com \
--cc=chunkuang.hu@kernel.org \
--cc=ck.hu@mediatek.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@collabora.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