Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6eb09ebe authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "icnss: Remove icnss_utils"

parents 6504e07a f70208ab
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ obj-y += qdsp6v2/
obj-$(CONFIG_MSM_SYSTEM_HEALTH_MONITOR)	+=	system_health_monitor_v01.o
obj-$(CONFIG_MSM_SYSTEM_HEALTH_MONITOR)	+=	system_health_monitor.o
obj-$(CONFIG_MSM_SYSMON_GLINK_COMM) += sysmon-glink.o sysmon-qmi.o
obj-$(CONFIG_ICNSS) += icnss.o wlan_firmware_service_v01.o icnss_utils.o
obj-$(CONFIG_ICNSS) += icnss.o wlan_firmware_service_v01.o

obj-$(CONFIG_MEM_SHARE_QMI_SERVICE)		+= memshare/
obj-$(CONFIG_MSM_PIL_SSR_GENERIC) += subsys-pil-tz.o
+0 −80
Original line number Diff line number Diff line
@@ -397,12 +397,6 @@ struct icnss_stats {
	uint32_t rejuvenate_ack_err;
};

#define MAX_NO_OF_MAC_ADDR 4
struct icnss_wlan_mac_addr {
	u8 mac_addr[MAX_NO_OF_MAC_ADDR][ETH_ALEN];
	uint32_t no_of_mac_addr_set;
};

enum icnss_pdr_cause_index {
	ICNSS_FW_CRASH,
	ICNSS_ROOT_PD_CRASH,
@@ -479,8 +473,6 @@ static struct icnss_priv {
	uint64_t vph_pwr;
	atomic_t pm_count;
	struct ramdump_device *msa0_dump_dev;
	bool is_wlan_mac_set;
	struct icnss_wlan_mac_addr wlan_mac_addr;
	bool bypass_s1_smmu;
	u8 cause_for_rejuvenation;
	u8 requesting_sub_system;
@@ -3279,78 +3271,6 @@ unsigned int icnss_socinfo_get_serial_number(struct device *dev)
}
EXPORT_SYMBOL(icnss_socinfo_get_serial_number);

int icnss_set_wlan_mac_address(const u8 *in, const uint32_t len)
{
	struct icnss_priv *priv = penv;
	uint32_t no_of_mac_addr;
	struct icnss_wlan_mac_addr *addr = NULL;
	int iter;
	u8 *temp = NULL;

	if (!priv) {
		icnss_pr_err("Priv data is NULL\n");
		return -EINVAL;
	}

	if (priv->is_wlan_mac_set) {
		icnss_pr_dbg("WLAN MAC address is already set\n");
		return 0;
	}

	if (len == 0 || (len % ETH_ALEN) != 0) {
		icnss_pr_err("Invalid length %d\n", len);
		return -EINVAL;
	}

	no_of_mac_addr = len / ETH_ALEN;
	if (no_of_mac_addr > MAX_NO_OF_MAC_ADDR) {
		icnss_pr_err("Exceed maxinum supported MAC address %u %u\n",
			     MAX_NO_OF_MAC_ADDR, no_of_mac_addr);
		return -EINVAL;
	}

	priv->is_wlan_mac_set = true;
	addr = &priv->wlan_mac_addr;
	addr->no_of_mac_addr_set = no_of_mac_addr;
	temp = &addr->mac_addr[0][0];

	for (iter = 0; iter < no_of_mac_addr;
	     ++iter, temp += ETH_ALEN, in += ETH_ALEN) {
		ether_addr_copy(temp, in);
		icnss_pr_dbg("MAC_ADDR:%02x:%02x:%02x:%02x:%02x:%02x\n",
			     temp[0], temp[1], temp[2],
			     temp[3], temp[4], temp[5]);
	}

	return 0;
}
EXPORT_SYMBOL(icnss_set_wlan_mac_address);

u8 *icnss_get_wlan_mac_address(struct device *dev, uint32_t *num)
{
	struct icnss_priv *priv = dev_get_drvdata(dev);
	struct icnss_wlan_mac_addr *addr = NULL;

	if (priv->magic != ICNSS_MAGIC) {
		icnss_pr_err("Invalid drvdata: dev %p, data %p, magic 0x%x\n",
			     dev, priv, priv->magic);
		goto out;
	}

	if (!priv->is_wlan_mac_set) {
		icnss_pr_dbg("WLAN MAC address is not set\n");
		goto out;
	}

	addr = &priv->wlan_mac_addr;
	*num = addr->no_of_mac_addr_set;
	return &addr->mac_addr[0][0];
out:
	*num = 0;
	return NULL;
}
EXPORT_SYMBOL(icnss_get_wlan_mac_address);

int icnss_trigger_recovery(struct device *dev)
{
	int ret = 0;

drivers/soc/qcom/icnss_utils.c

deleted100644 → 0
+0 −140
Original line number Diff line number Diff line
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <linux/module.h>
#include <linux/slab.h>
#include <soc/qcom/icnss.h>

#define ICNSS_MAX_CH_NUM 45

static DEFINE_MUTEX(unsafe_channel_list_lock);
static DEFINE_SPINLOCK(dfs_nol_info_lock);
static int driver_load_cnt;

static struct icnss_unsafe_channel_list {
	u16 unsafe_ch_count;
	u16 unsafe_ch_list[ICNSS_MAX_CH_NUM];
} unsafe_channel_list;

static struct icnss_dfs_nol_info {
	void *dfs_nol_info;
	u16 dfs_nol_info_len;
} dfs_nol_info;

int icnss_set_wlan_unsafe_channel(u16 *unsafe_ch_list, u16 ch_count)
{
	mutex_lock(&unsafe_channel_list_lock);
	if ((!unsafe_ch_list) || (ch_count > ICNSS_MAX_CH_NUM)) {
		mutex_unlock(&unsafe_channel_list_lock);
		return -EINVAL;
	}

	unsafe_channel_list.unsafe_ch_count = ch_count;

	if (ch_count != 0) {
		memcpy(
		       (char *)unsafe_channel_list.unsafe_ch_list,
		       (char *)unsafe_ch_list, ch_count * sizeof(u16));
	}
	mutex_unlock(&unsafe_channel_list_lock);

	return 0;
}
EXPORT_SYMBOL(icnss_set_wlan_unsafe_channel);

int icnss_get_wlan_unsafe_channel(u16 *unsafe_ch_list,
				  u16 *ch_count, u16 buf_len)
{
	mutex_lock(&unsafe_channel_list_lock);
	if (!unsafe_ch_list || !ch_count) {
		mutex_unlock(&unsafe_channel_list_lock);
		return -EINVAL;
	}

	if (buf_len < (unsafe_channel_list.unsafe_ch_count * sizeof(u16))) {
		mutex_unlock(&unsafe_channel_list_lock);
		return -ENOMEM;
	}

	*ch_count = unsafe_channel_list.unsafe_ch_count;
	memcpy(
		(char *)unsafe_ch_list,
		(char *)unsafe_channel_list.unsafe_ch_list,
		unsafe_channel_list.unsafe_ch_count * sizeof(u16));
	mutex_unlock(&unsafe_channel_list_lock);

	return 0;
}
EXPORT_SYMBOL(icnss_get_wlan_unsafe_channel);

int icnss_wlan_set_dfs_nol(const void *info, u16 info_len)
{
	void *temp;
	void *old_nol_info;
	struct icnss_dfs_nol_info *dfs_info;

	if (!info || !info_len)
		return -EINVAL;

	temp = kmalloc(info_len, GFP_ATOMIC);
	if (!temp)
		return -ENOMEM;

	memcpy(temp, info, info_len);
	spin_lock_bh(&dfs_nol_info_lock);
	dfs_info = &dfs_nol_info;
	old_nol_info = dfs_info->dfs_nol_info;
	dfs_info->dfs_nol_info = temp;
	dfs_info->dfs_nol_info_len = info_len;
	spin_unlock_bh(&dfs_nol_info_lock);
	kfree(old_nol_info);

	return 0;
}
EXPORT_SYMBOL(icnss_wlan_set_dfs_nol);

int icnss_wlan_get_dfs_nol(void *info, u16 info_len)
{
	int len;
	struct icnss_dfs_nol_info *dfs_info;

	if (!info || !info_len)
		return -EINVAL;

	spin_lock_bh(&dfs_nol_info_lock);

	dfs_info = &dfs_nol_info;
	if (dfs_info->dfs_nol_info == NULL ||
	    dfs_info->dfs_nol_info_len == 0) {
		spin_unlock_bh(&dfs_nol_info_lock);
		return -ENOENT;
	}

	len = min(info_len, dfs_info->dfs_nol_info_len);
	memcpy(info, dfs_info->dfs_nol_info, len);
	spin_unlock_bh(&dfs_nol_info_lock);

	return len;
}
EXPORT_SYMBOL(icnss_wlan_get_dfs_nol);

void icnss_increment_driver_load_cnt(void)
{
	++driver_load_cnt;
}
EXPORT_SYMBOL(icnss_increment_driver_load_cnt);

int icnss_get_driver_load_cnt(void)
{
	return driver_load_cnt;
}
EXPORT_SYMBOL(icnss_get_driver_load_cnt);
+0 −9
Original line number Diff line number Diff line
@@ -127,16 +127,7 @@ extern struct dma_iommu_mapping *icnss_smmu_get_mapping(struct device *dev);
extern int icnss_smmu_map(struct device *dev, phys_addr_t paddr,
			  uint32_t *iova_addr, size_t size);
extern unsigned int icnss_socinfo_get_serial_number(struct device *dev);
extern int icnss_set_wlan_unsafe_channel(u16 *unsafe_ch_list, u16 ch_count);
extern int icnss_get_wlan_unsafe_channel(u16 *unsafe_ch_list, u16 *ch_count,
					 u16 buf_len);
extern int icnss_wlan_set_dfs_nol(const void *info, u16 info_len);
extern int icnss_wlan_get_dfs_nol(void *info, u16 info_len);
extern bool icnss_is_qmi_disable(void);
extern bool icnss_is_fw_ready(void);
extern int icnss_set_wlan_mac_address(const u8 *in, const uint32_t len);
extern u8 *icnss_get_wlan_mac_address(struct device *dev, uint32_t *num);
extern int icnss_trigger_recovery(struct device *dev);
extern int icnss_get_driver_load_cnt(void);
extern void icnss_increment_driver_load_cnt(void);
#endif /* _ICNSS_WLAN_H_ */