pwm: pca9685: Fix wrong argument to set MODE1_SLEEP bit
PATCH 1/1 pwm: pca9685: Fix wrong argument to set MODE1_SLEEP bit
Current code actually does not set MODE1_SLEEP bit because the new value for bitmask (0x1) is wrong. To set MODE1_SLEEP bit, we should pass MODE1_SLEEP as the new value for bitmask.
---
Hi Steffen,
I don't have this hardware, can you test if this patch works? Thanks,
Axel
drivers/pwm/pwm-pca9685.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pwm/pwm-pca9685.c +3 -2
@@ -190,7 +190,7 @@ static void pca9685_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)if (--pca->active_cnt ==0 )regmap_update_bits (pca->regmap,PCA9685_MODE1 ,MODE1_SLEEP , -0x1 ); +MODE1_SLEEP ); }static const struct pwm_ops pca9685_pwm_ops = {
@@ -264,7 +264,8 @@ static int pca9685_pwm_remove(struct i2c_client *client) {struct pca9685 *pca =i2c_get_clientdata (client); -regmap_update_bits (pca->regmap,PCA9685_MODE1 ,MODE1_SLEEP ,0x1 ); +regmap_update_bits (pca->regmap,PCA9685_MODE1 ,MODE1_SLEEP , +MODE1_SLEEP );return pwmchip_remove (&pca->chip); }
Signature · 1 line
1.8.1.2
Quoted 5 lines · Axel Lin
Current code actually does not set
MODE1_SLEEPbit because the new value for bitmask (0x1) is wrong. To setMODE1_SLEEPbit, we should passMODE1_SLEEPas the new value for bitmask.Signed-off-by Axel Lin <[email protected]>
Quoted 8 lines
---
Hi Steffen,
I don't have this hardware, can you test if this patch works? Thanks,
Axeldrivers/pwm/pwm-pca9685.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Steffen,
are you able to test or review this? The patch seems good but I'm not familiar with the hardware nor do I have a board to test it on.
Thierry
Quoted 29 lines
drivers/pwm/pwm-pca9685.c +3
-2@@ -190,7 +190,7 @@ static void pca9685_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)if (--pca->active_cnt ==0 )regmap_update_bits (pca->regmap,PCA9685_MODE1 ,MODE1_SLEEP , -0x1 ); +MODE1_SLEEP ); }static const struct pwm_ops pca9685_pwm_ops = {@@ -264,7 +264,8 @@ static int pca9685_pwm_remove(struct i2c_client *client) {struct pca9685 *pca =i2c_get_clientdata (client); -regmap_update_bits (pca->regmap,PCA9685_MODE1 ,MODE1_SLEEP ,0x1 ); +regmap_update_bits (pca->regmap,PCA9685_MODE1 ,MODE1_SLEEP , +MODE1_SLEEP );return pwmchip_remove (&pca->chip); }Signature · 1 line
1.8.1.2
Steffen Trumtrar
Reviewed-byQuoted 40 lines · Thierry Reding
Quoted 5 lines · Axel Lin
Current code actually does not set
MODE1_SLEEPbit because the new value for bitmask (0x1) is wrong. To setMODE1_SLEEPbit, we should passMODE1_SLEEPas the new value for bitmask.Signed-off-by Axel Lin <[email protected]>Quoted 8 lines
---
Hi Steffen,
I don't have this hardware, can you test if this patch works? Thanks,
Axeldrivers/pwm/pwm-pca9685.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)Steffen,
are you able to test or review this? The patch seems good but I'm not familiar with the hardware nor do I have a board to test it on.
Thierry
Quoted 18 lines
drivers/pwm/pwm-pca9685.c +1
-1@@ -190,7 +190,7 @@ static void pca9685_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)if (--pca->active_cnt ==0 )regmap_update_bits (pca->regmap,PCA9685_MODE1 ,MODE1_SLEEP , -0x1 ); +MODE1_SLEEP ); }static const struct pwm_ops pca9685_pwm_ops = {@@ -264,7 +264,8 @@ static int pca9685_pwm_remove(struct i2c_client *client) {struct pca9685 *pca =i2c_get_clientdata (client);
Quoted 7 lines
drivers/pwm/pwm-pca9685.c static int pca9685_pwm_remove(struct i2c_client *client) · line 271
Quoted 7 lines
drivers/pwm/pwm-pca9685.c +2
-1-regmap_update_bits (pca->regmap,PCA9685_MODE1 ,MODE1_SLEEP ,0x1 ); +regmap_update_bits (pca->regmap,PCA9685_MODE1 ,MODE1_SLEEP , +MODE1_SLEEP );return pwmchip_remove (&pca->chip); }
Hi!
Looks good. I used regmap_update_bits wrong, obviously. I only provided the value (0x1), but did not apply the correct mask to it, which this version (with MODE1_SLEEP) does.
So, you may add my
Thank you Axel for fixing it,
Steffen
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Thierry Reding
AppliedQuoted 5 lines · Axel Lin
Current code actually does not set
MODE1_SLEEPbit because the new value for bitmask (0x1) is wrong. To setMODE1_SLEEPbit, we should passMODE1_SLEEPas the new value for bitmask.Signed-off-by Axel Lin <[email protected]>
Quoted 8 lines
---
Hi Steffen,
I don't have this hardware, can you test if this patch works? Thanks,
Axeldrivers/pwm/pwm-pca9685.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Applied, thanks.
Thierry