[PATCH v6 15/17] wifi: cc33xx: Add ps.c, ps.h
From: Ramesh Ramalingam
Date: Thu Dec 03 2026 - 02:10:57 EST
From: Michael Nemanov <michael.nemanov@xxxxxx>
80211 power-save modes are handled automatically by HW but
can be overridden here.
Signed-off-by: Michael Nemanov <michael.nemanov@xxxxxx>
Signed-off-by: Ramesh Ramalingam <r-ramalingam@xxxxxx>
---
drivers/net/wireless/ti/cc33xx/ps.c | 39 +++++++++++++++++++++++++++++
drivers/net/wireless/ti/cc33xx/ps.h | 14 +++++++++++
2 files changed, 53 insertions(+)
create mode 100644 drivers/net/wireless/ti/cc33xx/ps.c
create mode 100644 drivers/net/wireless/ti/cc33xx/ps.h
diff --git a/drivers/net/wireless/ti/cc33xx/ps.c b/drivers/net/wireless/ti/cc33xx/ps.c
new file mode 100644
index 000000000000..f2ed1678edb9
--- /dev/null
+++ b/drivers/net/wireless/ti/cc33xx/ps.c
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2022-2026 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include "ps.h"
+#include "debug.h"
+
+int cc33xx_ps_set_mode(struct cc33xx *cc, struct cc33xx_vif *wlvif,
+ enum cc33xx_cmd_ps_mode_e mode)
+{
+ int ret;
+ u16 timeout = cc->conf.host_conf.conn.dynamic_ps_timeout;
+
+ switch (mode) {
+ case STATION_AUTO_PS_MODE:
+ case STATION_POWER_SAVE_MODE:
+ ret = cc33xx_cmd_ps_mode(cc, wlvif, mode, timeout);
+ if (ret < 0)
+ return ret;
+
+ set_bit(WLVIF_FLAG_IN_PS, &wlvif->flags);
+ break;
+
+ case STATION_ACTIVE_MODE:
+ ret = cc33xx_cmd_ps_mode(cc, wlvif, mode, 0);
+ if (ret < 0)
+ return ret;
+
+ clear_bit(WLVIF_FLAG_IN_PS, &wlvif->flags);
+ break;
+
+ default:
+ dev_warn(cc->dev, "trying to set ps to unsupported mode %d\n", mode);
+ ret = -EINVAL;
+ }
+
+ return ret;
+}
diff --git a/drivers/net/wireless/ti/cc33xx/ps.h b/drivers/net/wireless/ti/cc33xx/ps.h
new file mode 100644
index 000000000000..155c903fdac3
--- /dev/null
+++ b/drivers/net/wireless/ti/cc33xx/ps.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0-only
+ *
+ * Copyright (C) 2022-2026 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#ifndef __PS_H__
+#define __PS_H__
+
+#include "acx.h"
+
+int cc33xx_ps_set_mode(struct cc33xx *cc, struct cc33xx_vif *wlvif,
+ enum cc33xx_cmd_ps_mode_e mode);
+
+#endif /* __PS_H__ */
--
2.34.1