From 0f48eedacf1914c000c7bebdc44de15412baa6f1 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Tue, 12 Jan 2016 18:28:51 +0100 Subject: regulator: da9210: fix lockdep warning Commit 70cfef26267474 ("regulator: Add lockdep asserts to help detecting locking misuse") successfully created this WARN, let's fix it: [ 1.218660] WARNING: CPU: 0 PID: 553 at drivers/regulator/core.c:3646 regulator_notifier_call_chain+0x5c/0x88() ... [ 1.220278] [] (regulator_notifier_call_chain) from [] (da9210_irq_handler+0x74/0x10c) [ 1.220412] r7:c0080cac r6:eb1daa00 r5:e64bbf10 r4:00000002 [ 1.220547] [] (da9210_irq_handler) from [] (irq_thread_fn+0x2c/0x44) ... Signed-off-by: Wolfram Sang Signed-off-by: Mark Brown diff --git a/drivers/regulator/da9210-regulator.c b/drivers/regulator/da9210-regulator.c index b351783..cfd6e8a 100644 --- a/drivers/regulator/da9210-regulator.c +++ b/drivers/regulator/da9210-regulator.c @@ -132,6 +132,8 @@ static irqreturn_t da9210_irq_handler(int irq, void *data) if (error < 0) goto error_i2c; + mutex_lock(&chip->rdev->mutex); + if (val & DA9210_E_OVCURR) { regulator_notifier_call_chain(chip->rdev, REGULATOR_EVENT_OVER_CURRENT, @@ -155,6 +157,9 @@ static irqreturn_t da9210_irq_handler(int irq, void *data) NULL); handled |= DA9210_E_VMAX; } + + mutex_unlock(&chip->rdev->mutex); + if (handled) { /* Clear handled events */ error = regmap_write(chip->regmap, DA9210_REG_EVENT_B, handled); -- cgit v0.10.2 From e0d9b7c45d987d94674d98ef2b74cbe657e00230 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Fri, 29 Jan 2016 13:09:00 -0300 Subject: regulator: max77802: Fix DT binding document reference The DT binding doc references the max77802 clocks header file which makes no sense since of course it doesn't contain data related to the regulators. It's a copy and paste error, so add a reference to the correct header file. Signed-off-by: Javier Martinez Canillas Signed-off-by: Mark Brown diff --git a/Documentation/devicetree/bindings/regulator/max77802.txt b/Documentation/devicetree/bindings/regulator/max77802.txt index 09d796e..879e98d 100644 --- a/Documentation/devicetree/bindings/regulator/max77802.txt +++ b/Documentation/devicetree/bindings/regulator/max77802.txt @@ -60,7 +60,7 @@ The possible values for "regulator-initial-mode" and "regulator-mode" are: 1: Normal regulator voltage output mode. 3: Low Power which reduces the quiescent current down to only 1uA -The list of valid modes are defined in the dt-bindings/clock/maxim,max77802.h +The valid modes list is defined in the dt-bindings/regulator/maxim,max77802.h header and can be included by device tree source files. The standard "regulator-mode" property can only be used for regulators that -- cgit v0.10.2 From 4434cee9b6e9d70c8afea0d46bb211f132039d19 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 11 Feb 2016 18:17:03 +0800 Subject: regulator: ad5398: Fix return value of ad5398_write_reg i2c_master_send() returns the number of bytes written on success. So current code returns 2 if ad5398_write_reg() success. This return value is propagated to .set_current_limit, .enable and .disable callbacks of regulator_ops. This can be a problem, for example, if the users test if the return value of regulator_set_current_limit() is 0. Fix it by making ad5398_write_reg() return 0 on success. Signed-off-by: Axel Lin Acked-by: Michael Hennerich Signed-off-by: Mark Brown diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c index ea50a88..8b0f788 100644 --- a/drivers/regulator/ad5398.c +++ b/drivers/regulator/ad5398.c @@ -58,10 +58,12 @@ static int ad5398_write_reg(struct i2c_client *client, const unsigned short data val = cpu_to_be16(data); ret = i2c_master_send(client, (char *)&val, 2); - if (ret < 0) + if (ret != 2) { dev_err(&client->dev, "I2C write error\n"); + return ret < 0 ? ret : -EIO; + } - return ret; + return 0; } static int ad5398_get_current_limit(struct regulator_dev *rdev) -- cgit v0.10.2 From 623f7b933968b159081559baca56d98ed4b60e33 Mon Sep 17 00:00:00 2001 From: James Ban Date: Mon, 7 Mar 2016 16:08:20 +0900 Subject: regulator: pv88090: fix incorrect clear of event register This is a patch to fix incorrect clear of event register. Signed-off-by: James Ban Signed-off-by: Mark Brown diff --git a/drivers/regulator/pv88090-regulator.c b/drivers/regulator/pv88090-regulator.c index ac15f31..0057c67 100644 --- a/drivers/regulator/pv88090-regulator.c +++ b/drivers/regulator/pv88090-regulator.c @@ -283,8 +283,8 @@ static irqreturn_t pv88090_irq_handler(int irq, void *data) } } - err = regmap_update_bits(chip->regmap, PV88090_REG_EVENT_A, - PV88090_E_VDD_FLT, PV88090_E_VDD_FLT); + err = regmap_write(chip->regmap, PV88090_REG_EVENT_A, + PV88090_E_VDD_FLT); if (err < 0) goto error_i2c; @@ -300,8 +300,8 @@ static irqreturn_t pv88090_irq_handler(int irq, void *data) } } - err = regmap_update_bits(chip->regmap, PV88090_REG_EVENT_A, - PV88090_E_OVER_TEMP, PV88090_E_OVER_TEMP); + err = regmap_write(chip->regmap, PV88090_REG_EVENT_A, + PV88090_E_OVER_TEMP); if (err < 0) goto error_i2c; -- cgit v0.10.2