From: Zhi Mao <zhi.mao@mediatek.com>
To: John Crispin <john@phrozen.org>
Cc: "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" <linux-pwm@vger.kernel.org>,
"Zhenbao Liu (刘振宝)" <Zhenbao.Liu@mediatek.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
srv_heupstream <srv_heupstream@mediatek.com>,
"Sean Wang (王志亘)" <sean.wang@mediatek.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"YT Shen (沈岳霆)" <Yt.Shen@mediatek.com>,
"Yingjoe Chen (??英洲)" <Yingjoe.Chen@mediatek.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH RESEND 2/4] pwm: mediatek: fix clk issue
Date: Thu, 22 Jun 2017 20:48:07 +0800 [thread overview]
Message-ID: <1498135687.18841.29.camel@mhfsdcap03> (raw)
In-Reply-To: <046facdc-b558-146a-dcfd-0ed98bfeb517@phrozen.org>
On Wed, 2017-06-21 at 20:07 +0800, John Crispin wrote:
> Hi
>
> comments inline
>
>
> > +static int mtk_pwm_clk_enable(struct pwm_chip *chip, struct pwm_device *pwm)
> > +{
> > + ret = clk_prepare_enable(pc->clks[MTK_CLK_PWM1 + pwm->hwpwm]);
> > + if (ret < 0) {
> > + clk_disable_unprepare(pc->clks[MTK_CLK_MAIN]);
> > + clk_disable_unprepare(pc->clks[MTK_CLK_TOP]);
> > + return ret;
> > + }
> > +
> Rather than disabling the already prepared clks in each error path and
> then returning, you should use goto err_clk_{top,main,pwm1} in the same
> style as what this patch removes from mtk_pwm_probe()
>
> > + return ret;
> > +}
> > static inline u32 mtk_pwm_readl(struct mtk_pwm_chip *chip, unsigned int num,
> > unsigned int offset)
> > {
> > @@ -91,10 +128,12 @@ static int mtk_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
> > if (clkdiv > 7)
> > return -EINVAL;
> >
> > - mtk_pwm_writel(pc, pwm->hwpwm, PWMCON, BIT(15) | BIT(3) | clkdiv);
> > + mtk_pwm_writel(pc, pwm->hwpwm, PWMCON, BIT(15) | clkdiv);
>
> this chunk needs to go into its own patch
>
> >
> > @@ -102,11 +141,8 @@ static int mtk_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
> > {
> >
> > - ret = clk_prepare(pc->clks[MTK_CLK_PWM1 + pwm->hwpwm]);
> > - if (ret < 0)
> > - return ret;
> > + mtk_pwm_clk_enable(chip, pwm);
> You need to check the error code here and return if clk enabling failed
>
<....>
Hi John,
For these above comments, I will modified as your suggestions in the
next release.
> >
> >
> > static int mtk_pwm_remove(struct platform_device *pdev)
> > {
> > struct mtk_pwm_chip *pc = platform_get_drvdata(pdev);
> > - unsigned int i;
> > -
> > - for (i = 0; i < pc->chip.npwm; i++)
> > - pwm_disable(&pc->chip.pwms[i]);
> why are you removing this chunk ?
>
> John
>
After refering to some other vendor's pwm driver, we think the
"pwm_disable" is no need, and framework control flow should disable all
the pwms before removing them,
so we remove it.
Regards,
Zhi
> >
> > return pwmchip_remove(&pc->chip);
> > }
>
next prev parent reply other threads:[~2017-06-22 12:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-21 8:11 [PATCH RESEND 0/4] mediatek: pwm driver add MT2712/MT7622 support Zhi Mao
2017-06-21 8:11 ` [PATCH RESEND 1/4] pwm: kconfig: modify mediatek information Zhi Mao
2017-06-21 8:11 ` [PATCH RESEND 2/4] pwm: mediatek: fix clk issue Zhi Mao
2017-06-21 12:07 ` John Crispin
2017-06-22 12:48 ` Zhi Mao [this message]
2017-06-21 8:11 ` [PATCH RESEND 3/4] pwm: bindings: add MT2712/MT7622 information Zhi Mao
2017-06-21 8:11 ` [PATCH RESEND 4/4] pwm: mediatek: add MT2712/MT7622 support Zhi Mao
2017-06-21 12:22 ` John Crispin
[not found] ` <1498111776.18841.10.camel@mhfsdcap03>
2017-06-22 6:12 ` John Crispin
2017-06-22 6:52 ` 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=1498135687.18841.29.camel@mhfsdcap03 \
--to=zhi.mao@mediatek.com \
--cc=Yingjoe.Chen@mediatek.com \
--cc=Yt.Shen@mediatek.com \
--cc=Zhenbao.Liu@mediatek.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 \
/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).