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: 2012001 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 16F873FD1A for ; Mon, 21 Jan 2013 12:25:57 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TxGMr-0000Hi-W7; Mon, 21 Jan 2013 12:20:50 +0000 Received: from casper.infradead.org ([85.118.1.10]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TxGMi-0000BO-1X for linux-arm-kernel@merlin.infradead.org; Mon, 21 Jan 2013 12:20:40 +0000 Received: from mail-we0-x232.google.com ([2a00:1450:400c:c03::232]) by casper.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TxG7w-0005lN-DU for linux-arm-kernel@lists.infradead.org; Mon, 21 Jan 2013 12:05:26 +0000 Received: by mail-we0-f178.google.com with SMTP id x48so30880wey.23 for ; Mon, 21 Jan 2013 04:05:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=TJkZ76mVadyV4MBBDLkT3eAD/Pq024TuJlD3YKNK5Ug=; b=NazQrf9YvJh0IEbeWTtnJpK+ccQVrstoUs9SMMnHqq+nhNqpSwP/lv/zjmX1c496XZ m+MiptuqlisKsMvnJJUEXqvt7xCHvxiqkevVkzw7t0e/qHqFH77ev/KzeppPAMM0XDge iafwrZo2ZJCcxhBaqsyDfDISe2sYDGdMJOfOyUqlkWdmmZW8qkJp6lu7ZWoxjz6AL+Ig Z0h0X1BYtgz+WuAN8psJx2ZvPfKhc0mT1k4Kr2TuLkHZsNVfIonnADSr+nfDNanrvjGy xvmM++JzUTo4TKWumfjEDbLuSRqIh/AhjNfcotEZltelz5X8PtYehOhO4mgvEkMOBDmT hNhw== 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 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: ALoCoQnmoeZj8QbC8caPQXizXWwnDiK+HCU45KWQEb/tf+wtYs7bit+HjxeqZj4D6s+qu9LS5pm4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130121_120524_708359_AE8B853A X-CRM114-Status: GOOD ( 13.76 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linus.walleij@stericsson.com, Jonas Aaberg , cbou@mail.ru, anton.vorontsov@linaro.org, arnd@arndb.de, Lee Jones X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 */