From 3d821401553a7e727a320c1f1bcab689d845cf94 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 22 Dec 2025 16:53:40 +0100 Subject: [PATCH] drivers/graphics/ihdgd: Minor EDID reading improvements * Enable unproven feature of embedded-hal. We depend on it. Currently it gets implicitly enabled by bitbang-hal. * Reduce nesting in probe_edid --- drivers/graphics/ihdgd/Cargo.toml | 2 +- drivers/graphics/ihdgd/src/device/ddi.rs | 39 +++++++++++------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/drivers/graphics/ihdgd/Cargo.toml b/drivers/graphics/ihdgd/Cargo.toml index d73bf7c134..1f3c18c6ef 100644 --- a/drivers/graphics/ihdgd/Cargo.toml +++ b/drivers/graphics/ihdgd/Cargo.toml @@ -9,7 +9,7 @@ drm-sys = "0.8.0" #TODO: edid is abandoned, fork it an maintain? edid = "0.3.0" #TODO: waiting for bitbang-hal to update to embedded-hal 1.0 -embedded-hal = "0.2.7" +embedded-hal = { version = "0.2.7", features = ["unproven"] } log.workspace = true nb = "1.0" # Patched to allow for exact range allocation diff --git a/drivers/graphics/ihdgd/src/device/ddi.rs b/drivers/graphics/ihdgd/src/device/ddi.rs index 64c51bfd91..ac4ce1bd87 100644 --- a/drivers/graphics/ihdgd/src/device/ddi.rs +++ b/drivers/graphics/ihdgd/src/device/ddi.rs @@ -274,31 +274,26 @@ impl Ddi { Ok(edid_data) }; - let (source, edid_data) = match aux_read_edid(self) { - Ok(edid_data) => ("AUX", edid_data), + match aux_read_edid(self) { + Ok(edid_data) => return Ok(Some(("AUX", edid_data))), Err(err) => { log::debug!("DDI {} failed to read EDID from AUX: {}", self.name, err); - match gmbus_read_edid(self) { - Ok(edid_data) => ("GMBUS", edid_data), - Err(err) => { - log::debug!("DDI {} failed to read EDID from GMBUS: {}", self.name, err); - match gpio_read_edid(self) { - Ok(edid_data) => ("GPIO", edid_data), - Err(err) => { - log::debug!( - "DDI {} failed to read EDID from GPIO: {}", - self.name, - err - ); - // Will try again but not fail the driver - return Ok(None); - } - } - } - } } - }; - Ok(Some((source, edid_data))) + } + match gmbus_read_edid(self) { + Ok(edid_data) => return Ok(Some(("GMBUS", edid_data))), + Err(err) => { + log::debug!("DDI {} failed to read EDID from GMBUS: {}", self.name, err); + } + } + match gpio_read_edid(self) { + Ok(edid_data) => return Ok(Some(("GPIO", edid_data))), + Err(err) => { + log::debug!("DDI {} failed to read EDID from GPIO: {}", self.name, err); + } + } + // Will try again but not fail the driver + Ok(None) } pub fn voltage_swing_hdmi(