mb/google/brya/var/uldrenite: update gpio settings
[coreboot2.git] / src / drivers / i2c / nct7802y / nct7802y.c
blobf313ef7f10fe2316f69de04d7635af9ccf3040bb
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <types.h>
7 #include "nct7802y.h"
8 #include "chip.h"
10 static void nct7802y_init_sensors(struct device *const dev)
12 const struct drivers_i2c_nct7802y_config *const config = dev->chip_info;
13 unsigned int i;
14 u8 value = 0;
16 for (i = 0; i < NCT7802Y_RTD_CNT; ++i)
17 value |= MODE_SELECTION_RTDx(i, config->sensors.rtd[i]);
18 if (config->sensors.local_enable)
19 value |= MODE_SELECTION_LTD_EN;
20 nct7802y_write(dev, MODE_SELECTION, value);
23 static void nct7802y_init(struct device *const dev)
25 if (!dev->chip_info) {
26 printk(BIOS_WARNING,
27 "NCT7802Y driver selected but not configured.");
28 return;
31 nct7802y_init_peci(dev);
32 nct7802y_init_sensors(dev);
33 nct7802y_init_fan(dev);
36 static struct device_operations nct7802y_ops = {
37 .read_resources = noop_read_resources,
38 .set_resources = noop_set_resources,
39 .init = nct7802y_init,
42 static void nct7802y_enable(struct device *const dev)
44 dev->ops = &nct7802y_ops;
47 struct chip_operations drivers_i2c_nct7802y_ops = {
48 .name = "NCT7802Y",
49 .enable_dev = nct7802y_enable