From patchwork Mon Jan 21 12:03:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 14166 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 58A7023E33 for ; Mon, 21 Jan 2013 12:05:11 +0000 (UTC) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by fiordland.canonical.com (Postfix) with ESMTP id F0207A18E14 for ; Mon, 21 Jan 2013 12:05:10 +0000 (UTC) Received: by mail-vb0-f54.google.com with SMTP id l1so5592175vba.41 for ; Mon, 21 Jan 2013 04:05:10 -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=TJkZ76mVadyV4MBBDLkT3eAD/Pq024TuJlD3YKNK5Ug=; b=gqBhg5IdyRxHaeY5OQU8xNGkOmPfba6/pc29NtgSTTDbZgpY8fyF4NwBwbjTO2hVfw waBW7bin5nz6KnZuA5G6dSUNAYguuVND89cti5tDZd9F5jTNorSWCiUzhoY5zI8FXnjt S1e3B4BLiv+kCjHGgwN6YyrbMec4ZRScDhPlf05Of71mfO+1ss832YiDCdM4WsfSLP1x EMS6U+mxLU/Amwmh6qI9giPXaRqRU67PYfWD/xf7BbA5+zyRoFgfecDIFXT7lnP8+u6S dgve4LUYF/M10lzvCTJYwc/0lkzUEaB6gW1HHdLH/qYxveW4+o6Qodyzoc/z0LT3aXU+ MOLw== X-Received: by 10.52.97.7 with SMTP id dw7mr16814966vdb.38.1358769910525; Mon, 21 Jan 2013 04:05:10 -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.58.145.101 with SMTP id st5csp197748veb; Mon, 21 Jan 2013 04:05:10 -0800 (PST) X-Received: by 10.194.71.244 with SMTP id y20mr25852727wju.19.1358769900331; Mon, 21 Jan 2013 04:05:00 -0800 (PST) Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com [74.125.82.44]) by mx.google.com with ESMTPS id ew20si3819031wid.14.2013.01.21.04.05.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Jan 2013 04:05:00 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.44 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.44; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.44 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-wg0-f44.google.com with SMTP id dr12so3595043wgb.11 for ; Mon, 21 Jan 2013 04:05:00 -0800 (PST) X-Received: by 10.180.33.44 with SMTP id o12mr15033237wii.28.1358769899944; Mon, 21 Jan 2013 04:04:59 -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 i2sm16575305wiw.3.2013.01.21.04.04.58 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Jan 2013 04:04:59 -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, anton.vorontsov@linaro.org, cbou@mail.ru, Jonas Aaberg , Lee Jones Subject: [PATCH 21/24] ab8500-charger: Do not touch VBUSOVV bits Date: Mon, 21 Jan 2013 12:03:57 +0000 Message-Id: <1358769840-4763-22-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1358769840-4763-1-git-send-email-lee.jones@linaro.org> References: <1358769840-4763-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQm4dWTNohT+SR82+tQGZ4AeGU5Htd8DyMZK5we4AjRmAa8BJ9KlPh4G/xD8z/7lhf1jMOfu From: Jonas Aaberg Do not touch the VBUSOVV in USBCHTRL2 when running on AB8505. Signed-off-by: Lee Jones Signed-off-by: Jonas Aaberg Reviewed-by: Marcus COOPER Tested-by: Mian Yousaf KAUKAB --- drivers/power/ab8500_charger.c | 22 ++++++++++++++++------ include/linux/mfd/abx500/ab8500.h | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c index a632b94..871bf5a 100644 --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c @@ -2671,13 +2671,23 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) } } - /* VBUS OVV set to 6.3V and enable automatic current limitiation */ - ret = abx500_set_register_interruptible(di->dev, - AB8500_CHARGER, - AB8500_USBCH_CTRL2_REG, - VBUS_OVV_SELECT_6P3V | VBUS_AUTO_IN_CURR_LIM_ENA); + if (is_ab9540_2p0(di->parent) || is_ab8505_2p0(di->parent)) + ret = abx500_mask_and_set_register_interruptible(di->dev, + AB8500_CHARGER, + AB8500_USBCH_CTRL2_REG, + VBUS_AUTO_IN_CURR_LIM_ENA, + VBUS_AUTO_IN_CURR_LIM_ENA); + else + /* + * VBUS OVV set to 6.3V and enable automatic current limitation + */ + ret = abx500_set_register_interruptible(di->dev, + AB8500_CHARGER, + AB8500_USBCH_CTRL2_REG, + VBUS_OVV_SELECT_6P3V | VBUS_AUTO_IN_CURR_LIM_ENA); if (ret) { - dev_err(di->dev, "failed to set VBUS OVV\n"); + dev_err(di->dev, + "failed to set automatic current limitation\n"); goto out; } diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h index 9dd9b99..b9a6a84 100644 --- a/include/linux/mfd/abx500/ab8500.h +++ b/include/linux/mfd/abx500/ab8500.h @@ -346,4 +346,23 @@ static inline int is_ab8500_2p0(struct ab8500 *ab) return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0)); } +static inline int is_ab8505_1p0_or_earlier(struct ab8500 *ab) +{ + return (is_ab8505(ab) && (ab->chip_id <= AB8500_CUT1P0)); +} + +static inline int is_ab8505_2p0(struct ab8500 *ab) +{ + return (is_ab8505(ab) && (ab->chip_id == AB8500_CUT2P0)); +} + +static inline int is_ab9540_1p0_or_earlier(struct ab8500 *ab) +{ + return (is_ab9540(ab) && (ab->chip_id <= AB8500_CUT1P0)); +} + +static inline int is_ab9540_2p0(struct ab8500 *ab) +{ + return (is_ab9540(ab) && (ab->chip_id == AB8500_CUT2P0)); +} #endif /* MFD_AB8500_H */