From patchwork Thu Sep 27 20:09:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11826 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 EB9CA24140 for ; Thu, 27 Sep 2012 20:10:34 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 96747A18351 for ; Thu, 27 Sep 2012 20:10:34 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so5234855iej.11 for ; Thu, 27 Sep 2012 13:10:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=JL4d7t6zziFB8brvR0QLg75gzFwTiui5CMmOg/Ad3yk=; b=BnhZtlDPevUBHtKOXNTcAtGyuc0cU7y0XButkOIFQHw7bJM8pjah9KMdNypzEquzYM JBCb78qpUywV29fGjwZnFyWNr8wbaQU792MEAiKkkMxIstcHbWRPcTAEwjzkb8XNFpQf uMGyngajNWt8zV2nVAp50ukCHl5DFdbKgybQdefY8WRA1YGb6MbjGxcb4PN6cyhM9QEW n+Bb/MKxBCVT2NT9H1lPIXkbYXlqGubpufwRTZOk4v18XDnM1X6leu3buqAMsyfZSvR2 NO2fhxs6MCP30RN2sS7sNL45GFIECvFCUtUtG6TPRh8zwfNJUFynnb+cRW9Nl8iUoKy8 QXDg== Received: by 10.50.217.229 with SMTP id pb5mr4700618igc.28.1348776634234; Thu, 27 Sep 2012 13:10:34 -0700 (PDT) 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.50.184.232 with SMTP id ex8csp436412igc; Thu, 27 Sep 2012 13:10:33 -0700 (PDT) Received: by 10.68.195.195 with SMTP id ig3mr14666347pbc.108.1348776633646; Thu, 27 Sep 2012 13:10:33 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id pi9si5467641pbb.12.2012.09.27.13.10.33 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:10:33 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) smtp.mail=mathieu.poirier@linaro.org Received: by mail-pb0-f50.google.com with SMTP id md4so1686045pbc.37 for ; Thu, 27 Sep 2012 13:10:33 -0700 (PDT) Received: by 10.68.204.169 with SMTP id kz9mr14529260pbc.39.1348776633419; Thu, 27 Sep 2012 13:10:33 -0700 (PDT) Received: from localhost.localdomain (S0106002369de4dac.cg.shawcable.net. [70.73.24.112]) by mx.google.com with ESMTPS id sa2sm1587890pbc.4.2012.09.27.13.10.32 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:10:32 -0700 (PDT) From: mathieu.poirier@linaro.org To: patches@linaro.org Subject: [PATCH 54/57] power: ab8500_charger: Use USBLink1Status Register Date: Thu, 27 Sep 2012 14:09:11 -0600 Message-Id: <1348776554-10019-55-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1348776554-10019-1-git-send-email-mathieu.poirier@linaro.org> References: <1348776554-10019-1-git-send-email-mathieu.poirier@linaro.org> X-Gm-Message-State: ALoCoQkZJ6I8UmDXopy18/QmFLfsSd+AwZ5n8/pm8KQtwC4Tw7EeQe/FHI9GgM/0+/OTgnR6UJm1 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: Mathieu Poirier Reviewed-by: Hakan BERG Reviewed-by: Yang QU Reviewed-by: Jonas ABERG --- drivers/power/ab8500_charger.c | 22 ++++++++++++++++------ 1 files changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c index 3a97012..7f8f362 100644 --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c @@ -2258,8 +2258,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 @@ -2299,10 +2304,15 @@ static void ab8500_charger_usb_link_status_work(struct work_struct *work) 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;