]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/mediatek: mtk_hdmi: Move output init to mtk_hdmi_register_audio_driver()
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tue, 15 Apr 2025 10:43:12 +0000 (12:43 +0200)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Mon, 21 Apr 2025 13:52:59 +0000 (13:52 +0000)
In preparation for moving the common bits of this driver, merge the
contents of mtk_hdmi_output_init in mtk_hdmi_register_audio_driver
function to aggregate all of the initial audio setup together in
the same function and to make it clear that all of the setup that
is performed in mtk_hdmi_output_init is specifically related only
to audio and not video.

Reviewed-by: CK Hu <ck.hu@mediatek.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20250415104321.51149-15-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
drivers/gpu/drm/mediatek/mtk_hdmi.c

index cba1d3172472b08c89ce7d921de43b4593365573..1a0c8d092b6b8f69981c061ac152f088d148a0aa 100644 (file)
@@ -1025,20 +1025,6 @@ static int mtk_hdmi_setup_vendor_specific_infoframe(struct mtk_hdmi *hdmi,
        return 0;
 }
 
-static int mtk_hdmi_output_init(struct mtk_hdmi *hdmi)
-{
-       struct hdmi_audio_param *aud_param = &hdmi->aud_param;
-
-       aud_param->aud_codec = HDMI_AUDIO_CODING_TYPE_PCM;
-       aud_param->aud_sample_size = HDMI_AUDIO_SAMPLE_SIZE_16;
-       aud_param->aud_input_type = HDMI_AUD_INPUT_I2S;
-       aud_param->aud_i2s_fmt = HDMI_I2S_MODE_I2S_24BIT;
-       aud_param->aud_mclk = HDMI_AUD_MCLK_128FS;
-       aud_param->aud_input_chan_type = HDMI_AUD_CHAN_TYPE_2_0;
-
-       return 0;
-}
-
 static void mtk_hdmi_audio_enable(struct mtk_hdmi *hdmi)
 {
        mtk_hdmi_hw_send_aud_packet(hdmi, true);
@@ -1616,6 +1602,7 @@ static void mtk_hdmi_unregister_audio_driver(void *data)
 static int mtk_hdmi_register_audio_driver(struct device *dev)
 {
        struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
+       struct hdmi_audio_param *aud_param = &hdmi->aud_param;
        struct hdmi_codec_pdata codec_data = {
                .ops = &mtk_hdmi_audio_codec_ops,
                .max_i2s_channels = 2,
@@ -1625,6 +1612,13 @@ static int mtk_hdmi_register_audio_driver(struct device *dev)
        };
        int ret;
 
+       aud_param->aud_codec = HDMI_AUDIO_CODING_TYPE_PCM;
+       aud_param->aud_sample_size = HDMI_AUDIO_SAMPLE_SIZE_16;
+       aud_param->aud_input_type = HDMI_AUD_INPUT_I2S;
+       aud_param->aud_i2s_fmt = HDMI_I2S_MODE_I2S_24BIT;
+       aud_param->aud_mclk = HDMI_AUD_MCLK_128FS;
+       aud_param->aud_input_chan_type = HDMI_AUD_CHAN_TYPE_2_0;
+
        hdmi->audio_pdev = platform_device_register_data(dev,
                                                         HDMI_CODEC_DRV_NAME,
                                                         PLATFORM_DEVID_AUTO,
@@ -1666,11 +1660,6 @@ static int mtk_hdmi_probe(struct platform_device *pdev)
        mutex_init(&hdmi->update_plugged_status_lock);
        platform_set_drvdata(pdev, hdmi);
 
-       ret = mtk_hdmi_output_init(hdmi);
-       if (ret)
-               return dev_err_probe(dev, ret,
-                                    "Failed to initialize hdmi output\n");
-
        ret = mtk_hdmi_register_audio_driver(dev);
        if (ret)
                return dev_err_probe(dev, ret,