From: m18063 <Claudiu.Beznea@microchip.com>
To: Zhi Mao <zhi.mao@mediatek.com>,
john@phrozen.org, Thierry Reding <thierry.reding@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
linux-pwm@vger.kernel.org
Cc: zhenbao.liu@mediatek.com, devicetree@vger.kernel.org,
srv_heupstream@mediatek.com, sean.wang@mediatek.com,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
yt.shen@mediatek.com, yingjoe.chen@mediatek.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 5/6] pwm: mediatek: add PWM_CLK_DIV_MAX
Date: Mon, 26 Jun 2017 11:43:01 +0300 [thread overview]
Message-ID: <8eaabcb6-c7b1-efcc-7dae-967a38feb8f1@microchip.com> (raw)
In-Reply-To: <1498194505-30930-6-git-send-email-zhi.mao@mediatek.com>
On 23.06.2017 08:08, Zhi Mao wrote:
> 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) {
You forgot to:
mtk_pwm_clk_disable(chip, pwm);
> + 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);
>
next prev parent reply other threads:[~2017-06-26 8:43 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
[not found] ` <1498194505-30930-5-git-send-email-zhi.mao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2017-06-26 19:04 ` Rob Herring
2017-06-23 5:08 ` [PATCH v2 5/6] pwm: mediatek: add PWM_CLK_DIV_MAX Zhi Mao
2017-06-26 8:43 ` m18063 [this message]
[not found] ` <8eaabcb6-c7b1-efcc-7dae-967a38feb8f1-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
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=8eaabcb6-c7b1-efcc-7dae-967a38feb8f1@microchip.com \
--to=claudiu.beznea@microchip.com \
--cc=devicetree@vger.kernel.org \
--cc=john@phrozen.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pwm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=robh+dt@kernel.org \
--cc=sean.wang@mediatek.com \
--cc=srv_heupstream@mediatek.com \
--cc=thierry.reding@gmail.com \
--cc=yingjoe.chen@mediatek.com \
--cc=yt.shen@mediatek.com \
--cc=zhenbao.liu@mediatek.com \
--cc=zhi.mao@mediatek.com \
/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;
as well as URLs for NNTP newsgroup(s).