Disabling HDP firmware loading except for debug.
Added simple checks to test HDP firmware status.
Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
*/
#include <linux/clk.h>
+#ifdef DEBUG_FW_LOAD
#include "mhdp_firmware.h"
+#endif
#include "imx-hdp.h"
#include "imx-hdmi.h"
#include "imx-dp.h"
+#ifdef DEBUG_FW_LOAD
void dp_fw_load(state_struct *state)
{
pr_info("loading hdmi firmware\n");
(u8 *)mhdp_dram0_get_ptr(),
mhdp_dram0_get_size());
}
-
-void dp_fw_init(state_struct *state)
+#endif
+int dp_fw_init(state_struct *state)
{
u8 echo_msg[] = "echo test";
u8 echo_resp[sizeof(echo_msg) + 1];
pr_info("Started firmware!\n");
ret = CDN_API_CheckAlive_blocking(state);
- pr_info("CDN_API_CheckAlive returned (ret = %d)\n", ret);
+ if (ret != 0) {
+ pr_err("CDN_API_CheckAlive failed - check firmware!\n");
+ return -ENXIO;
+ } else
+ pr_info("CDN_API_CheckAlive returned ret = %d\n", ret);
/* turn on IP activity */
ret = CDN_API_MainControl_blocking(state, 1, &resp);
ret = CDN_API_General_Test_Echo_Ext_blocking(state, echo_msg, echo_resp,
sizeof(echo_msg), CDN_BUS_TYPE_APB);
+ if (0 != strncmp(echo_msg, echo_resp, sizeof(echo_msg))) {
+ pr_err("CDN_API_General_Test_Echo_Ext_blocking - echo test failed, check firmware!");
+ return -ENXIO;
+ }
pr_info("CDN_API_General_Test_Echo_Ext_blocking (ret = %d echo_resp = %s)\n",
ret, echo_resp);
CDN_API_General_Write_Register_blocking(state,
ADDR_SOURCD_PHY + (LANES_CONFIG << 2), 0x0040001b);
pr_info("CDN_API_General_Write_Register_blockin ... setting LANES_CONFIG\n");
+
+ return 0;
}
int dp_phy_init(state_struct *state, int vic, int format, int color_depth)
#define _IMX_DP_H_
void dp_fw_load(state_struct *state);
-void dp_fw_init(state_struct *state);
+int dp_fw_init(state_struct *state);
void dp_mode_set(state_struct *state, int vic, int format, int color_depth, int max_link_rate);
int dp_phy_init(state_struct *state, int vic, int format, int color_depth);
int dp_get_edid_block(void *data, u8 *buf, u32 block, size_t len);
*/
#include <linux/clk.h>
+#ifdef DEBUG_FW_LOAD
#include "hdmitx_firmware.h"
+#endif
#include "imx-hdp.h"
#include "imx-hdmi.h"
#include "API_AFE_ss28fdsoi_kiran_hdmitx.h"
#include "API_AFE_t28hpc_hdmitx.h"
static int character_freq_khz;
-
+#ifdef DEBUG_FW_LOAD
void hdmi_fw_load(state_struct *state)
{
pr_info("loading hdmi firmware\n");
(u8 *)hdmitx_dram0_get_ptr(),
hdmitx_dram0_get_size());
}
-
-void hdmi_fw_init(state_struct *state)
+#endif
+int hdmi_fw_init(state_struct *state)
{
u8 echo_msg[] = "echo test";
u8 echo_resp[sizeof(echo_msg) + 1];
pr_info("Started firmware!\n");
ret = CDN_API_CheckAlive_blocking(state);
- pr_info("CDN_API_CheckAlive returned ret = %d\n", ret);
+ if (ret != 0) {
+ pr_err("CDN_API_CheckAlive failed - check firmware!\n");
+ return -ENXIO;
+ } else
+ pr_info("CDN_API_CheckAlive returned ret = %d\n", ret);
/* turn on IP activity */
ret = CDN_API_MainControl_blocking(state, 1, &sts);
ret = CDN_API_General_Test_Echo_Ext_blocking(state, echo_msg, echo_resp,
sizeof(echo_msg), CDN_BUS_TYPE_APB);
- pr_info("CDN_API_General_Test_Echo_Ext_blocking - APB(ret = %d echo_resp = %s)\n",
- ret, echo_resp);
+
+ if (0 != strncmp(echo_msg, echo_resp, sizeof(echo_msg))) {
+ pr_err("CDN_API_General_Test_Echo_Ext_blocking - echo test failed, check firmware!");
+ return -ENXIO;
+ }
+ pr_info("CDN_API_General_Test_Echo_Ext_blocking - APB(ret = %d echo_resp = %s)\n",
+ ret, echo_resp);
+
+ return 0;
}
int hdmi_phy_init(state_struct *state, int vic, int format, int color_depth)
#define _IMX_HDMI_H_
void hdmi_fw_load(state_struct *state);
-void hdmi_fw_init(state_struct *state);
+int hdmi_fw_init(state_struct *state);
int hdmi_phy_init(state_struct *state, int vic, int format, int color_depth);
void hdmi_mode_set(state_struct *state, int vic, int format, int color_depth, int temp);
int hdmi_get_edid_block(void *data, u8 *buf, u32 block, size_t len);
};
static struct hdp_ops imx8qm_dp_ops = {
+#ifdef DEBUG_FW_LOAD
.fw_load = dp_fw_load,
+#endif
.fw_init = dp_fw_init,
.phy_init = dp_phy_init,
.mode_set = dp_mode_set,
};
static struct hdp_ops imx8qm_hdmi_ops = {
+#ifdef DEBUG_FW_LOAD
.fw_load = hdmi_fw_load,
+#endif
.fw_init = hdmi_fw_init,
.phy_init = hdmi_phy_init,
.mode_set = hdmi_mode_set,
imx_hdp_call(hdp, fw_load, &hdp->state);
- imx_hdp_call(hdp, fw_init, &hdp->state);
+ ret = imx_hdp_call(hdp, fw_init, &hdp->state);
+ if (ret < 0) {
+ pr_err("Failed to initialise HDP firmware\n");
+ DRM_ERROR("Failed to initialise HDP firmware\n");
+ return ret;
+ }
/* Pixel Format - 1 RGB, 2 YCbCr 444, 3 YCbCr 420 */
/* bpp (bits per subpixel) - 8 24bpp, 10 30bpp, 12 36bpp, 16 48bpp */
#include <drm/drm_dp_helper.h>
#include "../../../../mxc/hdp/all.h"
+/* For testing hdp firmware define DEBUG_FW_LOAD */
+#undef DEBUG_FW_LOAD
#define PLL_1188MHZ (1188000000)
#define PLL_675MHZ (675000000)
struct hdp_ops {
void (*fw_load)(state_struct *state);
- void (*fw_init)(state_struct *state);
+ int (*fw_init)(state_struct *state);
int (*phy_init)(state_struct *state, int vic, int format, int color_depth);
void (*mode_set)(state_struct *state, int vic, int format, int color_depth, int max_link);
int (*get_edid_block)(void *data, u8 *buf, u32 block, size_t len);