[PATCH v19 06/25] soc: mediatek: add mtk_mmsys_write_reg API
AngeloGioacchino Del Regno
angelogioacchino.delregno at collabora.com
Tue May 3 12:19:23 UTC 2022
Il 03/05/22 12:23, Nancy.Lin ha scritto:
> Add mtk_mmsys_write_reg API. Simplify code for writing mmsys reg.
> It is a preparation for adding support for mmsys config API.
>
> Signed-off-by: Nancy.Lin <nancy.lin at mediatek.com>
> ---
> drivers/soc/mediatek/mtk-mmsys.c | 35 ++++++++++++++------------------
> 1 file changed, 15 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c
> index ab3c5cbb0175..3e2e5e3f721d 100644
> --- a/drivers/soc/mediatek/mtk-mmsys.c
> +++ b/drivers/soc/mediatek/mtk-mmsys.c
> @@ -191,22 +191,26 @@ static int mtk_mmsys_find_match_drvdata(struct mtk_mmsys *mmsys,
> return -EINVAL;
> }
>
> +static void mtk_mmsys_write_reg(struct mtk_mmsys *mmsys, u32 offset, u32 mask, u32 val)
> +{
> + u32 tmp;
> +
> + tmp = readl_relaxed(mmsys->regs + offset);
> + tmp = (tmp & ~mask) | val;
> + writel_relaxed(tmp, mmsys->regs + offset);
> +}
> +
Uhm... this is the equivalent of regmap_update_bits(): I fear that calling this
mtk_mmsys_write_reg() may lead to confusion.
I think that a more appropriate name would be mtk_mmsys_update_bits() or
something similar, recalling that this is not just a register write, but
a RMW.
Regards,
Angelo
More information about the dri-devel
mailing list