[PATCH v1 7/7] drm/mediatek: Introduce HDMI/DDC v2 for MT8195/MT8188
CK Hu (胡俊光)
ck.hu at mediatek.com
Thu Dec 5 03:40:01 UTC 2024
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 at 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;
> +}
> +
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20241205/dc705e9f/attachment-0001.htm>
More information about the dri-devel
mailing list