b9e340c78c
The bes2600 driver is a fork of the upstream cw1200 driver
(drivers/net/wireless/st/cw1200/, ST-Ericsson, Dmitry Tarnyagin
2010-2011). The fork's file headers have three GPL-compliance issues:
1. NO SPDX-License-Identifier on any of 48 source files (cw1200
mainline has them on all 25). kernel.org-mandated since 2017.
2. Original "Copyright (c) 2010, ST-Ericsson" lines stripped from
all files inherited from cw1200, replaced with
"Copyright (c) 2010, Bestechnic" — factually impossible
(Bestechnic did not author the 2010 work) and a GPL-2.0 §1
attribution-preservation violation.
3. The "GPL version 2 as published by the Free Software Foundation"
boilerplate paragraph is redundant alongside SPDX and is the
legacy form modern kernel sources have replaced.
This patch corrects all three for the 48 .c/.h files in bes2600/:
- Adds `// SPDX-License-Identifier: GPL-2.0-only` (or `/* ... */`
for headers) as line 1 of every file.
- Restores `Copyright (c) 2010, ST-Ericsson` + `Author: Dmitry
Tarnyagin <dmitry.tarnyagin@lockless.no>` as the FIRST copyright
chain entry on all 22 files derived from cw1200 (bh.{c,h},
debug.{c,h}, fwio.{c,h}, hwio.{c,h}, main.c, pm.{c,h},
queue.{c,h}, scan.{c,h}, sta.{c,h}, txrx.{c,h}, wsm.{c,h}).
- Keeps `Copyright (c) 2022, Bestechnic (Beijing) Co., Ltd.` as
the SECOND chain entry where Bestechnic genuinely contributed.
- Notes "Derived from cw1200_sdio.c" + ST-Ericsson copyright on
bes2600_sdio.c (heavy derivation, not a literal rename).
- Notes "Replaces hwbus.h from cw1200/" + ST-Ericsson copyright
on sbus.h.
- Preserves the prism54/islsm authorship chain on main.c and
bes2600.h (Michael Wu 2006 + Jean-Baptiste Note 2004-2006).
- Drops the GPL-2.0 boilerplate paragraph in favour of SPDX.
No code changes — only file-header comment blocks. Module build is
unaffected (verified by header-only diff scope).
This is a prerequisite for any kernel.org submission attempt. The
existing MODULE_LICENSE("GPL") + MODULE_AUTHOR(Tarnyagin@stericsson.com)
declarations were already present and are unchanged here; the
mismatch between MODULE_AUTHOR and the (since-corrected) per-file
copyrights is now resolved.
141 lines
3.8 KiB
C
141 lines
3.8 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* WiFi testmode commands for BES2600
|
|
*
|
|
* Copyright (c) 2022, Bestechnic (Beijing) Co., Ltd.
|
|
*
|
|
*/
|
|
#ifdef CONFIG_BES2600_TESTMODE
|
|
#include <net/netlink.h>
|
|
#include <linux/module.h>
|
|
#include <linux/firmware.h>
|
|
#include <linux/etherdevice.h>
|
|
#include <linux/vmalloc.h>
|
|
#include <linux/random.h>
|
|
#include <linux/sched.h>
|
|
#include <net/mac80211.h>
|
|
#include <linux/time.h>
|
|
#include <linux/string.h>
|
|
|
|
#include "wsm.h"
|
|
#include "bes2600.h"
|
|
#include "bes_nl80211_testmode_msg.h"
|
|
#include "bes_chardev.h"
|
|
#include "bes2600_factory.h"
|
|
|
|
|
|
/* store the reply message of the rf cmd */
|
|
static struct vendor_rf_cmd_msg_reply vendor_rf_cmd_reply;
|
|
|
|
extern int bes2600_testmode_reply(struct wiphy *wiphy, const void *data, int len);
|
|
|
|
void bes2600_rf_cmd_msg_assembly(u32 cmd_type, void *data, u32 msg_len)
|
|
{
|
|
vendor_rf_cmd_reply.id = cmd_type;
|
|
vendor_rf_cmd_reply.msg_len = msg_len + 2 * sizeof(u32);
|
|
|
|
if (msg_len)
|
|
memcpy(vendor_rf_cmd_reply.ret_msg, (u8 *)data, msg_len);
|
|
else
|
|
vendor_rf_cmd_reply.ret_msg[0] = '\0';
|
|
|
|
}
|
|
|
|
/**
|
|
* bes2600_vendor_rf_cmd, signaling cmd & rf nosignaling cmd
|
|
* reaches bes2600
|
|
*
|
|
* @hw: the hardware
|
|
* @vif: vif
|
|
* @data: incoming data
|
|
* @len: incoming data length
|
|
*
|
|
* Returns: 0 on success or non zero value on failure
|
|
*/
|
|
int bes2600_vendor_rf_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u8 *data, int len)
|
|
{
|
|
struct bes2600_common *hw_priv = hw->priv;
|
|
int ret = 0;
|
|
int recv_timeout = 1500; /*waiting for reply message*/
|
|
struct vendor_rf_cmd_t *vendor_rf_cmd = (struct vendor_rf_cmd_t *)data;
|
|
//struct timeval tstart, tend;
|
|
int if_id = 0;
|
|
u32 count, cmd_len, cmd_type;
|
|
|
|
count = vendor_rf_cmd->cmd_argc;
|
|
cmd_len = vendor_rf_cmd->cmd_len;
|
|
cmd_type = vendor_rf_cmd->cmd_type;
|
|
|
|
if (count == 0 || cmd_len == 0 ||
|
|
strlen(vendor_rf_cmd->cmd) + 1 != cmd_len) {
|
|
bes2600_err(BES2600_DBG_TEST_MODE, "%s line: %d, "
|
|
"vendor rf cmd parsing failed\n", __func__, __LINE__);
|
|
return -EINVAL;
|
|
}
|
|
|
|
bes2600_info(BES2600_DBG_TEST_MODE, "vendor cmd = %s\n", vendor_rf_cmd->cmd);
|
|
|
|
|
|
/**
|
|
* signaling mode does not support the saving of calibration files,
|
|
* but the saved calibration values can be read.
|
|
*
|
|
*/
|
|
if (bes2600_chrdev_is_signal_mode()) {
|
|
if (cmd_type == VENDOR_RF_SAVE_FREQOFFSET_CMD ||
|
|
cmd_type == VENDOR_RF_SAVE_POWERLEVEL_CMD ||
|
|
cmd_type == VENDOR_RF_POWER_CALIB_FINISH)
|
|
return -EOPNOTSUPP;
|
|
}
|
|
|
|
if (cmd_type == VENDOR_RF_SIG_NOSIG_MIX) {
|
|
if (bes2600_chrdev_is_signal_mode()) {
|
|
vendor_rf_cmd->cmd_type = VENDOR_RF_SIGNALING_CMD;
|
|
cmd_type = VENDOR_RF_SIGNALING_CMD;
|
|
} else {
|
|
vendor_rf_cmd->cmd_type = VENDOR_RF_NOSIGNALING_CMD;
|
|
cmd_type = VENDOR_RF_NOSIGNALING_CMD;
|
|
}
|
|
}
|
|
|
|
switch (cmd_type) {
|
|
case VENDOR_RF_POWER_CALIB_FINISH:
|
|
case VENDOR_RF_GET_SAVE_FREQOFFSET_CMD:
|
|
case VENDOR_RF_GET_SAVE_POWERLEVEL_CMD:
|
|
case VENDOR_RF_SIGNALING_CMD:
|
|
case VENDOR_RF_NOSIGNALING_CMD:
|
|
case VENDOR_RF_SAVE_FREQOFFSET_CMD:
|
|
case VENDOR_RF_SAVE_POWERLEVEL_CMD:
|
|
case VENDOR_RF_GET_CALI_FROM_EFUSE:
|
|
sema_init(&hw_priv->vendor_rf_cmd_replay_sema, 0);
|
|
ret = wsm_vendor_rf_cmd(hw_priv, if_id, vendor_rf_cmd);
|
|
|
|
if (ret) {
|
|
bes2600_err(BES2600_DBG_TEST_MODE, "vendor rf cmd send error code = %d\n", ret);
|
|
return ret;
|
|
}
|
|
|
|
//do_gettimeofday(&tstart);
|
|
if (down_timeout(&hw_priv->vendor_rf_cmd_replay_sema, recv_timeout)) {
|
|
bes2600_err(BES2600_DBG_TEST_MODE, "vendor rf cmd failed to receive reply message\n");
|
|
return -ENOMSG;
|
|
}
|
|
//do_gettimeofday(&tend);
|
|
//bes2600_dbg(BES2600_DBG_TEST_MODE,"recv time: %ldms\n",
|
|
//1000 * (tend.tv_sec - tstart.tv_sec) + (tend.tv_usec - tstart.tv_usec) / 1000);
|
|
|
|
ret = bes2600_testmode_reply(hw->wiphy, &vendor_rf_cmd_reply, vendor_rf_cmd_reply.msg_len);
|
|
vendor_rf_cmd_reply.ret_msg[0] = '\0';
|
|
break;
|
|
case VENDOR_RF_SIG_NOSIG_MIX:
|
|
ret = 0;
|
|
break;
|
|
default:
|
|
ret = -EOPNOTSUPP;
|
|
break;
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
#endif /* CONFIG_BES2600_TESTMODE */
|