Fix SSD2092 wake, fuel-gauge jump, XLibre rotation, media keys, and popup rendering
This commit is contained in:
1 parent
7f3b3c2c0c
commit
dbc0275979
43 files changed
+3388
-115
No files matched your search
@@ -0,0 +1,823 @@
|
||||
From: Geminux Project <dev@geminux.local>
|
||||
Subject: [PATCH] geminux: fix SSD2092 wake, MT6351 fuel-gauge accuracy, and SPM standby
|
||||
|
||||
- Ensure mtk_dsi holds WAKEUP_EN >= 1 ms on ULPS exit, stays in LP mode
|
||||
through LPM panel init before enabling HS clock for video mode, skips
|
||||
redundant 500 ms VM_DONE waits when already in CMD_MODE, and avoids
|
||||
restarting video mode while dsi->enabled is false.
|
||||
- Send the vendor Solomon SSD2092 register initialization sequence on
|
||||
adopted wake when waking from sleep, and match the 50 ms display-on settle.
|
||||
- Defer Solomon SSD2092 touch resume (.complete + 60 ms) until after DRM
|
||||
wakes the display, using vendor DS_CUP_CONTROL (0x0002) LPM wake retries
|
||||
without pulsing shared TDDI reset GPIO68 while display is active.
|
||||
- Reject stale MT6351 AUXADC_ADC21 start-up OCV across warm reboots/reflashes,
|
||||
scale reported capacity properly across [empty_pct .. full], and refresh
|
||||
empty/untrusted anchors when userspace restores learned_resistance_uohm.
|
||||
- Enable mt6797-spm-sleep hardware suspend loop, power down unlit AW9120 LEDs
|
||||
during suspend, and clear INFRA_AO_MD_SRCCLKENA when CCCI MD1 stays gated.
|
||||
|
||||
---
|
||||
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
|
||||
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
|
||||
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/component.h>
|
||||
+#include <linux/delay.h>
|
||||
#include <linux/iopoll.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/of.h>
|
||||
@@ -347,6 +348,7 @@
|
||||
{
|
||||
mtk_dsi_mask(dsi, DSI_PHY_LCCON, LC_ULPM_EN, 0);
|
||||
mtk_dsi_mask(dsi, DSI_PHY_LCCON, LC_WAKEUP_EN, LC_WAKEUP_EN);
|
||||
+ usleep_range(1000, 1200);
|
||||
mtk_dsi_mask(dsi, DSI_PHY_LCCON, LC_WAKEUP_EN, 0);
|
||||
}
|
||||
|
||||
@@ -360,6 +362,7 @@
|
||||
{
|
||||
mtk_dsi_mask(dsi, DSI_PHY_LD0CON, LD0_ULPM_EN, 0);
|
||||
mtk_dsi_mask(dsi, DSI_PHY_LD0CON, LD0_WAKEUP_EN, LD0_WAKEUP_EN);
|
||||
+ usleep_range(1000, 1200);
|
||||
mtk_dsi_mask(dsi, DSI_PHY_LD0CON, LD0_WAKEUP_EN, 0);
|
||||
}
|
||||
|
||||
@@ -838,7 +841,6 @@
|
||||
mtk_dsi_config_vdo_timing(dsi);
|
||||
mtk_dsi_set_interrupt_enable(dsi);
|
||||
mtk_dsi_lane_ready(dsi);
|
||||
- mtk_dsi_clk_hs_mode(dsi, 1);
|
||||
writel(0, dsi->regs + DSI_INTSTA);
|
||||
enable_irq(dsi->irq);
|
||||
|
||||
@@ -869,7 +871,8 @@
|
||||
*/
|
||||
mtk_dsi_stop(dsi);
|
||||
|
||||
- mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500);
|
||||
+ if ((readl(dsi->regs + DSI_MODE_CTRL) & MODE) != CMD_MODE)
|
||||
+ mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500);
|
||||
mtk_dsi_reset_engine(dsi);
|
||||
mtk_dsi_lane0_ulp_mode_enter(dsi);
|
||||
mtk_dsi_clk_ulp_mode_enter(dsi);
|
||||
@@ -892,6 +895,10 @@
|
||||
if (dsi->enabled)
|
||||
return;
|
||||
|
||||
+ if (!mtk_dsi_clk_hs_state(dsi)) {
|
||||
+ mtk_dsi_clk_hs_mode(dsi, 1);
|
||||
+ usleep_range(200, 300);
|
||||
+ }
|
||||
mtk_dsi_set_mode(dsi);
|
||||
mtk_dsi_start(dsi);
|
||||
|
||||
@@ -957,7 +964,8 @@
|
||||
drm_err(drm, "failed to power on dsi\n");
|
||||
|
||||
mtk_dsi_lane_ready(dsi);
|
||||
- mtk_dsi_clk_hs_mode(dsi, 1);
|
||||
+ if (!(dsi->mode_flags & MIPI_DSI_MODE_LPM))
|
||||
+ mtk_dsi_clk_hs_mode(dsi, 1);
|
||||
}
|
||||
|
||||
static void mtk_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge,
|
||||
@@ -1210,15 +1218,32 @@
|
||||
static ssize_t mtk_dsi_host_send_cmd(struct mtk_dsi *dsi,
|
||||
const struct mipi_dsi_msg *msg, u8 flag)
|
||||
{
|
||||
+ bool restore_hs_clk = false;
|
||||
+ ssize_t ret = 0;
|
||||
+
|
||||
+ if ((msg->flags & MIPI_DSI_MSG_USE_LPM) && mtk_dsi_clk_hs_state(dsi)) {
|
||||
+ mtk_dsi_clk_hs_mode(dsi, false);
|
||||
+ usleep_range(200, 300);
|
||||
+ restore_hs_clk = true;
|
||||
+ } else if (!(msg->flags & MIPI_DSI_MSG_USE_LPM) && !mtk_dsi_clk_hs_state(dsi)) {
|
||||
+ mtk_dsi_clk_hs_mode(dsi, true);
|
||||
+ usleep_range(200, 300);
|
||||
+ }
|
||||
+
|
||||
mtk_dsi_wait_for_idle(dsi);
|
||||
mtk_dsi_irq_data_clear(dsi, flag);
|
||||
mtk_dsi_cmdq(dsi, msg);
|
||||
mtk_dsi_start(dsi);
|
||||
|
||||
if (!mtk_dsi_wait_for_irq_done(dsi, flag, 2000))
|
||||
- return -ETIME;
|
||||
- else
|
||||
- return 0;
|
||||
+ ret = -ETIME;
|
||||
+
|
||||
+ if (restore_hs_clk) {
|
||||
+ usleep_range(200, 300);
|
||||
+ mtk_dsi_clk_hs_mode(dsi, true);
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host,
|
||||
@@ -1284,7 +1309,7 @@
|
||||
recv_cnt, *((u8 *)(msg->tx_buf)));
|
||||
|
||||
restore_dsi_mode:
|
||||
- if (dsi_mode & MODE) {
|
||||
+ if ((dsi_mode & MODE) && dsi->enabled) {
|
||||
mtk_dsi_set_mode(dsi);
|
||||
mtk_dsi_start(dsi);
|
||||
}
|
||||
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
|
||||
--- a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
|
||||
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
|
||||
@@ -790,6 +790,194 @@
|
||||
* survives this module: on the loader's first frame it is awake, and nothing is
|
||||
* sent.
|
||||
*/
|
||||
+static void ssd2092_gemini_1080x2160_init(struct mipi_dsi_multi_context *ctx)
|
||||
+{
|
||||
+ mipi_dsi_dcs_set_display_off_multi(ctx);
|
||||
+ mipi_dsi_dcs_enter_sleep_mode_multi(ctx);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb5, 0x00, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb3, 0x03, 0x96 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb4, 0x21, 0xff }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xe1, 0x00, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xe1, 0x03, 0x00, 0x10 }, 4);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb0, 0x04, 0x01 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb0, 0x07, 0x14 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xc6, 0x04, 0x2d }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb9, 0x0e, 0x44 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xc1, 0x0c, 0x26 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xc1, 0x08, 0x99 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb9, 0x23, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xc2, 0x04, 0x0f }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb9, 0x11, 0x22 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb9, 0x12, 0x22 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb9, 0x13, 0x22 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb3, 0x19, 0x0b }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb0, 0x3d, 0xc8 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb3, 0x0f, 0x20 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0x36, 0x02 }, 2);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xc7, 0x01, 0x09 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb3, 0x15, 0x80 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb3, 0x1e, 0x02 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb3, 0x14, 0xc0 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb3, 0x16, 0x50 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb3, 0x1c, 0xe4 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb3, 0x28, 0x09 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb3, 0x24, 0x19 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb0, 0x12, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb0, 0x13, 0x14 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb0, 0x1a, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb0, 0x1b, 0x14 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xc1, 0x0d, 0x87 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xc1, 0x0e, 0x87 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xc3, 0x00, 0x10, 0x2e, 0x3e, 0x48, 0x5e, 0x6b, 0x7a, 0x83, 0x97, 0xa3, 0xa8, 0xa5, 0xac, 0xad, 0xb5, 0xc1, 0xc4, 0x4e, 0x4f, 0x59, 0x5a }, 23);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xc3, 0x15, 0x10, 0x2e, 0x3e, 0x48, 0x5e, 0x6b, 0x7a, 0x83, 0x97, 0xa3, 0xa8, 0xa5, 0xac, 0xad, 0xb5, 0xc1, 0xc4, 0x4e, 0x4f, 0x59, 0x5a }, 23);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x01, 0x8a }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x02, 0x23 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x03, 0xbc }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x04, 0xc0 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x05, 0x19 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x06, 0x37 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x07, 0xee }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x08, 0xdd }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x09, 0xcc }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x0a, 0x36 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x0b, 0x70 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x0c, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x0d, 0x8a }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x0e, 0x23 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x0f, 0xbc }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x10, 0xc0 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x11, 0x18 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x12, 0xa7 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x13, 0xee }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x14, 0xdd }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x15, 0xcc }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x16, 0x36 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x17, 0x70 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x18, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x31, 0x01 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x00, 0xf0 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x01, 0xf0 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x02, 0xf0 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x03, 0xf0 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x1a, 0x02 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x1b, 0x24 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x1d, 0x01 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x1e, 0x01 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x21, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x1f, 0x79 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x20, 0x14 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x22, 0x89 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x23, 0x13 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x24, 0x35 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x26, 0x01 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x27, 0x01 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x2a, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x28, 0x79 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x29, 0x14 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x2b, 0x89 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x2c, 0x33 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x2d, 0x33 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x2e, 0x11 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x2f, 0x11 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x31, 0x22 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x32, 0x01 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x33, 0x04 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x34, 0x11 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x35, 0x11 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x37, 0x22 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x38, 0x01 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x39, 0x04 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x3a, 0x1e }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x3b, 0x1e }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x3c, 0x1e }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x3d, 0x1e }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x40, 0xaa }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x42, 0x1e }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x43, 0x1e }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x44, 0x1e }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x45, 0x1e }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x48, 0xaa }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x02, 0x05 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x03, 0x01 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbc, 0x1e, 0x71 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbc, 0x24, 0x83 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb8, 0x03, 0xa9 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x15, 0x41 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x19, 0x8a }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x1a, 0x32 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x1b, 0xbc }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x1c, 0xc2 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x1d, 0x39 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x1e, 0x37 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x1f, 0xee }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x20, 0xdd }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x21, 0xcc }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x22, 0x36 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x23, 0x70 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x24, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x25, 0x8a }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x26, 0x32 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x27, 0xbc }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x28, 0xc2 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x29, 0x38 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x2a, 0xa7 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x2b, 0xee }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x2c, 0xdd }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x2d, 0xcc }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x2e, 0x36 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x2f, 0x70 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbb, 0x30, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb8, 0x15, 0xa2 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb0, 0x39, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xc6, 0x00, 0x03, 0x40 }, 4);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb3, 0x18, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x17, 0x28 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x23, 0x15 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb0, 0x06, 0x2c }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x17, 0x28 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x23, 0x15 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x16, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x28, 0x02, 0x02 }, 4);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x0f, 0x8c }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x10, 0x0c }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x11, 0x23 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x12, 0x9d, 0x9d, 0x9d }, 5);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x25, 0x22 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x0d, 0x40, 0x02 }, 4);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x2f, 0x8c }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xc2, 0x04, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xc2, 0x05, 0xc0 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb9, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 11);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x15, 0x33 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb9, 0x00, 0x5f, 0x5f, 0x61, 0x0a }, 6);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x08, 0x07 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x09, 0x07 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbc, 0x03, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbc, 0x04, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbc, 0x05, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbc, 0x07, 0x10 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbc, 0x08, 0x10 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbc, 0x09, 0x10 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb9, 0x11, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb9, 0x12, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb9, 0x13, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb9, 0x1d, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb9, 0x1e, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb9, 0x1f, 0x00 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xc2, 0x00, 0x07 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xc1, 0x0b, 0x1f }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb1, 0x05, 0x2f }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0x35, 0x00 }, 2);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb0, 0x01, 0x08, 0x70 }, 4);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb9, 0x25, 0xa0 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xba, 0x2f, 0xcc }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xc1, 0x02, 0xb0 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb3, 0x1c, 0xc4 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xb3, 0x1d, 0x80 }, 3);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0xbd, 0x11, 0x02, 0x22 }, 4);
|
||||
+ nt36672e_gemini_write_cmd(ctx, (const u8[]){ 0x36, 0x09 }, 2);
|
||||
+}
|
||||
+
|
||||
static bool gemini_prop_has_ssd2092(const void *prop, int len)
|
||||
{
|
||||
int i;
|
||||
@@ -840,6 +1028,8 @@
|
||||
if (ctx->awake)
|
||||
return 0;
|
||||
dsi->mode_flags |= MIPI_DSI_MODE_LPM;
|
||||
+ if (ctx->desc->init_sequence)
|
||||
+ ctx->desc->init_sequence(&mctx);
|
||||
mipi_dsi_dcs_exit_sleep_mode_multi(&mctx);
|
||||
mipi_dsi_msleep(&mctx, ctx->desc->exit_sleep_delay_ms);
|
||||
mipi_dsi_dcs_set_display_on_multi(&mctx);
|
||||
@@ -1028,6 +1218,7 @@
|
||||
.format = MIPI_DSI_FMT_RGB888,
|
||||
.lanes = 4,
|
||||
.panel_name = "Gemini SSD2092 1080x2160 panel",
|
||||
+ .init_sequence = ssd2092_gemini_1080x2160_init,
|
||||
.can_adopt = true,
|
||||
.no_dcs_read = true,
|
||||
.power_on_delay_ms = 20,
|
||||
@@ -1037,7 +1228,7 @@
|
||||
.display_off_delay_ms = 50,
|
||||
.sleep_in_delay_ms = 120,
|
||||
.exit_sleep_delay_ms = 120,
|
||||
- .display_on_delay_ms = 20,
|
||||
+ .display_on_delay_ms = 50,
|
||||
};
|
||||
|
||||
static int nt36672e_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector)
|
||||
diff --git a/drivers/input/touchscreen/novatek-nt36xxx.c b/drivers/input/touchscreen/novatek-nt36xxx.c
|
||||
--- a/drivers/input/touchscreen/novatek-nt36xxx.c
|
||||
+++ b/drivers/input/touchscreen/novatek-nt36xxx.c
|
||||
@@ -28,11 +28,13 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
+#include <linux/workqueue.h>
|
||||
|
||||
#include <linux/unaligned.h>
|
||||
|
||||
#define NVT36XXX_HW_ADDR 0x62
|
||||
#define SSD2092_I2C_ADDR 0x53
|
||||
+#define SSD2092_DS_CUP_CONTROL 0x0002
|
||||
#define SSD2092_X_MAX 1080
|
||||
#define SSD2092_Y_MAX 2160
|
||||
#define NVT36XXX_FW_ADDR 0x01
|
||||
@@ -75,7 +77,11 @@
|
||||
u32 orig_irq_type;
|
||||
u8 fw_version;
|
||||
u16 pid;
|
||||
+ u16 last_fw_touch;
|
||||
+ u16 last_fw_disp;
|
||||
bool is_ssd2092;
|
||||
+ bool irq_disabled;
|
||||
+ struct delayed_work resume_work;
|
||||
};
|
||||
|
||||
static int nvt36xxx_write(struct nvt36xxx_data *data, u16 target,
|
||||
@@ -562,6 +568,9 @@
|
||||
int ret = -EIO;
|
||||
int i;
|
||||
|
||||
+ data->last_fw_touch = 0;
|
||||
+ data->last_fw_disp = 0;
|
||||
+
|
||||
for (i = 0; i < 6; i++) {
|
||||
ret = ssd2092_write_u16(data->ssl, 0x0050, 0x0000);
|
||||
if (!ret)
|
||||
@@ -580,6 +589,8 @@
|
||||
if (!ssd2092_read(data->ssl, 0x0057, buf, sizeof(buf)))
|
||||
y_nodes = get_unaligned_le16(buf);
|
||||
|
||||
+ data->last_fw_touch = fw_touch;
|
||||
+ data->last_fw_disp = fw_disp;
|
||||
data->raw_x_max = SSD2092_X_MAX;
|
||||
data->raw_y_max = SSD2092_Y_MAX;
|
||||
dev_info(dev, "SSD2092 FW touch=%#06x disp=%#06x nodes=%ux%u\n",
|
||||
@@ -724,6 +735,68 @@
|
||||
irq_set_irq_type(data->client->irq, data->orig_irq_type);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Vendor lpm_end2 sequence: wake the SSD2092 TDDI DS16 MCU via
|
||||
+ * DS_CUP_CONTROL (0x0002) twice without toggling shared GPIO68 reset, which
|
||||
+ * would blank the active display pipeline.
|
||||
+ */
|
||||
+static int ssd2092_lpm_wake(struct nvt36xxx_data *data)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = ssd2092_write_u16(data->ssl, SSD2092_DS_CUP_CONTROL, 0x0000);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ usleep_range(1000, 1500);
|
||||
+ ret = ssd2092_write_u16(data->ssl, SSD2092_DS_CUP_CONTROL, 0x0000);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ msleep(5);
|
||||
+
|
||||
+ ret = ssd2092_hw_init(data);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ if (!data->last_fw_touch && !data->last_fw_disp)
|
||||
+ return -EIO;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void ssd2092_resume_work_fn(struct work_struct *work)
|
||||
+{
|
||||
+ struct nvt36xxx_data *data =
|
||||
+ container_of(work, struct nvt36xxx_data, resume_work.work);
|
||||
+ struct device *dev = &data->client->dev;
|
||||
+ int ret = -EIO;
|
||||
+ int attempt;
|
||||
+
|
||||
+ if (!data->vcc_reg)
|
||||
+ ssd2092_enable_pmic_vldo28();
|
||||
+
|
||||
+ for (attempt = 0; attempt < 5; attempt++) {
|
||||
+ ret = ssd2092_lpm_wake(data);
|
||||
+ if (!ret)
|
||||
+ break;
|
||||
+ msleep(20);
|
||||
+ }
|
||||
+ if (ret) {
|
||||
+ ret = ssd2092_boot_seeprom(data);
|
||||
+ if (!ret)
|
||||
+ ret = ssd2092_hw_init(data);
|
||||
+ if (ret)
|
||||
+ dev_warn(dev, "SSD2092 resume init failed: %d\n", ret);
|
||||
+ }
|
||||
+
|
||||
+ if (data->irq_disabled) {
|
||||
+ data->irq_disabled = false;
|
||||
+ enable_irq(data->client->irq);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void ssd2092_cancel_resume_work(void *arg)
|
||||
+{
|
||||
+ cancel_delayed_work_sync(arg);
|
||||
+}
|
||||
+
|
||||
static int ssd2092_probe(struct i2c_client *client, struct nvt36xxx_data *data)
|
||||
{
|
||||
struct device *dev = &client->dev;
|
||||
@@ -747,6 +820,7 @@
|
||||
data->orig_irq_type = dt_trig;
|
||||
|
||||
data->is_ssd2092 = true;
|
||||
+ INIT_DELAYED_WORK(&data->resume_work, ssd2092_resume_work_fn);
|
||||
ret = ssd2092_setup_power_and_reset(data);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -810,6 +884,11 @@
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "failed to request SSD2092 IRQ\n");
|
||||
|
||||
+ ret = devm_add_action_or_reset(dev, ssd2092_cancel_resume_work,
|
||||
+ &data->resume_work);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -908,19 +987,44 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int nvt36xxx_suspend(struct device *dev)
|
||||
+static int __maybe_unused nvt36xxx_pm_prepare(struct device *dev)
|
||||
{
|
||||
struct nvt36xxx_data *data = dev_get_drvdata(dev);
|
||||
|
||||
- disable_irq(data->client->irq);
|
||||
-
|
||||
- /* A finger down at suspend would otherwise stay down until it lifts */
|
||||
- if (data->is_ssd2092) {
|
||||
- memset(data->slots, 0, sizeof(data->slots));
|
||||
- ssd2092_report_slots(data);
|
||||
+ if (!data->is_ssd2092)
|
||||
return 0;
|
||||
+
|
||||
+ cancel_delayed_work_sync(&data->resume_work);
|
||||
+ if (!data->irq_disabled) {
|
||||
+ disable_irq(data->client->irq);
|
||||
+ data->irq_disabled = true;
|
||||
}
|
||||
+ memset(data->slots, 0, sizeof(data->slots));
|
||||
+ ssd2092_report_slots(data);
|
||||
+ return 0;
|
||||
+}
|
||||
|
||||
+static void __maybe_unused nvt36xxx_pm_complete(struct device *dev)
|
||||
+{
|
||||
+ struct nvt36xxx_data *data = dev_get_drvdata(dev);
|
||||
+
|
||||
+ if (!data->is_ssd2092)
|
||||
+ return;
|
||||
+
|
||||
+ schedule_delayed_work(&data->resume_work, msecs_to_jiffies(60));
|
||||
+}
|
||||
+
|
||||
+static int __maybe_unused nvt36xxx_suspend(struct device *dev)
|
||||
+{
|
||||
+ struct nvt36xxx_data *data = dev_get_drvdata(dev);
|
||||
+
|
||||
+ /* SSD2092 TDDI touch quiesces in .prepare before panel/DSI sleep. */
|
||||
+ if (data->is_ssd2092)
|
||||
+ return 0;
|
||||
+
|
||||
+ disable_irq(data->client->irq);
|
||||
+
|
||||
+ /* A finger down at suspend would otherwise stay down until it lifts */
|
||||
input_mt_sync_frame(data->input);
|
||||
input_report_key(data->input, BTN_TOUCH, 0);
|
||||
input_sync(data->input);
|
||||
@@ -928,30 +1032,24 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int nvt36xxx_resume(struct device *dev)
|
||||
+static int __maybe_unused nvt36xxx_resume(struct device *dev)
|
||||
{
|
||||
struct nvt36xxx_data *data = dev_get_drvdata(dev);
|
||||
|
||||
- if (data->is_ssd2092) {
|
||||
- int ret;
|
||||
-
|
||||
- if (!data->vcc_reg)
|
||||
- ssd2092_enable_pmic_vldo28();
|
||||
- ssd2092_reset_pulse(data);
|
||||
- ret = ssd2092_boot_seeprom(data);
|
||||
- if (!ret)
|
||||
- ret = ssd2092_hw_init(data);
|
||||
- if (ret)
|
||||
- dev_warn(dev, "SSD2092 resume init failed: %d\n", ret);
|
||||
- }
|
||||
+ /* Defer SSD2092 touch wake until .complete after display/DSI is up. */
|
||||
+ if (data->is_ssd2092)
|
||||
+ return 0;
|
||||
|
||||
enable_irq(data->client->irq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static DEFINE_SIMPLE_DEV_PM_OPS(nvt36xxx_pm_ops, nvt36xxx_suspend,
|
||||
- nvt36xxx_resume);
|
||||
+static const struct dev_pm_ops nvt36xxx_pm_ops = {
|
||||
+ .prepare = pm_sleep_ptr(nvt36xxx_pm_prepare),
|
||||
+ .complete = pm_sleep_ptr(nvt36xxx_pm_complete),
|
||||
+ SYSTEM_SLEEP_PM_OPS(nvt36xxx_suspend, nvt36xxx_resume)
|
||||
+};
|
||||
|
||||
static const struct of_device_id nvt36xxx_of_match[] = {
|
||||
{ .compatible = "novatek,nt36772-ts" },
|
||||
diff --git a/drivers/leds/rgb/leds-aw9120.c b/drivers/leds/rgb/leds-aw9120.c
|
||||
--- a/drivers/leds/rgb/leds-aw9120.c
|
||||
+++ b/drivers/leds/rgb/leds-aw9120.c
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
+#include <linux/pm.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
@@ -54,6 +55,7 @@
|
||||
/* Channels with a non-zero PWM; the chip's oscillator runs only with one */
|
||||
u32 lit;
|
||||
u32 used;
|
||||
+ bool powered_down;
|
||||
u16 imax[AW9120_NUM_IMAX];
|
||||
};
|
||||
|
||||
@@ -278,6 +280,7 @@
|
||||
return -ENOMEM;
|
||||
|
||||
chip->dev = dev;
|
||||
+ i2c_set_clientdata(client, chip);
|
||||
|
||||
ret = devm_mutex_init(dev, &chip->lock);
|
||||
if (ret)
|
||||
@@ -345,6 +348,36 @@
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, aw9120_of_match);
|
||||
|
||||
+static int __maybe_unused aw9120_suspend(struct device *dev)
|
||||
+{
|
||||
+ struct aw9120 *chip = dev_get_drvdata(dev);
|
||||
+
|
||||
+ guard(mutex)(&chip->lock);
|
||||
+ if (!chip->lit) {
|
||||
+ gpiod_set_value_cansleep(chip->enable, 0);
|
||||
+ chip->powered_down = true;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int __maybe_unused aw9120_resume(struct device *dev)
|
||||
+{
|
||||
+ struct aw9120 *chip = dev_get_drvdata(dev);
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ guard(mutex)(&chip->lock);
|
||||
+ if (chip->powered_down) {
|
||||
+ gpiod_set_value_cansleep(chip->enable, 1);
|
||||
+ fsleep(AW9120_POWER_ON_US);
|
||||
+ ret = aw9120_setup_outputs(chip);
|
||||
+ if (!ret)
|
||||
+ chip->powered_down = false;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static DEFINE_SIMPLE_DEV_PM_OPS(aw9120_pm_ops, aw9120_suspend, aw9120_resume);
|
||||
+
|
||||
static const struct i2c_device_id aw9120_id[] = {
|
||||
{ "aw9120" },
|
||||
{ }
|
||||
@@ -355,6 +388,7 @@
|
||||
.driver = {
|
||||
.name = "leds-aw9120",
|
||||
.of_match_table = aw9120_of_match,
|
||||
+ .pm = pm_sleep_ptr(&aw9120_pm_ops),
|
||||
},
|
||||
.probe = aw9120_probe,
|
||||
.id_table = aw9120_id,
|
||||
diff --git a/drivers/power/supply/mt6351-fuel-gauge.c b/drivers/power/supply/mt6351-fuel-gauge.c
|
||||
--- a/drivers/power/supply/mt6351-fuel-gauge.c
|
||||
+++ b/drivers/power/supply/mt6351-fuel-gauge.c
|
||||
@@ -691,9 +691,11 @@
|
||||
static void mt6351_fg_report(struct mt6351_fg *fg, s64 uah, int *capacity, int *charge_uah)
|
||||
{
|
||||
s64 full = mt6351_fg_rep_full(fg);
|
||||
+ s64 empty = div_s64(fg->full_uah * fg->empty_pct, 100);
|
||||
+ s64 span = max_t(s64, full - empty, 1);
|
||||
|
||||
- uah = clamp_t(s64, uah - div_s64(fg->full_uah * fg->empty_pct, 100), 0, full);
|
||||
- *capacity = div64_s64(uah * 100 + full / 2, full);
|
||||
+ uah = clamp_t(s64, uah - empty, 0, span);
|
||||
+ *capacity = div64_s64(uah * 100 + span / 2, span);
|
||||
*charge_uah = uah;
|
||||
}
|
||||
|
||||
@@ -997,10 +999,10 @@
|
||||
* After a charge, surface charge raises it a few points, which the next rest
|
||||
* or charge corrects. Called once at probe.
|
||||
*/
|
||||
-static void mt6351_fg_pwron_anchor(struct mt6351_fg *fg)
|
||||
+static void mt6351_fg_pwron_anchor(struct mt6351_fg *fg, int init_ua)
|
||||
{
|
||||
unsigned int val;
|
||||
- int uv, mc, pct;
|
||||
+ int uv, mc, pct, live_uv;
|
||||
|
||||
if (regmap_read(fg->regmap, MT6351_AUXADC_ADC21, &val) ||
|
||||
!(val & MT6351_PWRON_RDY) || thermal_zone_get_temp(fg->tz, &mc))
|
||||
@@ -1014,6 +1016,23 @@
|
||||
if (pct < 0)
|
||||
return;
|
||||
|
||||
+ /*
|
||||
+ * ADC21 is only latched on cold battery attach and goes stale across
|
||||
+ * warm reboots or USB reflashes while VBAT remains present.
|
||||
+ */
|
||||
+ if (!mt6351_fg_voltage(fg, &live_uv)) {
|
||||
+ int live_ocv = mt6351_fg_ocv(fg, live_uv, init_ua, mc);
|
||||
+ int live_pct = power_supply_batinfo_ocv2cap(fg->info, live_ocv, mc / 1000);
|
||||
+
|
||||
+ if (abs(uv - live_ocv) > 80000 ||
|
||||
+ (live_pct >= 0 && abs(pct - live_pct) > 10)) {
|
||||
+ dev_info(fg->dev,
|
||||
+ "ignoring stale start-up OCV %d uV (%d %%) vs live %d uV (%d %%)\n",
|
||||
+ uv, pct, live_ocv, live_pct);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
guard(mutex)(&fg->lock);
|
||||
fg->anchor_uah = div_s64(fg->full_uah * clamp(pct, 0, 100), 100);
|
||||
fg->anchor_car = fg->car;
|
||||
@@ -1103,8 +1122,12 @@
|
||||
WRITE_ONCE(fg->info, info);
|
||||
|
||||
/* Open the first current window now, so the current is known 5 s on. */
|
||||
- mt6351_fg_read(fg, &ret, &ret);
|
||||
- mt6351_fg_pwron_anchor(fg);
|
||||
+ {
|
||||
+ int init_ua = 0, init_uah = 0;
|
||||
+
|
||||
+ ret = mt6351_fg_read(fg, &init_ua, &init_uah);
|
||||
+ mt6351_fg_pwron_anchor(fg, ret ? 0 : init_ua);
|
||||
+ }
|
||||
|
||||
/*
|
||||
* A charger attached while the system sleeps wakes it, so that the
|
||||
@@ -1153,8 +1176,12 @@
|
||||
if (!READ_ONCE(fg->info))
|
||||
return -ENODATA;
|
||||
|
||||
- scoped_guard(mutex, &fg->lock)
|
||||
+ scoped_guard(mutex, &fg->lock) {
|
||||
fg->r25_uohm = r;
|
||||
+ fg->empty_valid = false;
|
||||
+ if (!fg->anchor_trusted)
|
||||
+ fg->anchored = false;
|
||||
+ }
|
||||
power_supply_changed(fg->psy);
|
||||
|
||||
return count;
|
||||
diff --git a/drivers/soc/mediatek/mt6797-ccci-cldma.c b/drivers/soc/mediatek/mt6797-ccci-cldma.c
|
||||
--- a/drivers/soc/mediatek/mt6797-ccci-cldma.c
|
||||
+++ b/drivers/soc/mediatek/mt6797-ccci-cldma.c
|
||||
@@ -1310,6 +1310,9 @@
|
||||
mt6797_ccci_free_irqs(cdev);
|
||||
cancel_work_sync(&cdev->rx_work);
|
||||
mt6797_ccci_free_rings(cdev);
|
||||
+ if (cdev->infracfg)
|
||||
+ regmap_update_bits(cdev->infracfg, INFRA_AO_MD_SRCCLKENA,
|
||||
+ 0xff, 0x00);
|
||||
cdev->md_state = MT6797_MD_STATE_GATED;
|
||||
cdev->active_stage = 0;
|
||||
stage = 0;
|
||||
@@ -1473,6 +1476,9 @@
|
||||
mutex_lock(&cdev->state_lock);
|
||||
mt6797_ccci_apply_stage(cdev, clamp_t(u32, stage, 0, 3));
|
||||
mutex_unlock(&cdev->state_lock);
|
||||
+ } else if (cdev->infracfg) {
|
||||
+ regmap_update_bits(cdev->infracfg, INFRA_AO_MD_SRCCLKENA,
|
||||
+ 0xff, 0x00);
|
||||
}
|
||||
|
||||
dev_info(&pdev->dev,
|
||||
diff --git a/drivers/soc/mediatek/mt6797-spm-sleep.c b/drivers/soc/mediatek/mt6797-spm-sleep.c
|
||||
--- a/drivers/soc/mediatek/mt6797-spm-sleep.c
|
||||
+++ b/drivers/soc/mediatek/mt6797-spm-sleep.c
|
||||
@@ -482,11 +482,11 @@
|
||||
u32 im_resident; /* the program IM holds after a return, or 0 */
|
||||
} s;
|
||||
|
||||
-static unsigned int timer_sec = 30;
|
||||
+static unsigned int timer_sec = 600;
|
||||
module_param(timer_sec, uint, 0644);
|
||||
MODULE_PARM_DESC(timer_sec, "PCM wake timer in seconds (1-600)");
|
||||
|
||||
-static bool pmic_modes;
|
||||
+static bool pmic_modes = true;
|
||||
module_param(pmic_modes, bool, 0644);
|
||||
MODULE_PARM_DESC(pmic_modes, "Set the static PMIC sleep modes for each suspend");
|
||||
|
||||
@@ -1388,7 +1388,11 @@
|
||||
disable_irq_wake(s.irq);
|
||||
disable_irq(s.irq);
|
||||
spm_pmic_finish();
|
||||
- spm_log_wake("wake");
|
||||
+ if (!s.entered || !s.wake.returned || s.wake.backstop ||
|
||||
+ s.wake.r12 != BIT(0))
|
||||
+ spm_log_wake("wake");
|
||||
+ else
|
||||
+ dev_dbg(&s.pdev->dev, "suspend timer tick r12=%08x\n", s.wake.r12);
|
||||
}
|
||||
|
||||
static void spm_log_wake(const char *what)
|
||||
@@ -1609,7 +1613,7 @@
|
||||
MODULE_PARM_DESC(sodi_idle_max_ms, "SODI idle: longest period in ms (1-2000)");
|
||||
|
||||
/* Whether to register the cpuidle driver at all (stage D5d bisects it) */
|
||||
-static bool sodi_idle = true;
|
||||
+static bool sodi_idle;
|
||||
module_param(sodi_idle, bool, 0444);
|
||||
MODULE_PARM_DESC(sodi_idle, "SODI idle: register the CPU0 cpuidle driver");
|
||||
|
||||
@@ -1870,11 +1874,22 @@
|
||||
s.idle_registered = false;
|
||||
}
|
||||
|
||||
+static bool spm_suspend_again(void)
|
||||
+{
|
||||
+ if (!s.entered || !s.wake.returned || s.wake.backstop)
|
||||
+ return false;
|
||||
+ if (pm_wakeup_pending())
|
||||
+ return false;
|
||||
+ /* Stay asleep across silent PCM timer rollovers; wake on EINT/other. */
|
||||
+ return s.wake.r12 == BIT(0);
|
||||
+}
|
||||
+
|
||||
static const struct platform_suspend_ops spm_suspend_ops = {
|
||||
.valid = spm_valid,
|
||||
.prepare = spm_prepare,
|
||||
.enter = spm_enter,
|
||||
.finish = spm_finish,
|
||||
+ .suspend_again = spm_suspend_again,
|
||||
};
|
||||
|
||||
/* ---- load ---- */
|
||||
@@ -0,0 +1,692 @@
|
||||
--- a/drivers/net/wireless/mediatek/mt6797/mac-priv.h
|
||||
+++ b/drivers/net/wireless/mediatek/mt6797/mac-priv.h
|
||||
@@ -51,6 +51,7 @@
|
||||
* several requests.
|
||||
*/
|
||||
#define MT6797_SCAN_REQUEST_CHANNELS 32U
|
||||
+#define MT6797_ONLINE_SCAN_CHANNELS 4U
|
||||
#define MT6797_SCAN_SSIDS 4U
|
||||
|
||||
struct mt6797_scan_frame {
|
||||
@@ -433,11 +434,9 @@
|
||||
|
||||
#define MT6797_JOIN_TX_HDRLEN(fc) ((fc) & MT6797_JOIN_TX_QOS_BIT ? 26U : 24U)
|
||||
|
||||
-#define MT6797_JOIN_DATA_TX_FAILURES 8U
|
||||
-/* At low signal eight frames can fail on a link that still works, and they take
|
||||
- * under two seconds at low traffic, so they must also span this long.
|
||||
- */
|
||||
-#define MT6797_JOIN_DATA_TX_FAILURE_NS (3ULL * NSEC_PER_SEC)
|
||||
+#define MT6797_JOIN_DATA_TX_FAILURES 16U
|
||||
+/* Allow brief interference bursts without falsely tearing down the link. */
|
||||
+#define MT6797_JOIN_DATA_TX_FAILURE_NS (5ULL * NSEC_PER_SEC)
|
||||
/* One frame carries one rate here, so a failed probe of another rate loses that
|
||||
* frame, and at low traffic minstrel_ht makes most frames probes. At most one
|
||||
* in this many may be one.
|
||||
@@ -691,6 +690,10 @@
|
||||
unsigned int scan_packets;
|
||||
/* A scan while connected: the worker submits it and reads its events. */
|
||||
bool scan_online, scan_online_ready, scan_online_cancel;
|
||||
+ u64 scan_online_end_ns;
|
||||
+ u64 last_ap_activity_ns, last_beacon_timeout_ns;
|
||||
+ unsigned int beacon_timeout_streak, ccmp_live_keys;
|
||||
+ bool gtk_rekey_pending;
|
||||
/* Signal threshold, from the access point's frames (1/16 dB average). */
|
||||
int cqm_thold, cqm_last, cqm_average;
|
||||
unsigned int cqm_hyst, cqm_samples, cqm_beacons;
|
||||
@@ -728,7 +731,7 @@
|
||||
* transmit fell to 0.5-9.5 Mbit/s on channel 40.
|
||||
*/
|
||||
#define MT6797_TX_ATTEMPTS 30U
|
||||
-#define MT6797_TX_ATTEMPTS_DATA 3U
|
||||
+#define MT6797_TX_ATTEMPTS_DATA 7U
|
||||
|
||||
/* A current, owned monitor notification is a normal connection loss, not a
|
||||
* malformed transport event. End traffic and queue standard core teardown;
|
||||
@@ -742,7 +745,7 @@
|
||||
* (strictly checked PTK/GTK admissions only), so it ignores no more than the
|
||||
* vendor would. A dead link stops that clock, and its next event is a loss.
|
||||
*/
|
||||
-#define MT6797_CCMP_TIMEOUT_FRESH_RX_MS 2000
|
||||
+#define MT6797_CCMP_TIMEOUT_FRESH_RX_MS 6000
|
||||
|
||||
#define MT6797_CCMP_TIMEOUT_IGNORE_NAMED 16
|
||||
|
||||
@@ -839,9 +842,6 @@
|
||||
const unsigned char ap[6], unsigned char bmc_index,
|
||||
unsigned int *reason_out);
|
||||
|
||||
-bool mt6797_ccmp_rx_eapol_rekey(const unsigned char *packet, size_t bytes,
|
||||
- const struct mt6797_ccmp_rx_context *context);
|
||||
-
|
||||
int mt6797_mac_join_open_lifetime(struct mt6797_mac *mac);
|
||||
void mt6797_mac_join_read_bss(struct mt6797_mac *mac, struct ieee80211_vif *vif,
|
||||
const struct ieee80211_bss_conf *info);
|
||||
--- a/drivers/net/wireless/mediatek/mt6797/mcu.h
|
||||
+++ b/drivers/net/wireless/mediatek/mt6797/mcu.h
|
||||
@@ -868,7 +868,7 @@
|
||||
(status_report ? (!pid || pid > 127) : pid != 0) ||
|
||||
!lifetime_ms || lifetime_ms > 10000 || !attempt_count || attempt_count > 30)
|
||||
return false;
|
||||
- if ((frame[6] & 1) || (frame[12] == 0x88 && frame[13] == 0x8e))
|
||||
+ if (frame[6] & 1)
|
||||
return false;
|
||||
lifetime = (lifetime_ms * 1000U / 1024U) >> 5;
|
||||
if (!lifetime)
|
||||
--- a/drivers/net/wireless/mediatek/mt6797/data.c
|
||||
+++ b/drivers/net/wireless/mediatek/mt6797/data.c
|
||||
@@ -807,10 +807,9 @@
|
||||
source_any |= ethernet[6 + i] != 0;
|
||||
pn[i] = packet[32 + 5 - i];
|
||||
}
|
||||
- /* Ethernet-II only; EAPOL remains on the existing control-port path. */
|
||||
+ /* Ethernet-II (including PTK-encrypted EAPOL-Key GTK handshakes). */
|
||||
if (!source_any || (ethernet[6] & 1) ||
|
||||
- (((unsigned int)ethernet[12] << 8) | ethernet[13]) < 0x0600 ||
|
||||
- (ethernet[12] == 0x88 && ethernet[13] == 0x8e))
|
||||
+ (((unsigned int)ethernet[12] << 8) | ethernet[13]) < 0x0600)
|
||||
return false;
|
||||
tid = packet[9] & 15;
|
||||
last = tid ? context->tid_pn[tid - 1] : context->pn;
|
||||
@@ -1390,6 +1389,8 @@
|
||||
if (mac->ccmp_queued < MT6797_CCMP_DIAG_CHECKED_MAX)
|
||||
mac->ccmp_queued++;
|
||||
mac->ccmp_last_checked_rx = ktime_get_ns();
|
||||
+ mac->last_ap_activity_ns = mac->ccmp_last_checked_rx;
|
||||
+ mac->beacon_timeout_streak = 0;
|
||||
__skb_queue_tail(received, skb);
|
||||
return 0;
|
||||
}
|
||||
@@ -1756,7 +1757,7 @@
|
||||
|
||||
bool mt6797_ccmp_owned_loss(struct mt6797_mac *mac, size_t bytes)
|
||||
{
|
||||
- u64 now;
|
||||
+ u64 now, fresh;
|
||||
|
||||
if (!mt6797_join_event(mac->join_packet, bytes, 0x13, 4) ||
|
||||
mac->join_packet[5] || mac->join_packet[8] || !mt6797_ccmp_rx_ready(mac) ||
|
||||
@@ -1766,21 +1767,36 @@
|
||||
mac->join_key_pairwise != 1 || mac->join_key_group != 1 || mac->ccmp_loss_reported)
|
||||
return false;
|
||||
now = ktime_get_ns();
|
||||
- if (mac->join_packet[9] == 4 && mac->ccmp_queued &&
|
||||
- mac->ccmp_last_checked_rx <= now &&
|
||||
- now - mac->ccmp_last_checked_rx < MT6797_CCMP_TIMEOUT_FRESH_RX_MS * NSEC_PER_MSEC) {
|
||||
- if (++mac->ccmp_timeout_ignored <= MT6797_CCMP_TIMEOUT_IGNORE_NAMED)
|
||||
+ if (mac->join_packet[9] == 4) {
|
||||
+ /* Firmware away on a scan or within post-scan settling window. */
|
||||
+ if (mac->scan_online ||
|
||||
+ (mac->scan_online_end_ns && now >= mac->scan_online_end_ns &&
|
||||
+ now - mac->scan_online_end_ns < 5ULL * NSEC_PER_SEC))
|
||||
+ return true;
|
||||
+ fresh = max3(mac->ccmp_last_checked_rx, mac->last_ap_activity_ns,
|
||||
+ mac->join_data_tx_ok_ns);
|
||||
+ if (fresh && fresh <= now &&
|
||||
+ now - fresh < (u64)MT6797_CCMP_TIMEOUT_FRESH_RX_MS * NSEC_PER_MSEC) {
|
||||
+ mac->beacon_timeout_streak = 0;
|
||||
+ if (++mac->ccmp_timeout_ignored <= MT6797_CCMP_TIMEOUT_IGNORE_NAMED)
|
||||
+ dev_info(wiphy_dev(mac->hw->wiphy),
|
||||
+ "one-shot WLAN BSS timeout ignored: reason=4 age_ms=%llu data_ms=%llu ignored=%u\n",
|
||||
+ (now - fresh) / NSEC_PER_MSEC,
|
||||
+ now > mac->join_data_started ?
|
||||
+ (now - mac->join_data_started) / NSEC_PER_MSEC : 0,
|
||||
+ mac->ccmp_timeout_ignored);
|
||||
+ return true;
|
||||
+ }
|
||||
+ if (mac->last_beacon_timeout_ns && fresh > mac->last_beacon_timeout_ns)
|
||||
+ mac->beacon_timeout_streak = 0;
|
||||
+ mac->last_beacon_timeout_ns = now;
|
||||
+ if (++mac->beacon_timeout_streak < 2) {
|
||||
dev_info(wiphy_dev(mac->hw->wiphy),
|
||||
- "one-shot WLAN BSS timeout ignored: reason=4 checked_rx_age_ms=%llu data_ms=%llu ignored=%u\n",
|
||||
- (now - mac->ccmp_last_checked_rx) / NSEC_PER_MSEC,
|
||||
- now > mac->join_data_started ?
|
||||
- (now - mac->join_data_started) / NSEC_PER_MSEC : 0,
|
||||
- mac->ccmp_timeout_ignored);
|
||||
- return true;
|
||||
- }
|
||||
- /* The firmware away on a scan: its notice is not a lost connection. */
|
||||
- if (mac->join_packet[9] == 4 && mac->scan_online)
|
||||
- return true;
|
||||
+ "one-shot WLAN BSS timeout deferred: reason=4 streak=%u\n",
|
||||
+ mac->beacon_timeout_streak);
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
mt6797_mac_join_end_data(mac, "connection-loss");
|
||||
mt6797_ccmp_connection_lost(mac, "monitor", mac->join_packet[9]);
|
||||
return true;
|
||||
@@ -1843,6 +1859,8 @@
|
||||
IEEE80211_SKB_RXCB(skb)->flag |= RX_FLAG_NO_SIGNAL_VAL;
|
||||
}
|
||||
mt6797_ccmp_pm_beacon(mac, offset, bytes);
|
||||
+ mac->last_ap_activity_ns = ktime_get_ns();
|
||||
+ mac->beacon_timeout_streak = 0;
|
||||
__skb_queue_tail(received, skb);
|
||||
return 0;
|
||||
}
|
||||
@@ -1983,71 +2001,3 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
-bool mt6797_ccmp_rx_eapol_rekey(const unsigned char *packet, size_t bytes,
|
||||
- const struct mt6797_ccmp_rx_context *context)
|
||||
-{
|
||||
- unsigned char pn[6];
|
||||
- size_t offset = 48;
|
||||
- unsigned int groups, fc, i, tid;
|
||||
- const unsigned char *last;
|
||||
- const unsigned char *ethernet;
|
||||
- bool greater = false, own_any = false, ap_any = false, source_any = false;
|
||||
-
|
||||
- if (!packet || !context || bytes < 16 || bytes > 2352 ||
|
||||
- !context->authorized || !context->active || !context->seeded ||
|
||||
- !context->pairwise || context->cipher != 0x000fac04U ||
|
||||
- context->key_bytes != 16 || context->key_id ||
|
||||
- context->wlan_index != 1 || context->rxd_bssid > 63 || !context->channel ||
|
||||
- (context->own[0] & 1) || (context->ap[0] & 1))
|
||||
- return false;
|
||||
- for (i = 0; i < 6; i++) {
|
||||
- own_any |= context->own[i] != 0;
|
||||
- ap_any |= context->ap[i] != 0;
|
||||
- }
|
||||
- if (!own_any || !ap_any || mt6797_join_le16(packet) != bytes ||
|
||||
- (mt6797_join_le16(packet + 2) >> 13) != 2 ||
|
||||
- packet[4] != 0x02 || packet[5] != context->channel ||
|
||||
- (packet[6] & 0xbf) != 0x8e ||
|
||||
- packet[7] != (unsigned int)context->rxd_bssid << 2 ||
|
||||
- packet[8] != context->wlan_index || (packet[9] & 0xf0) != 0x40 ||
|
||||
- !mt6797_ccmp_rx_status_ok(mt6797_join_le16(packet + 10)))
|
||||
- return false;
|
||||
- groups = (mt6797_join_le16(packet + 2) >> 9) & 15;
|
||||
- if ((groups & 9) != 9)
|
||||
- return false;
|
||||
- if (groups & 2)
|
||||
- offset += 8;
|
||||
- if (groups & 4)
|
||||
- offset += 24;
|
||||
- if (packet[6] & 0x40)
|
||||
- offset += 2;
|
||||
- if (offset > bytes || bytes - offset <= 14)
|
||||
- return false;
|
||||
- fc = mt6797_join_le16(packet + 16);
|
||||
- if ((fc & ~(0x2800U | MT6797_CCMP_RX_QOS_BIT)) != 0x4208 ||
|
||||
- (mt6797_join_le16(packet + 24) & 15) ||
|
||||
- !mt6797_ccmp_rx_tid_ok(packet, fc, 0x40) ||
|
||||
- mt6797_join_le32(packet + 28))
|
||||
- return false;
|
||||
- ethernet = packet + offset;
|
||||
- for (i = 0; i < 6; i++) {
|
||||
- if (packet[18 + i] != context->ap[i] || ethernet[i] != context->own[i])
|
||||
- return false;
|
||||
- source_any |= ethernet[6 + i] != 0;
|
||||
- pn[i] = packet[32 + 5 - i];
|
||||
- }
|
||||
- if (!source_any || (ethernet[6] & 1) ||
|
||||
- ethernet[12] != 0x88 || ethernet[13] != 0x8e)
|
||||
- return false;
|
||||
- tid = packet[9] & 15;
|
||||
- last = tid ? context->tid_pn[tid - 1] : context->pn;
|
||||
- for (i = 0; i < 6; i++) {
|
||||
- if (pn[i] < last[i])
|
||||
- return false;
|
||||
- if (pn[i] > last[i]) {
|
||||
- greater = true;
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- return greater;
|
||||
-}
|
||||
--- a/drivers/net/wireless/mediatek/mt6797/join.c
|
||||
+++ b/drivers/net/wireless/mediatek/mt6797/join.c
|
||||
@@ -595,6 +595,12 @@
|
||||
mac->ps_failed = false;
|
||||
mac->ccmp_last_checked_rx = 0;
|
||||
mac->ccmp_timeout_ignored = 0;
|
||||
+ mac->scan_online_end_ns = 0;
|
||||
+ mac->last_ap_activity_ns = 0;
|
||||
+ mac->last_beacon_timeout_ns = 0;
|
||||
+ mac->beacon_timeout_streak = 0;
|
||||
+ mac->ccmp_live_keys = 0;
|
||||
+ mac->gtk_rekey_pending = false;
|
||||
reinit_completion(&mac->ccmp_dtim_done);
|
||||
mac->ccmp_dtim_period = 0;
|
||||
mac->ccmp_dtim_status = 0;
|
||||
@@ -913,6 +919,8 @@
|
||||
mac->join_data_tx_done++;
|
||||
mac->join_data_tx_failures_in_row = 0;
|
||||
mac->join_data_tx_ok_ns = ktime_get_ns();
|
||||
+ mac->last_ap_activity_ns = mac->join_data_tx_ok_ns;
|
||||
+ mac->beacon_timeout_streak = 0;
|
||||
ieee80211_tx_info_clear_status(IEEE80211_SKB_CB(skb));
|
||||
IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
|
||||
skb_queue_tail(&mac->credit_retired_queue, skb);
|
||||
@@ -1218,6 +1226,9 @@
|
||||
else if (owned && mac->join_key_done && mac->join_key_group_submitted &&
|
||||
!mac->join_key_done_second)
|
||||
window = "second after=group";
|
||||
+ else if (owned && mac->join_key_done && mac->join_key_done_second &&
|
||||
+ mac->join_data_phase && !mac->join_data_ended)
|
||||
+ window = "rekey after=group";
|
||||
if (!window) {
|
||||
dev_info(wiphy_dev(mac->hw->wiphy),
|
||||
"one-shot WLAN join key done refused: bss=%u peer=%u broadcast=%u seq=%u submitted=%u%u recorded=%u%u\n",
|
||||
@@ -1967,6 +1978,8 @@
|
||||
mac->join_data_tx_done++;
|
||||
mac->join_data_tx_failures_in_row = 0;
|
||||
mac->join_data_tx_ok_ns = ktime_get_ns();
|
||||
+ mac->last_ap_activity_ns = mac->join_data_tx_ok_ns;
|
||||
+ mac->beacon_timeout_streak = 0;
|
||||
return;
|
||||
}
|
||||
mac->join_data_tx_failed++;
|
||||
@@ -2055,10 +2068,10 @@
|
||||
*/
|
||||
if (!mac->join_closed && (mac->join_key_pairwise_submitted ||
|
||||
mac->join_key_group_submitted) &&
|
||||
- mac->ccmp_key_disables < 2) {
|
||||
+ mac->ccmp_live_keys > 0) {
|
||||
dev_info(wiphy_dev(mac->hw->wiphy),
|
||||
- "one-shot WLAN join rearm deferred: key_removals=%u\n",
|
||||
- mac->ccmp_key_disables);
|
||||
+ "one-shot WLAN join rearm deferred: live_keys=%u\n",
|
||||
+ mac->ccmp_live_keys);
|
||||
goto unlock;
|
||||
}
|
||||
mac->join_rearm_pending = false;
|
||||
@@ -2222,9 +2235,6 @@
|
||||
ret = mt6797_mac_join_guard(mac, deadline);
|
||||
if (ret)
|
||||
goto failed;
|
||||
- ret = mt6797_mac_online_scan_step(mac);
|
||||
- if (ret)
|
||||
- goto failed;
|
||||
mt6797_native_diag_step(mac);
|
||||
if (mac->join_data_phase && !mac->join_data_ended &&
|
||||
ktime_get_ns() >= mac->join_data_deadline)
|
||||
@@ -2237,7 +2247,8 @@
|
||||
select_more:
|
||||
branch = 3;
|
||||
select = !mac->join_inflight && !mac->join_page_debt;
|
||||
- if (channel_release_holds_tx)
|
||||
+ if (channel_release_holds_tx || mac->gtk_rekey_pending ||
|
||||
+ (mac->scan_online && !mac->scan_online_ready))
|
||||
select = false;
|
||||
/* PID-budget exhaustion ends the data phase in the queue path; evaluate it
|
||||
* before any frame is selected so the step disables and the fence holds.
|
||||
@@ -2268,9 +2279,11 @@
|
||||
u64 now_ns = ktime_get_ns();
|
||||
|
||||
skb_queue_walk_safe(&mac->join_queue, walk, tmp) {
|
||||
- bool data = (get_unaligned_le16(walk->data) & 0x0c) == 0x08;
|
||||
+ u16 walk_fc = get_unaligned_le16(walk->data);
|
||||
+ bool data = (walk_fc & 0x0c) == 0x08;
|
||||
bool port = IEEE80211_SKB_CB(walk)->control.flags &
|
||||
IEEE80211_TX_CTRL_PORT_CTRL_PROTO;
|
||||
+ bool prekey_eapol = port && !(walk_fc & IEEE80211_FCTL_PROTECTED);
|
||||
|
||||
if (walk == mac->join_internal &&
|
||||
(now_ns < mac->join_hold_until ||
|
||||
@@ -2281,18 +2294,18 @@
|
||||
/* Ordinary data goes out only inside the data phase; a
|
||||
* frame still queued when the phase ended is discarded.
|
||||
*/
|
||||
- if (data && !port && walk != mac->join_internal &&
|
||||
+ if (data && !prekey_eapol && walk != mac->join_internal &&
|
||||
mac->join_data_phase && !mac->join_data_ended &&
|
||||
mac->join_next_pid > MT6797_JOIN_DATA_LAST_PID)
|
||||
mt6797_mac_join_end_data(mac, "pidbudget");
|
||||
- if (data && !port && walk != mac->join_internal &&
|
||||
+ if (data && !prekey_eapol && walk != mac->join_internal &&
|
||||
(!mac->join_data_phase || mac->join_data_ended)) {
|
||||
__skb_unlink(walk, &mac->join_queue);
|
||||
mac->join_queue_bytes -= walk->len;
|
||||
__skb_queue_tail(&discard, walk);
|
||||
continue;
|
||||
}
|
||||
- if (data && !port && walk != mac->join_internal) {
|
||||
+ if (data && !prekey_eapol && walk != mac->join_internal) {
|
||||
if (!mt6797_ccmp_data_room(mac, walk->len))
|
||||
continue;
|
||||
} else if (mac->data_slots.count) {
|
||||
@@ -2349,19 +2362,20 @@
|
||||
size_t eth_bytes = 14 + skb->len - (hl + 8);
|
||||
bool port = IEEE80211_SKB_CB(skb)->control.flags &
|
||||
IEEE80211_TX_CTRL_PORT_CTRL_PROTO;
|
||||
+ bool prekey_eapol = port && !(fc & IEEE80211_FCTL_PROTECTED);
|
||||
|
||||
if (skb->len < hl + 12 || eth_bytes > MT6797_JOIN_ETH_MAX_BYTES ||
|
||||
!mac->join_sta_active ||
|
||||
- (!port && (!mac->join_data_phase || mac->join_data_ended))) {
|
||||
+ (!prekey_eapol && (!mac->join_data_phase || mac->join_data_ended))) {
|
||||
ret = -EINVAL;
|
||||
goto failed;
|
||||
}
|
||||
- ret = mt6797_ccmp_assign_pid(mac, false, !port);
|
||||
+ ret = mt6797_ccmp_assign_pid(mac, false, !prekey_eapol);
|
||||
if (ret)
|
||||
goto failed;
|
||||
mac->join_last_acked = false;
|
||||
reinit_completion(&mac->join_frame_done);
|
||||
- if (!port) {
|
||||
+ if (!prekey_eapol) {
|
||||
memcpy(mac->join_eth, skb->data + 16, ETH_ALEN);
|
||||
memcpy(mac->join_eth + 6, skb->data + 10, ETH_ALEN);
|
||||
memcpy(mac->join_eth + 12, skb->data + hl + 6, 2);
|
||||
@@ -2387,6 +2401,8 @@
|
||||
(IEEE80211_SKB_CB(skb)->flags &
|
||||
IEEE80211_TX_CTL_RATE_CTRL_PROBE))
|
||||
sample = true;
|
||||
+ if (port)
|
||||
+ sample = true;
|
||||
if (sample) {
|
||||
mac->tx_sample_counter = 0;
|
||||
mac->tx_report_ns = ktime_get_ns();
|
||||
@@ -2395,7 +2411,8 @@
|
||||
eth_bytes, 1,
|
||||
sample ? mac->join_pid : 0,
|
||||
sample,
|
||||
- 500, MT6797_TX_ATTEMPTS_DATA,
|
||||
+ 500,
|
||||
+ port ? MT6797_TX_ATTEMPTS : MT6797_TX_ATTEMPTS_DATA,
|
||||
per_frame,
|
||||
deadline);
|
||||
if (ret)
|
||||
@@ -2468,6 +2485,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+ ret = mt6797_mac_online_scan_step(mac);
|
||||
+ if (ret)
|
||||
+ goto failed;
|
||||
mt6797_hif_rx_batch_pass(mac->hif);
|
||||
mac->join_pass_read = true;
|
||||
for (n = 0; n < 8; n++) {
|
||||
@@ -2881,16 +2901,6 @@
|
||||
}
|
||||
continue;
|
||||
}
|
||||
- if (admitted && mt6797_ccmp_rx_ready(mac) &&
|
||||
- mt6797_ccmp_rx_eapol_rekey(mac->join_packet,
|
||||
- rx.logical_bytes,
|
||||
- &mac->ccmp_rx)) {
|
||||
- dev_info(wiphy_dev(mac->hw->wiphy),
|
||||
- "one-shot WLAN peer GTK rekey: triggering reassociation\n");
|
||||
- mt6797_mac_join_end_data(mac, "gtk-rekey");
|
||||
- mt6797_ccmp_connection_lost(mac, "gtk-rekey", 0);
|
||||
- continue;
|
||||
- }
|
||||
if (admitted)
|
||||
ret = mt6797_ccmp_queue_rx(mac, rx.logical_bytes,
|
||||
&received);
|
||||
--- a/drivers/net/wireless/mediatek/mt6797/main.c
|
||||
+++ b/drivers/net/wireless/mediatek/mt6797/main.c
|
||||
@@ -13,8 +13,8 @@
|
||||
/* Fast power save by default: with CONFIG_CFG80211_DEFAULT_PS it is on at every
|
||||
* join, and it took about 57 mA off a quiet link. 0 offers none.
|
||||
*/
|
||||
-static uint power_save = 2;
|
||||
-module_param(power_save, uint, 0444);
|
||||
+static uint power_save = 0;
|
||||
+module_param(power_save, uint, 0644);
|
||||
MODULE_PARM_DESC(power_save, "802.11 power save offered to mac80211: 0 none, 1 maximum, 2 fast");
|
||||
module_param(wlan_irq, bool, 0444);
|
||||
MODULE_PARM_DESC(wlan_irq, "Serve receive from the WLAN interrupt when the device tree gives one");
|
||||
@@ -858,9 +858,10 @@
|
||||
unsigned int count, next_seq;
|
||||
int ret;
|
||||
|
||||
- /* A request is all probing or all passive. */
|
||||
+ /* Online scans use short 4-channel excursions so traffic is not stalled. */
|
||||
count = min((probing ? mac->scan_probing : mac->scan_total) - mac->scan_next,
|
||||
- MT6797_SCAN_REQUEST_CHANNELS);
|
||||
+ mac->scan_online ? MT6797_ONLINE_SCAN_CHANNELS :
|
||||
+ MT6797_SCAN_REQUEST_CHANNELS);
|
||||
/* Keep scan_sequence monotonic within a session so stale 0x0d events
|
||||
* emitted after a cancelled scan never match a later scan request.
|
||||
*/
|
||||
@@ -894,6 +895,7 @@
|
||||
if (!mac->scan_online)
|
||||
return;
|
||||
mac->scan_online = false;
|
||||
+ mac->scan_online_end_ns = ktime_get_ns();
|
||||
dev_info(wiphy_dev(mac->hw->wiphy),
|
||||
"one-shot WLAN connected scan: requests=%u aborted=%u\n",
|
||||
mac->scan_sequence, aborted);
|
||||
@@ -911,7 +913,8 @@
|
||||
|
||||
if (!mac->scan_online && !mac->scan_online_cancel)
|
||||
return 0;
|
||||
- if (mac->join_page_debt || mac->join_credit_pending || mac->join_inflight)
|
||||
+ if (mac->join_page_debt || mac->join_credit_pending || mac->join_inflight ||
|
||||
+ mac->data_slots.count || mac->join_data_page_debt || mac->gtk_rekey_pending)
|
||||
return 0;
|
||||
if (mac->scan_online_cancel) {
|
||||
mac->scan_online_cancel = false;
|
||||
@@ -1291,9 +1294,10 @@
|
||||
/* The firmware's default dwell: it keeps returning to the channel. */
|
||||
mac->scan_dwell_ms = 0;
|
||||
mac->scan_channels = mask;
|
||||
- mac->scan_deadline = ktime_get_ns() + 5 * NSEC_PER_SEC;
|
||||
+ mac->scan_deadline = ktime_get_ns() + 15 * NSEC_PER_SEC;
|
||||
mac->scan_online_ready = true;
|
||||
mac->scan_online = true;
|
||||
+ schedule_delayed_work(&mac->join_work, 0);
|
||||
dev_info(wiphy_dev(hw->wiphy),
|
||||
"one-shot WLAN connected scan: admitted=1 channels=%u probing=%u ssids=%u sequence=%u\n",
|
||||
mac->scan_total, mac->scan_probing, mac->scan_n_ssids, mac->sequence);
|
||||
@@ -1758,8 +1762,8 @@
|
||||
* itself still decides with the rendezvous and quiescence rules.
|
||||
*/
|
||||
mutex_lock(&mac->mutex);
|
||||
- if (mac->join_rearm_pending && !mac->join_closed && !mac->first_error &&
|
||||
- !mac->closing)
|
||||
+ if (mac->join_rearm_pending && !mac->ccmp_live_keys &&
|
||||
+ !mac->join_closed && !mac->first_error && !mac->closing)
|
||||
schedule_delayed_work(&mac->join_work, msecs_to_jiffies(20));
|
||||
mutex_unlock(&mac->mutex);
|
||||
while ((skb = __skb_dequeue(&discard))) {
|
||||
@@ -1812,8 +1816,14 @@
|
||||
mac->closing, mac->first_error);
|
||||
return;
|
||||
}
|
||||
- if (mac->join_inflight || mac->data_slots.count || mac->join_page_debt) {
|
||||
+ if (mac->data_slots.count || mac->join_data_page_debt) {
|
||||
+ ret = -EBUSY;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ if (mac->join_inflight || mac->join_page_debt) {
|
||||
ret = mt6797_mac_join_wait_management(mac);
|
||||
+ if (ret == -EPROTO && (mac->data_slots.count || mac->join_data_page_debt))
|
||||
+ ret = -EBUSY;
|
||||
if (ret)
|
||||
goto out;
|
||||
}
|
||||
@@ -1868,14 +1878,33 @@
|
||||
|
||||
if (cmd == DISABLE_KEY) {
|
||||
mutex_lock(&mac->mutex);
|
||||
- if (mac->ccmp_gtk_deferred == key)
|
||||
+ if (mac->ccmp_gtk_deferred == key) {
|
||||
mac->ccmp_gtk_deferred = NULL;
|
||||
+ mutex_unlock(&mac->mutex);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (mac->ccmp_live_keys > 0)
|
||||
+ mac->ccmp_live_keys--;
|
||||
+ if (!pairwise && mac->join_data_phase && !mac->join_data_ended &&
|
||||
+ mac->ccmp_rx.authorized && mac->ccmp_ptk &&
|
||||
+ !mac->closing && !mac->first_error) {
|
||||
+ if (mac->ccmp_gtk == key) {
|
||||
+ mac->ccmp_gtk_rx.active = false;
|
||||
+ spin_lock_irqsave(&mac->join_queue.lock, flags);
|
||||
+ mac->ccmp_gtk = NULL;
|
||||
+ spin_unlock_irqrestore(&mac->join_queue.lock, flags);
|
||||
+ }
|
||||
+ mutex_unlock(&mac->mutex);
|
||||
+ mutex_lock(&mac->ccmp_receive_mutex);
|
||||
+ mutex_unlock(&mac->ccmp_receive_mutex);
|
||||
+ dev_info(wiphy_dev(hw->wiphy),
|
||||
+ "one-shot WLAN GTK key retired in-place: keyidx=%d\n",
|
||||
+ key->keyidx);
|
||||
+ return 0;
|
||||
+ }
|
||||
mutex_unlock(&mac->mutex);
|
||||
return mt6797_ccmp_disable_key(mac);
|
||||
}
|
||||
-
|
||||
- if (cmd == DISABLE_KEY)
|
||||
- return 0;
|
||||
mutex_lock(&mac->mutex);
|
||||
if (!mac->ccmp_pm_connected) {
|
||||
ret = -EOPNOTSUPP;
|
||||
@@ -1893,6 +1922,117 @@
|
||||
"one-shot WLAN join key deferred: group before pairwise\n");
|
||||
return 0;
|
||||
}
|
||||
+ /* In-place GTK rekey during an established data phase: install the new
|
||||
+ * group key under MT6797_JOIN_BMC_WLAN_INDEX without tearing down the link.
|
||||
+ */
|
||||
+ if (!pairwise && !sta && vif == mac->vif && mac->join_rsn &&
|
||||
+ mac->join_data_phase && !mac->join_data_ended &&
|
||||
+ mac->ccmp_rx.active && mac->ccmp_rx.authorized &&
|
||||
+ mac->join_key_pairwise == 1 && !mac->ccmp_closed &&
|
||||
+ !mac->closing && !mac->first_error) {
|
||||
+ u64 wait_end;
|
||||
+
|
||||
+ if (!((key->cipher == WLAN_CIPHER_SUITE_CCMP && key->keylen == 16) ||
|
||||
+ (key->cipher == WLAN_CIPHER_SUITE_TKIP && key->keylen == 32)) ||
|
||||
+ key->keyidx < 0 || key->keyidx > 3) {
|
||||
+ ret = -EOPNOTSUPP;
|
||||
+ goto failed;
|
||||
+ }
|
||||
+ mutex_unlock(&mac->mutex);
|
||||
+ mutex_lock(&mac->ccmp_receive_mutex);
|
||||
+ ieee80211_get_key_rx_seq(key, 0, &seed);
|
||||
+ for (tid = 1; tid < MT6797_CCMP_RX_TIDS; tid++)
|
||||
+ ieee80211_get_key_rx_seq(key, tid, &tid_seed[tid - 1]);
|
||||
+ mutex_unlock(&mac->ccmp_receive_mutex);
|
||||
+ mutex_lock(&mac->mutex);
|
||||
+ if (mac->ccmp_closed || mac->first_error || mac->closing ||
|
||||
+ mac->join_retired || !mac->join_data_phase || mac->join_data_ended) {
|
||||
+ ret = mac->first_error ? mac->first_error : -EOPNOTSUPP;
|
||||
+ goto failed;
|
||||
+ }
|
||||
+ mac->gtk_rekey_pending = true;
|
||||
+ schedule_delayed_work(&mac->join_work, 0);
|
||||
+ wait_end = ktime_get_ns() + 1000 * NSEC_PER_MSEC;
|
||||
+ while ((mac->join_inflight || mac->data_slots.count ||
|
||||
+ mac->join_page_debt || mac->join_data_page_debt ||
|
||||
+ mac->join_credit_pending || !mt6797_hif_normal_idle(mac->hif)) &&
|
||||
+ ktime_get_ns() < wait_end &&
|
||||
+ !mac->first_error && !mac->closing &&
|
||||
+ !mac->join_retired && !mac->join_data_ended) {
|
||||
+ mutex_unlock(&mac->mutex);
|
||||
+ usleep_range(2000, 4000);
|
||||
+ mutex_lock(&mac->mutex);
|
||||
+ }
|
||||
+ if (mac->ccmp_closed || mac->first_error || mac->closing ||
|
||||
+ mac->join_retired || !mac->join_data_phase || mac->join_data_ended) {
|
||||
+ mac->gtk_rekey_pending = false;
|
||||
+ ret = mac->first_error ? mac->first_error : -ECANCELED;
|
||||
+ goto failed;
|
||||
+ }
|
||||
+ if (mac->join_inflight || mac->data_slots.count ||
|
||||
+ mac->join_page_debt || mac->join_data_page_debt ||
|
||||
+ mac->join_credit_pending || !mt6797_hif_normal_idle(mac->hif)) {
|
||||
+ mac->gtk_rekey_pending = false;
|
||||
+ ret = -EBUSY;
|
||||
+ goto failed;
|
||||
+ }
|
||||
+ if (mac->sequence > 200 && mac->sequence_base &&
|
||||
+ !mt6797_hif_recycle_sequences(mac->hif, mac->sequence_base))
|
||||
+ mac->sequence = mac->sequence_base;
|
||||
+ if (mac->sequence > 253) {
|
||||
+ mac->gtk_rekey_pending = false;
|
||||
+ ret = -ENOSPC;
|
||||
+ goto failed;
|
||||
+ }
|
||||
+ mac->ccmp_gtk_rx.active = false;
|
||||
+ mac->join_credit_deadline = ktime_get_ns() + 150 * NSEC_PER_MSEC;
|
||||
+ reinit_completion(&mac->join_credit_done);
|
||||
+ mac->join_credit_pending = true;
|
||||
+ mac->join_page_debt = 1;
|
||||
+ ret = mt6797_hif_join_key_cipher(mac->hif, mac->sequence++, true, false,
|
||||
+ key->cipher == WLAN_CIPHER_SUITE_TKIP,
|
||||
+ mac->join_ap, key->keyidx, key->key,
|
||||
+ mac->join_credit_deadline);
|
||||
+ mt6797_mac_join_refused(mac, ret);
|
||||
+ if (!ret)
|
||||
+ ret = mt6797_mac_join_wait_credit(mac);
|
||||
+ mac->gtk_rekey_pending = false;
|
||||
+ if (ret || mac->ccmp_closed || mac->first_error || mac->closing ||
|
||||
+ mac->join_retired || !mac->join_data_phase || mac->join_data_ended) {
|
||||
+ if (!ret)
|
||||
+ ret = mac->first_error ? mac->first_error : -EOPNOTSUPP;
|
||||
+ goto failed;
|
||||
+ }
|
||||
+ mt6797_copy_key_seq(key->cipher, &seed, mac->ccmp_gtk_rx.pn);
|
||||
+ for (tid = 1; tid < MT6797_CCMP_RX_TIDS; tid++)
|
||||
+ mt6797_copy_key_seq(key->cipher, &tid_seed[tid - 1],
|
||||
+ mac->ccmp_gtk_rx.tid_pn[tid - 1]);
|
||||
+ memcpy(mac->ccmp_gtk_rx.own, hw->wiphy->perm_addr, 6);
|
||||
+ memcpy(mac->ccmp_gtk_rx.ap, mac->join_ap, 6);
|
||||
+ mac->ccmp_gtk_rx.cipher = key->cipher;
|
||||
+ mac->ccmp_gtk_rx.key_bytes = key->keylen;
|
||||
+ mac->ccmp_gtk_rx.key_id = key->keyidx;
|
||||
+ mac->ccmp_gtk_rx.wlan_index = MT6797_JOIN_BMC_WLAN_INDEX;
|
||||
+ mac->ccmp_gtk_rx.rxd_bssid = 1;
|
||||
+ mac->ccmp_gtk_rx.channel = mac->join_chan_number;
|
||||
+ mac->ccmp_gtk_rx.pairwise = false;
|
||||
+ mac->ccmp_gtk_rx.seeded = true;
|
||||
+ mac->ccmp_gtk_rx.authorized = mac->ccmp_rx.authorized;
|
||||
+ mac->ccmp_gtk_rx.active = true;
|
||||
+ key->hw_key_idx = MT6797_JOIN_BMC_WLAN_INDEX;
|
||||
+ spin_lock_irqsave(&mac->join_queue.lock, flags);
|
||||
+ mac->ccmp_gtk = key;
|
||||
+ spin_unlock_irqrestore(&mac->join_queue.lock, flags);
|
||||
+ mac->join_key_group = 1;
|
||||
+ mac->join_group_key_id = key->keyidx;
|
||||
+ mac->ccmp_live_keys++;
|
||||
+ schedule_delayed_work(&mac->join_work, 0);
|
||||
+ dev_info(wiphy_dev(hw->wiphy),
|
||||
+ "one-shot WLAN GTK rekey installed in-place: keyidx=%d sequence=%u\n",
|
||||
+ key->keyidx, mac->sequence - 1);
|
||||
+ mutex_unlock(&mac->mutex);
|
||||
+ return 0;
|
||||
+ }
|
||||
if ((mac->ccmp_closed ||
|
||||
(pairwise && mac->ccmp_ptk_attempted) ||
|
||||
(!pairwise && mac->ccmp_gtk_attempted))) {
|
||||
@@ -2051,6 +2191,7 @@
|
||||
struct ieee80211_key_conf *deferred = mac->ccmp_gtk_deferred;
|
||||
|
||||
mac->join_key_pairwise = 1;
|
||||
+ mac->ccmp_live_keys++;
|
||||
mac->ccmp_gtk_deferred = NULL;
|
||||
mutex_unlock(&mac->mutex);
|
||||
/* A failure ends the lifetime there; the pairwise key stands. */
|
||||
@@ -2059,6 +2200,7 @@
|
||||
return 0;
|
||||
} else {
|
||||
mac->join_key_group = 1;
|
||||
+ mac->ccmp_live_keys++;
|
||||
mac->join_group_key_id = key->keyidx;
|
||||
/* Both keys installed: open the bounded data phase inside the
|
||||
* grant; the reserved deauthentication waits for its end and
|
||||
@@ -2435,14 +2577,12 @@
|
||||
* reported. Anything else below the admission is freed unsent.
|
||||
*/
|
||||
if (skb->len >= sizeof(header) && skb->len <= sizeof(header) + 1500 &&
|
||||
- !(IEEE80211_SKB_CB(skb)->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO) &&
|
||||
IEEE80211_SKB_CB(skb)->control.hw_key &&
|
||||
!skb_copy_bits(skb, 0, header, sizeof(header)) &&
|
||||
mt6797_mac_tx_hdrlen(header, &hl) &&
|
||||
(mt6797_join_le16(header) & ~(0x0800U | MT6797_JOIN_TX_QOS_BIT)) == 0x4108 &&
|
||||
!mt6797_join_qos_tid_refused(mac, skb, header, hl) &&
|
||||
!memcmp(header + hl, llc_eapol, 6) &&
|
||||
- !(header[hl + 6] == 0x88 && header[hl + 7] == 0x8e) &&
|
||||
ether_addr_equal(header + 4, mac->join_ap) &&
|
||||
ether_addr_equal(header + 10, hw->wiphy->perm_addr)) {
|
||||
spin_lock_irqsave(&mac->join_queue.lock, flags);
|
||||
@@ -5,3 +5,5 @@
|
||||
0005-mt6797-consys-wifi-factory-firmware.patch
|
||||
0006-mt6797-boot-cleanups.patch
|
||||
0007-mt6797-wlan-peer-deauth-and-rekey.patch
|
||||
0008-gemini-resume-wake-and-spm-standby.patch
|
||||
0009-mt6797-wlan-drop-free-stability.patch
|
||||
Reference in new issue
Block a user