summaryrefslogtreecommitdiff
path: root/sdm/libs/core/fb/hw_device.cpp
diff options
context:
space:
mode:
authorRamkumar Radhakrishnan <ramkumar@codeaurora.org>2016-08-15 22:28:19 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-09-06 12:23:21 -0700
commitb5245a74b2c3ec813ac2cb2f60172ee054e86f51 (patch)
tree0f40778ef30245a20525fe7dad4d4dc12a8fcf1a /sdm/libs/core/fb/hw_device.cpp
parent710bc97a15b70bb7d914d3ab3b660ef8be0c0858 (diff)
downloaddisplay-b5245a74b2c3ec813ac2cb2f60172ee054e86f51.tar.gz
sdm: Configure DP/DTV port based on the connection status.
1. Parse the connection status of each fb node on HDMI connection and configure DP/DTV port. 2. Enable HPD for all the pluggable displays. Change-Id: I0e410f82660e30174068fd4e397771cea90d34b6 CRs-Fixed: 1055148
Diffstat (limited to 'sdm/libs/core/fb/hw_device.cpp')
-rw-r--r--sdm/libs/core/fb/hw_device.cpp44
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;
}