From: Sam Shih <sam.shih@mediatek.com>
To: Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Thierry Reding <thierry.reding@gmail.com>
Cc: Ryder Lee <ryder.lee@mediatek.com>,
John Crispin <john@phrozen.org>,
linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
Sam Shih <sam.shih@mediatek.com>
Subject: [PATCH v5 12/13] pwm: mediatek: remove a property "has-clock"
Date: Thu, 22 Aug 2019 14:58:42 +0800 [thread overview]
Message-ID: <1566457123-20791-13-git-send-email-sam.shih@mediatek.com> (raw)
In-Reply-To: <1566457123-20791-1-git-send-email-sam.shih@mediatek.com>
Due to we added clock-frequency property to fix
mt7628 pwm during configure from userspace.
We can alos use this property to determine whether
the complex clock tree exists in the SoC or not.
So we can safety remove has-clock property in the
driver specific data.
Signed-off-by: Sam Shih <sam.shih@mediatek.com>
---
drivers/pwm/pwm-mediatek.c | 26 ++++++++------------------
1 file changed, 8 insertions(+), 18 deletions(-)
diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c
index 290536a92a80..96f592595063 100644
--- a/drivers/pwm/pwm-mediatek.c
+++ b/drivers/pwm/pwm-mediatek.c
@@ -35,7 +35,6 @@
struct pwm_mediatek_of_data {
unsigned int fallback_npwms;
bool pwm45_fixup;
- bool has_clks;
};
/**
@@ -73,7 +72,7 @@ static int pwm_mediatek_clk_enable(struct pwm_chip *chip,
struct pwm_mediatek_chip *pc = to_pwm_mediatek_chip(chip);
int ret;
- if (!pc->soc->has_clks)
+ if (pc->clk_freq)
return 0;
ret = clk_prepare_enable(pc->clk_top);
@@ -103,7 +102,7 @@ static void pwm_mediatek_clk_disable(struct pwm_chip *chip,
{
struct pwm_mediatek_chip *pc = to_pwm_mediatek_chip(chip);
- if (!pc->soc->has_clks)
+ if (pc->clk_freq)
return;
clk_disable_unprepare(pc->clk_pwms[pwm->hwpwm]);
@@ -134,10 +133,10 @@ static int pwm_mediatek_config(struct pwm_chip *chip, struct pwm_device *pwm,
u64 resolution;
int ret;
- if (pc->soc->has_clks)
- clk_freq = clk_get_rate(pc->clk_pwms[pwm->hwpwm]);
- else
+ if (pc->clk_freq)
clk_freq = pc->clk_freq;
+ else
+ clk_freq = clk_get_rate(pc->clk_pwms[pwm->hwpwm]);
ret = pwm_mediatek_clk_enable(chip, pwm);
if (ret < 0)
@@ -222,6 +221,7 @@ static int pwm_mediatek_probe(struct platform_device *pdev)
struct pwm_mediatek_chip *pc;
struct resource *res;
unsigned int npwms;
+ unsigned int clk_freq;
int ret;
pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
@@ -247,7 +247,8 @@ static int pwm_mediatek_probe(struct platform_device *pdev)
}
}
- if (pc->soc->has_clks) {
+ ret = of_property_read_u32(np, "clock-frequency", &clk_freq);
+ if (ret < 0) {
int i;
pc->clk_pwms = devm_kcalloc(&pdev->dev, npwms,
@@ -280,13 +281,6 @@ static int pwm_mediatek_probe(struct platform_device *pdev)
}
}
} else {
- unsigned int clk_freq;
-
- ret = of_property_read_u32(np, "clock-frequency", &clk_freq);
- if (ret < 0) {
- dev_err(&pdev->dev, "failed to get clock_frequency\n");
- return ret;
- }
pc->clk_freq = clk_freq;
}
@@ -316,25 +310,21 @@ static int pwm_mediatek_remove(struct platform_device *pdev)
static const struct pwm_mediatek_of_data mt2712_pwm_data = {
.fallback_npwms = 8,
.pwm45_fixup = false,
- .has_clks = true,
};
static const struct pwm_mediatek_of_data mt7622_pwm_data = {
.fallback_npwms = 6,
.pwm45_fixup = false,
- .has_clks = true,
};
static const struct pwm_mediatek_of_data mt7623_pwm_data = {
.fallback_npwms = 5,
.pwm45_fixup = true,
- .has_clks = true,
};
static const struct pwm_mediatek_of_data mt7628_pwm_data = {
.fallback_npwms = 4,
.pwm45_fixup = true,
- .has_clks = false,
};
static const struct of_device_id pwm_mediatek_of_match[] = {
--
2.17.1
next prev parent reply other threads:[~2019-08-22 6:58 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-22 6:58 [PATCH v5 0/13] Add mt7629 and fix mt7628 pwm Sam Shih
[not found] ` <1566457123-20791-1-git-send-email-sam.shih-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2019-08-22 6:58 ` [PATCH v5 01/13] pwm: mediatek: add a property "num-pwms" Sam Shih
2019-08-24 0:28 ` Uwe Kleine-König
2019-08-22 6:58 ` [PATCH v5 02/13] pwm: mediatek: droping the check for of_device_get_match_data Sam Shih
2019-08-24 0:29 ` Uwe Kleine-König
2019-08-22 6:58 ` [PATCH v5 03/13] pwm: mediatek: add a property "clock-frequency" Sam Shih
2019-08-24 0:32 ` Uwe Kleine-König
2019-08-22 6:58 ` [PATCH v5 04/13] pwm: mediatek: allocate the clks array dynamically Sam Shih
2019-08-24 0:33 ` Uwe Kleine-König
2019-08-22 6:58 ` [PATCH v5 05/13] pwm: mediatek: use pwm_mediatek as common prefix Sam Shih
2019-08-24 0:34 ` Uwe Kleine-König
2019-08-22 6:58 ` [PATCH v5 06/13] pwm: mediatek: update license and switch to SPDX tag Sam Shih
2019-08-24 0:35 ` Uwe Kleine-König
2019-08-22 6:58 ` [PATCH v5 07/13] dt-bindings: pwm: add a property "num-pwms" Sam Shih
2019-08-27 18:39 ` Rob Herring
2019-09-02 16:04 ` Uwe Kleine-König
2019-09-05 3:27 ` Sam Shih
2019-09-12 1:33 ` Sam Shih
2019-08-22 6:58 ` [PATCH v5 08/13] dt-bindings: pwm: update bindings for MT7628 SoC Sam Shih
2019-08-22 8:12 ` Yingjoe Chen
2019-08-24 0:36 ` Uwe Kleine-König
2019-08-22 6:58 ` [PATCH v5 09/13] arm64: dts: mt7622: add a property "num-pwms" for PWM Sam Shih
2019-08-24 0:38 ` Uwe Kleine-König
2019-08-22 6:58 ` [PATCH v5 10/13] arm: dts: mt7623: " Sam Shih
2019-08-24 0:38 ` Uwe Kleine-König
2019-08-22 6:58 ` [PATCH v5 11/13] dt-bindings: pwm: update bindings for MT7629 SoC Sam Shih
2019-08-24 0:39 ` Uwe Kleine-König
2019-08-22 6:58 ` Sam Shih [this message]
2019-08-24 0:41 ` [PATCH v5 12/13] pwm: mediatek: remove a property "has-clock" Uwe Kleine-König
2019-08-22 6:58 ` [PATCH v5 13/13] arm: dts: mediatek: add mt7629 pwm support Sam Shih
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=1566457123-20791-13-git-send-email-sam.shih@mediatek.com \
--to=sam.shih@mediatek.com \
--cc=devicetree@vger.kernel.org \
--cc=john@phrozen.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=ryder.lee@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