Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 80178ec9b1 |
+1
-1
@@ -66,7 +66,7 @@ BES2600_DRV_VERSION := bes2600_0.3.5_2024.0116
|
|||||||
ifeq ($(CONFIG_BES2600_CALIB_FROM_LINUX),y)
|
ifeq ($(CONFIG_BES2600_CALIB_FROM_LINUX),y)
|
||||||
FACTORY_CRC_CHECK ?= n
|
FACTORY_CRC_CHECK ?= n
|
||||||
STANDARD_FACTORY_EFUSE_FLAG ?= y
|
STANDARD_FACTORY_EFUSE_FLAG ?= y
|
||||||
FACTORY_PATH ?= bes2600/bes2600_factory.txt
|
FACTORY_PATH ?= /lib/firmware/bes2600_factory.txt
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# basic function
|
# basic function
|
||||||
|
|||||||
+19
-14
@@ -12,7 +12,6 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
#include <linux/firmware.h>
|
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
#include <linux/crc32.h>
|
#include <linux/crc32.h>
|
||||||
@@ -138,32 +137,38 @@ static int bes2600_factory_crc_check(struct factory_t *factory_data)
|
|||||||
*/
|
*/
|
||||||
static int factory_section_read_file(char *path, void *buffer)
|
static int factory_section_read_file(char *path, void *buffer)
|
||||||
{
|
{
|
||||||
const struct firmware *fw;
|
int ret = 0;
|
||||||
int ret;
|
struct file *fp;
|
||||||
|
|
||||||
if (!path || !buffer) {
|
if (!path || !buffer) {
|
||||||
bes_err("%s NULL pointer err\n", __func__);
|
bes_err("%s NULL pointer err\n", __func__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bes_devel("requesting firmware-class %s\n", path);
|
bes_devel("reading %s \n", path);
|
||||||
|
|
||||||
ret = request_firmware(&fw, path, NULL);
|
fp = filp_open(path, O_RDONLY, 0); //S_IRUSR
|
||||||
if (ret) {
|
if (IS_ERR(fp)) {
|
||||||
bes_devel("BES2600: request_firmware(%s) failed: %d\n", path, ret);
|
bes_devel("BES2600 : can't open %s\n",path);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fw->size == 0 || fw->size > FACTORY_MAX_SIZE) {
|
if (fp->f_inode->i_size <= 0 || fp->f_inode->i_size > FACTORY_MAX_SIZE) {
|
||||||
bes_err("bes2600_factory.txt size check failed, read_size: %zu max_size: %d\n",
|
bes_err( "bes2600_factory.txt size check failed, read_size: %lld max_size: %d\n",
|
||||||
fw->size, FACTORY_MAX_SIZE);
|
fp->f_inode->i_size, FACTORY_MAX_SIZE);
|
||||||
release_firmware(fw);
|
filp_close(fp, NULL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(buffer, fw->data, fw->size);
|
ret = kernel_read(fp, buffer, fp->f_inode->i_size, &fp->f_pos);
|
||||||
ret = (int)fw->size;
|
|
||||||
release_firmware(fw);
|
filp_close(fp, NULL);
|
||||||
|
|
||||||
|
if (ret != fp->f_inode->i_size) {
|
||||||
|
bes_err("bes2600_factory.txt read fail\n");
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-2
@@ -472,6 +472,7 @@ static int bes2600_pwr_enter_lp_mode(struct bes2600_common *hw_priv)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
struct bes2600_vif *priv;
|
struct bes2600_vif *priv;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
int timeouts = 0;
|
||||||
char ip_str[20];
|
char ip_str[20];
|
||||||
unsigned long status = 0;
|
unsigned long status = 0;
|
||||||
|
|
||||||
@@ -528,22 +529,35 @@ static int bes2600_pwr_enter_lp_mode(struct bes2600_common *hw_priv)
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
atomic_set(&hw_priv->bes_power.pm_set_in_process, 0);
|
atomic_set(&hw_priv->bes_power.pm_set_in_process, 0);
|
||||||
bes_err("%s, set operation mode fail\n", __func__);
|
bes_err("%s, set operation mode fail\n", __func__);
|
||||||
|
timeouts++;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wait power save mode changed indication */
|
/* wait power save mode changed indication */
|
||||||
status = wait_for_completion_timeout(&hw_priv->bes_power.pm_enter_cmpl, 5 * HZ);
|
status = wait_for_completion_timeout(&hw_priv->bes_power.pm_enter_cmpl, 5 * HZ);
|
||||||
atomic_set(&hw_priv->bes_power.pm_set_in_process, 0);
|
atomic_set(&hw_priv->bes_power.pm_set_in_process, 0);
|
||||||
reinit_completion(&hw_priv->bes_power.pm_enter_cmpl);
|
reinit_completion(&hw_priv->bes_power.pm_enter_cmpl);
|
||||||
if (!status)
|
if (!status) {
|
||||||
bes_err("%s, wait pm ind timeout\n", __func__);
|
bes_err("%s, wait pm ind timeout\n", __func__);
|
||||||
|
timeouts++;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
bes_devel("skip enter lp mode\n");
|
bes_devel("skip enter lp mode\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set device low power configuration */
|
/*
|
||||||
|
* Enter the device-end of the LP transition only if every per-VIF
|
||||||
|
* mac80211 handshake reached firmware-ACKed completion. Doing the
|
||||||
|
* device-LP setup while any VIF is still pending leaves the driver
|
||||||
|
* in an inconsistent state that cascades into SDIO TX errors on
|
||||||
|
* the BES2600.
|
||||||
|
*/
|
||||||
|
if (timeouts == 0)
|
||||||
bes2600_pwr_device_enter_lp_mode(hw_priv);
|
bes2600_pwr_device_enter_lp_mode(hw_priv);
|
||||||
|
else
|
||||||
|
ret = -ETIMEDOUT;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user