mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-30 01:52:51 +00:00
WIFI-1864-CPU-Temperature_Update
This patch will add the support to read the cpu temperature of ath11k chipset boards and update to the UI Signed-off-by: Nagendrababu <nagendrababu.bonkuri@connectus.ai>
This commit is contained in:
committed by
Rick Sommerville
parent
804c83e70e
commit
ec8170bb11
@@ -5,7 +5,7 @@
|
||||
|
||||
extern int phy_from_path(char *path, char *phy);
|
||||
extern int phy_get_mac(char *phy, char *mac);
|
||||
extern int phy_find_hwmon(char *path, char *hwmon);
|
||||
extern int phy_find_hwmon(char *phy, char *hwmon, bool *DegreesNotMilliDegrees);
|
||||
extern int phy_get_tx_chainmask(const char *name);
|
||||
extern int phy_get_rx_chainmask(const char *name);
|
||||
extern int phy_get_tx_available_antenna(const char *name);
|
||||
|
||||
@@ -41,4 +41,5 @@ extern int net_get_mtu(char *iface);
|
||||
extern int net_get_mac(char *iface, char *mac);
|
||||
extern int net_is_bridge(char *iface);
|
||||
extern char* get_max_channel_bw_channel(int channel_freq, const char* htmode);
|
||||
int phy_find_hwmon_helper(char *dir, char *file, char *hwmon);
|
||||
#endif
|
||||
|
||||
@@ -350,12 +350,12 @@ bool target_stats_device_temp_get(radio_entry_t *radio_cfg, dpp_device_temp_t *t
|
||||
char hwmon_path[PATH_MAX];
|
||||
int32_t temperature;
|
||||
FILE *fp = NULL;
|
||||
bool DegreesNotMilliDegrees;
|
||||
|
||||
if (phy_find_hwmon(target_map_ifname(radio_cfg->phy_name), hwmon_path)) {
|
||||
if (phy_find_hwmon(target_map_ifname(radio_cfg->phy_name), hwmon_path, &DegreesNotMilliDegrees)) {
|
||||
LOG(ERR, "%s: hwmon is missing", radio_cfg->phy_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
fp = fopen(hwmon_path, "r");
|
||||
if (!fp) {
|
||||
LOG(ERR, "%s: Failed to open temp input files", radio_cfg->phy_name);
|
||||
@@ -372,7 +372,10 @@ bool target_stats_device_temp_get(radio_entry_t *radio_cfg, dpp_device_temp_t *t
|
||||
|
||||
fclose(fp);
|
||||
temp_entry->type = radio_cfg->type;
|
||||
temp_entry->value = temperature / 1000;
|
||||
if(DegreesNotMilliDegrees)
|
||||
temp_entry->value = temperature;
|
||||
else
|
||||
temp_entry->value = temperature / 1000;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -195,24 +195,36 @@ int phy_from_path(char *_path, char *phy, unsigned int idx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int phy_find_hwmon(char *phy, char *hwmon)
|
||||
int phy_find_hwmon_helper(char *dir, char *file, char *hwmon)
|
||||
{
|
||||
char tmp[PATH_MAX];
|
||||
glob_t gl;
|
||||
|
||||
*hwmon = '\0';
|
||||
snprintf(tmp, sizeof(tmp), "/sys/class/ieee80211/%s/device/hwmon/*", phy);
|
||||
if (glob(tmp, GLOB_NOSORT | GLOB_MARK, NULL, &gl))
|
||||
return -1;
|
||||
if (glob(dir, GLOB_NOSORT | GLOB_MARK, NULL, &gl))
|
||||
return -1;
|
||||
if (gl.gl_pathc) {
|
||||
strcpy(hwmon, gl.gl_pathv[0]);
|
||||
strncat(hwmon, "temp1_input", PATH_MAX);
|
||||
strncat(hwmon, file, PATH_MAX);
|
||||
}
|
||||
globfree(&gl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int phy_find_hwmon(char *phy, char *hwmon, bool *DegreesNotMilliDegrees)
|
||||
{
|
||||
char tmp[PATH_MAX];
|
||||
*hwmon = '\0';
|
||||
snprintf(tmp, sizeof(tmp), "/sys/class/ieee80211/%s/device/hwmon/*", phy);
|
||||
if (!phy_find_hwmon_helper(tmp, "temp1_input", hwmon)) {
|
||||
*DegreesNotMilliDegrees=false;
|
||||
return 0;
|
||||
}
|
||||
snprintf(tmp, sizeof(tmp), "/sys/class/ieee80211/%s/cooling_device/subsystem/thermal_zone0/", phy);
|
||||
if (!phy_find_hwmon_helper(tmp, "temp", hwmon)) {
|
||||
*DegreesNotMilliDegrees=true;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int phy_get_mac(char *phy, char *mac)
|
||||
{
|
||||
int sz = ETH_ALEN * 3;
|
||||
|
||||
Reference in New Issue
Block a user