[iwm] Very basic DTS thermal sensor support (prints temp as debug msg).

* Adds IWM_DEBUG_TEMP debug message type, for printing messages related
  to temperature sensors and thermal/TDP infos.

* The firmware regularly sends us DTS measurement notifications, so just
  print the temperature value as a debugging message.

(Adrian's addition):

* Eventually this can be used by the driver to limit transmit rate / power to
  try and do some thermal throttling.

Obtained from:	DragonflyBSD commit efb7d4eb5c3140889a8880e12fd83c7bbfd0059d
This commit is contained in:
adrian 2017-02-08 06:56:28 +00:00
parent f8f945c2d2
commit eb2c40eeeb
3 changed files with 38 additions and 1 deletions

View File

@ -5451,8 +5451,20 @@ iwm_notif_intr(struct iwm_softc *sc)
notif->source_id, sc->sc_fw_mcc);
break; }
case IWM_DTS_MEASUREMENT_NOTIFICATION:
case IWM_DTS_MEASUREMENT_NOTIFICATION: {
struct iwm_dts_measurement_notif_v1 *notif;
if (iwm_rx_packet_payload_len(pkt) < sizeof(*notif)) {
device_printf(sc->sc_dev,
"Invalid DTS_MEASUREMENT_NOTIFICATION\n");
break;
}
notif = (void *)pkt->data;
IWM_DPRINTF(sc, IWM_DEBUG_TEMP,
"IWM_DTS_MEASUREMENT_NOTIFICATION - %d\n",
notif->temp);
break;
}
case IWM_PHY_CONFIGURATION_CMD:
case IWM_TX_ANT_CONFIGURATION_CMD:

View File

@ -41,6 +41,7 @@ enum {
IWM_DEBUG_FIRMWARE_TLV = 0x00020000, /* Firmware TLV parsing */
IWM_DEBUG_TRANS = 0x00040000, /* Transport layer (eg PCIe) */
IWM_DEBUG_EEPROM = 0x00080000, /* EEPROM/channel information */
IWM_DEBUG_TEMP = 0x00100000, /* Thermal Sensor handling */
IWM_DEBUG_REGISTER = 0x20000000, /* print chipset register */
IWM_DEBUG_TRACE = 0x40000000, /* Print begin and start driver function */
IWM_DEBUG_FATAL = 0x80000000, /* fatal errors */

View File

@ -5978,6 +5978,30 @@ enum iwm_mcc_source {
IWM_MCC_SOURCE_GETTING_MCC_TEST_MODE = 0x11,
};
/**
* struct iwm_dts_measurement_notif_v1 - measurements notification
*
* @temp: the measured temperature
* @voltage: the measured voltage
*/
struct iwm_dts_measurement_notif_v1 {
int32_t temp;
int32_t voltage;
} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_1*/
/**
* struct iwm_dts_measurement_notif_v2 - measurements notification
*
* @temp: the measured temperature
* @voltage: the measured voltage
* @threshold_idx: the trip index that was crossed
*/
struct iwm_dts_measurement_notif_v2 {
int32_t temp;
int32_t voltage;
int32_t threshold_idx;
} __packed; /* TEMPERATURE_MEASUREMENT_TRIGGER_NTFY_S_VER_2 */
/*
* Some cherry-picked definitions
*/