* [PATCH RESEND] PWM: ab8500: Fix wrong value shift for disable/enable PWM
@ 2014-04-09 13:19 Axel Lin
2014-05-21 10:30 ` Thierry Reding
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2014-04-09 13:19 UTC (permalink / raw)
To: Thierry Reding
Cc: Linus Walleij, Alexandre BOURDIOL, Philippe Begnic, linux-pwm
Current code only works when pdev->id is 1. Fix it by passing correct bitvalues
argument to abx500_mask_and_set_register_interruptible.
Having DISABLE_PWM/ENABLE_PWM does not make the code better in readability
because the bitvalues depends on pdev->id.
Thus drop defines for DISABLE_PWM/ENABLE_PWM.
This patch also removes a unnecessary return in ab8500_pwm_disable.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Alexandre BOURDIOL <alexandre.bourdiol@st.com>
Acked-by: Philippe Begnic <philippe.begnic@st.com>
---
drivers/pwm/pwm-ab8500.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/pwm/pwm-ab8500.c b/drivers/pwm/pwm-ab8500.c
index 1d07a6f..d51dc15 100644
--- a/drivers/pwm/pwm-ab8500.c
+++ b/drivers/pwm/pwm-ab8500.c
@@ -20,10 +20,6 @@
#define AB8500_PWM_OUT_CTRL2_REG 0x61
#define AB8500_PWM_OUT_CTRL7_REG 0x66
-/* backlight driver constants */
-#define ENABLE_PWM 1
-#define DISABLE_PWM 0
-
struct ab8500_pwm_chip {
struct pwm_chip chip;
};
@@ -64,7 +60,7 @@ static int ab8500_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
ret = abx500_mask_and_set_register_interruptible(chip->dev,
AB8500_MISC, AB8500_PWM_OUT_CTRL7_REG,
- 1 << (chip->base - 1), ENABLE_PWM);
+ 1 << (chip->base - 1), 1 << (chip->base - 1));
if (ret < 0)
dev_err(chip->dev, "%s: Failed to enable PWM, Error %d\n",
pwm->label, ret);
@@ -77,11 +73,10 @@ static void ab8500_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
ret = abx500_mask_and_set_register_interruptible(chip->dev,
AB8500_MISC, AB8500_PWM_OUT_CTRL7_REG,
- 1 << (chip->base - 1), DISABLE_PWM);
+ 1 << (chip->base - 1), 0);
if (ret < 0)
dev_err(chip->dev, "%s: Failed to disable PWM, Error %d\n",
pwm->label, ret);
- return;
}
static const struct pwm_ops ab8500_pwm_ops = {
--
1.8.1.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH RESEND] PWM: ab8500: Fix wrong value shift for disable/enable PWM
2014-04-09 13:19 [PATCH RESEND] PWM: ab8500: Fix wrong value shift for disable/enable PWM Axel Lin
@ 2014-05-21 10:30 ` Thierry Reding
0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2014-05-21 10:30 UTC (permalink / raw)
To: Axel Lin; +Cc: Linus Walleij, Alexandre BOURDIOL, Philippe Begnic, linux-pwm
[-- Attachment #1: Type: text/plain, Size: 807 bytes --]
On Wed, Apr 09, 2014 at 09:19:54PM +0800, Axel Lin wrote:
> Current code only works when pdev->id is 1. Fix it by passing correct bitvalues
> argument to abx500_mask_and_set_register_interruptible.
>
> Having DISABLE_PWM/ENABLE_PWM does not make the code better in readability
> because the bitvalues depends on pdev->id.
> Thus drop defines for DISABLE_PWM/ENABLE_PWM.
>
> This patch also removes a unnecessary return in ab8500_pwm_disable.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> Acked-by: Alexandre BOURDIOL <alexandre.bourdiol@st.com>
> Acked-by: Philippe Begnic <philippe.begnic@st.com>
> ---
> drivers/pwm/pwm-ab8500.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
Applied, thanks.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-21 10:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-09 13:19 [PATCH RESEND] PWM: ab8500: Fix wrong value shift for disable/enable PWM Axel Lin
2014-05-21 10:30 ` Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).