From 87b2841753e1694fc96fefb467f6aff9940b07af Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 27 Nov 2013 16:13:10 +0000 Subject: regulator: core: Replace checks of have_full_constraints with a function Simple code reorganisation so we can change the logic for deciding what full constraints are more easily. Signed-off-by: Mark Brown --- drivers/regulator/core.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 6382f0af353b..1f314921774d 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -119,6 +119,11 @@ static const char *rdev_get_name(struct regulator_dev *rdev) return ""; } +static bool have_full_constraints(void) +{ + return has_full_constraints; +} + /** * of_get_regulator - get a regulator device node based on supply name * @dev: Device pointer for the consumer (of regulator) device @@ -1340,7 +1345,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id, * Assume that a regulator is physically present and enabled * even if it isn't hooked up and just provide a dummy. */ - if (has_full_constraints && allow_dummy) { + if (have_full_constraints() && allow_dummy) { pr_warn("%s supply %s not found, using dummy regulator\n", devname, id); @@ -3624,7 +3629,7 @@ int regulator_suspend_finish(void) if (error) ret = error; } else { - if (!has_full_constraints) + if (!have_full_constraints()) goto unlock; if (!ops->disable) goto unlock; @@ -3822,7 +3827,7 @@ static int __init regulator_init_complete(void) if (!enabled) goto unlock; - if (has_full_constraints) { + if (have_full_constraints()) { /* We log since this may kill the system if it * goes wrong. */ rdev_info(rdev, "disabling\n"); -- cgit v1.2.3 From 75bc9641cadd2a3f91f9c2e7f2fdfdeb8bd4b1d6 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 27 Nov 2013 16:22:53 +0000 Subject: regulator: core: Check for DT every time we check full constraints Eliminate the gap between DT becoming available and this being used to say we have full constraints by checking directly for DT every time we check for full constraints. This improves interoperaton with optional regulator support. Signed-off-by: Mark Brown Tested-by: Fabio Estevam --- drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 1f314921774d..6a75794ab20d 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -121,7 +121,7 @@ static const char *rdev_get_name(struct regulator_dev *rdev) static bool have_full_constraints(void) { - return has_full_constraints; + return has_full_constraints || of_have_populated_dt(); } /** -- cgit v1.2.3 From 6389075eff7dc1e6db39203c968394486c13b3e2 Mon Sep 17 00:00:00 2001 From: Vince Hsu Date: Thu, 28 Nov 2013 19:10:42 +0800 Subject: regulator: as3722: set the correct current limit Simple fix to set the correct current limit for SD0/1/6. Signed-off-by: Vince Hsu Signed-off-by: Mark Brown Fixes: bc407334e9a6 (regulator: as3722: add regulator driver for AMS AS3722) Cc: stable@vger.kernel.org --- drivers/regulator/as3722-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c index 5917fe3dc983..b9f1d24c6812 100644 --- a/drivers/regulator/as3722-regulator.c +++ b/drivers/regulator/as3722-regulator.c @@ -590,8 +590,8 @@ static int as3722_sd016_set_current_limit(struct regulator_dev *rdev, default: return -EINVAL; } + ret <<= ffs(mask) - 1; val = ret & mask; - val <<= ffs(mask) - 1; return as3722_update_bits(as3722, reg, mask, val); } -- cgit v1.2.3 From a1b6fa85c639ad0d5447d1a5e7d1463bbe29fcd3 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 9 Dec 2013 15:24:19 +0800 Subject: regulator: pfuze100: Fix address of FABID According to the datasheet, the address of FABID is 0x4. Fix it. Signed-off-by: Axel Lin Acked-by: Robin Gong Signed-off-by: Mark Brown Cc: stable@vger.kernel.org --- drivers/regulator/pfuze100-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c index ba67b2c4e2e7..565a631fff70 100644 --- a/drivers/regulator/pfuze100-regulator.c +++ b/drivers/regulator/pfuze100-regulator.c @@ -38,7 +38,7 @@ #define PFUZE100_DEVICEID 0x0 #define PFUZE100_REVID 0x3 -#define PFUZE100_FABID 0x3 +#define PFUZE100_FABID 0x4 #define PFUZE100_SW1ABVOL 0x20 #define PFUZE100_SW1CVOL 0x2e -- cgit v1.2.3 From 236c427cbc990e03ec8b39ce8ee9220705daeff9 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Tue, 5 Nov 2013 21:17:25 -0800 Subject: regulator: pfuze100: allow misprogrammed ID prior to week 08 of 2013 Freescale misprogrammed between 1 and 3% of PFUZE1000 parts with a ID=0x8 instead of the expected ID=0x0 Signed-off-by: Tim Harvey Signed-off-by: Mark Brown Cc: stable@vger.kernel.org --- drivers/regulator/pfuze100-regulator.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c index 565a631fff70..8b5e4c712a01 100644 --- a/drivers/regulator/pfuze100-regulator.c +++ b/drivers/regulator/pfuze100-regulator.c @@ -308,9 +308,15 @@ static int pfuze_identify(struct pfuze_chip *pfuze_chip) if (ret) return ret; - if (value & 0x0f) { - dev_warn(pfuze_chip->dev, "Illegal ID: %x\n", value); - return -ENODEV; + switch (value & 0x0f) { + /* Freescale misprogrammed 1-3% of parts prior to week 8 of 2013 as ID=8 */ + case 0x8: + dev_info(pfuze_chip->dev, "Assuming misprogrammed ID=0x8"); + case 0x0: + break; + default: + dev_warn(pfuze_chip->dev, "Illegal ID: %x\n", value); + return -ENODEV; } ret = regmap_read(pfuze_chip->regmap, PFUZE100_REVID, &value); -- cgit v1.2.3