Linux-mediatek Archive on lore.kernel.org
 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: "robh@kernel.org" <robh@kernel.org>,
	"tzimmermann@suse.de" <tzimmermann@suse.de>,
	"simona@ffwll.ch" <simona@ffwll.ch>,
	"mripard@kernel.org" <mripard@kernel.org>,
	"kernel@collabora.com" <kernel@collabora.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"maarten.lankhorst@linux.intel.com"
	<maarten.lankhorst@linux.intel.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"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 v1 7/7] drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188
Date: Thu, 5 Dec 2024 03:40:01 +0000	[thread overview]
Message-ID: <d9ca3245c89813d78e7a25aa9d4a0868fb30d27e.camel@mediatek.com> (raw)
In-Reply-To: <20241120124512.134278-8-angelogioacchino.delregno@collabora.com>

Hi, Angelo:

On Wed, 2024-11-20 at 13:45 +0100, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
> 
> 
> Add support for the newer HDMI-TX (Encoder) v2 and DDC v2 IPs
> found in MediaTek's MT8195, MT8188 SoC and their variants, and
> including support for display modes up to 4k60 and for HDMI
> Audio, as per the HDMI 2.0 spec.
> 
> HDCP and CEC functionalities are also supported by this hardware,
> but are not included in this commit.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---

[snip]

> +static int mtk_hdmi_v2_audio_hw_params(struct device *dev, void *data,
> +                                   struct hdmi_codec_daifmt *codec_daifmt,
> +                                   struct hdmi_codec_params *codec_params)
> +{

This function is almost the same as v1.
Try to make this function as common function.

Regards,
CK

> +       struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
> +       struct hdmi_audio_param aud_params = { 0 };
> +
> +       if (!hdmi->bridge.encoder)
> +               return -ENODEV;
> +
> +       switch (codec_params->cea.channels) {
> +       case 2:
> +               aud_params.aud_input_chan_type = HDMI_AUD_CHAN_TYPE_2_0;
> +               break;
> +       case 4:
> +               aud_params.aud_input_chan_type = HDMI_AUD_CHAN_TYPE_4_0;
> +               break;
> +       case 6:
> +               aud_params.aud_input_chan_type = HDMI_AUD_CHAN_TYPE_5_1;
> +               break;
> +       case 8:
> +               aud_params.aud_input_chan_type = HDMI_AUD_CHAN_TYPE_7_1;
> +               break;
> +       default:
> +               return -EINVAL;
> +       }
> +
> +       switch (codec_params->sample_rate) {
> +       case 32000:
> +       case 44100:
> +       case 48000:
> +       case 88200:
> +       case 96000:
> +       case 176400:
> +       case 192000:
> +               break;
> +       default:
> +               return -EINVAL;
> +       }
> +
> +       switch (codec_daifmt->fmt) {
> +       case HDMI_I2S:
> +               aud_params.aud_codec = HDMI_AUDIO_CODING_TYPE_PCM;
> +               aud_params.aud_sample_size = HDMI_AUDIO_SAMPLE_SIZE_16;
> +               aud_params.aud_input_type = HDMI_AUD_INPUT_I2S;
> +               aud_params.aud_i2s_fmt = HDMI_I2S_MODE_I2S_24BIT;
> +               aud_params.aud_mclk = HDMI_AUD_MCLK_128FS;
> +               break;
> +       default:
> +               return -EINVAL;
> +       }
> +
> +       memcpy(&aud_params.codec_params, codec_params, sizeof(aud_params.codec_params));
> +       mtk_hdmi_v2_audio_set_param(hdmi, &aud_params);
> +
> +       return 0;
> +}
> +

> 


  parent reply	other threads:[~2024-12-05  3:40 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-20 12:45 [PATCH v1 0/7] drm/mediatek: Add support for HDMIv2 and DDCv2 IPs AngeloGioacchino Del Regno
2024-11-20 12:45 ` [PATCH v1 1/7] dt-bindings: display: mediatek: Add binding for HDMIv2 DDC AngeloGioacchino Del Regno
2024-11-21 21:02   ` Rob Herring
2024-11-25 14:30     ` AngeloGioacchino Del Regno
2024-12-03 16:50   ` Rob Herring (Arm)
2024-11-20 12:45 ` [PATCH v1 2/7] dt-bindings: display: mediatek: Add binding for MT8195 HDMI-TX v2 AngeloGioacchino Del Regno
2024-11-20 14:29   ` Rob Herring (Arm)
2024-11-28  6:02   ` CK Hu (胡俊光)
2024-11-28 10:32     ` AngeloGioacchino Del Regno
2024-11-29  2:51       ` CK Hu (胡俊光)
2024-12-04 15:01         ` AngeloGioacchino Del Regno
2024-11-20 12:45 ` [PATCH v1 3/7] drm/mediatek: mtk_cec: Switch to register as module_platform_driver AngeloGioacchino Del Regno
2024-11-22 14:59   ` kernel test robot
2024-11-20 12:45 ` [PATCH v1 4/7] drm/mediatek: mtk_hdmi_ddc: " AngeloGioacchino Del Regno
2024-11-20 12:45 ` [PATCH v1 5/7] drm/mediatek: hdmi: Use regmap instead of iomem for main registers AngeloGioacchino Del Regno
2024-11-20 12:45 ` [PATCH v1 6/7] drm/mediatek: mtk_hdmi: Split driver and add common probe function AngeloGioacchino Del Regno
2024-11-29  4:02   ` CK Hu (胡俊光)
2024-11-29  7:28   ` CK Hu (胡俊光)
2024-12-02  2:52   ` CK Hu (胡俊光)
2024-12-05  3:16   ` CK Hu (胡俊光)
2024-11-20 12:45 ` [PATCH v1 7/7] drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188 AngeloGioacchino Del Regno
2024-11-22  9:20   ` Maxime Ripard
2024-11-25  9:40     ` AngeloGioacchino Del Regno
2024-11-25 10:13       ` Maxime Ripard
2024-11-26  7:42   ` CK Hu (胡俊光)
2024-11-26  8:57     ` AngeloGioacchino Del Regno
2024-11-27  3:08       ` CK Hu (胡俊光)
2024-11-27  8:42         ` AngeloGioacchino Del Regno
2024-11-29  5:53   ` CK Hu (胡俊光)
2024-12-02  5:18   ` CK Hu (胡俊光)
2024-12-02  7:27   ` CK Hu (胡俊光)
2024-12-04 14:44     ` AngeloGioacchino Del Regno
2024-12-05  2:42       ` CK Hu (胡俊光)
2024-12-05  2:48         ` CK Hu (胡俊光)
2024-12-05  9:28           ` AngeloGioacchino Del Regno
2024-12-03  7:44   ` CK Hu (胡俊光)
2024-12-04  7:08   ` CK Hu (胡俊光)
2024-12-04  9:41   ` CK Hu (胡俊光)
2024-12-04  9:46   ` CK Hu (胡俊光)
2024-12-05  3:40   ` CK Hu (胡俊光) [this message]
2024-12-05  8:35   ` CK 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=d9ca3245c89813d78e7a25aa9d4a0868fb30d27e.camel@mediatek.com \
    --to=ck.hu@mediatek.com \
    --cc=airlied@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@collabora.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mripard@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.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