1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <device/device.h>
10 static void nct7802y_init_sensors(struct device
*const dev
)
12 const struct drivers_i2c_nct7802y_config
*const config
= dev
->chip_info
;
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
) {
27 "NCT7802Y driver selected but not configured.");
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
= {
49 .enable_dev
= nct7802y_enable