Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5642254img; Wed, 27 Mar 2019 12:16:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlaYoFQ3LL9UsD5mes9F9WlnQIFKjHeGPFK3J9dXpARpHH9KyAIXLfKpHYTCQ015EV6xn3 X-Received: by 2002:a17:902:26f:: with SMTP id 102mr37974705plc.175.1553714210144; Wed, 27 Mar 2019 12:16:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553714210; cv=none; d=google.com; s=arc-20160816; b=KxMZGu29VsA9E9HOxVkstX3aImSsNYQIOYz3barwEDGlVP3lTaXx7vJzsS7ynILApP cboTmXeZUH4hdYKLHDUkaehY+AnTel6km6mtc0DmEf0QMbIc7Ulr2cKixL1Tu5GrfuxW cmmUuTMb4JjUvg9jmcxBj0qPPN4l9qwylxqyxP6R+2/u0/rOB0GfGe0jAbfEYL7ttjYZ hIzz7ilSI3fn4N9mXjZtl/p67IUOJ1bSKiIn1alBFPMjFaaydCz0xDT+YMSBOSks9Up/ J7bPtsDeRBILwOQ+78yDPOSPF8YHMB0JtanFNign0n4Zush3ZV6Y+//LYtMZGmZL9bRO X2qA== 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=kmRhDDffPQ3u4k3r6NKnW2dwZVyoj2QlYqsqHxGdTVI=; b=UAoBsBBrQ8qu79pqaEjFDuelsn2WRFCptavOo6/dsWG7NVaKvHaefpExRdHhmj8uh7 fp9sLXqueDIuNR/UX6bD6ASG2LOuIC6o4tyMD4IKSh/FAWpcD03mWOLNdrmDhs5jffla B9CFHVe2GeCqof2clajSjvGK6r8UJmaznSdkLTeErO68VLbWs48lNBXPDFVVuuI5oITj gnReIQFssiPXVvCPeEnKztnzcg+QhE7hbBpAy3P0cWb3rfa5SLfIQi2gqWaGwZuUaSDd W+w6ITHBa+r4PXgzLXJn9OOoPl6deoXyE16sKMKP26mqjF7eXlQcBra1hUC8qN5aI+mQ WqZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GJyiQIZ3; 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 q13si10646979pls.284.2019.03.27.12.16.34; Wed, 27 Mar 2019 12:16:50 -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=GJyiQIZ3; 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 S2388051AbfC0SJP (ORCPT + 99 others); Wed, 27 Mar 2019 14:09:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:51006 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727657AbfC0SJL (ORCPT ); Wed, 27 Mar 2019 14:09:11 -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 4190F21741; Wed, 27 Mar 2019 18:09:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710151; bh=XDU3pDaFS7FxDL2zKOud1zsUh802XoB4iGdwjkrHUHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GJyiQIZ3eloqnBDSb4npB9OYNmoyh235kW89y/HXSMa1QOMP89jXWZd8RyWhcFBsH gcFPDAwhlQCjF1kGy+uXedXDi0LVKmcji+iS+xl1H9Apa7uMatjli5n3SfH1dpbg9N YkpY5wuREhp4i7Q6W8q4cDFY8281iYbsWMmWlHoA= 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 5.0 219/262] HID: intel-ish: ipc: handle PIMR before ish_wakeup also clear PISR busy_clear bit Date: Wed, 27 Mar 2019 14:01:14 -0400 Message-Id: <20190327180158.10245-219-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-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 742191bb24c6..45e33c7ba9a6 100644 --- a/drivers/hid/intel-ish-hid/ipc/ipc.c +++ b/drivers/hid/intel-ish-hid/ipc/ipc.c @@ -91,7 +91,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; @@ -839,11 +842,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