diff options
Diffstat (limited to 'sdm/libs/core/fb/hw_device.cpp')
-rw-r--r-- | sdm/libs/core/fb/hw_device.cpp | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/sdm/libs/core/fb/hw_device.cpp b/sdm/libs/core/fb/hw_device.cpp index f75e92ad..3d5cb78a 100644 --- a/sdm/libs/core/fb/hw_device.cpp +++ b/sdm/libs/core/fb/hw_device.cpp @@ -737,7 +737,7 @@ void HWDevice::SetMDPFlags(const Layer *layer, const bool &is_rotator_used, } int HWDevice::GetFBNodeIndex(HWDeviceType device_type) { - for (int i = 0; i <= kDeviceVirtual; i++) { + for (int i = 0; i < kFBNodeMax; i++) { HWPanelInfo panel_info; GetHWPanelInfoByNode(i, &panel_info); switch (device_type) { @@ -748,7 +748,9 @@ int HWDevice::GetFBNodeIndex(HWDeviceType device_type) { break; case kDeviceHDMI: if (panel_info.is_pluggable == true) { - return i; + if (IsFBNodeConnected(i)) { + return i; + } } break; case kDeviceVirtual: @@ -990,17 +992,20 @@ int HWDevice::ParseLine(const char *input, const char *delim, char *tokens[], bool HWDevice::EnableHotPlugDetection(int enable) { char hpdpath[kMaxStringLength]; - int hdmi_node_index = GetFBNodeIndex(kDeviceHDMI); - if (hdmi_node_index < 0) { - return false; - } + char value = enable ? '1' : '0'; - snprintf(hpdpath , sizeof(hpdpath), "%s%d/hpd", fb_path_, hdmi_node_index); + // Enable HPD for all pluggable devices. + for (int i = 0; i < kFBNodeMax; i++) { + HWPanelInfo panel_info; + GetHWPanelInfoByNode(i, &panel_info); + if (panel_info.is_pluggable == true) { + snprintf(hpdpath , sizeof(hpdpath), "%s%d/hpd", fb_path_, i); - char value = enable ? '1' : '0'; - ssize_t length = SysFsWrite(hpdpath, &value, sizeof(value)); - if (length <= 0) { - return false; + ssize_t length = SysFsWrite(hpdpath, &value, sizeof(value)); + if (length <= 0) { + return false; + } + } } return true; @@ -1165,6 +1170,23 @@ ssize_t HWDevice::SysFsWrite(const char* file_node, const char* value, ssize_t l return len; } +bool HWDevice::IsFBNodeConnected(int fb_node) { + string file_name = fb_path_ + to_string(fb_node) + "/connected"; + + Sys::fstream fs(file_name, fstream::in); + if (!fs.is_open()) { + DLOGW("File not found %s", file_name.c_str()); + return false; + } + + string line; + if (!Sys::getline_(fs, line)) { + return false; + } + + return atoi(line.c_str()); +} + DisplayError HWDevice::SetS3DMode(HWS3DMode s3d_mode) { return kErrorNotSupported; } |