MLK-18368-3: hdp: add CDN_API_InfoframeRemovePacket function
authorShengjiu Wang <shengjiu.wang@nxp.com>
Tue, 22 May 2018 07:31:07 +0000 (15:31 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
add function to remove infoframe base on the packet type.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
drivers/gpu/drm/imx/hdp/imx-hdp-audio.c
drivers/mxc/hdp/API_Infoframe.c
drivers/mxc/hdp/API_Infoframe.h

index 05cfe89..48bcc1e 100644 (file)
@@ -165,6 +165,10 @@ static int imx_hdp_audio_hw_params(struct device *dev, void *data,
 
 static void imx_hdp_audio_shutdown(struct device *dev, void *data)
 {
+       struct imx_hdp *hdmi = dev_get_drvdata(dev);
+       state_struct *state = &hdmi->state;
+
+       CDN_API_InfoframeRemovePacket(state, 0x1, 0x84);
 }
 
 static int imx_hdp_audio_get_eld(struct device *dev, void *data, uint8_t *buf, size_t len)
index eb6c5e8..2a4e973 100644 (file)
@@ -144,3 +144,20 @@ CDN_API_STATUS CDN_API_InfoframeRemove(state_struct *state, u8 entry_id)
 
        return CDN_OK;
 }
+
+CDN_API_STATUS CDN_API_InfoframeRemovePacket(state_struct *state, u8 entry_id, u8 packet_type)
+{
+       /* invalidate entry */
+       if (cdn_apb_write
+           (state,
+            BANK_OFFSET | ADDR_SOURCE_PIF | (SOURCE_PIF_PKT_ALLOC_REG << 2),
+            0x20000 | F_PKT_ALLOC_ADDRESS(entry_id) |  F_PACKET_TYPE(packet_type)))
+               return CDN_ERR;
+       if (cdn_apb_write
+           (state,
+            BANK_OFFSET | ADDR_SOURCE_PIF | (SOURCE_PIF_PKT_ALLOC_WR_EN << 2),
+            F_PKT_ALLOC_WR_EN(1)))
+               return CDN_ERR;
+
+       return CDN_OK;
+}
index d8811e7..492eb66 100644 (file)
@@ -59,5 +59,6 @@ CDN_API_STATUS CDN_API_InfoframeSetNoActiveIdle(state_struct *state,
                                                u8 entry_id, u8 packet_len,
                                                u32 *packet, u8 packet_type);
 CDN_API_STATUS CDN_API_InfoframeRemove(state_struct *state, u8 entry_id);
+CDN_API_STATUS CDN_API_InfoframeRemovePacket(state_struct *state, u8 entry_id, u8 packet_type);
 
 #endif