Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6206795ybh; Wed, 7 Aug 2019 19:30:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyE19RWcA9dPeiONtpI4nB+Uks1ArQIOEX38e/xtB35PAmIr5fD5XsDjmz6H0AKrS3S12+7 X-Received: by 2002:aa7:8193:: with SMTP id g19mr12437359pfi.16.1565231457057; Wed, 07 Aug 2019 19:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565231457; cv=none; d=google.com; s=arc-20160816; b=TtGebA464MMpahjQ+M4Z83Ynl7Dqq66BPOdndXt5Hi3QWY7aWI+zh8YMizBElP0IhK fqn3h5Ww17Kncu0KYoWi6ejoHh+d+RQBA2u+/zs+L2tQ7TX2mB0DpbvkWnEZhoIal9Vs oIzWj1ZMY5ek291q/k7PQOBmkm2j8+GzXWOyyJsepPH4jjxaDNAXbienqBE4CVxkE+lB vSHBZarVnJMHixOYVk3yjgoMZQ8BkVAptEyGvuiigIIQkyGWh+K2WhTNNoaKf1VAZQQP 2p1H7Mm6vTp1slrXtbaih5jTQI0MzsqM1w+kKYGPEt5o3odY/KtdOKb20CeBQ8p+30a1 9M/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=LAdCdHhdvjmYPgTAmagvx1DfmFbH2jQiSDuYgeQFDHE=; b=y92F2Th8OIEdGZSUOM0OiWpXtEbZTVdAJNzRrCXQhvFIffnGdez1b9BqxIqOF4W7Xs wKU/r1s4S78cplC7adRmC+mILYYFzVbCZBE5LB00+51NYKpHZrwMjFJuX7nI7qtSIIKM 39AQLSeGYJJcORoxnlBYZq5j/AflH8huUU1cxKMhY3wa4voFdSwzBh5qLEZnnHn59MTy 4qTgBeq8b6l7m+8K5kYHpBeMVjxkYwMgeEAl8Fvv5ny7kQP53SGwfI+6ZcDRF8Ws8klD KIfxjsG+QIf0z6UP5fHUIhXP3gYtJnB5bg+wzoQxqtzAFzphld4Sj8CUcvi+jYM2AYiG tqqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s24si52282913pgq.372.2019.08.07.19.30.39; Wed, 07 Aug 2019 19:30:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728252AbfHHCWb (ORCPT + 99 others); Wed, 7 Aug 2019 22:22:31 -0400 Received: from mga03.intel.com ([134.134.136.65]:53455 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728162AbfHHCW1 (ORCPT ); Wed, 7 Aug 2019 22:22:27 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Aug 2019 19:22:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,358,1559545200"; d="scan'208";a="168832663" Received: from ipsg-l-lixuzha.sh.intel.com ([10.239.153.20]) by orsmga008.jf.intel.com with ESMTP; 07 Aug 2019 19:22:02 -0700 From: Zhang Lixu To: linux-input@vger.kernel.org, jikos@kernel.org, benjamin.tissoires@redhat.com Cc: srinivas.pandruvada@linux.intel.com, linux-kernel@vger.kernel.org, lixu.zhang@intel.com Subject: [PATCH v2 3/3] HID: intel-ish-hid: ipc: check the NO_D3 flag to distinguish resume paths Date: Thu, 8 Aug 2019 18:21:13 +0800 Message-Id: <20190808102113.27802-4-lixu.zhang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190808102113.27802-1-lixu.zhang@intel.com> References: <20190808102113.27802-1-lixu.zhang@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The NO_D3 flag would be set if the ISH enter D0i3 in ish_suspend(), The resume paths can be distinguished by checking the NO_D3 flag. It's more reasonable than checking the FW status. Signed-off-by: Zhang Lixu --- drivers/hid/intel-ish-hid/ipc/pci-ish.c | 34 +++++++++++-------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c b/drivers/hid/intel-ish-hid/ipc/pci-ish.c index 35081f2cf781..f269852304e5 100644 --- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c +++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c @@ -210,19 +210,11 @@ static void __maybe_unused ish_resume_handler(struct work_struct *work) { struct pci_dev *pdev = to_pci_dev(ish_resume_device); struct ishtp_device *dev = pci_get_drvdata(pdev); - uint32_t fwsts; int ret; - pdev->dev_flags &= ~PCI_DEV_FLAGS_NO_D3; - - /* Get ISH FW status */ - fwsts = IPC_GET_ISH_FWSTS(dev->ops->get_fw_status(dev)); - - /* - * If currently, in ISH FW, sensor app is loaded or beyond that, - * it means ISH isn't powered off, in this case, send a resume message. - */ - if (fwsts >= FWSTS_SENSOR_APP_LOADED) { + /* Check the NO_D3 flag to distinguish the resume paths */ + if (pdev->dev_flags & PCI_DEV_FLAGS_NO_D3) { + pdev->dev_flags &= ~PCI_DEV_FLAGS_NO_D3; disable_irq_wake(pdev->irq); ishtp_send_resume(dev); @@ -232,16 +224,20 @@ static void __maybe_unused ish_resume_handler(struct work_struct *work) ret = wait_event_interruptible_timeout(dev->resume_wait, !dev->resume_flag, msecs_to_jiffies(WAIT_FOR_RESUME_ACK_MS)); - } - /* - * If in ISH FW, sensor app isn't loaded yet, or no resume response. - * That means this platform is not S0ix compatible, or something is - * wrong with ISH FW. So on resume, full reboot of ISH processor will - * happen, so need to go through init sequence again. - */ - if (dev->resume_flag) + /* + * If the flag is not cleared, something is wrong with ISH FW. + * So on resume, need to go through init sequence again. + */ + if (dev->resume_flag) + ish_init(dev); + } else { + /* + * Resume from the D3, full reboot of ISH processor will happen, + * so need to go through init sequence again. + */ ish_init(dev); + } } /** -- 2.17.1