Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support kernel 5.10 #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ For compiling type
`make`
in source dir

* NOTE: For some ARM 64-bit system, add argument `ARCH=arm64` if the above command doesn't work

For install the driver use
`sudo insmod mt7612u.ko`

Expand Down
4 changes: 4 additions & 0 deletions chips/mt76x2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1624,6 +1624,7 @@ int mt76x2_get_rx_high_gain(RTMP_ADAPTER *ad)
else
cap->rf1_5g_grp5_rx_high_gain = -((value & RF1_5G_GRP5_RX_HIGH_GAIN_MASK) >> 12);
}
return 0;
}

static int mt76x2_get_tx_pwr_info(RTMP_ADAPTER *ad)
Expand Down Expand Up @@ -2330,6 +2331,8 @@ static int mt76x2_get_tx_pwr_info(RTMP_ADAPTER *ad)
/* check PA type combination */
RT28xx_EEPROM_READ16(ad, EEPROM_NIC1_OFFSET, value);
cap->PAType= GET_PA_TYPE(value);

return 0;
}

static u8 mt76x2_txpwr_chlist[] = {
Expand Down Expand Up @@ -2415,6 +2418,7 @@ static INT rf_tr_agc_config(RTMP_ADAPTER *pAd, INT rf_bw)
signed char rx_agc_fc_offset[3] = {2,2,2}; /* array idx 0: 20M, 1:40M, 2:80m */
UINT8 tx_agc_fc_offset[3] = {0,0,0}; /* array idx 0: 20M, 1:40M, 2:80m */
CHAR rf32_val, rf31_val, rf_diff;
return 0;
}

void mt76x2_get_tx_pwr_per_rate(RTMP_ADAPTER *ad)
Expand Down
1 change: 1 addition & 0 deletions common/rt_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2052,6 +2052,7 @@ INT get_vht_neighbor_index(IN UCHAR channel)
|| (channel == 144) || (channel == 161)) {
return -3;
}
return 0;
}

BOOLEAN AC_ChannelGroupCheck(
Expand Down
5 changes: 4 additions & 1 deletion include/os/rt_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,11 @@ typedef struct tasklet_struct *POS_NET_TASK_STRUCT;
typedef struct timer_list OS_NDIS_MINIPORT_TIMER;
typedef struct timer_list OS_TIMER;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
typedef void (*TIMER_FUNCTION)(struct timer_list*);
#else
typedef void (*TIMER_FUNCTION)(unsigned long);

#endif

#define OS_WAIT(_time) \
{ \
Expand Down
4 changes: 4 additions & 0 deletions os/linux/rt_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,13 @@ static inline VOID __RTMP_OS_Init_Timer(
IN PVOID data)
{
if (!timer_pending(pTimer)) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
timer_setup(pTimer, function, data);
#else
init_timer(pTimer);
pTimer->data = (unsigned long)data;
pTimer->function = function;
#endif
}
}

Expand Down
8 changes: 8 additions & 0 deletions os/linux/sta_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2510,7 +2510,11 @@ INT rt28xx_sta_ioctl(struct net_device *net_dev, struct ifreq *rq, INT cmd)
case SIOCGIWPRIV:
if (wrqin->u.data.pointer)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
if ( access_ok(wrqin->u.data.pointer, sizeof(privtab)) != TRUE)
#else
if ( access_ok(VERIFY_WRITE, wrqin->u.data.pointer, sizeof(privtab)) != TRUE)
#endif
break;
if ((sizeof(privtab) / sizeof(privtab[0])) <= wrq->u.data.length)
{
Expand All @@ -2523,7 +2527,11 @@ INT rt28xx_sta_ioctl(struct net_device *net_dev, struct ifreq *rq, INT cmd)
}
break;
case RTPRIV_IOCTL_SET:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
if(access_ok(wrqin->u.data.pointer, wrqin->u.data.length) != TRUE)
#else
if(access_ok(VERIFY_READ, wrqin->u.data.pointer, wrqin->u.data.length) != TRUE)
#endif
break;
return rt_ioctl_setparam(net_dev, NULL, NULL, wrqin->u.data.pointer);
break;
Expand Down