diff options
author | Maxim Polyakov <max.senia.poliak@gmail.com> | 2020-11-23 15:47:51 +0300 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2020-12-02 22:22:50 +0000 |
commit | b7eca6f123f8b04250b94380b5ac1c234a875728 (patch) | |
tree | f98c4ed8218c65aaceac7e69d28630218501b5af /src/drivers | |
parent | d17ce41e29018176ad43f5228f17ba93cab4a346 (diff) |
drivers/i2c/nct7802y: Move the sensor initialization procedure
The current location for the sensor initialization procedure was chosen
by mistake. Move this into a separate function in nct7802y.c .
Change-Id: I093ae75db5f0051bff65375b0720c86642b9148a
Signed-off-by: Maxim Polyakov <max.senia.poliak@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47861
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/i2c/nct7802y/nct7802y.c | 15 | ||||
-rw-r--r-- | src/drivers/i2c/nct7802y/nct7802y_fan.c | 7 |
2 files changed, 15 insertions, 7 deletions
diff --git a/src/drivers/i2c/nct7802y/nct7802y.c b/src/drivers/i2c/nct7802y/nct7802y.c index 5057890c6b..bb52a3fd0b 100644 --- a/src/drivers/i2c/nct7802y/nct7802y.c +++ b/src/drivers/i2c/nct7802y/nct7802y.c @@ -2,10 +2,24 @@ #include <console/console.h> #include <device/device.h> +#include <types.h> #include "nct7802y.h" #include "chip.h" +static void nct7802y_init_sensors(struct device *const dev) +{ + const struct drivers_i2c_nct7802y_config *const config = dev->chip_info; + unsigned int i; + u8 value = 0; + + for (i = 0; i < NCT7802Y_RTD_CNT; ++i) + value |= MODE_SELECTION_RTDx(i, config->sensors.rtd[i]); + if (config->sensors.local_enable) + value |= MODE_SELECTION_LTD_EN; + nct7802y_write(dev, MODE_SELECTION, value); +} + static void nct7802y_init(struct device *const dev) { if (!dev->chip_info) { @@ -15,6 +29,7 @@ static void nct7802y_init(struct device *const dev) } nct7802y_init_peci(dev); + nct7802y_init_sensors(dev); nct7802y_init_fan(dev); } diff --git a/src/drivers/i2c/nct7802y/nct7802y_fan.c b/src/drivers/i2c/nct7802y/nct7802y_fan.c index a608802c7b..bfe3a91a30 100644 --- a/src/drivers/i2c/nct7802y/nct7802y_fan.c +++ b/src/drivers/i2c/nct7802y/nct7802y_fan.c @@ -78,13 +78,6 @@ void nct7802y_init_fan(struct device *const dev) init_fan(dev, &config->fan[i], i); } - value = 0; - for (i = 0; i < NCT7802Y_RTD_CNT; ++i) - value |= MODE_SELECTION_RTDx(i, config->sensors.rtd[i]); - if (config->sensors.local_enable) - value |= MODE_SELECTION_LTD_EN; - nct7802y_write(dev, MODE_SELECTION, value); - switch (config->on_pecierror) { case PECI_ERROR_KEEP: value = CLOSE_LOOP_FAN_PECI_ERR_CURR; |