uint16_t num_bytes,
CDN_BUS_TYPE bus_type)
{
- internal_block_function(CDN_API_General_Test_Echo_Ext
- (msg, resp, num_bytes, bus_type)
- );
+ internal_block_function_udelay(CDN_API_General_Test_Echo_Ext
+ (msg, resp, num_bytes, bus_type), 1000);
}
CDN_API_STATUS CDN_API_General_getCurVersion(unsigned short *ver,
CDN_API_STATUS CDN_API_CheckAlive_blocking(void)
{
- internal_block_function(CDN_API_CheckAlive());
+ internal_block_function_udelay(CDN_API_CheckAlive(), 1000);
}
CDN_API_STATUS CDN_API_MainControl(unsigned char mode, unsigned char *resp)
*/
#ifndef UTIL_H_
-# define UTIL_H_
+#define UTIL_H_
-# include "API_General.h"
+#include <linux/delay.h>
+#include "API_General.h"
/**
* \addtogroup UTILS
* \{
return ret; \
} while (0)
+/**
+ * \brief expands to blocking function body
+ * \param x - function call
+ * \param y - num of loop
+ */
+# define internal_block_function_udelay(x, y) \
+do { \
+ CDN_API_STATUS ret; \
+ int i; \
+ for (i = 0; i < y; i++) { \
+ ret = x; \
+ if (ret == CDN_OK) \
+ break; \
+ udelay(1); \
+ } \
+ if (i == y) \
+ printk("timeout %s\n", __func__); \
+ return ret; \
+} while (0)
+
/**
* \brief write message and write response (if any), non-blocking way. Also sets state.running = 0
*/
ret = CDN_API_CheckAlive_blocking();
printk("CDN_API_CheckAlive returned ret = %d\n", ret);
+ if (ret != 0) {
+ printk("NO HDMI FW running\n");
+ return -EINVAL;
+ }
ret = CDN_API_General_Test_Echo_Ext_blocking(echo_msg, echo_resp,
sizeof(echo_msg),
printk
("CDN_API_General_Test_Echo_Ext_blocking - APB(ret = %d echo_resp = %s)\n",
ret, echo_resp);
+ if (ret != 0) {
+ printk("HDMI mailbox access failed\n");
+ return -EINVAL;
+ }
+
/* Configure PHY */
character_freq_khz =
phy_cfg_hdp(4, vic_mode, bps, format, pixel_clk_from_phy);
/* 0-480p, 1-720p, 2-1080p, 3-2160p60, 4-2160p30 */
/* Pixel Format - 1 RGB, 2 YCbCr 444, 3 YCbCr 420 */
if (vmode_index == 16)
- hdmi_init(2, 1, 8);
+ ret = hdmi_init(2, 1, 8);
else if (vmode_index == 97)
- hdmi_init(3, 1, 8);
+ ret = hdmi_init(3, 1, 8);
else if (vmode_index == 95)
- hdmi_init(4, 1, 8);
+ ret = hdmi_init(4, 1, 8);
else
- hdmi_init(1, 1, 8);
+ ret = hdmi_init(1, 1, 8);
+
+ if (ret < 0)
+ return -EINVAL;
+
dev_info(&pdev->dev, "i.MX HDMI driver probed\n");
return ret;