mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>
Cc: "Lewis Liao (廖柏鈞)" <Lewis.Liao@mediatek.com>,
	"Jason-JH Lin (林睿祥)" <Jason-JH.Lin@mediatek.com>,
	"Ives Chenjh (陳俊弘)" <Ives.Chenjh@mediatek.com>,
	"simona@ffwll.ch" <simona@ffwll.ch>,
	"TommyYL Chen (陳彥良)" <TommyYL.Chen@mediatek.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"airlied@gmail.com" <airlied@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"kernel@collabora.com" <kernel@collabora.com>
Subject: Re: [PATCH v1 2/5] drm/mediatek: mtk_dpi: Add local helpers for bus format parameters
Date: Tue, 22 Apr 2025 04:00:14 +0000	[thread overview]
Message-ID: <05abf54038b2fb066c64d0975ca2fe06e8c5be7f.camel@mediatek.com> (raw)
In-Reply-To: <20250409131306.108635-3-angelogioacchino.delregno@collabora.com>

On Wed, 2025-04-09 at 15:13 +0200, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
> 
> 
> In preparation for adding support for additional color formats,
> add local helpers to map media bus format parameters to this
> driver's bit_num, channel_swap and color_format.
> 
> This commit brings no functional changes.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 46 ++++++++++++++++++++++++++----
>  1 file changed, 40 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index d735398e97f8..5a66dfe3ad40 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -738,6 +738,43 @@ static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
>         return input_fmts;
>  }
> 
> +static unsigned int mtk_dpi_bus_fmt_bit_num(unsigned int out_bus_format)
> +{
> +       switch (out_bus_format) {
> +       default:
> +       case MEDIA_BUS_FMT_RGB888_1X24:
> +       case MEDIA_BUS_FMT_RGB888_2X12_LE:
> +       case MEDIA_BUS_FMT_RGB888_2X12_BE:
> +       case MEDIA_BUS_FMT_YUYV8_1X16:
> +               return MTK_DPI_OUT_BIT_NUM_8BITS;
> +       }
> +}
> +
> +static unsigned int mtk_dpi_bus_fmt_channel_swap(unsigned int out_bus_format)
> +{
> +       switch (out_bus_format) {
> +       default:
> +       case MEDIA_BUS_FMT_RGB888_1X24:
> +       case MEDIA_BUS_FMT_RGB888_2X12_LE:
> +       case MEDIA_BUS_FMT_RGB888_2X12_BE:
> +       case MEDIA_BUS_FMT_YUYV8_1X16:
> +               return MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> +       }
> +}
> +
> +static unsigned int mtk_dpi_bus_fmt_color_format(unsigned int out_bus_format)
> +{
> +       switch (out_bus_format) {
> +       default:
> +       case MEDIA_BUS_FMT_RGB888_1X24:
> +       case MEDIA_BUS_FMT_RGB888_2X12_LE:
> +       case MEDIA_BUS_FMT_RGB888_2X12_BE:
> +               return MTK_DPI_COLOR_FORMAT_RGB;
> +       case MEDIA_BUS_FMT_YUYV8_1X16:
> +               return MTK_DPI_COLOR_FORMAT_YCBCR_422;
> +       }
> +}
> +
>  static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
>                                        struct drm_bridge_state *bridge_state,
>                                        struct drm_crtc_state *crtc_state,
> @@ -757,13 +794,10 @@ static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
>                 bridge_state->output_bus_cfg.format);
> 
>         dpi->output_fmt = out_bus_format;
> -       dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> -       dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> +       dpi->bit_num = mtk_dpi_bus_fmt_bit_num(out_bus_format);
> +       dpi->channel_swap = mtk_dpi_bus_fmt_channel_swap(out_bus_format);
>         dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> -       if (out_bus_format == MEDIA_BUS_FMT_YUYV8_1X16)
> -               dpi->color_format = MTK_DPI_COLOR_FORMAT_YCBCR_422;
> -       else
> -               dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> +       dpi->color_format = mtk_dpi_bus_fmt_color_format(out_bus_format);
> 
>         return 0;
>  }
> --
> 2.49.0
> 


  reply	other threads:[~2025-04-22  4:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09 13:13 [PATCH v1 0/5] MediaTek DPI: Cleanups and add support for more formats AngeloGioacchino Del Regno
2025-04-09 13:13 ` [PATCH v1 1/5] drm/mediatek: mtk_dpi: Use switch in mtk_dpi_config_color_format() AngeloGioacchino Del Regno
2025-04-22  3:30   ` CK Hu (胡俊光)
2025-04-09 13:13 ` [PATCH v1 2/5] drm/mediatek: mtk_dpi: Add local helpers for bus format parameters AngeloGioacchino Del Regno
2025-04-22  4:00   ` CK Hu (胡俊光) [this message]
2025-04-09 13:13 ` [PATCH v1 3/5] drm/mediatek: mtk_dpi: Add support for additional output formats AngeloGioacchino Del Regno
2025-04-22  5:50   ` CK Hu (胡俊光)
2025-04-09 13:13 ` [PATCH v1 4/5] drm/mediatek: mtk_dpi: Allow additional output formats on MT8195/88 AngeloGioacchino Del Regno
2025-04-22  6:01   ` CK Hu (胡俊光)
2025-04-22 13:42     ` AngeloGioacchino Del Regno
2025-04-23  3:45       ` CK Hu (胡俊光)
2025-04-09 13:13 ` [PATCH v1 5/5] drm/mediatek: mtk_dpi: Rename output fmts array for MT8195 DP_INTF AngeloGioacchino Del Regno
2025-04-22  6:04   ` CK Hu (胡俊光)
2025-04-27  1:47 ` [PATCH v1 0/5] MediaTek DPI: Cleanups and add support for more formats Chun-Kuang Hu

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=05abf54038b2fb066c64d0975ca2fe06e8c5be7f.camel@mediatek.com \
    --to=ck.hu@mediatek.com \
    --cc=Ives.Chenjh@mediatek.com \
    --cc=Jason-JH.Lin@mediatek.com \
    --cc=Lewis.Liao@mediatek.com \
    --cc=TommyYL.Chen@mediatek.com \
    --cc=airlied@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --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 \
    --cc=simona@ffwll.ch \
    /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®