Lines Matching +full:temp +full:- +full:sensor

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright 2011-2013 Solarflare Communications Inc.
40 #define SENSOR(name, label, hwmon_type, port) \ macro
42 SENSOR(CONTROLLER_TEMP, "Controller board temp.", TEMP, -1),
43 SENSOR(PHY_COMMON_TEMP, "PHY temp.", TEMP, -1),
44 SENSOR(CONTROLLER_COOLING, "Controller heat sink", COOL, -1),
45 SENSOR(PHY0_TEMP, "PHY temp.", TEMP, 0),
46 SENSOR(PHY0_COOLING, "PHY heat sink", COOL, 0),
47 SENSOR(PHY1_TEMP, "PHY temp.", TEMP, 1),
48 SENSOR(PHY1_COOLING, "PHY heat sink", COOL, 1),
49 SENSOR(IN_1V0, "1.0V supply", IN, -1),
50 SENSOR(IN_1V2, "1.2V supply", IN, -1),
51 SENSOR(IN_1V8, "1.8V supply", IN, -1),
52 SENSOR(IN_2V5, "2.5V supply", IN, -1),
53 SENSOR(IN_3V3, "3.3V supply", IN, -1),
54 SENSOR(IN_12V0, "12.0V supply", IN, -1),
55 SENSOR(IN_1V2A, "1.2V analogue supply", IN, -1),
56 SENSOR(IN_VREF, "Ref. voltage", IN, -1),
57 SENSOR(OUT_VAOE, "AOE FPGA supply", IN, -1),
58 SENSOR(AOE_TEMP, "AOE FPGA temp.", TEMP, -1),
59 SENSOR(PSU_AOE_TEMP, "AOE regulator temp.", TEMP, -1),
60 SENSOR(PSU_TEMP, "Controller regulator temp.",
61 TEMP, -1),
62 SENSOR(FAN_0, "Fan 0", COOL, -1),
63 SENSOR(FAN_1, "Fan 1", COOL, -1),
64 SENSOR(FAN_2, "Fan 2", COOL, -1),
65 SENSOR(FAN_3, "Fan 3", COOL, -1),
66 SENSOR(FAN_4, "Fan 4", COOL, -1),
67 SENSOR(IN_VAOE, "AOE input supply", IN, -1),
68 SENSOR(OUT_IAOE, "AOE output current", CURR, -1),
69 SENSOR(IN_IAOE, "AOE input current", CURR, -1),
70 SENSOR(NIC_POWER, "Board power use", POWER, -1),
71 SENSOR(IN_0V9, "0.9V supply", IN, -1),
72 SENSOR(IN_I0V9, "0.9V supply current", CURR, -1),
73 SENSOR(IN_I1V2, "1.2V supply current", CURR, -1),
74 SENSOR(IN_0V9_ADC, "0.9V supply (ext. ADC)", IN, -1),
75 SENSOR(CONTROLLER_2_TEMP, "Controller board temp. 2", TEMP, -1),
76 SENSOR(VREG_INTERNAL_TEMP, "Regulator die temp.", TEMP, -1),
77 SENSOR(VREG_0V9_TEMP, "0.9V regulator temp.", TEMP, -1),
78 SENSOR(VREG_1V2_TEMP, "1.2V regulator temp.", TEMP, -1),
79 SENSOR(CONTROLLER_VPTAT,
80 "Controller PTAT voltage (int. ADC)", IN, -1),
81 SENSOR(CONTROLLER_INTERNAL_TEMP,
82 "Controller die temp. (int. ADC)", TEMP, -1),
83 SENSOR(CONTROLLER_VPTAT_EXTADC,
84 "Controller PTAT voltage (ext. ADC)", IN, -1),
85 SENSOR(CONTROLLER_INTERNAL_TEMP_EXTADC,
86 "Controller die temp. (ext. ADC)", TEMP, -1),
87 SENSOR(AMBIENT_TEMP, "Ambient temp.", TEMP, -1),
88 SENSOR(AIRFLOW, "Air flow raw", IN, -1),
89 SENSOR(VDD08D_VSS08D_CSR, "0.9V die (int. ADC)", IN, -1),
90 SENSOR(VDD08D_VSS08D_CSR_EXTADC, "0.9V die (ext. ADC)", IN, -1),
91 SENSOR(HOTPOINT_TEMP, "Controller board temp. (hotpoint)", TEMP, -1),
92 #undef SENSOR
114 * know about, but do not expect new sensor states. */ in efx_mcdi_sensor_event()
120 name = "No sensor name available"; in efx_mcdi_sensor_event()
128 netif_err(efx, hw, efx->net_dev, in efx_mcdi_sensor_event()
129 "Sensor %d (%s) reports condition '%s' for value %d%s\n", in efx_mcdi_sensor_event()
151 hwmon->dma_buf.dma_addr); in efx_mcdi_mon_update()
152 MCDI_SET_DWORD(inbuf, READ_SENSORS_EXT_IN_LENGTH, hwmon->dma_buf.len); in efx_mcdi_mon_update()
157 hwmon->last_update = jiffies; in efx_mcdi_mon_update()
164 struct efx_nic *efx = dev_get_drvdata(dev->parent); in efx_mcdi_mon_get_entry()
170 mutex_lock(&hwmon->update_lock); in efx_mcdi_mon_get_entry()
173 if (time_before(jiffies, hwmon->last_update + HZ)) in efx_mcdi_mon_get_entry()
179 *entry = ((efx_dword_t *)hwmon->dma_buf.addr)[index]; in efx_mcdi_mon_get_entry()
181 mutex_unlock(&hwmon->update_lock); in efx_mcdi_mon_get_entry()
196 rc = efx_mcdi_mon_get_entry(dev, mon_attr->index, &entry); in efx_mcdi_mon_show_value()
202 return -EBUSY; in efx_mcdi_mon_show_value()
206 switch (mon_attr->hwmon_type) { in efx_mcdi_mon_show_value()
208 /* Convert temperature from degrees to milli-degrees Celsius */ in efx_mcdi_mon_show_value()
231 value = mon_attr->limit_value; in efx_mcdi_mon_show_limit()
233 switch (mon_attr->hwmon_type) { in efx_mcdi_mon_show_limit()
235 /* Convert temperature from degrees to milli-degrees Celsius */ in efx_mcdi_mon_show_limit()
260 rc = efx_mcdi_mon_get_entry(dev, mon_attr->index, &entry); in efx_mcdi_mon_show_alarm()
275 efx_mcdi_sensor_type[mon_attr->type].label); in efx_mcdi_mon_show_label()
286 struct efx_mcdi_mon_attribute *attr = &hwmon->attrs[hwmon->n_attrs]; in efx_mcdi_mon_add_attr()
288 strscpy(attr->name, name, sizeof(attr->name)); in efx_mcdi_mon_add_attr()
289 attr->index = index; in efx_mcdi_mon_add_attr()
290 attr->type = type; in efx_mcdi_mon_add_attr()
292 attr->hwmon_type = efx_mcdi_sensor_type[type].hwmon_type; in efx_mcdi_mon_add_attr()
294 attr->hwmon_type = EFX_HWMON_UNKNOWN; in efx_mcdi_mon_add_attr()
295 attr->limit_value = limit_value; in efx_mcdi_mon_add_attr()
296 sysfs_attr_init(&attr->dev_attr.attr); in efx_mcdi_mon_add_attr()
297 attr->dev_attr.attr.name = attr->name; in efx_mcdi_mon_add_attr()
298 attr->dev_attr.attr.mode = 0444; in efx_mcdi_mon_add_attr()
299 attr->dev_attr.show = reader; in efx_mcdi_mon_add_attr()
300 hwmon->group.attrs[hwmon->n_attrs++] = &attr->dev_attr.attr; in efx_mcdi_mon_add_attr()
326 return -EIO; in efx_mcdi_mon_probe()
339 efx, &hwmon->dma_buf, in efx_mcdi_mon_probe()
345 mutex_init(&hwmon->update_lock); in efx_mcdi_mon_probe()
350 * value, min, max, crit, alarm and label for each sensor. in efx_mcdi_mon_probe()
353 hwmon->attrs = kcalloc(n_attrs, sizeof(*hwmon->attrs), GFP_KERNEL); in efx_mcdi_mon_probe()
354 if (!hwmon->attrs) { in efx_mcdi_mon_probe()
355 rc = -ENOMEM; in efx_mcdi_mon_probe()
358 hwmon->group.attrs = kcalloc(n_attrs + 1, sizeof(struct attribute *), in efx_mcdi_mon_probe()
360 if (!hwmon->group.attrs) { in efx_mcdi_mon_probe()
361 rc = -ENOMEM; in efx_mcdi_mon_probe()
365 for (i = 0, j = -1, type = -1; ; i++) { in efx_mcdi_mon_probe()
371 /* Find next sensor type or exit if there is none */ in efx_mcdi_mon_probe()
377 j = -1; in efx_mcdi_mon_probe()
390 rc = -EIO; in efx_mcdi_mon_probe()
401 rc = -EIO; in efx_mcdi_mon_probe()
423 hwmon_prefix = "temp"; in efx_mcdi_mon_probe()
424 hwmon_index = ++n_temp; /* 1-based */ in efx_mcdi_mon_probe()
432 hwmon_index = ++n_cool; /* 1-based */ in efx_mcdi_mon_probe()
436 hwmon_index = n_in++; /* 0-based */ in efx_mcdi_mon_probe()
440 hwmon_index = ++n_curr; /* 1-based */ in efx_mcdi_mon_probe()
444 hwmon_index = ++n_power; /* 1-based */ in efx_mcdi_mon_probe()
504 hwmon->groups[0] = &hwmon->group; in efx_mcdi_mon_probe()
505 hwmon->device = hwmon_device_register_with_groups(&efx->pci_dev->dev, in efx_mcdi_mon_probe()
507 hwmon->groups); in efx_mcdi_mon_probe()
508 if (IS_ERR(hwmon->device)) { in efx_mcdi_mon_probe()
509 rc = PTR_ERR(hwmon->device); in efx_mcdi_mon_probe()
524 if (hwmon->device) in efx_mcdi_mon_remove()
525 hwmon_device_unregister(hwmon->device); in efx_mcdi_mon_remove()
526 kfree(hwmon->attrs); in efx_mcdi_mon_remove()
527 kfree(hwmon->group.attrs); in efx_mcdi_mon_remove()
528 efx_nic_free_buffer(efx, &hwmon->dma_buf); in efx_mcdi_mon_remove()