From patchwork Mon Aug 20 12:18:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10802 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 AA89423E56 for ; Mon, 20 Aug 2012 12:18:59 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id DC765A18857 for ; Mon, 20 Aug 2012 12:18:52 +0000 (UTC) Received: by yenl8 with SMTP id l8so5222272yen.11 for ; Mon, 20 Aug 2012 05:18:57 -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:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=iaZ141jri6fz+CaMrCVVYsMlFfrPbcBJADlGCQWt+7U=; b=JY0piWxwLmkJmwO5JZwoZDsYynYf1rKYMCPAX8KB8GGLuWaF/R74Zf1p3SY7cIlQ/k MMxPoZydgkyrZ31Cfp/DRO72YvU0LIpFWq/btU2oMxaUlzzL16H0uNztu5Yqz9naMfAy bCWb+W6yQzESELkOMS7Nvcf+ybVDohheUFk/hwaQMzLDka3lsgmf2CrNj8ildl9K4ZH6 IVr/UJW1EixaeWf5TCoFU7xoCaGvpn6MlbFd6ADA1Ike4C3UZ3Ts3X1cmiGfjYv0p+xm LhGH3ukFORvl7mcNswgddP1LJpTLJRy25u18dXBQCiURZkKpo1wBUkkiy5Ef+3HHyN3r xSbQ== Received: by 10.50.180.129 with SMTP id do1mr9583898igc.28.1345465137443; Mon, 20 Aug 2012 05:18:57 -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 ex8csp80641igc; Mon, 20 Aug 2012 05:18:56 -0700 (PDT) Received: by 10.14.179.200 with SMTP id h48mr8530475eem.12.1345465135787; Mon, 20 Aug 2012 05:18:55 -0700 (PDT) Received: from eu1sys200aog105.obsmtp.com (eu1sys200aog105.obsmtp.com. [207.126.144.119]) by mx.google.com with SMTP id 43si4093525eea.80.2012.08.20.05.18.51 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 20 Aug 2012 05:18:55 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.119 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.119; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.119 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob105.postini.com ([207.126.147.11]) with SMTP ID DSNKUDIrK//cTHagNAyXE5qL2t5cCnWXM+f4@postini.com; Mon, 20 Aug 2012 12:18:55 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id AE68C3A; Mon, 20 Aug 2012 12:18:04 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 9E03C45; Mon, 20 Aug 2012 08:36:51 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 542F224C07C; Mon, 20 Aug 2012 14:18:23 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Mon, 20 Aug 2012 14:18:29 +0200 From: Linus Walleij To: Liam Girdwood , Mark Brown , Cc: Mattias Wallin , Linus Walleij , Axel Lin Subject: [PATCH] regulator: ab8500: fix voltage selector regression Date: Mon, 20 Aug 2012 14:18:17 +0200 Message-ID: <1345465097-31576-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmHDQ9DT53ohDJ8ELO0e8C4SWCMalIMk/Ir6AzSTDA0cfjcCb2V7u+yR24q01hUfinWIYnN From: Linus Walleij Commit 3bf6e90e476fb34ca47b6dda270f41d9cebcb1ac "regulator: Convert ab8499 to use get_voltage_sel()" and commit ae713d394d9e2aacaab620acd3212855f1f06b00 "regulator: Convert ab8500 to set_voltage_sel" corrupted the voltage selector mechanism is two ways: The function for getting the selector stopped respecting the bit shift to get the selector out, and the function for setting the selector hacked in a non-generic kludge that does not scale. Besides, the regulator info struct for the AB8500 already contains the proper shift values. This sanitize the code so it works as expected again. Cc: Axel Lin Signed-off-by: Linus Walleij --- drivers/regulator/ab8500.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 8807166..c659127 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -195,17 +195,14 @@ static int ab8500_regulator_get_voltage_sel(struct regulator_dev *rdev) } dev_vdbg(rdev_get_dev(rdev), - "%s-get_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x," - " 0x%x\n", - info->desc.name, info->voltage_bank, info->voltage_reg, - info->voltage_mask, regval); + "%s-get_voltage (bank, reg, mask, shift, value): " + "0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", + info->desc.name, info->voltage_bank, + info->voltage_reg, info->voltage_mask, + info->voltage_shift, regval); - /* vintcore has a different layout */ val = regval & info->voltage_mask; - if (info->desc.id == AB8500_LDO_INTCORE) - return val >> 0x3; - else - return val; + return val >> info->voltage_shift; } static int ab8500_regulator_set_voltage_sel(struct regulator_dev *rdev, @@ -221,7 +218,7 @@ static int ab8500_regulator_set_voltage_sel(struct regulator_dev *rdev, } /* set the registers for the request */ - regval = (u8)selector; + regval = (u8)selector << info->voltage_shift; ret = abx500_mask_and_set_register_interruptible(info->dev, info->voltage_bank, info->voltage_reg, info->voltage_mask, regval);