libdrm_meson: printf detect set fail for HDMIA [1/1]

PD#SWPL-174660

Problem:
printf detect set fail for HDMIA

Solution:
add write patch

Verify:
AH212

Change-Id: I9d955a8e3772dc6ec5f6a9da0c09d83b63e45f05
Signed-off-by: chen.wang1 <chen.wang1@amlogic.com>
diff --git a/meson/libdrm_meson_connector.c b/meson/libdrm_meson_connector.c
index 00755bc..606840a 100644
--- a/meson/libdrm_meson_connector.c
+++ b/meson/libdrm_meson_connector.c
@@ -18,8 +18,31 @@
 #include <linux/version.h>
 #include "meson_drm_log.h"
 
-#define MESON_DRM_MODE_GETCONNECTOR_HDMI     "/sys/class/drm/card0-HDMI-A-1/status"
+#define MESON_DRM_MODE_GETCONNECTOR_HDMI_A_C    "/sys/class/drm/card0-HDMI-A-C/status"
+#define MESON_DRM_MODE_GETCONNECTOR_HDMI_A_A    "/sys/class/drm/card0-HDMI-A-A/status"
+#define MESON_DRM_MODE_GETCONNECTOR_HDMI_A_1    "/sys/class/drm/card0-HDMI-A-1/status"
 #define MESON_DRM_MODE_GETCONNECTOR_VBYONE    "/sys/class/drm/card0-VBYONE-A/status"
+#define MESON_DRM_MODE_GETCONNECTOR_LVDS_A    "/sys/class/drm/card0-LVDS-A/status"
+
+typedef struct {
+    const char *path;
+    const char *status;
+    const char *path_type;
+} ConnectorInfo;
+
+const ConnectorInfo hdmi_a_connectors[] = {
+    {MESON_DRM_MODE_GETCONNECTOR_HDMI_A_C, "detect", "HDMI-A-C"},
+    {MESON_DRM_MODE_GETCONNECTOR_HDMI_A_A, "detect", "HDMI-A-A"},
+    {MESON_DRM_MODE_GETCONNECTOR_HDMI_A_1, "detect", "HDMI-A-1"}
+};
+
+const ConnectorInfo lvds_connector[] = {
+    {MESON_DRM_MODE_GETCONNECTOR_VBYONE, "detect", "VBYONE"},
+    {MESON_DRM_MODE_GETCONNECTOR_LVDS_A, "detect", "LVDS_A"}
+};
+
+#define HDMI_A_CONNECTORS_COUNT (sizeof(hdmi_a_connectors) / sizeof(hdmi_a_connectors[0]))
+#define LVDS_CONNECTORS_COUNT (sizeof(lvds_connector) / sizeof(lvds_connector[0]))
 
 struct mesonConnector {
 int type;
@@ -151,20 +174,32 @@
 	}
 	for ( i= 0; i < res->count_connectors; ++i ) {
 		if ( type == DRM_MODE_CONNECTOR_HDMIA ) {
-			if (0 != meson_amsysfs_set_sysfs_strs(MESON_DRM_MODE_GETCONNECTOR_HDMI, "detect"))
-				ERROR("\n %s %d detect set fail for HDMIA\n", __FUNCTION__,__LINE__);
-	   } else if ( type == DRM_MODE_CONNECTOR_LVDS ) {
-			if (0 != meson_amsysfs_set_sysfs_strs(MESON_DRM_MODE_GETCONNECTOR_VBYONE, "detect"))
-				ERROR("\n %s %d detect set fail for LVDS\n", __FUNCTION__,__LINE__);
-	   }
-	   conn= drmModeGetConnector( drmFd, res->connectors[i] );
-	   if ( conn ) {
-		  if ( conn->connector_type == type ) {    //是否需要判断当前connector是否连接
-			 break;
-		  }
-		  drmModeFreeConnector(conn);
-		  conn= NULL;
-	   }
+			for (int i = 0; i < HDMI_A_CONNECTORS_COUNT; i++) {
+				if (0 != meson_amsysfs_set_sysfs_strs(hdmi_a_connectors[i].path, hdmi_a_connectors[i].status)) {
+					DEBUG("%s %d %s detect set fail for HDMIA\n", __FUNCTION__, __LINE__, hdmi_a_connectors[i].path_type);
+				} else {
+					DEBUG("%s %d %s detect set success for HDMIA\n", __FUNCTION__, __LINE__, hdmi_a_connectors[i].path_type);
+					break;
+				}
+			}
+		} else if ( type == DRM_MODE_CONNECTOR_LVDS ) {
+			for (int i = 0; i < LVDS_CONNECTORS_COUNT; i++) {
+				if (0 != meson_amsysfs_set_sysfs_strs(lvds_connector[i].path, lvds_connector[i].status)) {
+					DEBUG("%s %d %s detect set fail for LVDS\n", __FUNCTION__, __LINE__, lvds_connector[i].path_type);
+				} else {
+					DEBUG("%s %d %s detect set success for LVDS\n", __FUNCTION__, __LINE__, lvds_connector[i].path_type);
+					break;
+				}
+			}
+		}
+		conn= drmModeGetConnector( drmFd, res->connectors[i] );
+		if ( conn ) {
+			if ( conn->connector_type == type ) {
+				break;
+		}
+		drmModeFreeConnector(conn);
+		conn= NULL;
+		}
 	}
 	if ( !conn ) {
 		free(ret);