mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 23:24:22 -04:00
qcacld-3.0: Add a sysfs replacement for get_temp
As part of WEXT replacement, replace get_temp with a sysfs file. file path: /sys/class/net/wlanxx/get_temp where wlanxx is adapter name example: cat /sys/class/net/wlanxx/get_temp Change-Id: I6e530562347c936fb980f4eed4c3a55cb9804bdd CRs-Fixed: 2684669
This commit is contained in:
parent
f516576fcf
commit
bb1227276b
5 changed files with 171 additions and 0 deletions
4
Kbuild
4
Kbuild
|
|
@ -318,6 +318,9 @@ endif
|
|||
ifeq ($(CONFIG_WLAN_GET_TDLS_PEERS), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_get_tdls_peers.o
|
||||
endif
|
||||
ifeq ($(CONFIG_WLAN_GET_TEMP), y)
|
||||
HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_sysfs_get_temp.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_QCACLD_FEATURE_FW_STATE), y)
|
||||
|
|
@ -2553,6 +2556,7 @@ cppflags-$(CONFIG_WLAN_TXRX_FW_STATS) += -DCONFIG_WLAN_TXRX_FW_STATS
|
|||
cppflags-$(CONFIG_WLAN_TXRX_STATS) += -DCONFIG_WLAN_TXRX_STATS
|
||||
cppflags-$(CONFIG_WLAN_SET_DP_TRACE) += -DCONFIG_WLAN_SET_DP_TRACE
|
||||
cppflags-$(CONFIG_WLAN_GET_RANGE_EXT) += -DCONFIG_WLAN_GET_RANGE_EXT
|
||||
cppflags-$(CONFIG_WLAN_GET_TEMP) += -DCONFIG_WLAN_GET_TEMP
|
||||
cppflags-$(CONFIG_FEATURE_UNIT_TEST_SUSPEND) += -DWLAN_SUSPEND_RESUME_TEST
|
||||
cppflags-$(CONFIG_FEATURE_WLM_STATS) += -DFEATURE_WLM_STATS
|
||||
|
||||
|
|
|
|||
|
|
@ -194,6 +194,7 @@ ifeq ($(CONFIG_WLAN_SYSFS), y)
|
|||
ifeq ($(CONFIG_QCOM_TDLS), y)
|
||||
CONFIG_WLAN_GET_TDLS_PEERS := y
|
||||
endif
|
||||
CONFIG_WLAN_GET_TEMP := y
|
||||
endif
|
||||
|
||||
CONFIG_WLAN_POWER_DEBUG := y
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@
|
|||
#include <wlan_hdd_sysfs_set_dp_trace.h>
|
||||
#include <wlan_hdd_sysfs_get_range_ext.h>
|
||||
#include <wlan_hdd_sysfs_get_tdls_peers.h>
|
||||
#include <wlan_hdd_sysfs_get_temp.h>
|
||||
|
||||
#define MAX_PSOC_ID_SIZE 10
|
||||
|
||||
|
|
@ -642,11 +643,13 @@ hdd_sysfs_create_sta_adapter_root_obj(struct hdd_adapter *adapter)
|
|||
hdd_sysfs_txrx_stats_create(adapter);
|
||||
hdd_sysfs_get_range_ext_create(adapter);
|
||||
hdd_sysfs_get_tdls_peers_interface_create(adapter);
|
||||
hdd_sysfs_get_temp_create(adapter);
|
||||
}
|
||||
|
||||
static void
|
||||
hdd_sysfs_destroy_sta_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
{
|
||||
hdd_sysfs_get_temp_destroy(adapter);
|
||||
hdd_sysfs_get_tdls_peers_interface_destroy(adapter);
|
||||
hdd_sysfs_get_range_ext_destroy(adapter);
|
||||
hdd_sysfs_txrx_stats_destroy(adapter);
|
||||
|
|
@ -677,11 +680,13 @@ hdd_sysfs_create_sap_adapter_root_obj(struct hdd_adapter *adapter)
|
|||
hdd_sysfs_set_radar_create(adapter);
|
||||
hdd_sysfs_txrx_fw_stats_create(adapter);
|
||||
hdd_sysfs_txrx_stats_create(adapter);
|
||||
hdd_sysfs_get_temp_create(adapter);
|
||||
}
|
||||
|
||||
static void
|
||||
hdd_sysfs_destroy_sap_adapter_root_obj(struct hdd_adapter *adapter)
|
||||
{
|
||||
hdd_sysfs_get_temp_destroy(adapter);
|
||||
hdd_sysfs_txrx_stats_destroy(adapter);
|
||||
hdd_sysfs_txrx_fw_stats_destroy(adapter);
|
||||
hdd_sysfs_set_radar_destroy(adapter);
|
||||
|
|
|
|||
99
core/hdd/src/wlan_hdd_sysfs_get_temp.c
Normal file
99
core/hdd/src/wlan_hdd_sysfs_get_temp.c
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* Copyright (c) 2011-2020 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: wlan_hdd_sysfs_get_temp.c
|
||||
*
|
||||
* implementation for creating sysfs file get_temp
|
||||
*/
|
||||
|
||||
#include <wlan_hdd_includes.h>
|
||||
#include <wlan_hdd_sysfs.h>
|
||||
#include "osif_vdev_sync.h"
|
||||
#include <wlan_hdd_sysfs_get_temp.h>
|
||||
#include <wlan_hdd_stats.h>
|
||||
|
||||
static ssize_t
|
||||
__hdd_sysfs_get_temp_show(struct net_device *net_dev, char *buf)
|
||||
{
|
||||
struct hdd_adapter *adapter = netdev_priv(net_dev);
|
||||
struct hdd_context *hdd_ctx;
|
||||
int value;
|
||||
int ret;
|
||||
|
||||
if (hdd_validate_adapter(adapter)) {
|
||||
hdd_err_rl("adapter validate fail");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
ret = wlan_hdd_validate_context(hdd_ctx);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!wlan_hdd_validate_modules_state(hdd_ctx))
|
||||
return -EINVAL;
|
||||
|
||||
hdd_debug("SYSFS_GET_TEMPERATURE");
|
||||
ret = wlan_hdd_get_temperature(adapter, &value);
|
||||
|
||||
if (ret) {
|
||||
hdd_err_rl("GET_TEMP failed: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return scnprintf(buf, PAGE_SIZE, "%d\n", value);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
hdd_sysfs_get_temp_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct net_device *net_dev = container_of(dev, struct net_device, dev);
|
||||
struct osif_vdev_sync *vdev_sync;
|
||||
ssize_t err_size;
|
||||
|
||||
err_size = osif_vdev_sync_op_start(net_dev, &vdev_sync);
|
||||
if (err_size)
|
||||
return err_size;
|
||||
|
||||
err_size = __hdd_sysfs_get_temp_show(net_dev, buf);
|
||||
|
||||
osif_vdev_sync_op_stop(vdev_sync);
|
||||
|
||||
return err_size;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(get_temp, 0440,
|
||||
hdd_sysfs_get_temp_show, NULL);
|
||||
|
||||
int hdd_sysfs_get_temp_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = device_create_file(&adapter->dev->dev,
|
||||
&dev_attr_get_temp);
|
||||
if (error)
|
||||
hdd_err("could not create get_temp sysfs file");
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void hdd_sysfs_get_temp_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
device_remove_file(&adapter->dev->dev, &dev_attr_get_temp);
|
||||
}
|
||||
62
core/hdd/src/wlan_hdd_sysfs_get_temp.h
Normal file
62
core/hdd/src/wlan_hdd_sysfs_get_temp.h
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) 2011-2020 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: wlan_hdd_sysfs_get_temp.h
|
||||
*
|
||||
* implementation for creating sysfs file get_temp
|
||||
*/
|
||||
|
||||
#ifndef _WLAN_HDD_SYSFS_GET_TEMP_H
|
||||
#define _WLAN_HDD_SYSFS_GET_TEMP_H
|
||||
|
||||
#if defined(WLAN_SYSFS) && defined(CONFIG_WLAN_GET_TEMP)
|
||||
/**
|
||||
* hdd_sysfs_get_temp_create() - API to create get_temp
|
||||
* @adapter: pointer to adapter
|
||||
*
|
||||
* this file is created per adapter.
|
||||
* file path: /sys/class/net/wlanxx/get_temp
|
||||
* where wlanxx is adapter name
|
||||
*
|
||||
* usage:
|
||||
* cat /sys/class/net/wlanxx/get_temp
|
||||
*
|
||||
* Return: 0 on success and errno on failure
|
||||
*/
|
||||
int hdd_sysfs_get_temp_create(struct hdd_adapter *adapter);
|
||||
|
||||
/**
|
||||
* hdd_sysfs_get_temp_destroy() -
|
||||
* API to destroy get_temp
|
||||
* @adapter: pointer to adapter
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
void hdd_sysfs_get_temp_destroy(struct hdd_adapter *adapter);
|
||||
#else
|
||||
static inline int
|
||||
hdd_sysfs_get_temp_create(struct hdd_adapter *adapter)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
hdd_sysfs_get_temp_destroy(struct hdd_adapter *adapter)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif /* #ifndef _WLAN_HDD_SYSFS_GET_TEMP_H */
|
||||
Loading…
Reference in a new issue