Skip to content

Commit c942476

Browse files
rado17krish2718
authored andcommitted
[nrf fromlist] drivers: wifi: nrf_wifi: Add P2P powersave support
Add ops to handle P2P powersave configuration. Upstream PR #: 97183 Signed-off-by: Ravi Dondaputi <[email protected]>
1 parent 92d535b commit c942476

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

drivers/wifi/nrf_wifi/inc/wpa_supp_if.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ int nrf_wifi_supp_set_country(void *if_priv, const char *alpha2);
133133
int nrf_wifi_supp_get_country(void *if_priv, char *alpha2);
134134
int nrf_wifi_supp_remain_on_channel(void *if_priv, unsigned int freq, unsigned int duration);
135135
int nrf_wifi_supp_cancel_remain_on_channel(void *if_priv);
136+
int nrf_wifi_supp_set_p2p_powersave(void *if_priv, int legacy_ps, int opp_ps, int ctwindow);
136137

137138
#endif /* CONFIG_NRF70_STA_MODE */
138139
#ifdef CONFIG_NRF70_AP_MODE

drivers/wifi/nrf_wifi/src/fmac_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,7 @@ static const struct zep_wpa_supp_dev_ops wpa_supp_ops = {
967967
.get_country = nrf_wifi_supp_get_country,
968968
.remain_on_channel = nrf_wifi_supp_remain_on_channel,
969969
.cancel_remain_on_channel = nrf_wifi_supp_cancel_remain_on_channel,
970+
.set_p2p_powersave = nrf_wifi_supp_set_p2p_powersave,
970971
#ifdef CONFIG_NRF70_AP_MODE
971972
.init_ap = nrf_wifi_wpa_supp_init_ap,
972973
.start_ap = nrf_wifi_wpa_supp_start_ap,

drivers/wifi/nrf_wifi/src/wpa_supp_if.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,6 +2151,51 @@ int nrf_wifi_supp_cancel_remain_on_channel(void *if_priv)
21512151
return status;
21522152
}
21532153

2154+
int nrf_wifi_supp_set_p2p_powersave(void *if_priv, int legacy_ps, int opp_ps, int ctwindow)
2155+
{
2156+
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
2157+
#ifdef NRF70_P2P_MODE
2158+
struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL;
2159+
struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL;
2160+
2161+
if (!if_priv) {
2162+
LOG_ERR("%s: Invalid params", __func__);
2163+
return -1;
2164+
}
2165+
vif_ctx_zep = if_priv;
2166+
rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep;
2167+
if (!rpu_ctx_zep) {
2168+
LOG_ERR("%s: rpu_ctx_zep is NULL", __func__);
2169+
return -1;
2170+
}
2171+
k_mutex_lock(&vif_ctx_zep->vif_lock, K_FOREVER);
2172+
if (!rpu_ctx_zep->rpu_ctx) {
2173+
LOG_DBG("%s: RPU context not initialized", __func__);
2174+
goto out;
2175+
}
2176+
2177+
if (legacy_ps == -1) {
2178+
status = 0;
2179+
goto out;
2180+
}
2181+
2182+
if (legacy_ps != 0 && legacy_ps != 1) {
2183+
LOG_ERR("%s: Invalid legacy_ps value: %d", __func__, legacy_ps);
2184+
goto out;
2185+
}
2186+
2187+
status = nrf_wifi_sys_fmac_set_power_save(rpu_ctx_zep->rpu_ctx, vif_ctx_zep->vif_idx,
2188+
legacy_ps);
2189+
if (status != NRF_WIFI_STATUS_SUCCESS) {
2190+
LOG_ERR("%s: nrf_wifi_fmac_set_p2p_powersave failed", __func__);
2191+
goto out;
2192+
}
2193+
out:
2194+
k_mutex_unlock(&vif_ctx_zep->vif_lock);
2195+
#endif /* NRF70_P2P_MODE */
2196+
return status;
2197+
}
2198+
21542199
#ifdef CONFIG_NRF70_AP_MODE
21552200
static int nrf_wifi_vif_state_change(struct nrf_wifi_vif_ctx_zep *vif_ctx_zep,
21562201
enum nrf_wifi_fmac_if_op_state state)

0 commit comments

Comments
 (0)