From patchwork Mon May 6 03:23:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 2521951 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 73B01DFB79 for ; Mon, 6 May 2013 03:29:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752859Ab3EFD3X (ORCPT ); Sun, 5 May 2013 23:29:23 -0400 Received: from mga09.intel.com ([134.134.136.24]:58746 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752135Ab3EFD3W (ORCPT ); Sun, 5 May 2013 23:29:22 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 05 May 2013 20:27:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,618,1363158000"; d="scan'208";a="332257719" Received: from lantianyu-ws.sh.intel.com (HELO localhost) ([10.239.36.18]) by orsmga002.jf.intel.com with ESMTP; 05 May 2013 20:29:21 -0700 From: Lan Tianyu To: rjw@sisk.pl, lenb@kernel.org Cc: Lan Tianyu , linux-acpi@vger.kernel.org Subject: [FIX PATCH] ACPI/EC: Restart transaction even when IBF flag setting Date: Mon, 6 May 2013 11:23:40 +0800 Message-Id: <1367810620-9369-1-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Some time, EC works abnormally with IBF flag always setting. IBF means "The host has written a byte of data to the command or data port, but the embedded controller has not yet read it". This will cause all EC requests to be failed with timeout error. After several trials, find restarting transaction with IBF flag setting can make EC work again. This patch is to remove the IBF flag check before restarting transaction and increase the repeat number to 5. Some time, once restart is not enough. This bug happens on the different machines. (e.g Asus V1S, Dell Latitude E6530, Samsung R719, Acer Aspire 5930G, Sony Vaio SR19VN and so on). Related bugs: https://bugzilla.kernel.org/show_bug.cgi?id=14733 https://bugzilla.kernel.org/show_bug.cgi?id=15560 https://bugzilla.kernel.org/show_bug.cgi?id=15946 https://bugzilla.kernel.org/show_bug.cgi?id=42945 https://bugzilla.kernel.org/show_bug.cgi?id=48221 Signed-off-by: Lan Tianyu --- drivers/acpi/ec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index d45b287..edc0081 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -223,7 +223,7 @@ static int ec_check_sci_sync(struct acpi_ec *ec, u8 state) static int ec_poll(struct acpi_ec *ec) { unsigned long flags; - int repeat = 2; /* number of command restarts */ + int repeat = 5; /* number of command restarts */ while (repeat--) { unsigned long delay = jiffies + msecs_to_jiffies(ec_delay); @@ -241,8 +241,6 @@ static int ec_poll(struct acpi_ec *ec) } advance_transaction(ec, acpi_ec_read_status(ec)); } while (time_before(jiffies, delay)); - if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) - break; pr_debug(PREFIX "controller reset, restart transaction\n"); spin_lock_irqsave(&ec->lock, flags); start_transaction(ec);