From patchwork Fri Feb 15 12:44:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 14868 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9233123E2E for ; Fri, 15 Feb 2013 12:46:35 +0000 (UTC) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by fiordland.canonical.com (Postfix) with ESMTP id 48587A18715 for ; Fri, 15 Feb 2013 12:46:35 +0000 (UTC) Received: by mail-ve0-f173.google.com with SMTP id oz10so3002895veb.32 for ; Fri, 15 Feb 2013 04:46:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=54N1yjETfAz+0vUCuGsu2HyXvVCcLkm3KXO3UVhveyA=; b=R/V7rZetwvsDNyKpdI0fTXeGvXiwQZBwHk7H1CCjwG4FqKm9HGGk0DwE0nUyeWRLf8 i6a9sHfEBYoVz7tcqzOMHDhLCY5BwnYMx8OizQcqSFwfILxnivuMrbq0gEjdkW+upAhx 3RLH5jPf6Bgs4X4em7v2DLQK2tsFKpG49EytOIdme5m0bs6TJAuW99L8iF846JCrVEwR 8+mHq365nfL/0fG5qjI1M1AMROtPhihtKUokhBnIulru4OBdRnj9TeMUO19oL2CRQtH+ e3itOjXD9ghp1sznEyF2GQRNcQZ6+jUpiI5FSToUActTekYnTMVUkDCx2pZhluuBpjxz GOeg== X-Received: by 10.58.12.200 with SMTP id a8mr2853364vec.52.1360932394621; Fri, 15 Feb 2013 04:46:34 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.221.4.5 with SMTP id oa5csp10880vcb; Fri, 15 Feb 2013 04:46:33 -0800 (PST) X-Received: by 10.180.75.177 with SMTP id d17mr3914378wiw.16.1360932393549; Fri, 15 Feb 2013 04:46:33 -0800 (PST) Received: from mail-we0-x22e.google.com ([2a00:1450:400c:c03::22e]) by mx.google.com with ESMTPS id eb9si1029004wib.115.2013.02.15.04.46.33 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:46:33 -0800 (PST) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22e is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c03::22e; Authentication-Results: mx.google.com; spf=neutral (google.com: 2a00:1450:400c:c03::22e is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-we0-f174.google.com with SMTP id r6so2829955wey.5 for ; Fri, 15 Feb 2013 04:46:33 -0800 (PST) X-Received: by 10.180.80.35 with SMTP id o3mr5833536wix.9.1360932392826; Fri, 15 Feb 2013 04:46:32 -0800 (PST) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPS id bs6sm5133904wib.4.2013.02.15.04.46.30 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:46:31 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, cbouatmailru@gmail.com, sameo@linux.intel.com, Marcus Cooper , Lee Jones Subject: [PATCH 23/40] ab8500-charger: Use USBLink1Status Register Date: Fri, 15 Feb 2013 12:44:53 +0000 Message-Id: <1360932310-30065-24-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360932310-30065-1-git-send-email-lee.jones@linaro.org> References: <1360932310-30065-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQmme2UaAMQr38CltesCFkqnw5WLgPx0gldZUtvXbpW1+g2+blQio1ulpwY4Zye42ILm3suZ From: Marcus Cooper The newer AB's such as the AB8505, AB9540 etc include a USBLink1 Status register which detects a larger range of external devices. This should be used instead of the USBLine Status register. Signed-off-by: Marcus Cooper Signed-off-by: Lee Jones Reviewed-by: Hakan BERG Reviewed-by: Jonas ABERG Tested-by: Yang QU --- drivers/power/ab8500_charger.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c index 6089ee7..bf8b479 100644 --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c @@ -2320,8 +2320,13 @@ static void ab8500_charger_usb_link_status_work(struct work_struct *work) * to start the charging process. but by jumping * thru a few hoops it can be forced to start. */ - ret = abx500_get_register_interruptible(di->dev, AB8500_USB, - AB8500_USB_LINE_STAT_REG, &val); + if (is_ab8500(di->parent)) + ret = abx500_get_register_interruptible(di->dev, AB8500_USB, + AB8500_USB_LINE_STAT_REG, &val); + else + ret = abx500_get_register_interruptible(di->dev, AB8500_USB, + AB8500_USB_LINK1_STAT_REG, &val); + if (ret >= 0) dev_dbg(di->dev, "UsbLineStatus register = 0x%02x\n", val); else @@ -2357,9 +2362,15 @@ static void ab8500_charger_usb_link_status_work(struct work_struct *work) abx500_mask_and_set_register_interruptible(di->dev, AB8500_USB, AB8500_MCH_IPT_CURLVL_REG, 0x01, 0x00); /*Check link status*/ - ret = abx500_get_register_interruptible(di->dev, - AB8500_USB, - AB8500_USB_LINE_STAT_REG, &val); + if (is_ab8500(di->parent)) + ret = abx500_get_register_interruptible(di->dev, + AB8500_USB, AB8500_USB_LINE_STAT_REG, + &val); + else + ret = abx500_get_register_interruptible(di->dev, + AB8500_USB, AB8500_USB_LINK1_STAT_REG, + &val); + dev_dbg(di->dev, "USB link status= 0x%02x\n", (val & link_status) >> USB_LINK_STATUS_SHIFT); di->invalid_charger_detect_state = 2;