From: zhi.mao@mediatek.com (Zhi Mao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 5/6] pwm: mediatek: add PWM_CLK_DIV_MAX
Date: Fri, 23 Jun 2017 13:08:24 +0800 [thread overview]
Message-ID: <1498194505-30930-6-git-send-email-zhi.mao@mediatek.com> (raw)
In-Reply-To: <1498194505-30930-1-git-send-email-zhi.mao@mediatek.com>
Replace "7" with "PWM_CLK_DIV_MAX" in function:mtk_pwm_config()
to improve the code readablity.
Signed-off-by: Zhi Mao <zhi.mao@mediatek.com>
---
drivers/pwm/pwm-mediatek.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c
index 554a042..e5f6425 100644
--- a/drivers/pwm/pwm-mediatek.c
+++ b/drivers/pwm/pwm-mediatek.c
@@ -30,6 +30,8 @@
#define PWMDWIDTH 0x2c
#define PWMTHRES 0x30
+#define PWM_CLK_DIV_MAX 7
+
enum {
MTK_CLK_MAIN = 0,
MTK_CLK_TOP,
@@ -130,8 +132,10 @@ static int mtk_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
clkdiv++;
}
- if (clkdiv > 7)
+ if (clkdiv > PWM_CLK_DIV_MAX) {
+ dev_err(chip->dev, "period %d not supported\n", period_ns);
return -EINVAL;
+ }
mtk_pwm_writel(pc, pwm->hwpwm, PWMCON, BIT(15) | clkdiv);
mtk_pwm_writel(pc, pwm->hwpwm, PWMDWIDTH, period_ns / resolution);
--
1.7.9.5
next prev parent reply other threads:[~2017-06-23 5:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-23 5:08 [PATCH v2 0/6] mediatek: pwm driver add MT2712/MT7622 support Zhi Mao
2017-06-23 5:08 ` [PATCH v2 1/6] pwm: kconfig: modify mediatek information Zhi Mao
2017-06-23 5:08 ` [PATCH v2 2/6] pwm: mediatek: fix pwm source clock selection Zhi Mao
2017-06-23 5:08 ` [PATCH v2 3/6] pwm: mediatek: fix clock control issue Zhi Mao
2017-06-23 5:08 ` [PATCH v2 4/6] pwm: bindings: add MT2712/MT7622 information Zhi Mao
2017-06-26 19:04 ` Rob Herring
2017-06-23 5:08 ` Zhi Mao [this message]
2017-06-26 8:43 ` [PATCH v2 5/6] pwm: mediatek: add PWM_CLK_DIV_MAX m18063
2017-06-27 2:50 ` Zhi Mao
2017-06-23 5:08 ` [PATCH v2 6/6] pwm: mediatek: add MT2712/MT7622 support Zhi Mao
2017-06-23 5:48 ` [PATCH v2 0/6] mediatek: pwm driver " John Crispin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1498194505-30930-6-git-send-email-zhi.mao@mediatek.com \
--to=zhi.mao@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox