From patchwork Mon Apr 29 18:13:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthikeyan Ramasubramanian X-Patchwork-Id: 13647495 Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 592E4127E24 for ; Mon, 29 Apr 2024 18:14:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714414457; cv=none; b=XrDfVeYFPRc2F4kM6y4Ez0hWw3mz9OKG7J3zR3hzGjHDKflPFJskztKcPn+jvVJcJ57Set1oTf7dKy4xir1iKC8wPTow27j7hufBL28HoGKiF4Aqp97rcZ19/Bqq/mLEZQO6Vluq3bvBqAGoDDt8OgV/Xq+D6wg3q6X65IiY2so= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714414457; c=relaxed/simple; bh=YCowSaEVxz5Th4+eEyP+ngkS+IVErBSdGo7rFV+gYM4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=N7HenN8rvAOKbvBifRTlsBiGTFR2zsnDCc/fSRtFRAoGxrNP9gZ3hY10yD8AekuS237nxa0350vjtwUn0/oTh8ZQoNs54w/glUdXeUv299bdY0KC+exmYEm69O/UhT541oWWHOXT4l8JTMdvFCOWVZOUB5sVdwYO6tWEXVrlas0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=XsHs7gPq; arc=none smtp.client-ip=209.85.166.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="XsHs7gPq" Received: by mail-io1-f53.google.com with SMTP id ca18e2360f4ac-7da3ec3e044so228349939f.2 for ; Mon, 29 Apr 2024 11:14:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714414455; x=1715019255; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=5U5Ovsd+M0JJ1E5zOP2YrAXuvUNDgcSQFNzhJAAl8DQ=; b=XsHs7gPqHtY7v03RjjVtM9/wy7Z31ChNuv5vwPusYFMlPmkclyrvWbaWyCtsDnISdX SY3peP9o/cBLuAgkx/rhLmADuhp/SiB3GHqXGS8VnbGzsnWt40oWjrAAgj+SKxLMLENr SZ7Lc1LwdI7qHD/wgVME5KQTEVoZ8tGCzTayo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714414455; x=1715019255; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5U5Ovsd+M0JJ1E5zOP2YrAXuvUNDgcSQFNzhJAAl8DQ=; b=vIDPXGq+l+uZND9YPtN77rUVB0q+bs+8KFmsTuzAvl3Jfh+KKDGswvEQKspD8sNwCK 7qJ+CjSlUZJbA96iqanwdBvrxgMGW25tmv/ZzkfaaRSNkT2Y0pbPxtvKHOS+RrpPik5V /WMEkWJ5MLvy2P10KA9j0g2aYGzFwK01jOSbQrkWes6DUUSOmA8t8yA0XuLK0b0EgQD9 ynzqcGJRdp1eDMhuhcSkmGH8+cOlg62vcqQwsEjQAItqUi5Lj5nAkoSXzkvCSdtCJ0R0 kq8aPeooqjmbnsAn3DzcPSw6ofxbPssTMXsUqrNJheVXOVKBVmYuAUVQzJ2z3Kn5ce2Y rrhw== X-Forwarded-Encrypted: i=1; AJvYcCXK9b6cUsdjzlE2iUWZacZtdQ3pK9ZFwvofncMnWlGFMC3/1jxJcV1LdrfDZkmn01iQ3hMqGr1QxEG5MjTmdLF91/OfINhI4VU0rk5jJakb X-Gm-Message-State: AOJu0YxyUfsiNxlc2AcvepDjRUrYYV67/mwRykwiZk4y4DAu6wgyInBK K0lBcq6pzxopCHgyzo3haAyIP3toxWLx1WppmoBMhIxfLmF27ULjslWMq3IZ0Q== X-Google-Smtp-Source: AGHT+IELaJ8zCPU56vHLqlO0m0JFHKddtNX1XApb9dDhvl4jX4rekMtYaF/Fr00J+p1noZD9iNJccw== X-Received: by 2002:a6b:5814:0:b0:7d5:c00a:7d30 with SMTP id m20-20020a6b5814000000b007d5c00a7d30mr768321iob.8.1714414455464; Mon, 29 Apr 2024 11:14:15 -0700 (PDT) Received: from kramasub2.cros.corp.google.com ([100.107.108.189]) by smtp.gmail.com with ESMTPSA id n21-20020a6b4115000000b007d05927cb31sm6068548ioa.45.2024.04.29.11.14.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 11:14:14 -0700 (PDT) From: Karthikeyan Ramasubramanian To: LKML Cc: Karthikeyan Ramasubramanian , stable@vger.kernel.org, Lalith Rajendran , chrome-platform@lists.linux.dev, Benson Leung , Guenter Roeck , Tzung-Bi Shih Subject: [PATCH v2] chrome/cros_ec: Handle events during suspend after resume completion Date: Mon, 29 Apr 2024 12:13:45 -0600 Message-ID: <20240429121343.v2.1.If2e0cef959f1f6df9f4d1ab53a97c54aa54208af@changeid> X-Mailer: git-send-email 2.44.0.769.g3c40516874-goog Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit 47ea0ddb1f56 ("platform/chrome: cros_ec_lpc: Separate host command and irq disable") re-ordered the resume sequence. Before that change, cros_ec resume sequence is: 1) Enable IRQ 2) Send resume event 3) Handle events during suspend After commit 47ea0ddb1f56 ("platform/chrome: cros_ec_lpc: Separate host command and irq disable"), cros_ec resume sequence is: 1) Enable IRQ 2) Handle events during suspend 3) Send resume event. This re-ordering leads to delayed handling of any events queued between items 2) and 3) with the updated sequence. Also in certain platforms, EC skips triggering interrupt for certain events eg. mkbp events until the resume event is received. Such events are stuck in the host event queue indefinitely. This change puts back the original order to avoid any delay in handling the pending events. Fixes: 47ea0ddb1f56 ("platform/chrome: cros_ec_lpc: Separate host command and irq disable") Cc: stable@vger.kernel.org Cc: Lalith Rajendran Cc: chrome-platform@lists.linux.dev Signed-off-by: Karthikeyan Ramasubramanian --- Changes in v2: - Updated the commit message with the right problem description drivers/platform/chrome/cros_ec.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index badc68bbae8cc..41714df053916 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -432,6 +432,12 @@ static void cros_ec_send_resume_event(struct cros_ec_device *ec_dev) void cros_ec_resume_complete(struct cros_ec_device *ec_dev) { cros_ec_send_resume_event(ec_dev); + /* + * Let the mfd devices know about events that occur during + * suspend. This way the clients know what to do with them. + */ + cros_ec_report_events_during_suspend(ec_dev); + } EXPORT_SYMBOL(cros_ec_resume_complete); @@ -442,12 +448,6 @@ static void cros_ec_enable_irq(struct cros_ec_device *ec_dev) if (ec_dev->wake_enabled) disable_irq_wake(ec_dev->irq); - - /* - * Let the mfd devices know about events that occur during - * suspend. This way the clients know what to do with them. - */ - cros_ec_report_events_during_suspend(ec_dev); } /** @@ -475,8 +475,9 @@ EXPORT_SYMBOL(cros_ec_resume_early); */ int cros_ec_resume(struct cros_ec_device *ec_dev) { - cros_ec_enable_irq(ec_dev); - cros_ec_send_resume_event(ec_dev); + cros_ec_resume_early(ec_dev); + cros_ec_resume_complete(ec_dev); + return 0; } EXPORT_SYMBOL(cros_ec_resume);