diff --git a/task/thermal/src/bsp/gimlet_bcdef.rs b/task/thermal/src/bsp/gimlet_bcdef.rs index 875316dc4..fdb3b8851 100644 --- a/task/thermal/src/bsp/gimlet_bcdef.rs +++ b/task/thermal/src/bsp/gimlet_bcdef.rs @@ -13,7 +13,6 @@ use crate::{ }; pub use drv_gimlet_seq_api::SeqError; use drv_gimlet_seq_api::{PowerState, Sequencer}; -use drv_i2c_devices::max31790::Max31790; use task_sensor_api::SensorId; use task_thermal_api::ThermalProperties; use userlib::{task_slot, units::Celsius, TaskId, UnwrapLite}; @@ -166,8 +165,7 @@ impl Bsp { pub fn new(i2c_task: TaskId) -> Self { // Initializes and build a handle to the fan controller IC - let fctrl = - Max31790State::new(Max31790::new(&devices::max31790(i2c_task)[0])); + let fctrl = Max31790State::new(&devices::max31790(i2c_task)[0]); // Handle for the sequencer task, which we check for power state let seq = Sequencer::from(SEQ.get_task_id()); diff --git a/task/thermal/src/bsp/sidecar_bcd.rs b/task/thermal/src/bsp/sidecar_bcd.rs index 4bb76ef9b..e1b35dde5 100644 --- a/task/thermal/src/bsp/sidecar_bcd.rs +++ b/task/thermal/src/bsp/sidecar_bcd.rs @@ -8,7 +8,6 @@ use crate::control::{ ChannelType, ControllerInitError, Device, FanControl, Fans, InputChannel, Max31790State, PidConfig, TemperatureSensor, }; -use drv_i2c_devices::max31790::Max31790; use drv_i2c_devices::tmp451::*; pub use drv_sidecar_seq_api::SeqError; use drv_sidecar_seq_api::{Sequencer, TofinoSeqState, TofinoSequencerPolicy}; @@ -128,11 +127,11 @@ impl Bsp { // Run the function on each fan control chip match self.fan_control(0.into()) { Ok(c) => fctrl(c), - Err(e) => last_err = Err(e.into()), + Err(e) => last_err = Err(e), } match self.fan_control(4.into()) { Ok(c) => fctrl(c), - Err(e) => last_err = Err(e.into()), + Err(e) => last_err = Err(e), } last_err } @@ -174,12 +173,8 @@ impl Bsp { // fan presence let seq = Sequencer::from(SEQUENCER.get_task_id()); - let fctrl_east = Max31790State::new(Max31790::new( - &devices::max31790_east(i2c_task), - )); - let fctrl_west = Max31790State::new(Max31790::new( - &devices::max31790_west(i2c_task), - )); + let fctrl_east = Max31790State::new(&devices::max31790_east(i2c_task)); + let fctrl_west = Max31790State::new(&devices::max31790_west(i2c_task)); Self { seq, diff --git a/task/thermal/src/control.rs b/task/thermal/src/control.rs index ca6978676..930a5eee1 100644 --- a/task/thermal/src/control.rs +++ b/task/thermal/src/control.rs @@ -6,7 +6,7 @@ use crate::{ bsp::{self, Bsp, PowerBitmask}, Fan, ThermalError, Trace, }; -use drv_i2c_api::ResponseCode; +use drv_i2c_api::{I2cDevice, ResponseCode}; use drv_i2c_devices::{ max31790::{I2cWatchdog, Max31790}, nvme_bmc::NvmeBmc, @@ -295,9 +295,9 @@ pub(crate) struct Max31790State { } impl Max31790State { - pub(crate) fn new(max31790: Max31790) -> Self { + pub(crate) fn new(dev: &I2cDevice) -> Self { let mut this = Self { - max31790, + max31790: Max31790::new(dev), initialized: false, }; // When we first start up, try to initialize the fan controller a few