[PATCH v3 03/12] drm/mediatek: hdmi: use a regmap instead of iomem

AngeloGioacchino Del Regno angelogioacchino.delregno at collabora.com
Mon Nov 7 03:20:20 PST 2022


Il 04/11/22 15:09, Guillaume Ranquet ha scritto:
> To prepare support for newer chips that need to share their address
> range with a dedicated ddc driver, use a regmap.
> 
> Signed-off-by: Guillaume Ranquet <granquet at baylibre.com>
> ---
>   drivers/gpu/drm/mediatek/mtk_hdmi.c | 43 +++++++++++--------------------------
>   1 file changed, 13 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index 4c80b6896dc3..9b02b30a193a 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -171,7 +171,7 @@ struct mtk_hdmi {
>   	u32 ibias_up;
>   	struct regmap *sys_regmap;
>   	unsigned int sys_offset;
> -	void __iomem *regs;
> +	struct regmap *regs;
>   	enum hdmi_colorspace csp;
>   	struct hdmi_audio_param aud_param;
>   	bool audio_enable;
> @@ -187,44 +187,29 @@ static inline struct mtk_hdmi *hdmi_ctx_from_bridge(struct drm_bridge *b)
>   	return container_of(b, struct mtk_hdmi, bridge);
>   }
>   
> -static u32 mtk_hdmi_read(struct mtk_hdmi *hdmi, u32 offset)
> +static int mtk_hdmi_read(struct mtk_hdmi *hdmi, u32 offset, u32 *val)
>   {
> -	return readl(hdmi->regs + offset);
> +	return regmap_read(hdmi->regs, offset, val);
>   }
>   
>   static void mtk_hdmi_write(struct mtk_hdmi *hdmi, u32 offset, u32 val)
>   {
> -	writel(val, hdmi->regs + offset);
> +	regmap_write(hdmi->regs, offset, val);
>   }
>   
>   static void mtk_hdmi_clear_bits(struct mtk_hdmi *hdmi, u32 offset, u32 bits)

You don't need these functions anymore, as these are now simply wrapping
regmap calls, hence these don't contain any "real" logic anymore.

Please remove them and use the regmap API directly.

Thanks,
Angelo




More information about the linux-arm-kernel mailing list