Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5612002img; Wed, 27 Mar 2019 11:41:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFbrtkUiPP92FPWJSdrW944CsIP6owfLalBtVPtCT596Pijz7EqurhB6Bu/vioU6zkosWc X-Received: by 2002:a65:424b:: with SMTP id d11mr6575163pgq.205.1553712092190; Wed, 27 Mar 2019 11:41:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553712092; cv=none; d=google.com; s=arc-20160816; b=YEPQNqV9S5YogBUl92F3Vvtqu0BRFH8/MNjyvzWDb3KruDUh3PWo3CvdpYKy5Usq+w pR9uttCvXEtdn0iJiOdY8KNp4XK/U8QCdbi5Qxts6gimnSi8dyNWoPrh85TdZ5qiWc0w f+SOirxH1AQhqJ7OoVNE3FazigKusFG2OorSRlZkda0sSKlqvcxPKjdMZpSzwlAweecJ yQUU47gBPY8KVEzCD688Y/PPlzFaiHs15Sz8JCuP37ui3ExYaXuDDkUzRA5XsuNGLvXN tnGiZZFIt4+6m7ILJ/9r2Qw56vTRSgk1qhSCxbA+Wv9fNV4dbAbxAKsVigGXtCdBwVrt wQQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vGkFzXpVMYHtw+/XR0HK/2RIU6F+97OqIjsoyukO+8I=; b=axtzzCfTDue6+EcZjHm2nD7qSubYnzpuWInAYKQJlrPBtfindJnel/GE1ELVaybxtb R1haKgeFWCa8qWThjyeCggOZCc1hBEw7pZMtOioE8ZJEDyMCOpcvhmDcnSg1evkzMqzW OUnoQVC33/sOMZuqSO3Z+MF/DSfljj44+fBjwMUuFXmYfnIcsE/nz9B4kCXlmBDoiIjD iENko7+EQRbQCvLvS2NxczIbd4+zHpMRfPWIu3sM+E8uTnhFXsQBYk4vJ0LAUS3wxhgu QvDwhHtgRXbkPv/bccmoSfnP5AKAjGf9+leMqeD5DkIPbvPIAP2NH8dZ5cnpV6ZCMt/8 1Jbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0bkh6MsH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si13110110pgm.385.2019.03.27.11.41.16; Wed, 27 Mar 2019 11:41:32 -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; dkim=pass header.i=@kernel.org header.s=default header.b=0bkh6MsH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391392AbfC0SXC (ORCPT + 99 others); Wed, 27 Mar 2019 14:23:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:41180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391375AbfC0SW6 (ORCPT ); Wed, 27 Mar 2019 14:22:58 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 94A1720449; Wed, 27 Mar 2019 18:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710977; bh=GXd+FQv0I7gyn1dAW5umAnm2VA0c5bCFeh2R2DDhkws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0bkh6MsHOeC/yG3OwQfYq4bJ66+lXMwQ5GIhPJA0QMYaATpA3KrhIhQLVepyZ5CdE 1PveP7oG11ZIFx/KEIATTyZvlgWiDwv9gvJItr9qOdxlnnDsM4tQPsa0TSdhZ69rzJ KGLtb519NB3zWqv9D5ABCGKdUtHYRsgCsUY/zZio= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Song Hongyan , Jiri Kosina , Sasha Levin , linux-input@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 72/87] HID: intel-ish: ipc: handle PIMR before ish_wakeup also clear PISR busy_clear bit Date: Wed, 27 Mar 2019 14:20:25 -0400 Message-Id: <20190327182040.17444-72-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327182040.17444-1-sashal@kernel.org> References: <20190327182040.17444-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Song Hongyan [ Upstream commit 2edefc056e4f0e6ec9508dd1aca2c18fa320efef ] Host driver should handle interrupt mask register earlier than wake up ish FW else there will be conditions when FW interrupt comes, host PIMR register still not set ready, so move the interrupt mask setting before ish_wakeup. Clear PISR busy_clear bit in ish_irq_handler. If not clear, there will be conditions host driver received a busy_clear interrupt (before the busy_clear mask bit is ready), it will return IRQ_NONE after check_generated_interrupt, the interrupt will never be cleared, causing the DEVICE not sending following IRQ. Since PISR clear should not be called for the CHV device we do this change. After the change, both ISH2HOST interrupt and busy_clear interrupt will be considered as interrupt from ISH, busy_clear interrupt will return IRQ_HANDLED from IPC_IS_BUSY check. Signed-off-by: Song Hongyan Acked-by: Srinivas Pandruvada Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/intel-ish-hid/ipc/ipc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-ish-hid/ipc/ipc.c index 0c9ac4d5d850..41d44536aa15 100644 --- a/drivers/hid/intel-ish-hid/ipc/ipc.c +++ b/drivers/hid/intel-ish-hid/ipc/ipc.c @@ -92,7 +92,10 @@ static bool check_generated_interrupt(struct ishtp_device *dev) IPC_INT_FROM_ISH_TO_HOST_CHV_AB(pisr_val); } else { pisr_val = ish_reg_read(dev, IPC_REG_PISR_BXT); - interrupt_generated = IPC_INT_FROM_ISH_TO_HOST_BXT(pisr_val); + interrupt_generated = !!pisr_val; + /* only busy-clear bit is RW, others are RO */ + if (pisr_val) + ish_reg_write(dev, IPC_REG_PISR_BXT, pisr_val); } return interrupt_generated; @@ -795,11 +798,11 @@ int ish_hw_start(struct ishtp_device *dev) { ish_set_host_rdy(dev); + set_host_ready(dev); + /* After that we can enable ISH DMA operation and wakeup ISHFW */ ish_wakeup(dev); - set_host_ready(dev); - /* wait for FW-initiated reset flow */ if (!dev->recvd_hw_ready) wait_event_interruptible_timeout(dev->wait_hw_ready, -- 2.19.1