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

Commit cecb6044 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" into msm-next

parents 2cedc609 18701149
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ obj-$(CONFIG_MSM_GLADIATOR_ERP) += gladiator_erp.o
obj-$(CONFIG_QCOM_SECURE_BUFFER) += secure_buffer.o
obj-$(CONFIG_QCOM_MEMORY_DUMP_V2) += memory_dump_v2.o
obj-$(CONFIG_QCOM_WATCHDOG_V2) += watchdog_v2.o
obj-$(CONFIG_ICNSS) += icnss.o icnss_utils.o
obj-$(CONFIG_ICNSS) += icnss.o
obj-$(CONFIG_MSM_SERVICE_NOTIFIER) += service-notifier.o
obj-$(CONFIG_MSM_SERVICE_LOCATOR) += service-locator.o
obj-$(CONFIG_MSM_SYSMON_GLINK_COMM) += sysmon-glink.o sysmon-qmi.o
+0 −72
Original line number Diff line number Diff line
@@ -1777,78 +1777,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 %pK, data %pK, 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;
+0 −9
Original line number Diff line number Diff line
@@ -227,8 +227,6 @@ struct icnss_stats {
	uint32_t rejuvenate_ack_err;
};

#define MAX_NO_OF_MAC_ADDR 4

#define WLFW_MAX_TIMESTAMP_LEN 32
#define WLFW_MAX_BUILD_ID_LEN 128
#define WLFW_MAX_NUM_MEMORY_REGIONS 2
@@ -239,11 +237,6 @@ struct icnss_stats {
#define WLFW_MAX_NUM_SVC 24
#define WLFW_MAX_NUM_SHADOW_REG 24

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

struct service_notifier_context {
	void *handle;
	uint32_t instance_id;
@@ -338,8 +331,6 @@ struct icnss_priv {
	uint8_t *diag_reg_read_buf;
	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;

drivers/soc/qcom/icnss_utils.c

deleted100644 → 0
+0 −154
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 enum cnss_cc_src icnss_cc_source = CNSS_SOURCE_CORE;

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);


void icnss_set_cc_source(enum cnss_cc_src cc_source)
{
	icnss_cc_source = cc_source;
}
EXPORT_SYMBOL(icnss_set_cc_source);

enum cnss_cc_src icnss_get_cc_source(void)
{
	return icnss_cc_source;
}
EXPORT_SYMBOL(icnss_get_cc_source);
+0 −19
Original line number Diff line number Diff line
@@ -23,12 +23,6 @@ enum icnss_uevent {
	ICNSS_UEVENT_FW_DOWN,
};

enum cnss_cc_src {
	CNSS_SOURCE_CORE,
	CNSS_SOURCE_11D,
	CNSS_SOURCE_USER
};

struct icnss_uevent_fw_down_data {
	bool crashed;
};
@@ -133,20 +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 void cnss_set_cc_source(enum cnss_cc_src cc_source);
extern enum cnss_cc_src cnss_get_cc_source(void);
extern int icnss_get_driver_load_cnt(void);
extern void icnss_increment_driver_load_cnt(void);
extern void icnss_set_cc_source(enum cnss_cc_src cc_source);
extern enum cnss_cc_src icnss_get_cc_source(void);
#endif /* _ICNSS_WLAN_H_ */