coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
nct7802y.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <types.h>
6 
7 #include "nct7802y.h"
8 #include "chip.h"
9 
10 static void nct7802y_init_sensors(struct device *const dev)
11 {
12  const struct drivers_i2c_nct7802y_config *const config = dev->chip_info;
13  unsigned int i;
14  u8 value = 0;
15 
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)
21 }
22 
23 static void nct7802y_init(struct device *const dev)
24 {
25  if (!dev->chip_info) {
27  "NCT7802Y driver selected but not configured.");
28  return;
29  }
30 
31  nct7802y_init_peci(dev);
33  nct7802y_init_fan(dev);
34 }
35 
36 static struct device_operations nct7802y_ops = {
38  .set_resources = noop_set_resources,
39  .init = nct7802y_init,
40 };
41 
42 static void nct7802y_enable(struct device *const dev)
43 {
44  dev->ops = &nct7802y_ops;
45 }
46 
48  CHIP_NAME("NCT7802Y")
49  .enable_dev = nct7802y_enable
50 };
pte_t value
Definition: mmu.c:91
#define printk(level,...)
Definition: stdlib.h:16
#define NCT7802Y_RTD_CNT
Definition: chip.h:10
#define CHIP_NAME(X)
Definition: device.h:32
static void noop_read_resources(struct device *dev)
Standard device operations function pointers shims.
Definition: device.h:73
static void noop_set_resources(struct device *dev)
Definition: device.h:74
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
Definition: loglevel.h:86
enum board_config config
Definition: memory.c:448
static void nct7802y_init(struct device *const dev)
Definition: nct7802y.c:23
struct chip_operations drivers_i2c_nct7802y_ops
Definition: nct7802y.c:47
static void nct7802y_init_sensors(struct device *const dev)
Definition: nct7802y.c:10
static struct device_operations nct7802y_ops
Definition: nct7802y.c:36
static void nct7802y_enable(struct device *const dev)
Definition: nct7802y.c:42
#define MODE_SELECTION_RTDx(x, val)
Definition: nct7802y.h:16
#define MODE_SELECTION
Definition: nct7802y.h:14
static int nct7802y_write(struct device *const dev, const u8 reg, const u8 value)
Definition: nct7802y.h:76
void nct7802y_init_peci(struct device *dev)
Definition: nct7802y_peci.c:9
#define MODE_SELECTION_LTD_EN
Definition: nct7802y.h:15
void nct7802y_init_fan(struct device *dev)
Definition: nct7802y_fan.c:67
uint8_t u8
Definition: stdint.h:45
void(* read_resources)(struct device *dev)
Definition: device.h:39
Definition: device.h:107
struct device_operations * ops
Definition: device.h:143
DEVTREE_CONST void * chip_info
Definition: device.h:164