Merge tag 'drm-next-2018-10-24' of git://anongit.freedesktop.org/drm/drm
[platform/kernel/linux-starfive.git] / drivers / gpu / drm / mediatek / mtk_hdmi.c
index 643f5ed..862f3ec 100644 (file)
@@ -233,6 +233,7 @@ static void mtk_hdmi_hw_vid_black(struct mtk_hdmi *hdmi, bool black)
 static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool enable)
 {
        struct arm_smccc_res res;
+       struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(hdmi->phy);
 
        /*
         * MT8173 HDMI hardware has an output control bit to enable/disable HDMI
@@ -240,8 +241,13 @@ static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool enable)
         * The ARM trusted firmware provides an API for the HDMI driver to set
         * this control bit to enable HDMI output in supervisor mode.
         */
-       arm_smccc_smc(MTK_SIP_SET_AUTHORIZED_SECURE_REG, 0x14000904, 0x80000000,
-                     0, 0, 0, 0, 0, &res);
+       if (hdmi_phy->conf && hdmi_phy->conf->tz_disabled)
+               regmap_update_bits(hdmi->sys_regmap,
+                                  hdmi->sys_offset + HDMI_SYS_CFG20,
+                                  0x80008005, enable ? 0x80000005 : 0x8000);
+       else
+               arm_smccc_smc(MTK_SIP_SET_AUTHORIZED_SECURE_REG, 0x14000904,
+                             0x80000000, 0, 0, 0, 0, 0, &res);
 
        regmap_update_bits(hdmi->sys_regmap, hdmi->sys_offset + HDMI_SYS_CFG20,
                           HDMI_PCLK_FREE_RUN, enable ? HDMI_PCLK_FREE_RUN : 0);
@@ -1576,6 +1582,11 @@ static int mtk_hdmi_audio_hw_params(struct device *dev, void *data,
                hdmi_params.aud_i2s_fmt = HDMI_I2S_MODE_I2S_24BIT;
                hdmi_params.aud_mclk = HDMI_AUD_MCLK_128FS;
                break;
+       case HDMI_SPDIF:
+               hdmi_params.aud_codec = HDMI_AUDIO_CODING_TYPE_PCM;
+               hdmi_params.aud_sampe_size = HDMI_AUDIO_SAMPLE_SIZE_16;
+               hdmi_params.aud_input_type = HDMI_AUD_INPUT_SPDIF;
+               break;
        default:
                dev_err(hdmi->dev, "%s: Invalid DAI format %d\n", __func__,
                        daifmt->fmt);